Changeset 4122 in orxonox.OLD for orxonox/branches/heightMap/src/world_entities/skybox.cc
- Timestamp:
- May 9, 2005, 11:29:19 AM (20 years ago)
- Location:
- orxonox/branches/heightMap
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/heightMap
- Property svn:externals
-
old new 1 data http://svn.orxonox.ethz.ch/data 1
-
- Property svn:externals
-
orxonox/branches/heightMap/src/world_entities/skybox.cc
r3913 r4122 28 28 29 29 #include "skybox.h" 30 30 31 #include "stdincl.h" 32 #include "factory.h" 31 33 32 34 #include "material.h" … … 36 38 //#include "world_entity.h" 37 39 40 CREATE_FACTORY(SkyBox); 38 41 39 42 using namespace std; … … 44 47 */ 45 48 SkyBox::SkyBox(char* fileName) 49 { 50 this->preInit(); 51 this->postInit(); 52 } 53 54 SkyBox::SkyBox(TiXmlElement* root) : WorldEntity(root) 55 { 56 this->preInit(); 57 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->model == NULL) 69 { 70 PRINTF(0)("SkyBox model '%s' could not be loaded\n", string); 71 } 72 this->postInit(); 73 } 74 75 void SkyBox::preInit(void) 46 76 { 47 77 this->setClassName("SkyBox"); … … 56 86 } 57 87 this->setMode(PNODE_MOVEMENT); 58 88 } 89 90 void SkyBox::postInit(void) 91 { 59 92 this->setSize(1900.0); 93 this->rebuild(); 60 94 } 61 95 … … 67 101 { 68 102 PRINTF(5)("Deleting the SkyBox\n"); 69 70 103 for (int i = 0; i < 6; i++) 71 104 delete this->material[i]; … … 84 117 void SkyBox::setTexture(const char* name, const char* extension) 85 118 { 86 char* top = new char[strlen(name)+strlen(extension)+ 6];87 char* bottom = new char[strlen(name)+strlen(extension)+ 9];88 char* left = new char[strlen(name)+strlen(extension)+ 7];89 char* right = new char[strlen(name)+strlen(extension)+ 8];90 char* front = new char[strlen(name)+strlen(extension)+ 8];91 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]; 92 125 93 126 sprintf(top, "%s_top.%s", name, extension); … … 100 133 this->setTextures(top, bottom, left, right, front, back); 101 134 135 // deleted alocated memory of this function 102 136 delete []top; 103 137 delete []bottom; … … 125 159 this->material[4]->setDiffuseMap(front); 126 160 this->material[5]->setDiffuseMap(back); 127 128 this->rebuild();129 161 } 130 162 … … 135 167 { 136 168 this->size = size; 137 138 this->rebuild();139 169 } 140 170 … … 188 218 189 219 model->setMaterial(material[0]); 190 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 3,2,4, 4,3,4, 6,4,4, 5,1,4); // top220 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,1,3, 3,2,3, 5,3,3, 4,0,3); // top 191 221 model->setMaterial(material[1]); 192 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 7,4,2, 8,1,2, 2,2,2, 1,3,2); // bottom222 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,3,1, 7,0,1, 1,1,1, 0,2,1); // bottom 193 223 model->setMaterial(material[2]); 194 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,1,3, 2,2,3, 4,3,3, 3,4,3); // left224 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 0,0,2, 1,1,2, 3,2,2, 2,3,2); // left 195 225 model->setMaterial(material[3]); 196 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 5,3,1, 6,4,1, 8,1,1, 7,2,1); // right226 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 4,2,0, 5,3,0, 7,0,0, 6,1,0); // right 197 227 model->setMaterial(material[4]); 198 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,1,6, 8,2,6, 6,3,6, 4,4,6); // front228 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,0,5, 7,1,5, 5,2,5, 3,3,6); // front 199 229 model->setMaterial(material[5]); 200 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 7,1,5, 1,2,5, 3,3,5, 5,4,5); // back230 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,0,4, 0,1,4, 2,2,4, 4,3,4); // back 201 231 202 232 model->finalize();
Note: See TracChangeset
for help on using the changeset viewer.