- Timestamp:
- Jun 21, 2006, 3:12:57 AM (18 years ago)
- Location:
- branches/bsp_model/src/lib/graphics/importer/md3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/graphics/importer/md3/md3_data.cc
r8654 r8658 456 456 457 457 // reserver memory for the vertex informations 458 this->meshes[mesh]->meshFrames = new sVec3D [this->meshes[mesh]->header->meshFrameNum * this->meshes[mesh]->header->vertexNum];459 this->meshes[mesh]->normals = new MD3Normal [this->meshes[mesh]->header->meshFrameNum * this->meshes[mesh]->header->vertexNum];460 461 for( int i = 0; i < this->meshes[mesh]->header->meshFrameNum * this->meshes[mesh]->header->vertexNum; i++)458 this->meshes[mesh]->meshFrames = new sVec3D*[this->meshes[mesh]->header->meshFrameNum]; // * this->meshes[mesh]->header->vertexNum 459 this->meshes[mesh]->normals = new MD3Normal*[this->meshes[mesh]->header->meshFrameNum]; 460 461 for( int i = 0; i < this->meshes[mesh]->header->meshFrameNum; i++) 462 462 { 463 // read out the compressed data 464 MD3VertexCompressed* vc = new MD3VertexCompressed; 465 fread(vc, 1, sizeof(MD3VertexCompressed), pFile); 466 467 this->meshes[mesh]->meshFrames[i][0] = (float)vc->vector[0] / 64.0f; 468 this->meshes[mesh]->meshFrames[i][1] = (float)vc->vector[1] / 64.0f; 469 this->meshes[mesh]->meshFrames[i][2] = (float)vc->vector[2] / 64.0f; 470 471 this->meshes[mesh]->normals[i].vertexNormal[0] = (int)vc->vertexNormal[0]; 472 this->meshes[mesh]->normals[i].vertexNormal[1] = (int)vc->vertexNormal[1]; 463 this->meshes[mesh]->meshFrames[i] = new sVec3D[this->meshes[mesh]->header->vertexNum]; 464 this->meshes[mesh]->normals[i] = new MD3Normal[this->meshes[mesh]->header->vertexNum]; 465 466 for( int j = 0; j < this->meshes[mesh]->header->vertexNum; j++) 467 { 468 // read out the compressed data 469 MD3VertexCompressed* vc = new MD3VertexCompressed; 470 fread(vc, 1, sizeof(MD3VertexCompressed), pFile); 471 472 this->meshes[mesh]->meshFrames[i][j][0] = (float)vc->vector[0] / 64.0f; 473 this->meshes[mesh]->meshFrames[i][j][1] = (float)vc->vector[1] / 64.0f; 474 this->meshes[mesh]->meshFrames[i][j][2] = (float)vc->vector[2] / 64.0f; 475 476 this->meshes[mesh]->normals[i][j].vertexNormal[0] = (int)vc->vertexNormal[0]; 477 this->meshes[mesh]->normals[i][j].vertexNormal[1] = (int)vc->vertexNormal[1]; 473 478 474 479 // PRINTF(0)("nr: %i, meshframes: %f, %f, %f, normal: %f, %f\n", i, this->meshes[mesh]->meshFrames[i][0], this->meshes[mesh]->meshFrames[i][1], 475 480 // this->meshes[mesh]->meshFrames[i][2], this->meshes[mesh]->normals[i].vertexNormal[0], this->meshes[mesh]->normals[i].vertexNormal[1]); 476 481 477 delete vc; 482 delete vc; 483 } 478 484 } 479 485 -
branches/bsp_model/src/lib/graphics/importer/md3/md3_mesh.h
r8490 r8658 77 77 MD3Triangle* triangles; //!< indices into mesh frames and texture coord arrays 78 78 MD3TexVecs* texVecs; //!< tex vecs coordinates 79 sVec3D* 80 MD3Normal* 79 sVec3D** meshFrames; //!< mesh frames 80 MD3Normal** normals; //!< 3d array of normals with spherical coordinates giving the dir of the vertex normal 81 81 82 82 }; -
branches/bsp_model/src/lib/graphics/importer/md3/md3_model.cc
r8657 r8658 168 168 //interpolate mesh frame between the 2 current mesh frames 169 169 this->interpolateMeshFrame( data, 170 &mesh->meshFrames[data->animationState.currentFrame],171 &mesh->meshFrames[data->animationState.nextFrame],170 mesh->meshFrames[data->animationState.currentFrame], 171 mesh->meshFrames[data->animationState.nextFrame], 172 172 data->animationState.interpolationFraction, mesh, i); 173 173 // } … … 188 188 //interpolate vertex normals 189 189 this->interpolateVertexNormals(data, 190 &mesh->normals[data->animationState.currentFrame],191 &mesh->normals[data->animationState.nextFrame],190 mesh->normals[data->animationState.currentFrame], 191 mesh->normals[data->animationState.nextFrame], 192 192 data->animationState.interpolationFraction, mesh, i); 193 193 } … … 305 305 else { 306 306 //stick with current vertex normals 307 this->drawVertexNormals(frame, &mesh->normals[data->animationState.currentFrame]);307 this->drawVertexNormals(frame, mesh->normals[data->animationState.currentFrame]); 308 308 } 309 309 }
Note: See TracChangeset
for help on using the changeset viewer.