Преглед на файлове

LightsNode: Honor spotlight maps in cache key. (#30940)

* LightsNode: Honor spotlight maps in cache key.

* LightsNode: Make spot light hash more robust.
Michael Herzog преди 8 месеца
родител
ревизия
4d368fa638
променени са 1 файла, в които са добавени 15 реда и са изтрити 5 реда
  1. 15 5
      src/nodes/lighting/LightsNode.js

+ 15 - 5
src/nodes/lighting/LightsNode.js

@@ -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 );
 
 	}
 

粤ICP备19079148号