Commit 93c768ed by Sebastian Eichelbaum

[MERGE]

parents 973f5e5c b46902ef
......@@ -237,13 +237,14 @@ void WMFiberDisplay::toggleTubes()
{
if ( m_useTubesProp->get( true ) )
{
updateTexture();
m_useTextureProp->get( true );
m_tubeDrawable->setUseTubes( true );
m_shaderTubes->apply( m_osgNode );
osg::ref_ptr<osg::Uniform>( new osg::Uniform( "globalColor", 1 ) );
rootState->addUniform( osg::ref_ptr<osg::Uniform>( new osg::Uniform( "globalColor", 1 ) ) );
m_uniformTubeThickness = osg::ref_ptr<osg::Uniform>( new osg::Uniform( "u_thickness", static_cast<float>( m_tubeThickness->get() ) ) );
rootState->addUniform( m_uniformTubeThickness );
rootState->addUniform( osg::ref_ptr<osg::Uniform>( new osg::Uniform( "useTexture", m_useTextureProp->get() ) ) );
}
else if ( m_useTextureProp->get( true ) && !m_useTubesProp->get( true ) )
{
......
......@@ -3,7 +3,36 @@ varying float s_param; // s parameter of texture [-1..1]
varying float tangent_dot_view;
varying vec4 myColor;
uniform bool globalColor;
uniform bool useTexture;
varying vec4 VaryingTexCoord0;
uniform int dimX, dimY, dimZ;
uniform sampler3D tex;
uniform int type;
uniform float threshold;
uniform int cMap;
#include "colorMaps.fs"
float lookupTex()
{
vec3 v = VaryingTexCoord0.xyz;
v.x = v.x / ( float( dimX ) );
v.y = v.y / ( float( dimY ) );
v.z = v.z / ( float( dimZ ) );
vec3 col1;
col1.r = clamp( texture3D( tex, v ).r, 0.0, 1.0 );
if ( col1.r < threshold )
{
discard;
}
else
return col1.r;
}
/*
* simple fragment shader that does rendering of tubes with diffuse illumination
*/
......@@ -11,10 +40,15 @@ void main()
{
vec3 color;
//if (globalColor)
if ( useTexture )
{
float value = lookupTex();
colorMap(color, value, cMap );
}
else
color = abs(normalize(myColor.rgb));
//else
// color = abs(normalize(tangentR3));
vec3 view = vec3(0., 0., -1.);
float view_dot_normal = sqrt(1. - s_param * s_param) + .1;
......
......@@ -3,9 +3,12 @@ varying vec3 tangentR3;
varying float s_param;
varying vec4 myColor;
uniform float u_thickness;
varying vec4 VaryingTexCoord0;
void main()
{
VaryingTexCoord0 = gl_Vertex;
gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex; //< make clipping planes work
vec3 tangent;
......
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