Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8553 in orxonox.OLD for branches


Ignore:
Timestamp:
Jun 17, 2006, 3:12:52 AM (18 years ago)
Author:
patrick
Message:

bsp: md3 model drawing work, still some more work needed

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

    r8552 r8553  
    2020#include "md3_mesh.h"
    2121#include "md3_tag.h"
     22#include "md3_bone_frame.h"
    2223
    2324#include "md3_animation_cfg.h"
     
    127128      float* m = new float[16];
    128129
     130      MD3Tag* currFrameTag = data->boneFrames[data->animationState.currentFrame]->tags[child->parentTagIndex];
     131
     132      if( data->animationState.interpolationFraction != 0.0 &&
     133          data->animationState.currentFrame != data->animationState.nextFrame) {
     134        //we need to interpolate
     135        MD3Tag* nextFrameTag = data->boneFrames[data->animationState.nextFrame]->tags[child->parentTagIndex];
     136        m = this->interpolateTransformation(currFrameTag, nextFrameTag, data->animationState.interpolationFraction);
     137      }
     138      else {
     139        //no interpolation needed, stay with last transformation
     140        //OpenGL matrix is in column-major order
     141        m[0] = currFrameTag->matrix[0][0];
     142        m[1] = currFrameTag->matrix[1][0];
     143        m[2] = currFrameTag->matrix[2][0];
     144        m[3] = 0.0f;
     145        m[4] = currFrameTag->matrix[0][1];
     146        m[5] = currFrameTag->matrix[1][1];
     147        m[6] = currFrameTag->matrix[2][1];
     148        m[7] = 0.0f;
     149        m[8] = currFrameTag->matrix[0][2];
     150        m[9] = currFrameTag->matrix[1][2];
     151        m[10]= currFrameTag->matrix[2][2];
     152        m[11]= 0.0f;
     153        m[12] = currFrameTag->position.x;
     154        m[13] = currFrameTag->position.y;
     155        m[14] = currFrameTag->position.z;
     156        m[15] = 1.0f;
     157      }
    129158    }
    130 
    131159  }
    132160
     
    149177   *  interpolate bone frame
    150178   */
    151   MD3BoneFrame MD3Model::interpolateBoneFrame(MD3BoneFrame* currBoneFrame, MD3BoneFrame* nextBoneFrame, float frac)
     179  MD3BoneFrame* MD3Model::interpolateBoneFrame(MD3BoneFrame* currBoneFrame, MD3BoneFrame* nextBoneFrame, float frac)
    152180  {}
    153181
     
    174202
    175203
     204  /**
     205   * interpolate transformation
     206   */
     207  float* MD3Model::interpolateTransformation(MD3Tag* currFrameTag, MD3Tag* nextFrameTag, float frac)
     208  {}
     209
     210
    176211}
  • branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h

    r8552 r8553  
    2020class MD3BoneFrame;
    2121class MD3Mesh;
     22class MD3Tag;
     23
    2224struct MD3Normal;
    2325
     
    4850
    4951    sVec3D* interpolateMeshFrame(MD3Mesh* mesh, int startFrame, int nextMeshFrame, float frac);
    50 
    5152    MD3Normal* interpolateVertexNormals(MD3Normal* curNormals, MD3Normal* nextNormals, float frac);
    52 
     53    float* interpolateTransformation(MD3Tag* currFrameTag, MD3Tag* nextFrameTag, float frac);
    5354
    5455  private:
Note: See TracChangeset for help on using the changeset viewer.