@richard
I was actually curious what that looked like, I spent an hour trying to find all the native implementations but got lost in the nest. With my current shaded triangle, I tried replacing my setpixel with the native one and it halved my framerate, but maybe I can find a clever way to use the native line drawer instead of ever touching setpixel. This is what my implementation looks like right now
I replaced my array of buffers with a single buffer of size 19200 that contains the color for every pixel on the screen. I use math to set it at the correct location, assuming the center of the screen is 0,0 (more or less). Then this is what my update loop looks like
I don’t intend on storing points like this in the long run, though I haven’t decided definitively how I’d like to. I know each {} allocation is pretty hefty per @mmoskal’s post in the MakeCode Kart thread
As I mentioned in my response to @kwx, I also intend on removing the function calls and placing the code directly into my update loop, to remove a little bit of overhead. I have them separate for now for convenience. I’ve also done my best to avoid floating point math where possible, but I’m sure there are a few equations sneaking around that I’ve missed.
Here’s the shaded triangle code I have right now, as I’m starting the perspective projection code.
A toggles wireframe, B randomized point locations and h values