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) {
|
if (webGPU) {
|
||||||
console.log({ tool });
|
|
||||||
// invert tool Z offset for gpu code
|
// invert tool Z offset for gpu code
|
||||||
let toolBounds = new THREE.Box3();
|
let toolBounds = new THREE.Box3();
|
||||||
let toolPos = tool.profile.slice();
|
let toolPos = tool.profile.slice();
|
||||||
|
|
@ -155,6 +154,7 @@ export class Topo {
|
||||||
onProgress(pct) { console.log({ pct }); onupdate(pct/100, 100) }
|
onProgress(pct) { console.log({ pct }); onupdate(pct/100, 100) }
|
||||||
});
|
});
|
||||||
let { numScanlines, pointsPerLine, pathData } = output;
|
let { numScanlines, pointsPerLine, pathData } = output;
|
||||||
|
let { positions, gridWidth } = terrainData;
|
||||||
let xmult = xStep * resolution;
|
let xmult = xStep * resolution;
|
||||||
let ymult = yStep * resolution;
|
let ymult = yStep * resolution;
|
||||||
let xoff = wbounds.min.x;
|
let xoff = wbounds.min.x;
|
||||||
|
|
@ -179,7 +179,7 @@ export class Topo {
|
||||||
let skip = 0;
|
let skip = 0;
|
||||||
let lp;
|
let lp;
|
||||||
for (let p of points) {
|
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) {
|
if (poly.length > 1) {
|
||||||
lines.push(poly);
|
lines.push(poly);
|
||||||
poly = newPolygon().setOpen();
|
poly = newPolygon().setOpen();
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,9 @@ export class Topo {
|
||||||
|
|
||||||
onupdate(0, "lathe");
|
onupdate(0, "lathe");
|
||||||
|
|
||||||
|
const parts = webGPU ? [ 0.8, 0.2 ] : [ 0.25, 0.75 ];
|
||||||
const range = this.range = { min: Infinity, max: -Infinity };
|
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) {
|
for (let slice of slices) {
|
||||||
range.min = Math.min(range.min, slice.z);
|
range.min = Math.min(range.min, slice.z);
|
||||||
|
|
@ -82,7 +83,7 @@ export class Topo {
|
||||||
.addPolys(slice.topPolys());
|
.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");
|
onupdate(1, "lathe");
|
||||||
ondone(lathe);
|
ondone(lathe);
|
||||||
|
|
@ -191,7 +192,8 @@ export class Topo {
|
||||||
boundsOverride.max.x -= offEnd * unit;
|
boundsOverride.max.x -= offEnd * unit;
|
||||||
let terrainData = await gpu.rasterizeModel({
|
let terrainData = await gpu.rasterizeModel({
|
||||||
triangles: vertices,
|
triangles: vertices,
|
||||||
boundsOverride
|
boundsOverride,
|
||||||
|
onProgress(pct) { onupdate(pct/100) }
|
||||||
});
|
});
|
||||||
let output = await gpu.generateToolpaths({
|
let output = await gpu.generateToolpaths({
|
||||||
terrainData,
|
terrainData,
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,6 @@ self.uuid = ((Math.random() * Date.now()) | 0).toString(36);
|
||||||
* @returns {RasterPath}
|
* @returns {RasterPath}
|
||||||
*/
|
*/
|
||||||
self.get_raster_gpu = async function({ mode, resolution, rotationStep }) {
|
self.get_raster_gpu = async function({ mode, resolution, rotationStep }) {
|
||||||
console.log({ mode, resolution, rotationStep });
|
|
||||||
let gpu = new RasterPath({
|
let gpu = new RasterPath({
|
||||||
mode,
|
mode,
|
||||||
resolution,
|
resolution,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue