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
76a737aa
Commit
76a737aa
authored
May 05, 2011
by
Sebastian Eichelbaum
Browse files
[ADD] - added option to show complete slices
parent
da982ebe
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
3 deletions
+25
-3
src/graphicsEngine/shaders/shaders/WGEColormapping-fragment.glsl
...phicsEngine/shaders/shaders/WGEColormapping-fragment.glsl
+0
-1
src/modules/navigationSlices/WMNavigationSlices.cpp
src/modules/navigationSlices/WMNavigationSlices.cpp
+9
-0
src/modules/navigationSlices/WMNavigationSlices.h
src/modules/navigationSlices/WMNavigationSlices.h
+2
-0
src/modules/navigationSlices/shaders/WMNavigationSlices-fragment.glsl
...navigationSlices/shaders/WMNavigationSlices-fragment.glsl
+14
-2
No files found.
src/graphicsEngine/shaders/shaders/WGEColormapping-fragment.glsl
View file @
76a737aa
...
...
@@ -57,7 +57,6 @@ void colormap( inout vec4 color, in sampler3D sampler, in vec3 coord, float minV
// compositing:
// associated colors needed
src
.
rgb
*=
src
.
a
;
//src.a = 1.0;
// apply front-to-back compositing
color
=
(
1
.
0
-
color
.
a
)
*
src
+
color
;
}
...
...
src/modules/navigationSlices/WMNavigationSlices.cpp
View file @
76a737aa
...
...
@@ -31,6 +31,7 @@
#include "../../graphicsEngine/WGEGeodeUtils.h"
#include "../../graphicsEngine/callbacks/WGELinearTranslationCallback.h"
#include "../../graphicsEngine/callbacks/WGENodeMaskCallback.h"
#include "../../graphicsEngine/callbacks/WGEPropertyUniformCallback.h"
#include "../../graphicsEngine/callbacks/WGEShaderAnimationCallback.h"
#include "../../graphicsEngine/shaders/WGEPropertyUniform.h"
#include "../../graphicsEngine/shaders/WGEShader.h"
...
...
@@ -85,6 +86,9 @@ void WMNavigationSlices::connectors()
void
WMNavigationSlices
::
properties
()
{
m_noTransparency
=
m_properties
->
addProperty
(
"No Transparency"
,
"If checked, transparency is not used. This will show the complete slices."
,
false
);
m_sliceGroup
=
m_properties
->
addPropertyGroup
(
"Slices"
,
"Slice Options."
);
// enable slices
...
...
@@ -222,6 +226,11 @@ void WMNavigationSlices::initOSG()
state
->
addUniform
(
animationUniform
);
animationUniform
->
setUpdateCallback
(
new
WGEShaderAnimationCallback
()
);
// transparency property
osg
::
ref_ptr
<
osg
::
Uniform
>
transparencyUniform
=
new
osg
::
Uniform
(
"u_noTransparency"
,
false
);
state
->
addUniform
(
transparencyUniform
);
transparencyUniform
->
setUpdateCallback
(
new
WGEPropertyUniformCallback
<
WPropBool
>
(
m_noTransparency
)
);
// add the transformation nodes to the output group
m_output
->
insert
(
mX
);
m_output
->
insert
(
mY
);
...
...
src/modules/navigationSlices/WMNavigationSlices.h
View file @
76a737aa
...
...
@@ -196,6 +196,8 @@ private:
*/
osg
::
ref_ptr
<
WGEManagedGroupNode
>
m_output
;
WPropBool
m_noTransparency
;
//!< if true, the whole slices are shown.
WPropGroup
m_sliceGroup
;
//!< the group contains several slice properties
WPropDouble
m_xPos
;
//!< x position of the slice
...
...
src/modules/navigationSlices/shaders/WMNavigationSlices-fragment.glsl
View file @
76a737aa
...
...
@@ -35,6 +35,9 @@ uniform float u_picked;
// animation time. Used for pick-animation
uniform
int
u_timer
;
// if true, no transparency should be used.
uniform
bool
u_noTransparency
;
/**
* Applies colormapping.
*/
...
...
@@ -47,9 +50,18 @@ void main()
// NOTE: the 100.0 depends on the timer tick. We have a timer that counts one per a hundreth of a second.
float
pickColorIntensity
=
0
.
5
*
(
1
.
0
+
sin
(
3
.
0
*
3
.
1472
*
float
(
u_timer
)
/
100
.
0
)
);
// as we use this for blending, we want it to swing in [0.5-0.75]
pickColorIntensity
=
0
.
5
+
(
pickColorIntensity
*
0
.
25
);
pickColorIntensity
=
(
pickColorIntensity
*
0
.
25
)
+
0
.
5
;
// remove transparency?
float
removeTransparency
=
clamp
(
u_picked
+
float
(
u_noTransparency
),
0
.
0
,
1
.
0
);
cmap
.
a
=
(
(
1
.
0
-
removeTransparency
)
*
cmap
.
a
)
+
removeTransparency
;
// mix colormapping and pick color
gl_FragColor
=
mix
(
pickColor
,
cmap
,
(
(
1
.
0
-
u_picked
)
*
1
.
0
)
+
(
u_picked
*
pickColorIntensity
)
);
vec4
finalColor
=
mix
(
pickColor
,
cmap
,
(
1
.
0
-
u_picked
)
+
(
u_picked
*
pickColorIntensity
)
// mix intensity. This is influenced by the pick-state.
);
// set as fragColor and remove transparency if needed.
gl_FragColor
=
vec4
(
finalColor
.
rgba
);
}
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