meshes look slightly better
This commit is contained in:
parent
651cfe8c07
commit
59937f3cd5
4
main.c
4
main.c
|
@ -429,7 +429,7 @@ fill_top_flat_triangle(rgb canvas[], rgb c, triangle2 tri)
|
|||
int32_t xl_change = cx < ax ? 1 : -1;
|
||||
|
||||
int32_t y;
|
||||
for (y = cy; y > by; y--) {
|
||||
for (y = cy-1; y > by; y--) {
|
||||
eps_r += dx_right;
|
||||
eps_l += dx_left;
|
||||
while (eps_r > 0) {
|
||||
|
@ -548,6 +548,8 @@ draw_mesh(rgb canvas[], rgb col, camera c, mesh mesh)
|
|||
v1 = mesh.vertices[mesh.indices[3*i+1]],
|
||||
v2 = mesh.vertices[mesh.indices[3*i+2]];
|
||||
|
||||
if (v0.z > c.znear && v1.z > c.znear && v2.z > c.znear) continue;
|
||||
|
||||
vec3 norm = vec3_normalize(vec3_cross(vec3_sub(v1, v0), vec3_sub(v2, v0)));
|
||||
double x = vec3_dot(vec3_sub(v0, c.pos), norm);
|
||||
|
||||
|
|
Loading…
Reference in New Issue