Changeset 4602 in orxonox.OLD for orxonox/trunk/src/lib
- Timestamp:
- Jun 11, 2005, 6:09:21 PM (19 years ago)
- Location:
- orxonox/trunk/src/lib/particles
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/particles/particle_system.cc
r4597 r4602 27 27 #include "state.h" 28 28 29 30 // needed to find the Position of the Camera 31 #include "world.h" 29 #include "tinyxml.h" 32 30 33 31 using namespace std; … … 40 38 ParticleSystem::ParticleSystem (unsigned int maxCount, PARTICLE_TYPE type) : PhysicsInterface(this) 41 39 { 42 this->setClassID(CL_PARTICLE_SYSTEM, "ParticleSystem"); 43 44 this->material = NULL; 40 this->init(); 41 45 42 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;52 43 this->setType(type, 1); 53 ParticleEngine::getInstance()->addSystem(this); 54 } 55 44 } 45 46 ParticleSystem::ParticleSystem(const TiXmlElement* root) : PhysicsInterface(this) 47 { 48 this->init(); 49 this->loadParams(root); 50 } 56 51 57 52 /** … … 81 76 if (this->material) 82 77 delete this->material; 78 } 79 80 /** 81 \brief initializes the ParticleSystem with default values 82 */ 83 void 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 */ 104 void 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 83 120 } 84 121 -
orxonox/trunk/src/lib/particles/particle_system.h
r4597 r4602 14 14 15 15 #include "quick_animation.h" 16 17 // Forward Declaration 18 class TiXmlElement; 16 19 17 20 #define PARTICLE_DOT_MASK 0x000001 //!< A Mask if the Particles should be displayed as DOTs … … 66 69 ParticleSystem(unsigned int maxCount = PARTICLE_DEFAULT_MAX_COUNT, 67 70 PARTICLE_TYPE type = PARTICLE_DEFAULT_TYPE); 71 ParticleSystem(const TiXmlElement* root); 68 72 virtual ~ParticleSystem(); 73 74 void init(void); 75 void loadParams(const TiXmlElement* root); 69 76 70 77 void setType(PARTICLE_TYPE particleType, int count = 0);
Note: See TracChangeset
for help on using the changeset viewer.