2023-11-24 23:21:08 +02:00
|
|
|
#version 330 core
|
|
|
|
|
layout (location = 0) in vec2 vertex;
|
|
|
|
|
|
|
|
|
|
// per instance
|
|
|
|
|
layout (location = 1) in vec4 offset;
|
|
|
|
|
layout (location = 2) in int tex_index;
|
2023-11-25 01:39:49 +02:00
|
|
|
layout (location = 3) in mat4 model; // this takes locations 3,4,5,6
|
2023-11-24 23:21:08 +02:00
|
|
|
|
|
|
|
|
out vec2 v_TexCoords;
|
|
|
|
|
uniform mat4 projection;
|
|
|
|
|
// buffer for all the 96 ascii characters' texcoords
|
|
|
|
|
uniform vec2 texcoords[96 * 4];
|
|
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
|
vec2 pos = vec2((vertex.x) * offset.z, (vertex.y) * offset.w);
|
|
|
|
|
gl_Position = projection * model * vec4(pos + offset.xy, 0.0, 1.0);
|
|
|
|
|
v_TexCoords = texcoords[tex_index * 4 + gl_VertexID];
|
|
|
|
|
}
|