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

#include <ShaderNode.h>

+ Inheritance diagram for ShaderNode:

Classes

class  Classification
 Flags for classifying nodes into different categories. More...
 

Public Member Functions

virtual ~ShaderNode ()
 
 ShaderNode (const ShaderGraph *parent, const string &name)
 Constructor. More...
 
virtual bool isAGraph () const
 Return true if this node is a graph. More...
 
const ShaderGraphgetParent () const
 
void setClassification (uint32_t c)
 
uint32_t getClassification () const
 Get classification bits set for this node. More...
 
void addClassification (uint32_t c)
 Add classification bits to this node. More...
 
bool hasClassification (uint32_t c) const
 Return true if this node matches the given classification. More...
 
const stringgetName () const
 Return the name of this node. More...
 
const ShaderNodeImplgetImplementation () const
 Return the implementation used for this node. More...
 
void initialize (const Node &node, const NodeDef &nodeDef, GenContext &context)
 
ShaderInputaddInput (const string &name, const TypeDesc *type)
 Add inputs/outputs. More...
 
ShaderOutputaddOutput (const string &name, const TypeDesc *type)
 
size_t numInputs () const
 Get number of inputs/outputs. More...
 
size_t numOutputs () const
 
ShaderInputgetInput (size_t index)
 Get inputs/outputs by index. More...
 
ShaderOutputgetOutput (size_t index=0)
 
const ShaderInputgetInput (size_t index) const
 
const ShaderOutputgetOutput (size_t index=0) const
 
ShaderInputgetInput (const string &name)
 Get inputs/outputs by name. More...
 
ShaderOutputgetOutput (const string &name)
 
const ShaderInputgetInput (const string &name) const
 
const ShaderOutputgetOutput (const string &name) const
 
const vector< ShaderInput * > & getInputs () const
 Get vector of inputs/outputs. More...
 
const vector< ShaderOutput * > & getOutputs () const
 
void setMetadata (ShaderMetadataVecPtr metadata)
 Set the metadata vector. More...
 
ShaderMetadataVecPtr getMetadata ()
 Get the metadata vector. More...
 
const ShaderMetadataVecPtrgetMetadata () const
 Get the metadata vector. More...
 
bool isEditable (const ShaderInput &input) const
 
bool isEditable (const ShaderGraphInputSocket &input) const
 

Static Public Member Functions

static ShaderNodePtr create (const ShaderGraph *parent, const string &name, const NodeDef &nodeDef, GenContext &context)
 Create a new node from a nodedef. More...
 
static ShaderNodePtr create (const ShaderGraph *parent, const string &name, ShaderNodeImplPtr impl, unsigned int classification=Classification::TEXTURE)
 Create a new node from a node implementation. More...
 

Static Public Attributes

static const ShaderNodePtr NONE
 
static const string CONSTANT
 
static const string DOT
 
static const string IMAGE
 
static const string SURFACESHADER
 
static const string SCATTER_MODE
 
static const string BSDF_R
 
static const string BSDF_T
 
static const string TRANSFORM_POINT
 
static const string TRANSFORM_VECTOR
 
static const string TRANSFORM_NORMAL
 
static const string TEXTURE2D_GROUPNAME
 
static const string TEXTURE3D_GROUPNAME
 
static const string PROCEDURAL2D_GROUPNAME
 
static const string PROCEDURAL3D_GROUPNAME
 
static const string GEOMETRIC_GROUPNAME
 

Protected Member Functions

void createMetadata (const NodeDef &nodeDef, GenContext &context)
 Create metadata from the nodedef according to registered metadata. More...
 

Protected Attributes

const ShaderGraph_parent
 
string _name
 
uint32_t _classification
 
std::unordered_map< string,
ShaderInputPtr
_inputMap
 
vector< ShaderInput * > _inputOrder
 
std::unordered_map< string,
ShaderOutputPtr
_outputMap
 
vector< ShaderOutput * > _outputOrder
 
ShaderNodeImplPtr _impl
 
ShaderMetadataVecPtr _metadata
 

Friends

class ShaderGraph
 

Detailed Description

Class representing a node in the shader generation DAG

Definition at line 325 of file ShaderNode.h.

Constructor & Destructor Documentation

virtual ShaderNode::~ShaderNode ( )
inlinevirtual

Definition at line 328 of file ShaderNode.h.

ShaderNode::ShaderNode ( const ShaderGraph parent,
const string name 
)

Constructor.

Member Function Documentation

void ShaderNode::addClassification ( uint32_t  c)
inline

Add classification bits to this node.

Definition at line 418 of file ShaderNode.h.

ShaderInput* ShaderNode::addInput ( const string name,
const TypeDesc type 
)

Add inputs/outputs.

ShaderOutput* ShaderNode::addOutput ( const string name,
const TypeDesc type 
)
static ShaderNodePtr ShaderNode::create ( const ShaderGraph parent,
const string name,
const NodeDef nodeDef,
GenContext context 
)
static

Create a new node from a nodedef.

static ShaderNodePtr ShaderNode::create ( const ShaderGraph parent,
const string name,
ShaderNodeImplPtr  impl,
unsigned int  classification = Classification::TEXTURE 
)
static

Create a new node from a node implementation.

void ShaderNode::createMetadata ( const NodeDef nodeDef,
GenContext context 
)
protected

Create metadata from the nodedef according to registered metadata.

uint32_t ShaderNode::getClassification ( ) const
inline

Get classification bits set for this node.

Definition at line 412 of file ShaderNode.h.

const ShaderNodeImpl& ShaderNode::getImplementation ( ) const
inline

Return the implementation used for this node.

Definition at line 436 of file ShaderNode.h.

ShaderInput* ShaderNode::getInput ( size_t  index)
inline

Get inputs/outputs by index.

Definition at line 454 of file ShaderNode.h.

const ShaderInput* ShaderNode::getInput ( size_t  index) const
inline

Definition at line 456 of file ShaderNode.h.

ShaderInput* ShaderNode::getInput ( const string name)

Get inputs/outputs by name.

const ShaderInput* ShaderNode::getInput ( const string name) const
const vector<ShaderInput*>& ShaderNode::getInputs ( ) const
inline

Get vector of inputs/outputs.

Definition at line 466 of file ShaderNode.h.

ShaderMetadataVecPtr ShaderNode::getMetadata ( )
inline

Get the metadata vector.

Definition at line 473 of file ShaderNode.h.

const ShaderMetadataVecPtr& ShaderNode::getMetadata ( ) const
inline

Get the metadata vector.

Definition at line 476 of file ShaderNode.h.

const string& ShaderNode::getName ( ) const
inline

Return the name of this node.

Definition at line 430 of file ShaderNode.h.

ShaderOutput* ShaderNode::getOutput ( size_t  index = 0)
inline

Definition at line 455 of file ShaderNode.h.

const ShaderOutput* ShaderNode::getOutput ( size_t  index = 0) const
inline

Definition at line 457 of file ShaderNode.h.

ShaderOutput* ShaderNode::getOutput ( const string name)
const ShaderOutput* ShaderNode::getOutput ( const string name) const
const vector<ShaderOutput*>& ShaderNode::getOutputs ( ) const
inline

Definition at line 467 of file ShaderNode.h.

const ShaderGraph* ShaderNode::getParent ( ) const
inline

Return the parent graph that owns this node. If this node is a root graph it has no parent and nullptr will be returned.

Definition at line 399 of file ShaderNode.h.

bool ShaderNode::hasClassification ( uint32_t  c) const
inline

Return true if this node matches the given classification.

Definition at line 424 of file ShaderNode.h.

void ShaderNode::initialize ( const Node node,
const NodeDef nodeDef,
GenContext context 
)

Initialize this shader node with all required data from the given node and nodedef.

virtual bool ShaderNode::isAGraph ( ) const
inlinevirtual

Return true if this node is a graph.

Reimplemented in ShaderGraph.

Definition at line 394 of file ShaderNode.h.

bool ShaderNode::isEditable ( const ShaderInput input) const
inline

Returns true if an input is editable by users. Editable inputs are allowed to be published as shader uniforms and hence must be presentable in a user interface.

Definition at line 481 of file ShaderNode.h.

bool ShaderNode::isEditable ( const ShaderGraphInputSocket input) const
inline

Returns true if a graph input is accessible by users. Editable inputs are allowed to be published as shader uniforms and hence must be presentable in a user interface.

Definition at line 489 of file ShaderNode.h.

size_t ShaderNode::numInputs ( ) const
inline

Get number of inputs/outputs.

Definition at line 450 of file ShaderNode.h.

size_t ShaderNode::numOutputs ( ) const
inline

Definition at line 451 of file ShaderNode.h.

void ShaderNode::setClassification ( uint32_t  c)
inline

Set classification bits for this node, replacing any previous set bits.

Definition at line 406 of file ShaderNode.h.

void ShaderNode::setMetadata ( ShaderMetadataVecPtr  metadata)
inline

Set the metadata vector.

Definition at line 470 of file ShaderNode.h.

Friends And Related Function Documentation

friend class ShaderGraph
friend

Definition at line 511 of file ShaderNode.h.

Member Data Documentation

uint32_t ShaderNode::_classification
protected

Definition at line 500 of file ShaderNode.h.

ShaderNodeImplPtr ShaderNode::_impl
protected

Definition at line 508 of file ShaderNode.h.

std::unordered_map<string, ShaderInputPtr> ShaderNode::_inputMap
protected

Definition at line 502 of file ShaderNode.h.

vector<ShaderInput*> ShaderNode::_inputOrder
protected

Definition at line 503 of file ShaderNode.h.

ShaderMetadataVecPtr ShaderNode::_metadata
protected

Definition at line 509 of file ShaderNode.h.

string ShaderNode::_name
protected

Definition at line 499 of file ShaderNode.h.

std::unordered_map<string, ShaderOutputPtr> ShaderNode::_outputMap
protected

Definition at line 505 of file ShaderNode.h.

vector<ShaderOutput*> ShaderNode::_outputOrder
protected

Definition at line 506 of file ShaderNode.h.

const ShaderGraph* ShaderNode::_parent
protected

Definition at line 498 of file ShaderNode.h.

const string ShaderNode::BSDF_R
static

Definition at line 370 of file ShaderNode.h.

const string ShaderNode::BSDF_T
static

Definition at line 371 of file ShaderNode.h.

const string ShaderNode::CONSTANT
static

Definition at line 365 of file ShaderNode.h.

const string ShaderNode::DOT
static

Definition at line 366 of file ShaderNode.h.

const string ShaderNode::GEOMETRIC_GROUPNAME
static

Definition at line 379 of file ShaderNode.h.

const string ShaderNode::IMAGE
static

Definition at line 367 of file ShaderNode.h.

const ShaderNodePtr ShaderNode::NONE
static

Definition at line 363 of file ShaderNode.h.

const string ShaderNode::PROCEDURAL2D_GROUPNAME
static

Definition at line 377 of file ShaderNode.h.

const string ShaderNode::PROCEDURAL3D_GROUPNAME
static

Definition at line 378 of file ShaderNode.h.

const string ShaderNode::SCATTER_MODE
static

Definition at line 369 of file ShaderNode.h.

const string ShaderNode::SURFACESHADER
static

Definition at line 368 of file ShaderNode.h.

const string ShaderNode::TEXTURE2D_GROUPNAME
static

Definition at line 375 of file ShaderNode.h.

const string ShaderNode::TEXTURE3D_GROUPNAME
static

Definition at line 376 of file ShaderNode.h.

const string ShaderNode::TRANSFORM_NORMAL
static

Definition at line 374 of file ShaderNode.h.

const string ShaderNode::TRANSFORM_POINT
static

Definition at line 372 of file ShaderNode.h.

const string ShaderNode::TRANSFORM_VECTOR
static

Definition at line 373 of file ShaderNode.h.


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