OpenWalnut  1.5.0dev
Public Types | Public Member Functions | Protected Attributes | List of all members
WGEPropertyUniformCallback< T > Class Template Reference

This class is an OSG Callback which allows uniforms to be controlled by properties. More...

#include <WGEPropertyUniformCallback.h>

+ Inheritance diagram for WGEPropertyUniformCallback< T >:
+ Collaboration diagram for WGEPropertyUniformCallback< T >:

Public Types

typedef wge::UniformType< typename T::element_type::ValueType >::Type UniformType
 The type which is used for this uniform. More...
 

Public Member Functions

 WGEPropertyUniformCallback (T property)
 Constructor. More...
 
virtual ~WGEPropertyUniformCallback ()
 Destructor. More...
 
virtual void operator() (osg::Uniform *uniform, osg::NodeVisitor *nv)
 The callback. More...
 

Protected Attributes

m_property
 The property. More...
 

Detailed Description

template<typename T>
class WGEPropertyUniformCallback< T >

This class is an OSG Callback which allows uniforms to be controlled by properties.

This is useful to simply forward properties to a shader. Please note that you still need to add this callback to the desired uniforms. A convenience class is WGEPropertyUniform which uses this callback. On each traversal of the OSG, the callback sets the value of the property to the uniform but does NOT reset the change flag.

Template Parameters
Tthe type used as control mechanism. The type specified must support access via T->get(). Specialize the class if you do not specify a pointer.

Definition at line 43 of file WGEPropertyUniformCallback.h.

Member Typedef Documentation

◆ UniformType

template<typename T >
typedef wge::UniformType< typename T::element_type::ValueType >::Type WGEPropertyUniformCallback< T >::UniformType

The type which is used for this uniform.

Definition at line 69 of file WGEPropertyUniformCallback.h.

Constructor & Destructor Documentation

◆ WGEPropertyUniformCallback()

template<typename T >
WGEPropertyUniformCallback< T >::WGEPropertyUniformCallback ( property)
explicit

Constructor.

Creates the callback. You still need to add it to the desired uniform.

Parameters
propertythe property containing the value

Definition at line 81 of file WGEPropertyUniformCallback.h.

◆ ~WGEPropertyUniformCallback()

template<typename T >
WGEPropertyUniformCallback< T >::~WGEPropertyUniformCallback
virtual

Destructor.

Definition at line 89 of file WGEPropertyUniformCallback.h.

Member Function Documentation

◆ operator()()

template<typename T >
void WGEPropertyUniformCallback< T >::operator() ( osg::Uniform *  uniform,
osg::NodeVisitor *  nv 
)
virtual

The callback.

Called every render traversal for the uniform. It sets the value of the property to the uniform.

Parameters
uniformthe uniform for which this callback is.
nvthe visitor.

Definition at line 95 of file WGEPropertyUniformCallback.h.

References wge::toUniformType().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_property

template<typename T >
T WGEPropertyUniformCallback< T >::m_property
protected

The property.

Definition at line 75 of file WGEPropertyUniformCallback.h.


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