25 lines
493 B
GLSL
25 lines
493 B
GLSL
#version 150 core
|
|
|
|
uniform ivec2 Viewport;
|
|
uniform mat3 Transform;
|
|
uniform sampler2D Texture;
|
|
|
|
/* TODO: instanced */
|
|
uniform vec4 Rect;
|
|
uniform vec4 Clip;
|
|
|
|
in vec2 Vert;
|
|
|
|
out vec2 TextureCoord;
|
|
|
|
void main() {
|
|
vec2 vert = mix(Rect.xy, Rect.zw, Vert);
|
|
vec3 pos = Transform * vec3(vert, 1.0);
|
|
|
|
TextureCoord = mix(Clip.st, Clip.pq, Vert) / textureSize(Texture, 0);
|
|
|
|
gl_Position.xy = pos.xy * vec2(2.0, -2.0) / Viewport + vec2(-1.0, 1.0);
|
|
gl_Position.z = 0.0;
|
|
gl_Position.w = 1.0;
|
|
}
|