Hi, I have a BufferGeometry on which I set a bunch of Vector3 points to create a shape. Additionally I have a mesh with WireframeGeometry set to the same geometry as my shape.
As seen in the screenshot, the wireframe does not follow the edge. I've been changing the order of points to try get it to work, but this seems impossible. It will always show a diagonal and sometimes missing edges.
Ive also tried using EdgeGeometry, geometry.setFromPoints and setIndex with indices, but these results are also unreliable or draw all edges rather than just the outside ones.
How can I get only the outside edges to show in the wireframe?
function updateGeometry() {
// ... calculating point positions
const points = [
left,
leftClipVantage,
fold,
leftClipVantage,
foldClipVantage,
fold,
rightClipVantage,
right,
foldClipVantage,
right,
fold,
foldClipVantage,
]
this.setGeometryPoints(points)
}
setGeometryPoints(geometryPoints: Vector3[]) {
const values = geometryPoints.flatMap(p => [p.x, p.y, p.z])
this.setGeometryValues(values)
this.updateWireframeGeometry()
}
updateWireframeGeometry() {
this.wireframeMesh.geometry = new WireframeGeometry(this.geometry)
this.wireframeMesh.updateMatrixWorld(true)
}
setGeometryValues(geometryValues: Array<number>) {
this.geometry.setAttribute(
'position',
new Float32BufferAttribute(geometryValues, 3)
);
this.geometry.computeVertexNormals();
this.geometry.computeBoundingBox();
this.geometry.computeBoundingSphere();
}