Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
9e451ce0
Commit
9e451ce0
authored
Oct 08, 2010
by
schurade
Browse files
[CLEAN] changed to use new FunctorCallback
parent
f81d3df6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
80 deletions
+10
-80
src/modules/fiberDisplay/WMFiberDisplay.cpp
src/modules/fiberDisplay/WMFiberDisplay.cpp
+5
-17
src/modules/fiberDisplay/WMFiberDisplay.h
src/modules/fiberDisplay/WMFiberDisplay.h
+5
-63
No files found.
src/modules/fiberDisplay/WMFiberDisplay.cpp
View file @
9e451ce0
...
...
@@ -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
();
}
src/modules/fiberDisplay/WMFiberDisplay.h
View file @
9e451ce0
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment