Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: commented the abstract_class.h right

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 <vector>
27#include <math.h>
28#include <SDL_image.h>
29
30using namespace std;
31
32
33
34//! this is a small and performant 3D vector
35typedef float sVec3D[3];
36
37
38//! small and performant 2D vector
39typedef float sVec2D[2];
40
41
42//! compressed vertex data: char insetead of float, the value will be expanded by the scale value. only for loading
43typedef struct
44{
45  byte             v[3];                 //!< the vector of the vertex
46  unsigned char    lightNormalIndex;     //!< the index of the light normal
47} sVertex;
48
49
50//! compressed texture offset data: coords scaled by the texture size. Only for loading
51typedef struct
52{
53  short            s;                    //!< the s,t coordinates of a texture
54  short            t;                    //!< the s,t coordinates of a texture
55} sTexCoor;
56
57
58//! holds tha informations about a md2 frame
59typedef struct
60{
61  sVec3D           scale;                //!< scales values of the model
62  sVec3D           translate;            //!< translates the model
63  char             name[16];             //!< frame name: something like "run32"
64  sVertex          pVertices[1];         //!< first vertex of thes frame
65} sFrame;
66
67
68//! holds the information about a triangle
69typedef struct
70{
71  short            indexToVertices[3];   //!< index to the verteces of the triangle
72  short            indexToTexCoor[3];    //!< index to the texture coordinates
73} sTriangle;
74
75
76//! the command list of the md2 model, very md2 specific
77typedef struct
78{
79  float            s;                    //!< texture coordinate 1
80  float            t;                    //!< texture coordinate 2
81  int              vertexIndex;          //!< index of the vertex in the vertex list
82} glCommandVertex;
83
84
85//! a md2 animation definition
86typedef struct
87{
88  int              firstFrame;           //!< first frame of the animation
89  int              lastFrame;            //!< last frame of the animation
90  int              fps;                  //!< speed: number of frames per second
91} sAnim;
92
93
94//! animation state definition
95typedef struct
96{
97  int              startFrame;           //!< the start frame of an animation
98  int              endFrame;             //!< last frame of the animation
99  int              fps;                  //!< fps of the animaion (speed)
100
101  float            localTime;            //!< the local time
102  float            lastTime;             //!< last time stamp
103  float            interpolationState;   //!< the state of the animation [0..1]
104 
105  int              type;                 //!< animation type
106
107  int              currentFrame;         //!< the current frame
108  int              nextFrame;            //!< the next frame in the list
109} sAnimState;
110
111
112//! This class defines the basic components of a model
113class AbstractModel : public BaseObject {
114
115 public:
116  AbstractModel() {}
117  virtual ~AbstractModel() {}
118};
119
120
121
122
123#endif /* _ABSTRACT_MODEL_H */
Note: See TracBrowser for help on using the repository browser.