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,
|
||||
slaOpenTop: false,
|
||||
slaOpenBase: false,
|
||||
slaAntiAlias: false,
|
||||
slaAntiAlias: 1,
|
||||
slaLayerOff: 0.1,
|
||||
slaLayerOn: 7,
|
||||
slaPeelDist: 6,
|
||||
|
|
|
|||
|
|
@ -1542,6 +1542,7 @@ var gs_kiri_cam = exports;
|
|||
|
||||
// last layer/move is to zmax
|
||||
// injected into the last layer generated
|
||||
if (lastPoint)
|
||||
addOutput(newOutput[newOutput.length-1], printPoint = lastPoint.clone().setZ(zmax_outer), 0, 0, tool.number);
|
||||
|
||||
// replace output single flattened layer with all points
|
||||
|
|
|
|||
|
|
@ -413,32 +413,31 @@ let gs_kiri_sla = exports;
|
|||
layerBytes = width * height,
|
||||
small = conf.small,
|
||||
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 count = line.length / 4;
|
||||
let lineDV = new DataView(line.buffer);
|
||||
let bits = new Uint8Array(line.length / 4), bits2;
|
||||
let bitsDV = new DataView(bits.buffer), bitsDV2;
|
||||
let lineDV = new DataView(line.buffer);
|
||||
let subs = [{
|
||||
exposureTime: process.slaLayerOn,
|
||||
data: bits
|
||||
}];
|
||||
if (subcount === 2) {
|
||||
bits2 = bits.slice();
|
||||
bitsDV2 = new DataView(bits2.buffer);
|
||||
subs.push({
|
||||
exposureTime: process.slaLayerOn,
|
||||
data: bits2
|
||||
});
|
||||
let subs = [{ data: bits, view: bitsDV }];
|
||||
for (let sl=1; sl<subcount; sl++) {
|
||||
bits = bits.slice();
|
||||
bitsDV = new DataView(bits.buffer);
|
||||
subs.push({ data: bits, view: bitsDV });
|
||||
}
|
||||
// reduce RGB to R
|
||||
for (let i = 0; i < count; i++) {
|
||||
// defeat anti-aliasing for the moment
|
||||
let dv = lineDV.getUint8(i * 4);
|
||||
bitsDV.setUint8(i, dv >= 128 ? 1 : 0);
|
||||
if (subcount === 2) {
|
||||
bitsDV2.setUint8(i, dv > 0 && dv < 128 ? 1 : 0);
|
||||
// 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++) {
|
||||
let dv = lineDV.getUint8(i * 4) & mask;
|
||||
view.setUint8(i, dv > 0 ? 1 : 0);
|
||||
}
|
||||
}
|
||||
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}),
|
||||
slaOpenTop: UC.newBoolean('open top', onBooleanClick, {title:'solid 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
|
||||
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}),
|
||||
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"}),
|
||||
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}),
|
||||
|
||||
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) {
|
||||
|
|
|
|||
|
|
@ -132,10 +132,16 @@ self.kiri.copyright = exports.COPYRIGHT;
|
|||
{ name: "triangle" },
|
||||
{ name: "linear" }
|
||||
],
|
||||
units:[
|
||||
units: [
|
||||
{ name: "mm" },
|
||||
{ name: "in" }
|
||||
],
|
||||
antialias: [
|
||||
{ name: "1", id: 1 },
|
||||
{ name: "2", id: 2 },
|
||||
{ name: "4", id: 4 },
|
||||
{ name: "8", id: 8 }
|
||||
]
|
||||
};
|
||||
|
||||
const API = KIRI.api = {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
var exports = {
|
||||
COPYRIGHT:"Copyright (C) Stewart Allen <sa@grid.space> - All Rights Reserved",
|
||||
LICENSE:"See the license.md file included with the source distribution",
|
||||
VERSION:"1.8.9"
|
||||
VERSION:"1.9.0"
|
||||
};
|
||||
if (!module) var module = {};
|
||||
module.exports = exports;
|
||||
|
|
|
|||
|
|
@ -667,7 +667,7 @@ var MOTO = window.moto = window.moto || {};
|
|||
preserveDrawingBuffer: true
|
||||
});
|
||||
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);
|
||||
|
||||
camera.position.set(0, 200, 340);
|
||||
|
|
|
|||
Loading…
Reference in a new issue