@@ -33,6 +33,26 @@ class LightsNode extends Node {
3333
3434 }
3535
36+ getHash ( ) {
37+
38+ if ( this . _hash === null ) {
39+
40+ const hash = [ ] ;
41+
42+ for ( const lightNode of this . lightNodes ) {
43+
44+ hash . push ( lightNode . getHash ( ) ) ;
45+
46+ }
47+
48+ this . _hash = 'lights-' + hash . join ( ',' ) ;
49+
50+ }
51+
52+ return this . _hash ;
53+
54+ }
55+
3656 setup ( builder ) {
3757
3858 const context = builder . context ;
@@ -57,7 +77,7 @@ class LightsNode extends Node {
5777 for ( const lightNode of lightNodes ) {
5878
5979 lightNode . build ( builder ) ;
60-
80+
6181 }
6282
6383 //
@@ -76,7 +96,7 @@ class LightsNode extends Node {
7696 if ( backdrop !== null ) {
7797
7898 totalDiffuse = vec3 ( backdropAlpha !== null ? backdropAlpha . mix ( totalDiffuse , backdrop ) : backdrop ) ;
79-
99+
80100 }
81101
82102 totalDiffuseNode . assign ( totalDiffuse ) ;
@@ -98,35 +118,11 @@ class LightsNode extends Node {
98118
99119 }
100120
101- getHash ( builder ) {
102-
103- if ( this . _hash === null ) {
104-
105- let hash = '' ;
106-
107- const lightNodes = this . lightNodes ;
108-
109- for ( const lightNode of lightNodes ) {
110-
111- hash += lightNode . getHash ( builder ) + ' ' ;
112-
113- }
114-
115- this . _hash = hash ;
116-
117- }
118-
119- return this . _hash ;
120-
121- }
122-
123- getLightNodeByHash ( hash ) {
124-
125- const lightNodes = this . lightNodes ;
121+ _getLightNodeById ( id ) {
126122
127- for ( const lightNode of lightNodes ) {
123+ for ( const lightNode of this . lightNodes ) {
128124
129- if ( lightNode . light . uuid === hash ) {
125+ if ( lightNode . isAnalyticLightNode && lightNode . light . id === id ) {
130126
131127 return lightNode ;
132128
@@ -146,7 +142,7 @@ class LightsNode extends Node {
146142
147143 for ( const light of lights ) {
148144
149- let lightNode = this . getLightNodeByHash ( light . uuid ) ;
145+ let lightNode = this . _getLightNodeById ( light . id ) ;
150146
151147 if ( lightNode === null ) {
152148
@@ -173,7 +169,7 @@ class LightsNode extends Node {
173169export default LightsNode ;
174170
175171export const lights = ( lights ) => nodeObject ( new LightsNode ( ) . fromLights ( lights ) ) ;
176- export const lightsWithoutWrap = nodeProxy ( LightsNode ) ;
172+ export const lightNodes = nodeProxy ( LightsNode ) ;
177173
178174export function addLightNode ( lightClass , lightNodeClass ) {
179175
0 commit comments