Переглянути джерело

Merge pull request #21065 from marcofugaro/vec4-multiply

Add Vector4.multiply()
Mr.doob 4 роки тому
батько
коміт
dbf57f8499

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

@@ -241,6 +241,9 @@
 		that value with the corresponding min value.
 		</p>
 
+		<h3>[method:this multiply]( [param:Vector4 v] )</h3>
+		<p>Multiplies this vector by [page:Vector4 v].</p>
+
 		<h3>[method:this multiplyScalar]( [param:Float s] )</h3>
 		<p>Multiplies this vector by scalar [page:Float s].</p>
 

+ 3 - 0
docs/api/zh/math/Vector4.html

@@ -240,6 +240,9 @@
 		则将该值替换为对应的最小值。
 		</p>
 
+		<h3>[method:this multiply]( [param:Vector4 v] )</h3>
+		<p>将该向量与所传入的向量[page:Vector4 v]进行相乘。</p>
+
 		<h3>[method:this multiplyScalar]( [param:Float s] )</h3>
 		<p>将该向量与所传入的标量[page:Float s]进行相乘。</p>
 

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

@@ -107,6 +107,8 @@ export class Vector4 implements Vector {
 	 */
 	subVectors( a: Vector4, b: Vector4 ): this;
 
+	multiply( v: Vector4 ): this;
+
 	/**
 	 * Multiplies this vector by scalar s.
 	 */

+ 11 - 0
src/math/Vector4.js

@@ -227,6 +227,17 @@ class Vector4 {
 
 	}
 
+	multiply( v ) {
+
+		this.x *= v.x;
+		this.y *= v.y;
+		this.z *= v.z;
+		this.w *= v.w;
+
+		return this;
+
+	}
+
 	multiplyScalar( scalar ) {
 
 		this.x *= scalar;