Skip to content

Commit 1316cf2

Browse files
committed
Main: ParticleEmitter - new take on burst mode
1 parent 9359691 commit 1316cf2

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Docs/src/particle-scripts.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ format: direction\_position\_reference <x> <y> <z> <enable&
307307

308308
## emission\_rate
309309

310-
Sets how many particles per second should be emitted. The specific emitter does not have to emit these in a continuous burst - this is a relative parameter and the emitter may choose to emit all of the second’s worth of particles every half-second for example, the behaviour depends on the emitter. The emission rate will also be limited by the particle system’s ’quota’ setting.
310+
Sets how many particles per second should be emitted. The specific emitter does not have to emit these in a continuous manner - this is a relative parameter and the emitter may choose to emit all of the second’s worth of particles every half-second for example, the behaviour depends on the emitter. The emission rate will also be limited by the particle system’s ’quota’ setting.
311311

312312
format: emission\_rate &lt;particles\_per\_second&gt;<br> example: emission\_rate 50<br> default: 10<br>
313313

@@ -355,10 +355,13 @@ format: as time\_to\_live<br> example:<br>     time\_to\_live\_min 2<br>  
355355

356356
## duration
357357

358-
Sets the number of seconds the emitter is active. The emitter can be started again, see [repeat\_delay](#repeat_005fdelay). A value of 0 means infinite duration. See also the duration\_min and duration\_max attributes which let you set a duration range instead of a fixed one.
358+
Sets the number of seconds the emitter is active. The emitter can be started again, see [repeat\_delay](#repeat_005fdelay).
359+
See also the duration\_min and duration\_max attributes which let you set a duration range instead of a fixed one.
359360

360361
format: duration &lt;seconds&gt;<br> example:<br>     duration 2.5<br> default: 0<br> <br>
361362

363+
@note A value of 0 means infinite duration. A value < 0 means "burst" where @c emission_rate of particles are emitted once in the next frame.
364+
362365
<a name="duration_005fmin"></a><a name="duration_005fmax"></a>
363366

364367
## duration\_min & duration\_max

OgreMain/src/OgreParticleEmitter.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,12 @@ namespace Ogre
312312
{
313313
if (mEnabled)
314314
{
315+
if(mDurationMax < 0)
316+
{
317+
// single-shot burst
318+
setEnabled(false);
319+
return mEmissionRate;
320+
}
315321
// Keep fractions, otherwise a high frame rate will result in zero emissions!
316322
mRemainder += mEmissionRate * timeElapsed;
317323
unsigned short intRequest = (unsigned short)mRemainder;

0 commit comments

Comments
 (0)