2023-04-10 00:21:49 +02:00
|
|
|
#version 330 core
|
|
|
|
|
|
|
|
layout (location = 0) in vec3 aPos;
|
2023-07-19 12:42:45 +02:00
|
|
|
layout (location = 1) in vec3 aExtents;
|
|
|
|
layout (location = 2) in vec2 aInfo;
|
2023-04-10 00:21:49 +02:00
|
|
|
|
|
|
|
uniform mat4 model;
|
|
|
|
|
2023-07-19 12:42:45 +02:00
|
|
|
out VS_OUT {
|
|
|
|
vec3 Extents;
|
|
|
|
vec3 Normal;
|
|
|
|
float BlockType;
|
|
|
|
} vs_out;
|
2023-04-10 00:21:49 +02:00
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2023-07-19 12:42:45 +02:00
|
|
|
//vNormal = mat3(transpose(inverse(model))) * aNormal;
|
|
|
|
vs_out.Extents = aExtents;
|
|
|
|
vs_out.BlockType = aInfo.y;
|
2023-04-10 00:21:49 +02:00
|
|
|
|
2023-07-19 12:42:45 +02:00
|
|
|
if(aExtents.x == 0) vs_out.Normal = vec3(1.0 - 2*aInfo.x, 0.0, 0.0);
|
|
|
|
else if(aExtents.y == 0) vs_out.Normal = vec3(0.0, 1.0 - 2*aInfo.x, 0.0);
|
|
|
|
else vs_out.Normal = vec3(0.0, 0.0, 1.0 - 2*aInfo.x);
|
|
|
|
vs_out.Normal = mat3(transpose(inverse(model))) * vs_out.Normal;
|
|
|
|
|
|
|
|
gl_Position = model * vec4(aPos, 1.0);
|
2023-04-10 00:21:49 +02:00
|
|
|
}
|