/* DO NOT EDIT.
 * Generated by ../bin/vtkEncodeString
 * 
 * Define the vtkGPUVolumeRayCastMapper_CompositeBinaryMaskFS string.
 *
 * Generated from file: /home/dorado1/vtk/VTK5.10.1/VolumeRendering/vtkGPUVolumeRayCastMapper_CompositeBinaryMaskFS.glsl
 */
#include "vtkGPUVolumeRayCastMapper_CompositeBinaryMaskFS.h"
const char *vtkGPUVolumeRayCastMapper_CompositeBinaryMaskFS =
"/*=========================================================================\n"
"\n"
"  Program:   Visualization Toolkit\n"
"  Module:    vtkGPUVolumeRayCastMapper_CompositeBinaryMaskFS.glsl\n"
"\n"
"  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n"
"  All rights reserved.\n"
"  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n"
"\n"
"     This software is distributed WITHOUT ANY WARRANTY; without even\n"
"     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
"     PURPOSE.  See the above copyright notice for more information.\n"
"\n"
"=========================================================================*/\n"
"\n"
"// Fragment program part with ray cast and composite method with masks.\n"
"// Only regions in the mask texture contribute. Regions outside are as good\n"
"// as completely transparent.\n"
"\n"
"#version 110\n"
"\n"
"uniform sampler3D dataSetTexture;\n"
"uniform sampler3D maskTexture;\n"
"uniform sampler1D opacityTexture;\n"
"\n"
"uniform vec3 lowBounds;\n"
"uniform vec3 highBounds;\n"
"\n"
"// Entry position (global scope)\n"
"vec3 pos;\n"
"// Incremental vector in texture space (global scope)\n"
"vec3 rayDir;\n"
"\n"
"float tMax;\n"
"\n"
"// from cropping vs no cropping\n"
"vec4 initialColor();\n"
"\n"
"// from 1 vs 4 component shader.\n"
"float scalarFromValue(vec4 value);\n"
"vec4 colorFromValue(vec4 value);\n"
"\n"
"// from noshade vs shade.\n"
"void initShade();\n"
"vec4 shade(vec4 value);\n"
"\n"
"void trace(void)\n"
"{\n"
"  vec4 destColor=initialColor();\n"
"  float remainOpacity=1.0-destColor.a;\n"
"\n"
"  bool inside=true;\n"
"\n"
"  vec4 maskValue;\n"
"  vec4 color;\n"
"  vec4 opacity;\n"
"\n"
"  initShade();\n"
"\n"
"  float t=0.0;\n"
"\n"
"  // We NEED two nested while loops. It is trick to work around hardware\n"
"  // limitation about the maximum number of loops.\n"
"\n"
"  while(inside)\n"
"    {\n"
"    while(inside)\n"
"      {\n"
"      vec4 value=texture3D(dataSetTexture,pos);\n"
"      float scalar=scalarFromValue(value);\n"
"      opacity=texture1D(opacityTexture,scalar);\n"
"\n"
"      if(opacity.a>0.0)\n"
"        {\n"
"        // get the mask value at this same location\n"
"        maskValue=texture3D(maskTexture,pos);\n"
"        if(maskValue.a!=0.0)\n"
"          {\n"
"          color=shade(value);\n"
"          color=color*opacity.a;\n"
"          destColor=destColor+color*remainOpacity;\n"
"          remainOpacity=remainOpacity*(1.0-opacity.a);\n"
"          }\n"
"        }\n"
"\n"
"\n"
"      pos=pos+rayDir;\n"
"      t+=1.0;\n"
"      inside=t<tMax && all(greaterThanEqual(pos,lowBounds))\n"
"        && all(lessThanEqual(pos,highBounds))\n"
"        && (remainOpacity>=0.0039); // 1/255=0.0039\n"
"      }\n"
"    }\n"
"  gl_FragColor = destColor;\n"
"  gl_FragColor.a = 1.0-remainOpacity;\n"
"}\n"
"\n";

