HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ClosureContext Class Reference

#include <GenContext.h>

Public Types

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

Public Member Functions

 ClosureContext (int type=0)
 Constructor. More...
 
int getType () const
 Return the identifier for this context. More...
 
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. More...
 
const ArgumentsgetArguments (const TypeDesc *nodeType) const
 Return a list of extra argument to be used for the given node in this context. More...
 
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. More...
 
const stringgetSuffix (const TypeDesc *nodeType) const
 Return the function name suffix to be used for the given node in this context. More...
 
void setClosureParams (const ShaderNode *closure, const ClosureParams *params)
 Set extra parameters to use for evaluating a closure. More...
 
const ClosureParamsgetClosureParams (const ShaderNode *closure) const
 

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.

Definition at line 247 of file GenContext.h.

Member Typedef Documentation

using ClosureContext::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.

Definition at line 253 of file GenContext.h.

An array of arguments.

Definition at line 255 of file GenContext.h.

using ClosureContext::ClosureParams = std::unordered_map<string, const ShaderInput*>

Extra parameters for closure evaluation.

Definition at line 258 of file GenContext.h.

Constructor & Destructor Documentation

ClosureContext::ClosureContext ( int  type = 0)
inline

Constructor.

Definition at line 261 of file GenContext.h.

Member Function Documentation

void ClosureContext::addArgument ( const TypeDesc nodeType,
const Argument arg 
)
inline

For the given node type add an extra argument to be used for the function in this context.

Definition at line 268 of file GenContext.h.

const Arguments& ClosureContext::getArguments ( const TypeDesc nodeType) const
inline

Return a list of extra argument to be used for the given node in this context.

Definition at line 274 of file GenContext.h.

const ClosureParams* ClosureContext::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.

Definition at line 308 of file GenContext.h.

const string& ClosureContext::getSuffix ( const TypeDesc nodeType) const
inline

Return the function name suffix to be used for the given node in this context.

Definition at line 287 of file GenContext.h.

int ClosureContext::getType ( ) const
inline

Return the identifier for this context.

Definition at line 265 of file GenContext.h.

void ClosureContext::setClosureParams ( const ShaderNode closure,
const ClosureParams params 
)
inline

Set extra parameters to use for evaluating a closure.

Definition at line 294 of file GenContext.h.

void ClosureContext::setSuffix ( const TypeDesc nodeType,
const string suffix 
)
inline

For the given node type set a function name suffix to be used for the function in this context.

Definition at line 281 of file GenContext.h.

Member Data Documentation

std::unordered_map<const TypeDesc*, Arguments> ClosureContext::_arguments
protected

Definition at line 316 of file GenContext.h.

std::unordered_map<const ShaderNode*, const ClosureParams*> ClosureContext::_params
protected

Definition at line 318 of file GenContext.h.

std::unordered_map<const TypeDesc*, string> ClosureContext::_suffix
protected

Definition at line 317 of file GenContext.h.

const int ClosureContext::_type
protected

Definition at line 315 of file GenContext.h.

const Arguments ClosureContext::EMPTY_ARGUMENTS
staticprotected

Definition at line 320 of file GenContext.h.


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