feat: initial commit
This commit is contained in:
29
src/shaders/simple.vs
Normal file
29
src/shaders/simple.vs
Normal file
@ -0,0 +1,29 @@
|
||||
#version 460 core
|
||||
|
||||
// Input vertex attributes
|
||||
layout (location = 0) in vec3 position; // Vertex position in local space (model space)
|
||||
layout (location = 1) in vec3 normal; // vertex normal
|
||||
layout (location = 2) in vec2 texCoord; // Vertex texture uv
|
||||
|
||||
// Output to fragment shader
|
||||
out vec3 vertexPos;
|
||||
out vec3 vertexNormal;
|
||||
out vec2 TexCoords;
|
||||
|
||||
// Uniforms for transformation matrices
|
||||
uniform mat4 u_model; // Model matrix: transforms from local space to world space
|
||||
uniform mat4 u_view; // View matrix: transforms from world space to camera space (view space)
|
||||
uniform mat4 u_projection; // Projection matrix: transforms from camera space to clip space
|
||||
|
||||
void main()
|
||||
{
|
||||
vertexPos = vec3(u_model * vec4(position, 1.0));
|
||||
|
||||
mat3 normalMatrix = mat3(transpose(inverse(u_model)));
|
||||
vertexNormal = normalMatrix * normal;
|
||||
// vertexNormal = normal;
|
||||
|
||||
TexCoords = texCoord;
|
||||
|
||||
gl_Position = u_projection * u_view * vec4(vertexPos, 1.0);
|
||||
}
|
Reference in New Issue
Block a user