Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4602 in orxonox.OLD


Ignore:
Timestamp:
Jun 11, 2005, 6:09:21 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: load-params in particle-system (not finished yet)

Location:
orxonox/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/ChangeLog

    r4561 r4602  
     12005-06-10      Banjamin Grauer <bensch@orxonox.ethz.ch>
     2        Established a try on class-derivation and isA function.
     3
    142005-06-09      orxonox <info@orxonox.ethz.ch>
    25        created new Tag 0.3.0-pre-alpha
  • orxonox/trunk/src/lib/particles/particle_system.cc

    r4597 r4602  
    2727#include "state.h"
    2828
    29 
    30 // needed to find the Position of the Camera
    31 #include "world.h"
     29#include "tinyxml.h"
    3230
    3331using namespace std;
     
    4038ParticleSystem::ParticleSystem (unsigned int maxCount, PARTICLE_TYPE type) : PhysicsInterface(this)
    4139{
    42   this->setClassID(CL_PARTICLE_SYSTEM, "ParticleSystem");
    43 
    44   this->material = NULL;
     40  this->init();
     41
    4542  this->maxCount = maxCount;
    46   this->count = 0;
    47   this->particles = NULL;
    48   this->deadList = NULL;
    49   this->setConserve(1);
    50   this->setLifeSpan(1);
    51   this->glID = NULL;
    5243  this->setType(type, 1);
    53   ParticleEngine::getInstance()->addSystem(this);
    54 }
    55 
     44}
     45
     46ParticleSystem::ParticleSystem(const TiXmlElement* root) : PhysicsInterface(this)
     47{
     48  this->init();
     49  this->loadParams(root);
     50}
    5651
    5752/**
     
    8176   if (this->material)
    8277     delete this->material;
     78}
     79
     80/**
     81  \brief initializes the ParticleSystem with default values
     82*/
     83void ParticleSystem::init(void)
     84{
     85  this->setClassID(CL_PARTICLE_SYSTEM, "ParticleSystem");
     86
     87  this->material = NULL;
     88  this->maxCount = PARTICLE_DEFAULT_MAX_COUNT;
     89  this->count = 0;
     90  this->particles = NULL;
     91  this->deadList = NULL;
     92  this->setConserve(1);
     93  this->setLifeSpan(1);
     94  this->glID = NULL;
     95  this->setType(PARTICLE_DEFAULT_TYPE, 1);
     96  ParticleEngine::getInstance()->addSystem(this);
     97}
     98
     99
     100/**
     101 * loads Parameters from a TiXmlElement
     102 * @param root the XML-element to load from.
     103 */
     104void ParticleSystem::loadParams(const TiXmlElement* root)
     105{
     106  static_cast<WorldEntity*>(this)->loadParams(root);
     107  static_cast<PhysicsInterface*>(this)->loadParams(root);
     108
     109  //LoadParam<ParticleSystem>(root, "type", this, &ParticleSystem::setType);
     110  LoadParam<ParticleSystem>(root, "life-span", this, &ParticleSystem::setLifeSpan);
     111  LoadParam<ParticleSystem>(root, "conserve", this, &ParticleSystem::setConserve);
     112//   void setLifeSpan(float lifeSpan, float randomLifeSpan = 0.0);
     113//   void setConserve(float conserve);
     114//
     115//   /* Per-Particle-Attributes */
     116//   void setRadius(float lifeCycleTime, float radius, float randRadius = 0.0);
     117//   void setMass(float lifeCycleTime, float mass, float randMass = 0.0);
     118//   void setColor(float lifeCycleTime, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
     119
    83120}
    84121
  • orxonox/trunk/src/lib/particles/particle_system.h

    r4597 r4602  
    1414
    1515#include "quick_animation.h"
     16
     17// Forward Declaration
     18class TiXmlElement;
    1619
    1720#define PARTICLE_DOT_MASK              0x000001     //!< A Mask if the Particles should be displayed as DOTs
     
    6669  ParticleSystem(unsigned int maxCount = PARTICLE_DEFAULT_MAX_COUNT,
    6770                 PARTICLE_TYPE type = PARTICLE_DEFAULT_TYPE);
     71  ParticleSystem(const TiXmlElement* root);
    6872  virtual ~ParticleSystem();
     73
     74  void init(void);
     75  void loadParams(const TiXmlElement* root);
    6976
    7077  void setType(PARTICLE_TYPE particleType, int count = 0);
Note: See TracChangeset for help on using the changeset viewer.