Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4496 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
Jun 3, 2005, 3:52:05 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: cycling read-in of parameters should work now… this is quite tricky, and the TrackManager has to be rewritten in some parts…. :(

Location:
orxonox/trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/particles/particle_emitter.cc

    r4494 r4496  
    6262   \brief standard destructor
    6363
     64   removes the EmitterSystem from the ParticleEngine
    6465*/
    6566ParticleEmitter::~ParticleEmitter ()
  • orxonox/trunk/src/story_entities/world.cc

    r4489 r4496  
    529529  // initializing the TrackManager
    530530  this->trackManager = TrackManager::getInstance();
    531   //trackManager->addPoint(Vector(0,0,0));
    532   trackManager->addPoint(Vector(150, -35, 5));
    533   trackManager->addPoint(Vector(200,-35, 5));
    534   trackManager->addPoint(Vector(250, -35, 5));
    535   trackManager->addPoint(Vector(320,-33,-.55));
     531  //trackManager->addPointV(Vector(0,0,0));
     532  trackManager->addPointV(Vector(150, -35, 5));
     533  trackManager->addPointV(Vector(200,-35, 5));
     534  trackManager->addPointV(Vector(250, -35, 5));
     535  trackManager->addPointV(Vector(320,-33,-.55));
    536536  trackManager->setDuration(1);
    537537  trackManager->setSavePoint();
    538538
    539   trackManager->addPoint(Vector(410, 0, 0));
    540   trackManager->addPoint(Vector(510, 20, -10));
    541   trackManager->addPoint(Vector(550, 20, -10));
    542   trackManager->addPoint(Vector(570, 20, -10));
     539  trackManager->addPointV(Vector(410, 0, 0));
     540  trackManager->addPointV(Vector(510, 20, -10));
     541  trackManager->addPointV(Vector(550, 20, -10));
     542  trackManager->addPointV(Vector(570, 20, -10));
    543543  trackManager->setDuration(2);
    544544     
    545545  trackManager->forkS("testFork1,testFork2");
    546546  trackManager->workOn("testFork1");
    547   trackManager->addPoint(Vector(640, 25, -30));
    548   trackManager->addPoint(Vector(700, 40, -120));
    549   trackManager->addPoint(Vector(800, 50, -150));
    550   trackManager->addPoint(Vector(900, 60, -100));
    551   trackManager->addPoint(Vector(900, 60, -70));
    552   trackManager->addPoint(Vector(990, 65, -15));
    553   trackManager->addPoint(Vector(1050, 65, -10));
    554   trackManager->addPoint(Vector(1100, 65, -20));
     547  trackManager->addPointV(Vector(640, 25, -30));
     548  trackManager->addPointV(Vector(700, 40, -120));
     549  trackManager->addPointV(Vector(800, 50, -150));
     550  trackManager->addPointV(Vector(900, 60, -100));
     551  trackManager->addPointV(Vector(900, 60, -70));
     552  trackManager->addPointV(Vector(990, 65, -15));
     553  trackManager->addPointV(Vector(1050, 65, -10));
     554  trackManager->addPointV(Vector(1100, 65, -20));
    555555  trackManager->setDuration(4);
    556556
    557557  trackManager->workOn("testFork2");
    558   trackManager->addPoint(Vector(640, 25, 20));
    559   trackManager->addPoint(Vector(670, 50, 120));
    560   trackManager->addPoint(Vector(700, 70, 80));
    561   trackManager->addPoint(Vector(800, 70, 65));
    562   trackManager->addPoint(Vector(850, 65, 65));
    563   trackManager->addPoint(Vector(920, 35, 40));
    564   trackManager->addPoint(Vector(945, 40, 40));
    565   trackManager->addPoint(Vector(970, 24, 40));
    566   trackManager->addPoint(Vector(1000, 40, -7));
     558  trackManager->addPointV(Vector(640, 25, 20));
     559  trackManager->addPointV(Vector(670, 50, 120));
     560  trackManager->addPointV(Vector(700, 70, 80));
     561  trackManager->addPointV(Vector(800, 70, 65));
     562  trackManager->addPointV(Vector(850, 65, 65));
     563  trackManager->addPointV(Vector(920, 35, 40));
     564  trackManager->addPointV(Vector(945, 40, 40));
     565  trackManager->addPointV(Vector(970, 24, 40));
     566  trackManager->addPointV(Vector(1000, 40, -7));
    567567  trackManager->setDuration(4);
    568568     
     
    570570  trackManager->joinS("testFork1,testFork2");
    571571       
    572   trackManager->addPoint(Vector(1200, 60, -50));
    573   trackManager->addPoint(Vector(1300, 50, -50));
    574   trackManager->addPoint(Vector(1400, 40, -50));
    575   trackManager->addPoint(Vector(1500, 40, -60));
    576   trackManager->addPoint(Vector(1600, 35, -55));
    577   trackManager->addPoint(Vector(1700, 45, -40));
    578   trackManager->addPoint(Vector(1750, 60, -40));
    579   trackManager->addPoint(Vector(1770, 80, -40));
    580   trackManager->addPoint(Vector(1800, 100, -40));
     572  trackManager->addPointV(Vector(1200, 60, -50));
     573  trackManager->addPointV(Vector(1300, 50, -50));
     574  trackManager->addPointV(Vector(1400, 40, -50));
     575  trackManager->addPointV(Vector(1500, 40, -60));
     576  trackManager->addPointV(Vector(1600, 35, -55));
     577  trackManager->addPointV(Vector(1700, 45, -40));
     578  trackManager->addPointV(Vector(1750, 60, -40));
     579  trackManager->addPointV(Vector(1770, 80, -40));
     580  trackManager->addPointV(Vector(1800, 100, -40));
    581581  trackManager->setDuration(10);
    582582 
  • orxonox/trunk/src/util/loading/game_loader.cc

    r4487 r4496  
    252252  // free the XML data
    253253  delete XMLDoc;
    254        
     254
    255255  return c;
    256256}
  • orxonox/trunk/src/util/loading/load_param.cc

    r4492 r4496  
    2626   \param paramName: The name of the parameter loaded.
    2727   \param paramCount: how many parameters this loading-function takes
     28   \param multi: if false LoadParam assumes only one occurence of this parameter in root, if true it assumes multiple occurences.
    2829   \param ...: the parameter information
    2930*/
    30 BaseLoadParam::BaseLoadParam(const TiXmlElement* root, BaseObject* object, const char* paramName, int paramCount, ...)
    31 {
    32   this->loadString = grabParameter(root, paramName);
     31BaseLoadParam::BaseLoadParam(const TiXmlElement* root, BaseObject* object, const char* paramName,
     32                             int paramCount, bool multi, ...)
     33{
     34  this->loadString = NULL;
     35
     36  if (likely(!multi))
     37    this->loadString = grabParameter(root, paramName);
     38  else
     39    {
     40      printf("paramName:::::%s\n", root->Value());
     41      if (!strcmp(root->Value(), paramName))
     42        {
     43          const TiXmlNode* val = root->FirstChild();
     44          if( val->ToText())
     45            this->loadString = val->Value();
     46        }
     47    }
     48  if (loadString)
     49    printf("%s\n", loadString);
    3350
    3451  this->paramDesc = NULL;
     
    4360
    4461      va_list types;
    45       va_start (types, paramCount);
     62      va_start (types, multi);
    4663      for(int i = 0; i < paramCount; i++)
    4764        {
  • orxonox/trunk/src/util/loading/load_param.h

    r4495 r4496  
    7373*/
    7474#define LoadParam1(type1) \
    75  LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE)) \
    76    : BaseLoadParam(root, pt2Object, paramName, 1, type1##_NAME)         \
     75 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE), bool multi = false) \
     76   : BaseLoadParam(root, pt2Object, paramName, 1, multi, type1##_NAME)          \
    7777    { \
    7878      if (loadString != NULL && root != NULL) \
     
    9090*/
    9191#define LoadParam2(type1, type2) \
    92  LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE)) \
    93    : BaseLoadParam(root, pt2Object, paramName, 2, type1##_NAME, type2##_NAME) \
     92 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE), bool multi = false) \
     93   : BaseLoadParam(root, pt2Object, paramName, 2, multi, type1##_NAME, type2##_NAME) \
    9494    { \
    9595      if (loadString != NULL && root != NULL) \
     
    115115*/
    116116#define LoadParam3(type1, type2, type3) \
    117  LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE))\
    118    : BaseLoadParam(root, pt2Object, paramName, 3, type1##_NAME, type2##_NAME, type3##_NAME) \
     117 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE), bool multi = false)\
     118   : BaseLoadParam(root, pt2Object, paramName, 3, multi, type1##_NAME, type2##_NAME, type3##_NAME) \
    119119    { \
    120120      if (loadString != NULL && root != NULL) \
     
    141141*/
    142142#define LoadParam4(type1, type2, type3, type4) \
    143  LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE)) \
    144    : BaseLoadParam(root, pt2Object, paramName, 4, type1##_NAME, type2##_NAME, type3##_NAME, type2##_NAME, type4##_NAME) \
     143 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE), bool multi = false) \
     144   : BaseLoadParam(root, pt2Object, paramName, 4, multi, type1##_NAME, type2##_NAME, type3##_NAME, type2##_NAME, type4##_NAME) \
    145145    { \
    146146      if (loadString != NULL && root != NULL) \
     
    168168*/
    169169#define LoadParam5(type1, type2, type3, type4, type5) \
    170  LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE, type5##_TYPE)) \
    171    : BaseLoadParam(root, pt2Object, paramName, 5, type1##_NAME, type2##_NAME, type3##_NAME, type2##_NAME, type4##_NAME, type5##_NAME) \
     170 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE, type5##_TYPE), bool multi = false) \
     171   : BaseLoadParam(root, pt2Object, paramName, 5, multi, type1##_NAME, type2##_NAME, type3##_NAME, type2##_NAME, type4##_NAME, type5##_NAME) \
    172172    { \
    173173      if (loadString != NULL && root != NULL) \
     
    221221
    222222 private:
    223   static bool                         parametersDescription;  //!< if parameter-description should be enabled.
    224   static tList<LoadClassDescription>* classList;              //!< a list, that holds all the loadable classes. (after one instance has been loaded)
    225   char*                               className;              //!< name of the class
    226   tList<LoadParamDescription>*        paramList;              //!< List of parameters this class knows.
     223  static bool                          parametersDescription;  //!< if parameter-description should be enabled.
     224  static tList<LoadClassDescription>*  classList;              //!< a list, that holds all the loadable classes. (after one instance has been loaded)
     225  char*                                className;              //!< name of the class
     226  tList<LoadParamDescription>*         paramList;              //!< List of parameters this class knows.
    227227};
    228228
     
    234234
    235235 protected:
    236   BaseLoadParam(const TiXmlElement* root, BaseObject* object, const char* paramName, int paramCount, ...);
     236  BaseLoadParam(const TiXmlElement* root, BaseObject* object, const char* paramName, int paramCount, bool multi, ...);
    237237
    238238 protected:
  • orxonox/trunk/src/util/track/track_manager.cc

    r4489 r4496  
    2525#include "text_engine.h"
    2626#include "t_animation.h"
     27#include "load_param.h"
     28
     29
     30#include "tinyxml.h"
    2731#include "substring.h"
    28 #include "tinyxml.h"
    2932
    3033#include <stdarg.h>
     
    409412  while( element != NULL)
    410413    {
    411       if( !strcmp( element->Value(), "Point"))
    412         {
    413           container = element->FirstChild();
    414           if( container->ToText())
    415             {
    416               assert( container->Value() != NULL);
    417               if( sscanf( container->Value(), "%lf,%lf,%lf", &x, &y, &z) == 3)
    418                 {
    419                   PRINTF(5)("Loaded Point: %lf,%lf,%lf (%s)\n", x, y, z, container->Value());
    420                   addPoint( Vector( x, y, z));
    421                 }
    422               else
    423                 {
    424                   PRINTF(0)("Invalid Point in Track (skipped)\n");
    425                 }                       
    426             }
    427         }
    428       else if( !strcmp( element->Value(), "Duration"))
    429         {
    430           container = element->FirstChild();
    431           if( container->ToText())
    432             {
    433               assert( container->Value() != NULL);
    434               if( sscanf( container->Value(), "%lf", &d) == 1)
    435                 {
    436                   PRINTF(5)("Loaded Duration: %lf (%s)\n", d, container->Value());
    437                   setDuration( d);
    438                 }
    439               else
    440                 {
    441                   PRINTF(2)("Invalid Duration in Track (skipped)\n");
    442                 }                       
    443             }
    444         }
    445       else if( !strcmp( element->Value(), "SavePoint"))
     414      LoadParam<TrackManager>(element, "Point", this, &TrackManager::addPoint, true)
     415        .describe("Adds a new Point to the currently selected TrackElement");
     416
     417      LoadParam<TrackManager>(element, "Duration", this, &TrackManager::setDuration, true)
     418        .describe("Sets the Duration of the currently selected TrackElement");
     419     
     420      LoadParam<TrackManager>(element, "SavePoint", this, &TrackManager::setSavePoint, true);
     421
     422      /*
     423      if( !strcmp( element->Value(), "SavePoint"))
    446424        {
    447425          PRINTF(5)("Loaded Savepoint\n");
    448426          setSavePoint();
    449427        }
    450       else if( !strcmp( element->Value(), "Fork"))
     428      */
     429      if( !strcmp( element->Value(), "Fork"))
    451430        {
    452431          container = element->FirstChild();
     
    526505      newElem->startingTime = trackElem->endTime + trackElem->jumpTime;
    527506      // adds the conection Point
    528       this->addPoint(trackElem->curve->getNode(trackElem->curve->getNodeCount()),
     507      this->addPointV(trackElem->curve->getNode(trackElem->curve->getNodeCount()),
    529508                     newElem);
    530509      // add the new child to the childList.
     
    600579
    601580/**
     581   \param duration the duration of the TrackElement
     582   \see void TrackManager::setDuration(float duration, TrackElement* trackElem)
     583*/
     584void TrackManager::setDuration(float duration)
     585{
     586  this->setDuration(duration, NULL);
     587}
     588
     589/**
    602590   \brief Sets the duration of the current path in seconds.
    603591   \param duration The duration in seconds.
     
    615603/**
    616604   \brief adds a point to trackElem
     605   \param x x coord
     606   \param y y coord
     607   \param z z coord
     608   \param trackElem The TrackElement to add the Point to
     609*/
     610void TrackManager::addPoint(float x, float y, float z)
     611{
     612  this->addPointV(Vector(x,y,z));
     613}
     614
     615/**
     616   \brief adds a point to trackElem
    617617   \param newPoint The point to add.
    618618   \param trackElem The TrackElement to add the Point to
    619619*/
    620 bool TrackManager::addPoint(Vector newPoint, TrackElement* trackElem)
     620void TrackManager::addPointV(Vector newPoint, TrackElement* trackElem)
    621621{
    622622  if (!trackElem)
     
    653653  trackElem->nodeCount++;
    654654  this->initChildren(1, trackElem);
     655}
     656
     657/**
     658   \todo this must be better
     659*/
     660void TrackManager::setSavePoint(int isLoadable)
     661{
     662  this->setSavePoint();
    655663}
    656664
     
    946954          else
    947955            {
    948               this->addPoint(tmpc2Point, tmpJoinElem);
    949               this->addPoint(tmpTangentPoint, tmpJoinElem);
    950               this->addPoint(tmpEndPoint, tmpJoinElem);
     956              this->addPointV(tmpc2Point, tmpJoinElem);
     957              this->addPointV(tmpTangentPoint, tmpJoinElem);
     958              this->addPointV(tmpEndPoint, tmpJoinElem);
    951959              // time all other Joins
    952960              tmpJoinElem->jumpTime = tmpLatestTime - tmpJoinElem->endTime;
  • orxonox/trunk/src/util/track/track_manager.h

    r4489 r4496  
    151151  inline void setCurveType(CurveType curveType) { this->setCurveType (curveType, this->currentTrackElem);};
    152152  void setCurveType(CurveType curveType, TrackElement* trackElem);
    153   void setDuration(float duration, TrackElement* trackElem = NULL);
    154   bool addPoint(Vector newPoint, TrackElement* trackElem = NULL);
     153  void setDuration(float duration);
     154  void setDuration(float duration, TrackElement* trackElem);
     155  void addPoint(float x, float y, float z);
     156  void addPointV(Vector newPoint, TrackElement* trackElem = NULL);
    155157  int addHotPoint(Vector newPoint, TrackElement* trackElem = NULL);
     158  void setSavePoint(int isLoadable);
    156159  int setSavePoint(TrackElement* trackElem = NULL);
    157160  void fork(unsigned int count, ...);
Note: See TracChangeset for help on using the changeset viewer.