Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4277 in orxonox.OLD for orxonox/trunk/src


Ignore:
Timestamp:
May 24, 2005, 11:23:12 AM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: defined new datatype MD2Data to be used as data container for md2 models

Location:
orxonox/trunk/src/lib/graphics/importer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/graphics/importer/md2Model.cc

    r4276 r4277  
    2121
    2222#include <fstream>
    23 #include <string>
    24 #include <vector>
     23
    2524
    2625
     
    8382  this->numGLCommands = 0;
    8483 
    85   this->textureID = 0;
    8684  this->scaleFactor = 1.0f;
    8785
  • orxonox/trunk/src/lib/graphics/importer/md2Model.h

    r4276 r4277  
    146146
    147147
    148 
    149 //! This is a MD2 Model class
    150 class MD2Model : public AbstractModel {
    151 
    152 public:
    153   MD2Model();
    154   virtual ~MD2Model();
    155  
    156   bool loadModel(const char* filename);
    157   bool loadSkin(const char* filename);
    158  
    159   void drawFrame(int frame);
    160   void draw();
    161   void draw2();
    162  
    163   void setAnim(int type);
    164   void scaleModel(float scaleFactor) { this->scaleFactor = scaleFactor;}
    165 
    166   void tick(float dtS);
    167   void debug();
    168 
    169 
    170 private:
    171   void animate(); 
    172   void processLighting();
    173   void interpolate(sVec3D* verticesList);
    174   void renderFrame();
    175 
     148//! class to store the md2 data in
     149class MD2Data
     150{
    176151 public:
    177   /* these variables are static, because they are all the same for every model */
    178   static sVec3D anorms[NUM_VERTEX_NORMALS];
    179   static float anormsDots[SHADEDOT_QUANT][256];
    180   static sAnim animationList[21];
    181 
    182  private:
     152  MD2Data();
     153  virtual ~MD2Data();
     154
     155  bool loadModel(const char* fileName);
     156  bool loadSkin(const char* fileName);
     157
    183158  int numFrames;
    184159  int numVertices;
     
    194169  glCommandVertex* pGLCommands2;
    195170
    196   unsigned int textureID;
     171  Material* material;
     172  float scaleFactor;
     173};
     174
     175
     176//! This is a MD2 Model class
     177class MD2Model : public AbstractModel {
     178
     179public:
     180  MD2Model();
     181  virtual ~MD2Model();
     182 
     183  bool loadModel(const char* filename);
     184  bool loadSkin(const char* filename);
     185 
     186  void drawFrame(int frame);
     187  void draw();
     188  void draw2();
     189 
     190  void setAnim(int type);
     191  void scaleModel(float scaleFactor) { this->scaleFactor = scaleFactor;}
     192
     193  void tick(float dtS);
     194  void debug();
     195
     196
     197private:
     198  void animate(); 
     199  void processLighting();
     200  void interpolate(sVec3D* verticesList);
     201  void renderFrame();
     202
     203 public:
     204  /* these variables are static, because they are all the same for every model */
     205  static sVec3D anorms[NUM_VERTEX_NORMALS];
     206  static float anormsDots[SHADEDOT_QUANT][256];
     207  static sAnim animationList[21];
     208
     209 private:
     210  MD2Data* data;
     211
     212  int numFrames;
     213  int numVertices;
     214  int numTriangles;
     215  int numGLCommands;
     216  char* fileName;
     217  char* skinFileName;
     218  tMd2Header* header;
     219
     220  sVec3D* pVertices;
     221  int* pGLCommands;
     222  int* pLightNormals;
     223  glCommandVertex* pGLCommands2;
     224
    197225  Material* material;
    198226  sAnimState animationState;
Note: See TracChangeset for help on using the changeset viewer.