Poly3d/shaders/cube_shader.vs

21 lines
508 B
Plaintext
Raw Normal View History

2024-11-27 17:51:31 +00:00
#version 330 core
2024-11-27 20:45:59 +00:00
layout(location = 0) in vec3 position;
layout(location = 1) in vec3 normal;
layout(location = 2) in vec2 texCoords;
2024-11-27 17:51:31 +00:00
2024-11-27 20:45:59 +00:00
out vec3 FragPos;
out vec3 Normal;
out vec2 TexCoords;
2024-11-27 17:51:31 +00:00
uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;
void main()
{
2024-11-27 20:45:59 +00:00
TexCoords = texCoords; // Pass texture coordinates to fragment shader
FragPos = vec3(model * vec4(position, 1.0));
Normal = mat3(transpose(inverse(model))) * normal;
gl_Position = projection * view * vec4(FragPos, 1.0);
2024-11-27 17:51:31 +00:00
}