Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 24, 2005, 10:32:34 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/physics: merged the trunk back to branches/physics
merged with command
svn merge -r 4223:HEAD ../../trunk/ .
conflicts additively included

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/physics/src/world_entities/skybox.cc

    r4178 r4283  
    1111
    1212   ### File Specific:
    13    main-programmer: David Gruetter
    14    co-programmer: Benjamin Grauer
    15    
    16    Created by Dave: this file is actually quite similar to player.cc and so is
    17    skybox.h similar to player.h
    18    With that said, things should be clear:)
    19    
    20    Edited:
    21    Bensch: more constructors, changeability, comments...
    22    Patrick: giving it the common orxonox style, not much to do... good work Dave!
    23 
     13   main-programmer: Benjamin Grauer
     14   co-programmer: ...
    2415*/
    2516
     
    4637   \param fileName the file to take as input for the SkyBox
    4738*/
    48 SkyBox::SkyBox(char* fileName)
     39SkyBox::SkyBox(const char* fileName)
    4940{
    5041  this->preInit();
     42  if (fileName)
     43    this->setTextureAndType(fileName, ".jpg");
    5144  this->postInit();
    5245}
    5346
    54 SkyBox::SkyBox(TiXmlElement* root) : WorldEntity(root)
     47SkyBox::SkyBox(const TiXmlElement* root) : WorldEntity(root)
    5548{
    5649  this->preInit();
    5750
    58   const char* string;
    59 
    60   // Model Loading     
    61   string = grabParameter( root, "materialset");
    62   if( string != NULL)
    63     this->setTexture(string, "jpg");
    64   else
    65     {
    66       PRINTF(0)("SkyBox is missing a proper 'MaterialSet'\n");
    67     }
    68   if( this->skyModel == NULL)
    69     {
    70       PRINTF(0)("SkyBox model '%s' could not be loaded\n", string);
    71     }
     51  this->loadParams(root);
     52
    7253  this->postInit();
     54}
     55
     56void SkyBox::loadParams(const TiXmlElement* root)
     57{
     58  LoadParam<SkyBox>(root, "Materialset", this, &SkyBox::setTexture)
     59    .describe("Sets the material on the SkyBox. The string must be the path relative to the data-dir, and without a trailing .jpg");
    7360}
    7461
     
    116103               "skybox_right.jpg", "skybox_front.jpg", "skybox_back.jpg");
    117104*/
    118 void SkyBox::setTexture(const char* name, const char* extension)
     105void SkyBox::setTextureAndType(const char* name, const char* extension)
    119106{
    120107  char* top    = new char[strlen(name)+strlen(extension)+ 10];
     
    219206
    220207  this->skyModel->setMaterial(material[0]);
    221   this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,1,3, 3,2,3, 5,3,3, 4,0,3); // top
     208  this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,0,3, 3,1,3, 5,2,3, 4,3,3); // top
    222209  this->skyModel->setMaterial(material[1]);
    223   this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,3,1, 7,0,1, 1,1,1, 0,2,1); // bottom
     210  this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,0,1, 7,1,1, 1,2,1, 0,3,1); // bottom
    224211  this->skyModel->setMaterial(material[2]);
    225   this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 0,0,2, 1,1,2, 3,2,2, 2,3,2); // left
     212  this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 4,2,2, 5,3,2, 7,0,2, 6,1,2); // left
    226213  this->skyModel->setMaterial(material[3]);
    227   this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 4,2,0, 5,3,0, 7,0,0, 6,1,0); // right
     214  this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 0,0,0, 1,1,0, 3,2,0, 2,3,0); // right
    228215  this->skyModel->setMaterial(material[4]);
    229   this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,0,5, 7,1,5, 5,2,5, 3,3,6); // front
     216  this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,0,5, 7,1,5, 5,2,5, 3,3,5); // front
    230217  this->skyModel->setMaterial(material[5]);
    231218  this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,0,4, 0,1,4, 2,2,4, 4,3,4); // back
Note: See TracChangeset for help on using the changeset viewer.