6#ifndef MATERIALX_SHADERGENERATOR_H
7#define MATERIALX_SHADERGENERATOR_H
23MATERIALX_NAMESPACE_BEGIN
53 virtual void emitScopeEnd(
ShaderStage& stage,
bool semicolon =
false,
bool newline =
true)
const;
56 virtual void emitLineBegin(
ShaderStage& stage)
const;
59 virtual void emitLineEnd(
ShaderStage& stage,
bool semicolon =
true)
const;
62 virtual void emitLineBreak(
ShaderStage& stage)
const;
65 virtual void emitString(
const string& str,
ShaderStage& stage)
const;
68 virtual void emitLine(
const string& str,
ShaderStage& stage,
bool semicolon =
true)
const;
71 virtual void emitComment(
const string& str,
ShaderStage& stage)
const;
132 bool assignValue =
true)
const;
141 bool assignValue =
true)
const;
144 virtual void getClosureContexts(
const ShaderNode& node, vector<ClosureContext*>& cct)
const;
153 void registerImplementation(
const string& name, CreatorFunction<ShaderNodeImpl> creator);
156 void registerImplementation(
const StringVec& nameVec, CreatorFunction<ShaderNodeImpl> creator);
159 bool implementationRegistered(
const string& name)
const;
167 _colorManagementSystem = colorManagementSystem;
173 return _colorManagementSystem;
179 _unitSystem = unitSystem;
191 return _tokenSubstitutions;
226 static const string T_FILE_TRANSFORM_UV;
242 using Exception::Exception;
245MATERIALX_NAMESPACE_END
Color management system classes.
shared_ptr< class ColorManagementSystem > ColorManagementSystemPtr
A shared pointer to a ColorManagementSystem.
Definition: ColorManagementSystem.h:25
shared_ptr< Document > DocumentPtr
A shared pointer to a Document.
Definition: Document.h:22
shared_ptr< Element > ElementPtr
A shared pointer to an Element.
Definition: Element.h:31
Class instantiator factory helper class.
Cross-platform support for file and search paths.
vector< string > StringVec
A vector of strings.
Definition: Library.h:57
std::unordered_map< string, string > StringMap
An unordered map with strings as both keys and values.
Definition: Library.h:59
Macros for declaring imported and exported symbols.
shared_ptr< ShaderStage > ShaderStagePtr
Shared pointer to a ShaderStage.
Definition: Library.h:36
shared_ptr< Shader > ShaderPtr
Shared pointer to a Shader.
Definition: Library.h:34
shared_ptr< ShaderNodeImpl > ShaderNodeImplPtr
Shared pointer to a ShaderNodeImpl.
Definition: Library.h:40
shared_ptr< class ShaderGraph > ShaderGraphPtr
A shared pointer to a shader graph.
Definition: ShaderGraph.h:39
Class related to holding information for shader stages.
Base class for syntax handling for shader generators.
shared_ptr< Syntax > SyntaxPtr
Shared pointer to a Syntax.
Definition: Syntax.h:26
shared_ptr< class UnitSystem > UnitSystemPtr
A shared pointer to a UnitSystem.
Definition: UnitSystem.h:26
The base class for exceptions that are propagated from the MaterialX library to the client applicatio...
Definition: Exception.h:22
An exception that is thrown when shader generation fails.
Definition: ShaderGenerator.h:240
Factory class for creating instances of classes given their type name.
Definition: Factory.h:19
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
A node definition element within a Document.
Definition: Definition.h:82
Base class for shader generators All third-party shader generators should derive from this class.
Definition: ShaderGenerator.h:31
ColorManagementSystemPtr getColorManagementSystem() const
Returns the color management system.
Definition: ShaderGenerator.h:171
const StringMap & getTokenSubstitutions() const
Return the map of token substitutions used by the generator.
Definition: ShaderGenerator.h:189
void setUnitSystem(UnitSystemPtr unitSystem)
Sets the unit system.
Definition: ShaderGenerator.h:177
void emitValue(const T &value, ShaderStage &stage) const
Add a value.
Definition: ShaderGenerator.h:83
virtual const string & getTarget() const
Return the name of the target this generator is for.
Definition: ShaderGenerator.h:37
void setColorManagementSystem(ColorManagementSystemPtr colorManagementSystem)
Sets the color management system.
Definition: ShaderGenerator.h:165
const Syntax & getSyntax() const
Return the syntax object for the language used by the code generator.
Definition: ShaderGenerator.h:150
virtual ~ShaderGenerator()
Destructor.
Definition: ShaderGenerator.h:34
void setFunctionName(const string &functionName, ShaderStage &stage) const
Set function name for a stage.
Definition: ShaderGenerator.h:213
UnitSystemPtr getUnitSystem() const
Returns the unit system.
Definition: ShaderGenerator.h:183
virtual ShaderPtr generate(const string &, ElementPtr, GenContext &) const
Generate a shader starting from the given element, translating the element and all dependencies upstr...
Definition: ShaderGenerator.h:44
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:326
An output on a ShaderNode.
Definition: ShaderNode.h:301
An input or output port on a ShaderNode.
Definition: ShaderNode.h:123
A shader stage, containing the state and resulting source code for the stage.
Definition: ShaderStage.h:139
void setFunctionName(const string &functionName)
Set stage function name.
Definition: ShaderStage.h:284
void addValue(const T &value)
Add a value.
Definition: ShaderStage.h:264
Base class for syntax objects used by shader generators to emit code with correct syntax for each lan...
Definition: Syntax.h:40
Punctuation
Punctuation types.
Definition: Syntax.h:44
A block of variables in a shader stage.
Definition: ShaderStage.h:61