Commit c5643cb3 authored by Alexander Wiebel's avatar Alexander Wiebel

[CLEAN #161] removed some code by using the new WGEFunctorCallback

parent 7a1314ff
......@@ -51,6 +51,7 @@
#include "../../dataHandler/WSubject.h"
#include "../../dataHandler/WDataTexture3D.h"
#include "../../graphicsEngine/WGEUtils.h"
#include "../../graphicsEngine/callbacks/WGEFunctorCallback.h"
#include "../../kernel/WKernel.h"
#include "../../graphicsEngine/algorithms/WMarchingCubesAlgorithm.h"
......@@ -489,7 +490,7 @@ void WMMarchingCubes::renderMesh()
m_moduleNodeInserted = true;
}
m_moduleNode->addUpdateCallback( new SurfaceNodeCallback( this ) );
m_moduleNode->addUpdateCallback( new WGEFunctorCallback< osg::Node >( boost::bind( &WMMarchingCubes::updateGraphicsCallback, this ) ) );
}
void WMMarchingCubes::notifyTextureChange()
......@@ -571,7 +572,7 @@ bool WMMarchingCubes::save() const
return true;
}
void WMMarchingCubes::updateGraphicsForCallback()
void WMMarchingCubes::updateGraphicsCallback()
{
boost::unique_lock< boost::shared_mutex > lock;
lock = boost::unique_lock< boost::shared_mutex >( m_updateLock );
......@@ -690,4 +691,3 @@ void WMMarchingCubes::updateGraphicsForCallback()
}
lock.unlock();
}
......@@ -93,7 +93,7 @@ public:
/**
* updates textures and shader parameters when called (usually from the callback)
*/
void updateGraphicsForCallback();
void updateGraphicsCallback();
protected:
/**
......@@ -200,41 +200,4 @@ private:
static const int m_maxNumberOfTextures = 8; //!< We support only 8 textures because some known hardware does not support more texture coordinates.
};
/**
* Adapter object for realizing callbacks of the node representing the isosurface in the osg
*/
class SurfaceNodeCallback : public osg::NodeCallback
{
public:
/**
* Constructor of the callback adapter.
* \param module A function of this module will be called
*/
explicit SurfaceNodeCallback( WMMarchingCubes* module );
/**
* Function that is called by the osg and that call the function in the module.
* \param node The node we are called.
* \param nv the visitor calling us.
*/
virtual void operator()( osg::Node* node, osg::NodeVisitor* nv );
private:
WMMarchingCubes* m_module; //!< Pointer to the module to which the function that is called belongs to.
};
inline SurfaceNodeCallback::SurfaceNodeCallback( WMMarchingCubes* module )
: m_module( module )
{
}
inline void SurfaceNodeCallback::operator()( osg::Node* node, osg::NodeVisitor* nv )
{
if ( m_module )
{
m_module->updateGraphicsForCallback();
}
traverse( node, nv );
}
#endif // WMMARCHINGCUBES_H
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