Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 13, 2005, 3:40:23 PM (19 years ago)
Author:
patrick
Message:

orxonox/branches/md2_loader: reimplemente the whole md2_loader to make it more performant

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/md2_loader/src/lib/graphics/importer/md2Model.h

    r4168 r4172  
    2525
    2626//! These are the needed defines for the max values when loading .MD2 files
     27#define MD2_IDENT                       (('2'<<24) + ('P'<<16) + ('D'<<8) + 'I')
     28#define MD2_VERSION                     8
    2729#define MD2_MAX_TRIANGLES               4096
    2830#define MD2_MAX_VERTICES                2048
     
    3133#define MD2_MAX_SKINS                   32
    3234#define MD2_MAX_FRAMESIZE               (MD2_MAX_VERTICES * 4 + 128)
     35
     36#define NUM_VERTEX_NORMALS              162
     37#define SHADEDOT_QUANT                  16
    3338
    3439//! This stores the speed of the animation between each key frame - currently conflicting with the animation framework
     
    107112typedef char tMd2Skin[64];
    108113
     114
    109115//! This is a MD2 Model class
    110116class MD2Model : public AbstractModel {
     
    137143};
    138144
     145/* forward definitions */
     146class Material;
     147
     148//! This is a MD2 Model class
     149class MD2Model2 : public AbstractModel {
     150
     151public:
     152  MD2Model2();
     153  virtual ~MD2Model2();
     154 
     155  bool loadModel(const char* filename);
     156  bool loadSkin(const char* filename);
     157 
     158  void drawFrame(int frame);
     159  void draw();
     160 
     161  void setAnim(int type);
     162  void scaleModel(float scaleFactor) { this->scaleFactor = scaleFactor;}
     163
     164  void tick(float dtS);
     165
     166private:
     167  void animate(float time); 
     168  void processLighting();
     169  void interpolate(sVec3D* verticesList);
     170  void renderFrame();
     171
     172 public:
     173  /* these variables are static, because they are all the same for every model */
     174  static sVec3D anorms[NUM_VERTEX_NORMALS];
     175  static float anormsDots[SHADEDOT_QUANT][256];
     176  static sAnim animationList[21];
     177
     178 private:
     179  int numFrames;
     180  int numVertices;
     181  int numGLCommands;
     182
     183  sVec3D* pVertices;
     184  int* pGLCommands;
     185  int* pLightNormals;
     186
     187  unsigned int textureID;
     188  Material* material;
     189  sAnimState animationState;
     190  float scaleFactor;
     191};
     192
     193
    139194//! A class that handles all of the loading code
    140195class MD2Loader : public BaseObject {
Note: See TracChangeset for help on using the changeset viewer.