Changeset 4165 in orxonox.OLD for orxonox/branches/heightMap/src/world_entities
- Timestamp:
- May 11, 2005, 2:23:54 PM (20 years ago)
- Location:
- orxonox/branches/heightMap/src/world_entities
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/heightMap/src/world_entities/skybox.cc
r4122 r4165 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/branches/heightMap/src/world_entities/skybox.h
r4122 r4165 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/branches/heightMap/src/world_entities/terrain.cc
r4090 r4165 109 109 void Terrain::init(void) 110 110 { 111 112 113 111 this->setClassName ("Terrain"); 112 113 this->objectList = 0; 114 114 } 115 115 … … 130 130 glMultMatrixf((float*)matrix); 131 131 132 if (objectList) 133 glCallList(objectList); 134 else if (model) 135 model->draw(); 136 // this->model->draw(); 132 if (this->objectList) 133 glCallList(this->objectList); 134 else if (this->model) 135 this->model->draw(); 137 136 glPopMatrix(); 138 137 }
Note: See TracChangeset
for help on using the changeset viewer.