[8342] | 1 | /*! |
---|
| 2 | * @file md3_mesh.h |
---|
| 3 | * |
---|
| 4 | * Code heavely inspired by: JAVA MD3 Model Viewer - A Java based Quake 3 model viewer |
---|
| 5 | * Copyright (C) 1999 Erwin 'KLR8' Vervaet |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #ifndef _MD3_MESH_H |
---|
| 9 | #define _MD3_MESH_H |
---|
| 10 | |
---|
[8348] | 11 | |
---|
| 12 | #include <string> |
---|
| 13 | |
---|
| 14 | #include "md_model_structure.h" |
---|
| 15 | |
---|
| 16 | #include "vector.h" |
---|
| 17 | |
---|
[8418] | 18 | class Material; |
---|
[8351] | 19 | |
---|
[8418] | 20 | |
---|
[8351] | 21 | namespace md3 |
---|
| 22 | { |
---|
| 23 | |
---|
[8374] | 24 | typedef struct MD3MeshHeader { |
---|
| 25 | |
---|
| 26 | int id; //!< individual id, must be IDP3 |
---|
| 27 | char name[68]; //!< the name of the mesh |
---|
| 28 | |
---|
| 29 | int meshFrameNum; //!< numbers of frames |
---|
| 30 | int textureNum; //!< numbers of textures |
---|
| 31 | int vertexNum; //!< numbers of verteces |
---|
| 32 | int triangleNum; //!< number of triangles |
---|
| 33 | |
---|
| 34 | int triangleStart; //!< triangle start offset |
---|
| 35 | int textureStart; //!< texture start offset |
---|
| 36 | int texVecStart; //!< tex vec start offset |
---|
| 37 | int vertexStart; //!< vertex start offset |
---|
| 38 | |
---|
| 39 | int meshSize; //!< total mesh size |
---|
| 40 | }; |
---|
| 41 | |
---|
[8416] | 42 | |
---|
| 43 | typedef struct MD3Triangle { |
---|
[8420] | 44 | int vertexOffset[3]; //!< the vertex offsets of the triangles in the vertex array |
---|
[8416] | 45 | }; |
---|
| 46 | |
---|
[8418] | 47 | typedef struct MD3Texture { |
---|
[8420] | 48 | char fileName[68]; //!< the filename of the texture. path relativly to the model file |
---|
[8418] | 49 | }; |
---|
[8416] | 50 | |
---|
[8420] | 51 | typedef struct MD3TexVecs { |
---|
| 52 | float textureCoord[2]; //!< the texture u/v coordinates |
---|
| 53 | }; |
---|
[8418] | 54 | |
---|
[8423] | 55 | typedef struct MD3Normal { |
---|
| 56 | int vertexNormal[2]; //!< vertex normals |
---|
| 57 | }; |
---|
[8420] | 58 | |
---|
[8423] | 59 | typedef struct MD3VertexCompressed { |
---|
| 60 | short vector[3]; //!< compressed vertex information |
---|
| 61 | unsigned char vertexNormal[2]; //!< vertex normals compressed |
---|
| 62 | }; |
---|
| 63 | |
---|
| 64 | |
---|
| 65 | |
---|
[8342] | 66 | class MD3Mesh |
---|
| 67 | { |
---|
| 68 | public: |
---|
[8372] | 69 | MD3Mesh(); |
---|
[8343] | 70 | virtual ~MD3Mesh(); |
---|
[8342] | 71 | |
---|
| 72 | |
---|
[8374] | 73 | public: |
---|
| 74 | MD3MeshHeader* header; //!< the header of the mesh |
---|
[8342] | 75 | |
---|
[8418] | 76 | Material* material; //!< the material/textures of the models |
---|
[8416] | 77 | MD3Triangle* triangles; //!< indices into mesh frames and texture coord arrays |
---|
[8420] | 78 | MD3TexVecs* texVecs; //!< tex vecs coordinates |
---|
[8724] | 79 | sVec3D** meshFrames; //!< mesh frames |
---|
| 80 | MD3Normal** normals; //!< 3d array of normals with spherical coordinates giving the dir of the vertex normal |
---|
[8418] | 81 | |
---|
[8342] | 82 | }; |
---|
| 83 | |
---|
[8351] | 84 | } |
---|
[8342] | 85 | |
---|
| 86 | #endif /* _MD3_MESH_H */ |
---|