diff --git a/src/kiri/mode/cam/topo3.js b/src/kiri/mode/cam/topo3.js index 262fa309..37120093 100644 --- a/src/kiri/mode/cam/topo3.js +++ b/src/kiri/mode/cam/topo3.js @@ -108,7 +108,6 @@ export class Topo { } if (webGPU) { - console.log({ tool }); // invert tool Z offset for gpu code let toolBounds = new THREE.Box3(); let toolPos = tool.profile.slice(); @@ -155,6 +154,7 @@ export class Topo { onProgress(pct) { console.log({ pct }); onupdate(pct/100, 100) } }); let { numScanlines, pointsPerLine, pathData } = output; + let { positions, gridWidth } = terrainData; let xmult = xStep * resolution; let ymult = yStep * resolution; let xoff = wbounds.min.x; @@ -179,7 +179,7 @@ export class Topo { let skip = 0; let lp; for (let p of points) { - if (inside && positions[p.ty * terrain.gridWidth + p.tx] < zBottom - epsilon) { + if (inside && positions[p.ty * gridWidth + p.tx] < zBottom - epsilon) { if (poly.length > 1) { lines.push(poly); poly = newPolygon().setOpen(); diff --git a/src/kiri/mode/cam/topo4.js b/src/kiri/mode/cam/topo4.js index 86cf2a5d..1fd15de6 100644 --- a/src/kiri/mode/cam/topo4.js +++ b/src/kiri/mode/cam/topo4.js @@ -71,8 +71,9 @@ export class Topo { onupdate(0, "lathe"); + const parts = webGPU ? [ 0.8, 0.2 ] : [ 0.25, 0.75 ]; const range = this.range = { min: Infinity, max: -Infinity }; - const slices = this.sliced = await this.slice(scale(onupdate, 0.25, 0)); + const slices = this.sliced = await this.slice(scale(onupdate, parts[0], 0)); for (let slice of slices) { range.min = Math.min(range.min, slice.z); @@ -82,7 +83,7 @@ export class Topo { .addPolys(slice.topPolys()); } - const lathe = await this.lathe(scale(onupdate, 0.75, 0.25)); + const lathe = await this.lathe(scale(onupdate, parts[1], parts[0])); onupdate(1, "lathe"); ondone(lathe); @@ -191,7 +192,8 @@ export class Topo { boundsOverride.max.x -= offEnd * unit; let terrainData = await gpu.rasterizeModel({ triangles: vertices, - boundsOverride + boundsOverride, + onProgress(pct) { onupdate(pct/100) } }); let output = await gpu.generateToolpaths({ terrainData, diff --git a/src/kiri/run/worker.js b/src/kiri/run/worker.js index 27e8b570..f5ebdf5e 100644 --- a/src/kiri/run/worker.js +++ b/src/kiri/run/worker.js @@ -69,7 +69,6 @@ self.uuid = ((Math.random() * Date.now()) | 0).toString(36); * @returns {RasterPath} */ self.get_raster_gpu = async function({ mode, resolution, rotationStep }) { - console.log({ mode, resolution, rotationStep }); let gpu = new RasterPath({ mode, resolution,