فهرست منبع

Add Vector4.multiply()

Marco Fugaro 4 سال پیش
والد
کامیت
f265b3ed4a
4فایلهای تغییر یافته به همراه26 افزوده شده و 0 حذف شده
  1. 3 0
      docs/api/en/math/Vector4.html
  2. 3 0
      docs/api/zh/math/Vector4.html
  3. 2 0
      src/math/Vector4.d.ts
  4. 18 0
      src/math/Vector4.js

+ 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.
 	 */

+ 18 - 0
src/math/Vector4.js

@@ -227,6 +227,24 @@ class Vector4 {
 
 	}
 
+	multiply( v, w ) {
+
+		if ( w !== undefined ) {
+
+			console.warn( 'THREE.Vector4: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.' );
+			return this.multiplyVectors( v, w );
+
+		}
+
+		this.x *= v.x;
+		this.y *= v.y;
+		this.z *= v.z;
+		this.w *= v.w;
+
+		return this;
+
+	}
+
 	multiplyScalar( scalar ) {
 
 		this.x *= scalar;