Changeset 8560 in orxonox.OLD for branches/bsp_model/src/lib/graphics/importer
- Timestamp:
- Jun 17, 2006, 12:22:53 PM (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
r8558 r8560 25 25 26 26 #include "material.h" 27 #include "quaternion.h" 27 28 28 29 namespace md3 … … 266 267 */ 267 268 float* MD3Model::interpolateTransformation(MD3Tag* currFrameTag, MD3Tag* nextFrameTag, float frac) 268 {} 269 { 270 // interpolate position 271 Vector interpolatedPosition = currFrameTag->position * (1.0f - frac) + nextFrameTag->position * frac; 272 273 274 // interpolate rotation matrix 275 float currRot[4][4]; 276 float nextRot[4][4]; 277 float interpolatedMatrix[4][4]; 278 279 Quaternion currQuat(currFrameTag->matrix); currQuat.matrix(currRot); 280 Quaternion nextQuat(nextFrameTag->matrix); nextQuat.matrix(nextRot); 281 282 Quaternion interpolatedQuat = Quaternion::quatSlerp(currQuat, nextQuat, frac); interpolatedQuat.matrix(interpolatedMatrix); 283 284 // quaternion code is column based, so use transposed matrix when spitting out to gl 285 this->tmpMatrix[0] = interpolatedMatrix[0][0]; 286 this->tmpMatrix[4] = interpolatedMatrix[1][0]; 287 this->tmpMatrix[8] = interpolatedMatrix[2][0]; 288 this->tmpMatrix[12] = interpolatedPosition.x; 289 this->tmpMatrix[1] = interpolatedMatrix[0][1]; 290 this->tmpMatrix[5] = interpolatedMatrix[1][1]; 291 this->tmpMatrix[9] = interpolatedMatrix[2][1]; 292 this->tmpMatrix[13] = interpolatedPosition.y; 293 this->tmpMatrix[2] = interpolatedMatrix[0][2]; 294 this->tmpMatrix[6] = interpolatedMatrix[1][2]; 295 this->tmpMatrix[10]= interpolatedMatrix[2][2]; 296 this->tmpMatrix[14] = interpolatedPosition.z; 297 this->tmpMatrix[3] = 0.0f; 298 this->tmpMatrix[7] = 0.0f; 299 this->tmpMatrix[11]= 0.0f; 300 this->tmpMatrix[15] = 1.0f; 301 302 return this->tmpMatrix; 303 304 } 269 305 270 306 -
branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h
r8558 r8560 62 62 sVec3D* tmpMesh; //!< a temporary mesh frame 63 63 MD3Normal* tmpNormal; //!< a temporary normals frame 64 float tmpMatrix[16]; //!< a temporary matrix 64 65 }; 65 66
Note: See TracChangeset
for help on using the changeset viewer.