Commit 16c65f0c authored by Alexander Wiebel's avatar Alexander Wiebel

[FIX #343] fixed shading. works now with glsl.

parent 381165db
......@@ -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 );
......
......@@ -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
......
#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;
}
#include "WGELighting.glsl"
void main()
{
prepareLight();
gl_FrontColor = gl_Color;
gl_Position = ftransform();
}
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