Friday, December 18, 2009

DirectFitz is almost done

This is going to happen sometime over the next 2 days. All that's needed now is for me to go through the code and pick up on anything I've accidentally missed out. How many of those "accidentally"s there are will determine how long it takes.

I've had tremendous fun implementing GL_QUAD_STRIP in Direct3D (FitzQuake uses this for r_showbboxes). The OpenGL documentation could certainly be a lot better here - I was working off the basis that the documented vertex indexes were 0-based, and couldn't figure out what was going on - turns out they were 1-based all along.

Hint to OpenGL documenters - use the same array base as programming languages do, please. You're writing for programmers, and programmers don't actually care if you're technically correct according to some criteria that's irrelevant to them.

Sheesh, I know I harp on a bit about the quality of D3D documentation, but here's evidence that OpenGL ain't perfect either.


For the most part I like to try get a port as complete as possible, but this will be one where I might fall short. Two main things will likely be missing; the first will be on account of the fact that D3D8 doesn't support scissor test (although I might try to hack something up), the second will be on account of the fact that I didn't feel like bothering with implementing FitzQuake's render-to-framebuffer water (although I will need to implement the API calls used for other engines, so I might knuckle down and do it yet).
I also haven't done the stencil buffer; FitzQuake 0.85 requests a stencil buffer, clears it if it has one, but doesn't actually do anything else with it.
Polygon offset was also fun. D3D8's implementation was very basic (it would have been much better if I had used D3D9, but I wanted to retain compatibility with as much horrible old hardware as possible), just being a single Z bias factor which is only capable of biasing towards the viewer (sometimes we need to bias away from the viewer). In the end I hacked a little and set the default to the midpoint of D3D's range, thereby allowing me to bias towards or away at the expense of some range (which in practice wasn't really used).
More next time (which will hopefully be the release).

0 comments: