Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Jun 17, 2006, 11:39:34 AM (18 years ago)
Author:
patrick
Message:

bsp: mesh interpolation finished

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

Legend:

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

    r8556 r8557  
    3939
    4040    this->tmpBoneFrame = new MD3BoneFrame();
     41    this->tmpMesh = new sVec3D[2048];          //!< the temporary mesh, hopefully newer bigger than 2048 vertices
    4142  }
    4243
     
    4647  {
    4748    delete this->tmpBoneFrame;
     49    delete [] this->tmpMesh;
    4850  }
    4951
     
    101103          data->animationState.currentFrame != data->animationState.nextFrame) {
    102104        //interpolate mesh frame between the 2 current mesh frames
    103         frame = this->interpolateMeshFrame(mesh, data->animationState.currentFrame, data->animationState.nextFrame,
    104                                            data->animationState.interpolationFraction);
     105//         frame = this->interpolateMeshFrame(mesh, data->animationState.currentFrame, data->animationState.nextFrame,
     106//                                            data->animationState.interpolationFraction);
     107        frame = this->interpolateMeshFrame( data->meshes[data->animationState.currentFrame]->meshFrames,
     108                                            data->meshes[data->animationState.nextFrame]->meshFrames,
     109                                            data->animationState.interpolationFraction, mesh);
    105110      }
    106111      else {
     
    194199
    195200  /**
     201   * draw bone frame
     202   */
     203  void MD3Model::drawBoneFrame(MD3BoneFrame* frame)
     204  {}
     205
     206
     207  /**
    196208   *  interpolate bone frame
    197209   * @param currBoneFrame Start bone frame.
     
    212224
    213225    return this->tmpBoneFrame;
    214 
    215   }
    216 
    217 
    218   /**
    219    * draw bone frame
    220    */
    221   void MD3Model::drawBoneFrame(MD3BoneFrame* frame)
    222   {}
     226  }
    223227
    224228
     
    226230   * interpolate mesh frame
    227231   */
    228   sVec3D* MD3Model::interpolateMeshFrame(MD3Mesh* mesh, int startFrame, int nextMeshFrame, float frac)
    229   {}
     232  sVec3D* MD3Model::interpolateMeshFrame(sVec3D* currMeshFrame, sVec3D* nextMeshFrame, float frac, MD3Mesh* mesh)
     233  {
     234    int vertexNum = mesh->header->vertexNum;
     235
     236    // calc interpolated vertices
     237    for( int t = 0; t < vertexNum * 3.0f; t++)
     238    {
     239      this->tmpMesh[t][0]  = (1.0f - frac)   * currMeshFrame[t][0]  + frac * nextMeshFrame[t][0];
     240      this->tmpMesh[t][1]  = (1.0f - frac)   * currMeshFrame[t][1]  + frac * nextMeshFrame[t][1];
     241      this->tmpMesh[t][2]  = (1.0f - frac)   * currMeshFrame[t][2]  + frac * nextMeshFrame[t][2];
     242    }
     243
     244    return this->tmpMesh;
     245  }
    230246
    231247
  • branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h

    r8556 r8557  
    4949    void drawBoneFrame(MD3BoneFrame* frame);
    5050
    51     sVec3D* interpolateMeshFrame(MD3Mesh* mesh, int startFrame, int nextMeshFrame, float frac);
     51    sVec3D* interpolateMeshFrame(sVec3D* currMeshFrame, sVec3D* nextMeshFrame, float frac, MD3Mesh* mesh);
    5252    MD3Normal* interpolateVertexNormals(MD3Normal* curNormals, MD3Normal* nextNormals, float frac);
    5353    float* interpolateTransformation(MD3Tag* currFrameTag, MD3Tag* nextFrameTag, float frac);
     
    6060
    6161    MD3BoneFrame*       tmpBoneFrame;      //!< a temporary bone frame
     62    sVec3D*             tmpMesh;           //!< a temportary mesh frame
    6263};
    6364
Note: See TracChangeset for help on using the changeset viewer.