//============================================================================= // // Project: SharpImage // Module: shader-vt-copy.frag // Language: OpenGL Shading Language (GLSL) // Author: Dan Mueller // Date: $Date$ // Revision: $Revision$ // // Copyright (c) Queensland University of Technology (QUT) 2007. // All rights reserved. // // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the copyright notices for more information. // //============================================================================= uniform sampler3D sam3Tex0; // Sampler for transfer function uniform sampler3D sam3Tex1; // Sampler for value image uniform sampler3D sam3Tex2; // Not used uniform sampler3D sam3Tex3; // Sampler for tag image uniform float fFactor1; // Enhancement factor uniform float fFactor2; // Enhancement factor uniform float fFactor3; // Enhancement factor void main() { // Interpolate images float value = vec4( texture3D(sam3Tex1, gl_TexCoord[1]) ).a; float tag = vec4( texture3D(sam3Tex3, gl_TexCoord[3]) ).a; // Weight based on tag const float TAG0 = 0.0 / 255.0; const float TAG1 = 1.0 / 255.0; const float TAG2 = 2.0 / 255.0; const float TAG3 = 3.0 / 255.0; const float TAG4 = 4.0 / 255.0; float fWeightedValue = float( tag == TAG0 ) * value * clamp( fFactor1, 0.0, 1.0 ) + float( tag == TAG1 ) * value * clamp( fFactor2, 0.0, 1.0 ) + float( tag == TAG2 ) * value * clamp( fFactor3, 0.0, 1.0 ); // Set color gl_FragColor = vec4( fWeightedValue, fWeightedValue, fWeightedValue, 1.0 ); }