Index of /vectrex/draw3d
Name Last modified Size Description
Parent Directory -
Makefile 2025-06-06 10:14 699
README.txt 2025-06-06 10:14 1.3K
c2s.c 2025-06-06 10:14 14K
demo-model.h 2025-06-06 10:14 2.5K
jenny.c 2025-06-06 10:14 11K
percy.c 2025-06-06 10:14 36K
types.h 2025-06-06 10:14 3.1K
This is a 'work in progress' experiment to handle 3D perspective projection
using lookup tables rather than calculations. "jenny.c" is the generator,
and "percy.c" does the in-game perspective projection. This code currently
runs on Linux, I have not yet tested it on the Vectrex.
"c2s.c" converts from cartesian coordinates to spherical coordinates and back
again, and the Vectrex implementation will use fast 8-bit lookup tables for the
sin & cos functions. These tables are expected to use no more than 128 bytes.
Using spherical coordinates allows us to rotate 3D models around two axes
very cheaply - the cost is a single 8-bit addition per axis.
Both the perspective code and the spherical coordinate code cause some
inaccuracies in the eventual model -> screen pipeline, but so far the
maximum inaccuracy is bounded (10 Vectrex coordinate points with the mode
being 4 and the majority of errors being 6 points or fewer) which should
be acceptable for games with fast-moving 3D objects. Experiments to test
this are coming soon, and hopefully accompanied by code with tighter
constraints on the errors.
I thought I'd put what I've done so far online for the programmers in the
Vectrex forums to have a look at and maybe offer some suggestions as to the
way to go about things - whether what I've done so far makes sense and what
I should do next.