Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 5463 was 5435, checked in by bensch, 19 years ago

orxonox/trunk: power-ups implemented (simple-mode)

File size: 4.4 KB
RevLine 
[4794]1/*
[4245]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
[4794]13   co-programmer:
[4245]14*/
15
[4794]16/*!
[5039]17 * @file abstract_model.h
[5435]18 *  Definition of an abstract model. containing all needed for other model
19 */
[4245]20
21#ifndef _ABSTRACT_MODEL_H
22#define _ABSTRACT_MODEL_H
23
24#include "base_object.h"
25
[4550]26
[4245]27using namespace std;
28
[4809]29class Quadtree;
[4245]30
31
32//! this is a small and performant 3D vector
33typedef float sVec3D[3];
34
[4467]35
[4245]36//! small and performant 2D vector
37typedef float sVec2D[2];
38
[4467]39
[4245]40//! compressed vertex data: char insetead of float, the value will be expanded by the scale value. only for loading
41typedef struct
42{
[5427]43  char             v[3];                 //!< the vector of the vertex
[4467]44  unsigned char    lightNormalIndex;     //!< the index of the light normal
[4245]45} sVertex;
46
[4467]47
[4245]48//! compressed texture offset data: coords scaled by the texture size. Only for loading
49typedef struct
50{
[4467]51  short            s;                    //!< the s,t coordinates of a texture
52  short            t;                    //!< the s,t coordinates of a texture
[4245]53} sTexCoor;
54
55
56//! holds tha informations about a md2 frame
57typedef struct
58{
[4467]59  sVec3D           scale;                //!< scales values of the model
60  sVec3D           translate;            //!< translates the model
61  char             name[16];             //!< frame name: something like "run32"
62  sVertex          pVertices[1];         //!< first vertex of thes frame
[4245]63} sFrame;
64
65
66//! holds the information about a triangle
67typedef struct
68{
[4787]69  unsigned short   indexToVertices[3];   //!< index to the verteces of the triangle
70  unsigned short   indexToTexCoor[3];    //!< index to the texture coordinates
[4245]71} sTriangle;
72
73
[4794]74//! holds the information about a triangle
75typedef struct
76{
77  unsigned int   indexToVertices[3];   //!< index to the verteces of the triangle
[4802]78  unsigned int   indexToNormals[3];    //!< index to the normals of the triangle
[4794]79  unsigned int   indexToTexCoor[3];    //!< index to the texture coordinates
80} sTriangleExt;
81
82
[4467]83//! the command list of the md2 model, very md2 specific
[4245]84typedef struct
85{
[4467]86  float            s;                    //!< texture coordinate 1
87  float            t;                    //!< texture coordinate 2
88  int              vertexIndex;          //!< index of the vertex in the vertex list
[4245]89} glCommandVertex;
90
91
92//! a md2 animation definition
93typedef struct
94{
[4467]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
[4245]98} sAnim;
99
[4467]100
[4245]101//! animation state definition
102typedef struct
103{
[4467]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)
[4245]107
[4467]108  float            localTime;            //!< the local time
109  float            lastTime;             //!< last time stamp
110  float            interpolationState;   //!< the state of the animation [0..1]
[4794]111
[4467]112  int              type;                 //!< animation type
[4245]113
[4467]114  int              currentFrame;         //!< the current frame
115  int              nextFrame;            //!< the next frame in the list
[4245]116} sAnimState;
117
[5430]118//! Model Information definitions
[4804]119typedef struct
120{
[5430]121  unsigned int     numVertices;          //!< number of Vertices in the Model
122  unsigned int     numTriangles;         //!< number of triangles in the Model
123  unsigned int     numNormals;           //!< how many Normals in the Model
[4804]124  unsigned int     numTexCoor;
125
[5430]126  const float*     pVertices;            //!< array of the Vertives
127  sTriangleExt*    pTriangles;           //!< array of all triangles
128  const float*     pNormals;             //!< array of the Normals
129  const float*     pTexCoor;             //!< array of the Texture Coordinates
[4804]130
131} modelInfo;
132
133
134
[4245]135//! This class defines the basic components of a model
136class AbstractModel : public BaseObject {
137
[4806]138  public:
139    AbstractModel() {}
140    virtual ~AbstractModel() {}
141
[5430]142    inline const modelInfo* getModelInfo() const { return this->pModelInfo; }
[4806]143
144
145  protected:
[5430]146    modelInfo*     pModelInfo;      //!< Reference to the modelInfo
[4245]147};
148
149#endif /* _ABSTRACT_MODEL_H */
Note: See TracBrowser for help on using the repository browser.