transition support detect from Geometry to BufferGeometry
This commit is contained in:
parent
59878384c9
commit
d230f1e473
1 changed files with 11 additions and 9 deletions
|
|
@ -1269,10 +1269,9 @@
|
||||||
let process = settings.process;
|
let process = settings.process;
|
||||||
let size = process.sliceSupportSize;
|
let size = process.sliceSupportSize;
|
||||||
let min = process.sliceSupportArea || 1;
|
let min = process.sliceSupportArea || 1;
|
||||||
let buf = new THREE.BufferGeometry();
|
let geo = new THREE.BufferGeometry();
|
||||||
buf.setAttribute('position', new THREE.BufferAttribute(widget.vertices, 3));
|
geo.setAttribute('position', new THREE.BufferAttribute(widget.vertices, 3));
|
||||||
let mat = new THREE.MeshBasicMaterial();
|
let mat = new THREE.MeshBasicMaterial();
|
||||||
let geo = new THREE.Geometry().fromBufferGeometry(buf);
|
|
||||||
let rad = (Math.PI / 180);
|
let rad = (Math.PI / 180);
|
||||||
let deg = (180 / Math.PI);
|
let deg = (180 / Math.PI);
|
||||||
let angle = rad * settings.process.sliceSupportAngle;
|
let angle = rad * settings.process.sliceSupportAngle;
|
||||||
|
|
@ -1329,19 +1328,22 @@
|
||||||
} : (f) => {
|
} : (f) => {
|
||||||
return f.normal.z < thresh;
|
return f.normal.z < thresh;
|
||||||
};
|
};
|
||||||
geo.faces.filter(filter).forEach(face => {
|
let position = geo.attributes.position;
|
||||||
let a = geo.vertices[face.a];
|
let { itemSize, count, array } = position;
|
||||||
let b = geo.vertices[face.b];
|
for (let i = 0; i<count; i += 3) {
|
||||||
let c = geo.vertices[face.c];
|
let ip = i * itemSize;
|
||||||
|
let a = new THREE.Vector3(array[ip++], array[ip++], array[ip++]);
|
||||||
|
let b = new THREE.Vector3(array[ip++], array[ip++], array[ip++]);
|
||||||
|
let c = new THREE.Vector3(array[ip++], array[ip++], array[ip++]);
|
||||||
// skip tiny faces
|
// skip tiny faces
|
||||||
if (BASE.newPolygon().addPoints([a,b,c]).area() < min) {
|
if (BASE.newPolygon().addPoints([a,b,c]).area() < min) {
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
tp(new THREE.Vector3().add(a).add(b).add(c).divideScalar(3));
|
tp(new THREE.Vector3().add(a).add(b).add(c).divideScalar(3));
|
||||||
tl(a,b);
|
tl(a,b);
|
||||||
tl(b,c);
|
tl(b,c);
|
||||||
tl(a,c);
|
tl(a,c);
|
||||||
});
|
}
|
||||||
widget.supports = add;
|
widget.supports = add;
|
||||||
return add.length > 0;
|
return add.length > 0;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue