David Catuhe 10 سال پیش
والد
کامیت
9361bd6f46
4فایلهای تغییر یافته به همراه43 افزوده شده و 39 حذف شده
  1. 13 9
      Babylon/Cameras/babylon.camera.js
  2. 14 15
      Babylon/Cameras/babylon.camera.ts
  3. 14 13
      babylon.2.1-beta.debug.js
  4. 2 2
      babylon.2.1-beta.js

+ 13 - 9
Babylon/Cameras/babylon.camera.js

@@ -228,19 +228,23 @@ var BABYLON;
         };
         Camera.prototype.getViewMatrix = function () {
             this._computedViewMatrix = this._computeViewMatrix();
-            if (!this.parent || !this.parent.getWorldMatrix || this.isSynchronized()) {
-                this._globalPosition.copyFrom(this.position);
+            if (this.isSynchronized()) {
                 return this._computedViewMatrix;
             }
-            if (!this._worldMatrix) {
-                this._worldMatrix = BABYLON.Matrix.Identity();
+            if (!this.parent || !this.parent.getWorldMatrix) {
+                this._globalPosition.copyFrom(this.position);
+            }
+            else {
+                if (!this._worldMatrix) {
+                    this._worldMatrix = BABYLON.Matrix.Identity();
+                }
+                this._computedViewMatrix.invertToRef(this._worldMatrix);
+                this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._computedViewMatrix);
+                this._globalPosition.copyFromFloats(this._computedViewMatrix.m[12], this._computedViewMatrix.m[13], this._computedViewMatrix.m[14]);
+                this._computedViewMatrix.invert();
+                this._markSyncedWithParent();
             }
-            this._computedViewMatrix.invertToRef(this._worldMatrix);
-            this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._computedViewMatrix);
-            this._globalPosition.copyFromFloats(this._computedViewMatrix.m[12], this._computedViewMatrix.m[13], this._computedViewMatrix.m[14]);
-            this._computedViewMatrix.invert();
             this._currentRenderId = this.getScene().getRenderId();
-            this._markSyncedWithParent();
             return this._computedViewMatrix;
         };
         Camera.prototype._computeViewMatrix = function (force) {

+ 14 - 15
Babylon/Cameras/babylon.camera.ts

@@ -284,29 +284,28 @@
         public getViewMatrix(): Matrix {
             this._computedViewMatrix = this._computeViewMatrix();
 
-            if (!this.parent
-                || !this.parent.getWorldMatrix
-                || this.isSynchronized()) {
-
-                this._globalPosition.copyFrom(this.position);
-
+            if (this.isSynchronized()) {
                 return this._computedViewMatrix;
             }
 
-            if (!this._worldMatrix) {
-                this._worldMatrix = Matrix.Identity();
-            }
+            if (!this.parent || !this.parent.getWorldMatrix) {
+                this._globalPosition.copyFrom(this.position);
+            } else {
+                if (!this._worldMatrix) {
+                    this._worldMatrix = Matrix.Identity();
+                }
 
-            this._computedViewMatrix.invertToRef(this._worldMatrix);
+                this._computedViewMatrix.invertToRef(this._worldMatrix);
 
-            this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._computedViewMatrix);
-            this._globalPosition.copyFromFloats(this._computedViewMatrix.m[12], this._computedViewMatrix.m[13], this._computedViewMatrix.m[14]);
+                this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._computedViewMatrix);
+                this._globalPosition.copyFromFloats(this._computedViewMatrix.m[12], this._computedViewMatrix.m[13], this._computedViewMatrix.m[14]);
 
-            this._computedViewMatrix.invert();
+                this._computedViewMatrix.invert();
 
-            this._currentRenderId = this.getScene().getRenderId();
+                this._markSyncedWithParent();
+            }
 
-            this._markSyncedWithParent();
+            this._currentRenderId = this.getScene().getRenderId();
 
             return this._computedViewMatrix;
         }

+ 14 - 13
babylon.2.1-beta.debug.js

@@ -7026,9 +7026,6 @@ var BABYLON;
             this._update();
         };
         // Synchronized
-        //public isSynchronizedWithParent(): boolean {
-        //    return false;
-        //}
         Camera.prototype._isSynchronized = function () {
             return this._isSynchronizedViewMatrix() && this._isSynchronizedProjectionMatrix();
         };
@@ -7137,19 +7134,23 @@ var BABYLON;
         };
         Camera.prototype.getViewMatrix = function () {
             this._computedViewMatrix = this._computeViewMatrix();
-            if (!this.parent || !this.parent.getWorldMatrix || this.isSynchronized()) {
-                this._globalPosition.copyFrom(this.position);
+            if (this.isSynchronized()) {
                 return this._computedViewMatrix;
             }
-            if (!this._worldMatrix) {
-                this._worldMatrix = BABYLON.Matrix.Identity();
+            if (!this.parent || !this.parent.getWorldMatrix) {
+                this._globalPosition.copyFrom(this.position);
+            }
+            else {
+                if (!this._worldMatrix) {
+                    this._worldMatrix = BABYLON.Matrix.Identity();
+                }
+                this._computedViewMatrix.invertToRef(this._worldMatrix);
+                this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._computedViewMatrix);
+                this._globalPosition.copyFromFloats(this._computedViewMatrix.m[12], this._computedViewMatrix.m[13], this._computedViewMatrix.m[14]);
+                this._computedViewMatrix.invert();
+                this._currentRenderId = this.getScene().getRenderId();
+                this._markSyncedWithParent();
             }
-            this._computedViewMatrix.invertToRef(this._worldMatrix);
-            this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._computedViewMatrix);
-            this._globalPosition.copyFromFloats(this._computedViewMatrix.m[12], this._computedViewMatrix.m[13], this._computedViewMatrix.m[14]);
-            this._computedViewMatrix.invert();
-            this._currentRenderId = this.getScene().getRenderId();
-            this._markSyncedWithParent();
             return this._computedViewMatrix;
         };
         Camera.prototype._computeViewMatrix = function (force) {

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 2 - 2
babylon.2.1-beta.js