To begin with, I want to apolgogize in advance if my question has
appeared in the forums before and just slipped my attention (i DID take
a look :-)
I need some guidance on reading .X files based on templates (no premade
D3DX functions as LoadMeshFromX e.t.c)
At the time i can parse the top level children “nodes”, (and i think it
can be done recursively for any depth), but i still can’t figure out how
to read the actual data!
I haven’t found any good resources about it and I find the SDK doc a bit
confusing on the matter…
Please log in or register to post a reply.
First of all you need to get the guid of the template that is currently
being parsed. Then you lock the id3dxfiledata object and it gives you a
pointer to data (depending on the template being used).
All types can be gotten by copying “data type size” bytes from the
pointer returned by the lock operation. The only type to watch out for
is the string type which returns the address of the string in memory.
You need to take care of freeing that memory later on as well. so
pdata->lock( &sz, &data );
// stract whatever you need form data then
If you’re having trouble recursing an xfile then you can check my site
in my sig. Goto the meshes section in the tutorials section and check
the parsing and x file tutorial. The recursive framework for parsing an
xfile is all defined and explained there.
Thanx a lot!
Funny how i didn’t stumble upon your page before… :)
Very good material!