Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4163 in orxonox.OLD for orxonox/branches/md2_loader/src


Ignore:
Timestamp:
May 11, 2005, 10:30:39 AM (20 years ago)
Author:
patrick
Message:

orxonox/branches/md2_model: yea! animation now works :), orxonox now supports md2 loading and md2 animation playing. There is still a lot of work to do: cleaning up code and tie it closer to the orxonox framework

Location:
orxonox/branches/md2_loader/src
Files:
3 edited

Legend:

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

    r4162 r4163  
    9797{
    9898  /* stretch the time with animation speed (and make seconds out of it) */
    99   float t = this->dtS / (1000.0f / kAnimationSpeed);
    100        
    101   if ( unlikely(this->dtS >= (1000.0f / kAnimationSpeed)) )
     99  //float t = this->dtS / kAnimationSpeed;
     100       
     101  if ( unlikely(this->localTime*1000.0 >=  1000.0/kAnimationSpeed) )
     102    {
    102103      pModel->currentFrame = nextFrame;
    103   return t;
     104      printf("changing frame\n");
     105      this->localTime = 0.0f;
     106    }
     107  printf("t = %f\n", this->localTime);
     108  return (this->localTime/kAnimationSpeed);
    104109}
    105110
     
    109114  /* TEMP TEMP TEMP: save the current step length */
    110115  this->dtS = dtS;
     116  this->localTime += dtS;
    111117}
    112118
  • orxonox/branches/md2_loader/src/lib/graphics/importer/md2Model.h

    r4162 r4163  
    3333
    3434//! This stores the speed of the animation between each key frame - currently conflicting with the animation framework
    35 #define kAnimationSpeed                 5.0f
     35#define kAnimationSpeed                 12.0f
    3636
    3737//! This holds the header information that is read in at the beginning of the file: id software definition
     
    126126
    127127  void tick(float dtS);
    128  
     128
     129  void animate(/*float time*/ t3DModel *pModel);
    129130private:
    130   void animate(/*float time*/ t3DModel *pModel);
    131131  void processLightning();
    132132  void interpolate(CVector3* vertlist);
     
    135135
    136136  float dtS;
     137  float localTime;
    137138};
    138139
  • orxonox/branches/md2_loader/src/world_entities/test_entity.cc

    r4159 r4163  
    4545
    4646
    47 void TestEntity::tick (float time) {}
     47void TestEntity::tick (float time)
     48{
     49  this->md2Model->tick(time);
     50}
    4851
    4952
     
    7073  /* TESTGING TESTING TESTING */
    7174  this->material->select();
    72   this->md2Model->draw(this->model);
     75  //this->md2Model->draw(this->model);
     76  this->md2Model->animate(this->model);
    7377
    7478  glPopMatrix();
Note: See TracChangeset for help on using the changeset viewer.