Changeset 8490 in orxonox.OLD for trunk/src/lib/graphics/importer/bsp_file.cc
- Timestamp:
- Jun 15, 2006, 9:34:48 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/importer/bsp_file.cc
r8330 r8490 37 37 #include <SDL/SDL_image.h> 38 38 39 // STL Containers 40 #include <vector> 41 39 42 using namespace std; 40 43 … … 50 53 int BspFile::read(const char* name) 51 54 { 52 //this->scale = 0.4;55 this->scale = 1.0; 53 56 int offset; 54 57 int size; … … 211 214 bspFile.read(this->visData, size); 212 215 213 PRINTF( 4)("BSP FILE: VisDataSize: %i Bytes. \n", size);214 PRINTF( 4)("BSP FILE: NumVisData: %i. \n", size /1 - 8);215 PRINTF( 4)("BSP FILE: Remainder: %i. \n", size % 1);216 PRINTF( 4)("BSP FILE: VisDataOffset: %i. \n", offset);216 PRINTF(0)("BSP FILE: VisDataSize: %i Bytes. \n", size); 217 PRINTF(0)("BSP FILE: NumVisData: %i. \n", size /1 - 8); 218 PRINTF(0)("BSP FILE: Remainder: %i. \n", size % 1); 219 PRINTF(0)("BSP FILE: VisDataOffset: %i. \n", offset); 217 220 218 221 // Get the Textures … … 388 391 { 389 392 ::std::string absFileName; 390 char fileName [228]; 391 char ext [100]; 393 char* baseName = "/worlds/bsp/"; 394 395 char fileName [500]; 396 char ext [500]; 392 397 struct stat results; 393 398 … … 401 406 if(strlen(fileName) == 0) 402 407 { 408 403 409 // Default Material 404 410 this->Materials[i].mat = new Material(); 405 411 this->Materials[i].mat->setDiffuse(0.1,0.1,1.0); 406 412 this->Materials[i].mat->setAmbient(0.1,0.1,1.0 ); … … 417 423 418 424 // Check for mov 419 strcpy(fileName, &this->textures[8+ 72*i]); 425 strcpy(fileName, baseName); 426 strcpy(ext, &this->textures[8+ 72*i]); 427 strncat(fileName, ext, strlen(fileName) + strlen(&this->textures[8+ 72*i]) ); 420 428 strcpy(ext, ".mov"); 421 strncat (fileName, ext, strlen(fileName)); 429 strncat (fileName, ext, strlen(fileName) ); 430 431 PRINTF(0)("BSP FILE: Name %s . \n", fileName); 422 432 423 433 absFileName = ResourceManager::getFullName(fileName); … … 430 440 431 441 // Check for avi 432 strcpy(fileName, &this->textures[8+ 72*i]); 442 strcpy(fileName, baseName); 443 strcpy(ext, &this->textures[8+ 72*i]); 444 strncat(fileName, ext, strlen(fileName) + strlen(&this->textures[8+ 72*i]) ); 433 445 strcpy(ext, ".avi"); 434 446 strncat (fileName, ext, strlen(fileName)); … … 443 455 444 456 // Check for mpg 445 strcpy(fileName, &this->textures[8+ 72*i]); 457 strcpy(fileName, baseName); 458 strcpy(ext, &this->textures[8+ 72*i]); 459 strncat(fileName, ext, strlen(fileName) + strlen(&this->textures[8+ 72*i]) ); 446 460 strcpy(ext, ".mpg"); 447 461 strncat (fileName, ext, strlen(fileName)); … … 456 470 457 471 // Check for tga 458 strcpy(fileName, &this->textures[8+ 72*i]); 472 strcpy(fileName, baseName); 473 strcpy(ext, &this->textures[8+ 72*i]); 474 strncat(fileName, ext, strlen(fileName) + strlen(&this->textures[8+ 72*i]) ); 459 475 strcpy(ext, ".tga"); 460 476 strncat (fileName, ext, strlen(fileName)); … … 468 484 } 469 485 // Check for TGA 470 strcpy(fileName, &this->textures[8+ 72*i]); 486 strcpy(fileName, baseName); 487 strcpy(ext, &this->textures[8+ 72*i]); 488 strncat(fileName, ext, strlen(fileName) + strlen(&this->textures[8+ 72*i]) ); 471 489 strcpy(ext, ".TGA"); 472 490 strncat (fileName, ext, strlen(fileName)); … … 479 497 } 480 498 // Check for jpg 481 strcpy(fileName, &this->textures[8+ 72*i]); 499 strcpy(fileName, baseName); 500 strcpy(ext, &this->textures[8+ 72*i]); 501 strncat(fileName, ext, strlen(fileName) + strlen(&this->textures[8+ 72*i]) ); 482 502 strcpy(ext, ".jpg"); 483 503 strncat (fileName, ext, strlen(fileName)); … … 491 511 492 512 // Check for JPG 493 strcpy(fileName, &this->textures[8+ 72*i]); 513 strcpy(fileName, baseName); 514 strcpy(ext, &this->textures[8+ 72*i]); 515 strncat(fileName, ext, strlen(fileName) + strlen(&this->textures[8+ 72*i]) ); 494 516 strcpy(ext, ".JPG"); 495 517 strncat (fileName, ext, strlen(fileName)); … … 504 526 505 527 // Check for bmp 506 strcpy(fileName, &this->textures[8+ 72*i]); 528 strcpy(fileName, baseName); 529 strcpy(ext, &this->textures[8+ 72*i]); 530 strncat(fileName, ext, strlen(fileName) + strlen(&this->textures[8+ 72*i]) ); 507 531 strcpy(ext, ".bmp"); 508 532 strncat (fileName, ext, strlen(fileName)); … … 516 540 517 541 // Check for BMP 518 strcpy(fileName, &this->textures[8+ 72*i]); 542 strcpy(fileName, baseName); 543 strcpy(ext, &this->textures[8+ 72*i]); 544 strncat(fileName, ext, strlen(fileName) + strlen(&this->textures[8+ 72*i]) ); 519 545 strcpy(ext, ".BMP"); 520 546 strncat (fileName, ext, strlen(fileName)); … … 577 603 MoviePlayer * testMC = new MoviePlayer(mat); 578 604 testMC->start(0); 605 606 this->MovieMaterials.push_back(testMC); 579 607 580 608 //Material* tmp = new Material(); … … 605 633 sc = ((unsigned char *)(&lightMapTexture))[i]; 606 634 sc *= 1/255.0; 607 scale = 2.0; 635 636 scale = 1.0f; // Adjust brightness here 637 608 638 if(sc > 1.0f && (temp = (1.0f/sc)) < scale) scale=temp; 609 639 scale*=255.0;
Note: See TracChangeset
for help on using the changeset viewer.