25 #ifndef WGELINEARTRANSLATIONCALLBACK_H
26 #define WGELINEARTRANSLATIONCALLBACK_H
30 #include <osg/Uniform>
31 #include <osg/MatrixTransform>
33 #include "../../common/WProperties.h"
43 template<
typename T >
85 virtual void operator()( osg::Node* node, osg::NodeVisitor* nv );
115 template<
typename T >
121 m_texMat( texMatrix )
126 template<
typename T >
137 template<
typename T >
147 template<
typename T >
153 template<
typename T >
157 float newPos = m_pos->get();
158 if( newPos != m_oldPos )
161 osg::MatrixTransform* m =
static_cast< osg::MatrixTransform*
>( node );
164 float max = m_pos->getMax()->getMax();
165 float min = m_pos->getMin()->getMin();
166 float size = max - min;
167 float axeLen = m_axe.length();
169 osg::Vec3 translation = m_axe *
static_cast< float >( m_oldPos - min );
174 m_texMat->setMatrix( osg::Matrix::translate( translation / size / axeLen ) );
178 m_uniform->set( osg::Matrix::translate( translation ) );
181 m->setMatrix( osg::Matrix::translate( translation ) );
185 traverse( node, nv );
188 #endif // WGELINEARTRANSLATIONCALLBACK_H