Changeset 8579 in orxonox.OLD for branches/bsp_model/src/lib/graphics
- Timestamp:
- Jun 19, 2006, 1:23:38 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
r8578 r8579 237 237 fread(md, 1, sizeof(MD3TagData), pFile); 238 238 this->boneFrames[i]->tags[j]->data = md; 239 240 this->boneFrames[i]->tags[j]->name = std::string(this->boneFrames[i]->tags[j]->data->name); 241 this->boneFrames[i]->tags[j]->position = Vector( this->boneFrames[i]->tags[j]->data->position[0], 242 this->boneFrames[i]->tags[j]->data->position[1], 243 this->boneFrames[i]->tags[j]->data->position[2]); 244 for( int k = 0; k < 3; k++) 245 for( int l = 0; l < 3; l++) 246 this->boneFrames[i]->tags[j]->matrix[k][l] = this->boneFrames[i]->tags[j]->data->matrix[k][l]; 247 248 //PRINTF(0)("Tag name: %s\n", this->boneFrames[i]->tags[j]->name.c_str()); 239 249 } 240 250 } … … 360 370 for( int i = 0; i < this->meshes[mesh]->header->textureNum; i++) { 361 371 PRINTF(0)(" texture file: %s\n", tex[i].fileName); 372 #warning texture stuff hard coded. make this again 362 373 std::string path("/home/boenzlip/tmp/q3/Downloads/MOH/q3mdl-alien3/"); 363 374 std::string path1(tex[i].fileName); 364 375 std::string fullPath( path + path1); 365 this->meshes[mesh]->material[i].setDiffuseMap(/*tex[i].fileName*/ /*fullPath.c_str()*/ "maps/ blue_torso.tga");376 this->meshes[mesh]->material[i].setDiffuseMap(/*tex[i].fileName*/ /*fullPath.c_str()*/ "maps/yuri.tga"); 366 377 this->meshes[mesh]->material[i].setAmbient(1, 1, 1); 367 378 } -
branches/bsp_model/src/lib/graphics/importer/md3/md3_model.cc
r8578 r8579 37 37 MD3Model::MD3Model(std::string filename, float scaling) 38 38 { 39 this->md3Data = new MD3Data(filename, filename, scaling); 40 41 // MD3AnimationCfg cfg("/home/boenzlip/tmp/q3/Downloads/MOH/q3mdl-alien3/models/players/alien3/animation.cfg"); 42 39 40 this->autoAssemblePlayerModel(filename, scaling); 41 42 43 // create the temporary data to work with (interpolation data) 43 44 this->tmpBoneFrame = new MD3BoneFrame(); 44 45 … … 70 71 } 71 72 73 74 /** 75 * auto assemples a player model 76 */ 77 void MD3Model::autoAssemblePlayerModel(std::string filename, float scaling) 78 { 79 this->md3Data = new MD3Data(filename, filename, scaling); 80 // MD3AnimationCfg cfg("/home/boenzlip/tmp/q3/Downloads/MOH/q3mdl-alien3/models/players/alien3/animation.cfg"); 81 } 72 82 73 83 … … 313 323 { 314 324 glColor3f(1.0f, 1.0f, 1.0f); 315 glBegin( GL_TRIANGLES ); 325 326 glBegin( GL_TRIANGLES); 316 327 glScalef( 0.7f , 0.7f, 0.7f ); 317 328 … … 319 330 320 331 // upload all triangles in the frame to OpenGL 321 for( int t = 0; t < mesh->header->triangleNum; t++) { 332 for( int t = 0; t < mesh->header->triangleNum; t++) 333 { 322 334 // calc normal vector 323 335 tmpVec1.x = frame[mesh->triangles[t].vertexOffset[1]][0] - frame[mesh->triangles[t].vertexOffset[0]][0]; 336 tmpVec1.y = frame[mesh->triangles[t].vertexOffset[1]][1] - frame[mesh->triangles[t].vertexOffset[0]][1]; 337 tmpVec1.z = frame[mesh->triangles[t].vertexOffset[1]][2] - frame[mesh->triangles[t].vertexOffset[0]][2]; 338 324 339 tmpVec2.x = frame[mesh->triangles[t].vertexOffset[2]][0] - frame[mesh->triangles[t].vertexOffset[0]][0]; 325 326 tmpVec1.y = frame[mesh->triangles[t].vertexOffset[1]][1] - frame[mesh->triangles[t].vertexOffset[0]][1];327 340 tmpVec2.y = frame[mesh->triangles[t].vertexOffset[2]][1] - frame[mesh->triangles[t].vertexOffset[0]][1]; 328 329 tmpVec1.z = frame[mesh->triangles[t].vertexOffset[1]][2] - frame[mesh->triangles[t].vertexOffset[0]][2];330 341 tmpVec2.z = frame[mesh->triangles[t].vertexOffset[2]][2] - frame[mesh->triangles[t].vertexOffset[0]][2]; 331 342 … … 333 344 normal.normalize(); 334 345 346 // PRINTF(0)("normal: %f, %f, %f\n", normal.x, normal.y, normal.z); 347 335 348 glNormal3f(normal.x, normal.y, normal.z); 336 //no normalization necessary, GL_NORMALIZE is enabled!337 338 // PRINTF(0)("drawing vertex: %f, %f, %f, normal: %f, %f\n",339 // frame[mesh->triangles[t].vertexOffset[0]][0],340 // frame[mesh->triangles[t].vertexOffset[0]][1],341 // frame[mesh->triangles[t].vertexOffset[0]][2],342 // normal.x, normal.y, normal.z);343 // PRINTF(0)("drawing vertex: %f, %f, %f, normal: %f, %f\n",344 // frame[mesh->triangles[t].vertexOffset[1]][0],345 // frame[mesh->triangles[t].vertexOffset[1]][1],346 // frame[mesh->triangles[t].vertexOffset[1]][2],347 // normal.x, normal.y, normal.z);348 // PRINTF(0)("drawing vertex: %f, %f, %f, normal: %f, %f\n",349 // frame[mesh->triangles[t].vertexOffset[2]][0],350 // frame[mesh->triangles[t].vertexOffset[2]][1],351 // frame[mesh->triangles[t].vertexOffset[2]][2],352 // normal.x, normal.y, normal.z);353 354 355 349 glTexCoord2fv( mesh->texVecs[mesh->triangles[t].vertexOffset[0]].textureCoord); 356 350 glVertex3f( frame[mesh->triangles[t].vertexOffset[0]][0], 357 351 frame[mesh->triangles[t].vertexOffset[0]][2], 358 352 frame[mesh->triangles[t].vertexOffset[0]][1]); 353 354 glNormal3f(normal.x, normal.y, normal.z); 359 355 glTexCoord2fv( mesh->texVecs[mesh->triangles[t].vertexOffset[1]].textureCoord); 360 356 glVertex3f( frame[mesh->triangles[t].vertexOffset[1]][0], 361 357 frame[mesh->triangles[t].vertexOffset[1]][2], 362 358 frame[mesh->triangles[t].vertexOffset[1]][1]); 359 360 glNormal3f(normal.x, normal.y, normal.z); 363 361 glTexCoord2fv( mesh->texVecs[mesh->triangles[t].vertexOffset[2]].textureCoord); 364 362 glVertex3f( frame[mesh->triangles[t].vertexOffset[2]][0], … … 366 364 frame[mesh->triangles[t].vertexOffset[2]][1]); 367 365 } 368 369 366 glEnd(); 367 370 368 } 371 369 … … 390 388 float z2 = frame->maxs.z; 391 389 392 //glPushAttrib(GL_TEXTURE_2D);393 //glPushAttrib(GL_LIGHTING);390 glPushAttrib(GL_TEXTURE_2D); 391 glPushAttrib(GL_LIGHTING); 394 392 395 393 glColor3f(1.0f,0.0f,0.0f); … … 430 428 glEnd(); 431 429 432 //glPopAttrib();433 //glPopAttrib();430 glPopAttrib(); 431 glPopAttrib(); 434 432 } 435 433 -
branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h
r8565 r8579 39 39 40 40 private: 41 42 void autoAssemblePlayerModel(std::string filename, float scaling); 43 41 44 void draw(MD3Data* data) const; 42 45 void tick(float dt, MD3Data* data);
Note: See TracChangeset
for help on using the changeset viewer.