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
16c65f0c
Commit
16c65f0c
authored
Aug 04, 2010
by
Alexander Wiebel
Browse files
[FIX
#343
] fixed shading. works now with glsl.
parent
381165db
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
0 deletions
+35
-0
src/modules/homeGlyphs/WMHomeGlyphs.cpp
src/modules/homeGlyphs/WMHomeGlyphs.cpp
+4
-0
src/modules/homeGlyphs/WMHomeGlyphs.h
src/modules/homeGlyphs/WMHomeGlyphs.h
+3
-0
src/modules/homeGlyphs/shaders/WMHomeGlyphs-fragment.glsl
src/modules/homeGlyphs/shaders/WMHomeGlyphs-fragment.glsl
+18
-0
src/modules/homeGlyphs/shaders/WMHomeGlyphs-vertex.glsl
src/modules/homeGlyphs/shaders/WMHomeGlyphs-vertex.glsl
+10
-0
No files found.
src/modules/homeGlyphs/WMHomeGlyphs.cpp
View file @
16c65f0c
...
...
@@ -311,6 +311,10 @@ void WMHomeGlyphs::renderSlice( size_t sliceId )
glyphGeometry
->
setColorBinding
(
osg
::
Geometry
::
BIND_PER_VERTEX
);
m_glyphsGeode
->
addDrawable
(
glyphGeometry
);
m_shader
=
osg
::
ref_ptr
<
WShader
>
(
new
WShader
(
"WMHomeGlyphs"
,
m_localPath
)
);
m_shader
->
apply
(
m_glyphsGeode
);
m_moduleNode
->
insert
(
m_glyphsGeode
);
...
...
src/modules/homeGlyphs/WMHomeGlyphs.h
View file @
16c65f0c
...
...
@@ -30,6 +30,7 @@
#include <osg/Geode>
#include "../../dataHandler/WDataSetSphericalHarmonics.h"
#include "../../graphicsEngine/WShader.h"
#include "../../kernel/WModule.h"
#include "../../kernel/WModuleInputData.h"
#include "../../kernel/WModuleOutputData.h"
...
...
@@ -129,6 +130,8 @@ private:
* \param sliceId The number of the slice to be rendered.
*/
void
renderSlice
(
size_t
sliceId
);
osg
::
ref_ptr
<
WShader
>
m_shader
;
//!< The shader used for the glyph surfaces
WPropBool
m_usePolarPlotProp
;
//!< Property indicating whether to use polar plot instead of HOME glyph
...
...
src/modules/homeGlyphs/shaders/WMHomeGlyphs-fragment.glsl
0 → 100644
View file @
16c65f0c
#include "WGEColorMaps.glsl"
#include "WGELighting.glsl"
void
main
()
{
vec4
col
=
gl_Color
;
vec4
ambient
=
vec4
(
0
.
0
);
vec4
diffuse
=
vec4
(
0
.
0
);
vec4
specular
=
vec4
(
0
.
0
);
calculateLighting
(
-
normal
,
gl_FrontMaterial
.
shininess
,
ambient
,
diffuse
,
specular
);
calculateLighting
(
normal
,
gl_FrontMaterial
.
shininess
,
ambient
,
diffuse
,
specular
);
col
=
(
ambient
*
col
/
2
.
0
)
+
(
diffuse
*
col
)
+
(
specular
*
col
/
2
.
0
);
col
=
clamp
(
col
,
0
.
0
,
1
.
0
);
gl_FragColor
=
col
;
}
src/modules/homeGlyphs/shaders/WMHomeGlyphs-vertex.glsl
0 → 100644
View file @
16c65f0c
#include "WGELighting.glsl"
void
main
()
{
prepareLight
();
gl_FrontColor
=
gl_Color
;
gl_Position
=
ftransform
();
}
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