Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/lib/graphics/importer/abstract_model.h @ 4550

Last change on this file since 4550 was 4550, checked in by patrick, 19 years ago

orxonox/trunk: draw functions and some sVec3D issues

File size: 3.4 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    \brief 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#include <math.h>
27
28
29using namespace std;
30
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  short            indexToVertices[3];   //!< index to the verteces of the triangle
71  short            indexToTexCoor[3];    //!< index to the texture coordinates
72} sTriangle;
73
74
75//! the command list of the md2 model, very md2 specific
76typedef struct
77{
78  float            s;                    //!< texture coordinate 1
79  float            t;                    //!< texture coordinate 2
80  int              vertexIndex;          //!< index of the vertex in the vertex list
81} glCommandVertex;
82
83
84//! a md2 animation definition
85typedef struct
86{
87  int              firstFrame;           //!< first frame of the animation
88  int              lastFrame;            //!< last frame of the animation
89  int              fps;                  //!< speed: number of frames per second
90} sAnim;
91
92
93//! animation state definition
94typedef struct
95{
96  int              startFrame;           //!< the start frame of an animation
97  int              endFrame;             //!< last frame of the animation
98  int              fps;                  //!< fps of the animaion (speed)
99
100  float            localTime;            //!< the local time
101  float            lastTime;             //!< last time stamp
102  float            interpolationState;   //!< the state of the animation [0..1]
103 
104  int              type;                 //!< animation type
105
106  int              currentFrame;         //!< the current frame
107  int              nextFrame;            //!< the next frame in the list
108} sAnimState;
109
110
111//! This class defines the basic components of a model
112class AbstractModel : public BaseObject {
113
114 public:
115  AbstractModel() {}
116  virtual ~AbstractModel() {}
117};
118
119
120
121
122#endif /* _ABSTRACT_MODEL_H */
Note: See TracBrowser for help on using the repository browser.