Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions src/nodes/lighting/LightsNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,23 +107,33 @@ class LightsNode extends Node {
}

/**
* Overwrites the default {@link Node#customCacheKey} implementation by including the
* light IDs into the cache key.
* Overwrites the default {@link Node#customCacheKey} implementation by including
* light data into the cache key.
*
* @return {number} The custom cache key.
*/
customCacheKey() {

const lightIDs = [];
const hashData = [];
const lights = this._lights;

for ( let i = 0; i < lights.length; i ++ ) {

lightIDs.push( lights[ i ].id );
const light = lights[ i ];

hashData.push( light.id );

if ( light.isSpotLight === true ) {

const hashValue = ( light.map !== null ) ? light.map.id : - 1;

hashData.push( hashValue );

}

}

return hashArray( lightIDs );
return hashArray( hashData );

}

Expand Down