Just done some work on DirectQ 1.8 today (when I should have been working on QRack).
It's no secret that the Q1 alias model format is horrible. It's horrible to load, horrible to work with, horrible to render from. Even it's own mother doesn't love it.
Having to work with it was the main reason why I delayed doing shadows in DirectQ for so long.
The on-disk format is obviously beyond redemption but there are things we can do with the in-memory format. I've been meaning to do this for a long time, but finally knuckled down to it on a lazy Sunday afternoon.
No more commands, no more order, no more negative vertex counts, no more not knowing anything about what you're going to draw in advance. An in-memory alias model is now a linked list of polygons, each of which contains a primitive type, numverts, an array of verts and a next pointer.
Each vert contains s, t and an index into the alias verts array. The alias verts array does not need to be pre-expanded to strips or fans, but is exactly as it comes off disk.
Side effects of this include a substantial memory saving on alias models, removal of a lot of the temporary buffers that were used to shift data around, faster loading, and an extremely clean render function (it looks quite similar to a brush poly render function now). Even the loader and structs are cleaner.
Functionally it still supports everything that the old in-memory format did, but it's far more pleasant to work with and maintain. Result I think.
Sunday, December 20, 2009
Cleaning out the Alias Model format
Posted by
mhquake
at
8:13 PM
Subscribe to:
Post Comments (Atom)
2 comments:
Sounds great :D
You need more lazy Sunday afternoons ;)
My knowledge of the mdl model format is limited aside from the basic concepts (triangles, vertices, UV maps etc).
Maybe I'll learn more as I read your blogging on this ...
Peg is right, the more idle Sundays for MH, the better.
Post a Comment