Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4730 in orxonox.OLD


Ignore:
Timestamp:
Jun 29, 2005, 1:46:15 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: loading fields

Location:
orxonox/trunk/src
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/Makefile.am

    r4725 r4730  
    153153endif
    154154
    155 SUBDIRS = lib . $(SUB_PROGS) subprojects
     155SUBDIRS = lib . $(SUB_PROGS)
    156156
    157157
  • orxonox/trunk/src/Makefile.in

    r4725 r4730  
    391391@SUB_PROJECTS_FALSE@SUB_PROGS =
    392392@SUB_PROJECTS_TRUE@SUB_PROGS = subprojects
    393 SUBDIRS = lib . $(SUB_PROGS) subprojects
     393SUBDIRS = lib . $(SUB_PROGS)
    394394all: all-recursive
    395395
  • orxonox/trunk/src/lib/physics/Makefile.am

    r4539 r4730  
    22include $(MAINSRCDIR)/defs/include_paths.am
    33
    4 noinst_LIBRARIES = libORXphysics.a 
     4noinst_LIBRARIES = libORXphysics.a
    55
    66libORXphysics_a_SOURCES = physics_interface.cc \
    7                           physics_connection.cc \
    8                           physics_engine.cc \
    9                           fields/field.cc \
    10                           fields/gravity.cc \
    11                           fields/point_gravity.cc \
    12                           fields/twirl.cc
     7                          physics_connection.cc \
     8                          physics_engine.cc \
     9                          fields/field.cc \
     10                          fields/gravity.cc \
     11                          fields/point_gravity.cc \
     12                          fields/twirl.cc
    1313
    1414noinst_HEADERS= physics_interface.h \
    15                 physics_connection.h \
    16                 physics_engine.h \
    17                 fields/fields.h \
    18                 fields/field.h \
    19                 fields/gravity.h \
    20                 fields/point_gravity.h \
    21                 fields/twirl.h
     15                physics_connection.h \
     16                physics_engine.h \
     17                fields/fields.h \
     18                fields/field.h \
     19                fields/gravity.h \
     20                fields/point_gravity.h \
     21                fields/twirl.h
  • orxonox/trunk/src/lib/physics/Makefile.in

    r4539 r4730  
    187187target_vendor = @target_vendor@
    188188MAINSRCDIR = ../..
    189 noinst_LIBRARIES = libORXphysics.a 
     189noinst_LIBRARIES = libORXphysics.a
    190190libORXphysics_a_SOURCES = physics_interface.cc \
    191                           physics_connection.cc \
    192                           physics_engine.cc \
    193                           fields/field.cc \
    194                           fields/gravity.cc \
    195                           fields/point_gravity.cc \
    196                           fields/twirl.cc
     191                          physics_connection.cc \
     192                          physics_engine.cc \
     193                          fields/field.cc \
     194                          fields/gravity.cc \
     195                          fields/point_gravity.cc \
     196                          fields/twirl.cc
    197197
    198198noinst_HEADERS = physics_interface.h \
    199                 physics_connection.h \
    200                 physics_engine.h \
    201                 fields/fields.h \
    202                 fields/field.h \
    203                 fields/gravity.h \
    204                 fields/point_gravity.h \
    205                 fields/twirl.h
     199                physics_connection.h \
     200                physics_engine.h \
     201                fields/fields.h \
     202                fields/field.h \
     203                fields/gravity.h \
     204                fields/point_gravity.h \
     205                fields/twirl.h
    206206
    207207all: all-am
  • orxonox/trunk/src/lib/physics/fields/field.cc

    r4728 r4730  
    3030{
    3131  this->init();
    32 }
    33 
    34 /**
    35   \param root The XML-element to load settings from
    36  */
    37 Field::Field(const TiXmlElement* root)
    38 {
    39   this->init();
    40   this->loadParams(root);
    4132}
    4233
  • orxonox/trunk/src/lib/physics/fields/field.h

    r4728 r4730  
    3636 public:
    3737  Field();
    38   Field(const TiXmlElement* root);
    3938  virtual ~Field();
    4039
  • orxonox/trunk/src/lib/physics/fields/gravity.cc

    r4728 r4730  
    1010
    1111   ### File Specific:
    12    main-programmer: ...
     12   main-programmer: Benjamin Grauer
    1313   co-programmer: ...
    1414*/
     
    5353{
    5454  static_cast<Field*>(this)->loadParams(root);
    55 
    5655}
    5756
  • orxonox/trunk/src/lib/physics/physics_engine.cc

    r4728 r4730  
    2121
    2222#include "list.h"
    23 #include "game_loader.h"
    2423#include "tinyxml.h"
     24#include "factory.h"
    2525
    2626using namespace std;
     
    3030   \brief standard constructor
    3131*/
    32 PhysicsEngine::PhysicsEngine()
     32PhysicsEngine::PhysicsEngine(void)
    3333{
    3434  this->setClassID(CL_PHYSICS_ENGINE, "PhysicsEngine");
     
    4848
    4949*/
    50 PhysicsEngine::~PhysicsEngine ()
     50PhysicsEngine::~PhysicsEngine(void)
    5151{
    5252  PhysicsEngine::singletonRef = NULL;
     
    5656  \param root the XML-element to load settings from
    5757 */
    58 void loadParams(const TiXmlElement* root)
    59 {
    60   const TiXmlElement* element;
    61 
    62   PRINTF(4)("Loading Physical Fields\n");
     58void PhysicsEngine::loadParams(const TiXmlElement* root)
     59{
     60  const TiXmlElement* element = NULL;
     61
     62  PRINTF(0)("Loading Physical Fields\n");
    6363  element = root->FirstChildElement("Fields");
    64   {
    65     element = element->FirstChildElement();
    66     GameLoader::getInstance()->fabricate(element);
     64  printf("PPPPPOOOOINNNTERRRR: %p\n", element);
     65  element = element->FirstChildElement();
     66  printf("PPPPPOOOOINNNTERRRR: %p\n", element);
     67  while (element != NULL)
     68  {
     69    Factory::getFirst()->fabricate(element)->getName();
    6770
    6871    element = element->NextSiblingElement();
    6972  }
    70 
    71   PRINTF(4)("Loading Physical Connections\n");
    72   element = root->FirstChildElement("PhysicsConnections");
    73   {
    74     element = element->FirstChildElement();
    75     GameLoader::getInstance()->fabricate(element);
     73  element = NULL;
     74
     75  PRINTF(0)("Loading Physical Connections\n");
     76  element = root->FirstChildElement("Connections");
     77  element = element->FirstChildElement();
     78  while (element != NULL)
     79  {
     80    Factory::getFirst()->fabricate(element);
    7681
    7782    element = element->NextSiblingElement();
    7883  }
    79 
    80 }
    81 
    82 
    83 
     84}
    8485
    8586/**
     
    260261  PRINT(0)(" reference: %p\n", this);
    261262  PRINT(0)(" number of Interfaces: %d\n", this->interfaces->getSize());
     263  PRINT(0)(" number of Fields: %d\n", this->fields->getSize());
    262264  PRINT(0)(" number of Connections: %d\n", this->connections->getSize());
    263265
  • orxonox/trunk/src/story_entities/world.cc

    r4728 r4730  
    415415
    416416    LoadParam<ParticleEngine>(root, "ParticleEngine", ParticleEngine::getInstance(), &ParticleEngine::loadParams);
     417    LoadParam<PhysicsEngine>(root, "PhysicsEngine", PhysicsEngine::getInstance(), &PhysicsEngine::loadParams);
    417418
    418419  // find Track
     
    494495  ////////////
    495496
    496   Field* gravity = new Gravity();
    497   gravity->setMagnitude(30.0);
    498 
     497  Gravity* test = new Gravity();
    499498
    500499  // SYSTEM TRAILING THE PLAYER
     
    525524  particleEngine->addConnection(emitter, system);
    526525
    527   new PhysicsConnection(system, gravity);
     526  //new PhysicsConnection(system, gravity);
    528527  //    new PhysicsConnection(this->localPlayer, gravity);
    529528
     
    552551
    553552
    554 //   new PhysicsConnection(testEntity, gravity);
    555 
    556   // printing out some debug stuff
    557   NullParent::getInstance()->debug(0);
    558   this->localPlayer->whatIs();
    559   this->whatIs();
    560   GraphicsEngine::getInstance()->whatIs();
     553  PhysicsEngine::getInstance()->debug();
     554
    561555}
    562556
  • orxonox/trunk/src/util/loading/factory.cc

    r4729 r4730  
    3535  this->setName(factoryName);
    3636
     37  if (Factory::first == NULL)
     38    Factory::first = this;
    3739  next = NULL;
    3840
    3941  initialize();
    4042}
     43
     44Factory* Factory::first = NULL;
    4145
    4246/**
     
    5559
    5660/**
    57    \brief generates the associated object from data
    58 */
    59 BaseObject* Factory::fabricate(const TiXmlElement* data)
    60 {
    61   return NULL;
    62 }
    63 
    64 /**
    6561   \brief make this particular factory known to the LevelFactory
    6662*/
    6763void Factory::initialize()
    6864{
    69 #ifdef IS_ORXONOX
    7065  GameLoader::getInstance()->registerFactory( this);
    71 #endif /* IS_ORXONOX */
    7266}
    7367
  • orxonox/trunk/src/util/loading/factory.h

    r4729 r4730  
    3535  \todo make factoryName a BaseObject-parameter. (else it would be redundant)
    3636*/
    37 #define CREATE_FACTORY(CLASS_NAME) tFactory<CLASS_NAME>* global_##CLASS_NAME##Factory = new tFactory<CLASS_NAME>(#CLASS_NAME)
     37#define CREATE_FACTORY(CLASS_NAME) tFactory<CLASS_NAME>* global_##CLASS_NAME##_Factory = new tFactory<CLASS_NAME>(#CLASS_NAME)
    3838
    3939//! The Factory is a loadable object handler
     
    4545
    4646
    47   virtual BaseObject* fabricate(const TiXmlElement* root);
     47  virtual BaseObject* fabricate(const TiXmlElement* root) = NULL;
    4848  void initialize();
    4949  void registerFactory( Factory* factory);
    5050  /** \brief sets the Next factory in the list \param nextFactory the next factory */
    5151  inline void setNext( Factory* nextFactory) { this->next = nextFactory; };
     52  /** \returns the first factory */
     53  static Factory* getFirst(void) { return Factory::first; };
    5254  /** \returns the next factory */
    5355  Factory* getNext(void) const { return this->next; };
     56
    5457
    5558 private:
     
    6972
    7073  private:
    71   BaseObject* fabricate(const TiXmlElement* root);
     74  virtual BaseObject* fabricate(const TiXmlElement* root);
    7275};
    7376
     
    7982tFactory<T>::tFactory(const char* factoryName) : Factory(factoryName)
    8083{
    81   PRINTF(5)("fileName: %s loadable\n", this->getName());
     84  PRINTF(5)("Class: %s loadable\n", this->getName());
    8285}
    8386
     
    9093BaseObject* tFactory<T>::fabricate(const TiXmlElement* root)
    9194{
    92   if(!strcmp(root->Value(), getName()))
     95  if(!strcmp(root->Value(), this->getName()))
    9396    return new T ( root);
    9497  else if( getNext() != NULL)
Note: See TracChangeset for help on using the changeset viewer.