Commit 9e451ce0 authored by schurade's avatar schurade

[CLEAN] changed to use new FunctorCallback

parent f81d3df6
......@@ -307,11 +307,7 @@ void WMFiberDisplay::create()
osgNodeNew->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
osgNodeNew->setUserData( osg::ref_ptr< userData >(
new userData( boost::shared_dynamic_cast< WMFiberDisplay >( shared_from_this() ) )
) );
osgNodeNew->addUpdateCallback( new fdNodeCallback );
osgNodeNew->addUpdateCallback( new WGEFunctorCallback< osg::Node >( boost::bind( &WMFiberDisplay::updateCallback, this ) ) );
// remove previous nodes if there are any
WKernel::getRunningKernel()->getGraphicsEngine()->getScene()->removeChild( m_osgNode.get() );
......@@ -477,17 +473,9 @@ void WMFiberDisplay::notifyTextureChange()
m_textureChanged = true;
}
void WMFiberDisplay::userData::update()
{
parent->update();
}
void WMFiberDisplay::userData::updateRenderModes()
{
parent->updateRenderModes();
}
void WMFiberDisplay::userData::toggleColoring()
void WMFiberDisplay::updateCallback()
{
parent->toggleColoring();
update();
toggleColoring();
updateRenderModes();
}
......@@ -140,6 +140,11 @@ private:
*/
void inputUpdated();
/**
* The update callback that is called for the osg node of this module.
*/
void updateCallback();
/**
* A condition used to notify about changes in several properties.
*/
......@@ -276,69 +281,6 @@ private:
* create a selection box to cull the fibers
*/
void initCullBox();
/**
* Wrapper class for userData to prevent cyclic destructor calls
*/
class userData: public osg::Referenced
{
public:
/**
* userData Constructur with shared pointer to module
* \param _parent pointer to the module
*/
explicit userData( boost::shared_ptr< WMFiberDisplay > _parent )
{
parent = _parent;
}
/**
* update wrapper Function
*/
void update();
/**
* updateRenderModes wrapper Function
*/
void updateRenderModes();
/**
* toggleColoring wrapper Function
*/
void toggleColoring();
private:
/**
* shared pointer to the module
*/
boost::shared_ptr< WMFiberDisplay > parent;
};
/**
* Node callback to handle updates properly
*/
class fdNodeCallback : public osg::NodeCallback
{
public: // NOLINT
/**
* operator ()
*
* \param node the osg node
* \param nv the node visitor
*/
virtual void operator()( osg::Node* node, osg::NodeVisitor* nv )
{
osg::ref_ptr< userData > module = static_cast< userData* > ( node->getUserData() );
if ( module )
{
module->update();
module->updateRenderModes();
module->toggleColoring();
}
traverse( node, nv );
}
};
};
inline const std::string WMFiberDisplay::getName() const
......
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