MaterialX 1.38.9
Loading...
Searching...
No Matches
SourceCodeNode.h
1//
2// Copyright Contributors to the MaterialX Project
3// SPDX-License-Identifier: Apache-2.0
4//
5
6#ifndef MATERIALX_SOURCECODENODE_H
7#define MATERIALX_SOURCECODENODE_H
8
10
12
13MATERIALX_NAMESPACE_BEGIN
14
19class MX_GENSHADER_API SourceCodeNode : public ShaderNodeImpl
20{
21 public:
22 static ShaderNodeImplPtr create();
23
24 void initialize(const InterfaceElement& element, GenContext& context) override;
25 void emitFunctionDefinition(const ShaderNode& node, GenContext& context, ShaderStage& stage) const override;
26 void emitFunctionCall(const ShaderNode& node, GenContext& context, ShaderStage& stage) const override;
27
28 protected:
29 bool _inlined;
30 string _functionName;
31 string _functionSource;
32 FilePath _sourceFilename;
33};
34
35MATERIALX_NAMESPACE_END
36
37#endif
Cross-platform support for file and search paths.
shared_ptr< ShaderNodeImpl > ShaderNodeImplPtr
Shared pointer to a ShaderNodeImpl.
Definition: Library.h:40
Base class for shader node implementations.
A generic file path, supporting both syntactic and file system operations.
Definition: File.h:27
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:318
Class representing a node in the shader generation DAG.
Definition: ShaderNode.h:326
Class handling the shader generation implementation for a node.
Definition: ShaderNodeImpl.h:31
virtual void emitFunctionCall(const ShaderNode &node, GenContext &context, ShaderStage &stage) const
Emit the function call or inline source code for given node instance in the given context.
Definition: ShaderNodeImpl.cpp:57
virtual void emitFunctionDefinition(const ShaderNode &node, GenContext &context, ShaderStage &stage) const
Emit function definition for the given node instance.
Definition: ShaderNodeImpl.cpp:53
virtual void initialize(const InterfaceElement &element, GenContext &context)
Initialize with the given implementation element.
Definition: ShaderNodeImpl.cpp:25
A shader stage, containing the state and resulting source code for the stage.
Definition: ShaderStage.h:139
Implemention for a node using data-driven static source code.
Definition: SourceCodeNode.h:20