# README
000 - Simple
Rendering a model with colored triangles. Simple as that.
A basic vertex pipeline that performs the following operations on Suzanne:
- Transforms
suzanne.vertices
from Local Space -> Clip Space into aclip_vertices
buffer. - Iterates
suzanne.triangles
, discarding any with a vertex that is out of bounds. a. For simplicity I won't be clipping triangles for now. - Transforms the triangle from Clip Space -> Normalized Device Coordinates (NDC)
- Performs back-face culling on the triangle, discards back faces.
- If front facing: Transforms NDC to Screen Space and appends the screen space data to
screen_triangles
andscreen_vertices
respectively. a.screen_triangles
is used for a simple depth sort and pointing to the first vertex of this triangle. - Sort the
screen_triangles
slice based on the triangle'saverage_z
in screen space. - Iterate each
screen_triangle
and populateindices
andvertices
with data fromscreen_vertices
to be used withscreen.DrawTriangles
. - Done!