My second Triangle rasterizer and this one is EPIC in performance when I test this in my 3D engine I get like double the performance and the reason why is because I did some research into triangle rasterization and came across that there's two methods of what I know which is Point in triangle or Scanline. https://turbowarp.org/1266340510?fps=60 ------------------------------------------The method This triangle rasterizer uses the Scanline method since the scanline method is better suited to the CPU which scratch runs on but the point in triangle can be more effiecient if you can use the GPU since GPU's nowadays are optimized to run that method better and you can also run it parallel. --------------------------------------Flaws Despite this being a 2x times increase in speed from the version 1 which ran on the Point in triangle method I really only coded this for function as proof in concept with only the formulas go off by I bet you can make this run 25 percent faster if your smart enough to make cuz at the start it culculates the start and end of each line before drawing since I have like no braincells left I cant figure out how to make culculating it on the spot work and I spent 2 hour trying to figure out and still failed :C also the most annoying problem with this is bigger triangles are slower to render so yeah although there are ways to make them not so slow which seem good on paper because I haven't tried them yet. ---------------------------------------Use Well you could use this for your 3D engine although you need make sure it has a position limit on it tho like the renderer wont try to draw triangles bigger then the scratch screen. And the other reason is well, am not sure. And I will for sure be making a V3
I made this all by myself without help except formulas and that's it so this can for sure be more optimized also on a side note I am documenting my 3d engine like every stage I go through it on Youtube but it will take time for me to finish my first video on it.