Part geometry for the view
32-bit, display onlyBuilds the triangles and feature lines of a part for drawing.
Positions are expanded to one vertex per triangle corner in a Float32Array for the GPU; normals and bounds are computed by three.js from that buffer. Nothing here is saved or reported.
const geoFor = (mesh) => {
let g = cache.get(mesh);
if (g) return g;
const P = mesh.positions, I = mesh.indices, nt = I.length / 3;
const pos = new Float32Array(nt * 9);
for (let t = 0; t < nt; t++) for (let k = 0; k < 3; k++) for (let c = 0; c < 3; c++) pos[t * 9 + k * 3 + c] = P[I[t * 3 + k] * 3 + c];
const geo = new THREE.BufferGeometry();
geo.setAttribute('position', new THREE.BufferAttribute(pos, 3));
geo.computeVertexNormals(); geo.computeBoundingBox(); geo.computeBoundingSphere();
const eg = new THREE.BufferGeometry();
eg.setAttribute('position', new THREE.BufferAttribute(featureSegments(mesh), 3));
g = { geo, eg };
cache.set(mesh, g);
return g;
};