Files
HydraV3/HydraEngine/source/ShaderFiles/forward_shader.vert
T
2026-07-17 15:30:29 +01:00

41 lines
922 B
GLSL

#version 460 core
#extension GL_ARB_bindless_texture : require
layout(binding = 0) uniform uniform_per_frame
{
mat4 view;
mat4 proj;
vec3 viewer_pos;
uint light_count;
} ubo_per_frame;
layout(binding = 1) readonly buffer PositionsBuffer
{
mat4 model_matrix[];
};
layout (location = 0) in vec3 inPos; //12 bytes : 0
layout (location = 1) in vec2 inUV; //8 Bytes : 12
layout (location = 2) in uvec3 inChunkID; //12 Bytes : 20
layout(location=0) out VS_OUT
{
vec2 vsUV;
vec4 vsWorldPos;
flat uint vsChunkID;
flat uint vsMaterialID;
}vs_out;
void main()
{
uint chunkid = inChunkID[0];
mat4 model = model_matrix[chunkid];
mat4 view = ubo_per_frame.view;
mat4 proj = ubo_per_frame.proj;
//model = mat4(1);
gl_Position = proj * view * model * vec4(inPos, 1.0);
vs_out.vsWorldPos = model * vec4(inPos,1);
vs_out.vsUV = inUV;
vs_out.vsChunkID = chunkid;
vs_out.vsMaterialID = inChunkID[1];
}