More 3D graphics

After the teapot wireframe, I moved forward to the next steps of rendering:

https://github.com/marianodominguez/3d_graphics_prog/blob/main/teapot/src/teapot_03.c


Face culling

Once I got the Bezier patch, I can calculate the normal in the current vertex:

 n = normalize(cross(v0, v1));

where v0 and v1 are the sides of the triangle in the patch

https://github.com/marianodominguez/3d_graphics_prog/blob/main/teapot/src/teapot_04.c


This gets rid of most faces, but we can see handler would need more logic to hide them.

We can apply the light model to each face, have some flat shading.

https://github.com/marianodominguez/3d_graphics_prog/blob/main/teapot/src/teapot_06.c


Interpolating the values across the vertices, we can get to Goraud shading. If we interpolate the normals, we then are doing Phong shading.

https://github.com/marianodominguez/3d_graphics_prog/blob/main/teapot/src/teapot_07.c


Once we have Z-buffer implemented. The handler and lid show correctly.

https://github.com/marianodominguez/3d_graphics_prog/blob/main/teapot/src/teapot_08.c