Hi guys,
I need some help with my smoke particle system. I'm trying to get my smoke system to look like this (See "Smoke Stack" ) Its written in Delphi (?). Also, the .exe and source is included.
This code renders each of the particles.
Display All
This code resets a dead particle.
Question: When rendering each particle in my loop, is there something wrong in what I am donig?
Note the link I provided above uses Delphi, if anyone knows this language can you translate the important stuff?
Here a link to a movie demonstrating my smoke. (SLOW download!)
Thanks again
Sabrina
I need some help with my smoke particle system. I'm trying to get my smoke system to look like this (See "Smoke Stack" ) Its written in Delphi (?). Also, the .exe and source is included.
This code renders each of the particles.
Source Code
- for (int i = 0; i < MAX_SMOKE_PARTICLES; i++ ) // loop through 500 particles.
- {
- if ( Particle[i].GetActiveState() ) // If a particular particle is alive...
- {
- // glColor4f( Particle[i].m_vColor.Red, Particle[i].m_vColor.Blue, Particle[i].m_vColor.Green, Particle[i].m_fEnergy );
- glColor4f( 0.25f, 0.25f, 0.25f, 0.050f );
- glBegin(GL_TRIANGLE_STRIP);
- ... // draw the smoke pic.
- glEnd();
- Particle[i].m_vPosition += Particle[i].m_vVelocity * 0.0050f;
- Particle[i].m_vVelocity += Particle[i].m_vGravity;
- Particle[i].m_fSize += 0.01f; // As smoke rises, it expands, so increase the size of the particle.
- Particle[i].m_fEnergy -= Particle[i].m_fFade;
- if ( Particle[i].IsDead() ) // Is our particle dead?
- {
- ReSetParticle(i);
- }
- }
- }
- ....
This code resets a dead particle.
Source Code
- inline void CSmokeEffect::ReSetParticle( unsigned int uPart )
- {
- Particle[uPart].SetLifeTime( 1.00f );
- Particle[uPart].SetFadeTime( Randf( 0.00f, 1.00f ) ); // Get a number from 0.0 to 1.0.
- Particle[uPart].SetPosition( 0.00f, -4.90f, 0.00f );
- Particle[uPart].SetVelocity( 0.00f, 1.00f, 0.00f );
- Particle[uPart].SetColor( 0.25f, 0.25f, 0.25f, 1.00f );
- Particle[uPart].m_fSize = 1.00f;
- }
Question: When rendering each particle in my loop, is there something wrong in what I am donig?
Note the link I provided above uses Delphi, if anyone knows this language can you translate the important stuff?
Here a link to a movie demonstrating my smoke. (SLOW download!)
Thanks again
Sabrina