codec and color cleanup

This commit is contained in:
Stewart Allen 2020-11-09 19:22:28 -05:00
commit 1d573b1605
8 changed files with 29 additions and 43 deletions

View file

@ -415,6 +415,10 @@
const cn_len = new Counter();
const cn_col = new Counter();
function color(point) {
return hsv2rgb({h:point.speed / maxspd, s:1, v:0.75}, true);
}
levels.forEach((level, index) => {
const prints = {};
const moves = [];
@ -444,7 +448,7 @@
if (!lastOut.emit || (ckspeed && out.speed !== lastOut.speed)) {
current = newPolygon().setOpen();
current.push(lastOut.point);
current.color = hsv2rgb({h:out.speed/maxspd, s:1, v:0.75}, true);
current.color = color(out);
pushPrint(out.tool, current);
}
current.push(out.point);
@ -460,7 +464,7 @@
current = newPolygon().setOpen();
current.push(out.point);
if (out.emit) {
current.color = hsv2rgb({h:out.speed/maxspd, s:1, v:1}, true);
current.color = color(out);
pushPrint(out.tool, current);
} else {
moves.push(current);

View file

@ -18,9 +18,9 @@
FILL = KIRI.fill,
FILLFIXED = KIRI.fill_fixed,
COLOR = {
shell: { face: 0x003399, line: 0x003399, opacity: 1 },
fill: { face: 0x003399, line: 0x003399, opacity: 1 },
infill: { face: 0x003399, line: 0x003399, opacity: 1 },
shell: { face: 0x0077bb, line: 0x0077bb, opacity: 1 },
fill: { face: 0x0077bb, line: 0x0077bb, opacity: 1 },
infill: { face: 0x0077bb, line: 0x0077bb, opacity: 1 },
support: { face: 0x006699, line: 0x006699, opacity: 1 }
};

View file

@ -17,7 +17,6 @@
slice,
prepare,
export: exportLaser,
printRender,
exportGCode,
exportSVG,
exportDXF
@ -256,8 +255,8 @@
min.y = 0;
} else {
// normalize against center of build area
let w = print.settings.device.bedWidth;
let h = print.settings.device.bedDepth;
let w = settings.device.bedWidth;
let h = settings.device.bedDepth;
output.forEach(function(layer) {
layer.forEach(function(out) {
point = out.point;
@ -495,8 +494,4 @@
return lines.join('\n');
};
function printRender(print) {
return KIRI.driver.FDM.printRender(print, {aslines: true, nomoves: true, flat: true});
}
})();