I figured I may as well make a topic for this since it seems neat, at least to me.
I'm working on optimizing a triangle rasterizer for the TI84+CSE, and possibly adding some perspective math to it to get some 3 dimensional things rendering.
Initial results:
That triangle takes about 1.25 seconds to render, so clearly the code is not very optimal. There's a lot that can be done to improve speed though, so that's what I'm doing next.
Details on what I'm doing for those interested:
I calculate the barycentric coordinates for each pixel to test if it's within the triangle, and if it is I draw a red dot, otherwise I draw a white dot.
The screen is actually stored fully in ram before being copied to the LCD to simplify rendering once I remove the visible bounding box around the triangle. It's currently 136x120 pixels (1 byte per pixel), but I'm going to switch it to 128x120 so the X coordinate fits in a signed byte. The LCD is in half-res mode, and so each row is duplicated for aspect-ratio correction. I'm using the 'xLIBC' palette for the colors.
Download here if you want to see it run (code will be available later), it's not a very exciting process to watch right now though. Requires DCSE 8.1
Download
EDIT: Forgot to mention, press [CLEAR] to exit the program.
ALSO: If anyone can think of some practical uses for this, let me know. I'd like some ideas for things to do with this once it's running faster.
I'm working on optimizing a triangle rasterizer for the TI84+CSE, and possibly adding some perspective math to it to get some 3 dimensional things rendering.
Initial results:
That triangle takes about 1.25 seconds to render, so clearly the code is not very optimal. There's a lot that can be done to improve speed though, so that's what I'm doing next.
Details on what I'm doing for those interested:
I calculate the barycentric coordinates for each pixel to test if it's within the triangle, and if it is I draw a red dot, otherwise I draw a white dot.
The screen is actually stored fully in ram before being copied to the LCD to simplify rendering once I remove the visible bounding box around the triangle. It's currently 136x120 pixels (1 byte per pixel), but I'm going to switch it to 128x120 so the X coordinate fits in a signed byte. The LCD is in half-res mode, and so each row is duplicated for aspect-ratio correction. I'm using the 'xLIBC' palette for the colors.
Download here if you want to see it run (code will be available later), it's not a very exciting process to watch right now though. Requires DCSE 8.1
Download
EDIT: Forgot to mention, press [CLEAR] to exit the program.
ALSO: If anyone can think of some practical uses for this, let me know. I'd like some ideas for things to do with this once it's running faster.