MaterialX 1.38.10
Loading...
Searching...
No Matches
ClosureContext Class Reference

Class representing a context for closure evaluation. More...

#include <GenContext.h>

Public Types

using Argument = std::pair< const TypeDesc *, string >
 An extra argument for closure functions. More...
 
using Arguments = vector< Argument >
 An array of arguments.
 
using ClosureParams = std::unordered_map< string, const ShaderInput * >
 Extra parameters for closure evaluation.
 

Public Member Functions

 ClosureContext (int type=0)
 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.
 
void setClosureParams (const ShaderNode *closure, const ClosureParams *params)
 Set extra parameters to use for evaluating a closure.
 
const ClosureParamsgetClosureParams (const ShaderNode *closure) const
 Return extra parameters to use for evaluating a closure. More...
 

Protected Attributes

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

Static Protected Attributes

static const Arguments EMPTY_ARGUMENTS
 

Detailed Description

Class representing a context for closure evaluation.

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.

Member Function Documentation

◆ getClosureParams()

const ClosureParams * getClosureParams ( const ShaderNode closure) const
inline

Return extra parameters to use for evaluating a closure.

Or return nullptr if no parameters have been set for the given closure.


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