Changeset 4136 in orxonox.OLD for orxonox/trunk/src/world_entities
- Timestamp:
- May 10, 2005, 12:06:20 AM (20 years ago)
- Location:
- orxonox/trunk/src/world_entities
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world_entities/skybox.cc
r4112 r4136 66 66 PRINTF(0)("SkyBox is missing a proper 'MaterialSet'\n"); 67 67 } 68 if( this-> model == NULL)68 if( this->skyModel == NULL) 69 69 { 70 70 PRINTF(0)("SkyBox model '%s' could not be loaded\n", string); … … 76 76 { 77 77 this->setClassName("SkyBox"); 78 this->skyModel = NULL; 78 79 this->material = new Material*[6]; 79 for (int i = 0; i < 6; i++)80 for (int i = 0; i < 6; i++) 80 81 { 81 82 this->material[i] = new Material(); … … 100 101 SkyBox::~SkyBox() 101 102 { 102 PRINTF(5)("Deleting theSkyBox\n");103 PRINTF(5)("Deleting SkyBox\n"); 103 104 for (int i = 0; i < 6; i++) 104 105 delete this->material[i]; … … 179 180 glTranslatef(r.x, r.y, r.z); 180 181 181 this-> model->draw();182 this->skyModel->draw(); 182 183 183 184 glPopMatrix(); … … 192 193 void SkyBox::rebuild() 193 194 { 194 if (this-> model)195 delete model;196 model = new Model();197 198 model->addVertex (-0.5*size, -0.5*size, 0.5*size);199 model->addVertex (0.5*size, -0.5*size, 0.5*size);200 model->addVertex (-0.5*size, 0.5*size, 0.5*size);201 model->addVertex (0.5*size, 0.5*size, 0.5*size);202 model->addVertex (-0.5*size, 0.5*size, -0.5*size);203 model->addVertex (0.5*size, 0.5*size, -0.5*size);204 model->addVertex (-0.5*size, -0.5*size, -0.5*size);205 model->addVertex (0.5*size, -0.5*size, -0.5*size);206 207 model->addVertexTexture (0.0, 0.0);208 model->addVertexTexture (1.0, 0.0);209 model->addVertexTexture (1.0, 1.0);210 model->addVertexTexture (0.0, 1.0);211 212 model->addVertexNormal (0.0, 0.0, 1.0);213 model->addVertexNormal (0.0, 1.0, 0.0);214 model->addVertexNormal (0.0, 0.0, -1.0);215 model->addVertexNormal (0.0, -1.0, 0.0);216 model->addVertexNormal (1.0, 0.0, 0.0);217 model->addVertexNormal (-1.0, 0.0, 0.0);218 219 model->setMaterial(material[0]);220 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,1,3, 3,2,3, 5,3,3, 4,0,3); // top221 model->setMaterial(material[1]);222 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,3,1, 7,0,1, 1,1,1, 0,2,1); // bottom223 model->setMaterial(material[2]);224 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 0,0,2, 1,1,2, 3,2,2, 2,3,2); // left225 model->setMaterial(material[3]);226 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 4,2,0, 5,3,0, 7,0,0, 6,1,0); // right227 model->setMaterial(material[4]);228 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,0,5, 7,1,5, 5,2,5, 3,3,6); // front229 model->setMaterial(material[5]);230 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,0,4, 0,1,4, 2,2,4, 4,3,4); // back195 if (this->skyModel) 196 delete skyModel; 197 skyModel = new Model(); 198 199 this->skyModel->addVertex (-0.5*size, -0.5*size, 0.5*size); 200 this->skyModel->addVertex (0.5*size, -0.5*size, 0.5*size); 201 this->skyModel->addVertex (-0.5*size, 0.5*size, 0.5*size); 202 this->skyModel->addVertex (0.5*size, 0.5*size, 0.5*size); 203 this->skyModel->addVertex (-0.5*size, 0.5*size, -0.5*size); 204 this->skyModel->addVertex (0.5*size, 0.5*size, -0.5*size); 205 this->skyModel->addVertex (-0.5*size, -0.5*size, -0.5*size); 206 this->skyModel->addVertex (0.5*size, -0.5*size, -0.5*size); 207 208 this->skyModel->addVertexTexture (0.0, 0.0); 209 this->skyModel->addVertexTexture (1.0, 0.0); 210 this->skyModel->addVertexTexture (1.0, 1.0); 211 this->skyModel->addVertexTexture (0.0, 1.0); 212 213 this->skyModel->addVertexNormal (0.0, 0.0, 1.0); 214 this->skyModel->addVertexNormal (0.0, 1.0, 0.0); 215 this->skyModel->addVertexNormal (0.0, 0.0, -1.0); 216 this->skyModel->addVertexNormal (0.0, -1.0, 0.0); 217 this->skyModel->addVertexNormal (1.0, 0.0, 0.0); 218 this->skyModel->addVertexNormal (-1.0, 0.0, 0.0); 219 220 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 222 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 224 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 226 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 228 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 230 this->skyModel->setMaterial(material[5]); 231 this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,0,4, 0,1,4, 2,2,4, 4,3,4); // back 231 232 232 model->finalize();233 } 233 this->skyModel->finalize(); 234 } -
orxonox/trunk/src/world_entities/skybox.h
r4012 r4136 39 39 void rebuild(); 40 40 41 Model* skyModel; //!< A Model for the Sky. This must not be the same as the Model from WorldEntity, because it is not alocated through the ResourceManager. 41 42 Material **material; //!< Materials for the SkyBox. sorted by number (0-5) top, bottom, left, right, front, back 42 43 float size; //!< Size of the SkyBox. This should match the frustum maximum range. -
orxonox/trunk/src/world_entities/terrain.cc
r3677 r4136 77 77 void Terrain::init(void) 78 78 { 79 80 81 79 this->setClassName ("Terrain"); 80 81 this->objectList = 0; 82 82 } 83 83 … … 98 98 glMultMatrixf((float*)matrix); 99 99 100 if (objectList) 101 glCallList(objectList); 102 else if (model) 103 model->draw(); 104 // this->model->draw(); 100 if (this->objectList) 101 glCallList(this->objectList); 102 else if (this->model) 103 this->model->draw(); 105 104 glPopMatrix(); 106 105 }
Note: See TracChangeset
for help on using the changeset viewer.