Changeset 4680 in orxonox.OLD for orxonox/trunk/src/world_entities
- Timestamp:
- Jun 24, 2005, 12:12:41 AM (19 years ago)
- Location:
- orxonox/trunk/src/world_entities
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world_entities/skybox.cc
r4621 r4680 74 74 this->size = 100.0; 75 75 76 this->skyModel = NULL;77 76 this->material = new Material*[6]; 78 77 for (int i = 0; i < 6; i++) … … 179 178 glTranslatef(r.x, r.y, r.z); 180 179 181 this-> skyModel->draw();180 this->model->draw(); 182 181 183 182 glPopMatrix(); … … 192 191 void SkyBox::rebuild() 193 192 { 194 if (this-> skyModel)195 delete skyModel;196 skyModel = new Model();197 198 this-> skyModel->addVertex (-0.5*size, -0.5*size, 0.5*size);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 207 this-> skyModel->addVertexTexture (0.0, 1.0);208 this-> skyModel->addVertexTexture (1.0, 1.0);209 this-> skyModel->addVertexTexture (1.0, 0.0);210 this-> skyModel->addVertexTexture (0.0, 0.0);211 212 this-> skyModel->addVertexNormal (0.0, 0.0, 1.0);213 this-> skyModel->addVertexNormal (0.0, 1.0, 0.0);214 this-> skyModel->addVertexNormal (0.0, 0.0, -1.0);215 this-> skyModel->addVertexNormal (0.0, -1.0, 0.0);216 this-> skyModel->addVertexNormal (1.0, 0.0, 0.0);217 this-> skyModel->addVertexNormal (-1.0, 0.0, 0.0);218 219 this-> skyModel->setMaterial(material[0]);220 this-> skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,0,3, 3,1,3, 5,2,3, 4,3,3); // top221 this-> skyModel->setMaterial(material[1]);222 this-> skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,0,1, 7,1,1, 1,2,1, 0,3,1); // bottom223 this-> skyModel->setMaterial(material[2]);224 this-> skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 4,2,2, 5,3,2, 7,0,2, 6,1,2); // left225 this-> skyModel->setMaterial(material[3]);226 this-> skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 0,0,0, 1,1,0, 3,2,0, 2,3,0); // right227 this-> skyModel->setMaterial(material[4]);228 this-> skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,0,5, 7,1,5, 5,2,5, 3,3,5); // front229 this-> skyModel->setMaterial(material[5]);230 this-> skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,0,4, 0,1,4, 2,2,4, 4,3,4); // back231 232 this-> skyModel->finalize();233 } 193 if (this->model) 194 delete this->model; 195 model = new Model(); 196 197 this->model->addVertex (-0.5*size, -0.5*size, 0.5*size); 198 this->model->addVertex (0.5*size, -0.5*size, 0.5*size); 199 this->model->addVertex (-0.5*size, 0.5*size, 0.5*size); 200 this->model->addVertex (0.5*size, 0.5*size, 0.5*size); 201 this->model->addVertex (-0.5*size, 0.5*size, -0.5*size); 202 this->model->addVertex (0.5*size, 0.5*size, -0.5*size); 203 this->model->addVertex (-0.5*size, -0.5*size, -0.5*size); 204 this->model->addVertex (0.5*size, -0.5*size, -0.5*size); 205 206 this->model->addVertexTexture (0.0, 1.0); 207 this->model->addVertexTexture (1.0, 1.0); 208 this->model->addVertexTexture (1.0, 0.0); 209 this->model->addVertexTexture (0.0, 0.0); 210 211 this->model->addVertexNormal (0.0, 0.0, 1.0); 212 this->model->addVertexNormal (0.0, 1.0, 0.0); 213 this->model->addVertexNormal (0.0, 0.0, -1.0); 214 this->model->addVertexNormal (0.0, -1.0, 0.0); 215 this->model->addVertexNormal (1.0, 0.0, 0.0); 216 this->model->addVertexNormal (-1.0, 0.0, 0.0); 217 218 this->model->setMaterial(material[0]); 219 this->model->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,0,3, 3,1,3, 5,2,3, 4,3,3); // top 220 this->model->setMaterial(material[1]); 221 this->model->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,0,1, 7,1,1, 1,2,1, 0,3,1); // bottom 222 this->model->setMaterial(material[2]); 223 this->model->addFace (4, VERTEX_TEXCOORD_NORMAL, 4,2,2, 5,3,2, 7,0,2, 6,1,2); // left 224 this->model->setMaterial(material[3]); 225 this->model->addFace (4, VERTEX_TEXCOORD_NORMAL, 0,0,0, 1,1,0, 3,2,0, 2,3,0); // right 226 this->model->setMaterial(material[4]); 227 this->model->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,0,5, 7,1,5, 5,2,5, 3,3,5); // front 228 this->model->setMaterial(material[5]); 229 this->model->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,0,4, 0,1,4, 2,2,4, 4,3,4); // back 230 231 this->model->finalize(); 232 } -
orxonox/trunk/src/world_entities/skybox.h
r4620 r4680 26 26 virtual ~SkyBox(); 27 27 28 void preInit(void); 29 28 30 void loadParams(const TiXmlElement* root); 29 31 30 void preInit(void);31 32 void postInit(void); 32 33 … … 35 36 /** \brief assumes jpg as input-format */ 36 37 void setTexture(const char* name) { setTextureAndType (name, "jpg"); }; 38 37 39 void setTextureAndType(const char* name, const char* extension); 38 void setTextures(const char* top, const char* bottom, const char* left, const char* right, const char* front, const char* back); 40 void setTextures(const char* top, const char* bottom, const char* left, 41 const char* right, const char* front, const char* back); 39 42 40 43 virtual void draw(); … … 43 46 void rebuild(); 44 47 45 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.46 48 Material** material; //!< Materials for the SkyBox. sorted by number (0-5) top, bottom, left, right, front, back 47 49 float size; //!< Size of the SkyBox. This should match the frustum maximum range. -
orxonox/trunk/src/world_entities/world_entity.cc
r4597 r4680 19 19 20 20 #include "world_entity.h" 21 #include "model.h"22 21 #include "list.h" 23 22 #include "vector.h" -
orxonox/trunk/src/world_entities/world_entity.h
r4504 r4680 1 /*! 1 /*! 2 2 \file world_entity.h 3 3 \brief Definition of the basic WorldEntity … … 12 12 #include "factory.h" 13 13 #include "load_param.h" 14 #include "model.h" 14 15 15 16 //class CollisionCluster; 16 17 class CharacterAttributes; 17 class Model;18 18 class SoundEngine; 19 19 class SoundBuffer; … … 22 22 //! Basic class from which all interactive stuff in the world is derived from 23 23 class WorldEntity : public PNode 24 { 24 { 25 25 friend class World; 26 26 … … 33 33 34 34 //void setCollision (CollisionCluster* newhull); 35 35 36 36 //void addAbility(Ability* ability); 37 37 //void removeAbility(Ability* ability); 38 void setDrawable (bool bDraw); 38 void setDrawable (bool bDraw); 39 39 void setCharacterAttributes(CharacterAttributes* charAttr); 40 40 CharacterAttributes* getCharacterAttributes(); … … 47 47 virtual void command (Command* cmd); 48 48 49 /** \returns the Count of Faces on this WorldEntity */ 50 virtual unsigned int getFaceCount (void) const { if (this->model) return this->model->getFaceCount(); else return 0; }; 51 49 52 void processDraw (); 50 53 virtual void draw (); 51 54 virtual void tick (float time); 52 55 53 56 protected: 54 57 Model* model; //!< The model that should be loaded for this entity. 55 58 CharacterAttributes* charAttr; //!< the character attributes of a world_entity 56 59 57 60 private: 58 61 bool bCollide; //!< If it should be considered for the collisiontest.
Note: See TracChangeset
for help on using the changeset viewer.