.x file loading
I am writing a .x file parser and there is really no documentation on the file layout. I used the directx file viewer with the direct x SDK, to load this dwarf.x and it displays the model correctly. But in the .x file I don't understand a part; maybe someone can look at the problematic part in the file and point out what is going on.
open the file and goto where Dwarf_2_LOD0Mtl_maceSub5 is used as a material on the mesh, not the material declaration at the top of the file.
Now, notice in in that specific MeshMaterialList, there are 6 materials listed, and if you scroll up, you will see the index 4 used for that mesh. My problem is, why the hell are there 6 materials listed there and only one is used? index 4? Where do I use the other 6 at? Can this be explained in short over these boards? If you check the rest of the file, you will see that is the only place where those other 5 materials are used anywhere.
Here are the textures used in the model:
the .x file link works now
Your link to dwarf.x seems to be down. Could it be that those materials have been added to the model but not actually used...as in they are there in the material library so to speak but never used on the actual model?
Just use D3DXLoadMeshFromX. That way if the X file format changes you won't have to maintain your code and can rely on Microsoft's library. The less you have to maintain the better. The only time I would write my own loader is for proprietary formats and/or for much faster X file loading.
When loading the file you should get 6 D3DXMATERIAL structures. Since I cannot see the file in question I can only guess as to what is going on.
Ok, I had a w transposed with the a :P It works now.
bumpage. Still looking for an answer. And in response to using direct x's library. The reason I am writing this is so that I can control what vertex streams are created without having to let direct x make it's own, then I would have to copy them out to separate streams that can be bound at different times. Also, creating a direct x 9 reference device to load the file. There is just alot of extra fluff. I am really held up on this one specific point that doesn't make any sense and there's no damned documentation.
You can still grab the final vertex buffers from the meshes and then discard the meshes later when you don't need them.