Particle Emitter - Start & Stop

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
rdm
Posts: 10
Joined: Mon Jun 19, 2006 2:53 pm

Particle Emitter - Start & Stop

Post by rdm »

Hi,

I want to share a simple particle emitter modification with the community. I hope it will be included ... I am using it on my game.

"setMaxMinLifeTime" function for emitters will be usefull. With this function it is possible to change the life time of particles.

"setParticlesPerSecond" function for emitters will be usefull. With this function it is possible to start/stop/restart the particle emitters.

Implementation;

Step 1 - (IParticleEmitter.h) - Add;
- To the class definition, public ...

Code: Select all

	virtual void setParticlesPerSecond(int max, int min) = 0; 

	virtual void setMaxMinLifeTime(int max, int min) = 0;
Step 2 - (CParticlePointEmitter.h) - Add;
- To the class definition, public ...

Code: Select all

	void setParticlesPerSecond(int max, int min); 
	
	void setMaxMinLifeTime(int max, int min);
Step 3 - (CParticleBoxEmitter.h) - Add;
- To the class definition, public ...

Code: Select all

	void setParticlesPerSecond(int max, int min); 
	
	void setMaxMinLifeTime(int max, int min);

Step 4 - (CParticlePointEmitter.cpp) - Add;

Code: Select all

void CParticlePointEmitter::setParticlesPerSecond(int max, int min)
{ 
   MaxParticlesPerSecond = max; 
   MinParticlesPerSecond = min; 
} 

void CParticlePointEmitter::setMaxMinLifeTime(int max, int min)
{ 
   MaxLifeTime = max; 
   MinLifeTime = min; 
}

Step 5 - (CParticleBoxEmitter.cpp) - Add;

Code: Select all

void CParticleBoxEmitter::setParticlesPerSecond(int max, int min)
{ 
   MaxParticlesPerSecond = max; 
   MinParticlesPerSecond = min; 
} 

void CParticleBoxEmitter::setMaxMinLifeTime(int max, int min)
{ 
   MaxLifeTime = max; 
   MinLifeTime = min; 
}
Thanks.
rdm
Posts: 10
Joined: Mon Jun 19, 2006 2:53 pm

Post by rdm »

It seems this won't added to the engine :P
Eternl Knight
Posts: 313
Joined: Tue Nov 01, 2005 5:01 am

Post by Eternl Knight »

Be patient, there is still a large number of more essential patches being merged. For example, I happen to know from one recent thread that hybrid is still working on getting Spintz's "32bit index" patch in, allowing for more than 65K vertices/triangles to be loaded at once.

--EK
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Well, impatience seem to be quite common nowadays. Additionally Spintz also provides lots of particle enhancements which might already provide this interface. So these changes will have to be merged and further checked before inclusion. And yes, particles have not the highest priority for me :wink:
rdm
Posts: 10
Joined: Mon Jun 19, 2006 2:53 pm

Post by rdm »

I am sorry, i dont mean/seem to be impatient i just wanted to remind and bump this topic ...

i thought this would be usefull cause i am using it in my game :P

anyway, tnx.
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

Another little quick addition to the particle system in Irrlicht to help with some problems with the particle systems when they are first created -

In CParticleSystemSceneNode::doParticleSystem(u32 time), add to the very beginning of the function -

Code: Select all

if( LastEmitTime == 0 )
{
	LastEmitTime = time;
	return;
}
Should help fix that initial emit of a particle system in no mans land.
Image
Post Reply