Changeset 7801 in orxonox.OLD for branches/bsp_model/src/lib/graphics/importer/bsp_file.cc
- Timestamp:
- May 24, 2006, 1:24:39 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/graphics/importer/bsp_file.cc
r7596 r7801 25 25 #include "vector.h" 26 26 #include "util/loading/resource_manager.h" 27 #include "movie_player.h" 27 28 28 29 #include <SDL/SDL_endian.h> … … 45 46 int size; 46 47 struct stat results; 47 // name = "/root/data/Kanti175.bsp"; 48 48 49 49 50 if (stat( name , &results) == 0) { … … 393 394 this->Materials[i].mat->setSpecular(0.4,0.4,1.0); 394 395 //this->Materials[i]->setShininess(100.0); 395 this->Materials[i].mat->setTransparency(1.0);396 // this->Materials[i].mat->setTransparency(1.0); 396 397 this->Materials[i].mat->setDiffuseMap("pictures/ground.tga"); 397 398 this->Materials[i].mat->setAmbientMap("pictures/ground.tga"); 398 399 this->Materials[i].mat->setSpecularMap("pictures/ground.tga"); 399 400 this->Materials[i].alpha = false; 401 this->Materials[i].animated = false; 400 402 continue; 401 403 } 404 405 // Check for mov 406 strcpy(fileName, &this->textures[8+ 72*i]); 407 strcpy(ext, ".mov"); 408 strncat (fileName, ext, strlen(fileName)); 409 410 absFileName = ResourceManager::getFullName(fileName); 411 412 if(ResourceManager::isFile(absFileName)) { 413 PRINTF(0)("BSP FILE: gefunden . \n"); 414 this->Materials[i] = this->loadAVI(fileName); 415 continue; 416 } 402 417 418 // Check for avi 419 strcpy(fileName, &this->textures[8+ 72*i]); 420 strcpy(ext, ".avi"); 421 strncat (fileName, ext, strlen(fileName)); 422 423 absFileName = ResourceManager::getFullName(fileName); 424 425 if(ResourceManager::isFile(absFileName)) { 426 PRINTF(0)("BSP FILE: gefunden . \n"); 427 this->Materials[i] = this->loadAVI(fileName); 428 continue; 429 } 430 431 // Check for mpg 432 strcpy(fileName, &this->textures[8+ 72*i]); 433 strcpy(ext, ".mpg"); 434 strncat (fileName, ext, strlen(fileName)); 435 436 absFileName = ResourceManager::getFullName(fileName); 437 438 if(ResourceManager::isFile(absFileName)) { 439 PRINTF(0)("BSP FILE: gefunden . \n"); 440 this->Materials[i] = this->loadAVI(fileName); 441 continue; 442 } 403 443 404 444 // Check for tga … … 481 521 this->Materials[i].mat->setSpecular(0.4,0.4,0.4); 482 522 //this->Materials[i]->setShininess(100.0); 483 this->Materials[i].mat->setTransparency(1.0); 484 this->Materials[i].mat->setDiffuseMap("pictures/ground.tga"); 485 this->Materials[i].mat->setAmbientMap("pictures/ground.tga"); 486 this->Materials[i].mat->setSpecularMap("pictures/ground.tga"); 487 this->Materials[i].alpha = false; 523 //this->Materials[i].mat->setTransparency(1.0); 524 this->Materials[i].mat->setDiffuseMap("pictures/error_texture.png"); 525 this->Materials[i].mat->setAmbientMap("pictures/error_texture.png"); 526 this->Materials[i].mat->setSpecularMap("pictures/error_texture.png"); 527 this->Materials[i].alpha = true; 528 this->Materials[i].animated = false; 488 529 489 530 } … … 503 544 504 545 Material* tmp = new Material(); 505 tmp->setDiffuse(1.0,1.0,1.0);506 tmp->setAmbient(1.0,1.0,1.0 );546 tmp->setDiffuse(1.0,1.0,1.0); 547 tmp->setAmbient(1.0,1.0,1.0 ); 507 548 tmp->setSpecular(1.0,1.0,1.0); 508 549 // tmp->setShininess(.5); 509 // tmp->setTransparency( 1.0);550 // tmp->setTransparency(0.0); 510 551 511 552 tmp->setDiffuseMap(mat); 512 553 513 554 tmpAMat.mat = tmp; 514 555 tmpAMat.animated = false; 556 return tmpAMat; 557 } 558 559 AMat BspFile::loadAVI(char* mat) 560 { 561 AMat tmpAMat; 562 563 564 MoviePlayer * testMC = new MoviePlayer(mat); 565 testMC->start(0); 566 567 //Material* tmp = new Material(); 568 // tmp->setDiffuse(1.0,1.0,1.0); 569 //tmp->setAmbient(1.0,1.0,1.0 ); 570 //tmp->setSpecular(1.0,1.0,1.0); 571 // tmp->setShininess(.5);tmpAMat 572 // tmp->setTransparency(0.0); 573 574 //tmp->setDiffuseMap(mat); 575 576 tmpAMat.aviMat = testMC; 577 tmpAMat.animated = true; 578 tmpAMat.alpha = true; 515 579 return tmpAMat; 516 580 } … … 533 597 scale*=255.0; 534 598 sc*=scale; 535 if(sc <= 205)536 ((unsigned char *)(&lightMapTexture))[i] = (unsigned char)sc + 50;599 if(sc <= 180) 600 ((unsigned char *)(&lightMapTexture))[i] = (unsigned char)sc + 75; 537 601 else 538 602 ((unsigned char *)(&lightMapTexture))[i] = (unsigned char)sc; … … 595 659 int level = 7; 596 660 int level1 = 8; 597 int size0 = SDL_SwapLE32(Face->size[0]);598 int size1 = SDL_SwapLE32(Face->size[1]);661 int size0 = (Face->size[0]); 662 int size1 = (Face->size[1]); 599 663 // For each patch... 600 664 for(int i = 0; i < ( size0 - 1) ; i+=2) { … … 609 673 for(int k = 0; k < 3; k++) { 610 674 for(int l = 0; l < 3; l++) { 611 controls[k +3*l]. position[0] = SDL_SwapLE32( BspVrtx[Face->vertex + (j * size0)+ i + l+ size0*k].position[0]);612 controls[k +3*l]. position[1] = SDL_SwapLE32( BspVrtx[Face->vertex + (j * size0)+ i +l+ size0*k].position[1]);613 controls[k +3*l]. position[2] = SDL_SwapLE32( BspVrtx[Face->vertex + (j * size0)+ i + l+ size0*k].position[2]); /*Face->n_vertexes*/614 615 controlsTmp[2-k +6-3*l]. position[0] = SDL_SwapLE32( BspVrtx[Face->vertex +( j * size0)+ i + l+ size0*k].position[0]);616 controlsTmp[2-k +6-3*l]. position[1] = SDL_SwapLE32( BspVrtx[Face->vertex + (j * size0)+ i +l+ size0*k].position[1]);617 controlsTmp[2-k +6-3*l]. position[2] = SDL_SwapLE32( BspVrtx[Face->vertex + (j * size0)+ i + l+ size0*k].position[2]); /*Face->n_vertexes*/618 619 VControls[k +3*l]. position[0] = SDL_SwapLE32( BspVrtx[Face->vertex +( j * size0)+ i + l+ size0*k].position[0]);620 VControls[k +3*l]. position[1] = SDL_SwapLE32( BspVrtx[Face->vertex + (j * size0)+ i +l+ size0*k].position[1]);621 VControls[k +3*l]. position[2] = SDL_SwapLE32( BspVrtx[Face->vertex + (j * size0)+ i + l+ size0*k].position[2]);622 623 VControls[k +3*l]. normal[0] = SDL_SwapLE32( BspVrtx[Face->vertex +( j * size0)+ i + l+ size0*k].normal[0]);624 VControls[k +3*l]. normal[1] = SDL_SwapLE32( BspVrtx[Face->vertex + (j * size0)+ i +l+ size0*k].normal[1]);625 VControls[k +3*l]. normal[2] = SDL_SwapLE32( BspVrtx[Face->vertex + (j * size0)+ i + l+ size0*k].normal[2]);626 627 VControls[k +3*l]. texcoord[0][0]= SDL_SwapLE32( BspVrtx[Face->vertex +( j * size0)+ i + l+ size0*k].texcoord[0][0]);628 VControls[k +3*l]. texcoord[0][1] = SDL_SwapLE32( BspVrtx[Face->vertex + (j * size0)+ i +l+ size0*k].texcoord[0][1]);629 VControls[k +3*l]. texcoord[1][0] = SDL_SwapLE32( BspVrtx[Face->vertex +( j * size0)+ i + l+ size0*k].texcoord[1][0]);630 VControls[k +3*l]. texcoord[1][1] = SDL_SwapLE32( BspVrtx[Face->vertex + (j * size0)+ i +l+ size0*k].texcoord[1][1]);675 controls[k +3*l]. position[0] = ( BspVrtx[Face->vertex + (j * size0)+ i + l+ size0*k].position[0]); 676 controls[k +3*l]. position[1] = ( BspVrtx[Face->vertex + (j * size0)+ i +l+ size0*k].position[1]); 677 controls[k +3*l]. position[2] = ( BspVrtx[Face->vertex + (j * size0)+ i + l+ size0*k].position[2]); /*Face->n_vertexes*/ 678 679 controlsTmp[2-k +6-3*l]. position[0] = ( BspVrtx[Face->vertex +( j * size0)+ i + l+ size0*k].position[0]); 680 controlsTmp[2-k +6-3*l]. position[1] = ( BspVrtx[Face->vertex + (j * size0)+ i +l+ size0*k].position[1]); 681 controlsTmp[2-k +6-3*l]. position[2] = ( BspVrtx[Face->vertex + (j * size0)+ i + l+ size0*k].position[2]); /*Face->n_vertexes*/ 682 683 VControls[k +3*l]. position[0] = ( BspVrtx[Face->vertex +( j * size0)+ i + l+ size0*k].position[0]); 684 VControls[k +3*l]. position[1] = ( BspVrtx[Face->vertex + (j * size0)+ i +l+ size0*k].position[1]); 685 VControls[k +3*l]. position[2] = ( BspVrtx[Face->vertex + (j * size0)+ i + l+ size0*k].position[2]); 686 687 VControls[k +3*l]. normal[0] = ( BspVrtx[Face->vertex +( j * size0)+ i + l+ size0*k].normal[0]); 688 VControls[k +3*l]. normal[1] = ( BspVrtx[Face->vertex + (j * size0)+ i +l+ size0*k].normal[1]); 689 VControls[k +3*l]. normal[2] = ( BspVrtx[Face->vertex + (j * size0)+ i + l+ size0*k].normal[2]); 690 691 VControls[k +3*l]. texcoord[0][0]= ( BspVrtx[Face->vertex +( j * size0)+ i + l+ size0*k].texcoord[0][0]); 692 VControls[k +3*l]. texcoord[0][1] = ( BspVrtx[Face->vertex + (j * size0)+ i +l+ size0*k].texcoord[0][1]); 693 VControls[k +3*l]. texcoord[1][0] = ( BspVrtx[Face->vertex +( j * size0)+ i + l+ size0*k].texcoord[1][0]); 694 VControls[k +3*l]. texcoord[1][1] = ( BspVrtx[Face->vertex + (j * size0)+ i +l+ size0*k].texcoord[1][1]); 631 695 632 696 … … 911 975 //Face->n_meshverts = sz; 912 976 } 977 978 void BspFile::swapAllBspCoordinates() 979 { 980 981 } 982 983 void BspFile::swapCoords((int *) array) 984 { 985 986 } 987 988 void BspFile::swapCoords((float *) array) 989 { 990 991 } 992
Note: See TracChangeset
for help on using the changeset viewer.