fix contour Y mutating widget vertex cache
This commit is contained in:
parent
1378160b73
commit
78ef351963
1 changed files with 11 additions and 8 deletions
|
|
@ -51,18 +51,20 @@ export class Topo {
|
||||||
stepsY = Math.ceil(boundsY / resolution),
|
stepsY = Math.ceil(boundsY / resolution),
|
||||||
widtopo = widget.topo,
|
widtopo = widget.topo,
|
||||||
topoCache = widtopo
|
topoCache = widtopo
|
||||||
&& widtopo.resolution === resolution
|
&& widtopo.tolerance === tolerance
|
||||||
&& widtopo.diameter === toolDiameter
|
&& widtopo.diameter === toolDiameter
|
||||||
? widtopo : undefined,
|
? widtopo : undefined,
|
||||||
topo = widget.topo = topoCache || {
|
topo = widget.topo = topoCache || {
|
||||||
|
axis,
|
||||||
data: new Float32Array(new SharedArrayBuffer(stepsX * stepsY * 4)),
|
data: new Float32Array(new SharedArrayBuffer(stepsX * stepsY * 4)),
|
||||||
stepsX: stepsX,
|
stepsX,
|
||||||
stepsY: stepsY,
|
stepsY,
|
||||||
bounds: bounds,
|
bounds,
|
||||||
diameter: toolDiameter,
|
diameter: toolDiameter,
|
||||||
resolution: resolution,
|
resolution,
|
||||||
|
tolerance,
|
||||||
profile: toolOffset,
|
profile: toolOffset,
|
||||||
widget: widget,
|
widget,
|
||||||
raster: true,
|
raster: true,
|
||||||
slices: null
|
slices: null
|
||||||
},
|
},
|
||||||
|
|
@ -120,14 +122,15 @@ export class Topo {
|
||||||
}
|
}
|
||||||
let toolData = { positions: toolPos, bounds: toolBounds };
|
let toolData = { positions: toolPos, bounds: toolBounds };
|
||||||
|
|
||||||
const vertices = widget.getGeoVertices({ unroll: true, translate: true });
|
let vertices = widget.getGeoVertices({ unroll: true, translate: true });
|
||||||
const wbounds = widget.getBoundingBox();
|
let wbounds = widget.getBoundingBox();
|
||||||
if (!inside) {
|
if (!inside) {
|
||||||
wbounds.expandByVector({ x: toolDiameter/2 + resolution, y: toolDiameter/2 + resolution, z: 0 });
|
wbounds.expandByVector({ x: toolDiameter/2 + resolution, y: toolDiameter/2 + resolution, z: 0 });
|
||||||
}
|
}
|
||||||
|
|
||||||
// swap XY vertices (unswap later after polylines generated)
|
// swap XY vertices (unswap later after polylines generated)
|
||||||
if (contourY) {
|
if (contourY) {
|
||||||
|
vertices = vertices.slice();
|
||||||
for (let i=0; i<vertices.length; i+= 3) {
|
for (let i=0; i<vertices.length; i+= 3) {
|
||||||
let tmp = vertices[i+1];
|
let tmp = vertices[i+1];
|
||||||
vertices[i+1] = vertices[i+0];
|
vertices[i+1] = vertices[i+0];
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue