ADD: Normal mapping

This commit is contained in:
2025-11-01 17:32:14 +09:00
parent d5ff6263ee
commit fbc937974d
28 changed files with 2802 additions and 264 deletions

View File

@@ -9,6 +9,7 @@ layout (location = 0) out vec3 outNormal;
layout (location = 1) out vec3 outColor;
layout (location = 2) out vec2 outUV;
layout (location = 3) out vec3 outWorldPos;
layout (location = 4) out vec4 outTangent; // xyz: world tangent, w: sign
struct Vertex {
@@ -17,6 +18,7 @@ struct Vertex {
vec3 normal;
float uv_y;
vec4 color;
vec4 tangent;
};
layout(buffer_reference, std430) readonly buffer VertexBuffer{
@@ -38,6 +40,8 @@ void main()
gl_Position = sceneData.viewproj * worldPos;
outNormal = (PushConstants.render_matrix * vec4(v.normal, 0.f)).xyz;
vec3 worldTangent = (PushConstants.render_matrix * vec4(v.tangent.xyz, 0.f)).xyz;
outTangent = vec4(normalize(worldTangent), v.tangent.w);
// Pass pure vertex color; apply baseColorFactor only in fragment
outColor = v.color.xyz;
outUV.x = v.uv_x;