Changeset 8564 in orxonox.OLD for branches/bsp_model
- Timestamp:
- Jun 17, 2006, 1:58:03 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
r8563 r8564 48 48 49 49 this->tmpNormal = new MD3Normal[2048]; //!< the temporary normals 50 51 this->tmpMatrix = new float*[this->md3Data->tagNum]; 52 for( int i = 0; i < this->md3Data->tagNum; i++) 53 this->tmpMatrix[i] = new float[16]; 50 54 } 51 55 … … 55 59 { 56 60 delete this->tmpBoneFrame; 57 delete [] this->tmpMesh; 61 // delete [] this->tmpMesh; 62 63 ///TODO deleting mesh 64 ///TODO deleting matrices 58 65 } 59 66 … … 124 131 // draw all models linked to this model 125 132 std::map<int, MD3Data*>::iterator it = data->sortedMap.begin(); 133 int i = 0; 126 134 while( it != data->sortedMap.end()) 127 135 { … … 137 145 //we need to interpolate 138 146 MD3Tag* nextFrameTag = data->boneFrames[data->animationState.nextFrame]->tags[child->parentTagIndex]; 139 m = this->interpolateTransformation(currFrameTag, nextFrameTag, data->animationState.interpolationFraction );147 m = this->interpolateTransformation(currFrameTag, nextFrameTag, data->animationState.interpolationFraction, i); 140 148 } 141 149 else { … … 168 176 169 177 glPopMatrix(); 178 i++; 170 179 } 171 180 } … … 232 241 } 233 242 243 234 244 // draw vertex normals if needed 235 245 if( this->bDrawNormals) { … … 261 271 //we need to interpolate 262 272 MD3Tag* nextFrameTag = data->boneFrames[data->animationState.nextFrame]->tags[child->parentTagIndex]; 263 m = this->interpolateTransformation(currFrameTag, nextFrameTag, data->animationState.interpolationFraction);273 // m = this->interpolateTransformation(currFrameTag, nextFrameTag, data->animationState.interpolationFraction); 264 274 } 265 275 else { … … 464 474 * interpolate transformation 465 475 */ 466 float* MD3Model::interpolateTransformation(MD3Tag* currFrameTag, MD3Tag* nextFrameTag, float frac )476 float* MD3Model::interpolateTransformation(MD3Tag* currFrameTag, MD3Tag* nextFrameTag, float frac, int i) 467 477 { 468 478 // interpolate position … … 481 491 482 492 // quaternion code is column based, so use transposed matrix when spitting out to gl 483 this->tmpMatrix[ 0] = interpolatedMatrix[0][0];484 this->tmpMatrix[ 4] = interpolatedMatrix[1][0];485 this->tmpMatrix[ 8] = interpolatedMatrix[2][0];486 this->tmpMatrix[ 12] = interpolatedPosition.x;487 this->tmpMatrix[ 1] = interpolatedMatrix[0][1];488 this->tmpMatrix[ 5] = interpolatedMatrix[1][1];489 this->tmpMatrix[ 9] = interpolatedMatrix[2][1];490 this->tmpMatrix[ 13] = interpolatedPosition.y;491 this->tmpMatrix[ 2] = interpolatedMatrix[0][2];492 this->tmpMatrix[ 6] = interpolatedMatrix[1][2];493 this->tmpMatrix[ 10]= interpolatedMatrix[2][2];494 this->tmpMatrix[ 14] = interpolatedPosition.z;495 this->tmpMatrix[ 3] = 0.0f;496 this->tmpMatrix[ 7] = 0.0f;497 this->tmpMatrix[ 11]= 0.0f;498 this->tmpMatrix[ 15] = 1.0f;499 500 return this->tmpMatrix ;493 this->tmpMatrix[i][0] = interpolatedMatrix[0][0]; 494 this->tmpMatrix[i][4] = interpolatedMatrix[1][0]; 495 this->tmpMatrix[i][8] = interpolatedMatrix[2][0]; 496 this->tmpMatrix[i][12] = interpolatedPosition.x; 497 this->tmpMatrix[i][1] = interpolatedMatrix[0][1]; 498 this->tmpMatrix[i][5] = interpolatedMatrix[1][1]; 499 this->tmpMatrix[i][9] = interpolatedMatrix[2][1]; 500 this->tmpMatrix[i][13] = interpolatedPosition.y; 501 this->tmpMatrix[i][2] = interpolatedMatrix[0][2]; 502 this->tmpMatrix[i][6] = interpolatedMatrix[1][2]; 503 this->tmpMatrix[i][10]= interpolatedMatrix[2][2]; 504 this->tmpMatrix[i][14] = interpolatedPosition.z; 505 this->tmpMatrix[i][3] = 0.0f; 506 this->tmpMatrix[i][7] = 0.0f; 507 this->tmpMatrix[i][11]= 0.0f; 508 this->tmpMatrix[i][15] = 1.0f; 509 510 return this->tmpMatrix[i]; 501 511 502 512 } -
branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h
r8563 r8564 49 49 sVec3D* interpolateMeshFrame(sVec3D* currMeshFrame, sVec3D* nextMeshFrame, float frac, MD3Mesh* mesh, int i); 50 50 MD3Normal* interpolateVertexNormals(MD3Normal* curNormals, MD3Normal* nextNormals, float frac, MD3Mesh* mesh); 51 float* interpolateTransformation(MD3Tag* currFrameTag, MD3Tag* nextFrameTag, float frac );51 float* interpolateTransformation(MD3Tag* currFrameTag, MD3Tag* nextFrameTag, float frac, int i); 52 52 53 53 private: … … 60 60 sVec3D** tmpMesh; //!< a temporary mesh frame 61 61 MD3Normal* tmpNormal; //!< a temporary normals frame 62 float tmpMatrix[16];//!< a temporary matrix62 float** tmpMatrix; //!< a temporary matrix 63 63 Vector tmpVec1; 64 64 Vector tmpVec2;
Note: See TracChangeset
for help on using the changeset viewer.