viteo/small3dlib — reverse-engineered prompt
Reverse engineered prompt
Build me a tiny public domain 3D software rasterizer library in plain C99 for low power computers and embedded devices.
I want it to be a single header, with no dependencies, no heap allocation, no floats, and only integer math by default. It should not open windows or draw to the screen itself. Instead, let the user provide a pixel callback so they can plug it into SDL, a terminal, bare metal hardware, or anything else that can draw pixels.
Please support simple triangle rendering with perspective and orthographic projection, z buffer or triangle sorting options, near plane handling, barycentric coordinates for custom texturing or shading, and compile time switches for speed versus quality. Include small example programs like hello world, a spinning cube in the terminal, and a simple PC demo. Also add Python tools to convert simple models and textures into C arrays.
Keep the code small, readable, well commented, and easy to hack on. I’m aiming for a retro PS1 style renderer that can run almost anywhere.
Want more depth? Deep Reverse