add notes on how to improve path visuals and speed up compute time

This commit is contained in:
Stewart Allen 2022-09-27 23:35:51 -04:00
commit a15b47c05e
3 changed files with 16 additions and 2 deletions

View file

@ -219,12 +219,13 @@ class Layers {
const one = cur.paths[0];
if (one) {
// merge all contour geometry for massive speed gain
// todo: recode to concat all geometries at once, and not incrementally
const add = one.faces.length / 3;
for (let i=0; i<index.length; i++) {
index[i] += add;
}
const feces = new Float32Array(one.faces.length + faces.length);
const indln = one.index.length;
const indln = one.index.length || one.faces.length / 3;
feces.set(one.faces);
feces.set(faces, one.faces.length);
one.faces = feces;
@ -352,6 +353,18 @@ function ProfiledContourGeometry(profileShape, contour, contourClosed) {
index.push(p8, p7, p5);
}
// unrolled / non-indexed geometry provides a cleaner look because vertex
// shading of indexed geometries looks wrong. this takes longer to re-compute
// so it should be produced unrolled above.
//
// let nufaces = new Float32Array(index.length * 3), ii = 0;
// for (let i of index) {
// nufaces[ii++] = faces[i*3];
// nufaces[ii++] = faces[i*3+1];
// nufaces[ii++] = faces[i*3+2];
// }
// return { index:[], faces: nufaces };
return {index, faces};
}