MaterialX 1.39.0
Loading...
Searching...
No Matches
CompoundNode.h
1//
2// Copyright Contributors to the MaterialX Project
3// SPDX-License-Identifier: Apache-2.0
4//
5
6#ifndef MATERIALX_COMPOUNDNODE_H
7#define MATERIALX_COMPOUNDNODE_H
8
12
13MATERIALX_NAMESPACE_BEGIN
14
16class MX_GENSHADER_API CompoundNode : public ShaderNodeImpl
17{
18 public:
19 static ShaderNodeImplPtr create();
20
21 void initialize(const InterfaceElement& element, GenContext& context) override;
22
23 void createVariables(const ShaderNode& node, GenContext& context, Shader& shader) const override;
24
25 void emitFunctionDefinition(const ShaderNode& node, GenContext& context, ShaderStage& stage) const override;
26
27 void emitFunctionCall(const ShaderNode& node, GenContext& context, ShaderStage& stage) const override;
28
29 ShaderGraph* getGraph() const override { return _rootGraph.get(); }
30
31 protected:
32 ShaderGraphPtr _rootGraph;
33 string _functionName;
34};
35
36MATERIALX_NAMESPACE_END
37
38#endif
shared_ptr< ShaderNodeImpl > ShaderNodeImplPtr
Shared pointer to a ShaderNodeImpl.
Definition: Library.h:40
Shader instance class created during shader generation.
Shader graph class.
shared_ptr< class ShaderGraph > ShaderGraphPtr
A shared pointer to a shader graph.
Definition: ShaderGraph.h:39
Base class for shader node implementations.
Compound node implementation.
Definition: CompoundNode.h:17
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.
ShaderGraph * getGraph() const override
Return a pointer to the graph if this implementation is using a graph, or returns nullptr otherwise.
Definition: CompoundNode.h:29
void initialize(const InterfaceElement &element, GenContext &context) override
Initialize with the given implementation element.
void createVariables(const ShaderNode &node, GenContext &context, Shader &shader) const override
Create shader variables needed for the implementation of this node (e.g.
A context class for shader generation.
Definition: GenContext.h:31
The base class for interface elements such as Node, NodeDef, and NodeGraph.
Definition: Interface.h:286
Class representing a graph (DAG) for shader generation.
Definition: ShaderGraph.h:44
Class containing all data needed during shader generation.
Definition: Shader.h:33
Class representing a node in the shader generation DAG.
Definition: ShaderNode.h:320
Class handling the shader generation implementation for a node.
Definition: ShaderNodeImpl.h:32
A shader stage, containing the state and resulting source code for the stage.
Definition: ShaderStage.h:139