#include "vtkPointGaussianGS.h" const char *vtkPointGaussianGS = "//VTK::System::Dec\n" "\n" "/*=========================================================================\n" "\n" " Program: Visualization Toolkit\n" " Module: vtkPointGaussianGS.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" "// Template for the polydata mappers geometry shader\n" "\n" "// primitiveID\n" "//VTK::PrimID::Dec\n" "\n" "// optional color passed in from the vertex shader, vertexColor\n" "//VTK::Color::Dec\n" "\n" "layout(points) in;\n" "layout(triangle_strip, max_vertices = 3) out;\n" "\n" "uniform int cameraParallel;\n" "uniform float triangleScale;\n" "\n" "uniform mat4 VCDCMatrix;\n" "\n" "in float radiusVCVSOutput[];\n" "out vec2 offsetVCGSOutput;\n" "\n" "// clipping plane vars\n" "//VTK::Clip::Dec\n" "\n" "// picking support\n" "//VTK::Picking::Dec\n" "\n" "void main()\n" "{\n" " // the offsets sent down are positioned\n" " // as radius*triangleScale from the center of the\n" " // gaussian. This has to be consistent\n" " // with the offsets we build into the VBO\n" " float radius = radiusVCVSOutput[0]/triangleScale;\n" "\n" " int i = 0;\n" " vec4 offset;\n" "\n" " vec4 base1 = vec4(1.0,0.0,0.0,0.0);\n" " vec4 base2 = vec4(0.0,1.0,0.0,0.0);\n" "\n" " // make the triangle face the camera\n" " if (cameraParallel == 0)\n" " {\n" " vec3 dir = normalize(-gl_in[0].gl_Position.xyz);\n" " base2 = vec4(normalize(cross(dir,vec3(1.0,0.0,0.0))), 0.0);\n" " base1 = vec4(cross(base2.xyz,dir),0.0);\n" " }\n" "\n" " //VTK::PrimID::Impl\n" "\n" " //VTK::Clip::Impl\n" "\n" " //VTK::Color::Impl\n" "\n" " // note 1.73205 = 2.0*cos(30)\n" "\n" " offset = vec4(-1.73205*radiusVCVSOutput[0], -radiusVCVSOutput[0], 0.0, 0.0);\n" "\n" " //VTK::Picking::Impl\n" "\n" " offsetVCGSOutput = offset.xy/radius;\n" " gl_Position = VCDCMatrix * (gl_in[0].gl_Position + offset.x*base1 + offset.y*base2);\n" " EmitVertex();\n" "\n" " offset = vec4(1.73205*radiusVCVSOutput[0], -radiusVCVSOutput[0], 0.0, 0.0);\n" " offsetVCGSOutput = offset.xy/radius;\n" " gl_Position = VCDCMatrix * (gl_in[0].gl_Position + offset.x*base1 + offset.y*base2);\n" " EmitVertex();\n" "\n" " offset = vec4(0.0, 2.0*radiusVCVSOutput[0], 0.0, 0.0);\n" " offsetVCGSOutput = offset.xy/radius;\n" " gl_Position = VCDCMatrix * (gl_in[0].gl_Position + offset.x*base1 + offset.y*base2);\n" " EmitVertex();\n" "\n" " EndPrimitive();\n" "}\n" "";