Jelajahi Sumber

Fixe some issue with the cache.

Julien 11 tahun lalu
induk
melakukan
b1bd9fe0fc

+ 4 - 4
Babylon/Cameras/babylon.arcRotateCamera.js

@@ -46,10 +46,10 @@ var BABYLON = BABYLON || {};
     
     // Cache
     BABYLON.ArcRotateCamera.prototype._initCache = function () {
-        this._cache.target = this._getTargetPosition().clone();
-        this._cache.alpha = this.alpha;
-        this._cache.beta = this.beta;
-        this._cache.radius = this.radius;
+        this._cache.target = new BABYLON.Vector3(-Infinity, -Infinity,-Infinity);
+        this._cache.alpha = undefined;
+        this._cache.beta = undefined;
+        this._cache.radius = undefined;
     };
 
     BABYLON.ArcRotateCamera.prototype._updateCache = function (ignoreParentClass) {

+ 16 - 16
Babylon/Cameras/babylon.camera.js

@@ -60,22 +60,22 @@ var BABYLON = BABYLON || {};
     
     //Cache
     BABYLON.Camera.prototype._initCache = function () {
-        this._cache.position = this.position.clone();
-        this._cache.upVector = this.upVector.clone();
-
-        this._cache.mode = this.mode;
-        this._cache.minZ = this.minZ;
-        this._cache.maxZ = this.maxZ;
-
-        this._cache.fov = this.fov;
-        this._cache.aspectRatio = engine.getAspectRatio();
-
-        this._cache.orthoLeft = this.orthoLeft;
-        this._cache.orthoRight = this.orthoRight;
-        this._cache.orthoBottom = this.orthoBottom;
-        this._cache.orthoTop = this.orthoTop;
-        this._cache.renderWidth = engine.getRenderWidth()
-        this._cache.renderHeight = engine.getRenderHeight();
+        this._cache.position = new BABYLON.Vector3(-Infinity, -Infinity,-Infinity);
+        this._cache.upVector = new BABYLON.Vector3(-Infinity, -Infinity,-Infinity);
+
+        this._cache.mode = undefined;
+        this._cache.minZ = undefined;
+        this._cache.maxZ = undefined;
+
+        this._cache.fov = undefined;
+        this._cache.aspectRatio = undefined;
+
+        this._cache.orthoLeft = undefined;
+        this._cache.orthoRight = undefined;
+        this._cache.orthoBottom = undefined;
+        this._cache.orthoTop = undefined;
+        this._cache.renderWidth = undefined;
+        this._cache.renderHeight = undefined;
     };
 
     BABYLON.Camera.prototype._updateCache = function (ignoreParentClass) {

+ 2 - 3
Babylon/Cameras/babylon.freeCamera.js

@@ -58,9 +58,8 @@ var BABYLON = BABYLON || {};
 
     // Cache
     BABYLON.FreeCamera.prototype._initCache = function () {
-        var lockedTargetPosition = this._getLockedTargetPosition();
-        this._cache.lockedTarget = lockedTargetPosition ? lockedTargetPosition.clone() : null;
-        this._cache.rotation = this.rotation.clone();
+        this._cache.lockedTarget = new BABYLON.Vector3(-Infinity, -Infinity,-Infinity);
+        this._cache.rotation = new BABYLON.Vector3(-Infinity, -Infinity,-Infinity);
     };
 
     BABYLON.FreeCamera.prototype._updateCache = function (ignoreParentClass) {

+ 1 - 0
Babylon/babylon.node.js

@@ -22,6 +22,7 @@ var BABYLON = BABYLON || {};
     // DO NOT call parent class method
     BABYLON.Node.prototype._initCache = function () {
         this._cache = {};
+        this._cache.parent = undefined;
     };
 
     BABYLON.Node.prototype.updateCache = function (force) {