Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4301 in orxonox.OLD for orxonox/branches/physics/src


Ignore:
Timestamp:
May 26, 2005, 3:20:55 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/physics: merged the trunk back to the physics-branche
merged with command:
svn merge -4 4283:HEAD ../../trunk/ .
no conflicts

Location:
orxonox/branches/physics/src
Files:
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • orxonox/branches/physics/src/defs/debug.h

    r4178 r4301  
    5656// DEFINE MODULES
    5757#define DEBUG_MODULE_ORXONOX            0
    58 #define DEBUG_MODULE_WORLD              1
    59 #define DEBUG_MODULE_PNODE              1
     58#define DEBUG_MODULE_WORLD              0
     59#define DEBUG_MODULE_PNODE              0
    6060#define DEBUG_MODULE_WORLD_ENTITY       0
    61 #define DEBUG_MODULE_COMMAND_NODE       4
     61#define DEBUG_MODULE_COMMAND_NODE       0
    6262#define DEBUG_MODULE_GRAPHICS           0
    6363#define DEBUG_MODULE_LOAD               2
    6464
    65 #define DEBUG_MODULE_IMPORTER           3
     65#define DEBUG_MODULE_IMPORTER           0
    6666#define DEBUG_MODULE_TRACK_MANAGER      0
    6767#define DEBUG_MODULE_GARBAGE_COLLECTOR  0
     68#define DEBUG_MODULE_OBJECT_MANAGER     3
    6869#define DEBUG_MODULE_LIGHT              0
    6970#define DEBUG_MODULE_PLAYER             1
    70 #define DEBUG_MODULE_WEAPON             3
     71#define DEBUG_MODULE_WEAPON             0
    7172#define DEBUG_MODULE_MATH               0
    7273#define DEBUG_MODULE_FONT               1
    7374#define DEBUG_MODULE_ANIM               1
    74 #define DEBUG_MODULE_PARTICLE           4
     75#define DEBUG_MODULE_PARTICLE           1
    7576
    7677#define DEBUG_MODULE_NULL_PARENT        0
  • orxonox/branches/physics/src/lib/graphics/importer/md2Model.cc

    r4283 r4301  
    6868
    6969/********************************************************************************
    70  *   MD2Model                                                                   *
    71  ********************************************************************************/
    72 
     70 *   MD2Model                                                                   * ********************************************************************************/
     71
     72/*
     73  \brief simple constructor initializing all variables
     74*/
    7375MD2Model::MD2Model()
    7476{
     
    8082}
    8183
    82 
     84/*
     85  \brief simple destructor, dereferencing all variables
     86
     87  this is where the ressource manager is cleaning the stuff
     88*/
    8389MD2Model::~MD2Model()
    8490{
     
    8692}
    8793
    88 
     94/*
     95  \brief load model
     96  \param name of the model file
     97  \return true if everything worked out smoothly
     98*/
    8999bool MD2Model::loadModel(const char* fileName)
    90100{
     
    93103
    94104
     105/*
     106  \brief load the skin as a material
     107  \param name of the texture file
     108  \return true if ok
     109*/
    95110bool MD2Model::loadSkin(const char* fileName)
    96111{
     
    122137
    123138
     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*/
    124145void MD2Model::setAnim(int type)
    125146{
     
    140161
    141162
     163/*
     164  \brief sets the time in seconds passed since the last tick
     165  \param time in sec
     166*/
    142167void MD2Model::tick(float time)
    143168{
     
    146171
    147172
     173/*
     174  \brief draws the model: interface for all other classes out in the world
     175*/
    148176void MD2Model::draw()
    149177{
     
    159187
    160188
     189/*
     190  \brief this is an internal function to render this special frame selected by animate()
     191*/
    161192void MD2Model::renderFrame()
    162193{
     
    200231
    201232
     233/*
     234  \brief animates the current model
     235
     236  depending on the time passed (tick function), the player will select another model
     237*/
    202238void MD2Model::animate()
    203239{
     
    222258
    223259
    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*/
    225265void MD2Model::processLighting()
    226266{
     
    228268}
    229269
    230 
     270/*
     271  \brief prints out debug informations
     272*/
    231273void MD2Model::debug()
    232274{
     
    246288 ********************************************************************************/
    247289
    248 
     290/*
     291  \brief simple constructor
     292*/
    249293MD2Data::MD2Data()
    250294{
     
    261305
    262306
     307/*
     308  \brief simple destructor
     309
     310  this will clean out all the necessary data for a specific md2model
     311*/
    263312MD2Data::~MD2Data()
    264313{
     
    270319
    271320
     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*/
    272326bool MD2Data::loadModel(const char* fileName)
    273327{
     
    335389
    336390
     391/*
     392  \brief loads the skin/material stuff
     393  \param name of the skin file
     394  \return true if success
     395*/
    337396bool MD2Data::loadSkin(const char* fileName)
    338397{
  • orxonox/branches/physics/src/orxonox.cc

    r4283 r4301  
    3535#include "graphics_engine.h"
    3636#include "resource_manager.h"
     37#include "object_manager.h"
    3738#include "text_engine.h"
    3839#include "factory.h"
     
    5657  this->world = NULL;
    5758  this->localinput = NULL;
     59  this->resourceManager = NULL;
     60  this->objectManager = NULL;
    5861
    5962  this->argc = 0;
     
    7275  delete GraphicsEngine::getInstance(); // deleting the Graphics
    7376  delete ResourceManager::getInstance(); // deletes the Resource Manager
     77  delete ObjectManager::getInstance();
    7478  delete TextEngine::getInstance();
    7579}
     
    225229  TextEngine::getInstance();
    226230
     231  PRINT(3)("initializing ObjectManager\n");
     232  this->objectManager = ObjectManager::getInstance();
     233
    227234  return 0;
    228235}
  • orxonox/branches/physics/src/orxonox.h

    r4283 r4301  
    1616class GameLoader;
    1717class ResourceManager;
     18class ObjectManager;
    1819
    1920//! Orxonox core singleton class
     
    3233  GameLoader* gameLoader;     //!< The gameLoader
    3334  ResourceManager* resourceManager; //!< The ResourceManager
     35  ObjectManager* objectManager; //!< the object manager of the game
    3436 
    3537  bool bQuitOrxonox;          //!< If Orxonox should Quit
  • orxonox/branches/physics/src/story_entities/world.cc

    r4293 r4301  
    4242#include "track_manager.h"
    4343#include "garbage_collector.h"
     44#include "object_manager.h"
    4445#include "animation_player.h"
    4546#include "particle_engine.h"
     
    5859
    5960#include "factory.h"
     61
     62#include "projectile.h"
    6063
    6164using namespace std;
  • orxonox/branches/physics/src/util/garbage_collector.cc

    r4283 r4301  
    2525
    2626#include "list.h"
     27#include "object_manager.h"
    2728
    2829using namespace std;
     
    137138          entity->remove();
    138139          /* then finaly delete reference */
    139           delete entity;
     140          //delete entity;
     141          ObjectManager::getInstance()->addToDeadList(CL_TEST_BULLET, entity);
     142          ObjectManager::getInstance()->debug();
    140143        }
    141144      entity = iterator->nextElement();
  • orxonox/branches/physics/src/util/loading/load_param.cc

    r4283 r4301  
    1010
    1111   ### File Specific:
    12    main-programmer: Christian Meyer
     12   main-programmer: Benjamin Grauer
    1313   co-programmer: ...
    1414*/
     
    2727   \param ... the parameter information
    2828*/
    29 BaseLoadParam::BaseLoadParam(BaseObject* object, const char* paramName, int paramCount, ...)
    30 {
     29BaseLoadParam::BaseLoadParam(const TiXmlElement* root, BaseObject* object, const char* paramName, int paramCount, ...)
     30{
     31  this->loadString = grabParameter(root, paramName);
     32
    3133  this->paramDesc = NULL;
    3234  if (LoadClassDescription::parametersDescription)
     
    4749          strcpy(this->paramDesc->types[i], tmpTypeName);
    4850        }
    49       va_end(types); 
     51      va_end(types);
    5052
    5153      int argCount = 0;
  • orxonox/branches/physics/src/util/loading/load_param.h

    r4283 r4301  
    6565#define LoadParam1(type1) \
    6666 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    { \
    7069      if (loadString != NULL && root != NULL) \
    7170        (*pt2Object.*function)(type1##_FUNC(loadString)); \
     
    7877#define LoadParam2(type1, type2) \
    7978 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    { \
    8381      if (loadString != NULL && root != NULL) \
    8482        { \
     
    9896#define LoadParam3(type1, type2, type3) \
    9997 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    { \
    103100      if (loadString != NULL && root != NULL) \
    104101        { \
     
    118115#define LoadParam4(type1, type2, type3, type4) \
    119116 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    { \
    123119      if (loadString != NULL && root != NULL) \
    124120        { \
     
    138134#define LoadParam5(type1, type2, type3, type4, type5) \
    139135 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    { \
    143138      if (loadString != NULL && root != NULL) \
    144139        { \
     
    202197
    203198 protected:
    204   BaseLoadParam(BaseObject* object, const char* paramName, int paramCount, ...);
     199  BaseLoadParam(const TiXmlElement* root, BaseObject* object, const char* paramName, int paramCount, ...);
    205200
    206201 protected:
    207202  LoadClassDescription* classDesc;               //!< The LoadClassDescription of this LoadParameter
    208203  LoadParamDescription* paramDesc;               //!< The LoadParameterDescription of this LoadParameter
     204  const char* loadString;                        //!< The string loaded by this LoadParam
    209205};
    210206
  • orxonox/branches/physics/src/util/object_manager.cc

    r4283 r4301  
    1111   ### File Specific:
    1212   main-programmer: Patrick Boenzli
    13    co-programmer: ...
    1413*/
    1514
     
    1716
    1817#include "object_manager.h"
     18#include "garbage_collector.h"
     19#include "list.h"
     20
    1921
    2022using namespace std;
     
    2628ObjectManager::ObjectManager ()
    2729{
    28    this->setClassName ("ObjectManager");
     30  this->setClassName ("ObjectManager");
     31 
     32  //this->managedObjectList = new BaseObject*[CL_NUMBER];
     33  this->managedObjectList = new tList<BaseObject>*[CL_NUMBER];
    2934
     35  this->garbageCollector = GarbageCollector::getInstance();
    3036}
    3137
     
    4551}
    4652
     53
    4754/**
    4855   \brief standard deconstructor
     
    5259{
    5360  ObjectManager::singletonRef = NULL;
     61}
    5462
     63
     64void ObjectManager::cache(classList index, int number, const BaseObject &copyObject)
     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    }
    5572}
     73
     74
     75void 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
     84BaseObject* 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
     97void 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  
    1818#define OM_
    1919
     20#include "class_list.h"
     21
     22
    2023class WorldEntity;
     24class GarbageCollector;
    2125
    2226
    2327template<class T> class tList;
     28template<class T> class ManagedObject;
    2429
    2530//! the object manager itself
     
    2934  static ObjectManager* getInstance(void);
    3035  virtual ~ObjectManager(void);
     36 
     37  void cache(classList index, int number, const BaseObject &copyObject);
     38  void addToDeadList(classList index, BaseObject* object);
     39  BaseObject* getFromDeadList(classList index, int number = 1);
    3140
    32   void preLoad();
     41  void debug();
    3342
    3443 private:
     
    3645  static ObjectManager* singletonRef;
    3746
    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};
    3951
    4052
    41 };
    4253
    4354#endif /* _OBJECT_MANAGER_H */
  • orxonox/branches/physics/src/world_entities/player.cc

    r4283 r4301  
    2727#include "list.h"
    2828#include "stdincl.h"
     29
     30#include "object_manager.h"
     31#include "projectile.h"
    2932
    3033using namespace std;
     
    5962  this->weaponMan->addWeapon(wpRight, W_CONFIG2);
    6063  this->weaponMan->addWeapon(wpLeft, W_CONFIG2);
    61 
    6264}
    6365
  • orxonox/branches/physics/src/world_entities/test_gun.cc

    r4178 r4301  
    3131#include "list.h"
    3232#include "animation3d.h"
     33
     34#include "object_manager.h"
    3335
    3436using namespace std;
     
    8789    }
    8890
     91  BaseObject* p = new TestBullet(this);
     92  ObjectManager::getInstance()->cache(CL_TEST_BULLET, 100, *p);
     93  ObjectManager::getInstance()->debug();
    8994}
    9095
Note: See TracChangeset for help on using the changeset viewer.