Bläddra i källkod

Removed camera.projectionMatrixInverse as per @bhouston suggestion in #4257.

Mr.doob 11 år sedan
förälder
incheckning
6f4cc817fd

+ 2 - 5
docs/api/cameras/Camera.html

@@ -19,7 +19,7 @@
 
 		<h3>[name]()</h3>
 		<div>
-			This constructor sets the following properties to the correct type: matrixWorldInverse, projectionMatrix and projectionMatrixInverse.
+			This constructor sets the following properties to the correct type: matrixWorldInverse and projectionMatrix.
 			
 		</div>
 
@@ -30,10 +30,7 @@
 		<div>This is the inverse of matrixWorld. MatrixWorld contains the Matrix which has the world transform of the Camera.</div>
 
 		<h3>.[page:Matrix4 projectionMatrix]</h3>
-		<div>This is the matrix which contains the projection.</div>		
-
-		<h3>.[page:Matrix4 projectionMatrixInverse]</h3>
-		<div>This is the inverse of projectionMatrix.</div>
+		<div>This is the matrix which contains the projection.</div>
 
 
 		<h2>Methods</h2>

+ 3 - 2
examples/js/renderers/WebGLDeferredRenderer.js

@@ -39,6 +39,7 @@ THREE.WebGLDeferredRenderer = function ( parameters ) {
 	//
 
 	var currentCamera = null;
+	var projectionMatrixInverse = new THREE.Matrix4();
 
 	var positionVS = new THREE.Vector3();
 	var directionVS = new THREE.Vector3();
@@ -932,7 +933,7 @@ THREE.WebGLDeferredRenderer = function ( parameters ) {
 
 		var uniforms = proxy.material.uniforms;
 
-		if ( uniforms[ "matProjInverse" ] ) uniforms[ "matProjInverse" ].value = currentCamera.projectionMatrixInverse;
+		if ( uniforms[ "matProjInverse" ] ) uniforms[ "matProjInverse" ].value = projectionMatrixInverse;
 		if ( uniforms[ "matView" ] ) uniforms[ "matView" ].value = currentCamera.matrixWorldInverse;
 
 		var originalLight = proxy.userData.originalLight;
@@ -1055,7 +1056,7 @@ THREE.WebGLDeferredRenderer = function ( parameters ) {
 
 		gl.depthFunc( gl.GEQUAL );
 
-		currentCamera.projectionMatrixInverse.getInverse( currentCamera.projectionMatrix );
+		projectionMatrixInverse.getInverse( currentCamera.projectionMatrix );
 
 		for ( var i = 0, il = lightSceneProxy.children.length; i < il; i ++ ) {
 

+ 0 - 3
src/cameras/Camera.js

@@ -9,9 +9,7 @@ THREE.Camera = function () {
 	THREE.Object3D.call( this );
 
 	this.matrixWorldInverse = new THREE.Matrix4();
-
 	this.projectionMatrix = new THREE.Matrix4();
-	this.projectionMatrixInverse = new THREE.Matrix4();
 
 };
 
@@ -41,7 +39,6 @@ THREE.Camera.prototype.clone = function (camera) {
 
 	camera.matrixWorldInverse.copy( this.matrixWorldInverse );
 	camera.projectionMatrix.copy( this.projectionMatrix );
-	camera.projectionMatrixInverse.copy( this.projectionMatrixInverse );
 
 	return camera;
 };

+ 4 - 3
src/core/Projector.js

@@ -22,6 +22,8 @@ THREE.Projector = function () {
 	_points3 = new Array( 3 ),
 	_points4 = new Array( 4 ),
 
+	_projectionMatrixInverse = new THREE.Matrix4(),
+
 	_viewMatrix = new THREE.Matrix4(),
 	_viewProjectionMatrix = new THREE.Matrix4(),
 
@@ -50,9 +52,8 @@ THREE.Projector = function () {
 
 	this.unprojectVector = function ( vector, camera ) {
 
-		camera.projectionMatrixInverse.getInverse( camera.projectionMatrix );
-
-		_viewProjectionMatrix.multiplyMatrices( camera.matrixWorld, camera.projectionMatrixInverse );
+		_projectionMatrixInverse.getInverse( camera.projectionMatrix );
+		_viewProjectionMatrix.multiplyMatrices( camera.matrixWorld, _projectionMatrixInverse );
 
 		return vector.applyProjection( _viewProjectionMatrix );