Skip to content

Commit

Permalink
TSL: convertToTexture() - return pass() texture if available (#29957
Browse files Browse the repository at this point in the history
)
  • Loading branch information
sunag authored Nov 25, 2024
1 parent 015480e commit 54ce779
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/nodes/utils/RTTNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,12 @@ class RTTNode extends TextureNode {
export default RTTNode;

export const rtt = ( node, ...params ) => nodeObject( new RTTNode( nodeObject( node ), ...params ) );
export const convertToTexture = ( node, ...params ) => node.isTextureNode ? node : rtt( node, ...params );

export const convertToTexture = ( node, ...params ) => {

if ( node.isTextureNode ) return node;
if ( node.isPassNode ) return node.getTextureNode();

return rtt( node, ...params );

};

0 comments on commit 54ce779

Please sign in to comment.