Explorar el Código

Better parenting cache system

David Catuhe hace 11 años
padre
commit
1571359418
Se han modificado 4 ficheros con 37 adiciones y 9 borrados
  1. 9 1
      Babylon/babylon.node.js
  2. 12 1
      Babylon/babylon.node.ts
  3. 9 1
      babylon.2.1-alpha.debug.js
  4. 7 6
      babylon.2.1-alpha.js

+ 9 - 1
Babylon/babylon.node.js

@@ -16,6 +16,7 @@ var BABYLON;
             this._isEnabled = true;
             this._isReady = true;
             this._currentRenderId = -1;
+            this._parentRenderId = -1;
             this.name = name;
             this.id = name;
             this._scene = scene;
@@ -52,7 +53,14 @@ var BABYLON;
             return true;
         };
         Node.prototype.isSynchronizedWithParent = function () {
-            return this.parent ? this.parent._currentRenderId <= this._currentRenderId && this.parent.isSynchronized() : true;
+            if (!this.parent) {
+                return true;
+            }
+            if (this._parentRenderId !== this.parent._currentRenderId) {
+                return false;
+            }
+            this._parentRenderId = this.parent._currentRenderId;
+            return this.parent._currentRenderId <= this._currentRenderId && this.parent.isSynchronized();
         };
         Node.prototype.isSynchronized = function (updateCache) {
             var check = this.hasNewParent();

+ 12 - 1
Babylon/babylon.node.ts

@@ -17,6 +17,7 @@
         private _isEnabled = true;
         private _isReady = true;
         public _currentRenderId = -1;
+        private _parentRenderId = -1;
 
         public _waitingParentId: string;
 
@@ -75,7 +76,17 @@
         }
 
         public isSynchronizedWithParent(): boolean {
-            return this.parent ? this.parent._currentRenderId <= this._currentRenderId && this.parent.isSynchronized() : true;
+            if (!this.parent) {
+                return true;
+            }
+
+            if (this._parentRenderId !== this.parent._currentRenderId) {
+                return false;
+            }
+
+            this._parentRenderId = this.parent._currentRenderId;
+
+            return this.parent._currentRenderId <= this._currentRenderId && this.parent.isSynchronized();
         }
 
         public isSynchronized(updateCache?: boolean): boolean {

+ 9 - 1
babylon.2.1-alpha.debug.js

@@ -5257,6 +5257,7 @@ var __extends = this.__extends || function (d, b) {
             this._isEnabled = true;
             this._isReady = true;
             this._currentRenderId = -1;
+            this._parentRenderId = -1;
             this.name = name;
             this.id = name;
             this._scene = scene;
@@ -5293,7 +5294,14 @@ var __extends = this.__extends || function (d, b) {
             return true;
         };
         Node.prototype.isSynchronizedWithParent = function () {
-            return this.parent ? this.parent._currentRenderId <= this._currentRenderId && this.parent.isSynchronized() : true;
+            if (!this.parent) {
+                return true;
+            }
+            if (this._parentRenderId !== this.parent._currentRenderId) {
+                return false;
+            }
+            this._parentRenderId = this.parent._currentRenderId;
+            return this.parent._currentRenderId <= this._currentRenderId && this.parent.isSynchronized();
         };
         Node.prototype.isSynchronized = function (updateCache) {
             var check = this.hasNewParent();

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 7 - 6
babylon.2.1-alpha.js