Placefile polygon looping

This commit is contained in:
Dan Paulat 2023-09-05 23:32:22 -05:00
parent e5d18ecc4d
commit 1a4b064214
4 changed files with 82 additions and 30 deletions

View file

@ -13,6 +13,7 @@ layout (location = 2) in vec3 aTexCoord;
layout (location = 3) in vec4 aModulate;
layout (location = 4) in float aAngleDeg;
layout (location = 5) in int aThreshold;
layout (location = 6) in ivec2 aTimeRange;
uniform mat4 uMVPMatrix;
uniform mat4 uMapMatrix;
@ -20,9 +21,10 @@ uniform vec2 uMapScreenCoord;
out VertexData
{
int threshold;
vec3 texCoord;
vec4 color;
int threshold;
vec3 texCoord;
vec4 color;
ivec2 timeRange;
} vsOut;
smooth out vec3 texCoord;
@ -39,8 +41,9 @@ vec2 latLngToScreenCoordinate(in vec2 latLng)
void main()
{
// Pass the threshold to the geometry shader
// Pass the threshold and time range to the geometry shader
vsOut.threshold = aThreshold;
vsOut.timeRange = aTimeRange;
// Pass the texture coordinate and color modulate to the geometry and
// fragment shaders

View file

@ -1,9 +1,10 @@
#version 330 core
layout (location = 0) in vec2 aScreenCoord;
layout (location = 1) in vec2 aXYOffset;
layout (location = 2) in vec4 aColor;
layout (location = 3) in int aThreshold;
layout (location = 0) in vec2 aScreenCoord;
layout (location = 1) in vec2 aXYOffset;
layout (location = 2) in vec4 aColor;
layout (location = 3) in int aThreshold;
layout (location = 4) in ivec2 aTimeRange;
uniform mat4 uMVPMatrix;
uniform mat4 uMapMatrix;
@ -11,17 +12,19 @@ uniform vec2 uMapScreenCoord;
out VertexData
{
int threshold;
vec3 texCoord;
vec4 color;
int threshold;
vec3 texCoord;
vec4 color;
ivec2 timeRange;
} vsOut;
smooth out vec4 color;
void main()
{
// Pass the threshold and color to the geometry shader
// Pass the threshold and time range to the geometry shader
vsOut.threshold = aThreshold;
vsOut.timeRange = aTimeRange;
// Pass the color to the geometry and fragment shaders
vsOut.color = aColor;

View file

@ -4,12 +4,14 @@ layout (triangles) in;
layout (triangle_strip, max_vertices = 3) out;
uniform float uMapDistance;
uniform int uSelectedTime;
in VertexData
{
int threshold;
vec3 texCoord;
vec4 color;
int threshold;
vec3 texCoord;
vec4 color;
ivec2 timeRange;
} gsIn[];
smooth out vec3 texCoord;
@ -17,9 +19,12 @@ smooth out vec4 color;
void main()
{
if (gsIn[0].threshold <= 0 || // If Threshold: 0 was specified, no threshold
gsIn[0].threshold >= uMapDistance || // If Threshold is above current map distance
gsIn[0].threshold >= 999) // If Threshold: 999 was specified (or greater), no threshold
if ((gsIn[0].threshold <= 0 || // If Threshold: 0 was specified, no threshold
gsIn[0].threshold >= uMapDistance || // If Threshold is above current map distance
gsIn[0].threshold >= 999) && // If Threshold: 999 was specified (or greater), no threshold
(gsIn[0].timeRange[0] == 0 || // If there is no start time specified
(gsIn[0].timeRange[0] <= uSelectedTime && // If the selected time is after the start time
uSelectedTime < gsIn[0].timeRange[1]))) // If the selected time is before the end time
{
gl_Position = gl_in[0].gl_Position;
texCoord = gsIn[0].texCoord;