Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8490 in orxonox.OLD for trunk/src/lib/graphics/importer/bsp_file.cc


Ignore:
Timestamp:
Jun 15, 2006, 9:34:48 PM (18 years ago)
Author:
patrick
Message:

merged the bsp branche back to trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/importer/bsp_file.cc

    r8330 r8490  
    3737#include <SDL/SDL_image.h>
    3838
     39// STL Containers
     40#include <vector>
     41
    3942using namespace std;
    4043
     
    5053int BspFile::read(const char* name)
    5154{
    52   //this->scale = 0.4;
     55  this->scale = 1.0;
    5356  int offset;
    5457  int size;
     
    211214    bspFile.read(this->visData, size);
    212215
    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);
    217220
    218221    // Get the Textures
     
    388391{
    389392  ::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];
    392397  struct stat results;
    393398
     
    401406    if(strlen(fileName) == 0)
    402407    {
     408
    403409     //         Default Material
    404       this->Materials[i].mat = new Material();
     410    this->Materials[i].mat = new Material();
    405411    this->Materials[i].mat->setDiffuse(0.1,0.1,1.0);
    406412    this->Materials[i].mat->setAmbient(0.1,0.1,1.0 );
     
    417423
    418424      // 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]) );
    420428    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);
    422432
    423433    absFileName = ResourceManager::getFullName(fileName);
     
    430440
    431441    // 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]) );
    433445    strcpy(ext, ".avi");
    434446    strncat (fileName, ext, strlen(fileName));
     
    443455
    444456       // 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]) );
    446460    strcpy(ext, ".mpg");
    447461    strncat (fileName, ext, strlen(fileName));
     
    456470
    457471    // 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]) );
    459475    strcpy(ext, ".tga");
    460476    strncat (fileName, ext, strlen(fileName));
     
    468484    }
    469485    // 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]) );
    471489    strcpy(ext, ".TGA");
    472490    strncat (fileName, ext, strlen(fileName));
     
    479497    }
    480498    // 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]) );
    482502    strcpy(ext, ".jpg");
    483503    strncat (fileName, ext, strlen(fileName));
     
    491511
    492512    // 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]) );
    494516    strcpy(ext, ".JPG");
    495517    strncat (fileName, ext, strlen(fileName));
     
    504526
    505527    // 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]) );
    507531    strcpy(ext, ".bmp");
    508532    strncat (fileName, ext, strlen(fileName));
     
    516540
    517541    // 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]) );
    519545    strcpy(ext, ".BMP");
    520546    strncat (fileName, ext, strlen(fileName));
     
    577603  MoviePlayer * testMC = new MoviePlayer(mat);
    578604  testMC->start(0);
     605 
     606  this->MovieMaterials.push_back(testMC);
    579607
    580608  //Material* tmp = new Material();
     
    605633  sc =  ((unsigned char *)(&lightMapTexture))[i];
    606634  sc *= 1/255.0;
    607   scale = 2.0;
     635
     636  scale = 1.0f; // Adjust brightness here
     637
    608638  if(sc > 1.0f && (temp = (1.0f/sc)) < scale) scale=temp;
    609639  scale*=255.0;
Note: See TracChangeset for help on using the changeset viewer.