Commit 33db85db authored by schurade's avatar schurade
Browse files

[ADD] nav slices now can be switched to complete mode, in which the shader...

[ADD] nav slices now can be switched to complete mode, in which the shader won't discard fragments with value zero
parent a1b3c79c
......@@ -131,6 +131,7 @@ void WMNavSlices::properties()
m_sagittalPos = m_properties->addProperty( "Sagittal Slice", "Position of sagittal slice.", 80 );
m_sagittalPos->setMin( 0 );
m_sagittalPos->setMax( 160 );
m_showComplete = m_properties->addProperty( "show complete", "Slice should be drawn complete even if the texture value is zero.", false );
m_axialPos->setHidden();
m_coronalPos->setHidden();
......@@ -877,6 +878,8 @@ void WMNavSlices::updateTextures()
m_highlightUniformCoronal->set( m_isPickedCoronal );
m_highlightUniformAxial->set( m_isPickedAxial );
m_showCompleteUniform->set( m_showComplete->get() );
m_xSliceNode->getOrCreateStateSet()->merge( *rootState );
m_ySliceNode->getOrCreateStateSet()->merge( *rootState );
m_zSliceNode->getOrCreateStateSet()->merge( *rootState );
......@@ -884,9 +887,6 @@ void WMNavSlices::updateTextures()
void WMNavSlices::initUniforms( osg::StateSet* rootState )
{
boost::shared_lock<boost::shared_mutex> slock;
slock = boost::shared_lock<boost::shared_mutex>( m_updateLock );
m_typeUniforms.push_back( osg::ref_ptr<osg::Uniform>( new osg::Uniform( "type0", 0 ) ) );
m_typeUniforms.push_back( osg::ref_ptr<osg::Uniform>( new osg::Uniform( "type1", 0 ) ) );
m_typeUniforms.push_back( osg::ref_ptr<osg::Uniform>( new osg::Uniform( "type2", 0 ) ) );
......@@ -959,7 +959,11 @@ void WMNavSlices::initUniforms( osg::StateSet* rootState )
m_ySliceNode->getOrCreateStateSet()->addUniform( m_highlightUniformCoronal );
m_zSliceNode->getOrCreateStateSet()->addUniform( m_highlightUniformAxial );
slock.unlock();
m_showCompleteUniform = osg::ref_ptr<osg::Uniform>( new osg::Uniform( "showComplete", 0 ) );
m_xSliceNode->getOrCreateStateSet()->addUniform( m_showCompleteUniform );
m_ySliceNode->getOrCreateStateSet()->addUniform( m_showCompleteUniform );
m_zSliceNode->getOrCreateStateSet()->addUniform( m_showCompleteUniform );
}
void WMNavSlices::updateViewportMatrix()
......
......@@ -201,6 +201,11 @@ private:
*/
WPropBool m_showSagittal;
/**
* True if the shader shouldn't discard a fragment when the value is zero
*/
WPropBool m_showComplete;
/**
* The current position as information property.
*/
......@@ -321,6 +326,8 @@ private:
osg::ref_ptr<osg::Uniform> m_highlightUniformCoronal; //!< Determines whether the slice is highlighted
osg::ref_ptr<osg::Uniform> m_highlightUniformAxial; //!< Determines whether the slice is highlighted
osg::ref_ptr<osg::Uniform> m_showCompleteUniform; //!< Determines whether the slices should be drawn completely
/**
* To avoid multiple instances of the nav slices.
*/
......
......@@ -53,6 +53,7 @@ uniform int useCmap6;
uniform int useCmap7;
uniform bool highlighted;
uniform bool showComplete;
#include "colorMaps.fs"
......@@ -104,6 +105,7 @@ void main()
}
else
{
if ( !showComplete )
discard;
}
}
......
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