Commit ace734e2 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[FIX] - fixed misplaced slices.

parent e7bf7243
......@@ -162,13 +162,17 @@ void WGELinearTranslationCallback< T >::operator()( osg::Node* node, osg::NodeVi
osg::MatrixTransform* m = static_cast< osg::MatrixTransform* >( node );
if( m )
{
osg::Vec3 translation = m_axe * static_cast< float >( m_oldPos );
float max = m_pos->getMax()->getMax();
float min = m_pos->getMin()->getMin();
float size = max - min;
float axeLen = m_axe.length();
osg::Vec3 translation = m_axe * static_cast< float >( m_oldPos - min );
// set both matrices
if( m_texMat )
{
m_texMat->setMatrix( osg::Matrix::translate( translation / static_cast< float >( m_pos->getMax()->getMax() ) / axeLen ) );
m_texMat->setMatrix( osg::Matrix::translate( translation / size / axeLen ) );
}
if( m_uniform )
{
......
......@@ -192,22 +192,22 @@ void WMNavigationSlices::initOSG()
// create a new geode containing the slices
// X Slice
osg::ref_ptr< osg::Node > xSlice = wge::genFinitePlane( minV, osg::Vec3( 0.0, maxV[1], 0.0 ),
osg::Vec3( 0.0, 0.0, maxV[2] ) );
osg::ref_ptr< osg::Node > xSlice = wge::genFinitePlane( minV, osg::Vec3( 0.0, sizes[1], 0.0 ),
osg::Vec3( 0.0, 0.0, sizes[2] ) );
xSlice->setName( "Sagittal Slice" );
osg::Uniform* xSliceUniform = new osg::Uniform( "u_WorldTransform", osg::Matrix::identity() );
xSlice->getOrCreateStateSet()->addUniform( xSliceUniform );
// Y Slice
osg::ref_ptr< osg::Node > ySlice = wge::genFinitePlane( minV, osg::Vec3( maxV[0], 0.0, 0.0 ),
osg::Vec3( 0.0, 0.0, maxV[2] ) );
osg::ref_ptr< osg::Node > ySlice = wge::genFinitePlane( minV, osg::Vec3( sizes[0], 0.0, 0.0 ),
osg::Vec3( 0.0, 0.0, sizes[2] ) );
ySlice->setName( "Coronal Slice" );
osg::Uniform* ySliceUniform = new osg::Uniform( "u_WorldTransform", osg::Matrix::identity() );
ySlice->getOrCreateStateSet()->addUniform( ySliceUniform );
// Z Slice
osg::ref_ptr< osg::Node > zSlice = wge::genFinitePlane( minV, osg::Vec3( maxV[0], 0.0, 0.0 ),
osg::Vec3( 0.0, maxV[1], 0.0 ) );
osg::ref_ptr< osg::Node > zSlice = wge::genFinitePlane( minV, osg::Vec3( sizes[0], 0.0, 0.0 ),
osg::Vec3( 0.0, sizes[1], 0.0 ) );
zSlice->setName( "Axial Slice" );
osg::Uniform* zSliceUniform = new osg::Uniform( "u_WorldTransform", osg::Matrix::identity() );
zSlice->getOrCreateStateSet()->addUniform( zSliceUniform );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment