6 #ifndef MATERIALX_SHADERGENERATOR_H
7 #define MATERIALX_SHADERGENERATOR_H
54 virtual void emitScopeEnd(
ShaderStage& stage,
bool semicolon =
false,
bool newline =
true)
const;
57 virtual void emitLineBegin(
ShaderStage& stage)
const;
60 virtual void emitLineEnd(
ShaderStage& stage,
bool semicolon =
true)
const;
63 virtual void emitLineBreak(
ShaderStage& stage)
const;
66 virtual void emitString(
const string& str,
ShaderStage& stage)
const;
69 virtual void emitLine(
const string& str,
ShaderStage& stage,
bool semicolon =
true)
const;
72 virtual void emitComment(
const string& str,
ShaderStage& stage)
const;
136 bool assignValue =
true)
const;
145 bool assignValue =
true)
const;
165 void registerImplementation(
const string&
name, CreatorFunction<ShaderNodeImpl> creator);
168 void registerImplementation(
const StringVec& nameVec, CreatorFunction<ShaderNodeImpl> creator);
171 bool implementationRegistered(
const string&
name)
const;
185 _colorManagementSystem = colorManagementSystem;
191 return _colorManagementSystem;
197 _unitSystem = unitSystem;
215 return _tokenSubstitutions;
221 _refactors.push_back(refactor);
231 virtual void applyDefaultOptions(
GenOptions& options)
const;
234 virtual void registerTypeDefs(
const DocumentPtr& doc);
287 #endif // MATERIALX_SHADERGENERATOR_H
GT_API const UT_StringHolder filename
virtual const string & getLightDataTypevarString() const
ColorManagementSystemPtr _colorManagementSystem
shared_ptr< ShaderNodeImpl > ShaderNodeImplPtr
Shared pointer to a ShaderNodeImpl.
void setFunctionName(const string &functionName, ShaderStage &stage) const
Set function name for a stage.
Factory< ShaderNodeImpl > _implFactory
void addValue(const T &value)
Add a value.
virtual bool nodeNeedsClosureData(const ShaderNode &) const
Return true if the node needs the additional ClosureData added.
void setColorManagementSystem(ColorManagementSystemPtr colorManagementSystem)
Sets the color management system.
shared_ptr< class ShaderGraphRefactor > ShaderGraphRefactorPtr
A shared pointer to a shader graph refactor.
static const string T_FILE_TRANSFORM_UV
#define MATERIALX_NAMESPACE_BEGIN
vector< string > StringVec
A vector of strings.
GLsizei const GLfloat * value
const Syntax & getSyntax() const
Return the syntax object for the language used by the code generator.
shared_ptr< class UnitSystem > UnitSystemPtr
A shared pointer to a UnitSystem.
vector< ShaderGraphRefactorPtr > _refactors
MATERIALX_NAMESPACE_BEGIN MX_CORE_API const string EMPTY_STRING
shared_ptr< Syntax > SyntaxPtr
Shared pointer to a Syntax.
void registerRefactor(ShaderGraphRefactorPtr refactor)
Register a shader graph refactoring pass.
shared_ptr< class TypeSystem > TypeSystemPtr
void setUnitSystem(UnitSystemPtr unitSystem)
Sets the unit system.
const StringMap & getTokenSubstitutions() const
Return the map of token substitutions used by the generator.
TypeSystemPtr _typeSystem
shared_ptr< class ColorManagementSystem > ColorManagementSystemPtr
A shared pointer to a ColorManagementSystem.
void emitValue(const T &value, ShaderStage &stage) const
Add a value.
const vector< ShaderGraphRefactorPtr > & getRefactors() const
Return the registered graph refactoring passes.
UnitSystemPtr _unitSystem
shared_ptr< Document > DocumentPtr
A shared pointer to a Document.
virtual void emitClosureDataArg(const ShaderNode &, GenContext &, ShaderStage &) const
GLuint const GLchar * name
shared_ptr< class ShaderGraph > ShaderGraphPtr
A shared pointer to a shader graph.
void setFunctionName(const string &functionName)
Set stage function name.
ColorManagementSystemPtr getColorManagementSystem() const
Returns the color management system.
virtual const string & getTarget() const
Return the name of the target this generator is for.
TypeSystemPtr getTypeSystem() const
Returns the type system.
virtual void emitClosureDataParameter(const ShaderNode &, GenContext &, ShaderStage &) const
shared_ptr< ShaderStage > ShaderStagePtr
Shared pointer to a ShaderStage.
Punctuation
Punctuation types.
UnitSystemPtr getUnitSystem() const
Returns the unit system.
std::unordered_map< string, string > StringMap
An unordered map with strings as both keys and values.
shared_ptr< Shader > ShaderPtr
Shared pointer to a Shader.
shared_ptr< Element > ElementPtr
A shared pointer to an Element.
#define MATERIALX_NAMESPACE_END
static const string LIGHTDATA_TYPEVAR_STRING
virtual ~ShaderGenerator()
Destructor.
virtual ShaderPtr generate(const string &, ElementPtr, GenContext &) const
StringMap _tokenSubstitutions