string - nul terminated byte setshort - 2 byteint - 4 bytefloat - 4 byte<root> <version 0x0002> int version; </version> <editor3d 0x3d3d> <meshversion 0x3d3e> int meshversion; </meshversion> <editmaterial 0xafff> // look below </editmaterial> <editobject 0x4000> string objectname; // look below </editobject> </editor3d></root>
edit material chunk (0xafff)
<editmaterial 0xafff> <materialname 0xa000> string materialname; </materialname> <shininesspercent 0xa040> // either a 0x0030 or 0x0031 chunk <percentint 0x0030> int percent; </percentint> <percentfloat 0x0030> int percent; </percentfloat> </shininesspercent> <transparencypercent 0xa050> // either a 0x0030 or 0x0031 chunk <percentint 0x0030> int percent; </percentint> <percentfloat 0x0030> int percent; </percentfloat> </transparencypercent> <texturemap1 0xa200> <texturesource 0xa300> string imagesrc; </texturesource> </texturemap1> <texturemap2 0xa200> <texturesource 0xa300> string imagesrc; </texturesource> </texturemap2></editmaterial>
edit object chunk (0x4000)
<editobject 0x4000> string objectname; // these child chunks, decide what this object is <trianglemesh 0x4100> // objects transform matrix (4x3 - last row is 0 0 0 1) <localcoordinatesystemmatrix 0x4160> // 12 floats - go figure float x00; float x01; ... </localcoordinatesystemmatrix> <vertexlist 0x4110> short numberofvertices; float x; float y; float z; // ... repeat numberofvertices times; </vertexlist> <texturecoordlist> short numberoftexcoords; float u; float v; // ... repeat numberoftexcoords times </texturecoordlist> <facelist> short numberoffaces; float va; // index to vertex array float vb; float vc; // ... repeat numberoffaces times <facesmaterials 0x4130> string materialname; short numberoffaces; short face; // ... repeat numberoffaces times </facesmaterials> </facelist> </trianglemesh> <light 0x4600> float x; float y; float z; /* finding this means this is a spotlight not an omni */ <spotlight 0x4610> float targetx; float targety; float targetz; </spotlight> </light> <camera 0x4700> // i am going to ignore this </camera></editobject>
also note that multiple objects exist as multiple editobject chunks, not multiple trianglemesh chunks (which is why objectname is in editobject chunk).
These are the things we will be parsing.
So, here in a list as well -
- lights
- materials
- meshes
- (im considering doing fog support)
And things it will not support
- camera's
- keyframing info
also note that the parser stores scene info internally using stl as it is a parser NOT a renderer (the info is meant to be read into the scenegraph, not used in the scenegraph).
[Edited by - Genjix on April 16, 2005 12:35:49 PM]