Commit 2af1c4a0 authored by Mathias Goldau's avatar Mathias Goldau
Browse files

[MERGE]

parents 52dfe6f9 d614efb0
......@@ -109,14 +109,14 @@ void WMMarchingCubes::moduleMain()
{
sleep( 1 );
}
WLogger::getLogger()->addLogMessage( "Starting MC", "Marching Cubes", LL_DEBUG );
debugLog() << "Starting MC";
boost::shared_ptr< WDataHandler > dh = WKernel::getRunningKernel()->getDataHandler();
boost::shared_ptr< WSubject > subject = (*dh)[0];
boost::shared_ptr< const WDataSetSingle > dataSet;
dataSet = boost::shared_dynamic_cast< const WDataSetSingle >( (*subject)[0] );
WLogger::getLogger()->addLogMessage( "Computing surface ...", "Marching Cubes", LL_DEBUG );
debugLog() << "Computing surface ...";
// TODO(wiebel): MC set correct isoValue here
const float testIsoValue = 80;
......@@ -154,14 +154,14 @@ void WMMarchingCubes::moduleMain()
// TODO(wiebel): MC remove this from here
// renderMesh( load( "/tmp/isosurfaceTestMesh.vtk" ) );
WLogger::getLogger()->addLogMessage( "Rendering surface ...", "Marching Cubes", LL_DEBUG );
debugLog() << "Rendering surface ...";
// settings for normal isosurface
m_shaderUseLighting = true;
renderSurface();
WLogger::getLogger()->addLogMessage( "Done!", "Marching Cubes", LL_DEBUG );
debugLog() << "Done!";
}
void WMMarchingCubes::connectors()
......
......@@ -280,10 +280,10 @@ private:
class SurfaceNodeCallback : public osg::NodeCallback
{
public:
/**
* Constructor of the callback adapter.
* \param module A function of this module will be called
*/
/**
* Constructor of the callback adapter.
* \param module A function of this module will be called
*/
explicit SurfaceNodeCallback( boost::shared_ptr< WMMarchingCubes > module );
/**
......
......@@ -14,17 +14,6 @@ uniform sampler3D tex7;
uniform sampler3D tex8;
uniform sampler3D tex9;
uniform float threshold0;
uniform float threshold1;
uniform float threshold2;
uniform float threshold3;
uniform float threshold4;
uniform float threshold5;
uniform float threshold6;
uniform float threshold7;
uniform float threshold8;
uniform float threshold9;
uniform int type0;
uniform int type1;
uniform int type2;
......@@ -50,19 +39,14 @@ uniform float alpha9;
#include "colorMaps.fs"
#include "lighting.fs"
void lookupTex(inout vec4 col, in int type, in sampler3D tex, in float threshold, in vec3 v, in float alpha)
void lookupTex(inout vec4 col, in int type, in sampler3D tex, in vec3 v, in float alpha)
{
vec3 col1 = vec3(0.0);
col1 = clamp( texture3D(tex, v).rgb, 0.0, 1.0);
if ( ( col1.r + col1.g + col1.b ) / 3.0 - threshold <= 0.0) return;
if ( type == 16 && useColorMap != -1)
{
if (threshold < 1.0)
col1.r = (col1.r - threshold) / (1.0 - threshold);
colorMap(col1, col1.r);
}
......@@ -82,16 +66,16 @@ void main()
if( useTexture )
{
if ( type9 > 0 ) lookupTex(col, type9, tex9, threshold9, VaryingTexCoord0.xyz, alpha9);
if ( type8 > 0 ) lookupTex(col, type8, tex8, threshold8, VaryingTexCoord0.xyz, alpha8);
if ( type7 > 0 ) lookupTex(col, type7, tex7, threshold7, VaryingTexCoord0.xyz, alpha7);
if ( type6 > 0 ) lookupTex(col, type6, tex6, threshold6, VaryingTexCoord0.xyz, alpha6);
if ( type5 > 0 ) lookupTex(col, type5, tex5, threshold5, VaryingTexCoord0.xyz, alpha5);
if ( type4 > 0 ) lookupTex(col, type4, tex4, threshold4, VaryingTexCoord0.xyz, alpha4);
if ( type3 > 0 ) lookupTex(col, type3, tex3, threshold3, VaryingTexCoord0.xyz, alpha3);
if ( type2 > 0 ) lookupTex(col, type2, tex2, threshold2, VaryingTexCoord0.xyz, alpha2);
if ( type1 > 0 ) lookupTex(col, type1, tex1, threshold1, VaryingTexCoord0.xyz, alpha1);
if ( type0 > 0 ) lookupTex(col, type0, tex0, threshold0, VaryingTexCoord0.xyz, alpha0);
if ( type9 > 0 ) lookupTex(col, type9, tex9, VaryingTexCoord0.xyz, alpha9);
if ( type8 > 0 ) lookupTex(col, type8, tex8, VaryingTexCoord0.xyz, alpha8);
if ( type7 > 0 ) lookupTex(col, type7, tex7, VaryingTexCoord0.xyz, alpha7);
if ( type6 > 0 ) lookupTex(col, type6, tex6, VaryingTexCoord0.xyz, alpha6);
if ( type5 > 0 ) lookupTex(col, type5, tex5, VaryingTexCoord0.xyz, alpha5);
if ( type4 > 0 ) lookupTex(col, type4, tex4, VaryingTexCoord0.xyz, alpha4);
if ( type3 > 0 ) lookupTex(col, type3, tex3, VaryingTexCoord0.xyz, alpha3);
if ( type2 > 0 ) lookupTex(col, type2, tex2, VaryingTexCoord0.xyz, alpha2);
if ( type1 > 0 ) lookupTex(col, type1, tex1, VaryingTexCoord0.xyz, alpha1);
if ( type0 > 0 ) lookupTex(col, type0, tex0, VaryingTexCoord0.xyz, alpha0);
}
if ( useLighting )
col = col + (ambient * col / 2.0) + (diffuse * col) + (specular * col / 2.0);
......
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