3D Wireframe Rotation dreams…
So I’d really like to be able to rotate 3D objects using this computer. There’s some problems though that make it a little harder than normal.
- The 68000 doesn’t have any integrated Floating Point Unit(FPU) integrated. What this means is that it “speaks” just integers, and there are no associated instructions for natively multiplying floats, for instance. There also isn’t one on my board.
- 3D coordinates use floating point numbers extensively. Many associated 3D functions need to operate on those numbers.
- I have no C toolchain. No C toolchain means that SOFTWARE support for floating point really doesn’t exist either. There aren’t exactly 68000 ready to go FP routines, but they could likely be ported from other OS’s like Mac or Amiga.
I’ve got a few ideas on how to solve this one:
- I think I’m going to use fixed point numbers. This definitely simplifies things.
- I’ll use one 16-bit integer to store the first part to the left of the decimal point, which I’m sure has a fancy name I don’t know. I looked at some .OBJ files and usually that portion of the x,y,z coordinate seems to be low numbers……like 0, 1, 2, or 45. I’ll have 65536 which is plenty.
- I’ll also use one 16-bit integer to store the part the right of the decimal point, the fractional part. This gives me 1/65536 = .000015259 granularity. Sounds good at first glance? Let’s walk before we run.
- I’ll need a set of basic math functions like multiplication and addition for these numbers.
- In order to do 3d transformations and 3d->2d projection, you need to do matrix math, including matrix multiplication. I plan using orthogonal projection, which I think is the easiest.
- I need to understand if the 68000 is going to be too slow at some parts of this, and whether I need to create custom Verilog hardware to speed it up.
Do you have any experience on using fixed point math to do 3d graphics on non-FPU computers? Does my approach sound reasonable?
Let me know in the comments!