fix gpu lathe progress, gpu contour api use
This commit is contained in:
parent
494397706f
commit
9de5457ec4
3 changed files with 7 additions and 6 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue