Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4012 in orxonox.OLD


Ignore:
Timestamp:
May 2, 2005, 3:54:33 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: some fixes in the SkyBox, loading of skybox should now run smoothely

Location:
orxonox/trunk/src/world_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/world_entities/skybox.cc

    r4010 r4012  
    4848SkyBox::SkyBox(char* fileName)
    4949{
    50   this->init();
     50  this->preInit();
     51  this->postInit();
    5152}
    5253
    5354SkyBox::SkyBox(TiXmlElement* root) : WorldEntity(root)
    5455{
    55   this->init();
    56 
    57   // Name Setup
    58   char* temp;
     56  this->preInit();
     57
    5958  const char* string;
    6059
    6160  // Model Loading     
    62   this->model = NULL;
    6361  string = grabParameter( root, "materialset");
    6462  if( string != NULL)
     
    6765    {
    6866      PRINTF(0)("SkyBox is missing a proper 'MaterialSet'\n");
    69       this->model = (Model*)ResourceManager::getInstance()->load("cube", OBJ, RP_CAMPAIGN);
    7067    }
    7168  if( this->model == NULL)
     
    7370      PRINTF(0)("SkyBox model '%s' could not be loaded\n", string);
    7471    }
    75 }
    76 
    77 void SkyBox::init(void)
     72  this->postInit();
     73}
     74
     75void SkyBox::preInit(void)
    7876{
    7977  this->setClassName("SkyBox");
     
    8886    }
    8987  this->setMode(PNODE_MOVEMENT);
    90 
     88}
     89
     90void SkyBox::postInit(void)
     91{
    9192  this->setSize(1900.0);
     93  this->rebuild();
    9294}
    9395
     
    99101{
    100102  PRINTF(5)("Deleting the SkyBox\n");
    101  
    102103  for (int i = 0; i < 6; i++)
    103104    delete this->material[i];
     
    116117void SkyBox::setTexture(const char* name, const char* extension)
    117118{
    118   char* top    = new char[strlen(name)+strlen(extension)+ 6];
    119   char* bottom = new char[strlen(name)+strlen(extension)+ 9];
    120   char* left   = new char[strlen(name)+strlen(extension)+ 7];
    121   char* right  = new char[strlen(name)+strlen(extension)+ 8];
    122   char* front  = new char[strlen(name)+strlen(extension)+ 8];
    123   char* back   = new char[strlen(name)+strlen(extension)+ 7];
     119  char* top    = new char[strlen(name)+strlen(extension)+ 10];
     120  char* bottom = new char[strlen(name)+strlen(extension)+ 10];
     121  char* left   = new char[strlen(name)+strlen(extension)+ 10];
     122  char* right  = new char[strlen(name)+strlen(extension)+ 10];
     123  char* front  = new char[strlen(name)+strlen(extension)+ 10];
     124  char* back   = new char[strlen(name)+strlen(extension)+ 10];
    124125
    125126  sprintf(top, "%s_top.%s", name, extension);
     
    132133  this->setTextures(top, bottom, left, right, front, back);
    133134
     135  // deleted alocated memory of this function
    134136  delete []top;
    135137  delete []bottom;
     
    157159  this->material[4]->setDiffuseMap(front);
    158160  this->material[5]->setDiffuseMap(back);
    159 
    160   this->rebuild();
    161161}
    162162
     
    167167{
    168168  this->size = size;
    169 
    170   this->rebuild();
    171169}
    172170
  • orxonox/trunk/src/world_entities/skybox.h

    r4010 r4012  
    2626  virtual ~SkyBox();
    2727
    28   void init(void);
     28  void preInit(void);
     29  void postInit(void);
     30
    2931
    3032  void setSize(float size);
Note: See TracChangeset for help on using the changeset viewer.