|
|
@@ -1,5 +1,6 @@
|
|
|
import Node from '../core/Node.js';
|
|
|
import { nodeObject, vec3 } from '../tsl/TSLBase.js';
|
|
|
+import { hashArray } from '../core/NodeUtils.js';
|
|
|
|
|
|
const sortLights = ( lights ) => {
|
|
|
|
|
|
@@ -51,6 +52,29 @@ class LightsNode extends Node {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ getCacheKey( force ) {
|
|
|
+
|
|
|
+ force = force || this.version !== this._cacheKeyVersion;
|
|
|
+
|
|
|
+ if ( force === true || this._cacheKey === null ) {
|
|
|
+
|
|
|
+ const lightIDs = [];
|
|
|
+
|
|
|
+ for ( let i = 0; i < this._lights.length; i ++ ) {
|
|
|
+
|
|
|
+ lightIDs.push( this._lights[ i ].id );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ this._cacheKey = hashArray( lightIDs );
|
|
|
+ this._cacheKeyVersion = this.version;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return this._cacheKey;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
getHash( builder ) {
|
|
|
|
|
|
if ( this._lightNodesHash === null ) {
|