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
|
//VTK::System::Dec
/*=========================================================================
Program: Visualization Toolkit
Module: vtkPolyDataWideLineGS.glsl
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// Template for the polydata mappers geometry shader
// VC position of this fragment
//VTK::PositionVC::Dec
// primitiveID
//VTK::PrimID::Dec
// optional color passed in from the vertex shader, vertexColor
//VTK::Color::Dec
// optional surface normal declaration
//VTK::Normal::Dec
// extra lighting parameters
//VTK::Light::Dec
// Texture coordinates
//VTK::TCoord::Dec
// picking support
//VTK::Picking::Dec
// Depth Peeling Support
//VTK::DepthPeeling::Dec
// clipping plane vars
//VTK::Clip::Dec
// the output of this shader
//VTK::Output::Dec
uniform vec2 lineWidthNVC;
layout(lines) in;
layout(triangle_strip, max_vertices = 4) out;
void main()
{
// compute the lines direction
vec2 normal = normalize(
gl_in[1].gl_Position.xy/gl_in[1].gl_Position.w -
gl_in[0].gl_Position.xy/gl_in[0].gl_Position.w);
// rotate 90 degrees
normal = vec2(-1.0*normal.y,normal.x);
//VTK::Normal::Start
for (int j = 0; j < 4; j++)
{
int i = j/2;
//VTK::PrimID::Impl
//VTK::Clip::Impl
//VTK::Color::Impl
//VTK::Normal::Impl
//VTK::Light::Impl
//VTK::TCoord::Impl
//VTK::DepthPeeling::Impl
//VTK::Picking::Impl
// VC position of this fragment
//VTK::PositionVC::Impl
gl_Position = vec4(
gl_in[i].gl_Position.xy + (lineWidthNVC*normal)*((j+1)%2 - 0.5)*gl_in[i].gl_Position.w,
gl_in[i].gl_Position.z,
gl_in[i].gl_Position.w);
EmitVertex();
}
EndPrimitive();
}
|