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

This class is an OSG Callback which allows simple linear translation of a matrix transform node along a specified axis. More...

#include <WGELinearTranslationCallback.h>

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

Public Member Functions

 WGELinearTranslationCallback (osg::Vec3 axe, T property, osg::ref_ptr< osg::TexMat > texMatrix, double scaler=1.0)
 Constructor. More...
 
 WGELinearTranslationCallback (osg::Vec3 axe, T property, osg::ref_ptr< osg::Uniform > uniform, double scaler=1.0)
 Constructor. More...
 
 WGELinearTranslationCallback (osg::Vec3 axe, T property, double scaler=1.0)
 Constructor. More...
 
virtual ~WGELinearTranslationCallback ()
 Destructor. More...
 
virtual void operator() (osg::Node *node, osg::NodeVisitor *nv)
 This operator gets called by OSG every update cycle. More...
 

Protected Attributes

osg::Vec3 m_axe
 The axis to transform along. More...
 
m_pos
 The position. More...
 
double m_oldPos
 Cache the old position for proper update. More...
 
osg::ref_ptr< osg::TexMat > m_texMat
 Texture matrix that contains normalized translation. More...
 
osg::ref_ptr< osg::Uniform > m_uniform
 The uniform to set the matrix to. More...
 
double m_scaler
 Scale the property prior to creating the matrix. More...
 

Detailed Description

template<typename T>
class WGELinearTranslationCallback< T >

This class is an OSG Callback which allows simple linear translation of a matrix transform node along a specified axis.

It is controlled by a WPropDouble. This way, one can simply implement movable slices and similar.

Template Parameters
Tthe type used as control mechanism. Typically, this should be an property whose type is cast-able to double. The type specified must support access via T->get(). Specialize the class if you do not specify a pointer.

Definition at line 46 of file WGELinearTranslationCallback.h.

Constructor & Destructor Documentation

◆ WGELinearTranslationCallback() [1/3]

template<typename T >
WGELinearTranslationCallback< T >::WGELinearTranslationCallback ( osg::Vec3  axe,
property,
osg::ref_ptr< osg::TexMat >  texMatrix,
double  scaler = 1.0 
)

Constructor.

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

Parameters
axethe axe to translate along. Should be normalized. If not, it scales the translation.
propertythe property containing the value
texMatrixoptional pointer to a texture matrix which can be modified too to contain the normalized translation.
scalerscales the property by this value before creating the matrix.

Definition at line 126 of file WGELinearTranslationCallback.h.

◆ WGELinearTranslationCallback() [2/3]

template<typename T >
WGELinearTranslationCallback< T >::WGELinearTranslationCallback ( osg::Vec3  axe,
property,
osg::ref_ptr< osg::Uniform >  uniform,
double  scaler = 1.0 
)

Constructor.

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

Parameters
axethe axe to translate along. Should be normalized. If not, it scales the translation.
propertythe property containing the value
uniformoptional pointer to a uniform that will contain the matrix. Useful if no tex-matrix is available anymore. The matrix is the matrix that is NOT scaled to be in texture space.
scalerscales the property by this value before creating the matrix.

Definition at line 138 of file WGELinearTranslationCallback.h.

◆ WGELinearTranslationCallback() [3/3]

template<typename T >
WGELinearTranslationCallback< T >::WGELinearTranslationCallback ( osg::Vec3  axe,
property,
double  scaler = 1.0 
)

Constructor.

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

Parameters
axethe axe to translate along. Should be normalized. If not, it scales the translation.
propertythe property containing the value
scalerscales the property by this value before creating the matrix.

Definition at line 150 of file WGELinearTranslationCallback.h.

◆ ~WGELinearTranslationCallback()

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

Destructor.

Definition at line 161 of file WGELinearTranslationCallback.h.

Member Function Documentation

◆ operator()()

template<typename T >
void WGELinearTranslationCallback< T >::operator() ( osg::Node *  node,
osg::NodeVisitor *  nv 
)
virtual

This operator gets called by OSG every update cycle.

It moves the underlying MatrixTransform according to the specified axis and value.

Parameters
nodethe osg node
nvthe node visitor

Definition at line 167 of file WGELinearTranslationCallback.h.

Member Data Documentation

◆ m_axe

template<typename T >
osg::Vec3 WGELinearTranslationCallback< T >::m_axe
protected

The axis to transform along.

Definition at line 96 of file WGELinearTranslationCallback.h.

◆ m_oldPos

template<typename T >
double WGELinearTranslationCallback< T >::m_oldPos
protected

Cache the old position for proper update.

Definition at line 106 of file WGELinearTranslationCallback.h.

◆ m_pos

template<typename T >
T WGELinearTranslationCallback< T >::m_pos
protected

The position.

Definition at line 101 of file WGELinearTranslationCallback.h.

◆ m_scaler

template<typename T >
double WGELinearTranslationCallback< T >::m_scaler
protected

Scale the property prior to creating the matrix.

Definition at line 121 of file WGELinearTranslationCallback.h.

◆ m_texMat

template<typename T >
osg::ref_ptr< osg::TexMat > WGELinearTranslationCallback< T >::m_texMat
protected

Texture matrix that contains normalized translation.

Definition at line 111 of file WGELinearTranslationCallback.h.

◆ m_uniform

template<typename T >
osg::ref_ptr< osg::Uniform > WGELinearTranslationCallback< T >::m_uniform
protected

The uniform to set the matrix to.

Definition at line 116 of file WGELinearTranslationCallback.h.


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