25 #ifndef WGELINEARTRANSLATIONCALLBACK_H
26 #define WGELINEARTRANSLATIONCALLBACK_H
30 #include <osg/Uniform>
31 #include <osg/MatrixTransform>
33 #include "../../common/WProperties.h"
34 #include "../WExportWGE.h"
43 template<
typename T >
85 virtual void operator()( osg::Node* node, osg::NodeVisitor* nv );
116 template<
typename T >
122 m_texMat( texMatrix )
127 template<
typename T >
138 template<
typename T >
148 template<
typename T >
154 template<
typename T >
158 float newPos = m_pos->get();
159 if( newPos != m_oldPos )
162 osg::MatrixTransform* m =
static_cast< osg::MatrixTransform*
>( node );
165 float max = m_pos->getMax()->getMax();
166 float min = m_pos->getMin()->getMin();
167 float size = max - min;
168 float axeLen = m_axe.length();
170 osg::Vec3 translation = m_axe *
static_cast< float >( m_oldPos - min );
175 m_texMat->setMatrix( osg::Matrix::translate( translation / size / axeLen ) );
179 m_uniform->set( osg::Matrix::translate( translation ) );
182 m->setMatrix( osg::Matrix::translate( translation ) );
186 traverse( node, nv );
189 #endif // WGELINEARTRANSLATIONCALLBACK_H