diff options
| author | navewindre <boneyaard@gmail.com> | 2025-09-03 20:10:09 +0200 |
|---|---|---|
| committer | navewindre <boneyaard@gmail.com> | 2025-09-03 20:10:09 +0200 |
| commit | f8b92ce3aa08b1445c9f956d8166830946562d12 (patch) | |
| tree | 94e63a5aec9f8f52b577f56799e0c9201fd976a5 /assets/shaders/2d_texcoord.vsh | |
a
Diffstat (limited to 'assets/shaders/2d_texcoord.vsh')
| -rw-r--r-- | assets/shaders/2d_texcoord.vsh | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/assets/shaders/2d_texcoord.vsh b/assets/shaders/2d_texcoord.vsh new file mode 100644 index 0000000..3ccc8e7 --- /dev/null +++ b/assets/shaders/2d_texcoord.vsh @@ -0,0 +1,28 @@ +#version 150 + +uniform sampler2D g_samplers[255]; + +in vec2 in_pos; +in vec4 in_clr; +in vec2 in_texcoord; +in float in_sampler; + +out vec2 g_texcoord; +out vec4 g_color; +flat out uint g_sampler; + +uniform vec4 g_screenratio; + +void main() { + vec2 halfscreen = vec2( 1.0 / g_screenratio[0], 1.0 / g_screenratio[1] ); + + vec4 pos = vec4( in_pos.x, in_pos.y, 1, 1 ); + pos[0] -= halfscreen[0]; + pos[1] -= halfscreen[1]; + pos[1] *= -1.0; + + g_texcoord = in_texcoord; + g_color = in_clr; + g_sampler = uint(in_sampler * 255 + 0.5); + gl_Position = ( pos ) * g_screenratio; +} |
