Changeset 8081 in orxonox.OLD for branches/bsp_model/src/world_entities
- Timestamp:
- Jun 1, 2006, 4:42:01 PM (18 years ago)
- Location:
- branches/bsp_model/src/world_entities
- Files:
-
- 2 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/world_entities/WorldEntities.am
r7167 r8081 15 15 world_entities/test_entity.cc \ 16 16 world_entities/planet.cc \ 17 world_entities/bsp_entity.cc \ 17 18 \ 18 19 world_entities/weapons/test_gun.cc \ … … 65 66 test_entity.h \ 66 67 planet.h \ 68 bsp_entity.h \ 67 69 \ 68 70 weapons/test_gun.h \ -
branches/bsp_model/src/world_entities/bsp_entity.cc
r7540 r8081 14 14 */ 15 15 16 #include " proto_world_entity.h"17 16 #include "bsp_entity.h" 17 #include "util/loading/resource_manager.h" 18 18 using namespace std; 19 19 20 20 CREATE_FACTORY(BSPEntity, CL_BSP_ENTITY); 21 21 /** 22 * constructs and loads a ProtoWorldEntity from a XML-element22 * constructs and loads a BSPEntity from a XML-element 23 23 * @param root the XML-element to load from 24 24 */ 25 ProtoWorldEntity::ProtoWorldEntity(const TiXmlElement* root)25 BSPEntity::BSPEntity(const TiXmlElement* root) 26 26 { 27 27 this->init(); … … 34 34 * standard deconstructor 35 35 */ 36 ProtoWorldEntity::~ProtoWorldEntity ()36 BSPEntity::~BSPEntity () 37 37 { 38 38 39 39 } 40 40 41 void BSPEntity::setName(const std::string& name) 42 { 43 printf("+++++++++++ LOADING NAME %s\n", name.c_str()); 44 45 this->bspManager->load(name.c_str(), 0.1f); 46 } 47 48 41 49 42 50 /** 43 * initializes the ProtoWorldEntity51 * initializes the BSPEntity 44 52 * @todo change this to what you wish 45 53 */ 46 void ProtoWorldEntity::init()54 void BSPEntity::init() 47 55 { 48 this->setClassID(CL_PROTO_WORLD_ENTITY, "ProtoWorldEntity"); 56 this->bspManager = new BspManager(); 57 this->setClassID(CL_BSP_ENTITY, "BSPEntity"); 49 58 59 this->toList(OM_ENVIRON); 60 50 61 /** 51 * @todo: Write CL_ PROTO_WORLD_ENTITY INTO THE src/defs/class_id.h (your own definition)62 * @todo: Write CL_BSP_ENTITY INTO THE src/defs/class_id.h (your own definition) 52 63 */ 53 64 … … 56 67 57 68 /** 58 * loads a ProtoWorldEntity from a XML-element69 * loads a BSPEntity from a XML-element 59 70 * @param root the XML-element to load from 60 71 * @todo make the class Loadable 61 72 */ 62 void ProtoWorldEntity::loadParams(const TiXmlElement* root)73 void BSPEntity::loadParams(const TiXmlElement* root) 63 74 { 64 75 // all the clases this Entity is directly derived from must be called in this way, to load all settings. 65 WorldEntity::loadParam(root); 76 // WorldEntity::loadParam(root); 77 78 LoadParam(root, "Name", this, BSPEntity, setName) 79 .describe("Sets the of the BSP file."); 66 80 81 /* LoadParam(root, "Scale", this, BSpEntity, setScale) 82 .describe("Sets the scale factore of the bsp level."); 83 */ 67 84 68 85 /** … … 73 90 74 91 /** 75 * advances the ProtoWorldEntity about time seconds92 * advances the BSPEntity about time seconds 76 93 * @param time the Time to step 77 94 */ 78 ProtoWorldEntity::tick(float time)95 void BSPEntity::tick(float time) 79 96 { 80 97 81 98 } 82 99 100 83 101 /** 84 102 * draws this worldEntity 85 103 */ 86 void ProtoWorldEntity::draw () const104 void BSPEntity::draw () const 87 105 { 88 glMatrixMode(GL_MODELVIEW); 89 glPushMatrix(); 90 float matrix[4][4]; 91 92 /* translate */ 93 glTranslatef (this->getAbsCoor ().x, 94 this->getAbsCoor ().y, 95 this->getAbsCoor ().z); 96 /* rotate */ 97 this->getAbsDir().matrix(matrix); 98 glMultMatrixf((float*)matrix); 99 100 if (model) 101 model->draw(); 102 glPopMatrix(); 106 this->bspManager->draw(); 103 107 } 104 108 … … 108 112 * 109 113 */ 110 void ProtoWorldEntity::collidesWith (WorldEntity* entity, const Vector& location)114 void BSPEntity::collidesWith (WorldEntity* entity, const Vector& location) 111 115 { 112 116 -
branches/bsp_model/src/world_entities/bsp_entity.h
r7540 r8081 1 1 /*! 2 * @file proto_world_entity.h2 * @file bsp_entity.h 3 3 * @brief description 4 4 */ 5 5 6 #ifndef _ PROTO_WORLD_ENTITY_H7 #define _ PROTO_WORLD_ENTITY_H6 #ifndef _BSP_ENTITY_H 7 #define _BSP_ENTITY_H 8 8 9 9 #include "world_entity.h" 10 #include "bsp_manager.h" 11 12 #include "util/loading/factory.h" 13 #include "util/loading/load_param.h" 14 15 10 16 11 17 //! A Class to ... 12 class ProtoWorldEntity : public WorldEntity18 class BSPEntity : public WorldEntity 13 19 { 14 20 15 21 public: 16 ProtoWorldEntity(const TiXmlElement* root = NULL);17 virtual ~ ProtoWorldEntity();22 BSPEntity(const TiXmlElement* root = NULL); 23 virtual ~BSPEntity(); 18 24 19 25 virtual void loadParams(const TiXmlElement* root); 26 27 void setName(const std::string& name); 28 20 29 void init(); 21 22 virtual void postSpawn ();23 virtual void leftWorld ();24 25 30 26 31 virtual void draw() const; … … 29 34 30 35 private: 36 BspManager* bspManager; 31 37 32 38 }; 33 39 34 #endif /* _ PROTO_WORLD_ENTITY_H */40 #endif /* _BSP_ENTITY_H */ -
branches/bsp_model/src/world_entities/terrain.cc
r7352 r8081 117 117 118 118 this->bspManager = new BspManager(); 119 this->bspManager->load("test.bsp", 0.4); 119 120 //this->loadTexture("maps/wall1.jpeg"); 120 121 } … … 208 209 // Vector tmpRot = this->getAbsDir().getSpacialAxis(); 209 210 //glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 210 /* 211 211 212 if (this->objectList) 212 213 glCallList(this->objectList); … … 226 227 } 227 228 228 */ 229 230 this->bspManager->draw();229 230 231 // this->bspManager->draw(); 231 232 glPopMatrix(); 232 233
Note: See TracChangeset
for help on using the changeset viewer.