forked from rolker/bagViewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgeometry.glsl
43 lines (37 loc) · 952 Bytes
/
geometry.glsl
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
#version 150 core
layout (triangles) in;
layout (triangle_strip, max_vertices = 3) out;
in VertexData
{
float elevation;
float lighting;
float uncertainty;
vec3 worldPosition;
} inData[];
out VertexData
{
float elevation;
float lighting;
float uncertainty;
vec3 worldPosition;
} outData;
void main()
{
int n;
float maxElevation = inData[0].elevation;
for (n = 0; n < gl_in.length(); n++)
if(inData[n].elevation > maxElevation)
maxElevation = inData[n].elevation;
// only generate a triangle if all verticies have a valid elevation.
if(maxElevation <= 1.0)
{
for (n = 0; n < gl_in.length(); n++)
{
gl_Position = gl_in[n].gl_Position;
outData.elevation = inData[n].elevation;
outData.lighting = inData[n].lighting;
outData.worldPosition = inData[n].worldPosition;
EmitVertex();
}
}
}