- Timestamp:
- May 2, 2005, 3:54:33 PM (20 years ago)
- Location:
- orxonox/trunk/src/world_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world_entities/skybox.cc
r4010 r4012 48 48 SkyBox::SkyBox(char* fileName) 49 49 { 50 this->init(); 50 this->preInit(); 51 this->postInit(); 51 52 } 52 53 53 54 SkyBox::SkyBox(TiXmlElement* root) : WorldEntity(root) 54 55 { 55 this->init(); 56 57 // Name Setup 58 char* temp; 56 this->preInit(); 57 59 58 const char* string; 60 59 61 60 // Model Loading 62 this->model = NULL;63 61 string = grabParameter( root, "materialset"); 64 62 if( string != NULL) … … 67 65 { 68 66 PRINTF(0)("SkyBox is missing a proper 'MaterialSet'\n"); 69 this->model = (Model*)ResourceManager::getInstance()->load("cube", OBJ, RP_CAMPAIGN);70 67 } 71 68 if( this->model == NULL) … … 73 70 PRINTF(0)("SkyBox model '%s' could not be loaded\n", string); 74 71 } 75 } 76 77 void SkyBox::init(void) 72 this->postInit(); 73 } 74 75 void SkyBox::preInit(void) 78 76 { 79 77 this->setClassName("SkyBox"); … … 88 86 } 89 87 this->setMode(PNODE_MOVEMENT); 90 88 } 89 90 void SkyBox::postInit(void) 91 { 91 92 this->setSize(1900.0); 93 this->rebuild(); 92 94 } 93 95 … … 99 101 { 100 102 PRINTF(5)("Deleting the SkyBox\n"); 101 102 103 for (int i = 0; i < 6; i++) 103 104 delete this->material[i]; … … 116 117 void SkyBox::setTexture(const char* name, const char* extension) 117 118 { 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]; 124 125 125 126 sprintf(top, "%s_top.%s", name, extension); … … 132 133 this->setTextures(top, bottom, left, right, front, back); 133 134 135 // deleted alocated memory of this function 134 136 delete []top; 135 137 delete []bottom; … … 157 159 this->material[4]->setDiffuseMap(front); 158 160 this->material[5]->setDiffuseMap(back); 159 160 this->rebuild();161 161 } 162 162 … … 167 167 { 168 168 this->size = size; 169 170 this->rebuild();171 169 } 172 170 -
orxonox/trunk/src/world_entities/skybox.h
r4010 r4012 26 26 virtual ~SkyBox(); 27 27 28 void init(void); 28 void preInit(void); 29 void postInit(void); 30 29 31 30 32 void setSize(float size);
Note: See TracChangeset
for help on using the changeset viewer.