Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8638 in orxonox.OLD for branches/bsp_model/src/lib/graphics


Ignore:
Timestamp:
Jun 20, 2006, 5:04:15 PM (18 years ago)
Author:
patrick
Message:

bsp: md3 more md3 animation stuff

Location:
branches/bsp_model/src/lib/graphics/importer/md3
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/bsp_model/src/lib/graphics/importer/md3/md3_bone_frame.h

    r8490 r8638  
    66 */
    77
    8 #ifndef _MD3_ANIMATION_H
    9 #define _MD3_ANIMATION_H
     8#ifndef _MD3_BONE_FRAME_ANIMATION_H
     9#define _MD3_BONE_FRAME_ANIMATION_H
    1010
    1111#include "vector.h"
     
    5151}
    5252
    53 #endif /* _MD3_ANIMATION_H */
     53#endif /* _MD3_BONE_FRAME_ANIMATION_H */
  • branches/bsp_model/src/lib/graphics/importer/md3/md3_data.h

    r8634 r8638  
    4040  class MD3Mesh;
    4141  class MD3Normal;
     42  class MD3Animation;
    4243
    4344  //! This holds the header information that is read in at the beginning of the file: id software definition
     
    118119      float**                   tmpMatrix;         //!< a temporary matrix
    119120
     121
     122     /* the animation part */
     123     MD3Animation*              animation;         //!< animation
     124     int                        op;                //!< the current operation
     125     int                        upperBound;        //!< the upper bound
     126     bool                       bInterpolate;      //!< interpolate the frames
    120127  };
    121128
  • branches/bsp_model/src/lib/graphics/importer/md3/md3_model.cc

    r8637 r8638  
    2121#include "md3_tag.h"
    2222#include "md3_bone_frame.h"
     23#include "md3_animation.h"
    2324
    2425#include "md3_animation_cfg.h"
     
    547548   * @param interpolate Should interpolation be done?
    548549   */
    549   void MD3Model::interpolate(MD3Data* data, MD3Animation* anim, int op, bool interpolate)
    550   {
    551 
    552 // //     data->
    553 //     this.anim=anim;
    554 //     if( op == NEXT || op == PREVIOUS || op == REWIND)
    555 //       this.op=op;
    556 //
    557 //     this.interpolate=interpolate;
     550  void MD3Model::interpolate(MD3Data* data, MD3Animation* anim, int op, bool bInterpolate)
     551  {
     552     data->animation = anim;
     553     if( data->op == NEXT || data->op == PREVIOUS || data->op == REWIND)
     554      data->op = op;
     555
     556     data->bInterpolate = bInterpolate;
    558557  }
    559558
     
    562561   * calc next frame number
    563562   */
    564   int MD3Model::next(int nr)
    565   {
    566 #if 0
    567     if( nr < (upperBound-1))
    568       return nr+1;
     563  int MD3Model::next(MD3Data* data, int nr)
     564  {
     565    if( nr < (data->upperBound - 1))
     566      return nr + 1;
    569567    else
    570568    { //rewind needed
    571       if( anim.num < 0)
    572         return anim.first;
     569      if( data->animation->numFrames < 0)
     570        return data->animation->first;
    573571      else {
    574         nr = (anim.looping != 0)?(anim.num - anim.looping):0;
    575         return anim.first + nr;
    576       }
    577     }
    578 #endif
     572        nr = (data->animation->numLoopFrames != 0)?(data->animation->numFrames - data->animation->numLoopFrames):0;
     573        return data->animation->first + nr;
     574      }
     575    }
    579576  }
    580577
     
    583580   * calc prev frame number
    584581   */
    585   int MD3Model::prev(int nr)
     582  int MD3Model::prev(MD3Data* data, int nr)
    586583  {
    587584#if 0
     
    597594   * apply the specified operation to the animation state data members of the model
    598595   * taking the specified animation into account
     596   *
     597   * @param data: the data of the model
    599598   */
    600599  void MD3Model::doOp(MD3Data* data)
  • branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h

    r8637 r8638  
    1313
    1414
     15#define FRACTION 0.34f
     16
     17
    1518namespace md3
    1619{
     
    2528
    2629struct MD3Normal;
     30
     31
     32typedef enum MD3FrameHandling {
     33  NEXT = 0,          //!< swith to the next frame
     34  PREVIOUS,          //!< swith to the previous frame
     35  REWIND             //!< rewind the animation
     36};
    2737
    2838
     
    5666    float* interpolateTransformation(MD3Data* data, MD3Tag* currFrameTag, MD3Tag* nextFrameTag, float frac, int i);
    5767
    58     void interpolate(MD3Data* data, MD3Animation* anim, int op, bool interpolate);
    59     int next(int nr);
    60     int prev(int nr);
     68    void interpolate(MD3Data* data, MD3Animation* anim, int op, bool bInterpolate);
     69    int next(MD3Data* data, int nr);
     70    int prev(MD3Data* data, int nr);
    6171    void doOp(MD3Data* data);
    6272
     
    7080    MD3AnimationCfg*    config;            //!< the config file parsed
    7181
     82};
    7283
    73 };
    7484
    7585}
Note: See TracChangeset for help on using the changeset viewer.