MaterialX 1.39.5
Loading...
Searching...
No Matches
ShaderNode Class Reference

Class representing a node in the shader generation DAG. More...

#include <ShaderNode.h>

Inheritance diagram for ShaderNode:
ShaderGraph

Classes

class  Classification
 Flags for classifying nodes into different categories. More...
 

Public Member Functions

 ShaderNode (const ShaderGraph *parent, const string &name)
 Constructor.
 
virtual bool isAGraph () const
 Return true if this node is a graph.
 
const ShaderGraphgetParent () const
 Return the parent graph that owns this node.
 
void setClassification (uint32_t c)
 Set classification bits for this node, replacing any previous set bits.
 
uint32_t getClassification () const
 Get classification bits set for this node.
 
void addClassification (uint32_t c)
 Add classification bits to this node.
 
bool hasClassification (uint32_t c) const
 Return true if this node matches the given classification.
 
const string & getName () const
 Return the name of this node.
 
const string & getUniqueId () const
 Return the unique identifier for this node, used as its key in the parent graph's node map.
 
const ShaderNodeImplgetImplementation () const
 Return the implementation used for this node.
 
void initialize (const Node &node, const NodeDef &nodeDef, GenContext &context)
 Initialize this shader node with all required data from the given node and nodedef.
 
ShaderInputaddInput (const string &name, TypeDesc type)
 Add inputs/outputs.
 
ShaderOutputaddOutput (const string &name, TypeDesc type)
 
size_t numInputs () const
 Get number of inputs/outputs.
 
size_t numOutputs () const
 
ShaderInputgetInput (size_t index)
 Get inputs/outputs by index.
 
ShaderOutputgetOutput (size_t index=0)
 
const ShaderInputgetInput (size_t index) const
 
const ShaderOutputgetOutput (size_t index=0) const
 
ShaderInputgetInput (const string &name)
 Get inputs/outputs by name.
 
ShaderOutputgetOutput (const string &name)
 
const ShaderInputgetInput (const string &name) const
 
const ShaderOutputgetOutput (const string &name) const
 
const vector< ShaderInput * > & getInputs () const
 Get vector of inputs/outputs.
 
const vector< ShaderOutput * > & getOutputs () const
 
void setMetadata (ShaderMetadataVecPtr metadata)
 Set the metadata vector.
 
ShaderMetadataVecPtr getMetadata ()
 Get the metadata vector.
 
const ShaderMetadataVecPtr & getMetadata () const
 Get the metadata vector.
 
bool isEditable (const ShaderInput &input) const
 Returns true if an input is editable by users.
 
bool isEditable (const ShaderGraphInputSocket &input) const
 Returns true if a graph input is accessible by users.
 

Static Public Member Functions

static ShaderNodePtr create (const ShaderGraph *parent, const string &name, const NodeDef &nodeDef, GenContext &context)
 Create a new node from a nodedef.
 
static ShaderNodePtr create (const ShaderGraph *parent, const string &name, ShaderNodeImplPtr impl, unsigned int classification=Classification::TEXTURE)
 Create a new node from a node implementation.
 

Static Public Attributes

static const ShaderNodePtr NONE
 
static const string CONSTANT
 
static const string DOT
 
static const string IMAGE
 
static const string SURFACESHADER
 
static const string BACKSURFACESHADER
 
static const string BSDF_R
 
static const string BSDF_T
 
static const string TEXTURE2D_GROUPNAME
 
static const string TEXTURE3D_GROUPNAME
 
static const string PROCEDURAL2D_GROUPNAME
 
static const string PROCEDURAL3D_GROUPNAME
 
static const string GEOMETRIC_GROUPNAME
 

Protected Member Functions

void createMetadata (const NodeDef &nodeDef, GenContext &context)
 Create metadata from the nodedef according to registered metadata.
 

Protected Attributes

const ShaderGraph_parent
 
string _name
 
string _uniqueId
 
uint32_t _classification
 
std::unordered_map< string, ShaderInputPtr_inputMap
 
vector< ShaderInput * > _inputOrder
 
std::unordered_map< string, ShaderOutputPtr_outputMap
 
vector< ShaderOutput * > _outputOrder
 
ShaderNodeImplPtr _impl
 
ShaderMetadataVecPtr _metadata
 

Friends

class ShaderGraph
 

Detailed Description

Class representing a node in the shader generation DAG.

Member Function Documentation

◆ getParent()

const ShaderGraph * getParent ( ) const
inline

Return the parent graph that owns this node.

If this node is a root graph it has no parent and nullptr will be returned.

◆ isAGraph()

virtual bool isAGraph ( ) const
inlinevirtual

Return true if this node is a graph.

Reimplemented in ShaderGraph.

◆ isEditable() [1/2]

bool isEditable ( const ShaderGraphInputSocket & input) const
inline

Returns true if a graph input is accessible by users.

Editable inputs are allowed to be published as shader uniforms and hence must be presentable in a user interface.

◆ isEditable() [2/2]

bool isEditable ( const ShaderInput & input) const
inline

Returns true if an input is editable by users.

Editable inputs are allowed to be published as shader uniforms and hence must be presentable in a user interface.


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