瀏覽代碼

Merge pull request #18083 from WestLangley/dev_apply_matrix

BufferGeometry: properly transform normals and tangents
Mr.doob 5 年之前
父節點
當前提交
771df2c77b
共有 1 個文件被更改,包括 3 次插入4 次删除
  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;
 
 		}