#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(std430, 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 = 3) in vec3 inNormal; //8 Bytes : 12 layout (location = 4) in vec3 inBiTangent; layout (location = 5) in vec3 inTangent; layout(location=0) out VS_OUT { vec2 vsUV; vec4 vsWorldPos; vec3 vsNormal; vec3 vsBiTangent; vec3 vsTangent; mat3 vsTBN; 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.vsNormal = normalize(vec3(model * vec4(normalize(inNormal),0))); vs_out.vsTangent = normalize(vec3(model *vec4(inTangent,0))) ; vs_out.vsBiTangent = normalize(vec3(model *vec4(inBiTangent,0))); vs_out.vsTBN = mat3(vs_out.vsTangent, vs_out.vsBiTangent, vs_out.vsNormal); vs_out.vsUV = inUV; vs_out.vsChunkID = chunkid; vs_out.vsMaterialID = inChunkID[1]; }