소스 검색

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

LeviPesin 3 년 전
부모
커밋
1e0cdd9c63
1개의 변경된 파일7개의 추가작업 그리고 1개의 파일을 삭제
  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 ) );
 
 		}