Updated Uniform name for controlling IsoSurfaceValue

This commit is contained in:
Robert Osfield
2009-01-17 17:23:17 +00:00
parent 069d86ae8b
commit 71ee1a7047
3 changed files with 9 additions and 8 deletions

View File

@@ -214,6 +214,8 @@ void ShaderTechnique::init()
else if (shadingModel==Isosurface)
{
stateset->addUniform(cpv._isoProperty->getUniform());
if (tf)
{
osg::Texture1D* texture1D = new osg::Texture1D;

View File

@@ -1,7 +1,7 @@
char volume_iso_frag[] = "uniform sampler3D baseTexture;\n"
"uniform float sampleDensity;\n"
"uniform float transparency;\n"
"uniform float alphaCutOff;\n"
"uniform float IsoSurfaceValue;\n"
"\n"
"varying vec4 cameraPos;\n"
"varying vec4 vertexPos;\n"
@@ -84,10 +84,10 @@ char volume_iso_frag[] = "uniform sampler3D baseTexture;\n"
" {\n"
" vec4 color = texture3D( baseTexture, texcoord);\n"
"\n"
" float m = (previousColor.a-alphaCutOff) * (color.a-alphaCutOff);\n"
" float m = (previousColor.a-IsoSurfaceValue) * (color.a-IsoSurfaceValue);\n"
" if (m <= 0.0)\n"
" {\n"
" float r = (alphaCutOff-color.a)/(previousColor.a-color.a);\n"
" float r = (IsoSurfaceValue-color.a)/(previousColor.a-color.a);\n"
" texcoord = texcoord - r*deltaTexCoord;\n"
" \n"
" float a = color.a;\n"
@@ -128,7 +128,6 @@ char volume_iso_frag[] = "uniform sampler3D baseTexture;\n"
" }\n"
"\n"
" if (fragColor.w>1.0) fragColor.w = 1.0; \n"
" //if (fragColor.w<alphaCutOff) discard;\n"
" gl_FragColor = fragColor;\n"
"}\n"
"\n";

View File

@@ -2,7 +2,7 @@ char volume_tf_iso_frag[] = "uniform sampler3D baseTexture;\n"
"uniform sampler1D tfTexture;\n"
"uniform float sampleDensity;\n"
"uniform float transparency;\n"
"uniform float alphaCutOff;\n"
"uniform float IsoSurfaceValue;\n"
"\n"
"varying vec4 cameraPos;\n"
"varying vec4 vertexPos;\n"
@@ -84,10 +84,10 @@ char volume_tf_iso_frag[] = "uniform sampler3D baseTexture;\n"
"\n"
" float v = texture3D( baseTexture, texcoord).a;\n"
"\n"
" float m = (previousV-alphaCutOff) * (v-alphaCutOff);\n"
" float m = (previousV-IsoSurfaceValue) * (v-IsoSurfaceValue);\n"
" if (m <= 0.0)\n"
" {\n"
" float r = (alphaCutOff-v)/(previousV-v);\n"
" float r = (IsoSurfaceValue-v)/(previousV-v);\n"
" texcoord = texcoord - r*deltaTexCoord;\n"
"\n"
" v = texture3D( baseTexture, texcoord).a;\n"
@@ -123,7 +123,7 @@ char volume_tf_iso_frag[] = "uniform sampler3D baseTexture;\n"
" }\n"
"\n"
" if (fragColor.w>1.0) fragColor.w = 1.0; \n"
" if (fragColor.w<alphaCutOff) discard;\n"
" if (fragColor.w<IsoSurfaceValue) discard;\n"
" gl_FragColor = fragColor;\n"
"}\n"
"\n";