I have now released version 1.4 with textures and new, rounder models for the sun, the cones, and the car's wheels.
Here's what it looks like:
The texture mapping uses linear interpolation, which isn't perspective-correct, but it's a lot faster, as it doesn't need any divisions per pixel. Because of this, textures wouldn't work well on objects that are both tilted relative to the camera and take up a lot of screen space, unless they're tesselated, so only the car is textured.
However, this is still slow (FPS drops from about 22 to 18), because texturing adds some operations per pixel.
It could be more optimized, but I think it's fast enough.
I don't plan to add any more optimizations or improvements to this game.
About the TI-84 plus CE version, I don't think it would be possible without some big changes because it doesn't seem to have enough memory for the depth buffer.
Also, here are some ideas for the renderer that I won't implement in this game (but maybe in another game if I get an idea):
- Don't use a depth buffer. Instead, use an ordering table to order triangles by their depth and draw them in the correct order. This is mostly implemented in a refactoring branch in the git repo, but the version in that branch is slow because it calls malloc hundreds of times. I think this can be fixed by allocating enough memory once and using that buffer to store the triangles in the ordering table.
- Instead of multiplying the texture color by the brightness for every pixel, store many textures for different brightness levels. This might cost too much memory though.
- Instead of checking if the texture coordinates are between 0 and 1 for every pixel, change the values used when interpolating so that they don't leave that range. Or maybe just don't texture the triangle if they would leave the range (if this only happens in triangles that aren't very visible).
- Use gouraud shading for better graphics (calculate lighting per vertex and interpolate vertex colors).
- Add detail to floors or walls efficiently using triangles with different colors.
- Only texture some parts of a model (use triangle colors where possible).