Switch to calculating z buffer from viewport vertices

This commit is contained in:
Abdelrahman Said 2024-08-17 20:27:58 +01:00
parent fdce10a85c
commit a3f0be461b

View File

@ -347,8 +347,7 @@ internal void fill_triangle(Render *render, V3f vertices[TRIANGLE_VERTICES],
} }
z = 0.0f; z = 0.0f;
z += vertices[0].z * coords.x + vertices[1].z * coords.y + z += v0.z * coords.x + v1.z * coords.y + v2.z * coords.z;
vertices[2].z * coords.z;
zbuf = get_pixel(f32, &(render->depth), x, y); zbuf = get_pixel(f32, &(render->depth), x, y);
if (z > zbuf) { if (z > zbuf) {