MaterialX 1.38.8
Loading...
Searching...
No Matches
VariableBlock Class Reference

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.
 
ShaderPortoperator[] (size_t index)
 Return a variable by index.
 
const ShaderPortoperator[] (size_t index) const
 Return a variable by index.
 
const vector< ShaderPort * > & getVariableOrder () const
 Return a const reference to our variable order vector.
 
ShaderPortoperator[] (const string &name)
 Return a variable by name. More...
 
const ShaderPortoperator[] (const string &name) const
 Return a variable by name. More...
 
ShaderPortfind (const string &name)
 Return a variable by name. More...
 
const ShaderPortfind (const string &name) const
 Return a variable by name. More...
 
ShaderPortfind (const ShaderPortPredicate &predicate)
 Find a port based on a predicate.
 
ShaderPortadd (const TypeDesc *type, const string &name, ValuePtr value=nullptr)
 Add a new shader port to this block.
 
void add (ShaderPortPtr port)
 Add an existing shader port to this block.
 

Detailed Description

A block of variables in a shader stage.

Member Function Documentation

◆ find() [1/2]

ShaderPort * find ( const string &  name)

Return a variable by name.

Returns nullptr if no variable is found by the given name.

◆ find() [2/2]

const ShaderPort * find ( const string &  name) const

Return a variable by name.

Returns nullptr if no variable is found by the given name.

◆ operator[]() [1/2]

ShaderPort * operator[] ( const string &  name)

Return a variable by name.

Throws exception if no variable is found by the given name.

◆ operator[]() [2/2]

const ShaderPort * operator[] ( const string &  name) const

Return a variable by name.

Throws exception if no variable is found by the given name.


The documentation for this class was generated from the following files: