Selaa lähdekoodia

Vector3.unproject(): Avoid computing inverse

WestLangley 6 vuotta sitten
vanhempi
commit
8bad3a4942
1 muutettua tiedostoa jossa 3 lisäystä ja 10 poistoa
  1. 3 10
      src/math/Vector3.js

+ 3 - 10
src/math/Vector3.js

@@ -1,5 +1,4 @@
 import { _Math } from './Math.js';
-import { Matrix4 } from './Matrix4.js';
 import { Quaternion } from './Quaternion.js';
 
 /**
@@ -318,17 +317,11 @@ Object.assign( Vector3.prototype, {
 
 	},
 
-	unproject: function () {
+	unproject: function ( camera ) {
 
-		var matrix = new Matrix4();
+		return this.applyMatrix4( camera.projectionMatrixInverse ).applyMatrix4( camera.matrixWorld );
 
-		return function unproject( camera ) {
-
-			return this.applyMatrix4( matrix.getInverse( camera.projectionMatrix ) ).applyMatrix4( camera.matrixWorld );
-
-		};
-
-	}(),
+	},
 
 	transformDirection: function ( m ) {