add more image import options. fix large array appends. optimize shadow in highly detained meshes

This commit is contained in:
Stewart Allen 2020-11-27 14:42:55 -05:00
commit 7292f1c141
7 changed files with 53 additions and 18 deletions

View file

@ -140,10 +140,15 @@
let tslices = [];
let tshadow = [];
let tzindex = slicer.interval(minStepDown, { fit: true, off: 0.01, down: true, flats: true });
let fakeTerrain = false;
if (tzindex.length > 100) {
fakeTerrain = tzindex[0];
tzindex = [ tzindex.pop() ];
}
let terrain = slicer.slice(tzindex, { each: (data, index, total) => {
tshadow = POLY.union(tshadow.appendAll(data.tops), 0.01, true);
tslices.push(data.slice);
if (false) {
if (true) {
const slice = data.slice;
sliceAll.push(slice);
slice.output()
@ -152,6 +157,12 @@
}
updateOp(index, total);
}, genso: true });
if (fakeTerrain) {
// to avoid compute for highly detailed maps, force all
// moves above part top by synthesizing a single terrain slice
terrain[0].z = fakeTerrain.z;
}
let shadowTop = terrain[terrain.length - 1];
let center = tshadow[0].bounds.center();

View file

@ -69,9 +69,9 @@
center = opt.center,
debug = false,
debug_clips = debug && true,
debug_topo = debug && false,
debug_topo_lines = debug && false,
debug_topo_shells = debug && false;
debug_topo = debug && true,
debug_topo_lines = debug && true,
debug_topo_shells = debug && true;
if (tabs) {
clipTab.appendAll(tabs.map(tab => POLY.expand([tab.poly], toolDiameter/2)).flat());