2021-08-26 16:26:45 +03:00
|
|
|
#version 330 core
|
|
|
|
layout (location = 0) in vec3 pos;
|
2022-11-12 19:47:28 +02:00
|
|
|
layout (location = 1) in uint tex;
|
2022-11-05 20:14:50 +02:00
|
|
|
layout (location = 2) in vec4 light;
|
|
|
|
layout (location = 3) in float sunlight;
|
2021-08-26 16:26:45 +03:00
|
|
|
|
2022-11-12 19:47:28 +02:00
|
|
|
out vec3 passTexCoords;
|
2021-09-12 19:59:23 +03:00
|
|
|
out vec3 passLight;
|
2021-08-26 16:26:45 +03:00
|
|
|
|
2022-11-05 20:14:50 +02:00
|
|
|
uniform mat4 mvpMatrix;
|
|
|
|
uniform float globalSunlight;
|
2021-08-26 16:26:45 +03:00
|
|
|
|
2022-11-12 19:47:28 +02:00
|
|
|
const vec2 texCoords[4] = vec2[4](
|
|
|
|
vec2(0.0f, 0.0f),
|
|
|
|
vec2(0.0f, 1.0f),
|
|
|
|
vec2(1.0f, 0.0f),
|
|
|
|
vec2(1.0f, 1.0f)
|
|
|
|
);
|
|
|
|
|
2021-08-26 16:26:45 +03:00
|
|
|
void main() {
|
2022-11-05 20:14:50 +02:00
|
|
|
gl_Position = mvpMatrix * vec4(pos, 1.0f);
|
2022-11-12 19:47:28 +02:00
|
|
|
uint index = tex >> 30;
|
|
|
|
uint layer = tex & 0x3FFFFFFFu;
|
|
|
|
passTexCoords = vec3(texCoords[index].x, 1.0f - texCoords[index].y, layer);
|
2022-11-05 20:14:50 +02:00
|
|
|
passLight = light.rgb * light.a;
|
2021-09-03 17:11:50 +03:00
|
|
|
}
|