Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/graphics/importer/md3/md3_mesh.h @ 8490

Last change on this file since 8490 was 8490, checked in by patrick, 18 years ago

merged the bsp branche back to trunk

File size: 2.4 KB
Line 
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
11
12#include <string>
13
14#include "md_model_structure.h"
15
16#include "vector.h"
17
18class Material;
19
20
21namespace md3
22{
23
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
42
43  typedef struct MD3Triangle  {
44    int     vertexOffset[3];                //!< the vertex offsets of the triangles in the vertex array
45  };
46
47  typedef struct MD3Texture {
48    char    fileName[68];                   //!< the filename of the texture. path relativly to the model file
49  };
50
51  typedef struct MD3TexVecs {
52    float   textureCoord[2];                //!< the texture u/v coordinates
53  };
54
55  typedef struct MD3Normal {
56    int     vertexNormal[2];                //!< vertex normals
57  };
58
59  typedef struct MD3VertexCompressed {
60    short   vector[3];                      //!< compressed vertex information
61    unsigned char vertexNormal[2];          //!< vertex normals compressed
62  };
63
64
65
66class MD3Mesh
67{
68  public:
69    MD3Mesh();
70    virtual ~MD3Mesh();
71
72
73  public:
74    MD3MeshHeader*     header;                  //!< the header of the mesh
75
76    Material*          material;                //!< the material/textures of the models
77    MD3Triangle*       triangles;               //!< indices into mesh frames and texture coord arrays
78    MD3TexVecs*        texVecs;                 //!< tex vecs coordinates
79    sVec3D*            meshFrames;              //!< mesh frames
80    MD3Normal*         normals;                 //!< 3d array of normals with spherical coordinates giving the dir of the vertex normal
81
82};
83
84}
85
86#endif /* _MD3_MESH_H */
Note: See TracBrowser for help on using the repository browser.