Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/2d-recalc/src/lib/graphics/importer/abstract_model.h @ 5855

Last change on this file since 5855 was 5280, checked in by bensch, 19 years ago

orxonox/trunk: remove unused stuff

File size: 4.2 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   ### File Specific:
12   main-programmer: Patrick Boenzli
13   co-programmer:
14*/
15
16/*!
17 * @file abstract_model.h
18  *  Definition of an abstract model. containing all needed for other model
19*/
20
21#ifndef _ABSTRACT_MODEL_H
22#define _ABSTRACT_MODEL_H
23
24#include "stdincl.h"
25#include "base_object.h"
26
27
28using namespace std;
29
30class Quadtree;
31
32
33//! this is a small and performant 3D vector
34typedef float sVec3D[3];
35
36
37//! small and performant 2D vector
38typedef float sVec2D[2];
39
40
41//! compressed vertex data: char insetead of float, the value will be expanded by the scale value. only for loading
42typedef struct
43{
44  byte             v[3];                 //!< the vector of the vertex
45  unsigned char    lightNormalIndex;     //!< the index of the light normal
46} sVertex;
47
48
49//! compressed texture offset data: coords scaled by the texture size. Only for loading
50typedef struct
51{
52  short            s;                    //!< the s,t coordinates of a texture
53  short            t;                    //!< the s,t coordinates of a texture
54} sTexCoor;
55
56
57//! holds tha informations about a md2 frame
58typedef struct
59{
60  sVec3D           scale;                //!< scales values of the model
61  sVec3D           translate;            //!< translates the model
62  char             name[16];             //!< frame name: something like "run32"
63  sVertex          pVertices[1];         //!< first vertex of thes frame
64} sFrame;
65
66
67//! holds the information about a triangle
68typedef struct
69{
70  unsigned short   indexToVertices[3];   //!< index to the verteces of the triangle
71  unsigned short   indexToTexCoor[3];    //!< index to the texture coordinates
72} sTriangle;
73
74
75//! holds the information about a triangle
76typedef struct
77{
78  unsigned int   indexToVertices[3];   //!< index to the verteces of the triangle
79  unsigned int   indexToNormals[3];    //!< index to the normals of the triangle
80  unsigned int   indexToTexCoor[3];    //!< index to the texture coordinates
81} sTriangleExt;
82
83
84//! the command list of the md2 model, very md2 specific
85typedef struct
86{
87  float            s;                    //!< texture coordinate 1
88  float            t;                    //!< texture coordinate 2
89  int              vertexIndex;          //!< index of the vertex in the vertex list
90} glCommandVertex;
91
92
93//! a md2 animation definition
94typedef struct
95{
96  int              firstFrame;           //!< first frame of the animation
97  int              lastFrame;            //!< last frame of the animation
98  int              fps;                  //!< speed: number of frames per second
99} sAnim;
100
101
102//! animation state definition
103typedef struct
104{
105  int              startFrame;           //!< the start frame of an animation
106  int              endFrame;             //!< last frame of the animation
107  int              fps;                  //!< fps of the animaion (speed)
108
109  float            localTime;            //!< the local time
110  float            lastTime;             //!< last time stamp
111  float            interpolationState;   //!< the state of the animation [0..1]
112
113  int              type;                 //!< animation type
114
115  int              currentFrame;         //!< the current frame
116  int              nextFrame;            //!< the next frame in the list
117} sAnimState;
118
119
120typedef struct
121{
122  unsigned int     numVertices;
123  unsigned int     numTriangles;
124  unsigned int     numNormals;
125  unsigned int     numTexCoor;
126
127  const float*     pVertices;
128  sTriangleExt*    pTriangles;
129  const float*     pNormals;
130  const float*     pTexCoor;
131
132} modelInfo;
133
134
135
136//! This class defines the basic components of a model
137class AbstractModel : public BaseObject {
138
139  public:
140    AbstractModel() {}
141    virtual ~AbstractModel() {}
142
143    inline modelInfo* getModelInfo() const { return this->pModelInfo; }
144
145
146  protected:
147    modelInfo*     pModelInfo;      //!< Reference to the modelInfo defined in abstract_model.h
148    Quadtree*      quadtreel;       //!< Reference to the quadtree of the object, NULL if not defined
149};
150
151
152
153
154
155#endif /* _ABSTRACT_MODEL_H */
Note: See TracBrowser for help on using the repository browser.