Skip to content

Commit

Permalink
Nodes: Fix addLightNode in case of anonymizing classes (mrdoob#26858)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
LeviPesin authored Sep 27, 2023
1 parent 688b749 commit cb64471
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions examples/jsm/nodes/lighting/AmbientLightNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ class AmbientLightNode extends AnalyticLightNode {

export default AmbientLightNode;

addLightNode( AmbientLight, AmbientLightNode );

addNodeClass( 'AmbientLightNode', AmbientLightNode );

addLightNode( AmbientLight, AmbientLightNode );
4 changes: 2 additions & 2 deletions examples/jsm/nodes/lighting/DirectionalLightNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ class DirectionalLightNode extends AnalyticLightNode {

export default DirectionalLightNode;

addLightNode( DirectionalLight, DirectionalLightNode );

addNodeClass( 'DirectionalLightNode', DirectionalLightNode );

addLightNode( DirectionalLight, DirectionalLightNode );
4 changes: 2 additions & 2 deletions examples/jsm/nodes/lighting/HemisphereLightNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ class HemisphereLightNode extends AnalyticLightNode {

export default HemisphereLightNode;

addLightNode( HemisphereLight, HemisphereLightNode );

addNodeClass( 'HemisphereLightNode', HemisphereLightNode );

addLightNode( HemisphereLight, HemisphereLightNode );
4 changes: 2 additions & 2 deletions examples/jsm/nodes/lighting/IESSpotLightNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ class IESSpotLightNode extends SpotLightNode {

export default IESSpotLightNode;

addLightNode( IESSpotLight, IESSpotLightNode );

addNodeClass( 'IESSpotLightNode', IESSpotLightNode );

addLightNode( IESSpotLight, IESSpotLightNode );
6 changes: 3 additions & 3 deletions examples/jsm/nodes/lighting/LightsNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ export const lightsWithoutWrap = nodeProxy( LightsNode );

export function addLightNode( lightClass, lightNodeClass ) {

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

LightNodes.set( lightClass, lightNodeClass );

Expand Down
4 changes: 2 additions & 2 deletions examples/jsm/nodes/lighting/PointLightNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ class PointLightNode extends AnalyticLightNode {

export default PointLightNode;

addLightNode( PointLight, PointLightNode );

addNodeClass( 'PointLightNode', PointLightNode );

addLightNode( PointLight, PointLightNode );
4 changes: 2 additions & 2 deletions examples/jsm/nodes/lighting/SpotLightNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ class SpotLightNode extends AnalyticLightNode {

export default SpotLightNode;

addLightNode( SpotLight, SpotLightNode );

addNodeClass( 'SpotLightNode', SpotLightNode );

addLightNode( SpotLight, SpotLightNode );

0 comments on commit cb64471

Please sign in to comment.