1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 08:12:53 +01:00

implement DrawLine with shader

This commit is contained in:
Ted John
2016-06-11 17:43:53 +01:00
parent e34ee15738
commit e3ecb91b91
6 changed files with 198 additions and 7 deletions

View File

@@ -0,0 +1,20 @@
#version 330
uniform ivec2 uScreenSize;
uniform ivec4 uClip;
uniform vec4 uColour;
in vec2 fPosition;
layout (location = 0) out vec4 oColour;
void main()
{
if (fPosition.x < uClip.x || fPosition.x > uClip.z ||
fPosition.y < uClip.y || fPosition.y > uClip.w)
{
discard;
}
oColour = uColour;
}

View File

@@ -0,0 +1,30 @@
#version 330
uniform ivec2 uScreenSize;
uniform ivec4 uBounds;
in int vIndex;
out vec2 fPosition;
void main()
{
vec2 pos;
if (vIndex == 0)
{
pos = uBounds.xy;
}
else
{
pos = uBounds.zw;
}
fPosition = pos;
// Transform screen coordinates to viewport
pos.x = (pos.x * (2.0 / uScreenSize.x)) - 1.0;
pos.y = (pos.y * (2.0 / uScreenSize.y)) - 1.0;
pos.y *= -1;
gl_Position = vec4(pos, 0.0, 1.0);
}