|
@@ -20,12 +20,27 @@ class Node extends EventDispatcher {
|
|
|
|
|
|
this.uuid = MathUtils.generateUUID();
|
|
this.uuid = MathUtils.generateUUID();
|
|
|
|
|
|
|
|
+ this.version = 0;
|
|
|
|
+
|
|
|
|
+ this._cacheKey = null;
|
|
|
|
+ this._cacheKeyVersion = 0;
|
|
|
|
+
|
|
this.isNode = true;
|
|
this.isNode = true;
|
|
|
|
|
|
Object.defineProperty( this, 'id', { value: _nodeId ++ } );
|
|
Object.defineProperty( this, 'id', { value: _nodeId ++ } );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ set needsUpdate( value ) {
|
|
|
|
+
|
|
|
|
+ if ( value === true ) {
|
|
|
|
+
|
|
|
|
+ this.version ++;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
get type() {
|
|
get type() {
|
|
|
|
|
|
return this.constructor.type;
|
|
return this.constructor.type;
|
|
@@ -80,9 +95,18 @@ class Node extends EventDispatcher {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- getCacheKey() {
|
|
|
|
|
|
+ getCacheKey( force = false ) {
|
|
|
|
+
|
|
|
|
+ force = force || this.version !== this._cacheKeyVersion;
|
|
|
|
+
|
|
|
|
+ if ( force === true || this._cacheKey === null ) {
|
|
|
|
+
|
|
|
|
+ this._cacheKey = getCacheKey( this, force );
|
|
|
|
+ this._cacheKeyVersion = this.version;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
- return getCacheKey( this );
|
|
|
|
|
|
+ return this._cacheKey;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|