Closed Raffaello closed 2 years ago
Clipping function, intersect method.
Clipping.cpp Lines:
when creating a new triangle the new vertex(es) doesn't have the color property and neither the normal, those 2 need to be recomputed:
the color need to be interpolated linearly from what is the color outside the screen until the point of the new inside screen vertex.
the normal it is more complicated as the adjacency list is "broken" after clipping, but the surface normal it was the same so the vertex normal should be the same too? but again like for color it will change the interpolation of the color as it will act differently as the trinagle surface will be shorter when interpolating light color.
so probably the best thing is to clipping during the raster phase for screen coordinates at least, so the interpolation will be the same but "cutted off" when reach the screen border.
perspective correction is not working ok.....
the w parameter when clipping is lost ....
fixed with interpolation, but i don't think is the right way.. better review the clipping and do it including the w parameter too.
with gouraud shading is possible to see that the vertex normal probably are not copied over.