Bläddra i källkod

Fixing sync issues

David Catuhe 11 år sedan
förälder
incheckning
6fbeb17ed3

+ 2 - 1
Babylon/Cameras/babylon.camera.js

@@ -290,9 +290,10 @@ var BABYLON = BABYLON || {};
     
     BABYLON.Camera.prototype._computeViewMatrix = function (force) {
         if (!force && this._isSynchronizedViewMatrix()) {
+            this._currentRenderId = this._scene.getRenderId();
             return this._computedViewMatrix;
         }
-        this._syncChildFlag();
+
         this._computedViewMatrix = this._getViewMatrix();
         return this._computedViewMatrix;
     };

+ 1 - 1
Babylon/Lights/babylon.light.js

@@ -37,7 +37,7 @@ var BABYLON = BABYLON || {};
     };
 
     BABYLON.Light.prototype.getWorldMatrix = function () {
-        this._syncChildFlag();
+        this._currentRenderId = this._scene.getRenderId();
 
         var worldMatrix = this._getWorldMatrix();
 

+ 5 - 5
Babylon/Mesh/babylon.mesh.js

@@ -264,7 +264,7 @@ var BABYLON = BABYLON || {};
         if (property === "rotation") {
             this.rotationQuaternion = null;
         }
-        this._syncChildFlag();
+        this._currentRenderId = -1;
     };
 
     BABYLON.Mesh.prototype.refreshBoundingInfo = function () {
@@ -304,10 +304,10 @@ var BABYLON = BABYLON || {};
 
     BABYLON.Mesh.prototype.computeWorldMatrix = function (force) {
         if (!force && (this._currentRenderId == this._scene.getRenderId() || this.isSynchronized(true))) {
+            this._currentRenderId = this._scene.getRenderId();
             return this._worldMatrix;
         }
 
-        this._syncChildFlag();
         this._cache.position.copyFrom(this.position);
         this._cache.scaling.copyFrom(this.scaling);
         this._cache.pivotMatrixUpdated = false;
@@ -384,7 +384,7 @@ var BABYLON = BABYLON || {};
         if (this.parent && this.parent.getWorldMatrix && this.billboardMode === BABYLON.Mesh.BILLBOARDMODE_NONE) {
             this._localWorld.multiplyToRef(this.parent.getWorldMatrix(), this._worldMatrix);
         } else {
-            this._localPivotScalingRotationWorld.multiplyToRef(this._localTranslation, this._worldMatrix);
+            this._worldMatrix.copyFrom(this._localWorld);
         }
 
         // Bounding info
@@ -867,8 +867,8 @@ var BABYLON = BABYLON || {};
     // Dispose
     BABYLON.Mesh.prototype.dispose = function (doNotRecurse) {
         if (this._vertexBuffers) {
-            for (var index = 0; index < this._vertexBuffers.length; index++) {
-                this._vertexBuffers[index].dispose();
+            for (var vbKind in this._vertexBuffers) {
+                this._vertexBuffers[vbKind].dispose();
             }
             this._vertexBuffers = null;
         }

+ 2 - 9
Babylon/babylon.node.js

@@ -15,6 +15,7 @@ var BABYLON = BABYLON || {};
     BABYLON.Node.prototype._childrenFlag = -1;
     BABYLON.Node.prototype._isReady = true;
     BABYLON.Node.prototype._isEnabled = true;
+    BABYLON.Node.prototype._currentRenderId = -1;
 
     // Cache
     BABYLON.Node.prototype._cache = null;
@@ -50,12 +51,8 @@ var BABYLON = BABYLON || {};
         return true;
     };
 
-    BABYLON.Node.prototype._syncChildFlag = function() {
-        this._childrenFlag = this.parent ? this.parent._childrenFlag : this._scene.getRenderId();
-    };
-
     BABYLON.Node.prototype.isSynchronizedWithParent = function() {
-        return this.parent ? !this.parent._needToSynchonizeChildren(this._childrenFlag) : true;
+        return this.parent ? !this.parent._currentRenderId === this._currentRenderId : true;
     };
 
     BABYLON.Node.prototype.isSynchronized = function (updateCache) {
@@ -81,10 +78,6 @@ var BABYLON = BABYLON || {};
         return true;
     };
 
-    BABYLON.Node.prototype._needToSynchonizeChildren = function (childFlag) {
-        return this._childrenFlag != childFlag;
-    };
-
     BABYLON.Node.prototype.isReady = function () {
         return this._isReady;
     };

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 1 - 1
babylon.1.8.5.js