Changeset 4173 in orxonox.OLD for orxonox/branches
- Timestamp:
- May 13, 2005, 9:04:50 PM (20 years ago)
- Location:
- orxonox/branches/particleEngine/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/particleEngine/src/lib/graphics/particles/particle_emitter.cc
r4129 r4173 140 140 // this should spread the Particles evenly. if the Emitter is moved around quickly 141 141 Vector equalSpread = this->getVelocity() * random()/RAND_MAX * dt; 142 equalSpread.debug();143 142 144 143 system->addParticle(this->getAbsCoor() - equalSpread, velocityV); -
orxonox/branches/particleEngine/src/lib/graphics/particles/particle_engine.cc
r4129 r4173 251 251 /** 252 252 \brief draws all the systems and their Particles. 253 */ 254 void ParticleEngine::draw(void) 253 \param dt the time passed in seconds (since the last Frame) 254 */ 255 void ParticleEngine::draw(float dt) 255 256 { 256 257 tIterator<ParticleSystem>* tmpIt = systemList->getIterator(); … … 258 259 while(tmpSys) 259 260 { 260 tmpSys->draw( );261 tmpSys->draw(dt); 261 262 tmpSys = tmpIt->nextElement(); 262 263 } -
orxonox/branches/particleEngine/src/lib/graphics/particles/particle_engine.h
r4128 r4173 30 30 31 31 void tick(float dt); 32 void draw( void);32 void draw(float dt); 33 33 34 34 void addSystem(ParticleSystem* system); -
orxonox/branches/particleEngine/src/lib/graphics/particles/particle_system.cc
r4129 r4173 38 38 this->maxCount = maxCount; 39 39 this->count = 0; 40 this->particleType = type;41 40 this->particles = NULL; 42 41 this->deadList = NULL; 43 this->setConserve( .8);44 this->setLifeSpan( .1);42 this->setConserve(1); 43 this->setLifeSpan(1); 45 44 this->setInheritSpeed(0); 46 45 this->glID = NULL; 47 46 this->setRadius(1.0, 1.0, 0.0); 48 this->setType( PARTICLE_SPRITE, 1);47 this->setType(type, 1); 49 48 ParticleEngine::getInstance()->addSystem(this); 50 49 } … … 54 53 \brief standard deconstructor 55 54 */ 56 ParticleSystem::~ParticleSystem() 55 ParticleSystem::~ParticleSystem() 57 56 { 58 57 // delete what has to be deleted here … … 240 239 /** 241 240 \brief draws all the Particles of this System 242 */ 243 void ParticleSystem::draw(void) 244 { 241 \param the time passed in seconds (since the last draw) 242 */ 243 void ParticleSystem::draw(float dt) 244 { 245 glPushAttrib(GL_ENABLE_BIT); 245 246 // 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)) 247 Particle* drawPart = particles; 248 249 switch (this->particleType) 254 250 { 255 //draw in DOT mode 256 // glBegin(GL_POINTS); 251 case PARTICLE_SPRITE: 252 glMatrixMode(GL_MODELVIEW); 253 // glDisable(GL_LIGHTING); 254 material->select(); 255 glDisable(GL_DEPTH_TEST); 257 256 while (likely(drawPart != NULL)) 258 257 { … … 267 266 } 268 267 // glEnd(); 268 269 // glEnable(GL_LIGHTING); 270 271 glEnable(GL_DEPTH_TEST); 272 break; 273 default: 274 275 case PARTICLE_SPARK: 276 glEnable(GL_LINE_SMOOTH); 277 glBegin(GL_LINES); 278 while (likely(drawPart != NULL)) 279 { 280 glVertex3f(drawPart->position.x, drawPart->position.y, drawPart->position.z); 281 glVertex3f(drawPart->position.x - drawPart->velocity.x, 282 drawPart->position.y - drawPart->velocity.y, 283 drawPart->position.z - drawPart->velocity.z); 284 drawPart = drawPart->next; 285 } 286 glEnd(); 287 break; 288 289 case PARTICLE_DOT: 290 glBegin(GL_POINTS); 291 while (likely(drawPart != NULL)) 292 { 293 glLineWidth(drawPart->radius); 294 295 glVertex3f(drawPart->position.x, drawPart->position.y, drawPart->position.z); 296 drawPart = drawPart->next; 297 } 298 glEnd(); 299 break; 269 300 } 270 // glEnable(GL_LIGHTING); 271 glEnable(GL_DEPTH_TEST); 301 glPopAttrib(); 272 302 } 273 303 -
orxonox/branches/particleEngine/src/lib/graphics/particles/particle_system.h
r4128 r4173 70 70 71 71 void tick(float dt); 72 void draw( void);72 void draw(float dt); 73 73 74 74 void debug(void); -
orxonox/branches/particleEngine/src/story_entities/world.cc
r4129 r4173 493 493 494 494 495 ParticleSystem* system = new ParticleSystem(1000 );496 system->setLifeSpan( 1);495 ParticleSystem* system = new ParticleSystem(1000, PARTICLE_SPARK); 496 system->setLifeSpan(.5); 497 497 system->setRadius(2, 0, 2, 0); 498 ParticleEmitter* emitter = new ParticleEmitter(Vector(-1, 0, 0), 0, 1000, 0); 498 499 ParticleEmitter* emitter = new ParticleEmitter(Vector(-1, 0, 0), M_PI_4, 1000, .05); 499 500 emitter->setParent(this->localPlayer); 500 501 … … 962 963 963 964 TextEngine::getInstance()->draw(); 964 particleEngine->draw( );965 particleEngine->draw((float)dt/1000.0); //!< \todo should be dts like in the Trunk; 965 966 966 967 lightMan->draw(); // must be at the end of the drawing procedure, otherwise Light cannot be handled as PNodes //
Note: See TracChangeset
for help on using the changeset viewer.