Browse Source

Merge pull request #18083 from WestLangley/dev_apply_matrix

BufferGeometry: properly transform normals and tangents
Mr.doob 5 years ago
parent
commit
771df2c77b
1 changed files with 3 additions and 4 deletions
  1. 3 4
      src/core/BufferGeometry.js

+ 3 - 4
src/core/BufferGeometry.js

@@ -140,7 +140,8 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
 
 			var normalMatrix = new Matrix3().getNormalMatrix( matrix );
 
-			normalMatrix.applyToBufferAttribute( normal );
+			normal.applyNormalMatrix( normalMatrix );
+
 			normal.needsUpdate = true;
 
 		}
@@ -149,10 +150,8 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
 
 		if ( tangent !== undefined ) {
 
-			var normalMatrix = new Matrix3().getNormalMatrix( matrix );
+			tangent.transformDirection( matrix );
 
-			// Tangent is vec4, but the '.w' component is a sign value (+1/-1).
-			normalMatrix.applyToBufferAttribute( tangent );
 			tangent.needsUpdate = true;
 
 		}