Explorar o código

Don't convert type of node if it is not needed (#23786)

LeviPesin %!s(int64=3) %!d(string=hai) anos
pai
achega
1e0cdd9c63
Modificáronse 1 ficheiros con 7 adicións e 1 borrados
  1. 7 1
      examples/jsm/nodes/ShaderNode.js

+ 7 - 1
examples/jsm/nodes/ShaderNode.js

@@ -236,7 +236,13 @@ const ConvertType = function ( type, cacheMap = null ) {
 
 			const nodes = params.map( getAutoTypedConstNode );
 
-			return nodeObject( new ConvertNode( nodes.length === 1 ? nodes[ 0 ] : new JoinNode( nodes ), type ) );
+			if ( nodes.length === 1 ) {
+
+				return nodeObject( nodes[ 0 ].nodeType === type ? nodes[ 0 ] : new ConvertNode( nodes[ 0 ], type ) );
+
+			}
+
+			return nodeObject( new ConvertNode( new JoinNode( nodes ), type ) );
 
 		}