Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: now will take array indexes directly from the ModelFaceElement, Array::getIndex(…) not used but I will keep it, since its a good thing to have

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