Browse Source

Merge pull request #1469 from vousk/dev_camera

added a method to force camera's projection matrix
David Catuhe 8 years ago
parent
commit
2980c82b84
1 changed files with 10 additions and 2 deletions
  1. 10 2
      src/Cameras/babylon.camera.ts

+ 10 - 2
src/Cameras/babylon.camera.ts

@@ -123,6 +123,7 @@
         // Cache
         private _computedViewMatrix = Matrix.Identity();
         public _projectionMatrix = new Matrix();
+        private _doNotComputeProjectionMatrix = false;
         private _worldMatrix: Matrix;
         public _postProcesses = new Array<PostProcess>();
         private _transformMatrix = Matrix.Zero();
@@ -413,8 +414,15 @@
             return this._computedViewMatrix;
         }
 
+        public freezeProjectionMatrix(projection?: Matrix): void {
+            this._doNotComputeProjectionMatrix = true;
+            if (projection !== undefined) {
+                this._projectionMatrix = projection;
+            }
+        };
+        
         public getProjectionMatrix(force?: boolean): Matrix {
-            if (!force && this._isSynchronizedProjectionMatrix()) {
+            if ((!force && this._isSynchronizedProjectionMatrix()) || this._doNotComputeProjectionMatrix) {
                 return this._projectionMatrix;
             }
 
@@ -784,4 +792,4 @@
             return camera;
         }
     }
-}
+}