voxel-engine/shaders/cube_vert.glsl
2025-11-12 14:06:57 -06:00

25 lines
690 B
GLSL

#version 330 core
// Input vertex attribute (e.g., from your VBO)
// 'layout (location = 0)' matches the first attribute you enable.
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aNormal;
layout (location = 2) in float aVoxelKind;
// A "uniform" is a global variable you set from your C++/Java/etc. code.
// This matrix combines your model, view, and projection matrices.
uniform mat4 u_mvp;
flat out vec3 v_Normal;
flat out float v_VoxelKind;
void main()
{
// gl_Position is a special built-in variable.
// It's the final clip-space position of the vertex.
gl_Position = u_mvp * vec4(aPos, 1.0);
v_Normal = aNormal;
v_VoxelKind = aVoxelKind;
}