瀏覽代碼

Added .applyNormalMatrix()

WestLangley 5 年之前
父節點
當前提交
e7f01d89db
共有 3 個文件被更改,包括 11 次插入0 次删除
  1. 3 0
      docs/api/en/math/Vector3.html
  2. 2 0
      src/math/Vector3.d.ts
  3. 6 0
      src/math/Vector3.js

+ 3 - 0
docs/api/en/math/Vector3.html

@@ -113,6 +113,9 @@ var d = a.distanceTo( b );
 		Multiplies this vector (with an implicit 1 in the 4th dimension) and m, and divides by perspective.
 		</p>
 
+		<h3>[method:this applyNormalMatrix]( [param:Matrix3 m] )</h3>
+		<p>Multiplies this vector by normal matrix [page:Matrix3 m] and normalizes the result.</p>
+
 		<h3>[method:this applyQuaternion]( [param:Quaternion quaternion] )</h3>
 		<p>
 		Applies a [page:Quaternion] transform to this vector.

+ 2 - 0
src/math/Vector3.d.ts

@@ -109,6 +109,8 @@ export class Vector3 implements Vector {
 
 	applyMatrix3( m: Matrix3 ): this;
 
+	applyNormalMatrix( m: Matrix3 ): this;
+
 	applyMatrix4( m: Matrix4 ): this;
 
 	applyQuaternion( q: Quaternion ): this;

+ 6 - 0
src/math/Vector3.js

@@ -265,6 +265,12 @@ Object.assign( Vector3.prototype, {
 
 	},
 
+	applyNormalMatrix: function ( m ) {
+
+		return this.applyMatrix3( m ).normalize();
+
+	},
+
 	applyMatrix4: function ( m ) {
 
 		var x = this.x, y = this.y, z = this.z;