Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: cleaned out the abstract_model file. there where many absolete structures from the ancient md2model :)

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