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
a876a0c2
Commit
a876a0c2
authored
Feb 19, 2010
by
Alexander Wiebel
Browse files
[CHANGE] adapted to new properties
parent
fde09285
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
43 deletions
+26
-43
src/modules/fiberDisplay/WMFiberDisplay.cpp
src/modules/fiberDisplay/WMFiberDisplay.cpp
+22
-35
src/modules/fiberDisplay/WMFiberDisplay.h
src/modules/fiberDisplay/WMFiberDisplay.h
+4
-8
No files found.
src/modules/fiberDisplay/WMFiberDisplay.cpp
View file @
a876a0c2
...
...
@@ -175,47 +175,34 @@ void WMFiberDisplay::activate()
void
WMFiberDisplay
::
properties
()
{
m_properties
->
addString
(
"Fibers Display Module"
,
"Display fibers"
);
// this bool is hidden
m_properties
->
addBool
(
"Local Color"
,
false
)
->
connect
(
boost
::
bind
(
&
WMFiberDisplay
::
slotPropertyChanged
,
this
,
_1
)
);
m_properties
->
addBool
(
"Use Tubes"
,
false
)
->
connect
(
boost
::
bind
(
&
WMFiberDisplay
::
slotPropertyChanged
,
this
,
_1
)
);
}
void
WMFiberDisplay
::
toggleTubes
()
{
if
(
m_properties
->
getValue
<
bool
>
(
"Use Tubes"
)
)
{
m_tubeDrawable
->
setUseTubes
(
true
);
m_tubeDrawable
->
dirtyDisplayList
();
m_useTubesProp
=
m_properties2
->
addProperty
(
"Use Tubes"
,
"Draw fiber tracts as fake tubes."
,
false
);
m_shader
->
apply
(
m_osgNode
);
osg
::
ref_ptr
<
osg
::
Uniform
>
(
new
osg
::
Uniform
(
"globalColor"
,
1
)
);
osg
::
StateSet
*
rootState
=
m_osgNode
->
getOrCreateStateSet
();
rootState
->
addUniform
(
osg
::
ref_ptr
<
osg
::
Uniform
>
(
new
osg
::
Uniform
(
"globalColor"
,
1
)
)
);
}
else
{
m_tubeDrawable
->
setUseTubes
(
false
);
m_tubeDrawable
->
dirtyDisplayList
();
}
// TODO( all ): remove the "true" that hides this property when local coloring is available again.
m_localColorProp
=
m_properties2
->
addProperty
(
"Local Color"
,
"Use local direction of fiber tract for coloring the line instead of global direction."
,
false
,
true
);
}
void
WMFiberDisplay
::
slotPropertyChanged
(
std
::
string
propertyName
)
void
WMFiberDisplay
::
toggleTubes
(
)
{
if
(
propertyName
==
"Local Color"
)
{
updateColoring
();
}
else
if
(
propertyName
==
"Use Tubes"
)
if
(
m_useTubesProp
->
changed
()
)
{
toggleTubes
();
}
if
(
m_useTubesProp
->
get
(
true
)
)
{
m_tubeDrawable
->
setUseTubes
(
true
);
m_tubeDrawable
->
dirtyDisplayList
();
else
{
// instead of WLogger we must use std::cerr since WLogger needs to much time!
std
::
cerr
<<
propertyName
<<
std
::
endl
;
assert
(
0
&&
"This property name is not supported by this function yet."
);
m_shader
->
apply
(
m_osgNode
);
osg
::
ref_ptr
<
osg
::
Uniform
>
(
new
osg
::
Uniform
(
"globalColor"
,
1
)
);
osg
::
StateSet
*
rootState
=
m_osgNode
->
getOrCreateStateSet
();
rootState
->
addUniform
(
osg
::
ref_ptr
<
osg
::
Uniform
>
(
new
osg
::
Uniform
(
"globalColor"
,
1
)
)
);
}
else
{
m_tubeDrawable
->
setUseTubes
(
false
);
m_tubeDrawable
->
dirtyDisplayList
();
}
}
}
...
...
src/modules/fiberDisplay/WMFiberDisplay.h
View file @
a876a0c2
...
...
@@ -81,12 +81,6 @@ public:
*/
virtual
const
char
**
getXPMIcon
()
const
;
/**
* Determine what to do if a property was changed.
* \param propertyName Name of the property.
*/
void
slotPropertyChanged
(
std
::
string
propertyName
);
protected:
/**
* Callback for m_active. Overwrite this in your modules to handle m_active changes separately.
...
...
@@ -124,9 +118,10 @@ protected:
*/
void
updateColoring
();
WPropBool
m_localColor
;
private:
WPropBool
m_localColorProp
;
//!< Property indicating whether to use ocal or global coloring of fiber tracts
WPropBool
m_useTubesProp
;
//!< Property indicating whether to use tubes for the fibers tracts.
/**
* Input connector for a fiber dataset.
*/
...
...
@@ -191,6 +186,7 @@ private:
if
(
module
)
{
module
->
update
();
module
->
toggleTubes
();
}
traverse
(
node
,
nv
);
}
...
...
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