Loading MD2 files header

Started by
1 comment, last by programguy 22 years, 1 month ago
Ok I am working on loading a md2 file in my window. I want to do this for many programs and i want to write a header file that will load the model so i can just call the function in the main program loop. Any suggestions on doing this (should i make a class or just a custom function?) programguy
Advertisement
I''d write a class that way you don''t have to worry about keeping all the structs in order. If you wanted to have more model in the program doing it without a class would be a lot harder.

Also you can always override aspects of classes if you need to make a minor modification to the code for one model.

Just make sure you don''t make any program specific calls from inside the class.
------------------------------------------------------------I wrote the best video game ever, then I woke up...
I wrote this code a while back, modified a DX7 version for DX8 and added the vertex normal table and calculations to get lighting. Credit where credit is due, thanks to William Chin for the original code :

class CMD2
{
public:
CMD2();
BOOL LoadMD2Model( MD2MODEL *model, char *filename );
BOOL RenderMD2Model( LPDIRECT3DDEVICE8 m_pd3dDevice,
float wx, float wy, float wz, float rotation_angle,
MD2MODEL *model, LPDIRECT3DTEXTURE8 d3dtex);
void ReleaseMD2Model( MD2MODEL *model );
};

So you just call RenderMD2Model() in each render loop of your program.

Hope this helps,

Stoo.

This topic is closed to new replies.

Advertisement