Quellcode durchsuchen

Vector*: Added setScalar.

Mr.doob vor 9 Jahren
Ursprung
Commit
af6a817751
3 geänderte Dateien mit 30 neuen und 0 gelöschten Zeilen
  1. 9 0
      src/math/Vector2.js
  2. 10 0
      src/math/Vector3.js
  3. 11 0
      src/math/Vector4.js

+ 9 - 0
src/math/Vector2.js

@@ -33,6 +33,15 @@ THREE.Vector2.prototype = {
 
 	},
 
+	setScalar: function ( scalar ) {
+
+		this.x = scalar;
+		this.y = scalar;
+
+		return this;
+
+	},
+
 	setX: function ( x ) {
 
 		this.x = x;

+ 10 - 0
src/math/Vector3.js

@@ -29,6 +29,16 @@ THREE.Vector3.prototype = {
 
 	},
 
+	setScalar: function ( scalar ) {
+
+		this.x = scalar;
+		this.y = scalar;
+		this.z = scalar;
+
+		return this;
+
+	},
+
 	setX: function ( x ) {
 
 		this.x = x;

+ 11 - 0
src/math/Vector4.js

@@ -30,6 +30,17 @@ THREE.Vector4.prototype = {
 
 	},
 
+	setScalar: function ( scalar ) {
+
+		this.x = scalar;
+		this.y = scalar;
+		this.z = scalar;
+		this.w = scalar;
+
+		return this;
+
+	},
+
 	setX: function ( x ) {
 
 		this.x = x;