- Timestamp:
- May 26, 2005, 3:20:55 PM (20 years ago)
- Location:
- orxonox/branches/physics/src
- Files:
-
- 12 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/physics/src/defs/debug.h
r4178 r4301 56 56 // DEFINE MODULES 57 57 #define DEBUG_MODULE_ORXONOX 0 58 #define DEBUG_MODULE_WORLD 159 #define DEBUG_MODULE_PNODE 158 #define DEBUG_MODULE_WORLD 0 59 #define DEBUG_MODULE_PNODE 0 60 60 #define DEBUG_MODULE_WORLD_ENTITY 0 61 #define DEBUG_MODULE_COMMAND_NODE 461 #define DEBUG_MODULE_COMMAND_NODE 0 62 62 #define DEBUG_MODULE_GRAPHICS 0 63 63 #define DEBUG_MODULE_LOAD 2 64 64 65 #define DEBUG_MODULE_IMPORTER 365 #define DEBUG_MODULE_IMPORTER 0 66 66 #define DEBUG_MODULE_TRACK_MANAGER 0 67 67 #define DEBUG_MODULE_GARBAGE_COLLECTOR 0 68 #define DEBUG_MODULE_OBJECT_MANAGER 3 68 69 #define DEBUG_MODULE_LIGHT 0 69 70 #define DEBUG_MODULE_PLAYER 1 70 #define DEBUG_MODULE_WEAPON 371 #define DEBUG_MODULE_WEAPON 0 71 72 #define DEBUG_MODULE_MATH 0 72 73 #define DEBUG_MODULE_FONT 1 73 74 #define DEBUG_MODULE_ANIM 1 74 #define DEBUG_MODULE_PARTICLE 475 #define DEBUG_MODULE_PARTICLE 1 75 76 76 77 #define DEBUG_MODULE_NULL_PARENT 0 -
orxonox/branches/physics/src/lib/graphics/importer/md2Model.cc
r4283 r4301 68 68 69 69 /******************************************************************************** 70 * MD2Model * 71 ********************************************************************************/ 72 70 * MD2Model * ********************************************************************************/ 71 72 /* 73 \brief simple constructor initializing all variables 74 */ 73 75 MD2Model::MD2Model() 74 76 { … … 80 82 } 81 83 82 84 /* 85 \brief simple destructor, dereferencing all variables 86 87 this is where the ressource manager is cleaning the stuff 88 */ 83 89 MD2Model::~MD2Model() 84 90 { … … 86 92 } 87 93 88 94 /* 95 \brief load model 96 \param name of the model file 97 \return true if everything worked out smoothly 98 */ 89 99 bool MD2Model::loadModel(const char* fileName) 90 100 { … … 93 103 94 104 105 /* 106 \brief load the skin as a material 107 \param name of the texture file 108 \return true if ok 109 */ 95 110 bool MD2Model::loadSkin(const char* fileName) 96 111 { … … 122 137 123 138 139 /* 140 \brief sets the animation type 141 \param animation type 142 143 the animation types can be looked up in the animationType table 144 */ 124 145 void MD2Model::setAnim(int type) 125 146 { … … 140 161 141 162 163 /* 164 \brief sets the time in seconds passed since the last tick 165 \param time in sec 166 */ 142 167 void MD2Model::tick(float time) 143 168 { … … 146 171 147 172 173 /* 174 \brief draws the model: interface for all other classes out in the world 175 */ 148 176 void MD2Model::draw() 149 177 { … … 159 187 160 188 189 /* 190 \brief this is an internal function to render this special frame selected by animate() 191 */ 161 192 void MD2Model::renderFrame() 162 193 { … … 200 231 201 232 233 /* 234 \brief animates the current model 235 236 depending on the time passed (tick function), the player will select another model 237 */ 202 238 void MD2Model::animate() 203 239 { … … 222 258 223 259 224 /* hhmmm... id used a very different way to do lightning... */ 260 /* 261 \brief this is how id is precessing their lightning 262 263 the details of how the whole lighting process is beeing handled - i have no idea... :) 264 */ 225 265 void MD2Model::processLighting() 226 266 { … … 228 268 } 229 269 230 270 /* 271 \brief prints out debug informations 272 */ 231 273 void MD2Model::debug() 232 274 { … … 246 288 ********************************************************************************/ 247 289 248 290 /* 291 \brief simple constructor 292 */ 249 293 MD2Data::MD2Data() 250 294 { … … 261 305 262 306 307 /* 308 \brief simple destructor 309 310 this will clean out all the necessary data for a specific md2model 311 */ 263 312 MD2Data::~MD2Data() 264 313 { … … 270 319 271 320 321 /* 322 \brief this will load the whole model data (vertices, opengl command list, ...) 323 \param name to the model file 324 \return true if success 325 */ 272 326 bool MD2Data::loadModel(const char* fileName) 273 327 { … … 335 389 336 390 391 /* 392 \brief loads the skin/material stuff 393 \param name of the skin file 394 \return true if success 395 */ 337 396 bool MD2Data::loadSkin(const char* fileName) 338 397 { -
orxonox/branches/physics/src/orxonox.cc
r4283 r4301 35 35 #include "graphics_engine.h" 36 36 #include "resource_manager.h" 37 #include "object_manager.h" 37 38 #include "text_engine.h" 38 39 #include "factory.h" … … 56 57 this->world = NULL; 57 58 this->localinput = NULL; 59 this->resourceManager = NULL; 60 this->objectManager = NULL; 58 61 59 62 this->argc = 0; … … 72 75 delete GraphicsEngine::getInstance(); // deleting the Graphics 73 76 delete ResourceManager::getInstance(); // deletes the Resource Manager 77 delete ObjectManager::getInstance(); 74 78 delete TextEngine::getInstance(); 75 79 } … … 225 229 TextEngine::getInstance(); 226 230 231 PRINT(3)("initializing ObjectManager\n"); 232 this->objectManager = ObjectManager::getInstance(); 233 227 234 return 0; 228 235 } -
orxonox/branches/physics/src/orxonox.h
r4283 r4301 16 16 class GameLoader; 17 17 class ResourceManager; 18 class ObjectManager; 18 19 19 20 //! Orxonox core singleton class … … 32 33 GameLoader* gameLoader; //!< The gameLoader 33 34 ResourceManager* resourceManager; //!< The ResourceManager 35 ObjectManager* objectManager; //!< the object manager of the game 34 36 35 37 bool bQuitOrxonox; //!< If Orxonox should Quit -
orxonox/branches/physics/src/story_entities/world.cc
r4293 r4301 42 42 #include "track_manager.h" 43 43 #include "garbage_collector.h" 44 #include "object_manager.h" 44 45 #include "animation_player.h" 45 46 #include "particle_engine.h" … … 58 59 59 60 #include "factory.h" 61 62 #include "projectile.h" 60 63 61 64 using namespace std; -
orxonox/branches/physics/src/util/garbage_collector.cc
r4283 r4301 25 25 26 26 #include "list.h" 27 #include "object_manager.h" 27 28 28 29 using namespace std; … … 137 138 entity->remove(); 138 139 /* then finaly delete reference */ 139 delete entity; 140 //delete entity; 141 ObjectManager::getInstance()->addToDeadList(CL_TEST_BULLET, entity); 142 ObjectManager::getInstance()->debug(); 140 143 } 141 144 entity = iterator->nextElement(); -
orxonox/branches/physics/src/util/loading/load_param.cc
r4283 r4301 10 10 11 11 ### File Specific: 12 main-programmer: Christian Meyer12 main-programmer: Benjamin Grauer 13 13 co-programmer: ... 14 14 */ … … 27 27 \param ... the parameter information 28 28 */ 29 BaseLoadParam::BaseLoadParam(BaseObject* object, const char* paramName, int paramCount, ...) 30 { 29 BaseLoadParam::BaseLoadParam(const TiXmlElement* root, BaseObject* object, const char* paramName, int paramCount, ...) 30 { 31 this->loadString = grabParameter(root, paramName); 32 31 33 this->paramDesc = NULL; 32 34 if (LoadClassDescription::parametersDescription) … … 47 49 strcpy(this->paramDesc->types[i], tmpTypeName); 48 50 } 49 va_end(types); 51 va_end(types); 50 52 51 53 int argCount = 0; -
orxonox/branches/physics/src/util/loading/load_param.h
r4283 r4301 65 65 #define LoadParam1(type1) \ 66 66 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE)) \ 67 : BaseLoadParam(pt2Object, paramName, 1, type1##_NAME) \ 68 { \ 69 const char* loadString = grabParameter(root, paramName); \ 67 : BaseLoadParam(root, pt2Object, paramName, 1, type1##_NAME) \ 68 { \ 70 69 if (loadString != NULL && root != NULL) \ 71 70 (*pt2Object.*function)(type1##_FUNC(loadString)); \ … … 78 77 #define LoadParam2(type1, type2) \ 79 78 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE)) \ 80 : BaseLoadParam(pt2Object, paramName, 2, type1##_NAME, type2##_NAME) \ 81 { \ 82 const char* loadString = grabParameter(root, paramName); \ 79 : BaseLoadParam(root, pt2Object, paramName, 2, type1##_NAME, type2##_NAME) \ 80 { \ 83 81 if (loadString != NULL && root != NULL) \ 84 82 { \ … … 98 96 #define LoadParam3(type1, type2, type3) \ 99 97 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE))\ 100 : BaseLoadParam(pt2Object, paramName, 3, type1##_NAME, type2##_NAME, type3##_NAME) \ 101 { \ 102 const char* loadString = grabParameter(root, paramName); \ 98 : BaseLoadParam(root, pt2Object, paramName, 3, type1##_NAME, type2##_NAME, type3##_NAME) \ 99 { \ 103 100 if (loadString != NULL && root != NULL) \ 104 101 { \ … … 118 115 #define LoadParam4(type1, type2, type3, type4) \ 119 116 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE)) \ 120 : BaseLoadParam(pt2Object, paramName, 4, type1##_NAME, type2##_NAME, type3##_NAME, type2##_NAME, type4##_NAME) \ 121 { \ 122 const char* loadString = grabParameter(root, paramName); \ 117 : BaseLoadParam(root, pt2Object, paramName, 4, type1##_NAME, type2##_NAME, type3##_NAME, type2##_NAME, type4##_NAME) \ 118 { \ 123 119 if (loadString != NULL && root != NULL) \ 124 120 { \ … … 138 134 #define LoadParam5(type1, type2, type3, type4, type5) \ 139 135 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE, type5##_TYPE)) \ 140 : BaseLoadParam(pt2Object, paramName, 5, type1##_NAME, type2##_NAME, type3##_NAME, type2##_NAME, type4##_NAME, type5##_NAME) \ 141 { \ 142 const char* loadString = grabParameter(root, paramName); \ 136 : BaseLoadParam(root, pt2Object, paramName, 5, type1##_NAME, type2##_NAME, type3##_NAME, type2##_NAME, type4##_NAME, type5##_NAME) \ 137 { \ 143 138 if (loadString != NULL && root != NULL) \ 144 139 { \ … … 202 197 203 198 protected: 204 BaseLoadParam( BaseObject* object, const char* paramName, int paramCount, ...);199 BaseLoadParam(const TiXmlElement* root, BaseObject* object, const char* paramName, int paramCount, ...); 205 200 206 201 protected: 207 202 LoadClassDescription* classDesc; //!< The LoadClassDescription of this LoadParameter 208 203 LoadParamDescription* paramDesc; //!< The LoadParameterDescription of this LoadParameter 204 const char* loadString; //!< The string loaded by this LoadParam 209 205 }; 210 206 -
orxonox/branches/physics/src/util/object_manager.cc
r4283 r4301 11 11 ### File Specific: 12 12 main-programmer: Patrick Boenzli 13 co-programmer: ...14 13 */ 15 14 … … 17 16 18 17 #include "object_manager.h" 18 #include "garbage_collector.h" 19 #include "list.h" 20 19 21 20 22 using namespace std; … … 26 28 ObjectManager::ObjectManager () 27 29 { 28 this->setClassName ("ObjectManager"); 30 this->setClassName ("ObjectManager"); 31 32 //this->managedObjectList = new BaseObject*[CL_NUMBER]; 33 this->managedObjectList = new tList<BaseObject>*[CL_NUMBER]; 29 34 35 this->garbageCollector = GarbageCollector::getInstance(); 30 36 } 31 37 … … 45 51 } 46 52 53 47 54 /** 48 55 \brief standard deconstructor … … 52 59 { 53 60 ObjectManager::singletonRef = NULL; 61 } 54 62 63 64 void ObjectManager::cache(classList index, int number, const BaseObject ©Object) 65 { 66 //this->managedObjectList[index] = new BaseObject[number]; 67 this->managedObjectList[index] = new tList<BaseObject>(); 68 for(int i = 0; i < number; ++i) 69 { 70 this->managedObjectList[index]->add(new BaseObject(copyObject)); 71 } 55 72 } 73 74 75 void ObjectManager::addToDeadList(classList index, BaseObject* object) 76 { 77 if( likely(this->managedObjectList[index] != NULL)) 78 this->managedObjectList[index]->add(object); 79 else 80 PRINTF(0)(" Error: unable to add object to the list nr. %i: no list initialized - ignoring\n", index); 81 } 82 83 84 BaseObject* ObjectManager::getFromDeadList(classList index, int number) 85 { 86 if( likely(this->managedObjectList[index] != NULL)) 87 { 88 BaseObject* obj = this->managedObjectList[index]->firstElement(); 89 this->managedObjectList[index]->remove(obj); 90 return obj; 91 } 92 else 93 PRINTF(0)(" Error: unable to get object from the list nr. %i: no elements initialized - ignoring\n", index); 94 } 95 96 97 void ObjectManager::debug() 98 { 99 PRINT(0)("\n==========================| ObjectManager::debug() |===\n"); 100 PRINT(0)("= Number of registerable classes: %i\n", CL_NUMBER ); 101 PRINT(0)("= Currently cached objects: \n"); 102 for(int i = 0; i < CL_NUMBER; ++i) 103 { 104 if(this->managedObjectList[i] != NULL) 105 PRINT(0)("= o Class Nr. %i has cached %i object(s)\n", i, this->managedObjectList[i]->getSize()); 106 else 107 PRINT(0)("= o Class Nr. %i has cached 0 object(s)\n", i); 108 } 109 PRINT(0)("=======================================================\n"); 110 } -
orxonox/branches/physics/src/util/object_manager.h
r4283 r4301 18 18 #define OM_ 19 19 20 #include "class_list.h" 21 22 20 23 class WorldEntity; 24 class GarbageCollector; 21 25 22 26 23 27 template<class T> class tList; 28 template<class T> class ManagedObject; 24 29 25 30 //! the object manager itself … … 29 34 static ObjectManager* getInstance(void); 30 35 virtual ~ObjectManager(void); 36 37 void cache(classList index, int number, const BaseObject ©Object); 38 void addToDeadList(classList index, BaseObject* object); 39 BaseObject* getFromDeadList(classList index, int number = 1); 31 40 32 void preLoad();41 void debug(); 33 42 34 43 private: … … 36 45 static ObjectManager* singletonRef; 37 46 38 tList<WorldEntity>* projectileBuffer; //!< a list of projectiles that is generated at the beginning to make orx faster 47 //BaseObject** managedObjectList; 48 tList<BaseObject>** managedObjectList; 49 GarbageCollector* garbageCollector; 50 }; 39 51 40 52 41 };42 53 43 54 #endif /* _OBJECT_MANAGER_H */ -
orxonox/branches/physics/src/world_entities/player.cc
r4283 r4301 27 27 #include "list.h" 28 28 #include "stdincl.h" 29 30 #include "object_manager.h" 31 #include "projectile.h" 29 32 30 33 using namespace std; … … 59 62 this->weaponMan->addWeapon(wpRight, W_CONFIG2); 60 63 this->weaponMan->addWeapon(wpLeft, W_CONFIG2); 61 62 64 } 63 65 -
orxonox/branches/physics/src/world_entities/test_gun.cc
r4178 r4301 31 31 #include "list.h" 32 32 #include "animation3d.h" 33 34 #include "object_manager.h" 33 35 34 36 using namespace std; … … 87 89 } 88 90 91 BaseObject* p = new TestBullet(this); 92 ObjectManager::getInstance()->cache(CL_TEST_BULLET, 100, *p); 93 ObjectManager::getInstance()->debug(); 89 94 } 90 95
Note: See TracChangeset
for help on using the changeset viewer.