Commit 419e4be0 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] you can now turn of directional coloring of glyphs.

parent 10aa99ed
......@@ -128,6 +128,8 @@ void WMSuperquadricGlyphs::properties()
m_scaling = m_properties->addProperty( "Scaling", "Scaling of Glyphs.", 0.5 );
m_scaling->setMin( 0.0 );
m_scaling->setMax( 2.0 );
m_directionalColoring = m_properties->addProperty( "Directional Color", "Color glyphs by main direction.", true );
}
inline void WMSuperquadricGlyphs::addGlyph( osg::Vec3 position, osg::ref_ptr< osg::Vec3Array > vertices, osg::ref_ptr< osg::Vec3Array > orientation )
......@@ -412,6 +414,10 @@ void WMSuperquadricGlyphs::moduleMain()
sset->addUniform( scaling );
sset->addUniform( gamma );
m_shader->addPreprocessor( WGEShaderPreprocessor::SPtr(
new WGEShaderPropertyDefineOptions< WPropBool >( m_directionalColoring, "DIRECTIONALCOLORING_DISABLED", "DIRECTIONALCOLORING_ENABLED" ) )
);
bool initialTensorUpload = true;
// loop until the module container requests the module to quit
......
......@@ -221,6 +221,11 @@ private:
*/
WPropDouble m_scaling;
/**
* Color glyphs by direction?
*/
WPropBool m_directionalColoring;
/**
* Adds a cube to the vertex array.
*
......
......@@ -267,12 +267,18 @@ void main( void )
wge_FragZoom = v_worldScale;
wge_FragTangent = textureNormalize( vec3( 0.0, 1.0, 0.0 ) );
#ifdef DIRECTIONALCOLORING_ENABLED
vec3 col = gl_Color.rgb;
#else
vec3 col = vec3( 1.0, 1.0, 1.0 );
#endif
// draw shaded pixel
wge_FragColor = blinnPhongIllumination(
// material properties
gl_Color.rgb * 0.2, // ambient color
gl_Color.rgb * 2.0, // diffuse color
gl_Color.rgb, // specular color
col.rgb * 0.2, // ambient color
col.rgb * 2.0, // diffuse color
col.rgb, // specular color
30.0, // shininess
// light color properties
......
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