2023-07-24 23:54:37 +02:00
|
|
|
#version 330 core
|
|
|
|
|
|
|
|
layout (location = 0) in vec3 aPos;
|
2023-08-03 10:26:01 +02:00
|
|
|
layout (location = 1) in vec3 aNormal;
|
2023-07-24 23:54:37 +02:00
|
|
|
|
2023-08-03 10:26:01 +02:00
|
|
|
uniform mat4x4 _Model;
|
|
|
|
uniform mat4x4 _View;
|
|
|
|
uniform mat4x4 _Projection;
|
|
|
|
|
|
|
|
out vec3 Normal;
|
|
|
|
out vec3 FragPos;
|
2024-09-29 01:11:12 +02:00
|
|
|
out mat4x4 ModelViewProjection;
|
2023-07-31 23:30:35 +02:00
|
|
|
|
2023-07-24 23:54:37 +02:00
|
|
|
void main()
|
|
|
|
{
|
2023-08-03 10:26:01 +02:00
|
|
|
vec4 pos = vec4(aPos, 1.0);
|
2023-08-13 22:57:05 +02:00
|
|
|
mat4x4 mvp = _Projection * _View * _Model;
|
2024-09-29 01:11:12 +02:00
|
|
|
ModelViewProjection = mvp;
|
2023-07-24 23:54:37 +02:00
|
|
|
|
2023-08-03 10:26:01 +02:00
|
|
|
gl_Position = mvp * pos;
|
|
|
|
FragPos = vec3(_Model * pos);
|
|
|
|
|
|
|
|
// Convert the normal from model to world space
|
|
|
|
mat3 normalMatrix = mat3(mvp);
|
|
|
|
normalMatrix = inverse(normalMatrix);
|
|
|
|
normalMatrix = transpose(normalMatrix);
|
|
|
|
Normal = normalize(normalMatrix * aNormal);
|
|
|
|
//Normal = normalize(_Model * aNormal);
|
|
|
|
}
|