blob: 2b1ad60022452e5181f8d2aec0dbc4dae3cd93db (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#version 420
in layout(location=0) vec3 position; /* vertex position in model coordinates */
in layout(location=1) vec2 offset; /* xy coordinates offset for atlases */
in layout(location=2) mat4 M_MVP;
out vec2 Fragment_UV; /* UV coordinates for the fragment */
uniform float number_of_rows; /* For texture atlases */
void main()
{
gl_Position = M_MVP * vec4(position, 1.0);
Fragment_UV = position.xy + vec2(0.5, 0.5);
Fragment_UV.y = 1.0 - Fragment_UV.y;
Fragment_UV = (Fragment_UV / number_of_rows ) + offset;
}
|