reorder auto/manual shadow code blocks, remove belt clip debug
This commit is contained in:
parent
69fdf1a60b
commit
2c6403e865
1 changed files with 17 additions and 13 deletions
|
|
@ -501,11 +501,25 @@ export function sliceOne(settings, widget, onupdate, ondone) {
|
||||||
// since that is done later and clipped to slice.clips
|
// since that is done later and clipped to slice.clips
|
||||||
stack.sort((a,b) => a.z - b.z);
|
stack.sort((a,b) => a.z - b.z);
|
||||||
|
|
||||||
|
// automatic supports
|
||||||
|
if (!manual) {
|
||||||
|
// find where shadow areas begin (async)
|
||||||
|
await widget.computeShadowStack(indices, progress => {
|
||||||
|
trackupdate(progress, div[0].lo, div[0].hi, "shadow");
|
||||||
|
}, zAngNorm, sliceHeight);
|
||||||
|
|
||||||
|
// assign to slices (sync)
|
||||||
|
for (let slice of stack) {
|
||||||
|
slice.shadow = await widget.shadowAt(slice.z, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// process manual supports if they exist
|
// process manual supports if they exist
|
||||||
let { paint } = widget.anno;
|
let { paint } = widget.anno;
|
||||||
let { belt } = widget;
|
let { belt } = widget;
|
||||||
|
|
||||||
// apply belt transformations, if needed
|
// apply belt transformations, if needed
|
||||||
if (belt && paint) {
|
if (manual && belt && paint?.length) {
|
||||||
let { anchor, angle, dy, slope } = belt;
|
let { anchor, angle, dy, slope } = belt;
|
||||||
// make a copy we can modify
|
// make a copy we can modify
|
||||||
paint = structuredClone(paint);
|
paint = structuredClone(paint);
|
||||||
|
|
@ -521,6 +535,7 @@ export function sliceOne(settings, widget, onupdate, ondone) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert paint points to circles on matching slices
|
// convert paint points to circles on matching slices
|
||||||
if (manual && paint?.length) {
|
if (manual && paint?.length) {
|
||||||
let hpi = Math.PI/2;
|
let hpi = Math.PI/2;
|
||||||
|
|
@ -539,17 +554,6 @@ export function sliceOne(settings, widget, onupdate, ondone) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// create automatic shadows supports when on manual paint
|
|
||||||
if (!manual) {
|
|
||||||
await widget.computeShadowStack(indices, progress => {
|
|
||||||
trackupdate(progress, div[0].lo, div[0].hi, "shadow");
|
|
||||||
}, zAngNorm, sliceHeight);
|
|
||||||
|
|
||||||
for (let slice of stack) {
|
|
||||||
slice.shadow = await widget.shadowAt(slice.z, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 1. accumulate / union shadow coverage top down
|
// 1. accumulate / union shadow coverage top down
|
||||||
// 2. trim to area outside slice.clips
|
// 2. trim to area outside slice.clips
|
||||||
let minArea = lineWidth;
|
let minArea = lineWidth;
|
||||||
|
|
@ -597,7 +601,7 @@ export function sliceOne(settings, widget, onupdate, ondone) {
|
||||||
.centerRectangle(newPoint(0, 0, slice.z), boundsx, boundsy)
|
.centerRectangle(newPoint(0, 0, slice.z), boundsx, boundsy)
|
||||||
.move({ x: 0, y: -boundsy / 2 + skewy, z: 0 });
|
.move({ x: 0, y: -boundsy / 2 + skewy, z: 0 });
|
||||||
shadow = POLY.trimTo(shadow, [ clip ]);
|
shadow = POLY.trimTo(shadow, [ clip ]);
|
||||||
if (devel) slice.output().setLayer("belt clip", 0xffff00).addPolys([ clip ]);
|
// if (devel) slice.output().setLayer("belt clip", 0xffff00).addPolys([ clip ]);
|
||||||
}
|
}
|
||||||
slice.supports = shadow;
|
slice.supports = shadow;
|
||||||
// if (devel) slice.output().setLayer("shadow", 0xff0000).addPolys(shadow);
|
// if (devel) slice.output().setLayer("shadow", 0xff0000).addPolys(shadow);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue