Add visibility to icon draw items

This commit is contained in:
Dan Paulat 2024-03-08 00:45:06 -06:00
parent d905abd3e7
commit 931b5d8481
7 changed files with 248 additions and 102 deletions

View file

@ -25,6 +25,7 @@ out VertexData
vec3 texCoord;
vec4 color;
ivec2 timeRange;
bool displayed;
} vsOut;
smooth out vec3 texCoord;
@ -41,6 +42,9 @@ vec2 latLngToScreenCoordinate(in vec2 latLng)
void main()
{
// Always set displayed to true
vsOut.displayed = true;
// Pass the threshold and time range to the geometry shader
vsOut.threshold = aThreshold;
vsOut.timeRange = aTimeRange;

View file

@ -16,12 +16,16 @@ out VertexData
vec3 texCoord;
vec4 color;
ivec2 timeRange;
bool displayed;
} vsOut;
smooth out vec4 color;
void main()
{
// Always set displayed to true
vsOut.displayed = true;
// Pass the threshold and time range to the geometry shader
vsOut.threshold = aThreshold;
vsOut.timeRange = aTimeRange;

View file

@ -7,20 +7,42 @@ layout (location = 1) in vec2 aXYOffset;
layout (location = 2) in vec3 aTexCoord;
layout (location = 3) in vec4 aModulate;
layout (location = 4) in float aAngleDeg;
layout (location = 5) in int aDisplayed;
uniform mat4 uMVPMatrix;
out VertexData
{
int threshold;
vec3 texCoord;
vec4 color;
ivec2 timeRange;
bool displayed;
} vsOut;
smooth out vec3 texCoord;
smooth out vec4 color;
void main()
{
// Always set threshold and time range to zero
vsOut.threshold = 0;
vsOut.timeRange = ivec2(0, 0);
// Pass displayed to the geometry shader
vsOut.displayed = (aDisplayed != 0);
// Pass the texture coordinate and color modulate to the geometry and
// fragment shaders
vsOut.texCoord = aTexCoord;
vsOut.color = aModulate;
texCoord = aTexCoord;
color = aModulate;
// Rotate clockwise
float angle = aAngleDeg * DEG2RAD;
mat2 rotate = mat2(cos(angle), -sin(angle),
sin(angle), cos(angle));
gl_Position = uMVPMatrix * vec4(aVertex + rotate * aXYOffset, 0.0f, 1.0f);
texCoord = aTexCoord;
color = aModulate;
}

View file

@ -12,6 +12,7 @@ in VertexData
vec3 texCoord;
vec4 color;
ivec2 timeRange;
bool displayed;
} gsIn[];
smooth out vec3 texCoord;
@ -19,7 +20,8 @@ smooth out vec4 color;
void main()
{
if ((gsIn[0].threshold <= 0 || // If Threshold: 0 was specified, no threshold
if (gsIn[0].displayed &&
(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