fix mirror normals bug
This commit is contained in:
parent
6cc27fd388
commit
8ec7c91613
2 changed files with 4 additions and 12 deletions
1
notes.md
1
notes.md
|
|
@ -3,7 +3,6 @@
|
||||||
## `C` cosmetic, `F` functional, `P` performance, `B` bug fix
|
## `C` cosmetic, `F` functional, `P` performance, `B` bug fix
|
||||||
|
|
||||||
* `B` normals possibly inverted on faces in 2D to 3D conversion
|
* `B` normals possibly inverted on faces in 2D to 3D conversion
|
||||||
* `B` some normals inverted on mirrored parts
|
|
||||||
* `B` normalize left, bottom, right pop menu time/click and value persistence
|
* `B` normalize left, bottom, right pop menu time/click and value persistence
|
||||||
* `B` origin bug (Onshape?) when switching modes in 2.5 and 2.6
|
* `B` origin bug (Onshape?) when switching modes in 2.5 and 2.6
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -273,7 +273,6 @@
|
||||||
// fix invalid normals
|
// fix invalid normals
|
||||||
geometry.computeFaceNormals();
|
geometry.computeFaceNormals();
|
||||||
geometry.computeVertexNormals();
|
geometry.computeVertexNormals();
|
||||||
// to fix mirroring of normals not working as expected
|
|
||||||
mesh.material.side = THREE.DoubleSide;
|
mesh.material.side = THREE.DoubleSide;
|
||||||
mesh.castShadow = true;
|
mesh.castShadow = true;
|
||||||
mesh.receiveShadow = true;
|
mesh.receiveShadow = true;
|
||||||
|
|
@ -512,18 +511,12 @@
|
||||||
PRO._mirror = function() {
|
PRO._mirror = function() {
|
||||||
this.setWireframe(false);
|
this.setWireframe(false);
|
||||||
this.clearSlices();
|
this.clearSlices();
|
||||||
let i,
|
this.mesh.applyMatrix4(new THREE.Matrix4().makeScale(-1, 1, 1));
|
||||||
o = this.track,
|
let geo = this.mesh.geometry,
|
||||||
geo = this.mesh.geometry,
|
o = this.track;
|
||||||
at = geo.attributes,
|
|
||||||
pa = at.position.array,
|
|
||||||
nm = at.normal.array;
|
|
||||||
for (i = 0 ; i < pa.length; i += 3) {
|
|
||||||
pa[i] = -pa[i];
|
|
||||||
nm[i] = -nm[i];
|
|
||||||
}
|
|
||||||
geo.computeFaceNormals();
|
geo.computeFaceNormals();
|
||||||
geo.computeVertexNormals();
|
geo.computeVertexNormals();
|
||||||
|
this.mesh.position.x = -this.mesh.position.x;
|
||||||
o.mirror = !o.mirror;
|
o.mirror = !o.mirror;
|
||||||
this.modified = true;
|
this.modified = true;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue