DO/M3D
From Dark Omen Wiki
(Difference between revisions)
Mikademus (Talk | contribs)
(New page: ''Note: this is old, partly incorrect and very incomplete information. This page will be rewritten sometime.'' ==The M3D 3D Object File Layout== The M3D format used by Dark Omen is a raw-...)
Newer edit →
Revision as of 20:33, 1 June 2008
Note: this is old, partly incorrect and very incomplete information. This page will be rewritten sometime.
The M3D 3D Object File Layout
The M3D format used by Dark Omen is a raw-data binary format to save a model consisting of a non-hierarchal array of meshes. It is intended for forward-parsing and do not contain block meta-data.
Render flags
M3D stored basic instructions on how the model is intended to be rendered in its filename.
//===================================================================== // Render flags // ------------ // // Render flags for a model are provided, believe it or not, in // the model<nowiki>’</nowiki>s filename. If the leading character is an underline // then the following is a hash for a binary attribute map where // // 00000 ( 0) = no flags // 00001 ( 1) = translucency (colour blending?) // 00010 ( 2) = animate texture UV coordinates // 00100 ( 4) = transparency (alpha blending?) // 10000 (16) = colour key transparency // // The hash depends on character // // <nowiki>’</nowiki>0<nowiki>’</nowiki>..<nowiki>’</nowiki>9<nowiki>’</nowiki>: flag <nowiki>|</nowiki>= char - 48 (==<nowiki>></nowiki> 0 .. 9) // <nowiki>’</nowiki>A<nowiki>’</nowiki>..<nowiki>’</nowiki>Z<nowiki>’</nowiki>: flag <nowiki>|</nowiki>= char - 55 (==<nowiki>></nowiki> 10 .. 35) // <nowiki>’</nowiki>a<nowiki>’</nowiki>..<nowiki>’</nowiki>z<nowiki>’</nowiki>: flag <nowiki>|</nowiki>= char - 87 (==<nowiki>></nowiki> 10 .. 35) // // The most common filename prefixes (actually, the only ones // present in Dark Omen) are: // // "_4": 00000100 (transparency) // "_6": 00000110 (transparecy and animated texture coordinates) // "_7": 00000111 (translucency, animated texture coordinates, and transparency) // "_K": 00010100 (transparency and colour keying) // //===============================================================
General layout
0 | 24 | File header | |
24 | 96 * n | Texture description | |
Sub-object description |
File header:
0 | 4 | Long | File ID |
4 | 4 | Long | Magic |
8 | 4 | Long | Version |
12 | 4 | Long | CRC |
16 | 4 | Long | NOT CRC |
20 | 2 | Short | # textures |
22 | 2 | Short | # sub-objects |
Texture description entry
0 | 64 | Char[64] | Filepath (ignored) |
64 | 32 | Char[32] | Texture filename |
3D Sub-object Description
char name[32]; // object name short parent; // parent index M3DPOINT pivot; // origin for heirarchy short vertices; // number of verts. short faces; // number of faces long flags; long spare1; long spare2;
Geometry
Geometry header List of faces List of vertices