Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 21, 2006, 1:40:52 AM (18 years ago)
Author:
patrick
Message:

bsp: md3 model:

  • traced the segfault, animation now gets initialized probperly
  • animation code exectued

still no animations tough… gogogo

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

Legend:

Unmodified
Added
Removed
  • branches/bsp_model/src/lib/graphics/importer/md3/md3_data.cc

    r8634 r8654  
    3737MD3Data::MD3Data(const std::string& modelFileName, const std::string& skinFileName, float scale)
    3838{
    39   this->filename = filename;
     39  this->filename = modelFileName;
    4040
    4141  this->parentTagIndex = -1;
     
    4545  this->animationState.nextFrame = 1;
    4646  this->animationState.interpolationFraction = 0.0f;
     47
     48  this->animation = NULL;
    4749
    4850  this->loadModel(modelFileName);
  • branches/bsp_model/src/lib/graphics/importer/md3/md3_model.cc

    r8645 r8654  
    4444    this->bDrawBones = false;
    4545    this->bDrawNormals = false;
     46
     47    // set the animation
     48    this->interpolate(this->md3Data, this->config->getAnimation("Walk"), REWIND, true);
    4649  }
    4750
     
    9396      else
    9497        PRINTF(0)("Could not add %s\n", nameLower.c_str());
     98
    9599    }
    96100
     
    119123  void MD3Model::tick(float time)
    120124  {
     125    if(this->md3Data == NULL)
     126      return;
    121127
    122128    this->visit(this->md3Data);
    123 
    124129    this->tick(time, this->md3Data);
    125130  }
     
    243248  void MD3Model::draw() const
    244249  {
    245     PRINTF(0)("\ndraw========================\n");
    246250    //draw current bone frame
    247251    this->draw(this->md3Data);
     
    331335  void MD3Model::drawMesh(MD3Mesh* mesh, sVec3D* frame) const
    332336  {
    333     PRINTF(0)("drawMesh: %s\n", mesh->header->name);
    334337    Vector tmpVec1, tmpVec2;
    335338
     
    556559
    557560    // visit children
    558     std::map<int, MD3Data*>::iterator it = data->sortedMap.begin();
    559     while( it != data->sortedMap.end())
    560     {
    561       this->visit(it->second);
    562       it++;
    563     }
     561//     std::map<int, MD3Data*>::iterator it = data->sortedMap.begin();
     562//     while( it != data->sortedMap.end())
     563//     {
     564//       this->visit(it->second);
     565//       it++;
     566//     }
    564567  }
    565568
  • branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h

    r8644 r8654  
    5757    void tick(float dt, MD3Data* data);
    5858
     59
    5960    void drawMesh(MD3Mesh* mesh, sVec3D* frame) const;
    6061    void drawVertexNormals(sVec3D* frame, MD3Normal* normals) const;
    6162    void drawBoneFrame(MD3BoneFrame* frame) const;
     63
    6264
    6365    MD3BoneFrame* interpolateBoneFrame(MD3Data* data, MD3BoneFrame* currBoneFrame, MD3BoneFrame* nextBoneFrame, float frac);
     
    6668    float* interpolateTransformation(MD3Data* data, MD3Tag* currFrameTag, MD3Tag* nextFrameTag, float frac, int i);
    6769
     70
     71    void interpolate(MD3Data* data, MD3Animation* anim, int op, bool bInterpolate);
     72
    6873    void visit(MD3Data* data);
    69     void interpolate(MD3Data* data, MD3Animation* anim, int op, bool bInterpolate);
    7074    int next(MD3Data* data, int nr);
    7175    int prev(MD3Data* data, int nr);
Note: See TracChangeset for help on using the changeset viewer.