Skip to content

Commit cb64471

Browse files
authoredSep 27, 2023
Nodes: Fix addLightNode in case of anonymizing classes (#26858)
* Fix `addLightNode` in case of anonymizing classes * Address comment * Update AmbientLightNode.js * Update DirectionalLightNode.js * Update HemisphereLightNode.js * Update IESSpotLightNode.js * Update PointLightNode.js * Update SpotLightNode.js * Fix
1 parent 688b749 commit cb64471

7 files changed

+15
-15
lines changed
 

‎examples/jsm/nodes/lighting/AmbientLightNode.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ class AmbientLightNode extends AnalyticLightNode {
2222

2323
export default AmbientLightNode;
2424

25-
addLightNode( AmbientLight, AmbientLightNode );
26-
2725
addNodeClass( 'AmbientLightNode', AmbientLightNode );
26+
27+
addLightNode( AmbientLight, AmbientLightNode );

‎examples/jsm/nodes/lighting/DirectionalLightNode.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ class DirectionalLightNode extends AnalyticLightNode {
3535

3636
export default DirectionalLightNode;
3737

38-
addLightNode( DirectionalLight, DirectionalLightNode );
39-
4038
addNodeClass( 'DirectionalLightNode', DirectionalLightNode );
39+
40+
addLightNode( DirectionalLight, DirectionalLightNode );

‎examples/jsm/nodes/lighting/HemisphereLightNode.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ class HemisphereLightNode extends AnalyticLightNode {
5050

5151
export default HemisphereLightNode;
5252

53-
addLightNode( HemisphereLight, HemisphereLightNode );
54-
5553
addNodeClass( 'HemisphereLightNode', HemisphereLightNode );
54+
55+
addLightNode( HemisphereLight, HemisphereLightNode );

‎examples/jsm/nodes/lighting/IESSpotLightNode.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ class IESSpotLightNode extends SpotLightNode {
3434

3535
export default IESSpotLightNode;
3636

37-
addLightNode( IESSpotLight, IESSpotLightNode );
38-
3937
addNodeClass( 'IESSpotLightNode', IESSpotLightNode );
38+
39+
addLightNode( IESSpotLight, IESSpotLightNode );

‎examples/jsm/nodes/lighting/LightsNode.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ export const lightsWithoutWrap = nodeProxy( LightsNode );
119119

120120
export function addLightNode( lightClass, lightNodeClass ) {
121121

122-
if ( LightNodes.has( lightClass ) ) throw new Error( `Redefinition of light node ${ lightNodeClass.name }` );
123-
if ( typeof lightClass !== 'function' || ! lightClass.name ) throw new Error( `Light ${ lightClass.name } is not a class` );
124-
if ( typeof lightNodeClass !== 'function' || ! lightNodeClass.name ) throw new Error( `Light node ${ lightNodeClass.name } is not a class` );
122+
if ( LightNodes.has( lightClass ) ) throw new Error( `Redefinition of light node ${ lightNodeClass.type }` );
123+
if ( typeof lightClass !== 'function' ) throw new Error( `Light ${ lightClass.name } is not a class` );
124+
if ( typeof lightNodeClass !== 'function' || ! lightNodeClass.type ) throw new Error( `Light node ${ lightNodeClass.type } is not a class` );
125125

126126
LightNodes.set( lightClass, lightNodeClass );
127127

‎examples/jsm/nodes/lighting/PointLightNode.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@ class PointLightNode extends AnalyticLightNode {
6363

6464
export default PointLightNode;
6565

66-
addLightNode( PointLight, PointLightNode );
67-
6866
addNodeClass( 'PointLightNode', PointLightNode );
67+
68+
addLightNode( PointLight, PointLightNode );

‎examples/jsm/nodes/lighting/SpotLightNode.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,6 @@ class SpotLightNode extends AnalyticLightNode {
8484

8585
export default SpotLightNode;
8686

87-
addLightNode( SpotLight, SpotLightNode );
88-
8987
addNodeClass( 'SpotLightNode', SpotLightNode );
88+
89+
addLightNode( SpotLight, SpotLightNode );

0 commit comments

Comments
 (0)
Please sign in to comment.