MaterialX 1.39.2
Loading...
Searching...
No Matches
SourceCodeNode Class Reference

Implementation for a node using data-driven static source code. More...

#include <SourceCodeNode.h>

Inheritance diagram for SourceCodeNode:
ShaderNodeImpl ClosureSourceCodeNode HwImageNode LightShaderNodeGlsl

Public Member Functions

void initialize (const InterfaceElement &element, GenContext &context) override
 Initialize with the given implementation element.
 
void emitFunctionDefinition (const ShaderNode &node, GenContext &context, ShaderStage &stage) const override
 Emit function definition for the given node instance.
 
void emitFunctionCall (const ShaderNode &node, GenContext &context, ShaderStage &stage) const override
 Emit the function call or inline source code for given node instance in the given context.
 
- Public Member Functions inherited from ShaderNodeImpl
virtual const string & getTarget () const
 Return an identifier for the target used by this implementation.
 
const string & getName () const
 Return the name of this implementation.
 
size_t getHash () const
 Return a hash for this implementation.
 
virtual void addInputs (ShaderNode &node, GenContext &context) const
 Add additional inputs on a node.
 
virtual void setValues (const Node &node, ShaderNode &shaderNode, GenContext &context) const
 Set values for additional inputs on a node.
 
virtual void addClassification (ShaderNode &node) const
 Add additional classifications on a node.
 
virtual void createVariables (const ShaderNode &node, GenContext &context, Shader &shader) const
 Create shader variables needed for the implementation of this node (e.g.
 
virtual void emitOutputVariables (const ShaderNode &node, GenContext &context, ShaderStage &stage) const
 Emit declaration and initialization of output variables to use in a function call.
 
virtual ShaderGraphgetGraph () const
 Return a pointer to the graph if this implementation is using a graph, or returns nullptr otherwise.
 
virtual bool isEditable (const ShaderInput &) const
 Returns true if an input is editable by users.
 
virtual bool isEditable (const ShaderGraphInputSocket &) const
 Returns true if a graph input is accessible by users.
 

Static Public Member Functions

static ShaderNodeImplPtr create ()
 

Protected Member Functions

virtual void resolveSourceCode (const InterfaceElement &element, GenContext &context)
 Resolve the source file and read the source code during the initialization of the node.
 
- Protected Member Functions inherited from ShaderNodeImpl
 ShaderNodeImpl ()
 Protected constructor.
 

Protected Attributes

bool _inlined
 
string _functionName
 
string _functionSource
 
FilePath _sourceFilename
 
- Protected Attributes inherited from ShaderNodeImpl
string _name
 
size_t _hash
 

Detailed Description

Implementation for a node using data-driven static source code.

This is the default implementation used for all nodes that do not have a custom ShaderNodeImpl class.

Member Function Documentation

◆ emitFunctionCall()

void emitFunctionCall ( const ShaderNode & node,
GenContext & context,
ShaderStage & stage ) const
overridevirtual

Emit the function call or inline source code for given node instance in the given context.

Reimplemented from ShaderNodeImpl.

◆ emitFunctionDefinition()

void emitFunctionDefinition ( const ShaderNode & node,
GenContext & context,
ShaderStage & stage ) const
overridevirtual

Emit function definition for the given node instance.

Reimplemented from ShaderNodeImpl.

◆ initialize()

void initialize ( const InterfaceElement & element,
GenContext & context )
overridevirtual

Initialize with the given implementation element.

Initialization must set the name and hash for the implementation, as well as any other data needed to emit code for the node.

Reimplemented from ShaderNodeImpl.


The documentation for this class was generated from the following file: