Color output based on moment data

This commit is contained in:
Dan Paulat 2021-07-27 00:24:12 -05:00
parent 421c600ed0
commit f004c7aee0
5 changed files with 176 additions and 60 deletions

View file

@ -5,9 +5,22 @@ precision mediump float;
uniform sampler2D uTexture;
in vec2 texCoord;
flat in uint dataMoment;
layout (location = 0) out vec4 fragColor;
void main()
{
gl_FragColor = vec4(1.0f, 0.0f, 0.0f, 1.0f);
if (dataMoment < 126u)
{
fragColor = vec4(0.0f, 0.5f, 0.0f, 0.9f);
}
else if (dataMoment < 156u)
{
fragColor = vec4(1.0f, 0.75f, 0.0f, 0.9f);
}
else
{
fragColor = vec4(1.0f, 0.0f, 0.0f, 0.9f);
}
}

View file

@ -7,12 +7,12 @@
#define RAD2DEG 57.295779513082320876798156332941f
layout (location = 0) in vec2 aLatLong;
layout (location = 1) in vec2 aTexCoord;
layout (location = 1) in uint aDataMoment;
uniform mat4 uMVPMatrix;
uniform vec2 uMapScreenCoord;
out vec2 texCoord;
flat out uint dataMoment;
vec2 latLngToScreenCoordinate(in vec2 latLng)
{
@ -25,8 +25,8 @@ vec2 latLngToScreenCoordinate(in vec2 latLng)
void main()
{
// Pass the texture coordinate to the fragment shader
texCoord = aTexCoord;
// Pass the coded data moment to the fragment shader
dataMoment = aDataMoment;
vec2 p = latLngToScreenCoordinate(aLatLong) - uMapScreenCoord;