I don't know how to do layering, can someone tell meh? I don't know how to do the calculation of the z position, can someone tell moi?
Okay. A couple of things changed. There was a mistake in the perspective, nothing much, just an incorrect sign. I swapped out the triangle filler for my own because I could (also it uses fewer variables), and I added back-face culling. I'm not sure if I'm calculating the normals correctly, but I got it working enough to be able to implement the culling. I'm almost certain the normals calculations are wrong, but I don't know how to fix them. I literally copied them from sudocode that someone put up, and I don't really understand the math behind it. I guess that's my bad :(