Changeset 4283 in orxonox.OLD for orxonox/branches/physics/src/world_entities/skybox.cc
- Timestamp:
- May 24, 2005, 10:32:34 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/physics/src/world_entities/skybox.cc
r4178 r4283 11 11 12 12 ### 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: ... 24 15 */ 25 16 … … 46 37 \param fileName the file to take as input for the SkyBox 47 38 */ 48 SkyBox::SkyBox(c har* fileName)39 SkyBox::SkyBox(const char* fileName) 49 40 { 50 41 this->preInit(); 42 if (fileName) 43 this->setTextureAndType(fileName, ".jpg"); 51 44 this->postInit(); 52 45 } 53 46 54 SkyBox::SkyBox( TiXmlElement* root) : WorldEntity(root)47 SkyBox::SkyBox(const TiXmlElement* root) : WorldEntity(root) 55 48 { 56 49 this->preInit(); 57 50 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 72 53 this->postInit(); 54 } 55 56 void 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"); 73 60 } 74 61 … … 116 103 "skybox_right.jpg", "skybox_front.jpg", "skybox_back.jpg"); 117 104 */ 118 void SkyBox::setTexture (const char* name, const char* extension)105 void SkyBox::setTextureAndType(const char* name, const char* extension) 119 106 { 120 107 char* top = new char[strlen(name)+strlen(extension)+ 10]; … … 219 206 220 207 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); // top208 this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,0,3, 3,1,3, 5,2,3, 4,3,3); // top 222 209 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); // bottom210 this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,0,1, 7,1,1, 1,2,1, 0,3,1); // bottom 224 211 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); // left212 this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 4,2,2, 5,3,2, 7,0,2, 6,1,2); // left 226 213 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); // right214 this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 0,0,0, 1,1,0, 3,2,0, 2,3,0); // right 228 215 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); // front216 this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,0,5, 7,1,5, 5,2,5, 3,3,5); // front 230 217 this->skyModel->setMaterial(material[5]); 231 218 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.