Changeset 4176 in orxonox.OLD for orxonox/trunk/src/lib
- Timestamp:
- May 13, 2005, 11:09:20 PM (20 years ago)
- Location:
- orxonox/trunk/src/lib
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/particles/particle_emitter.cc
r4017 r4176 137 137 randDir = (this->getAbsDir()*Quaternion(angle + randomAngle *((float)rand()/RAND_MAX -.5), randDir)).apply(this->direction); 138 138 Vector velocityV = randDir.getNormalized()*this->velocity + inheritVelocity; 139 140 system->addParticle(this->getAbsCoor(), velocityV); 139 140 // this should spread the Particles evenly. if the Emitter is moved around quickly 141 Vector equalSpread = this->getVelocity() * random()/RAND_MAX * dt; 142 143 system->addParticle(this->getAbsCoor() - equalSpread, velocityV); 141 144 } 142 145 } -
orxonox/trunk/src/lib/graphics/particles/particle_emitter.h
r3966 r4176 22 22 23 23 public: 24 ParticleEmitter(const Vector& direction, float angle = .5, float emissionRate = 1.0,25 float velocity = 1.0);24 ParticleEmitter(const Vector& direction, float angle = .5, 25 float emissionRate = 1.0, float velocity = 1.0); 26 26 virtual ~ParticleEmitter(void); 27 27 -
orxonox/trunk/src/lib/graphics/particles/particle_engine.cc
r3966 r4176 228 228 void ParticleEngine::tick(float dt) 229 229 { 230 // add new Particles to each System connected to an Emitter.231 tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();232 ParticleConnection* tmpConnection = tmpConIt->nextElement();233 while(tmpConnection)234 {235 tmpConnection->emitter->tick(dt, tmpConnection->system);236 tmpConnection = tmpConIt->nextElement();237 }238 delete tmpConIt;239 240 241 230 // ticks all the ParticleSystems 242 231 tIterator<ParticleSystem>* tmpIt = systemList->getIterator(); … … 248 237 } 249 238 delete tmpIt; 239 240 // add new Particles to each System connected to an Emitter. 241 tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator(); 242 ParticleConnection* tmpConnection = tmpConIt->nextElement(); 243 while(tmpConnection) 244 { 245 tmpConnection->emitter->tick(dt, tmpConnection->system); 246 tmpConnection = tmpConIt->nextElement(); 247 } 248 delete tmpConIt; 250 249 } 251 250 252 251 /** 253 252 \brief draws all the systems and their Particles. 254 */ 255 void ParticleEngine::draw(void) 253 \param dt the time passed in seconds (since the last Frame) 254 */ 255 void ParticleEngine::draw(float dt) 256 256 { 257 257 tIterator<ParticleSystem>* tmpIt = systemList->getIterator(); … … 259 259 while(tmpSys) 260 260 { 261 tmpSys->draw( );261 tmpSys->draw(dt); 262 262 tmpSys = tmpIt->nextElement(); 263 263 } -
orxonox/trunk/src/lib/graphics/particles/particle_engine.h
r3966 r4176 8 8 9 9 #include "base_object.h" 10 #include "particle_system.h" 11 #include "particle_emitter.h" 10 12 11 13 // FORWARD DEFINITION … … 28 30 29 31 void tick(float dt); 30 void draw( void);32 void draw(float dt); 31 33 32 34 void addSystem(ParticleSystem* system); -
orxonox/trunk/src/lib/graphics/particles/particle_system.cc
r4123 r4176 35 35 { 36 36 this->setClassName ("ParticleSystem"); 37 this->material = NULL; 37 38 this->name = NULL; 38 39 this->maxCount = maxCount; 39 40 this->count = 0; 40 this->particleType = type;41 41 this->particles = NULL; 42 42 this->deadList = NULL; 43 this->setConserve( .8);44 this->setLifeSpan( .1);43 this->setConserve(1); 44 this->setLifeSpan(1); 45 45 this->setInheritSpeed(0); 46 46 this->glID = NULL; 47 47 this->setRadius(1.0, 1.0, 0.0); 48 this->setType( PARTICLE_SPRITE, 1);48 this->setType(type, 1); 49 49 ParticleEngine::getInstance()->addSystem(this); 50 50 } … … 54 54 \brief standard deconstructor 55 55 */ 56 ParticleSystem::~ParticleSystem() 56 ParticleSystem::~ParticleSystem() 57 57 { 58 58 // delete what has to be deleted here … … 74 74 delete tmpDelPart; 75 75 } 76 77 if (this->material) 78 delete this->material; 76 79 } 77 80 … … 240 243 /** 241 244 \brief draws all the Particles of this System 242 */ 243 void ParticleSystem::draw(void) 244 { 245 \param the time passed in seconds (since the last draw) 246 */ 247 void ParticleSystem::draw(float dt) 248 { 249 glPushAttrib(GL_ENABLE_BIT); 245 250 // material->select(); 246 247 248 glMatrixMode(GL_MODELVIEW); 249 // glDisable(GL_LIGHTING); 250 material->select(); 251 glDisable(GL_DEPTH_TEST); 252 Particle* drawPart = particles; 253 if (likely(drawPart != NULL)) 251 Particle* drawPart = particles; 252 253 switch (this->particleType) 254 254 { 255 //draw in DOT mode 256 // glBegin(GL_POINTS); 255 case PARTICLE_SPRITE: 256 glMatrixMode(GL_MODELVIEW); 257 // glDisable(GL_LIGHTING); 258 material->select(); 259 glDisable(GL_DEPTH_TEST); 257 260 while (likely(drawPart != NULL)) 258 261 { … … 267 270 } 268 271 // glEnd(); 272 273 // glEnable(GL_LIGHTING); 274 275 glEnable(GL_DEPTH_TEST); 276 break; 277 default: 278 279 case PARTICLE_SPARK: 280 glEnable(GL_LINE_SMOOTH); 281 glBegin(GL_LINES); 282 while (likely(drawPart != NULL)) 283 { 284 glVertex3f(drawPart->position.x, drawPart->position.y, drawPart->position.z); 285 glVertex3f(drawPart->position.x - drawPart->velocity.x, 286 drawPart->position.y - drawPart->velocity.y, 287 drawPart->position.z - drawPart->velocity.z); 288 drawPart = drawPart->next; 289 } 290 glEnd(); 291 break; 292 293 case PARTICLE_DOT: 294 glBegin(GL_POINTS); 295 while (likely(drawPart != NULL)) 296 { 297 glLineWidth(drawPart->radius); 298 299 glVertex3f(drawPart->position.x, drawPart->position.y, drawPart->position.z); 300 drawPart = drawPart->next; 301 } 302 glEnd(); 303 break; 269 304 } 270 // glEnable(GL_LIGHTING); 271 glEnable(GL_DEPTH_TEST); 305 glPopAttrib(); 272 306 } 273 307 … … 291 325 } 292 326 else 293 this->particles = new Particle; 327 { 328 PRINTF(5)("Generating new Particle\n"); 329 this->particles = new Particle; 330 } 294 331 this->particles->next = NULL; 295 332 } … … 304 341 } 305 342 else 306 tmpPart = new Particle; 343 { 344 PRINTF(5)("Generating new Particle\n"); 345 tmpPart = new Particle; 346 } 307 347 tmpPart->next = this->particles; 308 348 this->particles = tmpPart; -
orxonox/trunk/src/lib/graphics/particles/particle_system.h
r4123 r4176 54 54 55 55 public: 56 ParticleSystem(unsigned int maxCount = PARTICLE_DEFAULT_MAX_COUNT, PARTICLE_TYPE type = PARTICLE_DEFAULT_TYPE); 56 ParticleSystem(unsigned int maxCount = PARTICLE_DEFAULT_MAX_COUNT, 57 PARTICLE_TYPE type = PARTICLE_DEFAULT_TYPE); 57 58 virtual ~ParticleSystem(); 58 59 void setName(const char* name); … … 63 64 void setInheritSpeed(float value); 64 65 void setLifeSpan(float lifeSpan, float randomLifeSpan = 0.0); 65 void setRadius(float startRadius, float endRadius, float randomStartRadius = 0.0, float randomEndRadius = 0.0); 66 void setRadius(float startRadius, float endRadius, 67 float randomStartRadius = 0.0, float randomEndRadius = 0.0); 66 68 void setConserve(float conserve); 67 69 void setMass(float mass, float randomMass); 68 70 69 71 void tick(float dt); 70 void draw( void);72 void draw(float dt); 71 73 72 74 void debug(void); -
orxonox/trunk/src/lib/gui/gui/gui_video.cc
r4132 r4176 107 107 Label* modelDetailLabel; //!< Label for model-detail. 108 108 Menu* modelDetail; //!< model-detail. 109 CheckButton* particles; //!< If the Particles should be enabled 109 110 Label* antiAliasingLabel; //!< Label for the anti-aliasing mode. 110 111 Menu* antiAliasing; //!< Menu for the Antialiasing-mode. … … 142 143 advancedBox->fill(modelDetail); 143 144 145 particles = new CheckButton(CONFIG_NAME_PARTICLES_ENABLED); 146 particles->saveability(); 147 particles->setDefaultValue(1); 148 advancedBox->fill(particles); 149 144 150 antiAliasingLabel = new Label("Anti-Aliasing-depth:"); 145 151 advancedBox->fill(antiAliasingLabel); … … 155 161 filterMethod->saveability(); 156 162 advancedBox->fill(filterMethod); 163 164 157 165 158 166 closeButton = new Button("close");
Note: See TracChangeset
for help on using the changeset viewer.