Skip to content

Commit

Permalink
TSL: Introduce after and before
Browse files Browse the repository at this point in the history
  • Loading branch information
sunag committed Jul 13, 2024
1 parent 677d83f commit 98992f7
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/nodes/Nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export { default as VaryingNode, varying } from './core/VaryingNode.js';
export { default as OutputStructNode, outputStruct } from './core/OutputStructNode.js';
export { default as MRTNode, mrt } from './core/MRTNode.js';
export { default as NodeHandler } from './core/NodeHandler.js';
export { default as AfterNode, after, before } from './utils/AfterNode.js';

import * as NodeUtils from './core/NodeUtils.js';
export { NodeUtils };
Expand Down
38 changes: 38 additions & 0 deletions src/nodes/utils/AfterNode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import Node from '../core/Node.js';
import { nodeProxy, addNodeElement } from '../shadernode/ShaderNode.js';

class AfterNode extends Node {

constructor( node, afterNode ) {

super( 'void' );

this.node = node;
this.afterNode = afterNode;

}

getNodeType( builder ) {

return this.afterNode.getNodeType( builder );

}

setup( builder ) {

this.node.build( builder );

return this.afterNode;

}

}

export const after = nodeProxy( AfterNode );
export const before = ( node, afterNode ) => after( afterNode, node );

addNodeElement( 'after', after );
addNodeElement( 'before', before );

export default AfterNode;

0 comments on commit 98992f7

Please sign in to comment.