00001 #include <vtkObject.h>
00002
00003
00004 #if ((VTK_MAJOR_VERSION > 5) || ((VTK_MAJOR_VERSION==5) && (VTK_MINOR_VERSION>=6) ))
00005
00006
00007
00008
00009
00010
00011
00012 const char *vtkMitkGPUVolumeRayCastMapper_CompositeCroppingFS =
00013 "/*=========================================================================\n"
00014 "\n"
00015 " Program: Visualization Toolkit\n"
00016 " Module: $RCSfile: vtkMitkGPUVolumeRayCastMapper_CompositeCroppingFS.glsl,v $\n"
00017 "\n"
00018 " Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n"
00019 " All rights reserved.\n"
00020 " See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n"
00021 "\n"
00022 " This software is distributed WITHOUT ANY WARRANTY; without even\n"
00023 " the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
00024 " PURPOSE. See the above copyright notice for more information.\n"
00025 "\n"
00026 "=========================================================================*/\n"
00027 "\n"
00028 "// Implementation of some function used by the composite method when cropping\n"
00029 "// is on.\n"
00030 "\n"
00031 "#version 110\n"
00032 "\n"
00033 "// color buffer as an input\n"
00034 "uniform sampler2D frameBufferTexture;\n"
00035 "// 2D Texture fragment coordinates [0,1] from fragment coordinates\n"
00036 "// the frame buffer texture has the size of the plain buffer but\n"
00037 "// we use a fraction of it. The texture coordinates is less than 1 if\n"
00038 "// the reduction factor is less than 1.\n"
00039 "vec2 fragTexCoord;\n"
00040 "\n"
00041 "vec4 initialColor()\n"
00042 "{\n"
00043 " return texture2D(frameBufferTexture,fragTexCoord);\n"
00044 "}\n"
00045 "\n";
00046
00047
00048
00049
00050
00051
00052
00053
00054 const char *vtkMitkGPUVolumeRayCastMapper_CompositeFS =
00055 "/*=========================================================================\n"
00056 "\n"
00057 " Program: Visualization Toolkit\n"
00058 " Module: $RCSfile: vtkMitkGPUVolumeRayCastMapper_CompositeFS.glsl,v $\n"
00059 "\n"
00060 " Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n"
00061 " All rights reserved.\n"
00062 " See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n"
00063 "\n"
00064 " This software is distributed WITHOUT ANY WARRANTY; without even\n"
00065 " the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
00066 " PURPOSE. See the above copyright notice for more information.\n"
00067 "\n"
00068 "=========================================================================*/\n"
00069 "\n"
00070 "// Fragment program part with ray cast and composite method.\n"
00071 "\n"
00072 "#version 110\n"
00073 "\n"
00074 "uniform sampler3D dataSetTexture;\n"
00075 "uniform sampler1D opacityTexture;\n"
00076 "\n"
00077 "uniform vec3 lowBounds;\n"
00078 "uniform vec3 highBounds;\n"
00079 "\n"
00080 "// Entry position (global scope)\n"
00081 "vec3 pos;\n"
00082 "// Incremental vector in texture space (global scope)\n"
00083 "vec3 rayDir;\n"
00084 "\n"
00085 "float tMax;\n"
00086 "\n"
00087 "// from cropping vs no cropping\n"
00088 "vec4 initialColor();\n"
00089 "\n"
00090 "// from 1 vs 4 component shader.\n"
00091 "float scalarFromValue(vec4 value);\n"
00092 "vec4 colorFromValue(vec4 value);\n"
00093 "\n"
00094 "// from noshade vs shade.\n"
00095 "void initShade();\n"
00096 "vec4 shade(vec4 value);\n"
00097 "\n"
00098 "void trace(void)\n"
00099 "{\n"
00100 " vec4 destColor=initialColor();\n"
00101 " float remainOpacity=1.0-destColor.a;\n"
00102 "\n"
00103 " bool inside=true;\n"
00104 " \n"
00105 " vec4 color;\n"
00106 " vec4 opacity;\n"
00107 "\n"
00108 " initShade();\n"
00109 " \n"
00110 " float t=0.0;\n"
00111 " \n"
00112 " // We NEED two nested while loops. It is trick to work around hardware\n"
00113 " // limitation about the maximum number of loops.\n"
00114 "\n"
00115 " while(inside)\n"
00116 " { \n"
00117 " while(inside)\n"
00118 " {\n"
00119 " vec4 value=texture3D(dataSetTexture,pos);\n"
00120 " float scalar=scalarFromValue(value);\n"
00121 " // opacity is the sampled texture value in the 1D opacity texture at\n"
00122 " // scalarValue\n"
00123 " opacity=texture1D(opacityTexture,scalar);\n"
00124 " if(opacity.a>0.0)\n"
00125 " {\n"
00126 " color=shade(value);\n"
00127 " color=color*opacity.a;\n"
00128 " destColor=destColor+color*remainOpacity;\n"
00129 " remainOpacity=remainOpacity*(1.0-opacity.a);\n"
00130 " }\n"
00131 " pos=pos+rayDir;\n"
00132 " t+=1.0;\n"
00133 " inside=t<tMax && all(greaterThanEqual(pos,lowBounds))\n"
00134 " && all(lessThanEqual(pos,highBounds))\n"
00135 " && (remainOpacity>=0.0039); // 1/255=0.0039\n"
00136 " }\n"
00137 " }\n"
00138 " gl_FragColor = destColor;\n"
00139 " gl_FragColor.a = 1.0-remainOpacity;\n"
00140 "}\n"
00141 "\n";
00142
00143
00144
00145
00146
00147
00148
00149
00150 const char *vtkMitkGPUVolumeRayCastMapper_CompositeMaskFS =
00151 "/*=========================================================================\n"
00152 "\n"
00153 " Program: Visualization Toolkit\n"
00154 " Module: $RCSfile: vtkMitkGPUVolumeRayCastMapper_CompositeMaskFS.glsl,v $\n"
00155 "\n"
00156 " Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n"
00157 " All rights reserved.\n"
00158 " See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n"
00159 "\n"
00160 " This software is distributed WITHOUT ANY WARRANTY; without even\n"
00161 " the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
00162 " PURPOSE. See the above copyright notice for more information.\n"
00163 "\n"
00164 "=========================================================================*/\n"
00165 "\n"
00166 "// Fragment program part with ray cast and composite method with masks.\n"
00167 "\n"
00168 "#version 110\n"
00169 "\n"
00170 "uniform sampler3D dataSetTexture;\n"
00171 "uniform sampler3D maskTexture;\n"
00172 "uniform sampler1D mask1ColorTexture;\n"
00173 "uniform sampler1D mask2ColorTexture;\n"
00174 "uniform sampler1D opacityTexture;\n"
00175 "\n"
00176 "uniform vec3 lowBounds;\n"
00177 "uniform vec3 highBounds;\n"
00178 "\n"
00179 "uniform float maskBlendFactor;\n"
00180 "\n"
00181 "// Entry position (global scope)\n"
00182 "vec3 pos;\n"
00183 "// Incremental vector in texture space (global scope)\n"
00184 "vec3 rayDir;\n"
00185 "\n"
00186 "float tMax;\n"
00187 "\n"
00188 "// from cropping vs no cropping\n"
00189 "vec4 initialColor();\n"
00190 "\n"
00191 "// from 1 vs 4 component shader.\n"
00192 "float scalarFromValue(vec4 value);\n"
00193 "vec4 colorFromValue(vec4 value);\n"
00194 "\n"
00195 "// from noshade vs shade.\n"
00196 "void initShade();\n"
00197 "vec4 shade(vec4 value);\n"
00198 "\n"
00199 "void trace(void)\n"
00200 "{\n"
00201 " vec4 destColor=initialColor();\n"
00202 " float remainOpacity=1.0-destColor.a;\n"
00203 "\n"
00204 " bool inside=true;\n"
00205 " \n"
00206 " vec4 maskValue;\n"
00207 " vec4 color;\n"
00208 " vec4 opacity;\n"
00209 "\n"
00210 " initShade();\n"
00211 " \n"
00212 " float t=0.0;\n"
00213 " \n"
00214 " // We NEED two nested while loops. It is trick to work around hardware\n"
00215 " // limitation about the maximum number of loops.\n"
00216 "\n"
00217 " while(inside)\n"
00218 " { \n"
00219 " while(inside)\n"
00220 " {\n"
00221 " vec4 value=texture3D(dataSetTexture,pos);\n"
00222 " float scalar=scalarFromValue(value);\n"
00223 " opacity=texture1D(opacityTexture,scalar);\n"
00224 " \n"
00225 " if(maskBlendFactor==0.0)\n"
00226 " {\n"
00227 " color=shade(value);\n"
00228 " }\n"
00229 " else\n"
00230 " {\n"
00231 " // get the mask value at this same location\n"
00232 " maskValue=texture3D(maskTexture,pos);\n"
00233 " if(maskValue.a==0.0)\n"
00234 " {\n"
00235 " color=shade(value);\n"
00236 " }\n"
00237 " else\n"
00238 " {\n"
00239 " if(maskValue.a==1.0/255.0)\n"
00240 " {\n"
00241 " color=texture1D(mask1ColorTexture,scalar);\n"
00242 " }\n"
00243 " else\n"
00244 " {\n"
00245 " // maskValue.a == 2.0/255.0\n"
00246 " color=texture1D(mask2ColorTexture,scalar);\n"
00247 " }\n"
00248 " color.a=1.0;\n"
00249 " if(maskBlendFactor<1.0)\n"
00250 " {\n"
00251 " color=(1.0-maskBlendFactor)*shade(value)+maskBlendFactor*color;\n"
00252 " }\n"
00253 "// color.r = 1;\n"
00254 "// color.g = 0;\n"
00255 "// color.b = 0;\n"
00256 "// color.a = 1;\n"
00257 " }\n"
00258 " }\n"
00259 " \n"
00260 " color=color*opacity.a;\n"
00261 " destColor=destColor+color*remainOpacity;\n"
00262 " remainOpacity=remainOpacity*(1.0-opacity.a);\n"
00263 " \n"
00264 " pos=pos+rayDir;\n"
00265 " t+=1.0;\n"
00266 " inside=t<tMax && all(greaterThanEqual(pos,lowBounds))\n"
00267 " && all(lessThanEqual(pos,highBounds))\n"
00268 " && (remainOpacity>=0.0039); // 1/255=0.0039\n"
00269 " }\n"
00270 " }\n"
00271 " gl_FragColor = destColor;\n"
00272 " gl_FragColor.a = 1.0-remainOpacity;\n"
00273 "}\n"
00274 "\n";
00275
00276
00277
00278
00279
00280
00281
00282
00283 const char *vtkMitkGPUVolumeRayCastMapper_CompositeNoCroppingFS =
00284 "/*=========================================================================\n"
00285 "\n"
00286 " Program: Visualization Toolkit\n"
00287 " Module: $RCSfile: vtkMitkGPUVolumeRayCastMapper_CompositeNoCroppingFS.glsl,v $\n"
00288 "\n"
00289 " Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n"
00290 " All rights reserved.\n"
00291 " See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n"
00292 "\n"
00293 " This software is distributed WITHOUT ANY WARRANTY; without even\n"
00294 " the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
00295 " PURPOSE. See the above copyright notice for more information.\n"
00296 "\n"
00297 "=========================================================================*/\n"
00298 "\n"
00299 "// Implementation of some function used by the composite method when cropping\n"
00300 "// is off.\n"
00301 "\n"
00302 "#version 110\n"
00303 "\n"
00304 "// Max intensity is the lowest value.\n"
00305 "vec4 initialColor()\n"
00306 "{\n"
00307 " return vec4(0.0,0.0,0.0,0.0);\n"
00308 "}\n"
00309 "\n";
00310
00311
00312
00313
00314
00315
00316
00317
00318 const char *vtkMitkGPUVolumeRayCastMapper_MinIPCroppingFS =
00319 "/*=========================================================================\n"
00320 "\n"
00321 " Program: Visualization Toolkit\n"
00322 " Module: $RCSfile: vtkMitkGPUVolumeRayCastMapper_MinIPCroppingFS.glsl,v $\n"
00323 "\n"
00324 " Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n"
00325 " All rights reserved.\n"
00326 " See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n"
00327 "\n"
00328 " This software is distributed WITHOUT ANY WARRANTY; without even\n"
00329 " the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
00330 " PURPOSE. See the above copyright notice for more information.\n"
00331 "\n"
00332 "=========================================================================*/\n"
00333 "\n"
00334 "// Implementation of some functions used by the Minimum Intensity Projection\n"
00335 "// (MinIP) method when cropping is on.\n"
00336 "\n"
00337 "#version 110\n"
00338 "\n"
00339 "// GLSL Spec 1.10 rev 59 30-April-2004 defines gl_FragData[] but implementation\n"
00340 "// older than the spec only has it as an extension\n"
00341 "// (nVidia Linux driver 100.14.13, OpenGL version 2.1.1,\n"
00342 "// on Quadro FX 3500/PCI/SSE2)\n"
00343 "#extension GL_ARB_draw_buffers : enable\n"
00344 "\n"
00345 "// max scalar buffer as an input\n"
00346 "uniform sampler2D scalarBufferTexture;\n"
00347 "// 2D Texture fragment coordinates [0,1] from fragment coordinates\n"
00348 "// the scalar frame buffer texture has the size of the plain buffer but\n"
00349 "// we use a fraction of it. The texture coordinates is less than 1 if\n"
00350 "// the reduction factor is less than 1.\n"
00351 "vec2 fragTexCoord;\n"
00352 "\n"
00353 "float initialMinValue()\n"
00354 "{\n"
00355 " return texture2D(scalarBufferTexture,fragTexCoord).r;\n"
00356 "}\n"
00357 "\n"
00358 "void writeColorAndMinScalar(vec4 sample,\n"
00359 " vec4 opacity,\n"
00360 " float minValue)\n"
00361 "{\n"
00362 " // color framebuffer\n"
00363 " gl_FragData[0].r =sample.r * opacity.a;\n"
00364 " gl_FragData[0].g =sample.g * opacity.a;\n"
00365 " gl_FragData[0].b =sample.b * opacity.a;\n"
00366 " gl_FragData[0].a=opacity.a;\n"
00367 " \n"
00368 " // min scalar framebuffer\n"
00369 " gl_FragData[1].r=minValue;\n"
00370 " gl_FragData[1].g=0.0;\n"
00371 " gl_FragData[1].b=0.0;\n"
00372 " gl_FragData[1].a=0.0;\n"
00373 "}\n"
00374 "\n";
00375
00376
00377
00378
00379
00380
00381
00382
00383 const char *vtkMitkGPUVolumeRayCastMapper_MinIPFourDependentCroppingFS =
00384 "/*=========================================================================\n"
00385 "\n"
00386 " Program: Visualization Toolkit\n"
00387 " Module: $RCSfile: vtkMitkGPUVolumeRayCastMapper_MinIPFourDependentCroppingFS.glsl,v $\n"
00388 "\n"
00389 " Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n"
00390 " All rights reserved.\n"
00391 " See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n"
00392 "\n"
00393 " This software is distributed WITHOUT ANY WARRANTY; without even\n"
00394 " the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
00395 " PURPOSE. See the above copyright notice for more information.\n"
00396 "\n"
00397 "=========================================================================*/\n"
00398 "\n"
00399 "// Implementation of some functions used by the 4-component Minimum Intensity\n"
00400 "// Projection (MinIP) method when cropping is on.\n"
00401 "\n"
00402 "#version 110\n"
00403 "\n"
00404 "// GLSL Spec 1.10 rev 59 30-April-2004 defines gl_FragData[] but implementation\n"
00405 "// older than the spec only has it as an extension\n"
00406 "// (nVidia Linux driver 100.14.13, OpenGL version 2.1.1,\n"
00407 "// on Quadro FX 3500/PCI/SSE2)\n"
00408 "#extension GL_ARB_draw_buffers : enable\n"
00409 "\n"
00410 "// max scalar buffer as an input\n"
00411 "uniform sampler2D scalarBufferTexture;\n"
00412 "\n"
00413 "// color buffer as an input\n"
00414 "uniform sampler2D frameBufferTexture;\n"
00415 "\n"
00416 "// 2D Texture fragment coordinates [0,1] from fragment coordinates\n"
00417 "// the scalar frame buffer texture has the size of the plain buffer but\n"
00418 "// we use a fraction of it. The texture coordinates is less than 1 if\n"
00419 "// the reduction factor is less than 1.\n"
00420 "vec2 fragTexCoord;\n"
00421 "\n"
00422 "float initialMinValue()\n"
00423 "{\n"
00424 " return texture2D(scalarBufferTexture,fragTexCoord).r;\n"
00425 "}\n"
00426 "\n"
00427 "vec4 initialColor()\n"
00428 "{\n"
00429 " return texture2D(frameBufferTexture,fragTexCoord);\n"
00430 "}\n"
00431 "\n"
00432 "void writeColorAndMinScalar(vec4 color,\n"
00433 " vec4 opacity,\n"
00434 " float minValue)\n"
00435 "{\n"
00436 " // color framebuffer\n"
00437 " gl_FragData[0].r = color.r*opacity.a;\n"
00438 " gl_FragData[0].g = color.g*opacity.a;\n"
00439 " gl_FragData[0].b = color.b*opacity.a;\n"
00440 " gl_FragData[0].a=opacity.a;\n"
00441 " \n"
00442 " // min scalar framebuffer\n"
00443 " gl_FragData[1].r=minValue;\n"
00444 " gl_FragData[1].g=0.0;\n"
00445 " gl_FragData[1].b=0.0;\n"
00446 " gl_FragData[1].a=0.0;\n"
00447 "}\n"
00448 "\n";
00449
00450
00451
00452
00453
00454
00455
00456
00457 const char *vtkMitkGPUVolumeRayCastMapper_MinIPFourDependentFS =
00458 "/*=========================================================================\n"
00459 "\n"
00460 " Program: Visualization Toolkit\n"
00461 " Module: $RCSfile: vtkMitkGPUVolumeRayCastMapper_MinIPFourDependentFS.glsl,v $\n"
00462 "\n"
00463 " Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n"
00464 " All rights reserved.\n"
00465 " See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n"
00466 "\n"
00467 " This software is distributed WITHOUT ANY WARRANTY; without even\n"
00468 " the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
00469 " PURPOSE. See the above copyright notice for more information.\n"
00470 "\n"
00471 "=========================================================================*/\n"
00472 "\n"
00473 "// Fragment program with ray cast and 4-dependent-component Minimum Intensity\n"
00474 "// Projection (MinIP) method.\n"
00475 "// Compilation: header part and the projection part are inserted first.\n"
00476 "// pos is defined and initialized in header\n"
00477 "// rayDir is defined in header and initialized in the projection part\n"
00478 "\n"
00479 "#version 110\n"
00480 "\n"
00481 "uniform sampler3D dataSetTexture;\n"
00482 "uniform sampler1D opacityTexture;\n"
00483 "\n"
00484 "uniform vec3 lowBounds;\n"
00485 "uniform vec3 highBounds;\n"
00486 "\n"
00487 "// Entry position (global scope)\n"
00488 "vec3 pos;\n"
00489 "// Incremental vector in texture space (global scope)\n"
00490 "vec3 rayDir;\n"
00491 "\n"
00492 "float tMax;\n"
00493 "\n"
00494 "// Sub-functions, depending on cropping mode\n"
00495 "float initialMinValue();\n"
00496 "vec4 initialColor();\n"
00497 "void writeColorAndMinScalar(vec4 color,\n"
00498 " vec4 opacity,\n"
00499 " float minValue);\n"
00500 "\n"
00501 "void trace(void)\n"
00502 "{\n"
00503 " // Max intensity is the lowest value.\n"
00504 " float minValue=initialMinValue();\n"
00505 " vec4 color=initialColor();\n"
00506 " bool inside=true;\n"
00507 " float t=0.0;\n"
00508 " vec4 sample;\n"
00509 " bool changed=false;\n"
00510 " \n"
00511 " // We NEED two nested while loops. It is a trick to work around hardware\n"
00512 " // limitation about the maximum number of loops.\n"
00513 " while(inside)\n"
00514 " {\n"
00515 " while(inside)\n"
00516 " {\n"
00517 " sample=texture3D(dataSetTexture,pos);\n"
00518 " if(sample.w<minValue)\n"
00519 " {\n"
00520 " changed=true;\n"
00521 " minValue=sample.w;\n"
00522 " color=sample;\n"
00523 " }\n"
00524 " pos=pos+rayDir;\n"
00525 " t+=1.0;\n"
00526 " \n"
00527 " // yes, t<tMax && all(greaterThanEqual(pos,lowBounds))\n"
00528 " // && all(lessThanEqual(pos,highBounds));\n"
00529 " // looks better but the latest nVidia 177.80 has a bug...\n"
00530 " inside=t<tMax && pos.x>=lowBounds.x && pos.y>=lowBounds.y\n"
00531 " && pos.z>=lowBounds.z && pos.x<=highBounds.x && pos.y<=highBounds.y\n"
00532 " && pos.z<=highBounds.z;\n"
00533 " }\n"
00534 " }\n"
00535 " \n"
00536 " if(changed)\n"
00537 " {\n"
00538 " vec4 opacity=texture1D(opacityTexture,minValue);\n"
00539 " writeColorAndMinScalar(color,opacity,minValue);\n"
00540 " }\n"
00541 " else\n"
00542 " {\n"
00543 " discard;\n"
00544 " }\n"
00545 "}\n"
00546 "\n";
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556 const char *vtkMitkGPUVolumeRayCastMapper_MinIPFourDependentNoCroppingFS =
00557 "/*=========================================================================\n"
00558 "\n"
00559 " Program: Visualization Toolkit\n"
00560 " Module: $RCSfile: vtkMitkGPUVolumeRayCastMapper_MinIPFourDependentNoCroppingFS.glsl,v $\n"
00561 "\n"
00562 " Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n"
00563 " All rights reserved.\n"
00564 " See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n"
00565 "\n"
00566 " This software is distributed WITHOUT ANY WARRANTY; without even\n"
00567 " the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
00568 " PURPOSE. See the above copyright notice for more information.\n"
00569 "\n"
00570 "=========================================================================*/\n"
00571 "\n"
00572 "// Implementation of some functions used by the 4-component Minimum Intensity\n"
00573 "// Projection (MinIP) method when cropping is off.\n"
00574 "\n"
00575 "#version 110\n"
00576 "\n"
00577 "float initialMinValue()\n"
00578 "{\n"
00579 " return 1.0;\n"
00580 "}\n"
00581 "\n"
00582 "vec4 initialColor()\n"
00583 "{\n"
00584 " return vec4(0.0,0.0,0.0,0.0);\n"
00585 "}\n"
00586 "\n"
00587 "void writeColorAndMinScalar(vec4 color,\n"
00588 " vec4 opacity,\n"
00589 " float minValue)\n"
00590 "{\n"
00591 " // minValue is not used\n"
00592 " \n"
00593 " // color framebuffer\n"
00594 " gl_FragColor.r = color.r*opacity.a;\n"
00595 " gl_FragColor.g = color.g*opacity.a;\n"
00596 " gl_FragColor.b = color.b*opacity.a;\n"
00597 " gl_FragColor.a=opacity.a;\n"
00598 "}\n"
00599 "\n";
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609 const char *vtkMitkGPUVolumeRayCastMapper_MinIPFS =
00610 "/*=========================================================================\n"
00611 "\n"
00612 " Program: Visualization Toolkit\n"
00613 " Module: $RCSfile: vtkMitkGPUVolumeRayCastMapper_MinIPFS.glsl,v $\n"
00614 "\n"
00615 " Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n"
00616 " All rights reserved.\n"
00617 " See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n"
00618 "\n"
00619 " This software is distributed WITHOUT ANY WARRANTY; without even\n"
00620 " the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
00621 " PURPOSE. See the above copyright notice for more information.\n"
00622 "\n"
00623 "=========================================================================*/\n"
00624 "\n"
00625 "// Fragment program with ray cast and Minimum Intensity Projection (MinIP)\n"
00626 "// method.\n"
00627 "// Compilation: header part and the projection part are inserted first.\n"
00628 "// pos is defined and initialized in header\n"
00629 "// rayDir is defined in header and initialized in the projection part\n"
00630 "// initMinValue() and writeColorAndMinScalar are defined in some specific\n"
00631 "// file depending on cropping flag being on or off.\n"
00632 "\n"
00633 "#version 110\n"
00634 "\n"
00635 "uniform sampler3D dataSetTexture;\n"
00636 "uniform sampler1D colorTexture;\n"
00637 "uniform sampler1D opacityTexture;\n"
00638 "\n"
00639 "uniform vec3 lowBounds;\n"
00640 "uniform vec3 highBounds;\n"
00641 "\n"
00642 "// Entry position (global scope)\n"
00643 "vec3 pos;\n"
00644 "// Incremental vector in texture space (global scope)\n"
00645 "vec3 rayDir;\n"
00646 "\n"
00647 "float tMax;\n"
00648 "\n"
00649 "// Sub-functions, depending on cropping mode\n"
00650 "float initialMinValue();\n"
00651 "void writeColorAndMinScalar(vec4 sample,\n"
00652 " vec4 opacity,\n"
00653 " float minValue);\n"
00654 "\n"
00655 "void trace(void)\n"
00656 "{\n"
00657 " // Max intensity is the lowest value.\n"
00658 " float minValue=initialMinValue();\n"
00659 " bool inside=true;\n"
00660 " vec4 sample;\n"
00661 " \n"
00662 " float t=0.0;\n"
00663 " // We NEED two nested while loops. It is trick to work around hardware\n"
00664 " // limitation about the maximum number of loops.\n"
00665 " while(inside)\n"
00666 " {\n"
00667 " while(inside)\n"
00668 " {\n"
00669 " sample=texture3D(dataSetTexture,pos);\n"
00670 " minValue=min(minValue,sample.r);\n"
00671 " pos=pos+rayDir;\n"
00672 " t+=1.0;\n"
00673 " inside=t<tMax && all(greaterThanEqual(pos,lowBounds))\n"
00674 " && all(lessThanEqual(pos,highBounds));\n"
00675 " \n"
00676 " // yes, t<tMax && all(greaterThanEqual(pos,lowBounds))\n"
00677 " // && all(lessThanEqual(pos,highBounds));\n"
00678 " // looks better but the latest nVidia 177.80 has a bug...\n"
00679 " inside=t<tMax && pos.x>=lowBounds.x && pos.y>=lowBounds.y\n"
00680 " && pos.z>=lowBounds.z && pos.x<=highBounds.x && pos.y<=highBounds.y\n"
00681 " && pos.z<=highBounds.z;\n"
00682 " \n"
00683 " \n"
00684 " }\n"
00685 " }\n"
00686 "\n"
00687 " sample=texture1D(colorTexture,minValue);\n"
00688 " vec4 opacity=texture1D(opacityTexture,minValue);\n"
00689 " \n"
00690 " writeColorAndMinScalar(sample,opacity,minValue);\n"
00691 "}\n"
00692 "\n";
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702 const char *vtkMitkGPUVolumeRayCastMapper_MinIPNoCroppingFS =
00703 "/*=========================================================================\n"
00704 "\n"
00705 " Program: Visualization Toolkit\n"
00706 " Module: $RCSfile: vtkMitkGPUVolumeRayCastMapper_MinIPNoCroppingFS.glsl,v $\n"
00707 "\n"
00708 " Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n"
00709 " All rights reserved.\n"
00710 " See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n"
00711 "\n"
00712 " This software is distributed WITHOUT ANY WARRANTY; without even\n"
00713 " the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
00714 " PURPOSE. See the above copyright notice for more information.\n"
00715 "\n"
00716 "=========================================================================*/\n"
00717 "\n"
00718 "// Implementation of some functions used by the Minimum Intensity projection\n"
00719 "// (MinIP) method when cropping is off.\n"
00720 "\n"
00721 "#version 110\n"
00722 "\n"
00723 "float initialMinValue()\n"
00724 "{\n"
00725 " return 1.0;\n"
00726 "}\n"
00727 "\n"
00728 "void writeColorAndMinScalar(vec4 sample,\n"
00729 " vec4 opacity,\n"
00730 " float minValue)\n"
00731 "{\n"
00732 " // we don't need to write minValue to a buffer when there is no cropping.\n"
00733 " // color framebuffer\n"
00734 " gl_FragColor.r =sample.r * opacity.a;\n"
00735 " gl_FragColor.g =sample.g * opacity.a;\n"
00736 " gl_FragColor.b =sample.b * opacity.a;\n"
00737 " gl_FragColor.a=opacity.a;\n"
00738 "}\n"
00739 "\n";
00740
00741
00742
00743
00744
00745
00746
00747
00748 const char *vtkMitkGPUVolumeRayCastMapper_MIPCroppingFS =
00749 "/*=========================================================================\n"
00750 "\n"
00751 " Program: Visualization Toolkit\n"
00752 " Module: $RCSfile: vtkMitkGPUVolumeRayCastMapper_MIPCroppingFS.glsl,v $\n"
00753 "\n"
00754 " Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n"
00755 " All rights reserved.\n"
00756 " See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n"
00757 "\n"
00758 " This software is distributed WITHOUT ANY WARRANTY; without even\n"
00759 " the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
00760 " PURPOSE. See the above copyright notice for more information.\n"
00761 "\n"
00762 "=========================================================================*/\n"
00763 "\n"
00764 "// Implementation of some functions used by the Maximum Intensity Projection\n"
00765 "// (MIP) method when cropping is on.\n"
00766 "\n"
00767 "#version 110\n"
00768 "\n"
00769 "// GLSL Spec 1.10 rev 59 30-April-2004 defines gl_FragData[] but implementation\n"
00770 "// older than the spec only has it as an extension\n"
00771 "// (nVidia Linux driver 100.14.13, OpenGL version 2.1.1,\n"
00772 "// on Quadro FX 3500/PCI/SSE2)\n"
00773 "#extension GL_ARB_draw_buffers : enable\n"
00774 "\n"
00775 "// max scalar buffer as an input\n"
00776 "uniform sampler2D scalarBufferTexture;\n"
00777 "// 2D Texture fragment coordinates [0,1] from fragment coordinates\n"
00778 "// the scalar frame buffer texture has the size of the plain buffer but\n"
00779 "// we use a fraction of it. The texture coordinates is less than 1 if\n"
00780 "// the reduction factor is less than 1.\n"
00781 "vec2 fragTexCoord;\n"
00782 "\n"
00783 "float initialMaxValue()\n"
00784 "{\n"
00785 " return texture2D(scalarBufferTexture,fragTexCoord).r;\n"
00786 "}\n"
00787 "\n"
00788 "void writeColorAndMaxScalar(vec4 sample,\n"
00789 " vec4 opacity,\n"
00790 " float maxValue)\n"
00791 "{\n"
00792 " // color framebuffer\n"
00793 " gl_FragData[0].r =sample.r * opacity.a;\n"
00794 " gl_FragData[0].g =sample.g * opacity.a;\n"
00795 " gl_FragData[0].b =sample.b * opacity.a;\n"
00796 " gl_FragData[0].a=opacity.a;\n"
00797 " \n"
00798 " // max scalar framebuffer\n"
00799 " gl_FragData[1].r=maxValue;\n"
00800 " gl_FragData[1].g=0.0;\n"
00801 " gl_FragData[1].b=0.0;\n"
00802 " gl_FragData[1].a=0.0;\n"
00803 "}\n"
00804 "\n";
00805
00806
00807
00808
00809
00810
00811
00812
00813 const char *vtkMitkGPUVolumeRayCastMapper_MIPFourDependentCroppingFS =
00814 "/*=========================================================================\n"
00815 "\n"
00816 " Program: Visualization Toolkit\n"
00817 " Module: $RCSfile: vtkMitkGPUVolumeRayCastMapper_MIPFourDependentCroppingFS.glsl,v $\n"
00818 "\n"
00819 " Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n"
00820 " All rights reserved.\n"
00821 " See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n"
00822 "\n"
00823 " This software is distributed WITHOUT ANY WARRANTY; without even\n"
00824 " the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
00825 " PURPOSE. See the above copyright notice for more information.\n"
00826 "\n"
00827 "=========================================================================*/\n"
00828 "\n"
00829 "// Implementation of some functions used by the 4-component Maximum Intensity\n"
00830 "// Projection (MIP) method when cropping is on.\n"
00831 "\n"
00832 "#version 110\n"
00833 "\n"
00834 "// GLSL Spec 1.10 rev 59 30-April-2004 defines gl_FragData[] but implementation\n"
00835 "// older than the spec only has it as an extension\n"
00836 "// (nVidia Linux driver 100.14.13, OpenGL version 2.1.1,\n"
00837 "// on Quadro FX 3500/PCI/SSE2)\n"
00838 "#extension GL_ARB_draw_buffers : enable\n"
00839 "\n"
00840 "// max scalar buffer as an input\n"
00841 "uniform sampler2D scalarBufferTexture;\n"
00842 "\n"
00843 "// color buffer as an input\n"
00844 "uniform sampler2D frameBufferTexture;\n"
00845 "\n"
00846 "// 2D Texture fragment coordinates [0,1] from fragment coordinates\n"
00847 "// the scalar frame buffer texture has the size of the plain buffer but\n"
00848 "// we use a fraction of it. The texture coordinates is less than 1 if\n"
00849 "// the reduction factor is less than 1.\n"
00850 "vec2 fragTexCoord;\n"
00851 "\n"
00852 "float initialMaxValue()\n"
00853 "{\n"
00854 " return texture2D(scalarBufferTexture,fragTexCoord).r;\n"
00855 "}\n"
00856 "\n"
00857 "vec4 initialColor()\n"
00858 "{\n"
00859 " return texture2D(frameBufferTexture,fragTexCoord);\n"
00860 "}\n"
00861 "\n"
00862 "void writeColorAndMaxScalar(vec4 color,\n"
00863 " vec4 opacity,\n"
00864 " float maxValue)\n"
00865 "{\n"
00866 " // color framebuffer\n"
00867 " gl_FragData[0].r = color.r*opacity.a;\n"
00868 " gl_FragData[0].g = color.g*opacity.a;\n"
00869 " gl_FragData[0].b = color.b*opacity.a;\n"
00870 " gl_FragData[0].a=opacity.a;\n"
00871 " \n"
00872 " // max scalar framebuffer\n"
00873 " gl_FragData[1].r=maxValue;\n"
00874 " gl_FragData[1].g=0.0;\n"
00875 " gl_FragData[1].b=0.0;\n"
00876 " gl_FragData[1].a=0.0;\n"
00877 "}\n"
00878 "\n";
00879
00880
00881
00882
00883
00884
00885
00886
00887 const char *vtkMitkGPUVolumeRayCastMapper_MIPFourDependentFS =
00888 "/*=========================================================================\n"
00889 "\n"
00890 " Program: Visualization Toolkit\n"
00891 " Module: $RCSfile: vtkMitkGPUVolumeRayCastMapper_MIPFourDependentFS.glsl,v $\n"
00892 "\n"
00893 " Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n"
00894 " All rights reserved.\n"
00895 " See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n"
00896 "\n"
00897 " This software is distributed WITHOUT ANY WARRANTY; without even\n"
00898 " the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
00899 " PURPOSE. See the above copyright notice for more information.\n"
00900 "\n"
00901 "=========================================================================*/\n"
00902 "\n"
00903 "// Fragment program with ray cast and 4-dependent-component Maximum Intensity\n"
00904 "// Projection (MIP) method.\n"
00905 "// Compilation: header part and the projection part are inserted first.\n"
00906 "// pos is defined and initialized in header\n"
00907 "// rayDir is defined in header and initialized in the projection part\n"
00908 "\n"
00909 "#version 110\n"
00910 "\n"
00911 "uniform sampler3D dataSetTexture;\n"
00912 "uniform sampler1D opacityTexture;\n"
00913 "\n"
00914 "uniform vec3 lowBounds;\n"
00915 "uniform vec3 highBounds;\n"
00916 "\n"
00917 "// Entry position (global scope)\n"
00918 "vec3 pos;\n"
00919 "// Incremental vector in texture space (global scope)\n"
00920 "vec3 rayDir;\n"
00921 "\n"
00922 "float tMax;\n"
00923 "\n"
00924 "// Sub-functions, depending on cropping mode\n"
00925 "float initialMaxValue();\n"
00926 "vec4 initialColor();\n"
00927 "void writeColorAndMaxScalar(vec4 color,\n"
00928 " vec4 opacity,\n"
00929 " float maxValue);\n"
00930 "\n"
00931 "void trace(void)\n"
00932 "{\n"
00933 " // Max intensity is the lowest value.\n"
00934 " float maxValue=initialMaxValue();\n"
00935 " vec4 color=initialColor();\n"
00936 " bool inside=true;\n"
00937 " float t=0.0;\n"
00938 " vec4 sample;\n"
00939 " bool changed=false;\n"
00940 " \n"
00941 " // We NEED two nested while loops. It is a trick to work around hardware\n"
00942 " // limitation about the maximum number of loops.\n"
00943 " while(inside)\n"
00944 " {\n"
00945 " while(inside)\n"
00946 " {\n"
00947 " sample=texture3D(dataSetTexture,pos);\n"
00948 " if(sample.w>maxValue)\n"
00949 " {\n"
00950 " changed=true;\n"
00951 " maxValue=sample.w;\n"
00952 " color=sample;\n"
00953 " }\n"
00954 " pos=pos+rayDir;\n"
00955 " t+=1.0;\n"
00956 " \n"
00957 " // yes, t<tMax && all(greaterThanEqual(pos,lowBounds))\n"
00958 " // && all(lessThanEqual(pos,highBounds));\n"
00959 " // looks better but the latest nVidia 177.80 has a bug...\n"
00960 " inside=t<tMax && pos.x>=lowBounds.x && pos.y>=lowBounds.y\n"
00961 " && pos.z>=lowBounds.z && pos.x<=highBounds.x && pos.y<=highBounds.y\n"
00962 " && pos.z<=highBounds.z;\n"
00963 " }\n"
00964 " }\n"
00965 " \n"
00966 " if(changed)\n"
00967 " {\n"
00968 " vec4 opacity=texture1D(opacityTexture,maxValue);\n"
00969 " writeColorAndMaxScalar(color,opacity,maxValue);\n"
00970 " }\n"
00971 " else\n"
00972 " {\n"
00973 " discard;\n"
00974 " }\n"
00975 "}\n"
00976 "\n";
00977
00978
00979
00980
00981
00982
00983
00984
00985 const char *vtkMitkGPUVolumeRayCastMapper_MIPFourDependentNoCroppingFS =
00986 "/*=========================================================================\n"
00987 "\n"
00988 " Program: Visualization Toolkit\n"
00989 " Module: $RCSfile: vtkMitkGPUVolumeRayCastMapper_MIPFourDependentNoCroppingFS.glsl,v $\n"
00990 "\n"
00991 " Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n"
00992 " All rights reserved.\n"
00993 " See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n"
00994 "\n"
00995 " This software is distributed WITHOUT ANY WARRANTY; without even\n"
00996 " the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
00997 " PURPOSE. See the above copyright notice for more information.\n"
00998 "\n"
00999 "=========================================================================*/\n"
01000 "\n"
01001 "// Implementation of some functions used by the 4-component Maximum Intensity\n"
01002 "// Projection (MIP) method when cropping is off.\n"
01003 "\n"
01004 "#version 110\n"
01005 "\n"
01006 "float initialMaxValue()\n"
01007 "{\n"
01008 " return 0.0;\n"
01009 "}\n"
01010 "\n"
01011 "vec4 initialColor()\n"
01012 "{\n"
01013 " return vec4(0.0,0.0,0.0,0.0);\n"
01014 "}\n"
01015 "\n"
01016 "void writeColorAndMaxScalar(vec4 color,\n"
01017 " vec4 opacity,\n"
01018 " float maxValue)\n"
01019 "{\n"
01020 " // maxValue is not used\n"
01021 " \n"
01022 " // color framebuffer\n"
01023 " gl_FragColor.r = color.r*opacity.a;\n"
01024 " gl_FragColor.g = color.g*opacity.a;\n"
01025 " gl_FragColor.b = color.b*opacity.a;\n"
01026 " gl_FragColor.a=opacity.a;\n"
01027 "}\n"
01028 "\n";
01029
01030
01031
01032
01033
01034
01035
01036
01037 const char *vtkMitkGPUVolumeRayCastMapper_MIPFS =
01038 "/*=========================================================================\n"
01039 "\n"
01040 " Program: Visualization Toolkit\n"
01041 " Module: $RCSfile: vtkMitkGPUVolumeRayCastMapper_MIPFS.glsl,v $\n"
01042 "\n"
01043 " Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n"
01044 " All rights reserved.\n"
01045 " See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n"
01046 "\n"
01047 " This software is distributed WITHOUT ANY WARRANTY; without even\n"
01048 " the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
01049 " PURPOSE. See the above copyright notice for more information.\n"
01050 "\n"
01051 "=========================================================================*/\n"
01052 "\n"
01053 "// Fragment program with ray cast and Maximum Intensity Projection (MIP)\n"
01054 "// method.\n"
01055 "// Compilation: header part and the projection part are inserted first.\n"
01056 "// pos is defined and initialized in header\n"
01057 "// rayDir is defined in header and initialized in the projection part\n"
01058 "// initMaxValue() and writeColorAndMaxScalar are defined in some specific\n"
01059 "// file depending on cropping flag being on or off.\n"
01060 "\n"
01061 "#version 110\n"
01062 "\n"
01063 "uniform sampler3D dataSetTexture;\n"
01064 "uniform sampler1D colorTexture;\n"
01065 "uniform sampler1D opacityTexture;\n"
01066 "\n"
01067 "uniform vec3 lowBounds;\n"
01068 "uniform vec3 highBounds;\n"
01069 "\n"
01070 "// Entry position (global scope)\n"
01071 "vec3 pos;\n"
01072 "// Incremental vector in texture space (global scope)\n"
01073 "vec3 rayDir;\n"
01074 "\n"
01075 "float tMax;\n"
01076 "\n"
01077 "// Sub-functions, depending on cropping mode\n"
01078 "float initialMaxValue();\n"
01079 "void writeColorAndMaxScalar(vec4 sample,\n"
01080 " vec4 opacity,\n"
01081 " float maxValue);\n"
01082 "\n"
01083 "void trace(void)\n"
01084 "{\n"
01085 " // Max intensity is the lowest value.\n"
01086 " float maxValue=initialMaxValue();\n"
01087 " bool inside=true;\n"
01088 " vec4 sample;\n"
01089 " \n"
01090 " float t=0.0;\n"
01091 " // We NEED two nested while loops. It is trick to work around hardware\n"
01092 " // limitation about the maximum number of loops.\n"
01093 " while(inside)\n"
01094 " {\n"
01095 " while(inside)\n"
01096 " {\n"
01097 " sample=texture3D(dataSetTexture,pos);\n"
01098 " maxValue=max(maxValue,sample.r);\n"
01099 " pos=pos+rayDir;\n"
01100 " t+=1.0;\n"
01101 " \n"
01102 " // yes, t<tMax && all(greaterThanEqual(pos,lowBounds))\n"
01103 " // && all(lessThanEqual(pos,highBounds));\n"
01104 " // looks better but the latest nVidia 177.80 has a bug...\n"
01105 " inside=t<tMax && pos.x>=lowBounds.x && pos.y>=lowBounds.y\n"
01106 " && pos.z>=lowBounds.z && pos.x<=highBounds.x && pos.y<=highBounds.y\n"
01107 " && pos.z<=highBounds.z;\n"
01108 " }\n"
01109 " }\n"
01110 "\n"
01111 " sample=texture1D(colorTexture,maxValue);\n"
01112 " vec4 opacity=texture1D(opacityTexture,maxValue);\n"
01113 " \n"
01114 " writeColorAndMaxScalar(sample,opacity,maxValue);\n"
01115 "}\n"
01116 "\n";
01117
01118
01119
01120
01121
01122
01123
01124
01125
01126 const char *vtkMitkGPUVolumeRayCastMapper_MIPNoCroppingFS =
01127 "/*=========================================================================\n"
01128 "\n"
01129 " Program: Visualization Toolkit\n"
01130 " Module: $RCSfile: vtkMitkGPUVolumeRayCastMapper_MIPNoCroppingFS.glsl,v $\n"
01131 "\n"
01132 " Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n"
01133 " All rights reserved.\n"
01134 " See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n"
01135 "\n"
01136 " This software is distributed WITHOUT ANY WARRANTY; without even\n"
01137 " the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
01138 " PURPOSE. See the above copyright notice for more information.\n"
01139 "\n"
01140 "=========================================================================*/\n"
01141 "\n"
01142 "// Implementation of some functions used by the Maximum Intensity projection\n"
01143 "// (MIP) method when cropping is off.\n"
01144 "\n"
01145 "#version 110\n"
01146 "\n"
01147 "float initialMaxValue()\n"
01148 "{\n"
01149 " return 0.0;\n"
01150 "}\n"
01151 "\n"
01152 "void writeColorAndMaxScalar(vec4 sample,\n"
01153 " vec4 opacity,\n"
01154 " float maxValue)\n"
01155 "{\n"
01156 " // we don't need to write maxValue to a buffer when there is no cropping.\n"
01157 " // color framebuffer\n"
01158 " gl_FragColor.r =sample.r * opacity.a;\n"
01159 " gl_FragColor.g =sample.g * opacity.a;\n"
01160 " gl_FragColor.b =sample.b * opacity.a;\n"
01161 " gl_FragColor.a=opacity.a;\n"
01162 "}\n"
01163 "\n";
01164
01165
01166
01167
01168
01169
01170
01171
01172 const char *vtkMitkGPUVolumeRayCastMapper_OneComponentFS =
01173 "/*=========================================================================\n"
01174 "\n"
01175 " Program: Visualization Toolkit\n"
01176 " Module: $RCSfile: vtkMitkGPUVolumeRayCastMapper_OneComponentFS.glsl,v $\n"
01177 "\n"
01178 " Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n"
01179 " All rights reserved.\n"
01180 " See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n"
01181 "\n"
01182 " This software is distributed WITHOUT ANY WARRANTY; without even\n"
01183 " the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
01184 " PURPOSE. See the above copyright notice for more information.\n"
01185 "\n"
01186 "=========================================================================*/\n"
01187 "\n"
01188 "// Fragment shader that implements scalarFromValue() and colorFromValue() in\n"
01189 "// the case of a one-component dataset.\n"
01190 "// The functions are used in composite mode.\n"
01191 "\n"
01192 "#version 110\n"
01193 "\n"
01194 "// \"value\" is a sample of the dataset.\n"
01195 "// Think of \"value\" as an object.\n"
01196 "\n"
01197 "uniform sampler1D colorTexture;\n"
01198 "\n"
01199 "float scalarFromValue(vec4 value)\n"
01200 "{\n"
01201 " return value.x;\n"
01202 "}\n"
01203 "\n"
01204 "vec4 colorFromValue(vec4 value)\n"
01205 "{\n"
01206 " return texture1D(colorTexture,value.x);\n"
01207 "}\n"
01208 "\n";
01209
01210
01211
01212
01213
01214
01215
01216
01217 const char *vtkMitkGPUVolumeRayCastMapper_ParallelProjectionFS =
01218 "/*=========================================================================\n"
01219 "\n"
01220 " Program: Visualization Toolkit\n"
01221 " Module: $RCSfile: vtkMitkGPUVolumeRayCastMapper_ParallelProjectionFS.glsl,v $\n"
01222 "\n"
01223 " Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n"
01224 " All rights reserved.\n"
01225 " See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n"
01226 "\n"
01227 " This software is distributed WITHOUT ANY WARRANTY; without even\n"
01228 " the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
01229 " PURPOSE. See the above copyright notice for more information.\n"
01230 "\n"
01231 "=========================================================================*/\n"
01232 "\n"
01233 "// Parallel projection.\n"
01234 "\n"
01235 "#version 110\n"
01236 "\n"
01237 "uniform vec3 parallelRayDirection;\n"
01238 "\n"
01239 "// Incremental vector in texture space (global scope)\n"
01240 "vec3 rayDir;\n"
01241 "\n"
01242 "// Defined in the right projection method.\n"
01243 "void incrementalRayDirection()\n"
01244 "{\n"
01245 " rayDir=parallelRayDirection;\n"
01246 "}\n"
01247 "\n";
01248
01249
01250
01251
01252
01253
01254
01255
01256 const char *vtkMitkGPUVolumeRayCastMapper_PerspectiveProjectionFS =
01257 "/*=========================================================================\n"
01258 "\n"
01259 " Program: Visualization Toolkit\n"
01260 " Module: $RCSfile: vtkMitkGPUVolumeRayCastMapper_PerspectiveProjectionFS.glsl,v $\n"
01261 "\n"
01262 " Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n"
01263 " All rights reserved.\n"
01264 " See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n"
01265 "\n"
01266 " This software is distributed WITHOUT ANY WARRANTY; without even\n"
01267 " the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
01268 " PURPOSE. See the above copyright notice for more information.\n"
01269 "\n"
01270 "=========================================================================*/\n"
01271 "\n"
01272 "// Perspective projection.\n"
01273 "\n"
01274 "#version 110\n"
01275 "\n"
01276 "// Entry position (global scope)\n"
01277 "vec3 pos;\n"
01278 "// Incremental vector in texture space (global scope)\n"
01279 "vec3 rayDir;\n"
01280 "\n"
01281 "// Camera position in texture space\n"
01282 "uniform vec3 cameraPosition;\n"
01283 "// Sample distance in world space\n"
01284 "uniform float sampleDistance;\n"
01285 "// Matrix coefficients: diagonal (a11,a22,a33)\n"
01286 "uniform vec3 matrix1;\n"
01287 "// Matrix coefficients: others (2a12,2a23,2a13)\n"
01288 "uniform vec3 matrix2;\n"
01289 "\n"
01290 "// Defined in the right projection method.\n"
01291 "void incrementalRayDirection()\n"
01292 "{\n"
01293 " // Direction of the ray in texture space, not normalized.\n"
01294 " rayDir=pos-cameraPosition;\n"
01295 " \n"
01296 " // x^2, y^2, z^2\n"
01297 " vec3 normDir=rayDir*rayDir;\n"
01298 " normDir.x=dot(normDir,matrix1);\n"
01299 " \n"
01300 " // xy,yz,zx\n"
01301 " vec3 coefs=rayDir*rayDir.yxz;\n"
01302 " coefs.x=dot(coefs,matrix2);\n"
01303 "\n"
01304 " // n^2\n"
01305 " normDir.x=normDir.x+coefs.x;\n"
01306 " \n"
01307 " // 1/n\n"
01308 " // normDir=1/sqrt(normDir)\n"
01309 " normDir.x=inversesqrt(normDir.x);\n"
01310 " \n"
01311 " // Final scale factor for the ray direction in texture space\n"
01312 " // normDir=normDir*sampleDistance\n"
01313 " normDir.x=normDir.x*sampleDistance;\n"
01314 " // Now, rayDir is the incremental direction in texture space\n"
01315 " rayDir=rayDir*normDir.x;\n"
01316 "}\n"
01317 "\n";
01318
01319
01320
01321
01322
01323
01324
01325
01326 const char *vtkMitkGPUVolumeRayCastMapper_ScaleBiasFS =
01327 "/*=========================================================================\n"
01328 "\n"
01329 " Program: Visualization Toolkit\n"
01330 " Module: $RCSfile: vtkMitkGPUVolumeRayCastMapper_ScaleBiasFS.glsl,v $\n"
01331 "\n"
01332 " Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n"
01333 " All rights reserved.\n"
01334 " See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n"
01335 "\n"
01336 " This software is distributed WITHOUT ANY WARRANTY; without even\n"
01337 " the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
01338 " PURPOSE. See the above copyright notice for more information.\n"
01339 "\n"
01340 "=========================================================================*/\n"
01341 "\n"
01342 "// This fragment shader scales and biases a framebuffer passed as a texture.\n"
01343 "// Incoming color from the texture is pre-multiplied by alpha.\n"
01344 "// It does not affect the alpha component.\n"
01345 "// Passing the framebuffer as a texture allows the use of a reduction factor\n"
01346 "// compared to the size of the final image.\n"
01347 "\n"
01348 "#version 110\n"
01349 "\n"
01350 "// Framebuffer to scale.\n"
01351 "uniform sampler2D frameBufferTexture;\n"
01352 "uniform float scale;\n"
01353 "uniform float bias;\n"
01354 "\n"
01355 "void main()\n"
01356 "{\n"
01357 " vec4 color=texture2D(frameBufferTexture,gl_TexCoord[0].xy);\n"
01358 " if(color.a==0.0)\n"
01359 " {\n"
01360 " discard;\n"
01361 " }\n"
01362 " // As incoming color is pre-multiplied by alpha, the bias has to be\n"
01363 " // multiplied by alpha before adding it.\n"
01364 " gl_FragColor.r=color.r*scale+bias*color.a;\n"
01365 " gl_FragColor.g=color.g*scale+bias*color.a;\n"
01366 " gl_FragColor.b=color.b*scale+bias*color.a;\n"
01367 " gl_FragColor.a=color.a;\n"
01368 "}\n"
01369 "\n";
01370
01371
01372
01373
01374
01375
01376
01377
01378 const char *vtkMitkGPUVolumeRayCastMapper_ShadeFS =
01379 "/*=========================================================================\n"
01380 "\n"
01381 " Program: Visualization Toolkit\n"
01382 " Module: $RCSfile: vtkMitkGPUVolumeRayCastMapper_ShadeFS.glsl,v $\n"
01383 "\n"
01384 " Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n"
01385 " All rights reserved.\n"
01386 " See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n"
01387 "\n"
01388 " This software is distributed WITHOUT ANY WARRANTY; without even\n"
01389 " the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
01390 " PURPOSE. See the above copyright notice for more information.\n"
01391 "\n"
01392 "=========================================================================*/\n"
01393 "// Fragment shader that implements initShade() and shade() in the case of\n"
01394 "// shading.\n"
01395 "// The functions are used in composite mode.\n"
01396 "\n"
01397 "#version 110\n"
01398 "\n"
01399 "// \"value\" is a sample of the dataset.\n"
01400 "// Think of \"value\" as an object.\n"
01401 "\n"
01402 "// from 1- vs 4-component shader.\n"
01403 "vec4 colorFromValue(vec4 value);\n"
01404 "\n"
01405 "uniform sampler3D dataSetTexture; // need neighbors for gradient\n"
01406 "\n"
01407 "// Change-of-coordinate matrix from eye space to texture space\n"
01408 "uniform mat3 eyeToTexture3;\n"
01409 "uniform mat4 eyeToTexture4;\n"
01410 "\n"
01411 "// Tranpose of Change-of-coordinate matrix from texture space to eye space\n"
01412 "uniform mat3 transposeTextureToEye;\n"
01413 "\n"
01414 "// Used to compute the gradient.\n"
01415 "uniform vec3 cellStep;\n"
01416 "uniform vec3 cellScale;\n"
01417 "\n"
01418 "\n"
01419 "// Entry position (global scope), updated in the loop\n"
01420 "vec3 pos;\n"
01421 "// Incremental vector in texture space (global scope)\n"
01422 "vec3 rayDir;\n"
01423 "\n"
01424 "\n"
01425 "// local to the implementation, shared between initShade() and shade()\n"
01426 "const vec3 minusOne=vec3(-1.0,-1.0,-1.0);\n"
01427 "const vec4 clampMin=vec4(0.0,0.0,0.0,0.0);\n"
01428 "const vec4 clampMax=vec4(1.0,1.0,1.0,1.0);\n"
01429 "\n"
01430 "vec3 xvec;\n"
01431 "vec3 yvec;\n"
01432 "vec3 zvec;\n"
01433 "vec3 wReverseRayDir;\n"
01434 "vec3 lightPos;\n"
01435 "vec3 ldir;\n"
01436 "vec3 h;\n"
01437 "vec4 hPos; // homogeneous position\n"
01438 "\n"
01439 "// ----------------------------------------------------------------------------\n"
01440 "void initShade()\n"
01441 "{\n"
01442 " xvec=vec3(cellStep.x,0.0,0.0); // 0.01\n"
01443 " yvec=vec3(0.0,cellStep.y,0.0);\n"
01444 " zvec=vec3(0.0,0.0,cellStep.z);\n"
01445 " \n"
01446 " // Reverse ray direction in eye space\n"
01447 " wReverseRayDir=eyeToTexture3*rayDir;\n"
01448 " wReverseRayDir=wReverseRayDir*minusOne;\n"
01449 " wReverseRayDir=normalize(wReverseRayDir);\n"
01450 " \n"
01451 " // Directonal light: w==0\n"
01452 " if(gl_LightSource[0].position.w==0.0)\n"
01453 " {\n"
01454 " ldir=gl_LightSource[0].position.xyz;\n"
01455 " ldir=normalize(ldir);\n"
01456 " h=normalize(ldir+wReverseRayDir);\n"
01457 " }\n"
01458 " else\n"
01459 " {\n"
01460 " lightPos=gl_LightSource[0].position.xyz/gl_LightSource[0].position.w;\n"
01461 " hPos.w=1.0; // used later\n"
01462 " }\n"
01463 "}\n"
01464 "\n"
01465 "// ----------------------------------------------------------------------------\n"
01466 "vec4 shade(vec4 value)\n"
01467 "{\n"
01468 " vec3 g1;\n"
01469 " vec3 g2;\n"
01470 " vec4 tmp;\n"
01471 " float att;\n"
01472 " float spot;\n"
01473 " \n"
01474 " g1.x=texture3D(dataSetTexture,pos+xvec).x;\n"
01475 " g1.y=texture3D(dataSetTexture,pos+yvec).x;\n"
01476 " g1.z=texture3D(dataSetTexture,pos+zvec).x;\n"
01477 " g2.x=texture3D(dataSetTexture,pos-xvec).x;\n"
01478 " g2.y=texture3D(dataSetTexture,pos-yvec).x;\n"
01479 " g2.z=texture3D(dataSetTexture,pos-zvec).x;\n"
01480 " // g1-g2 is the gradient in texture coordinates\n"
01481 " // the result is the normalized gradient in eye coordinates.\n"
01482 " \n"
01483 " g2=g1-g2;\n"
01484 " g2=g2*cellScale;\n"
01485 " \n"
01486 " float normalLength=length(g2);\n"
01487 " if(normalLength>0.0)\n"
01488 " {\n"
01489 " g2=normalize(transposeTextureToEye*g2);\n"
01490 " }\n"
01491 " else\n"
01492 " {\n"
01493 " g2=vec3(0.0,0.0,0.0);\n"
01494 " }\n"
01495 " \n"
01496 " vec4 color=colorFromValue(value);\n"
01497 " \n"
01498 " // initialize color to 0.0\n"
01499 " vec4 finalColor=vec4(0.0,0.0,0.0,0.0); \n"
01500 " \n"
01501 " if(gl_LightSource[0].position.w!=0.0)\n"
01502 " {\n"
01503 " // We need to know the eye position only if light is positional\n"
01504 " // ldir= vertex position in eye coordinates\n"
01505 " hPos.xyz=pos;\n"
01506 " tmp=eyeToTexture4*hPos;\n"
01507 " ldir=tmp.xyz/tmp.w;\n"
01508 " // ldir=light direction\n"
01509 " ldir=lightPos-ldir;\n"
01510 " float sqrDistance=dot(ldir,ldir);\n"
01511 " ldir=normalize(ldir);\n"
01512 " h=normalize(ldir+wReverseRayDir);\n"
01513 " att=1.0/(gl_LightSource[0].constantAttenuation+gl_LightSource[0].linearAttenuation*sqrt(sqrDistance)+gl_LightSource[0].quadraticAttenuation*sqrDistance);\n"
01514 " }\n"
01515 " else\n"
01516 " {\n"
01517 " att=1.0;\n"
01518 " }\n"
01519 " \n"
01520 " if(att>0.0)\n"
01521 " {\n"
01522 " if(gl_LightSource[0].spotCutoff==180.0)\n"
01523 " {\n"
01524 " spot=1.0;\n"
01525 " }\n"
01526 " else\n"
01527 " {\n"
01528 " float coef=-dot(ldir,gl_LightSource[0].spotDirection);\n"
01529 " if(coef>=gl_LightSource[0].spotCosCutoff)\n"
01530 " {\n"
01531 " spot=pow(coef,gl_LightSource[0].spotExponent);\n"
01532 " }\n"
01533 " else\n"
01534 " {\n"
01535 " spot=0.0;\n"
01536 " }\n"
01537 " }\n"
01538 " if(spot>0.0)\n"
01539 " {\n"
01540 " // LIT operation...\n"
01541 " float nDotL=dot(g2,ldir);\n"
01542 " float nDotH=dot(g2,h);\n"
01543 " \n"
01544 " // separate nDotL and nDotH for two-sided shading, otherwise we\n"
01545 " // get black spots.\n"
01546 " \n"
01547 " if(nDotL<0.0) // two-sided shading\n"
01548 " {\n"
01549 " nDotL=-nDotL;\n"
01550 " }\n"
01551 " \n"
01552 " if(nDotH<0.0) // two-sided shading\n"
01553 " {\n"
01554 " nDotH=-nDotH;\n"
01555 " }\n"
01556 " // ambient term for this light\n"
01557 " finalColor+=gl_FrontLightProduct[0].ambient;\n"
01558 " \n"
01559 " // diffuse term for this light\n"
01560 " if(nDotL>0.0)\n"
01561 " {\n"
01562 " finalColor+=(gl_FrontLightProduct[0].diffuse*nDotL)*color;\n"
01563 " }\n"
01564 " \n"
01565 " // specular term for this light\n"
01566 " float shininessFactor=pow(nDotH,gl_FrontMaterial.shininess);\n"
01567 " finalColor+=gl_FrontLightProduct[0].specular*shininessFactor;\n"
01568 " finalColor*=att*spot;\n"
01569 " }\n"
01570 " }\n"
01571 " \n"
01572 " // scene ambient term\n"
01573 " finalColor+=gl_FrontLightModelProduct.sceneColor*color;\n"
01574 " \n"
01575 " // clamp. otherwise we get black spots\n"
01576 " finalColor=clamp(finalColor,clampMin,clampMax);\n"
01577 " \n"
01578 " return finalColor;\n"
01579 "}\n"
01580 "\n";
01581
01582
01583
01584
01585
01586
01587
01588
01589
01590
01591
01592 const char *vtkMitkGPUVolumeRayCastMapper_NoShadeFS =
01593 "/*=========================================================================\n"
01594 "\n"
01595 " Program: Visualization Toolkit\n"
01596 " Module: $RCSfile: vtkMitkGPUVolumeRayCastMapper_NoShadeFS.glsl,v $\n"
01597 "\n"
01598 " Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n"
01599 " All rights reserved.\n"
01600 " See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n"
01601 "\n"
01602 " This software is distributed WITHOUT ANY WARRANTY; without even\n"
01603 " the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
01604 " PURPOSE. See the above copyright notice for more information.\n"
01605 "\n"
01606 "=========================================================================*/\n"
01607 "\n"
01608 "// Fragment shader that implements initShade() and shade() in the case of no\n"
01609 "// shading.\n"
01610 "// The functions are used in composite mode.\n"
01611 "\n"
01612 "#version 110\n"
01613 "\n"
01614 "// \"value\" is a sample of the dataset.\n"
01615 "// Think of \"value\" as an object.\n"
01616 "\n"
01617 "// from 1- vs 4-component shader.\n"
01618 "vec4 colorFromValue(vec4 value);\n"
01619 "\n"
01620 "// ----------------------------------------------------------------------------\n"
01621 "void initShade()\n"
01622 "{\n"
01623 " // empty, nothing to do.\n"
01624 "}\n"
01625 "\n"
01626 "// ----------------------------------------------------------------------------\n"
01627 "vec4 shade(vec4 value)\n"
01628 "{\n"
01629 " return colorFromValue(value);\n"
01630 "}\n"
01631 "\n";
01632
01633
01634
01635
01636
01637
01638
01639
01640 const char *vtkMitkGPUVolumeRayCastMapper_HeaderFS =
01641 "/*=========================================================================\n"
01642 "\n"
01643 " Program: Visualization Toolkit\n"
01644 " Module: $RCSfile: vtkMitkGPUVolumeRayCastMapper_HeaderFS.glsl,v $\n"
01645 "\n"
01646 " Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n"
01647 " All rights reserved.\n"
01648 " See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n"
01649 "\n"
01650 " This software is distributed WITHOUT ANY WARRANTY; without even\n"
01651 " the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
01652 " PURPOSE. See the above copyright notice for more information.\n"
01653 "\n"
01654 "=========================================================================*/\n"
01655 "\n"
01656 "#version 110\n"
01657 "\n"
01658 "// Depth map of the polygonal geometry\n"
01659 "uniform sampler2D depthTexture;\n"
01660 "\n"
01661 "// 2D noise texture to jitter the starting point of the ray in order to\n"
01662 "// remove patterns when the opacity transfer function make the data on the\n"
01663 "// border of the dataset to be visible.\n"
01664 "uniform sampler2D noiseTexture;\n"
01665 "\n"
01666 "uniform vec2 windowLowerLeftCorner;\n"
01667 "uniform vec2 invOriginalWindowSize;\n"
01668 "uniform vec2 invWindowSize;\n"
01669 "\n"
01670 "// Change-of-coordinate matrix from eye space to texture space\n"
01671 "uniform mat4 textureToEye;\n"
01672 "\n"
01673 "// Entry position (global scope)\n"
01674 "vec3 pos;\n"
01675 "// Incremental vector in texture space (global scope)\n"
01676 "vec3 rayDir;\n"
01677 "\n"
01678 "// Abscissa along the ray of the point on the depth map\n"
01679 "// tracing stops when t>=tMax\n"
01680 "float tMax;\n"
01681 "\n"
01682 "// 2D Texture fragment coordinates [0,1] from fragment coordinates\n"
01683 "// the frame buffer texture has the size of the plain buffer but\n"
01684 "// we use a fraction of it. The texture coordinates is less than 1 if\n"
01685 "// the reduction factor is less than 1.\n"
01686 "vec2 fragTexCoord;\n"
01687 "\n"
01688 "// Defined in the right projection method.\n"
01689 "// May use pos in global scope as input.\n"
01690 "// Use rayDir in global scope as output.\n"
01691 "void incrementalRayDirection();\n"
01692 "void trace();\n"
01693 "\n"
01694 "void main()\n"
01695 "{\n"
01696 "\n"
01697 " // device coordinates are between -1 and 1\n"
01698 " // we need texture coordinates between 0 and 1\n"
01699 " // the depth buffer has the original size buffer.\n"
01700 " fragTexCoord=(gl_FragCoord.xy-windowLowerLeftCorner)*invWindowSize;\n"
01701 " vec4 depth=texture2D(depthTexture,fragTexCoord);\n"
01702 " if(gl_FragCoord.z>=depth.x) // depth test\n"
01703 " {\n"
01704 " discard;\n"
01705 " }\n"
01706 " \n"
01707 " // color buffer or max scalar buffer have a reduced size.\n"
01708 " fragTexCoord=(gl_FragCoord.xy-windowLowerLeftCorner)*invOriginalWindowSize;\n"
01709 " // Abscissa of the point on the depth buffer along the ray.\n"
01710 " // point in texture coordinates\n"
01711 " vec4 maxPoint;\n"
01712 " \n"
01713 " // from window coordinates to normalized device coordinates\n"
01714 " maxPoint.x=(gl_FragCoord.x-windowLowerLeftCorner.x)*2.0*invWindowSize.x-1.0;\n"
01715 " maxPoint.y=(gl_FragCoord.y-windowLowerLeftCorner.y)*2.0*invWindowSize.y-1.0;\n"
01716 " maxPoint.z=(2.0*depth.x-(gl_DepthRange.near+gl_DepthRange.far))/gl_DepthRange.diff;\n"
01717 " maxPoint.w=1.0;\n"
01718 " \n"
01719 " // from normalized device coordinates to eye coordinates\n"
01720 " maxPoint=gl_ProjectionMatrixInverse*maxPoint;\n"
01721 " \n"
01722 " // from eye coordinates to texture coordinates\n"
01723 " maxPoint=textureToEye*maxPoint;\n"
01724 " // homogeneous to cartesian coordinates\n"
01725 " maxPoint/=maxPoint.w;\n"
01726 " \n"
01727 " // Entry position. divide by q.\n"
01728 " // pos=gl_TexCoord[0].xyz/gl_TexCoord[0].w;\n"
01729 " \n"
01730 " pos.x=gl_TexCoord[0].x/gl_TexCoord[0].w;\n"
01731 " pos.y=gl_TexCoord[0].y/gl_TexCoord[0].w;\n"
01732 " pos.z=gl_TexCoord[0].z/gl_TexCoord[0].w;\n"
01733 " \n"
01734 " // Incremental vector in texture space. Computation depends on the\n"
01735 " // type of projection (parallel or perspective)\n"
01736 " incrementalRayDirection();\n"
01737 " \n"
01738 " vec4 noiseValue=texture2D(noiseTexture,pos.xy*100.0); // with repeat/tiling mode on the noise texture.\n"
01739 " \n"
01740 " pos+=(noiseValue.x)*rayDir;\n"
01741 "\n"
01742 " tMax=length(maxPoint.xyz-pos.xyz) /length(rayDir);\n"
01743 "\n"
01744 "\n"
01745 " // Tracing method. Set the final fragment color.\n"
01746 " trace();\n"
01747 "}\n"
01748 "\n";
01749
01750
01751
01752
01753
01754
01755
01756
01757 const char *vtkMitkGPUVolumeRayCastMapper_FourComponentsFS =
01758 "/*=========================================================================\n"
01759 "\n"
01760 " Program: Visualization Toolkit\n"
01761 " Module: $RCSfile: vtkMitkGPUVolumeRayCastMapper_FourComponentsFS.glsl,v $\n"
01762 "\n"
01763 " Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen\n"
01764 " All rights reserved.\n"
01765 " See Copyright.txt or http://www.kitware.com/Copyright.htm for details.\n"
01766 "\n"
01767 " This software is distributed WITHOUT ANY WARRANTY; without even\n"
01768 " the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
01769 " PURPOSE. See the above copyright notice for more information.\n"
01770 "\n"
01771 "=========================================================================*/\n"
01772 "\n"
01773 "// Fragment shader that implements scalarFromValue() and colorFromValue() in\n"
01774 "// the case of a one-component dataset.\n"
01775 "// The functions are used in composite mode.\n"
01776 "\n"
01777 "#version 110\n"
01778 "\n"
01779 "// \"value\" is a sample of the dataset.\n"
01780 "// Think of \"value\" as an object.\n"
01781 "\n"
01782 "float scalarFromValue(vec4 value)\n"
01783 "{\n"
01784 " return value.w;\n"
01785 "}\n"
01786 "\n"
01787 "vec4 colorFromValue(vec4 value)\n"
01788 "{\n"
01789 " return vec4(value.xyz,1.0);\n"
01790 "}\n"
01791 "\n";
01792
01793 #endif