Visualization Library 2.0.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Classes | Public Types | Public Member Functions | Protected Attributes | List of all members
vl::ShaderNode Class Reference

The ShaderNode class is used to conveniently manage complex hierarchies of Shader[s]. More...

#include <ShaderNode.hpp>

+ Inheritance diagram for vl::ShaderNode:

Classes

struct  EnableInfo
 ShaderNode's representation of an enable. More...
 
struct  RenderStateInfo
 ShaderNode's representation of a RenderState. More...
 
struct  UniformInfo
 ShaderNode's representation of a Uniform. More...
 

Public Types

typedef std::map< ERenderState, RenderStateInfoRenderStatesMap
 
typedef std::map< EEnable, EnableInfoEnablesMap
 
typedef std::map< std::string, UniformInfoUniformsMap
 

Public Member Functions

 ShaderNode ()
 
void setShader (Shader *shader)
 
const Shadershader () const
 
Shadershader ()
 
void addChild (ShaderNode *node)
 
void eraseChild (ShaderNode *node)
 
void eraseChild (unsigned index)
 
void eraseChildren (unsigned start, unsigned count)
 
int findChild (const ShaderNode *node) const
 
size_t childrenCount () const
 
ShaderNodechild (unsigned i)
 
const ShaderNodechild (unsigned i) const
 
ShaderNodeparent ()
 
const ShaderNodeparent () const
 
void updateHierarchy ()
 
void inherit (ShaderNode *parent)
 
void setRenderState (EInheritance inheritance, RenderStateNonIndexed *rs)
 
void setRenderState (EInheritance inheritance, RenderState *rs, int index)
 
void eraseRenderState (RenderStateNonIndexed *rs)
 
void eraseRenderState (RenderState *rs, int index)
 
void setEnable (EEnable en, bool on, EInheritance inheritance=IN_Propagate)
 
void eraseEnable (EEnable en)
 
void setUniform (Uniform *unif, EInheritance inheritance=IN_Propagate)
 
void eraseUniform (Uniform *unif)
 
const RenderStatesMaprenderStates () const
 
RenderStatesMaprenderStates ()
 
const EnablesMapenables () const
 
EnablesMapenables ()
 
const UniformsMapuniforms () const
 
UniformsMapuniforms ()
 
- Public Member Functions inherited from vl::Object
 Object ()
 Constructor. More...
 
 Object (const Object &other)
 Copy constructor: copies the name, ref count mutex and user data. More...
 
Objectoperator= (const Object &other)
 Copy operator: copies the object's name, ref count mutex and user data. More...
 
const std::string & objectName () const
 The name of the object, by default set to the object's class name. More...
 
void setObjectName (const char *name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setObjectName (const std::string &name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setRefCountMutex (IMutex *mutex)
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
IMutexrefCountMutex ()
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
const IMutexrefCountMutex () const
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
int referenceCount () const
 Returns the number of references of an object. More...
 
void incReference () const
 Increments the reference count of an object. More...
 
void decReference ()
 Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More...
 
void setAutomaticDelete (bool autodel_on)
 If set to true the Object is deleted when its reference count reaches 0. More...
 
bool automaticDelete () const
 If set to true the Object is deleted when its reference count reaches 0. More...
 
template<class T >
T * as ()
 Casts an Object to the specified class. More...
 
template<class T >
const T * as () const
 Casts an Object to the specified class. More...
 

Protected Attributes

std::vector< ref< ShaderNode > > mNodes
 
ShaderNodemParent
 
RenderStatesMap mRenderStates
 
EnablesMap mEnables
 
UniformsMap mUniforms
 
RenderStatesMap mRenderStates_Final
 
EnablesMap mEnables_Final
 
UniformsMap mUniforms_Final
 
ref< ShadermShader
 
- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Additional Inherited Members

- Protected Member Functions inherited from vl::Object
virtual ~Object ()
 

Detailed Description

The ShaderNode class is used to conveniently manage complex hierarchies of Shader[s].

Definition at line 45 of file ShaderNode.hpp.

Member Typedef Documentation

◆ EnablesMap

Definition at line 78 of file ShaderNode.hpp.

◆ RenderStatesMap

Definition at line 77 of file ShaderNode.hpp.

◆ UniformsMap

typedef std::map< std::string, UniformInfo > vl::ShaderNode::UniformsMap

Definition at line 79 of file ShaderNode.hpp.

Constructor & Destructor Documentation

◆ ShaderNode()

vl::ShaderNode::ShaderNode ( )
inline

Definition at line 82 of file ShaderNode.hpp.

Member Function Documentation

◆ addChild()

void vl::ShaderNode::addChild ( ShaderNode node)
inline

Definition at line 94 of file ShaderNode.hpp.

References mNodes, mParent, NULL, parent(), and VL_CHECK.

Referenced by vl::Terrain::init().

◆ child() [1/2]

ShaderNode* vl::ShaderNode::child ( unsigned  i)
inline

Definition at line 139 of file ShaderNode.hpp.

References mNodes.

Referenced by eraseChild(), findChild(), and updateHierarchy().

◆ child() [2/2]

const ShaderNode* vl::ShaderNode::child ( unsigned  i) const
inline

Definition at line 141 of file ShaderNode.hpp.

References mNodes.

◆ childrenCount()

size_t vl::ShaderNode::childrenCount ( ) const
inline

Definition at line 137 of file ShaderNode.hpp.

References mNodes.

Referenced by eraseChild(), eraseChildren(), findChild(), and updateHierarchy().

◆ enables() [1/2]

const EnablesMap& vl::ShaderNode::enables ( ) const
inline

Definition at line 313 of file ShaderNode.hpp.

References mEnables.

◆ enables() [2/2]

EnablesMap& vl::ShaderNode::enables ( )
inline

Definition at line 315 of file ShaderNode.hpp.

References mEnables.

◆ eraseChild() [1/2]

void vl::ShaderNode::eraseChild ( ShaderNode node)
inline

Definition at line 101 of file ShaderNode.hpp.

References child(), childrenCount(), mNodes, mParent, NULL, parent(), and VL_CHECK.

◆ eraseChild() [2/2]

void vl::ShaderNode::eraseChild ( unsigned  index)
inline

Definition at line 113 of file ShaderNode.hpp.

References childrenCount(), mNodes, NULL, and VL_CHECK.

◆ eraseChildren()

void vl::ShaderNode::eraseChildren ( unsigned  start,
unsigned  count 
)
inline

Definition at line 120 of file ShaderNode.hpp.

References childrenCount(), mNodes, mParent, NULL, and VL_CHECK.

◆ eraseEnable()

void vl::ShaderNode::eraseEnable ( EEnable  en)
inline

Definition at line 291 of file ShaderNode.hpp.

References mEnables.

◆ eraseRenderState() [1/2]

void vl::ShaderNode::eraseRenderState ( RenderStateNonIndexed rs)
inline

Definition at line 272 of file ShaderNode.hpp.

References mRenderStates, and vl::RenderState::type().

◆ eraseRenderState() [2/2]

void vl::ShaderNode::eraseRenderState ( RenderState rs,
int  index 
)
inline

Definition at line 277 of file ShaderNode.hpp.

References mRenderStates, vl::RenderState::type(), and VL_CHECK.

◆ eraseUniform()

void vl::ShaderNode::eraseUniform ( Uniform unif)
inline

Definition at line 302 of file ShaderNode.hpp.

References mUniforms, and vl::Uniform::name().

◆ findChild()

int vl::ShaderNode::findChild ( const ShaderNode node) const
inline

Definition at line 129 of file ShaderNode.hpp.

References child(), and childrenCount().

◆ inherit()

void vl::ShaderNode::inherit ( ShaderNode parent)
inline

◆ parent() [1/2]

ShaderNode* vl::ShaderNode::parent ( )
inline

Definition at line 143 of file ShaderNode.hpp.

References mParent.

Referenced by addChild(), eraseChild(), and updateHierarchy().

◆ parent() [2/2]

const ShaderNode* vl::ShaderNode::parent ( ) const
inline

Definition at line 145 of file ShaderNode.hpp.

References mParent.

◆ renderStates() [1/2]

const RenderStatesMap& vl::ShaderNode::renderStates ( ) const
inline

Definition at line 309 of file ShaderNode.hpp.

References mRenderStates.

◆ renderStates() [2/2]

RenderStatesMap& vl::ShaderNode::renderStates ( )
inline

Definition at line 311 of file ShaderNode.hpp.

References mRenderStates.

◆ setEnable()

void vl::ShaderNode::setEnable ( EEnable  en,
bool  on,
EInheritance  inheritance = IN_Propagate 
)
inline

Definition at line 285 of file ShaderNode.hpp.

References mEnables.

Referenced by vl::Terrain::init().

◆ setRenderState() [1/2]

void vl::ShaderNode::setRenderState ( EInheritance  inheritance,
RenderStateNonIndexed rs 
)
inline

Definition at line 260 of file ShaderNode.hpp.

References mRenderStates, and vl::RenderState::type().

Referenced by vl::Terrain::init().

◆ setRenderState() [2/2]

void vl::ShaderNode::setRenderState ( EInheritance  inheritance,
RenderState rs,
int  index 
)
inline

Definition at line 266 of file ShaderNode.hpp.

References mRenderStates, and vl::RenderState::type().

◆ setShader()

void vl::ShaderNode::setShader ( Shader shader)
inline

Definition at line 86 of file ShaderNode.hpp.

References mShader, and shader().

Referenced by vl::Terrain::init().

◆ setUniform()

void vl::ShaderNode::setUniform ( Uniform unif,
EInheritance  inheritance = IN_Propagate 
)
inline

Definition at line 296 of file ShaderNode.hpp.

References mUniforms, and vl::Uniform::name().

◆ shader() [1/2]

const Shader* vl::ShaderNode::shader ( ) const
inline

Definition at line 88 of file ShaderNode.hpp.

References vl::ref< T >::get(), and mShader.

Referenced by setShader().

◆ shader() [2/2]

Shader* vl::ShaderNode::shader ( )
inline

Definition at line 90 of file ShaderNode.hpp.

References vl::ref< T >::get(), and mShader.

◆ uniforms() [1/2]

const UniformsMap& vl::ShaderNode::uniforms ( ) const
inline

Definition at line 317 of file ShaderNode.hpp.

References mUniforms.

◆ uniforms() [2/2]

UniformsMap& vl::ShaderNode::uniforms ( )
inline

Definition at line 319 of file ShaderNode.hpp.

References mUniforms.

◆ updateHierarchy()

void vl::ShaderNode::updateHierarchy ( )
inline

Definition at line 149 of file ShaderNode.hpp.

References child(), childrenCount(), inherit(), parent(), and updateHierarchy().

Referenced by vl::Terrain::init(), and updateHierarchy().

Member Data Documentation

◆ mEnables

EnablesMap vl::ShaderNode::mEnables
protected

Definition at line 326 of file ShaderNode.hpp.

Referenced by enables(), eraseEnable(), inherit(), and setEnable().

◆ mEnables_Final

EnablesMap vl::ShaderNode::mEnables_Final
protected

Definition at line 330 of file ShaderNode.hpp.

Referenced by inherit().

◆ mNodes

std::vector< ref< ShaderNode > > vl::ShaderNode::mNodes
protected

Definition at line 322 of file ShaderNode.hpp.

Referenced by addChild(), child(), childrenCount(), eraseChild(), and eraseChildren().

◆ mParent

ShaderNode* vl::ShaderNode::mParent
protected

Definition at line 323 of file ShaderNode.hpp.

Referenced by addChild(), eraseChild(), eraseChildren(), and parent().

◆ mRenderStates

RenderStatesMap vl::ShaderNode::mRenderStates
protected

Definition at line 325 of file ShaderNode.hpp.

Referenced by eraseRenderState(), inherit(), renderStates(), and setRenderState().

◆ mRenderStates_Final

RenderStatesMap vl::ShaderNode::mRenderStates_Final
protected

Definition at line 329 of file ShaderNode.hpp.

Referenced by inherit().

◆ mShader

ref<Shader> vl::ShaderNode::mShader
protected

Definition at line 333 of file ShaderNode.hpp.

Referenced by inherit(), setShader(), and shader().

◆ mUniforms

UniformsMap vl::ShaderNode::mUniforms
protected

Definition at line 327 of file ShaderNode.hpp.

Referenced by eraseUniform(), inherit(), setUniform(), and uniforms().

◆ mUniforms_Final

UniformsMap vl::ShaderNode::mUniforms_Final
protected

Definition at line 331 of file ShaderNode.hpp.

Referenced by inherit().


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