Commit 36934b70 authored by ledig's avatar ledig
Browse files

[FIX] FiberDisplay does no longer recursivly call its own destructor on delete...

[FIX] FiberDisplay does no longer recursivly call its own destructor on delete and fixed initialzation order
parent c7a04751
......@@ -210,9 +210,10 @@ void WMFiberDisplay::create()
osgNodeNew->addChild( geode );
osgNodeNew->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
WKernel::getRunningKernel()->getGraphicsEngine()->getScene()->addChild( osgNodeNew.get() );
osgNodeNew->setUserData( this );
osgNodeNew->setUserData( osg::ref_ptr< userData >(
new userData( boost::shared_dynamic_cast< WMFiberDisplay >( shared_from_this() ) )
) );
osgNodeNew->addUpdateCallback( new fdNodeCallback );
// remove previous nodes if there are any
......@@ -224,6 +225,8 @@ void WMFiberDisplay::create()
osg::StateSet* rootState = m_osgNode->getOrCreateStateSet();
initUniforms( rootState );
WKernel::getRunningKernel()->getGraphicsEngine()->getScene()->addChild( m_osgNode.get() );
}
void WMFiberDisplay::connectors()
......@@ -486,3 +489,18 @@ void WMFiberDisplay::initCullBox()
m_cullBox = osg::ref_ptr< WROIBox >( new WROIBox( minROIPos, maxROIPos ) );
m_cullBox->setColor( osg::Vec4( 1.0, 0., 1.0, 0.4 ) );
}
void WMFiberDisplay::userData::update()
{
parent->update();
}
void WMFiberDisplay::userData::updateRenderModes()
{
parent->updateRenderModes();
}
void WMFiberDisplay::userData::toggleColoring()
{
parent->toggleColoring();
}
\ No newline at end of file
......@@ -129,6 +129,18 @@ protected:
*/
void notifyTextureChange();
/**
* switches between fiber display and tube representation,
* texturing and box culling
* activates the neccesary shaders
*/
void updateRenderModes();
/**
* Enable disable global or local coloring
*/
void toggleColoring();
private:
/**
* Updates the output with the current selection and generates a WFiberCluster out of it.
......@@ -246,17 +258,6 @@ private:
osg::ref_ptr< WROIBox > m_cullBox; //!< stores a pointer to the cull box
/**
* switches between fiber display and tube representation,
* texturing and box culling
* activates the neccesary shaders
*/
void updateRenderModes();
/**
* Enable disable global or local coloring
*/
void toggleColoring();
/**
* changes tube parameters
......@@ -284,6 +285,20 @@ private:
*/
void initCullBox();
class userData: public osg::Referenced
{
public:
userData( boost::shared_ptr< WMFiberDisplay > _parent )
{
parent = _parent;
}
void update();
void updateRenderModes();
void toggleColoring();
private:
boost::shared_ptr< WMFiberDisplay > parent;
};
/**
* Node callback to handle updates properly
......@@ -299,7 +314,7 @@ private:
*/
virtual void operator()( osg::Node* node, osg::NodeVisitor* nv )
{
osg::ref_ptr< WMFiberDisplay > module = static_cast< WMFiberDisplay* > ( node->getUserData() );
osg::ref_ptr< userData > module = static_cast< userData* > ( node->getUserData() );
if ( module )
{
......
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