MaterialX 1.39.1
|
A block of variables in a shader stage. More...
#include <ShaderStage.h>
Public Member Functions | |
VariableBlock (const string &name, const string &instance) | |
const string & | getName () const |
Get the name of this block. | |
void | setName (const string &name) |
Set the name of this block. | |
const string & | getInstance () const |
Get the instance name of this block. | |
void | setInstance (const string &instance) |
Set the instance name of this block. | |
bool | empty () const |
Return true if the block has no variables. | |
size_t | size () const |
Return the number of variables in this block. | |
ShaderPort * | operator[] (size_t index) |
Return a variable by index. | |
const ShaderPort * | operator[] (size_t index) const |
Return a variable by index. | |
const vector< ShaderPort * > & | getVariableOrder () const |
Return a const reference to our variable order vector. | |
ShaderPort * | operator[] (const string &name) |
Return a variable by name. More... | |
const ShaderPort * | operator[] (const string &name) const |
Return a variable by name. More... | |
ShaderPort * | find (const string &name) |
Return a variable by name. More... | |
const ShaderPort * | find (const string &name) const |
Return a variable by name. More... | |
ShaderPort * | find (const ShaderPortPredicate &predicate) |
Find a port based on a predicate. | |
ShaderPort * | add (TypeDesc type, const string &name, ValuePtr value=nullptr, bool shouldWiden=false) |
Add a new shader port to this block. More... | |
void | add (ShaderPortPtr port) |
Add an existing shader port to this block. | |
A block of variables in a shader stage.
ShaderPort * add | ( | TypeDesc | type, |
const string & | name, | ||
ValuePtr | value = nullptr , |
||
bool | shouldWiden = false |
||
) |
Add a new shader port to this block.
type | The desired shader port type |
name | The shader port name |
value | The value to attach to the shader port |
shouldWiden | When false, an exception is thrown if the type of the existing port with the same name does not match the requested type. When true, the types can mismatch, and the type of any existing port is widened to match the requested type when necessary. |
ShaderPort * find | ( | const string & | name | ) |
Return a variable by name.
Returns nullptr if no variable is found by the given name.
const ShaderPort * find | ( | const string & | name | ) | const |
Return a variable by name.
Returns nullptr if no variable is found by the given name.
ShaderPort * operator[] | ( | const string & | name | ) |
Return a variable by name.
Throws exception if no variable is found by the given name.
const ShaderPort * operator[] | ( | const string & | name | ) | const |
Return a variable by name.
Throws exception if no variable is found by the given name.