- Timestamp:
- Jun 17, 2006, 3:12:52 AM (18 years ago)
- 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 20 20 #include "md3_mesh.h" 21 21 #include "md3_tag.h" 22 #include "md3_bone_frame.h" 22 23 23 24 #include "md3_animation_cfg.h" … … 127 128 float* m = new float[16]; 128 129 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 } 129 158 } 130 131 159 } 132 160 … … 149 177 * interpolate bone frame 150 178 */ 151 MD3BoneFrame MD3Model::interpolateBoneFrame(MD3BoneFrame* currBoneFrame, MD3BoneFrame* nextBoneFrame, float frac)179 MD3BoneFrame* MD3Model::interpolateBoneFrame(MD3BoneFrame* currBoneFrame, MD3BoneFrame* nextBoneFrame, float frac) 152 180 {} 153 181 … … 174 202 175 203 204 /** 205 * interpolate transformation 206 */ 207 float* MD3Model::interpolateTransformation(MD3Tag* currFrameTag, MD3Tag* nextFrameTag, float frac) 208 {} 209 210 176 211 } -
branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h
r8552 r8553 20 20 class MD3BoneFrame; 21 21 class MD3Mesh; 22 class MD3Tag; 23 22 24 struct MD3Normal; 23 25 … … 48 50 49 51 sVec3D* interpolateMeshFrame(MD3Mesh* mesh, int startFrame, int nextMeshFrame, float frac); 50 51 52 MD3Normal* interpolateVertexNormals(MD3Normal* curNormals, MD3Normal* nextNormals, float frac); 52 53 float* interpolateTransformation(MD3Tag* currFrameTag, MD3Tag* nextFrameTag, float frac); 53 54 54 55 private:
Note: See TracChangeset
for help on using the changeset viewer.