DX10 MD2 Loader

Started by
2 comments, last by ThrustGoblin 14 years, 10 months ago
Hi all, I have decided to make a DX10 MD2 loader, I know that this format is really old but I dont have a mesh loader at all at the moment so I think its definatly a step in the right direction. I have found a great tutorial on the MD2 loader with DX8 here: http://www.gamedev.net/reference/articles/article1653.asp Now all I want to do is update this to work with dx10, it seems from my reading not to be too much different from Dx10 except that it used DrawPrimitiveUP? I have never seen this call but doing some research it seems to be an old call. Would I be correct in say that the MD2 format contains all the verticies and the indicies required to create a vertex and index buffer? With this data I could then use that to call DrawIndexed on the data to draw the mesh? I just want an idea before I spend to much time and find out MD2 doesnt contain the right data to be brought into DX10. P.S I know MD2 is really old but I just to start somewhere before writing a more complex loader, just wanna know if it would be compatable with DX10. Thanks all.
Advertisement
It would be impossible to write a loader for any format without knowing what's in the file. So, your first step is to find a good reference for the MD2 format, if that is the format you want to work with.

Any 3D file format is going to at least have 3D positions. It is up to you, if you want to index them or not. You might have to provide some other means of providing textures and material information too.
DrawPrimitiveUP just draws vertecies directly without a vertex buffer (i.e. the vertices get passed in as an argument). But yes, the MD2 format contains everything you need to construct vertex and index buffers.
Your rendering system should not be concerned with file formats, whatsoever. It should operate on data formatted to it's own specification. That way, you can write an MD2 loader that parses out the relevant information (vertex/index data) and converts it to a data format that works with your renderer. This way, if you decide to add in support for MD3, OBJ, or whatever, you won't have to make fundamental changes to your renderer. You just need to write a new file reader.

Even if you only plan on supporting MD2s, it still makes sense to keep them decoupled, for ease of maintenance.

HTH

This topic is closed to new replies.

Advertisement