Loading MD3 In DirectX
Are there any samples, tutorials, or articles on how to load MD3 models using DirectX?
Thanks
I got this tutorial from http://www.gametutorials.com .
It's in OpenGL, but that shouldn't matter much, as this is actually showing how to load the data, and not really use the API.
Hope this helps, here's a direct link: http://www.gametutorials.com/gtstore/pc-76-1-md3-file-loader.aspx
It's in OpenGL, but that shouldn't matter much, as this is actually showing how to load the data, and not really use the API.
Hope this helps, here's a direct link: http://www.gametutorials.com/gtstore/pc-76-1-md3-file-loader.aspx
Hey thanks.
Actually I've looked at this and ran into the problem since for OGL it was able to use indexed texture coordinates. I wasn't wonder if anything out there that dealt with the situation.
Actually I've looked at this and ran into the problem since for OGL it was able to use indexed texture coordinates. I wasn't wonder if anything out there that dealt with the situation.
Greetings!
If you're just having problems with coordinates you can either:
1.) Swizzle .yz coordinates (x,y,z / x,z,y / x,-z,y etc...) once it is ok... or
2.) Use the left to right or vice versa conversion matrix:
1 0 0 0
0 0 1 0
0 1 0 0
0 0 0 1
Transform any GL vertex and you get a DX vertex or vice versa.
If you're having problems organizing FVF buffers, there is no work arround, the simplest thing would be to create a vertex buffer with 3xNUMFACES of vertices and just draw it NON Indexed. You can forget HW acceleration at the beggining and just focus with correct structures with the DrawPrimitiveUP function. DrawPrimitiveUP does not even require that there has to be a vertex buffer, it just takes whatever you pass to it, for example:
struct TVertex{
float x,y,z;
float u,v;
};
TVertex* pVertices = new TVertex[numFaces*3];
device->SetFVF(D3DFVF_XYZ | D3DTEX1);
DrawPrimitiveUp(...pVertices....);
delete [] pVertices;
Once it works, you can re-arange it with to INDEXED DrawIndexedPrimitveUP and after that just change DrawPrimitveUp to DrawIndexedPrimitive and you're in hardware. Of course you will have to copy your "pVertices" to a vretex buffer. But you should mess around with that after you at least rendered your mesh.
If you're just having problems with coordinates you can either:
1.) Swizzle .yz coordinates (x,y,z / x,z,y / x,-z,y etc...) once it is ok... or
2.) Use the left to right or vice versa conversion matrix:
1 0 0 0
0 0 1 0
0 1 0 0
0 0 0 1
Transform any GL vertex and you get a DX vertex or vice versa.
If you're having problems organizing FVF buffers, there is no work arround, the simplest thing would be to create a vertex buffer with 3xNUMFACES of vertices and just draw it NON Indexed. You can forget HW acceleration at the beggining and just focus with correct structures with the DrawPrimitiveUP function. DrawPrimitiveUP does not even require that there has to be a vertex buffer, it just takes whatever you pass to it, for example:
struct TVertex{
float x,y,z;
float u,v;
};
TVertex* pVertices = new TVertex[numFaces*3];
device->SetFVF(D3DFVF_XYZ | D3DTEX1);
DrawPrimitiveUp(...pVertices....);
delete [] pVertices;
Once it works, you can re-arange it with to INDEXED DrawIndexedPrimitveUP and after that just change DrawPrimitveUp to DrawIndexedPrimitive and you're in hardware. Of course you will have to copy your "pVertices" to a vretex buffer. But you should mess around with that after you at least rendered your mesh.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement