6 #ifndef MATERIALX_SHADERGRAPH_H
7 #define MATERIALX_SHADERGRAPH_H
62 bool isAGraph()
const override {
return true; }
68 const ShaderNode* getNode(
const string& name)
const;
71 const vector<ShaderNode*>&
getNodes()
const {
return _nodeOrder; }
109 void topologicalSort();
123 void createConnectedNodes(
const ElementPtr& downstreamElement,
173 const string& sourceColorSpace,
const string& targetColorSpace,
bool asInput);
183 std::unordered_map<string, ShaderNodePtr>
_nodeMap;
222 return _upstream == rhs._upstream &&
223 _downstream == rhs._downstream &&
224 _stack == rhs._stack;
228 return !(*
this == rhs);
256 using StackFrame = std::pair<ShaderOutput*, size_t>;
257 std::vector<StackFrame> _stack;
258 std::set<ShaderOutput*> _path;
std::unordered_map< ShaderInput *, UnitTransform > _inputUnitTransformMap
ShaderGraphEdge operator*() const
Dereference this iterator, returning the current output in the traversal.
ShaderGraphInputSocket * getInputSocket(size_t index)
Get socket by index.
vector< ShaderInput * > _inputOrder
bool operator==(const ShaderGraphEdgeIterator &rhs) const
std::unordered_map< string, ShaderNodePtr > _nodeMap
#define MATERIALX_NAMESPACE_BEGIN
ShaderOutput * getOutput(size_t index=0)
ShaderInput * getInput(size_t index)
Get inputs/outputs by index.
shared_ptr< class UnitSystem > UnitSystemPtr
A shared pointer to a UnitSystem.
vector< ShaderOutput * > _outputOrder
ShaderGraphOutputSocket * getOutputSocket(const string &name)
shared_ptr< const Node > ConstNodePtr
A shared pointer to a const Node.
size_t numOutputs() const
const vector< ShaderGraphOutputSocket * > & getOutputSockets() const
ShaderGraphOutputSocket * getOutputSocket(size_t index=0)
const ShaderGraphInputSocket * getInputSocket(size_t index) const
std::vector< ShaderNode * > _nodeOrder
bool operator!=(const ShaderGraphEdgeIterator &rhs) const
ShaderGraphEdgeIterator & begin()
Return a reference to this iterator to begin traversal.
size_t numInputSockets() const
Get number of input sockets.
ShaderGraphEdge(ShaderOutput *up, ShaderInput *down)
shared_ptr< class ColorManagementSystem > ColorManagementSystemPtr
A shared pointer to a ColorManagementSystem.
ShaderGraphInputSocket * getInputSocket(const string &name)
Get socket by name.
shared_ptr< class ShaderNode > ShaderNodePtr
Shared pointer to a ShaderNode.
static ShaderNodePtr create(const ShaderGraph *parent, const string &name, const NodeDef &nodeDef, GenContext &context)
Create a new node from a nodedef.
GLuint const GLchar * name
shared_ptr< class ShaderGraph > ShaderGraphPtr
A shared pointer to a shader graph.
GA_API const UT_StringHolder transform
const ShaderGraphOutputSocket * getOutputSocket(size_t index=0) const
const ShaderGraphOutputSocket * getOutputSocket(const string &name) const
size_t numOutputSockets() const
Get number of output sockets.
virtual ~ShaderGraph()
Desctructor.
std::unordered_map< ShaderOutput *, ColorSpaceTransform > _outputColorTransformMap
~ShaderGraphEdgeIterator()
bool isAGraph() const override
Return true if this node is a graph.
IdentifierMap _identifiers
const vector< ShaderNode * > & getNodes() const
Get a vector of all nodes in order.
GA_API const UT_StringHolder up
std::unordered_map< string, size_t > IdentifierMap
const ShaderGraphInputSocket * getInputSocket(const string &name) const
const vector< ShaderGraphInputSocket * > & getInputSockets() const
Get vector of sockets.
std::set< string > StringSet
A set of strings.
std::unordered_map< ShaderOutput *, UnitTransform > _outputUnitTransformMap
shared_ptr< Element > ElementPtr
A shared pointer to an Element.
shared_ptr< ValueElement > ValueElementPtr
A shared pointer to a ValueElement.
#define MATERIALX_NAMESPACE_END
std::unordered_map< ShaderInput *, ColorSpaceTransform > _inputColorTransformMap
size_t numInputs() const
Get number of inputs/outputs.
ConstDocumentPtr _document
shared_ptr< const Document > ConstDocumentPtr
A shared pointer to a const Document.
IdentifierMap & getIdentifierMap()
Return the map of unique identifiers used in the scope of this graph.