#include "vtkSphereMapperGS.h" const char *vtkSphereMapperGS = "//VTK::System::Dec\n" "\n" "/*=========================================================================\n" "\n" " Program: Visualization Toolkit\n" " Module: vtkSphereMapperGS.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" "\n" "uniform mat4 VCDCMatrix;\n" "\n" "in float radiusVCVSOutput[];\n" "out float radiusVCGSOutput;\n" "\n" "out vec4 vertexVCGSOutput;\n" "out vec3 centerVCGSOutput;\n" "\n" "// clipping plane vars\n" "//VTK::Clip::Dec\n" "\n" "// picking support\n" "//VTK::Picking::Dec\n" "\n" "void main()\n" "{\n" " radiusVCGSOutput = radiusVCVSOutput[0];\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" " centerVCGSOutput = gl_in[0].gl_Position.xyz/gl_in[0].gl_Position.w;\n" "\n" " //VTK::Picking::Impl\n" "\n" " // note 1.73205 = 2.0*cos(30)\n" "\n" " offset = vec4(-1.73205*radiusVCGSOutput, -radiusVCGSOutput, 0.0, 0.0);\n" " vertexVCGSOutput = gl_in[0].gl_Position + offset.x*base1 + offset.y*base2;\n" " gl_Position = VCDCMatrix * vertexVCGSOutput;\n" " EmitVertex();\n" "\n" " offset = vec4(1.73205*radiusVCGSOutput, -radiusVCGSOutput, 0.0, 0.0);\n" " vertexVCGSOutput = gl_in[0].gl_Position + offset.x*base1 + offset.y*base2;\n" " gl_Position = VCDCMatrix * vertexVCGSOutput;\n" " EmitVertex();\n" "\n" " offset = vec4(0.0, 2.0*radiusVCGSOutput, 0.0, 0.0);\n" " vertexVCGSOutput = gl_in[0].gl_Position + offset.x*base1 + offset.y*base2;\n" " gl_Position = VCDCMatrix * vertexVCGSOutput;\n" " EmitVertex();\n" "\n" " EndPrimitive();\n" "}\n" "";