فهرست منبع

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
Levi Pesin 1 سال پیش
والد
کامیت
cb644716ad

+ 2 - 2
examples/jsm/nodes/lighting/AmbientLightNode.js

@@ -22,6 +22,6 @@ class AmbientLightNode extends AnalyticLightNode {
 
 export default AmbientLightNode;
 
-addLightNode( AmbientLight, AmbientLightNode );
-
 addNodeClass( 'AmbientLightNode', AmbientLightNode );
+
+addLightNode( AmbientLight, AmbientLightNode );

+ 2 - 2
examples/jsm/nodes/lighting/DirectionalLightNode.js

@@ -35,6 +35,6 @@ class DirectionalLightNode extends AnalyticLightNode {
 
 export default DirectionalLightNode;
 
-addLightNode( DirectionalLight, DirectionalLightNode );
-
 addNodeClass( 'DirectionalLightNode', DirectionalLightNode );
+
+addLightNode( DirectionalLight, DirectionalLightNode );

+ 2 - 2
examples/jsm/nodes/lighting/HemisphereLightNode.js

@@ -50,6 +50,6 @@ class HemisphereLightNode extends AnalyticLightNode {
 
 export default HemisphereLightNode;
 
-addLightNode( HemisphereLight, HemisphereLightNode );
-
 addNodeClass( 'HemisphereLightNode', HemisphereLightNode );
+
+addLightNode( HemisphereLight, HemisphereLightNode );

+ 2 - 2
examples/jsm/nodes/lighting/IESSpotLightNode.js

@@ -34,6 +34,6 @@ class IESSpotLightNode extends SpotLightNode {
 
 export default IESSpotLightNode;
 
-addLightNode( IESSpotLight, IESSpotLightNode );
-
 addNodeClass( 'IESSpotLightNode', IESSpotLightNode );
+
+addLightNode( IESSpotLight, IESSpotLightNode );

+ 3 - 3
examples/jsm/nodes/lighting/LightsNode.js

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

+ 2 - 2
examples/jsm/nodes/lighting/PointLightNode.js

@@ -63,6 +63,6 @@ class PointLightNode extends AnalyticLightNode {
 
 export default PointLightNode;
 
-addLightNode( PointLight, PointLightNode );
-
 addNodeClass( 'PointLightNode', PointLightNode );
+
+addLightNode( PointLight, PointLightNode );

+ 2 - 2
examples/jsm/nodes/lighting/SpotLightNode.js

@@ -84,6 +84,6 @@ class SpotLightNode extends AnalyticLightNode {
 
 export default SpotLightNode;
 
-addLightNode( SpotLight, SpotLightNode );
-
 addNodeClass( 'SpotLightNode', SpotLightNode );
+
+addLightNode( SpotLight, SpotLightNode );