/usr/include/paraview/edl_shade.cxx is in paraview-dev 5.0.1+dfsg1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | /* DO NOT EDIT.
* Generated by ../../../bin/vtkEncodeString
*
* Define the edl_shade string.
*
* Generated from file: /build/paraview-arsa8T/paraview-5.0.1+dfsg1/Plugins/EyeDomeLighting/EyeDomeLighting/resources/Shaders/edl_shade.glsl
*/
const char *edl_shade =
"/*=========================================================================\n"
"\n"
" Program: ParaView\n"
" Module: edl_shade.glsl\n"
"\n"
" Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.\n"
" All rights reserved.\n"
"\n"
" ParaView is a free software; you can redistribute it and/or modify it\n"
" under the terms of the ParaView license version 1.2.\n"
"\n"
" See License_v1.2.txt for the full ParaView license.\n"
" A copy of this license can be obtained by contacting\n"
" Kitware Inc.\n"
" 28 Corporate Drive\n"
" Clifton Park, NY 12065\n"
" USA\n"
"\n"
"THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n"
"``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n"
"LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n"
"A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR\n"
"CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n"
"EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n"
"PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n"
"PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n"
"LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n"
"NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n"
"SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
"\n"
"=========================================================================*/\n"
"/*----------------------------------------------------------------------\n"
"Acknowledgement:\n"
"This algorithm is the result of joint work by Electricité de France,\n"
"CNRS, Collège de France and Université J. Fourier as part of the\n"
"Ph.D. thesis of Christian BOUCHENY.\n"
"------------------------------------------------------------------------*/\n"
"//////////////////////////////////////////////////////////////////////////\n"
"//\n"
"//\n"
"// EyeDome Lighting - Simplified version for use in VTK\n"
"// - oriented light\n"
"// - no focus\n"
"// - some uniforms transformed to local variables\n"
"//\n"
"// C.B. - 3 feb. 2009\n"
"//\n"
"// IN: Depth buffer of the scene\n"
"// r = recorded z, in [0:1]\n"
"// OUT: EDL shaded image\n"
"//\n"
"//////////////////////////////////////////////////////////////////////////\n"
"\n"
"/**************************************************/\n"
"uniform sampler2D s2_depth; // - Z Map\n"
"uniform float d; // [1.0 in full res - 2.0 at lower res]\n"
" //- Extension in image space, in pixels\n"
"uniform vec4 N[8]; //- Array of neighbours\n"
" // [No support for TabUniform in VTK\n"
" // --> constant array, hereafter]\n"
"uniform float F_scale; // [5.] - Shading amplification factor\n"
"\n"
"uniform float SX; // - pixel horizontal step (image distance: 1/w)\n"
"uniform float SY; //- pixel vertical step (image distance: 1/h)\n"
"uniform float Znear; // near clipping plane\n"
"uniform float Zfar; // far clipping plane\n"
"uniform float SceneSize; // typical scene size, to scale the depth by.\n"
"\n"
"uniform vec3 L; // [0.,0.,-1.] - Light direction [frontal]\n"
"/**************************************************/\n"
"\n"
"/**************************************************/\n"
"int Nnb = 1; // nombre de voisins par rayon\n"
"float Zm = 0.; // minimal z in image\n"
"float ZM = 1.; // maximal z in image\n"
"float Z; // initial Z\n"
"\n"
"vec3 WHITE3 = vec3(1.,1.,1.);\n"
"\n"
"float t;\n"
"vec4 Zn[8]; // profondeurs des voisins\n"
"float D[8]; // ombrage genere par les voisins\n"
"vec4 tn, tnw, tw, tsw, ts, tse, te, tne;\n"
"float dn, dnw, dw, dsw, ds, dse, de, dne;\n"
"float S; // image step, corresponds to one pixel size\n"
"/**************************************************/\n"
"\n"
"//////////////////////////////////////////////////////////////////////////\n"
"//\n"
"// Local shading functions\n"
"//\n"
"// Pseudo angle, avec S (distance pixel) valant l'unite\n"
"// zi elevation of current pixel\n"
"// zj elevation of its neighbour\n"
"// delta distance between the two\n"
"float angleP(float zi, float zj, float delta)\n"
"{\n"
" return max(0.,zj-zi) / (delta/S);\n"
"}\n"
"\n"
"// zi elevation of current pixel\n"
"// zj elevation of its neighbour\n"
"// delta distance between the two\n"
"float obscurance(float zi, float zj, float delta)\n"
"{\n"
" return angleP(zi,zj,delta);\n"
"}\n"
"//\n"
"// Local shading functions\n"
"//\n"
"//////////////////////////////////////////////////////////////////////////\n"
"\n"
"//////////////////////////////////////////////////////////////////////////\n"
"//\n"
"// Z transformation\n"
"//\n"
"float zflip(float z)\n"
"{\n"
" return 1. - z;\n"
"}\n"
"\n"
"float zscale(float z)\n"
"{\n"
" return clamp((z-Zm)/(ZM-Zm),0.,1.);\n"
"}\n"
"\n"
"// Inversion of OpenGL perspective projection\n"
"// (should be adapted for orthographic projection)\n"
"//\n"
"float ztransform(float z)\n"
"{\n"
" float Z;\n"
" Z = (z-0.5)*2.;\n"
" Z = -2.*Zfar*Znear/( (Zfar-Znear) * (Z-(Zfar+Znear)/(Zfar-Znear)) );\n"
" Z = (Z-Znear)/SceneSize;\n"
" return 1.-Z;\n"
"}\n"
"//\n"
"// Z transformation\n"
"//\n"
"//////////////////////////////////////////////////////////////////////////\n"
"\n"
"//////////////////////////////////////////////////////////////////////////\n"
"//\n"
"// NEIGHBORHOOD SHADING\n"
"//\n"
"void computeNeighbours8(float dist)\n"
"{\n"
" // Plan Lumiere-point\n"
" vec4 P = vec4( L.xyz , -dot(L.xyz,vec3(0.,0.,t)) );\n"
"\n"
" // 0 at the back of the scene\n"
" int c;\n"
" vec2 V; // pixel voisin\n"
" float di = dist;\n"
" float Znp[8]; // profondeur des 8 voisins sur le plan\n"
"\n"
" for(c=0; c<8;c++)\n"
" {\n"
" V = gl_TexCoord[0].st + di*vec2(SX,SY)*N[c].xy;\n"
" Zn[c].x = ztransform(texture2D(s2_depth,V).r);\n"
" // profondeur du voisin reel dans l'image\n"
"\n"
" // VERSION qui ombre le fond\n"
" Znp[c] = dot( vec4(di*vec2(SX,SY)*N[c].xy,Zn[c].x,1.) , P );\n"
" }\n"
" dn = obscurance( 0., Znp[0] ,di*SX);\n"
" dnw = obscurance( 0., Znp[1],di*SX);\n"
" dw = obscurance( 0., Znp[2] ,di*SX);\n"
" dsw = obscurance( 0., Znp[3],di*SX);\n"
" ds = obscurance( 0., Znp[4] ,di*SX);\n"
" dse = obscurance( 0., Znp[5],di*SX);\n"
" de = obscurance( 0., Znp[6] ,di*SX);\n"
" dne = obscurance( 0., Znp[7],di*SX);\n"
"}\n"
"\n"
"float computeObscurance(float F,float scale,float weight)\n"
"{\n"
" computeNeighbours8( scale );\n"
"\n"
" float S = F;\n"
" float WE = weight;\n"
"\n"
" S += dn * WE;\n"
" S += dnw * WE;\n"
" S += dw * WE;\n"
" S += dsw * WE;\n"
" S += ds * WE;\n"
" S += dse * WE;\n"
" S += de * WE;\n"
" S += dne * WE;\n"
"\n"
" return S;\n"
"}\n"
"\n"
"void ambientOcclusion()\n"
"{\n"
" float F = 0.;\n"
" float weight = 20.; // 2. * 3.14159;\n"
" int filter = 0;\n"
" F = computeObscurance(F,d,weight);\n"
" F = exp(-F_scale*F);\n"
" vec3 color = WHITE3;\n"
"\n"
" if(false)\n"
" {\n"
" gl_FragColor = vec4(1.,1.,1.,Z);\n"
" }\n"
" else\n"
" {\n"
" gl_FragColor = vec4(F,F,F,Z);\n"
" }\n"
"}\n"
"\n"
"void main (void)\n"
"{\n"
" S = SX;\n"
" Z = texture2D(s2_depth,gl_TexCoord[0].st).r;\n"
" t = ztransform(Z);\n"
"\n"
" ambientOcclusion();\n"
"}\n"
"\n";
|