2020-10-18 16:52:22 +00:00
|
|
|
#ifdef GL_ES
|
|
|
|
precision mediump float;
|
|
|
|
#endif
|
2020-10-18 10:22:08 +00:00
|
|
|
|
|
|
|
layout (points) in;
|
|
|
|
layout (triangle_strip) out;
|
|
|
|
layout (max_vertices = 4) out;
|
|
|
|
|
|
|
|
// OF handled uniforms and attributes.
|
|
|
|
uniform mat4 projectionMatrix;
|
|
|
|
|
|
|
|
// App specific uniforms and attributes.
|
|
|
|
uniform float uSpriteSize;
|
|
|
|
|
|
|
|
in vec4 vPosition[];
|
|
|
|
in vec2 vTexCoord[];
|
|
|
|
flat in int vValid[];
|
|
|
|
|
2020-10-20 09:16:21 +00:00
|
|
|
in float vTemperature[];
|
|
|
|
out float gTemperature;
|
|
|
|
|
2020-10-18 10:22:08 +00:00
|
|
|
out vec2 gTexCoord;
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
if (vValid[0] == 0) return;
|
|
|
|
|
|
|
|
gTexCoord = vTexCoord[0];
|
2020-10-20 09:16:21 +00:00
|
|
|
gTemperature = vTemperature[0];
|
2020-10-18 10:22:08 +00:00
|
|
|
|
|
|
|
for (int i = 0; i < gl_in.length(); ++i)
|
|
|
|
{
|
|
|
|
gl_Position = projectionMatrix * (vPosition[i] + vec4(1.0, -1.0, 0.0, 0.0) * uSpriteSize);
|
|
|
|
EmitVertex();
|
|
|
|
|
|
|
|
gl_Position = projectionMatrix * (vPosition[i] + vec4(1.0, 1.0, 0.0, 0.0) * uSpriteSize);
|
|
|
|
EmitVertex();
|
|
|
|
|
|
|
|
gl_Position = projectionMatrix * (vPosition[i] + vec4(-1.0, -1.0, 0.0, 0.0) * uSpriteSize);
|
|
|
|
EmitVertex();
|
|
|
|
|
|
|
|
gl_Position = projectionMatrix * (vPosition[i] + vec4(-1.0, 1.0, 0.0, 0.0) * uSpriteSize);
|
|
|
|
EmitVertex();
|
|
|
|
|
|
|
|
EndPrimitive();
|
|
|
|
}
|
|
|
|
}
|