|
MaterialX 1.38.2
|
Class containing all data needed during shader generation. More...
#include <Shader.h>
Public Member Functions | |
| Shader (const string &name, ShaderGraphPtr graph) | |
| Constructor. | |
| virtual | ~Shader () |
| Destructor. | |
| const string & | getName () const |
| Return the shader name. | |
| size_t | numStages () const |
| Return the number of shader stages for this shader. | |
| ShaderStage & | getStage (size_t index) |
| Return a stage by index. | |
| const ShaderStage & | getStage (size_t index) const |
| Return a stage by index. | |
| bool | hasStage (const string &name) |
| Return if stage exists. | |
| ShaderStage & | getStage (const string &name) |
| Return a stage by name. | |
| const ShaderStage & | getStage (const string &name) const |
| Return a stage by name. | |
| bool | hasAttribute (const string &attrib) const |
| Return true if the shader has a given named attribute. | |
| ValuePtr | getAttribute (const string &attrib) const |
| Return the value for a named attribute, or nullptr if no such attribute is found. | |
| void | setAttribute (const string &attrib, ValuePtr value) |
| Set a value attribute on the shader. | |
| void | setAttribute (const string &attrib) |
| Set a flag attribute on the shader. | |
| const ShaderGraph & | getGraph () const |
| Return the shader graph. | |
| ShaderGraph & | getGraph () |
| Return the shader graph. | |
| bool | hasClassification (unsigned int c) const |
| Return true if this shader matches the given classification. | |
| const string & | getSourceCode (const string &stage=Stage::PIXEL) const |
| Return the final shader source code for a given shader stage. | |
Protected Member Functions | |
| ShaderStagePtr | createStage (const string &name, ConstSyntaxPtr syntax) |
| Create a new stage in the shader. | |
Protected Attributes | |
| string | _name |
| ShaderGraphPtr | _graph |
| std::unordered_map< string, ShaderStagePtr > | _stagesMap |
| vector< ShaderStage * > | _stages |
| std::unordered_map< string, ValuePtr > | _attributeMap |
Friends | |
| class | ShaderGenerator |
Class containing all data needed during shader generation.
After generation is completed it will contain the resulting source code emitted by shader generators.
The class contains a default implementation using a single shader stage. Derived shaders can override this, as well as overriding all methods that add code to the shader.