Sign in to follow this  
vbisme

Loading MD3 In DirectX

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this