X file format parsing question: need help!

Started by
1 comment, last by DXnut 18 years ago
Hi everybody, I'm working on a X file loader that uses the ID3DXFile & ID3DXFileData helpers. I'm not using the D3DXMesh functions because I need to load these into my custom mesh class. I got everything working except the normals which I find to be akwardly defined in the MeshNormals template. For some reason, it defines the normals with a new set of faces and a set of normals which basically invalidates the positions/texcoords/color buffers I had loaded previously because all these other components use another, but common, index buffer (faces). Now I tried solving the problem: I "unindexed" my verts and the normals using their respective faces info and then I rebuilt a new common set of faces but that's slow as hell and I didn't get it to work perfectly yet. So, before I start going down the path of finalizing this solution and optimizing it for cache-coherency in the hope of speeding it up, my question is: is there something I'm missing? Looks like this is getting all very dumb but I don't see any other way! I wish there was a way to "merge" the faces without "unindexing" them. Thanks! [Edited by - bios10h on March 26, 2006 10:33:03 PM]
Advertisement
Bumping up! I really would appreciate some advice on this one.

Thanks!
I would use the D3DX function to load the mesh data (vertex and index buffers) and ID3DXFile to load any other stuff. Let DX figure out how to build those. You can always extract the data in those buffers from the ID3DXMesh interface. For my mesh modeler program I load everything using the D3DXLoadMeshHierarchyFromX function and then use ID3DXFile to load the animation data into my own classes.

However, I think you can ignore the face index data stored with the normals, and use the data stored with the mesh.
--------------------------Most of what I know came from Frank D. Luna's DirectX books

This topic is closed to new replies.

Advertisement