Files
HydraV3/HydraEngine/source/ShaderFiles/deferred_shader.vert
T

56 lines
1.4 KiB
GLSL
Raw Normal View History

2026-07-17 15:30:29 +01:00
#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;
2026-08-03 22:34:52 +01:00
layout(std430, binding = 1) readonly buffer positions_buffer
2026-07-17 15:30:29 +01:00
{
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];
}