/usr/include/paraview/Quadrics_vs.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 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 | /* DO NOT EDIT.
* Generated by ../../../bin/vtkEncodeString
*
* Define the Quadrics_vs string.
*
* Generated from file: /build/paraview-arsa8T/paraview-5.0.1+dfsg1/Plugins/PointSprite/Rendering/Resources/Shaders/Quadrics_vs.glsl
*/
const char *Quadrics_vs =
"/*=========================================================================\n"
"\n"
" Program: Visualization Toolkit\n"
" Module: Quadrics_vs.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"
"// .NAME Quadrics_vs.glsl\n"
"// .SECTION Thanks\n"
"// <verbatim>\n"
"//\n"
"// This file is part of the PointSprites plugin developed and contributed by\n"
"//\n"
"// Copyright (c) CSCS - Swiss National Supercomputing Centre\n"
"// EDF - Electricite de France\n"
"//\n"
"// John Biddiscombe, Ugo Varetto (CSCS)\n"
"// Stephane Ploix (EDF)\n"
"//\n"
"// </verbatim>\n"
"\n"
"//\n"
"// IN:\n"
"// - vertex\n"
"// - quadric transformation matrix\n"
"// - viewport (width and height only)\n"
"// - point scaling factor\n"
"// - min point size (pointThreshold)\n"
"//\n"
"// OUT:\n"
"// - vertex position\n"
"// - point size\n"
"// - ray origin\n"
"// - perspective flag\n"
"// - quadric equation coefficients\n"
"// - color\n"
"//\n"
"// NOTE: this shader is currently used for ellipsoids but can be used with\n"
"// any quadric matrix; for quadrics other than ellipsoids additional\n"
"// clipping information is required for computing both point size\n"
"// and intersection point\n"
"/// @todo try to pass attributes through texture coordinates/normal/secondary color...\n"
"\n"
"//#define CORRECT_POINT_Z\n"
"\n"
"// OPTIMAL\n"
"#define SPHERE\n"
"//#define ELLIPSOID\n"
"//#define CYLINDER\n"
"//#define CONE\n"
"//#define HYPERBOLOID1\n"
"//#define HYPERBOLOID2\n"
"//#define PARABOLOID\n"
"\n"
"// SUB OPTIMAL\n"
"//#define HYPER_PARABOLOID\n"
"\n"
"// force ELLIPSOID if we are using SPHERE\n"
"#ifdef SPHERE\n"
"#ifndef ELLIPSOID\n"
"#define ELLIPSOID\n"
"#endif\n"
"#endif\n"
"\n"
"uniform vec2 viewport; // only width and height passed, no origin\n"
"uniform float pointSizeThreshold; // minimum point size\n"
"uniform float MaxPixelSize;\n"
"\n"
"// quadric coefficients\n"
"// | a d e g |\n"
"// | d b f h |\n"
"// | e f c i |\n"
"// | g h i j |\n"
"// ax^2 + by^2 + cz^2 + 2dxy +2exz + 2fyz + 2gx + 2hy + 2iz + j = 0\n"
"varying float a;\n"
"varying float b;\n"
"varying float c;\n"
"varying float d;\n"
"varying float e;\n"
"varying float f;\n"
"varying float g;\n"
"varying float h;\n"
"varying float i;\n"
"varying float j;\n"
"\n"
"varying vec4 color; // primitive color\n"
"varying float pointSize; // computed point size\n"
"varying float perspective; // perspective flag\n"
"\n"
"#ifndef SPHERE\n"
"// columns of inverse transform\n"
"attribute vec4 Ti1;\n"
"attribute vec4 Ti2;\n"
"attribute vec4 Ti3;\n"
"attribute vec4 Ti4;\n"
"\n"
"// columns of transform\n"
"attribute vec4 T1;\n"
"attribute vec4 T2;\n"
"attribute vec4 T3;\n"
"attribute vec4 T4;\n"
"#endif\n"
"\n"
"// bounds in clip coordinates\n"
"vec2 xbc;\n"
"vec2 ybc;\n"
"\n"
"// Matrices in canonical form + trasformation matrices applied to\n"
"// bounding ellipsoids used to compute the point size: bounds are\n"
"// computed by transforming a 2D ellipsoid in canonical form with\n"
"// the t1,2 matrices and computing the union of the bounding boxes\n"
"// of the transformed ellipsoids.\n"
"#if defined( ELLIPSOID )\n"
"// quadric matrix in canonical form for ellipsoids\n"
"const mat4 D = mat4( 1., 0., 0., 0.,\n"
" 0., 1., 0., 0.,\n"
" 0., 0., 1., 0.,\n"
" 0., 0., 0., -1. );\n"
"#elif defined( CYLINDER )\n"
"// quadric matrix in canonical form for cylinders\n"
"const mat4 D = mat4( 1., 0., 0., 0.,\n"
" 0., 1., 0., 0.,\n"
" 0., 0., 0., 0.,\n"
" 0., 0., 0., -1. );\n"
"const mat4 t1 = mat4( 1., 0., 0., 0.,\n"
" 0., 1., 0., 0.,\n"
" 0., 0., 0., 0,\n"
" 0., 0., 1., 1. );\n"
"const mat4 t2 = mat4( 1., 0., 0., 0.,\n"
" 0., 1., 0., 0.,\n"
" 0., 0., 0., 0.,\n"
" 0., 0., -1., 1. );\n"
"#elif defined( CONE )\n"
"// quadric matrix in canonical form for cones\n"
"const mat4 D = mat4( 1., 0., 0., 0.,\n"
" 0., 1., 0., 0.,\n"
" 0., 0., -1., 0.,\n"
" 0., 0., 0., 0. );\n"
"const mat4 t1 = mat4( 1., 0., 0., 0.,\n"
" 0., 1., 0., 0.,\n"
" 0., 0., 0., 0.,\n"
" 0., 0., 1., 1. );\n"
"const mat4 t2 = mat4( 1., 0., 0., 0.,\n"
" 0., 1., 0., 0.,\n"
" 0., 0., 0., 0.,\n"
" 0., 0., -1., 1. );\n"
"#elif defined( HYPERBOLOID1 )\n"
"// quadric matrix in canonical form for hyperboloids of one sheet\n"
"const mat4 D = mat4( 1., 0., 0., 0.,\n"
" 0., 1., 0., 0.,\n"
" 0., 0., -1., 0.,\n"
" 0., 0., 0., -1. );\n"
"const mat4 t1 = mat4( sqrt( 2 ), 0., 0., 0.,\n"
" 0., sqrt( 2 ), 0., 0.,\n"
" 0., 0., 0.00, 0,\n"
" 0., 0., 1., 1. );\n"
"const mat4 t2 = mat4( sqrt( 2 ), 0., 0., 0.,\n"
" 0., sqrt( 2 ), 0., 0.,\n"
" 0., 0., 0.00, 0.,\n"
" 0., 0., -1., 1. );\n"
"#elif defined( HYPERBOLOID2 )\n"
"// quadric matrix in canonical form for hyperboloids of two sheets\n"
"// note the use of 0.5 instead of 1 to have the quadric visible\n"
"// within the unit cube with a radius of 1/sqrt(2) at z = +/-1\n"
"const mat4 D = mat4( -1., 0., 0., 0.,\n"
" 0., -1., 0., 0.,\n"
" 0., 0., 1., 0.,\n"
" 0., 0., 0., -.5 );\n"
"const mat4 t1 = mat4( inversesqrt( 2. ), 0., 0., 0.,\n"
" 0., inversesqrt( 2. ), 0., 0.,\n"
" 0., 0., 0., 0.,\n"
" 0., 0., 1., 1. );\n"
"const mat4 t2 = mat4( inversesqrt( 2. ), 0., 0., 0.,\n"
" 0., inversesqrt( 2. ), 0., 0.,\n"
" 0., 0., 0., 0.,\n"
" 0., 0., -1., 1. );\n"
"#elif defined( PARABOLOID )\n"
"// quadric matrix in canonical form for paraboloids\n"
"// note the .5 components used to properly center\n"
"// the paraboloid\n"
"const mat4 D = mat4( 1., 0., 0., 0.,\n"
" 0., 1., 0., 0.,\n"
" 0., 0., 0., -.5,\n"
" 0., 0., -.5, 0. );\n"
"const mat4 t1 = mat4( 1., 0., 0., 0.,\n"
" 0., 1., 0., 0.,\n"
" 0., 0., 0., 0.,\n"
" 0., 0., 1., 1. );\n"
"const mat4 t2 = mat4( 1., 0., 0., 0.,\n"
" 0., 1., 0., 0.,\n"
" 0., 0., 0., 0.,\n"
" 0., 0., 0., 1. );\n"
"\n"
"#elif defined( HYPER_PARABOLOID )\n"
"// quadric matrix in canonical form for hyperbolic paraboloid\n"
"const mat4 D = mat4( 1., 0., 0., 0.,\n"
" 0., -1., 0., 0.,\n"
" 0., 0., 0., -.5,\n"
" 0., 0., -.5, 0. );\n"
"#endif\n"
"\n"
"// change of basis matrix and inverse for quadric\n"
"mat4 T;\n"
"varying mat4 Ti;\n"
"\n"
"const float FEPS = 0.000001;\n"
"\n"
"const float DEF_Z = 1. - FEPS;\n"
"\n"
"//------------------------------------------------------------------------------\n"
"/// Compute point size and center using the technique described in:\n"
"/// \"GPU-Based Ray-Casting of Quadratic Surfaces\"\n"
"/// by Christian Sigg, Tim Weyrich, Mario Botsch, Markus Gross.\n"
"void ComputePointSizeAndPositionInClipCoordEllipsoid()\n"
"{\n"
" mat4 R = transpose( gl_ModelViewProjectionMatrix * T );\n"
" float A = dot( R[ 3 ], D * R[ 3 ] );\n"
" float B = -2. * dot( R[ 0 ], D * R[ 3 ] );\n"
" float C = dot( R[ 0 ], D * R[ 0 ] );\n"
" xbc[ 0 ] = ( -B - sqrt( B * B - 4. * A * C ) ) / ( 2.0 * A );\n"
" xbc[ 1 ] = ( -B + sqrt( B * B - 4. * A * C ) ) / ( 2.0 * A );\n"
" float sx = abs( xbc[ 0 ] - xbc[ 1 ] ) * .5 * viewport.x;\n"
"\n"
" A = dot( R[ 3 ], D * R[ 3 ] );\n"
" B = -2. * dot( R[ 1 ], D * R[ 3 ] );\n"
" C = dot( R[ 1 ], D * R[ 1 ] );\n"
" ybc[ 0 ] = ( -B - sqrt( B * B - 4. * A * C ) ) / ( 2.0 * A );\n"
" ybc[ 1 ] = ( -B + sqrt( B * B - 4. * A * C ) ) / ( 2.0 * A );\n"
" float sy = abs( ybc[ 0 ] - ybc[ 1 ] ) * .5 * viewport.y;\n"
"\n"
" pointSize = ceil( max( sx, sy ) );\n"
" gl_PointSize = pointSize;\n"
"#ifdef CORRECT_POINT_Z\n"
" // gl_Position has to be precomputed before getting here\n"
" // the reason for which we want the z coordinate to be correct is for debugging\n"
" // purpose only: when displaying point shapes as quads the point center will match\n"
" // the the quadric center\n"
" gl_Position.xy = vec2( .5 * ( xbc.x + xbc.y ), .5 * ( ybc.x + ybc.y ) ) * gl_Position.w;\n"
"#else\n"
" gl_Position = vec4( .5 * ( xbc.x + xbc.y ), .5 * ( ybc.x + ybc.y ), DEF_Z, 1. );\n"
"#endif\n"
"}\n"
"\n"
"//------------------------------------------------------------------------------\n"
"/// Compute point size and center using the technique described in:\n"
"/// \"GPU-Based Ray-Casting of Quadratic Surfaces\"\n"
"/// by Christian Sigg, Tim Weyrich, Mario Botsch, Markus Gross.\n"
"/// The technique described in the paper only works with ellipsoids, the following code\n"
"/// extends the technique to make it work with other quadric tyepes:\n"
"/// - Cylinder: the cylinder bounding box is computed by computing the union\n"
"/// of the bounding boxes of two 2D ellipsoids centered at (0, 0, +/- 1) which are\n"
"/// the cylinder bounds along the z axis in parameter space.\n"
"/// - Hyperboloid of one sheet: the hyperboloid bounding box is computed by\n"
"/// computing the union of the bounding boxes of two 2D ellipsoids\n"
"/// centered at (0, 0, +/- 1) and whose x and y axes are scaled by sqrt(2)\n"
"/// which are the hyperboloid bounds in parameter space.\n"
"/// - Hyperboloid of two sheets: the hyperboloid bounding box is computed by\n"
"/// computing the union of the bounding boxes of two 2D ellipsoids\n"
"/// centered at (0, 0, +/- 2) and whose x and y axes are scaled by sqrt(2),\n"
"/// which are the hyperboloid bounds in parameter space.\n"
"/// - Cone: the cone bounding box is computed by computing the union of the bounding\n"
"/// boxes of two 2D ellipsoids centered at (0, 0, +/- 1) which are the cone\n"
"/// bounds along the z axis in parameter space.\n"
"/// - Paraboloid: the paraboloid bounding box is computed by computing the union\n"
"/// of the bounding boxes of two 2D ellipsoids centered at (0, 0, 0) and (0, 0, 1)\n"
"/// which are the paraboloid bounds along the z axis in parameter space.\n"
"#if defined( CYLINDER ) || defined( CONE ) || defined( HYPERBOLOID1 ) || defined( HYPERBOLOID2 ) || defined( PARABOLOID )\n"
"void ComputePointSizeAndPositionInClipCoord()\n"
"{\n"
"\n"
" // always use ellipse to compute bounds\n"
" const mat4 D = mat4( 1., 0., 0., 0.,\n"
" 0., 1., 0., 0.,\n"
" 0., 0., 0., 0.,\n"
" 0., 0., 0., -1. );\n"
"\n"
" mat4 R = transpose( gl_ModelViewProjectionMatrix * T * t1 );\n"
" float A = dot( R[ 3 ], D * R[ 3 ] );\n"
" float B = -2. * dot( R[ 0 ], D * R[ 3 ] );\n"
" float C = dot( R[ 0 ], D * R[ 0 ] );\n"
" vec2 xbc1;\n"
" xbc1[ 0 ] = ( -B - sqrt( B * B - 4. * A * C ) ) / ( 2.0 * A );\n"
" xbc1[ 1 ] = ( -B + sqrt( B * B - 4. * A * C ) ) / ( 2.0 * A );\n"
"\n"
" A = dot( R[ 3 ], D * R[ 3 ] );\n"
" B = -2. * dot( R[ 1 ], D * R[ 3 ] );\n"
" C = dot( R[ 1 ], D * R[ 1 ] );\n"
" vec2 ybc1;\n"
" ybc1[ 0 ] = ( -B - sqrt( B * B - 4. * A * C ) ) / ( 2.0 * A );\n"
" ybc1[ 1 ] = ( -B + sqrt( B * B - 4. * A * C ) ) / ( 2.0 * A );\n"
"\n"
" R = transpose( gl_ModelViewProjectionMatrix * T * t2 );\n"
" A = dot( R[ 3 ], D * R[ 3 ] );\n"
" B = -2. * dot( R[ 0 ], D * R[ 3 ] );\n"
" C = dot( R[ 0 ], D * R[ 0 ] );\n"
" vec2 xbc2;\n"
" xbc2[ 0 ] = ( -B - sqrt( B * B - 4. * A * C ) ) / ( 2.0 * A ) ;\n"
" xbc2[ 1 ] = ( -B + sqrt( B * B - 4. * A * C ) ) / ( 2.0 * A );\n"
"\n"
" A = dot( R[ 3 ], D * R[ 3 ] );\n"
" B = -2. * dot( R[ 1 ], D * R[ 3 ] );\n"
" C = dot( R[ 1 ], D * R[ 1 ] );\n"
" vec2 ybc2;\n"
" ybc2[ 0 ] = ( -B - sqrt( B * B - 4. * A * C ) ) / ( 2.0 * A );\n"
" ybc2[ 1 ] = ( -B + sqrt( B * B - 4. * A * C ) ) / ( 2.0 * A );\n"
"\n"
"\n"
" xbc[ 0 ] = min( xbc1[ 0 ], min( xbc1[ 1 ], min( xbc2[ 0 ], xbc2[ 1 ] ) ) );\n"
" xbc[ 1 ] = max( xbc1[ 0 ], max( xbc1[ 1 ], max( xbc2[ 0 ], xbc2[ 1 ] ) ) );\n"
"\n"
" ybc[ 0 ] = min( ybc1[ 0 ], min( ybc1[ 1 ], min( ybc2[ 0 ], ybc2[ 1 ] ) ) );\n"
" ybc[ 1 ] = max( ybc1[ 0 ], max( ybc1[ 1 ], max( ybc2[ 0 ], ybc2[ 1 ] ) ) );\n"
"\n"
" float sx = ( xbc[ 1 ] - xbc[ 0 ] ) * .5 * viewport.x;\n"
" float sy = ( ybc[ 1 ] - ybc[ 0 ] ) * .5 * viewport.y;\n"
"\n"
" pointSize = ceil( max( sx, sy ) );\n"
" gl_PointSize = pointSize;\n"
"\n"
"#ifdef CORRECT_POINT_Z\n"
" // gl_Position has to be precomputed before getting here\n"
" // the reason for which we want the z coordinate to be correct is for debugging\n"
" // purpose only: when displaying point shapes as quads the point center will match\n"
" // the the quadric center\n"
" gl_Position.xy = vec2( .5 * ( xbc.x + xbc.y ), .5 * ( ybc.x + ybc.y ) ) * gl_Position.w;\n"
"#else\n"
" gl_Position = vec4( .5 * ( xbc.x + xbc.y ), .5 * ( ybc.x + ybc.y ), DEF_Z, 1. );\n"
"#endif\n"
"}\n"
"#endif\n"
"\n"
"//------------------------------------------------------------------------------\n"
"// Generic bounding box computation, works with any quadric type by splatting\n"
"// in clip space the bounding box in parameter space;\n"
"// in most cases you'll have to use a point scaling factor from 1.05 to 1.5\n"
"void ComputePointSizeAndPositionWithProjection()\n"
"{\n"
"\n"
" mat4 M = gl_ModelViewProjectionMatrix * T;\n"
"\n"
" const float dxm = -1.;\n"
" const float dxp = 1.;\n"
" const float dym = -1.;\n"
" const float dyp = 1.;\n"
" const float dzm = -1.;\n"
" const float dzp = 1.;\n"
" vec4 P1 = M * vec4( dxm, dym, dzm, 1. );\n"
" vec4 P2 = M * vec4( dxp, dym, dzm, 1. );\n"
" vec4 P3 = M * vec4( dxp, dyp, dzm, 1. );\n"
" vec4 P4 = M * vec4( dxm, dyp, dzm, 1. );\n"
" vec4 P5 = M * vec4( dxm, dym, dzp, 1. );\n"
" vec4 P6 = M * vec4( dxp, dym, dzp, 1. );\n"
" vec4 P7 = M * vec4( dxp, dyp, dzp, 1. );\n"
" vec4 P8 = M * vec4( dxm, dyp, dzp, 1. );\n"
"\n"
" P1 /= P1.w;\n"
" P2 /= P2.w;\n"
" P3 /= P3.w;\n"
" P4 /= P4.w;\n"
" P5 /= P5.w;\n"
" P6 /= P6.w;\n"
" P7 /= P7.w;\n"
" P8 /= P8.w;\n"
"\n"
" float xmin = min( P1.x,\n"
" min( P2.x,\n"
" min( P3.x,\n"
" min( P4.x,\n"
" min( P5.x,\n"
" min( P6.x,\n"
" min( P7.x, P8.x ) ) ) ) ) ) );\n"
" float ymin = min( P1.y,\n"
" min( P2.y,\n"
" min( P3.y,\n"
" min( P4.y,\n"
" min( P5.y,\n"
" min( P6.y,\n"
" min( P7.y, P8.y ) ) ) ) ) ) );\n"
"\n"
" float xmax = max( P1.x,\n"
" max( P2.x,\n"
" max( P3.x,\n"
" max( P4.x,\n"
" max( P5.x,\n"
" max( P6.x,\n"
" max( P7.x, P8.x ) ) ) ) ) ) );\n"
"\n"
" float ymax = max( P1.y,\n"
" max( P2.y,\n"
" max( P3.y,\n"
" max( P4.y,\n"
" max( P5.y,\n"
" max( P6.y,\n"
" max( P7.y, P8.y ) ) ) ) ) ) );\n"
"\n"
"\n"
" float sx = ( xmax - xmin ) * 0.5 * viewport.x;\n"
" float sy = ( ymax - ymin ) * 0.5 * viewport.y;\n"
"\n"
"// gl_PointSize = ceil( pointScaling * max( sx, sy ) );\n"
" pointSize = ceil( max( sx, sy ) );\n"
" gl_PointSize = pointSize;\n"
"#ifdef CORRECT_POINT_Z\n"
" // gl_Position has to be precomputed before getting here\n"
" // the reason for which we want the z coordinate to be correct is for debugging\n"
" // purpose only: when displaying point shapes as quads the point center will match\n"
" // the the quadric center\n"
" gl_Position.xy = vec2( .5 * ( xmin + xmax ), .5 * ( ymin + ymax ) ) * gl_Position.w;\n"
"#else\n"
" gl_Position = vec4( .5 * ( xmin + xmax ), .5 * ( ymin + ymax ), DEF_Z, 1. );\n"
"#endif\n"
"}\n"
"\n"
"#ifdef SPHERE\n"
"float GetRadius();\n"
"#endif\n"
"\n"
"void ComputePointSizeAndPosition()\n"
"{\n"
"#if defined( ELLIPSOID )\n"
" ComputePointSizeAndPositionWithProjection();\n"
" //ComputePointSizeAndPositionInClipCoordEllipsoid();\n"
"#elif defined( CYLINDER ) || defined( CONE ) || defined( HYPERBOLOID1 ) || defined( HYPERBOLOID2 ) || defined( PARABOLOID )\n"
" ComputePointSizeAndPositionInClipCoord();\n"
"#else\n"
" ComputePointSizeAndPositionWithProjection();\n"
"#endif\n"
"}\n"
"\n"
"//------------------------------------------------------------------------------\n"
"// MAIN\n"
"void propFuncVS()\n"
"{ \n"
" color = gl_Color;\n"
"\n"
" // compute position, this is required only when displaying the point quad\n"
"#ifdef CORRECT_POINT_Z\n"
" gl_Position = ftransform();\n"
"#endif\n"
"\n"
" //set perspective flag by inspecting the projection matrix\n"
" perspective = float( gl_ProjectionMatrix[ 3 ][ 3 ] < FEPS && abs( gl_ProjectionMatrix[ 2 ][ 3 ] ) > FEPS );\n"
"\n"
" #ifdef SPHERE\n"
" float radius = GetRadius();\n"
" float iradius;\n"
" if(radius < FEPS)\n"
" iradius = 1.0/FEPS;\n"
" else\n"
" iradius = 1.0/radius;\n"
"\n"
" T = mat4( radius, 0., 0., 0.,\n"
" 0., radius, 0., 0.,\n"
" 0., 0., radius, 0.,\n"
" gl_Vertex.x, gl_Vertex.y, gl_Vertex.z, 1.0 );\n"
"\n"
" Ti = mat4( iradius, 0., 0., 0.,\n"
" 0., iradius, 0., 0.,\n"
" 0., 0., iradius, 0.,\n"
" -gl_Vertex.x*iradius, -gl_Vertex.y*iradius, -gl_Vertex.z*iradius, 1.0 );\n"
"\n"
"\n"
" #else\n"
" // inverse of transformation matrix\n"
" Ti = mat4( Ti1, Ti2, Ti3, Ti4 );\n"
" // transformation matrix\n"
" T = mat4( T1, T2, T3, T4 );\n"
" #endif\n"
"\n"
" // compute point size and gl_Position; uses Ti and T which have to be\n"
" // computed before calling the function\n"
" ComputePointSizeAndPosition();\n"
"\n"
" if(pointSize > MaxPixelSize)\n"
" {\n"
" gl_PointSize = MaxPixelSize;\n"
" float factor = gl_PointSize / pointSize;\n"
" float realRadius = radius*factor;\n"
" float realIRadius = 1.0/realRadius;\n"
" T = mat4( realRadius, 0., 0., 0.,\n"
" 0., realRadius, 0., 0.,\n"
" 0., 0., realRadius, 0.,\n"
" gl_Vertex.x, gl_Vertex.y, gl_Vertex.z, 1.0 );\n"
"\n"
" Ti = mat4( realIRadius, 0., 0., 0.,\n"
" 0., realIRadius, 0., 0.,\n"
" 0., 0., realIRadius, 0.,\n"
" -gl_Vertex.x*realIRadius, -gl_Vertex.y*realIRadius, -gl_Vertex.z*realIRadius, 1.0 );\n"
" \n"
" ComputePointSizeAndPosition();\n"
" }\n"
" // if pixel size valid set quadric's coefficients\n"
" if( pointSize > pointSizeThreshold )\n"
" {\n"
" // transposed inverse of transformation matrix\n"
" mat4 Tit = transpose( Ti );\n"
" // transform quadric matrix into world coordinates and\n"
" // assign values to coefficients to be passed to fragment shader\n"
" mat4 Q = gl_ModelViewMatrixInverseTranspose * Tit * D * Ti * gl_ModelViewMatrixInverse;\n"
" //////////////////\n"
" // | a d e g |\n"
" // | d b f h |\n"
" // | e f c i |\n"
" // | g h i j |\n"
" // ax^2 + by^2 + cz^2 + 2dxy +2exz + 2fyz + 2gx + 2hy + 2iz + j = 0\n"
" a = Q[ 0 ][ 0 ];\n"
" b = Q[ 1 ][ 1 ];\n"
" c = Q[ 2 ][ 2 ];\n"
" d = Q[ 1 ][ 0 ];\n"
" e = Q[ 2 ][ 0 ];\n"
" f = Q[ 2 ][ 1 ];\n"
" g = Q[ 3 ][ 0 ];\n"
" h = Q[ 3 ][ 1 ];\n"
" i = Q[ 3 ][ 2 ];\n"
" j = Q[ 3 ][ 3 ];\n"
" }\n"
"}\n"
"\n";
|