add thin render option. fix cam rendering in cutting move across layer

This commit is contained in:
Stewart Allen 2020-06-10 00:24:07 -04:00
commit 87a34b3eca
4 changed files with 54 additions and 22 deletions

View file

@ -538,6 +538,7 @@
dark: false, dark: false,
expert: false, expert: false,
zoomSpeed: 1.0, zoomSpeed: 1.0,
thinRender: false,
reverseZoom: true, reverseZoom: true,
showOrigin: false, showOrigin: false,
freeLayout: true, freeLayout: true,

View file

@ -88,6 +88,7 @@
control.freeLayout = UI.freeLayout.checked; control.freeLayout = UI.freeLayout.checked;
control.alignTop = UI.alignTop.checked; control.alignTop = UI.alignTop.checked;
control.reverseZoom = UI.reverseZoom.checked; control.reverseZoom = UI.reverseZoom.checked;
control.thinRender = UI.thinRender.checked;
control.dark = UI.dark.checked; control.dark = UI.dark.checked;
SPACE.view.setZoom(control.reverseZoom, control.zoomSpeed); SPACE.view.setZoom(control.reverseZoom, control.zoomSpeed);
platform.layout(); platform.layout();
@ -1241,6 +1242,7 @@
autoLayout: UC.newBoolean(LANG.op_auto_s, booleanSave, {title:LANG.op_auto_l}), autoLayout: UC.newBoolean(LANG.op_auto_s, booleanSave, {title:LANG.op_auto_l}),
freeLayout: UC.newBoolean(LANG.op_free_s, booleanSave, {title:LANG.op_free_l, modes:ALL}), freeLayout: UC.newBoolean(LANG.op_free_s, booleanSave, {title:LANG.op_free_l, modes:ALL}),
reverseZoom: UC.newBoolean(LANG.op_invr_s, booleanSave, {title:LANG.op_invr_l, modes:ALL}), reverseZoom: UC.newBoolean(LANG.op_invr_s, booleanSave, {title:LANG.op_invr_l, modes:ALL}),
thinRender: UC.newBoolean(LANG.op_thin_s, booleanSave, {title:LANG.op_thin_l, modes:ALL}),
units: UC.newSelect(LANG.op_unit_s, {title: LANG.op_unit_l, modes:CAM}, "units"), units: UC.newSelect(LANG.op_unit_s, {title: LANG.op_unit_l, modes:CAM}, "units"),
prefadd: UC.checkpoint(), prefadd: UC.checkpoint(),

View file

@ -404,13 +404,14 @@
* @param {Object} widget to render * @param {Object} widget to render
* @param {number} mode to use to select colors * @param {number} mode to use to select colors
*/ */
function sliceRender(widget, mode) { function sliceRender(widget) {
let slices = widget.slices; let slices = widget.slices;
let settings = widget.settings; let settings = widget.settings;
let extnum = widget.getExtruder(settings); let extnum = widget.getExtruder(settings);
let extarr = settings.device.extruders || []; let extarr = settings.device.extruders || [];
let extinfo = extarr[extnum || 0]; let extinfo = extarr[extnum || 0];
let extoff = (extinfo.extNozzle || 0.4) / 2; let extoff = (extinfo.extNozzle || 0.4) / 2;
let thin = settings.controller.thinRender && settings.mode === 'FDM';
if (!slices) return; if (!slices) return;
@ -448,35 +449,53 @@
tops.forEach(function(top) { tops.forEach(function(top) {
// outline // outline
outline.poly(top.poly, 0xdddddd, true, false); outline.poly(top.poly, 0xdddddd, true, false);
outline.solid(top.poly, 0xcccccc); outline.solid(top.poly, thin ? 0xdddddd : 0xcccccc);
if (top.inner) outline.poly(top.inner, 0xdddddd, true); if (top.inner) outline.poly(top.inner, 0xdddddd, true);
// if (top.thinner) outline.poly(top.thinner, 0x559999, true, null); // if (top.thinner) outline.poly(top.thinner, 0x559999, true, null);
// shells // shells
shells.noodle(top.traces, extoff, 0x88aadd, 0x77bbcc); if (thin) {
shells.poly(top.traces, 0x77bbcc, true);
} else {
shells.noodle(top.traces, extoff, 0x88aadd, 0x77bbcc);
}
if (top.polish) { if (top.polish) {
shells.poly(top.polish.x, 0x880000, true, null); shells.poly(top.polish.x, 0x880000, true);
shells.poly(top.polish.y, 0x880000, true, null); shells.poly(top.polish.y, 0x880000, true);
} }
// solid fill // solid fill
solids.noodle_lines(top.fill_lines, extoff, 0x88aadd, 0x77bbcc, s.z); if (thin) {
solids.lines(top.fill_lines, 0x77bbcc);
} else {
solids.noodle_lines(top.fill_lines, extoff, 0x88aadd, 0x77bbcc, s.z);
}
// sparse fill // sparse fill
if (top.fill_sparse) { if (top.fill_sparse) {
top.fill_sparse.forEach(function(poly) { top.fill_sparse.forEach(function(poly) {
// todo cull polys with single point before this if (thin) {
sparse.noodle_open(poly, extoff, 0x88aadd, 0x77bbcc, s.z); // todo cull polys with single point before this
// poly.render(sparse, 0x0, false, true); if (poly.length > 1) poly.render(sparse, 0x0, false, true);
} else {
sparse.noodle_open(poly, extoff, 0x88aadd, 0x77bbcc, s.z);
}
}); });
} }
// support // support
if (s.supports) { if (s.supports) {
support.noodle(s.supports, extoff, 0x88aadd, 0x77bbcc); if (thin) {
s.supports.forEach(function(poly) { s.supports.forEach(function(poly) {
support.noodle_lines(poly.fills, extoff, 0x88aadd, 0x77bbcc, s.z); support.poly(poly, 0x88aadd, true);
}); support.lines(poly.fills, 0x88aadd);
});
} else {
support.noodle(s.supports, extoff, 0x88aadd, 0x77bbcc);
s.supports.forEach(function(poly) {
support.noodle_lines(poly.fills, extoff, 0x88aadd, 0x77bbcc, s.z);
});
}
} }
}); });
@ -1254,21 +1273,29 @@
scope.output.forEach(function(layerout) { scope.output.forEach(function(layerout) {
let move = [], print = [], cprint; let move = [], print = [], cprint;
layerout.forEach(function(out, index) { layerout.forEach(function(out, index) {
let point = out.point; let point = toPoint(out.point);
if (last) { if (last) {
// drop short segments // drop short segments
if (point.emit === last.emit && UTIL.distSq(last, point) < 0.001 && point.z === last.z) { // if (point.emit === last.emit && UTIL.distSq(last, point) < 0.001 && point.z === last.z) {
return; // return;
} // }
if (out.emit > 0) { if (out.emit > 0) {
if (moving) { if (moving || !cprint) {
let spd = out.speed || 4000; cprint = base.newPolygon().setOpen(true).append(last);
cprint = base.newPolygon().setOpen(true).append(toPoint(last)); print.push({
print.push({speed: spd, poly: cprint, tool:tools[out.tool]}); poly: cprint,
speed: out.speed || 4000,
tool:tools[out.tool]
});
}
try {
cprint.append(point);
} catch (e) {
console.log(e, {cprint});
} }
cprint.append(toPoint(point));
moving = false; moving = false;
} else { } else {
cprint = null;
move.push(last); move.push(last);
move.push(point); move.push(point);
moving = true; moving = true;

View file

@ -129,6 +129,8 @@ kiri.lang['en-us'] = {
op_free_l: "permit dragable layout", op_free_l: "permit dragable layout",
op_invr_s: "invert zoom", op_invr_s: "invert zoom",
op_invr_l: "invert mouse wheel\nscroll zoom", op_invr_l: "invert mouse wheel\nscroll zoom",
op_thin_s: "thin lines",
op_thin_l: "faster part visualization",
op_unit_s: "units", op_unit_s: "units",
op_unit_l: "workspace units affects\nspeeds and distances", op_unit_l: "workspace units affects\nspeeds and distances",