add anti-alias levels 2,4,8
This commit is contained in:
parent
7b2769199e
commit
86d3e3a501
7 changed files with 34 additions and 28 deletions
|
|
@ -305,7 +305,7 @@ let gs_kiri_conf = exports;
|
||||||
slaShell: 0.00,
|
slaShell: 0.00,
|
||||||
slaOpenTop: false,
|
slaOpenTop: false,
|
||||||
slaOpenBase: false,
|
slaOpenBase: false,
|
||||||
slaAntiAlias: false,
|
slaAntiAlias: 1,
|
||||||
slaLayerOff: 0.1,
|
slaLayerOff: 0.1,
|
||||||
slaLayerOn: 7,
|
slaLayerOn: 7,
|
||||||
slaPeelDist: 6,
|
slaPeelDist: 6,
|
||||||
|
|
|
||||||
|
|
@ -1542,6 +1542,7 @@ var gs_kiri_cam = exports;
|
||||||
|
|
||||||
// last layer/move is to zmax
|
// last layer/move is to zmax
|
||||||
// injected into the last layer generated
|
// injected into the last layer generated
|
||||||
|
if (lastPoint)
|
||||||
addOutput(newOutput[newOutput.length-1], printPoint = lastPoint.clone().setZ(zmax_outer), 0, 0, tool.number);
|
addOutput(newOutput[newOutput.length-1], printPoint = lastPoint.clone().setZ(zmax_outer), 0, 0, tool.number);
|
||||||
|
|
||||||
// replace output single flattened layer with all points
|
// replace output single flattened layer with all points
|
||||||
|
|
|
||||||
|
|
@ -413,32 +413,31 @@ let gs_kiri_sla = exports;
|
||||||
layerBytes = width * height,
|
layerBytes = width * height,
|
||||||
small = conf.small,
|
small = conf.small,
|
||||||
large = conf.large,
|
large = conf.large,
|
||||||
subcount = process.slaAntiAlias ? 2 : 1;
|
subcount = process.slaAntiAlias ? 2 : 1,
|
||||||
|
masks = [ ];
|
||||||
|
|
||||||
|
for (let l=0; l < subcount; l++) {
|
||||||
|
masks.push((Math.pow(2,8/subcount)-1) << (l * (8/subcount)));
|
||||||
|
}
|
||||||
|
|
||||||
let converted = conf.lines.map((line, index) => {
|
let converted = conf.lines.map((line, index) => {
|
||||||
let count = line.length / 4;
|
let count = line.length / 4;
|
||||||
|
let lineDV = new DataView(line.buffer);
|
||||||
let bits = new Uint8Array(line.length / 4), bits2;
|
let bits = new Uint8Array(line.length / 4), bits2;
|
||||||
let bitsDV = new DataView(bits.buffer), bitsDV2;
|
let bitsDV = new DataView(bits.buffer), bitsDV2;
|
||||||
let lineDV = new DataView(line.buffer);
|
let subs = [{ data: bits, view: bitsDV }];
|
||||||
let subs = [{
|
for (let sl=1; sl<subcount; sl++) {
|
||||||
exposureTime: process.slaLayerOn,
|
bits = bits.slice();
|
||||||
data: bits
|
bitsDV = new DataView(bits.buffer);
|
||||||
}];
|
subs.push({ data: bits, view: bitsDV });
|
||||||
if (subcount === 2) {
|
|
||||||
bits2 = bits.slice();
|
|
||||||
bitsDV2 = new DataView(bits2.buffer);
|
|
||||||
subs.push({
|
|
||||||
exposureTime: process.slaLayerOn,
|
|
||||||
data: bits2
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
// reduce RGB to R
|
// use R from RGB since that was painted on the canvas
|
||||||
|
for (let s=0; s<subcount; s++) {
|
||||||
|
let view = subs[s].view;
|
||||||
|
let mask = masks[s];
|
||||||
for (let i = 0; i < count; i++) {
|
for (let i = 0; i < count; i++) {
|
||||||
// defeat anti-aliasing for the moment
|
let dv = lineDV.getUint8(i * 4) & mask;
|
||||||
let dv = lineDV.getUint8(i * 4);
|
view.setUint8(i, dv > 0 ? 1 : 0);
|
||||||
bitsDV.setUint8(i, dv >= 128 ? 1 : 0);
|
|
||||||
if (subcount === 2) {
|
|
||||||
bitsDV2.setUint8(i, dv > 0 && dv < 128 ? 1 : 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
progress(index / conf.lines.length);
|
progress(index / conf.lines.length);
|
||||||
|
|
|
||||||
|
|
@ -1452,7 +1452,6 @@ var gs_kiri_init = exports;
|
||||||
slaShell: UC.newInput('hollow shell', {title:'shell thickness in mm\nuse multiple of layer height\nuse 0 for solid', convert:UC.toFloat, modes:SLA}),
|
slaShell: UC.newInput('hollow shell', {title:'shell thickness in mm\nuse multiple of layer height\nuse 0 for solid', convert:UC.toFloat, modes:SLA}),
|
||||||
slaOpenTop: UC.newBoolean('open top', onBooleanClick, {title:'solid layers', modes:SLA}),
|
slaOpenTop: UC.newBoolean('open top', onBooleanClick, {title:'solid layers', modes:SLA}),
|
||||||
slaOpenBase: UC.newBoolean('open base', onBooleanClick, {title:'bottom layers', modes:SLA}),
|
slaOpenBase: UC.newBoolean('open base', onBooleanClick, {title:'bottom layers', modes:SLA}),
|
||||||
slaAntiAlias: UC.newBoolean('anti alias', onBooleanClick, {title:'enable anti-aliasing\nproduces larger files', modes:SLA, expert:true}),
|
|
||||||
|
|
||||||
// SLA
|
// SLA
|
||||||
slaOutput: UC.newGroup('layers', null, {modes:SLA, group:"sla-layers"}),
|
slaOutput: UC.newGroup('layers', null, {modes:SLA, group:"sla-layers"}),
|
||||||
|
|
@ -1469,12 +1468,13 @@ var gs_kiri_init = exports;
|
||||||
slaBasePeelDist: UC.newInput('peel distance', {title:'peel distance\nin millimeters', convert:UC.toFloat, modes:SLA}),
|
slaBasePeelDist: UC.newInput('peel distance', {title:'peel distance\nin millimeters', convert:UC.toFloat, modes:SLA}),
|
||||||
slaBasePeelLiftRate: UC.newInput('peel lift rate', {title:'peel lift speed\nin mm/sec', convert:UC.toFloat, modes:SLA}),
|
slaBasePeelLiftRate: UC.newInput('peel lift rate', {title:'peel lift speed\nin mm/sec', convert:UC.toFloat, modes:SLA}),
|
||||||
|
|
||||||
slaFirst: UC.newGroup('first layer', null, {modes:SLA, group:"sla-first", expert:true}),
|
|
||||||
slaFirstOffset: UC.newInput('offset', {title:'first layer offset\nalmost always 0.0\n0.0-1.0 in millimeters', convert:UC.toFloat, bound:UC.bound(0,1), modes:SLA, expert:true}),
|
|
||||||
|
|
||||||
slaFill: UC.newGroup('infill', null, {modes:SLA, group:"sla-first"}),
|
slaFill: UC.newGroup('infill', null, {modes:SLA, group:"sla-first"}),
|
||||||
slaFillDensity: UC.newInput('density', {title:'percent infill\n0.0-1.0', convert:UC.toFloat, bound:UC.bound(0,1), modes:SLA}),
|
slaFillDensity: UC.newInput('density', {title:'percent infill\n0.0-1.0', convert:UC.toFloat, bound:UC.bound(0,1), modes:SLA}),
|
||||||
slaFillLine: UC.newInput('line width', {title:'hatch line width\nin millimeters', convert:UC.toFloat, bound:UC.bound(0,5), modes:SLA}),
|
slaFillLine: UC.newInput('line width', {title:'hatch line width\nin millimeters', convert:UC.toFloat, bound:UC.bound(0,5), modes:SLA}),
|
||||||
|
|
||||||
|
slaOutput: UC.newGroup('output', null, {modes:SLA, group:"sla-first"}),
|
||||||
|
slaFirstOffset: UC.newInput('z offset', {title:'z layer offset\nalmost always 0.0\n0.0-1.0 in millimeters', convert:UC.toFloat, bound:UC.bound(0,1), modes:SLA, expert:true}),
|
||||||
|
slaAntiAlias: UC.newSelect('anti alias', {title: 'enable anti-aliasing\nproduces larger files', modes:SLA}, "antialias"),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!lang_set) {
|
if (!lang_set) {
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,12 @@ self.kiri.copyright = exports.COPYRIGHT;
|
||||||
{ name: "mm" },
|
{ name: "mm" },
|
||||||
{ name: "in" }
|
{ name: "in" }
|
||||||
],
|
],
|
||||||
|
antialias: [
|
||||||
|
{ name: "1", id: 1 },
|
||||||
|
{ name: "2", id: 2 },
|
||||||
|
{ name: "4", id: 4 },
|
||||||
|
{ name: "8", id: 8 }
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
const API = KIRI.api = {
|
const API = KIRI.api = {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
var exports = {
|
var exports = {
|
||||||
COPYRIGHT:"Copyright (C) Stewart Allen <sa@grid.space> - All Rights Reserved",
|
COPYRIGHT:"Copyright (C) Stewart Allen <sa@grid.space> - All Rights Reserved",
|
||||||
LICENSE:"See the license.md file included with the source distribution",
|
LICENSE:"See the license.md file included with the source distribution",
|
||||||
VERSION:"1.8.9"
|
VERSION:"1.9.0"
|
||||||
};
|
};
|
||||||
if (!module) var module = {};
|
if (!module) var module = {};
|
||||||
module.exports = exports;
|
module.exports = exports;
|
||||||
|
|
|
||||||
|
|
@ -667,7 +667,7 @@ var MOTO = window.moto = window.moto || {};
|
||||||
preserveDrawingBuffer: true
|
preserveDrawingBuffer: true
|
||||||
});
|
});
|
||||||
camera = perspective ?
|
camera = perspective ?
|
||||||
new THREE.PerspectiveCamera(perspective, aspect(), 1, 100000) :
|
new THREE.PerspectiveCamera(perspective, aspect(), 5, 100000) :
|
||||||
new THREE.OrthographicCamera(-100 * aspect(), 100 * aspect(), 100, -100, 0.1, 100000);
|
new THREE.OrthographicCamera(-100 * aspect(), 100 * aspect(), 100, -100, 0.1, 100000);
|
||||||
|
|
||||||
camera.position.set(0, 200, 340);
|
camera.position.set(0, 200, 340);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue