ugprade threejs and comment out computeFaceNormals calls

This commit is contained in:
Stewart Allen 2022-01-03 19:58:49 -05:00
commit 9ed88bb938
6 changed files with 10 additions and 12 deletions

View file

@ -33,7 +33,7 @@
"moment": "^2.24.0", "moment": "^2.24.0",
"pixi.js": "^4.8.9", "pixi.js": "^4.8.9",
"serve-static": "^1.14.1", "serve-static": "^1.14.1",
"three": "^0.128.0", "three": "^0.136.0",
"uglify-es": "3.3.9", "uglify-es": "3.3.9",
"validator": ">=13.7.0", "validator": ">=13.7.0",
"ws": "^7.5.5" "ws": "^7.5.5"

View file

@ -1885,7 +1885,7 @@
DOC.body.classList.add('dark'); DOC.body.classList.add('dark');
} else { } else {
SPACE.platform.setGrid(gridMajor, gridMinor, 0x999999, 0xcccccc); SPACE.platform.setGrid(gridMajor, gridMinor, 0x999999, 0xcccccc);
SPACE.platform.opacity(0.3); SPACE.platform.opacity(0.2);
SPACE.sky.setColor(0xffffff); SPACE.sky.setColor(0xffffff);
DOC.body.classList.remove('dark'); DOC.body.classList.remove('dark');
} }

View file

@ -161,7 +161,7 @@
} else { } else {
geo.setAttribute('position', new THREE.BufferAttribute(faces, 3)); geo.setAttribute('position', new THREE.BufferAttribute(faces, 3));
} }
geo.computeFaceNormals(); // geo.computeFaceNormals();
geo.computeVertexNormals(); geo.computeVertexNormals();
if (cface) { if (cface) {
cface.forEach((c, i) => geo.addGroup(c.start, c.count, i)); cface.forEach((c, i) => geo.addGroup(c.start, c.count, i));
@ -189,7 +189,7 @@
const geo = new THREE.BufferGeometry(); const geo = new THREE.BufferGeometry();
geo.setAttribute('position', new THREE.BufferAttribute(faces, 3)); geo.setAttribute('position', new THREE.BufferAttribute(faces, 3));
geo.setIndex(index); geo.setIndex(index);
geo.computeFaceNormals(); // geo.computeFaceNormals();
geo.computeVertexNormals(); geo.computeVertexNormals();
if (cpath) { if (cpath) {
cpath.forEach((c, i) => geo.addGroup(c.start, c.count, i)); cpath.forEach((c, i) => geo.addGroup(c.start, c.count, i));

View file

@ -350,7 +350,7 @@ console.log/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
geo.setAttribute('position', new THREE.BufferAttribute(vertices, 3)); geo.setAttribute('position', new THREE.BufferAttribute(vertices, 3));
geo.setAttribute('normal', undefined); geo.setAttribute('normal', undefined);
geo.attributes.position.needsUpdate = true; geo.attributes.position.needsUpdate = true;
geo.computeFaceNormals(); // geo.computeFaceNormals();
geo.computeVertexNormals(); geo.computeVertexNormals();
this.meta.vertices = vertices.length / 3; this.meta.vertices = vertices.length / 3;
this.points = null; this.points = null;
@ -459,7 +459,7 @@ console.log/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
); );
mesh.renderOrder = 1; mesh.renderOrder = 1;
// fix invalid normals // fix invalid normals
geometry.computeFaceNormals(); // geometry.computeFaceNormals();
geometry.computeVertexNormals(); geometry.computeVertexNormals();
mesh.material.side = THREE.DoubleSide; mesh.material.side = THREE.DoubleSide;
mesh.castShadow = true; mesh.castShadow = true;
@ -740,7 +740,7 @@ console.log/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
arr[i*3+8] = z; arr[i*3+8] = z;
} }
pos.needsUpdate = true; pos.needsUpdate = true;
geo.computeFaceNormals(); // geo.computeFaceNormals();
geo.computeVertexNormals(); geo.computeVertexNormals();
ot.mirror = !ot.mirror; ot.mirror = !ot.mirror;
this.setModified(); this.setModified();

View file

@ -45,7 +45,7 @@ function init() {
size: { width: 2000, depth: 2000, height: 1, maxz: 300 }, size: { width: 2000, depth: 2000, height: 1, maxz: 300 },
grid: { major: 25, minor: 5, grid: { major: 25, minor: 5,
colorMajor: 0xcccccc, colorMinor: 0xeeeeee, colorMajor: 0xcccccc, colorMinor: 0xeeeeee,
colorX: 0xffaaaa, colorY: 0xaaaaff }, colorX: 0xff7777, colorY: 0x7777ff },
}); });
space.view.setZoom(zoomrev, zoomspd); space.view.setZoom(zoomrev, zoomspd);

View file

@ -290,7 +290,7 @@
{x: width/2, z: depth/2, y: maxz}, {x: width/2, z: depth/2, y: maxz},
{x: -width/2, z: depth/2, y: maxz}, {x: -width/2, z: depth/2, y: maxz},
]; ];
SCENE.add(volume = makeLinesFromPoints(points, 0x888888)); SCENE.add(volume = makeLinesFromPoints(points, 0xdddddd));
showVolume(volumeOn); showVolume(volumeOn);
} }
} }
@ -739,9 +739,7 @@
vrt[vi++] = p.z; vrt[vi++] = p.z;
} }
geo.setAttribute('position', new THREE.BufferAttribute(vrt, 3)); geo.setAttribute('position', new THREE.BufferAttribute(vrt, 3));
return new THREE.LineSegments(geo, new THREE.LineBasicMaterial({ return new THREE.LineSegments(geo, new THREE.LineBasicMaterial({ color }));
color: color
}));
} }
function intersect(objects, recurse) { function intersect(objects, recurse) {