Poly3d/shaders/preview_vertex.glsl

18 lines
485 B
Plaintext
Raw Permalink Normal View History

2024-11-26 03:49:37 +00:00
#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);
}