This was the most complicated task of the entire wrapper Puh, done ! All who are still here please raise up your hands. vertex.z = out->verts.v * out->scale + out->translate vertex.y = out->verts.v * out->scale + out->translate M_frame_list = new make_frame_list įor( int j = 0 j verts.v * out->scale + out->translate Create some variables according to the header Here we free up the memory to avoid leaksįor( int i = 0 i verts ![]() Inline int GetFrameCount() OK, let's implement the functions we've just declared! public means everyone can access the following values Private means that only functions from CMD2Modell can access You can alter the values if you like to. Of course, this still isn't enough to actually read a MD2 model. std::vector is declared in "vector" and it is a comfortable wrapper for dynamic arrays #define D3DFVF_MODELVERTEX ( D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE2(0) ) This is the definition for the vertex declared above (FVF=flexible vertex format) ![]() Int num_frames //Numer of frames/animations within the fileĭ3DXVECTOR2 m_vecTex //texturecoordinates Here all information for the model is saved. The only variably which is important for us is "name", it is filled with the names You don't have to know everything, you just have to know where to find it. I won't explain all structs, they are used _once_ for loading the model. You need alot of structs to import a Quake model: Okay, enough talk, it's time to write our own MD2 loader! There are also a lot of web pages offering many MD2 models for download (see the links section). (Half-Life does this.)īut the advantage of MD2 is that it is very easy to use and import it can be used by almost every game without great problems. It is not skeleton based, which means it is impossible (or very difficult) to turn, for example, the head independently from the body. As the MD2 format is a little bit old it has some restrictions/disadvantages. Quake's game models are available in the MD2 Format which can be imported easily using your own converter! Yeah!Īn MD2 File basically consists of a big list of triangles which then "form" the animation. The solution lies in Quake, Quake II to be specific. If you've made the mistake of looking at the DirectX SDK sample "skinned mesh", you may have even ended up so astonished by the complexity of it that you gave up and took on an easier task instead.īut importing a model can be easier than in the DirectX sample. It is not that easy to import animated objects into a game. If you're like me, that would be the point where you had your first big problems. ![]() Who hasn't had this problem? You've read (and understood) some tutorials on 3D game programming, and you want to create your own mega-seller with great outdoor worlds, greattextures, a unique AI and scary monsters. Target audience : Intermediate Direct3D8 programmerĭownload : Demo Project (see attached resource file) Content : Importing and animating a Quake2 MD2 model
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |