Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6222 in orxonox.OLD for trunk/src/lib/graphics/importer/md2Model.h


Ignore:
Timestamp:
Dec 21, 2005, 1:49:06 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the christmas branche to the trunk
merged with command:
svn merge -r6165:HEAD christmas_branche/ ../trunk/
no conflicts

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore set to
      Makefile.in
      Makefile
      configure
      *.kdevelop
      Doxyfile
      config.log
      config.h
      config.status
      stamp-h1
      autom4te.cache
      aclocal.m4
  • trunk/src

    • Property svn:ignore set to
      .deps
      orxonox
      Makefile
      Makefile.in

  • trunk/src/lib

    • Property svn:ignore set to
      Makefile
      Makefile.in
      .deps
      libORXlibs.a
  • trunk/src/lib/graphics

    • Property svn:ignore set to
      Makefile
      Makefile.in
      .deps
      libORX*

  • trunk/src/lib/graphics/importer

    • Property svn:ignore set to
      Makefile
      Makefile.in
      .deps
      libORX*

  • trunk/src/lib/graphics/importer/md2Model.h

    r6022 r6222  
    6565};
    6666
     67
     68//! compressed vertex data: char insetead of float, the value will be expanded by the scale value. only for loading
     69typedef struct
     70{
     71  unsigned char    v[3];                 //!< the vector of the vertex
     72  unsigned char    lightNormalIndex;     //!< the index of the light normal
     73} sVertex;
     74
     75
     76//! compressed texture offset data: coords scaled by the texture size. Only for loading
     77typedef struct
     78{
     79  short            s;                    //!< the s,t coordinates of a texture
     80  short            t;                    //!< the s,t coordinates of a texture
     81} sTexCoor;
     82
     83
     84//! holds tha informations about a md2 frame
     85typedef struct
     86{
     87  sVec3D           scale;                //!< scales values of the model
     88  sVec3D           translate;            //!< translates the model
     89  char             name[16];             //!< frame name: something like "run32"
     90  sVertex          pVertices[1];         //!< first vertex of thes frame
     91} sFrame;
     92
     93
     94//! holds the information about a triangle
     95typedef struct
     96{
     97  unsigned short   indexToVertices[3];   //!< index to the verteces of the triangle
     98  unsigned short   indexToTexCoor[3];    //!< index to the texture coordinates
     99} sTriangle;
     100
     101
     102
     103//! the command list of the md2 model, very md2 specific
     104typedef struct
     105{
     106  float            s;                    //!< texture coordinate 1
     107  float            t;                    //!< texture coordinate 2
     108  int              vertexIndex;          //!< index of the vertex in the vertex list
     109} glCommandVertex;
     110
     111
     112//! a md2 animation definition
     113typedef struct
     114{
     115  int              firstFrame;           //!< first frame of the animation
     116  int              lastFrame;            //!< last frame of the animation
     117  int              fps;                  //!< speed: number of frames per second
     118  int              bStoppable;           //!< 1 if the animation is stoppable 0 else
     119} sAnim;
     120
     121
     122//! animation state definition
     123typedef struct
     124{
     125  int              startFrame;           //!< the start frame of an animation
     126  int              endFrame;             //!< last frame of the animation
     127  int              fps;                  //!< fps of the animaion (speed)
     128
     129  float            localTime;            //!< the local time
     130  float            lastTime;             //!< last time stamp
     131  float            interpolationState;   //!< the state of the animation [0..1]
     132
     133  int              type;                 //!< animation type
     134
     135  int              currentFrame;         //!< the current frame
     136  int              nextFrame;            //!< the next frame in the list
     137  int              numPlays;             //!< the number of times, this has been played in series
     138} sAnimState;
    67139
    68140
     
    143215  virtual ~MD2Model();
    144216
    145   void draw();
     217  virtual void draw() const;
     218  void renderFrameTriangles() const;
     219
    146220
    147221  void setAnim(int type);
    148   /**
    149    *  scales the current model
    150    * @param scaleFactor: the factor [0..1] to use for scaling
    151   */
     222  /**  returns the current animation @returns animation type */
     223  inline int MD2Model::getAnim() { return this->animationState.type; }
     224  /**  scales the current model @param scaleFactor: the factor [0..1] to use for scaling */
    152225  void scaleModel(float scaleFactor) { this->scaleFactor = scaleFactor;}
    153226
    154   void tick(float dtS);
     227  virtual void tick(float dtS);
    155228  void debug();
    156229
    157230
    158231private:
    159   void animate();
     232  void animate(float time);
    160233  void processLighting();
    161   void interpolate(sVec3D* verticesList);
    162   void renderFrame();
     234  void interpolate(/*sVec3D* verticesList*/);
     235  void renderFrame() const ;
    163236
    164237
     
    168241  static float        anormsDots[SHADEDOT_QUANT][256];  //!< the anormals dot products
    169242  static sAnim        animationList[21];                //!< the anomation list
     243   //! again one of these strange id software parts
     244  float*              shadeDots;
    170245
    171246  MD2Data*            data;                             //!< the md2 data pointer
     
    174249  float               scaleFactor;                      //!< the scale factor (individual)
    175250  sAnimState          animationState;                   //!< animation state of the model
     251  sVec3D              verticesList[MD2_MAX_VERTICES];   //!< place to temp sav the vert
    176252};
    177253
Note: See TracChangeset for help on using the changeset viewer.