MaterialX 1.38.2
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
HwClosureContext Class Reference

Class representing a context for closure evaluation on hardware targets. More...

#include <HwShaderGenerator.h>

Inheritance diagram for HwClosureContext:
GenUserData

Public Types

enum  Type { REFLECTION , TRANSMISSION , INDIRECT , EMISSION }
 Types of closure contexts.
 
using Argument = std::pair< const TypeDesc *, string >
 An extra argument for closure functions. More...
 
using Arguments = vector< Argument >
 An array of arguments.
 

Public Member Functions

 HwClosureContext (int type)
 Constructor.
 
int getType () const
 Return the identifier for this context.
 
void addArgument (const TypeDesc *nodeType, const Argument &arg)
 For the given node type add an extra argument to be used for the function in this context.
 
const ArgumentsgetArguments (const TypeDesc *nodeType) const
 Return a list of extra argument to be used for the given node in this context.
 
void setSuffix (const TypeDesc *nodeType, const string &suffix)
 For the given node type set a function name suffix to be used for the function in this context.
 
const string & getSuffix (const TypeDesc *nodeType) const
 Return the function name suffix to be used for the given node in this context.
 
- Public Member Functions inherited from GenUserData
GenUserDataPtr getSelf ()
 Return a shared pointer for this object.
 
ConstGenUserDataPtr getSelf () const
 Return a shared pointer for this object.
 
template<class T >
shared_ptr< T > asA ()
 Return this object cast to a templated type.
 
template<class T >
shared_ptr< const T > asA () const
 Return this object cast to a templated type.
 

Static Public Member Functions

static HwClosureContextPtr create (int type)
 Create and return a new instance.
 

Protected Attributes

const int _type
 
std::unordered_map< const TypeDesc *, Arguments_arguments
 
std::unordered_map< const TypeDesc *, string > _suffix
 

Static Protected Attributes

static const Arguments EMPTY_ARGUMENTS
 

Detailed Description

Class representing a context for closure evaluation on hardware targets.

On hardware BSDF closures are evaluated differently in reflection, transmission or environment/indirect contexts. This class represents the context we are in and if extra arguments and function decorators are needed for that context.

Member Typedef Documentation

◆ Argument

using Argument = std::pair<const TypeDesc*, string>

An extra argument for closure functions.

An argument is a pair of strings holding the 'type' and 'name' of the argument.


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