6 #ifndef MATERIALX_GENCONTEXT_H
7 #define MATERIALX_GENCONTEXT_H
56 return _sg->getTypeSystem()->getType(name);
63 _sourceCodeSearchPath.append(path);
70 _sourceCodeSearchPath.append(path);
89 _reservedWords.insert(names.begin(), names.end());
96 return _reservedWords;
107 void getNodeImplementationNames(
StringSet& names);
110 void clearNodeImplementations();
115 _parentNodes.push_back(node);
121 _parentNodes.pop_back();
134 auto it = _userData.find(name);
135 if (it != _userData.end())
137 it->second.push_back(data);
141 _userData[
name] = { data };
148 auto it = _userData.find(name);
149 if (it != _userData.end())
151 it->second.pop_back();
156 void clearUserData();
163 auto it = _userData.find(name);
164 return it != _userData.end() && !it->second.empty() ? it->second.back()->asA<
T>() :
nullptr;
170 void addInputSuffix(
const ShaderInput* input,
const string& suffix);
179 void getInputSuffix(
const ShaderInput* input,
string& suffix)
const;
184 void addOutputSuffix(
const ShaderOutput* output,
const string& suffix);
193 void getOutputSuffix(
const ShaderOutput* output,
string& suffix)
const;
198 _applicationVariableHandler = handler;
204 return _applicationVariableHandler;
216 std::unordered_map<string, vector<GenUserDataPtr>>
_userData;
242 #endif // MATERIALX_GENCONTEXT_H
FileSearchPath _sourceCodeSearchPath
vector< ConstNodePtr > _parentNodes
GT_API const UT_StringHolder filename
FilePath getNormalized() const
shared_ptr< ShaderNodeImpl > ShaderNodeImplPtr
Shared pointer to a ShaderNodeImpl.
const vector< ConstNodePtr > & getParentNodes()
Return the current stack of parent nodes.
#define MATERIALX_NAMESPACE_BEGIN
A RAII class for overriding port variable names.
const StringSet & getReservedWords() const
GLsizei const GLchar *const * path
void addReservedWords(const StringSet &names)
shared_ptr< const Node > ConstNodePtr
A shared pointer to a const Node.
std::unordered_map< const ShaderInput *, string > _inputSuffix
std::function< void(ShaderNode *, GenContext &)> ApplicationVariableHandler
A standard function to allow for handling of application variables for a given node.
void popUserData(const string &name)
Remove user data from the context.
const GenOptions & getOptions() const
Return shader generation options.
bool isEmpty() const
Return true if the given path is empty.
ShaderGenerator & getShaderGenerator()
Return shader generatior.
std::unordered_map< string, ShaderNodeImplPtr > _nodeImpls
ApplicationVariableHandler getApplicationVariableHandler() const
Get handler for application variables.
std::shared_ptr< GenUserData > GenUserDataPtr
Shared pointer to a GenUserData.
TypeDesc getTypeDesc(const string &name) const
Return a TypeDesc for the given type name.
ApplicationVariableHandler _applicationVariableHandler
GLuint const GLchar * name
std::unordered_map< string, vector< GenUserDataPtr > > _userData
std::shared_ptr< T > getUserData(const string &name)
void registerSourceCodeSearchPath(const FileSearchPath &path)
void popParentNode()
Pop the current parent node from the stack.
void pushUserData(const string &name, GenUserDataPtr data)
void setApplicationVariableHandler(ApplicationVariableHandler handler)
Set handler for application variables.
void prepend(const FilePath &path)
Prepend the given path to the sequence.
GenOptions & getOptions()
Return shader generation options.
FilePath resolveSourceFile(const FilePath &filename, const FilePath &localPath) const
std::unordered_map< const ShaderOutput *, string > _outputSuffix
FilePath find(const FilePath &filename) const
std::set< string > StringSet
A set of strings.
void pushParentNode(ConstNodePtr node)
Push a parent node onto the stack.
#define MATERIALX_NAMESPACE_END
shared_ptr< ShaderGenerator > ShaderGeneratorPtr
Shared pointer to a ShaderGenerator.
void registerSourceCodeSearchPath(const FilePath &path)