swap vertices for gpu compute, fix progress
This commit is contained in:
parent
df58e7f465
commit
007d03b629
1 changed files with 11 additions and 1 deletions
|
|
@ -162,11 +162,21 @@ export class Topo {
|
||||||
async sliceGPU(onupdate) {
|
async sliceGPU(onupdate) {
|
||||||
const { angle, linear, offStart, offEnd, resolution, tool, unit, vertices, zBottom } = this;
|
const { angle, linear, offStart, offEnd, resolution, tool, unit, vertices, zBottom } = this;
|
||||||
|
|
||||||
|
// invert tool Z offset for gpu code
|
||||||
let gputool = tool.slice();
|
let gputool = tool.slice();
|
||||||
for (let i=0; i<gputool.length; i+= 3) {
|
for (let i=0; i<gputool.length; i+= 3) {
|
||||||
gputool[i+2] *= -1;
|
gputool[i+2] *= -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.time('swap XZ vertices');
|
||||||
|
// swap XZ vertices for gpu code
|
||||||
|
for (let i=0; i<vertices.length; i+= 3) {
|
||||||
|
let tmp = vertices[i+2];
|
||||||
|
vertices[i+2] = vertices[i+0];
|
||||||
|
vertices[i+0] = tmp;
|
||||||
|
}
|
||||||
|
console.timeEnd('swap XZ vertices');
|
||||||
|
|
||||||
let gpu = await self.get_raster_gpu();
|
let gpu = await self.get_raster_gpu();
|
||||||
let tickperstep = Math.round(this.step / resolution);
|
let tickperstep = Math.round(this.step / resolution);
|
||||||
let bounds = this.bounds.clone();
|
let bounds = this.bounds.clone();
|
||||||
|
|
@ -180,7 +190,7 @@ export class Topo {
|
||||||
zBottom,
|
zBottom,
|
||||||
resolution,
|
resolution,
|
||||||
bounds,
|
bounds,
|
||||||
(pct, msg) => { console.log({ pct, msg }) }
|
{ onProgress(pct, msg) { onupdate(pct/100) } }
|
||||||
);
|
);
|
||||||
|
|
||||||
let { numRotations, pointsPerLine, pathData } = output;
|
let { numRotations, pointsPerLine, pathData } = output;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue