Ver Fonte

Node: Fix .getNodeType() if .construct() return some Node (#26631)

sunag há 1 ano atrás
pai
commit
3bb6de2027

+ 2 - 2
examples/jsm/nodes/core/AttributeNode.js

@@ -20,12 +20,12 @@ class AttributeNode extends Node {
 
 	getNodeType( builder ) {
 
-		const attributeName = this.getAttributeName( builder );
-
 		let nodeType = super.getNodeType( builder );
 
 		if ( nodeType === null ) {
 
+			const attributeName = this.getAttributeName( builder );
+
 			if ( builder.hasGeometryAttribute( attributeName ) ) {
 
 				const attribute = builder.geometry.getAttribute( attributeName );

+ 9 - 1
examples/jsm/nodes/core/Node.js

@@ -105,7 +105,15 @@ class Node extends EventDispatcher {
 
 	}
 
-	getNodeType( /*builder*/ ) {
+	getNodeType( builder ) {
+
+		const nodeProperties = builder.getNodeProperties( this );
+
+		if ( nodeProperties.outputNode ) {
+
+			return nodeProperties.outputNode.getNodeType( builder );
+
+		}
 
 		return this.nodeType;
 

+ 1 - 1
examples/jsm/nodes/materials/NodeMaterial.js

@@ -303,7 +303,7 @@ class NodeMaterial extends ShaderMaterial {
 
 		if ( ( emissiveNode && emissiveNode.isNode === true ) || ( material.emissive && material.emissive.isColor === true ) ) {
 
-			outgoingLightNode = outgoingLightNode.add( emissiveNode ? vec3( emissiveNode ) : materialEmissive );
+			outgoingLightNode = outgoingLightNode.add( vec3( emissiveNode ? emissiveNode : materialEmissive ) );
 
 		}
 

+ 1 - 1
examples/jsm/nodes/utils/SplitNode.js

@@ -59,7 +59,7 @@ class SplitNode extends Node {
 
 			if ( this.components.length === nodeTypeLength && this.components === stringVectorComponents.slice( 0, this.components.length ) ) {
 
-				// unecessary swizzle
+				// unnecessary swizzle
 
 				snippet = builder.format( nodeSnippet, type, output );