Poly3d/shaders/preview_vertex.glsl
2024-11-25 21:49:37 -06:00

18 lines
485 B
GLSL

#version 330 core
layout(location = 0) in vec3 aPos;
layout(location = 1) in vec3 aNormal;
out vec3 FragPos; // Position of the fragment in world space
out vec3 Normal; // Normal of the fragment in world space
uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;
void main()
{
FragPos = vec3(model * vec4(aPos, 1.0));
Normal = mat3(transpose(inverse(model))) * aNormal; // Transform normals properly
gl_Position = projection * view * vec4(FragPos, 1.0);
}