Use stored inverted transposed projection model view matrix

This commit is contained in:
Abdelrahman Said 2024-09-14 18:33:39 +01:00
parent b0cebb67f8
commit db42dd3d9e

View File

@ -15,9 +15,8 @@ VertexData general_shader_vertex(void *shader, const VertexData *vert, u8 index,
shdr->vertices[index].position = project_vec4(vh);
shdr->vertices[index].uv = vert->uv;
M4x4f inv_transpose = mat4x4_inv(mat4x4_transpose(shdr->proj_mv));
V4f hnorm = V3_to_V4(vert->normal);
hnorm = mat4x4_mul_vec4(inv_transpose, hnorm);
hnorm = mat4x4_mul_vec4(shdr->proj_mv_inv_t, hnorm);
shdr->vertices[index].normal = project_vec4(hnorm);
normalise_v3(shdr->vertices[index].normal);