1/*========================================================================= 2 3 Program: Visualization Toolkit 4 Module: raycasterfs.glsl 5 6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 7 All rights reserved. 8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 9 10 This software is distributed WITHOUT ANY WARRANTY; without even 11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 12 PURPOSE. See the above copyright notice for more information. 13 14=========================================================================*/ 15#version 120 16 17// The following line handle system declarations such a 18// default precisions, or defining precisions to null 19//VTK::System::Dec 20 21////////////////////////////////////////////////////////////////////////////// 22/// 23/// Inputs 24/// 25////////////////////////////////////////////////////////////////////////////// 26 27/// 3D texture coordinates form vertex shader 28varying vec3 ip_textureCoords; 29varying vec3 ip_vertexPos; 30 31////////////////////////////////////////////////////////////////////////////// 32/// 33/// Outputs 34/// 35////////////////////////////////////////////////////////////////////////////// 36 37vec4 g_fragColor = vec4(0.0); 38 39////////////////////////////////////////////////////////////////////////////// 40/// 41/// Uniforms, attributes, and globals 42/// 43////////////////////////////////////////////////////////////////////////////// 44vec3 g_dataPos; 45vec3 g_dirStep; 46vec4 g_srcColor; 47vec4 g_eyePosObj; 48 49//VTK::Base::Dec 50//VTK::Termination::Dec 51//VTK::Cropping::Dec 52//VTK::Shading::Dec 53//VTK::BinaryMask::Dec 54//VTK::CompositeMask::Dec 55 56//VTK::ComputeOpacity::Dec 57//VTK::ComputeGradient::Dec 58//VTK::ComputeLighting::Dec 59//VTK::ColorTransferFunc::Dec 60 61//VTK::RayDirectionFunc::Dec 62 63/// We support only 8 clipping planes for now 64/// The first value is the size of the data array for clipping 65/// planes (origin, normal) 66uniform float in_clippingPlanes[49]; 67uniform float in_scale; 68uniform float in_bias; 69 70////////////////////////////////////////////////////////////////////////////// 71/// 72/// Main 73/// 74////////////////////////////////////////////////////////////////////////////// 75void main() 76 { 77 /// Initialize g_fragColor (output) to 0 78 g_fragColor = vec4(0.0); 79 g_dirStep = vec3(0.0); 80 81 //VTK::Base::Init 82 //VTK::Terminate::Init 83 //VTK::Shading::Init 84 //VTK::Cropping::Init 85 //VTK::Clipping::Init 86 87 /// For all samples along the ray 88 while (true) 89 { 90 //VTK::Base::Impl 91 //VTK::Terminate::Impl 92 //VTK::Cropping::Impl 93 //VTK::Clipping::Impl 94 //VTK::BinaryMask::Impl 95 //VTK::CompositeMask::Impl 96 //VTK::Shading::Impl 97 98 /// Advance ray 99 g_dataPos += g_dirStep; 100 } 101 102 //VTK::Base::Exit 103 //VTK::Terminate::Exit 104 //VTK::Cropping::Exit 105 //VTK::Clipping::Exit 106 //VTK::Shading::Exit 107 108 g_fragColor.r = g_fragColor.r * in_scale + in_bias * g_fragColor.a; 109 g_fragColor.g = g_fragColor.g * in_scale + in_bias * g_fragColor.a; 110 g_fragColor.b = g_fragColor.b * in_scale + in_bias * g_fragColor.a; 111 gl_FragColor = g_fragColor; 112 } 113