Files
OpenRCT2-Web/data/shaders/drawline.vert
T

29 lines
581 B
GLSL
Raw Normal View History

2016-06-15 17:53:26 +01:00
#version 150
2016-06-11 17:43:53 +01:00
2017-10-19 18:49:26 -05:00
// Allows for about 8 million draws per frame
const float DEPTH_INCREMENT = 1.0 / float(1u << 22u);
2016-06-11 17:43:53 +01:00
uniform ivec2 uScreenSize;
2017-10-19 18:49:26 -05:00
in ivec4 vBounds;
in ivec4 vClip;
in uint vColour;
in int vDepth;
2016-06-11 17:43:53 +01:00
2017-10-19 15:46:49 -05:00
in mat4x2 vVertMat;
2016-06-11 17:43:53 +01:00
2017-10-19 18:49:26 -05:00
flat out uint fColour;
2016-06-11 17:43:53 +01:00
void main()
{
2017-10-19 18:49:26 -05:00
vec2 pos = clamp(vVertMat * vBounds, vClip.xy, vClip.zw);
2016-06-11 17:43:53 +01:00
2017-10-21 21:04:24 -05:00
// Transform screen coordinates to viewport coordinates
pos = (pos * (2.0 / uScreenSize)) - 1.0;
2016-06-11 17:43:53 +01:00
pos.y *= -1;
2017-10-20 22:00:56 -05:00
float depth = 1.0 - (vDepth + 1) * DEPTH_INCREMENT;
2016-06-11 17:43:53 +01:00
2017-10-19 18:49:26 -05:00
fColour = vColour;
gl_Position = vec4(pos, depth, 1.0);
2016-06-11 17:43:53 +01:00
}