浏览代码

Fixed some more sub(a,b) to subVectors(a,b).

Mr.doob 12 年之前
父节点
当前提交
db6a79a730

+ 4 - 4
examples/canvas_geometry_birds.html

@@ -183,7 +183,7 @@
 
 
 						var steer = new THREE.Vector3();
 						var steer = new THREE.Vector3();
 
 
-						steer.sub( this.position, target );
+						steer.subVectors( this.position, target );
 						steer.multiplyScalar( 0.5 / distance );
 						steer.multiplyScalar( 0.5 / distance );
 
 
 						_acceleration.add( steer );
 						_acceleration.add( steer );
@@ -196,7 +196,7 @@
 
 
 					var steer = new THREE.Vector3();
 					var steer = new THREE.Vector3();
 
 
-					steer.sub( target, this.position );
+					steer.subVectors( target, this.position );
 					steer.multiplyScalar( amount );
 					steer.multiplyScalar( amount );
 
 
 					return steer;
 					return steer;
@@ -272,7 +272,7 @@
 
 
 					}
 					}
 
 
-					steer.sub( posSum, this.position );
+					steer.subVectors( posSum, this.position );
 
 
 					var l = steer.length();
 					var l = steer.length();
 
 
@@ -301,7 +301,7 @@
 
 
 						if ( distance > 0 && distance <= _neighborhoodRadius ) {
 						if ( distance > 0 && distance <= _neighborhoodRadius ) {
 
 
-							repulse.sub( this.position, boid.position );
+							repulse.subVectors( this.position, boid.position );
 							repulse.normalize();
 							repulse.normalize();
 							repulse.divideScalar( distance );
 							repulse.divideScalar( distance );
 							posSum.add( repulse );
 							posSum.add( repulse );

+ 2 - 2
examples/js/AudioObject.js

@@ -113,8 +113,8 @@ THREE.AudioObject = function ( url, volume, playbackRate, loop ) {
 		soundPosition.copy( this.matrixWorld.getPosition() );
 		soundPosition.copy( this.matrixWorld.getPosition() );
 		cameraPosition.copy( camera.matrixWorld.getPosition() );
 		cameraPosition.copy( camera.matrixWorld.getPosition() );
 
 
-		soundDelta.sub( soundPosition, oldSoundPosition );
-		cameraDelta.sub( cameraPosition, oldCameraPosition );
+		soundDelta.subVectors( soundPosition, oldSoundPosition );
+		cameraDelta.subVectors( cameraPosition, oldCameraPosition );
 
 
 		cameraUp.copy( camera.up );
 		cameraUp.copy( camera.up );
 
 

+ 1 - 1
examples/js/Cloth.js

@@ -250,7 +250,7 @@ function simulate(time) {
 			;i<il;i++) {
 			;i<il;i++) {
 		particle = particles[i];
 		particle = particles[i];
 		pos = particle.position;
 		pos = particle.position;
-		diff.sub(pos, ballPosition);
+		diff.subVectors(pos, ballPosition);
 		if (diff.length() < ballSize) {
 		if (diff.length() < ballSize) {
 			// collided
 			// collided
 			diff.normalize().multiplyScalar(ballSize);
 			diff.normalize().multiplyScalar(ballSize);

+ 1 - 1
examples/js/renderers/SVGRenderer.js

@@ -249,7 +249,7 @@ THREE.SVGRenderer = function () {
 
 
 				lightPosition = light.matrixWorld.getPosition();
 				lightPosition = light.matrixWorld.getPosition();
 
 
-				amount = normal.dot( _vector3.sub( lightPosition, position ).normalize() );
+				amount = normal.dot( _vector3.subVectors( lightPosition, position ).normalize() );
 
 
 				if ( amount <= 0 ) continue;
 				if ( amount <= 0 ) continue;
 
 

+ 1 - 1
examples/misc_controls_fly.html

@@ -298,7 +298,7 @@
 
 
 				dPlanet = camera.position.length();
 				dPlanet = camera.position.length();
 
 
-				dMoonVec.sub( camera.position, meshMoon.position );
+				dMoonVec.subVectors( camera.position, meshMoon.position );
 				dMoon = dMoonVec.length();
 				dMoon = dMoonVec.length();
 
 
 				if ( dMoon < dPlanet ) {
 				if ( dMoon < dPlanet ) {

+ 1 - 1
src/extras/core/Curve.js

@@ -562,7 +562,7 @@ THREE.LineCurve3 = THREE.Curve.create(
 		var r = new THREE.Vector3();
 		var r = new THREE.Vector3();
 
 
 
 
-		r.sub( this.v2, this.v1 ); // diff
+		r.subVectors( this.v2, this.v1 ); // diff
 		r.multiplyScalar( t );
 		r.multiplyScalar( t );
 		r.add( this.v1 );
 		r.add( this.v1 );