ParticleChokeDemo

Overview

This demo includes termination of particle emissions. This demo uses the demo library, demo::ParticleEffect class, and demo::ParticleNode class.

How to Use

Description

This demo detects the end of effect playback and and detaches the effect from the scene node after playback ends. Since the effect is always detached after playback ends, be sure to omit the cost of scene operations, for example. Within demo code, effect termination notification is performed using the IsDone() method in the ParticleNode class. In the IsDone() method, termination is determined while taking into account the number of particles and termination of emitter emissions, to be introduced below.

Checking that Particles Exist

After emissions end, the method given here can be used to check if particles exist. This can be determined as follows. For nw::gfx::ParticleModel* particleModel,

         if  (particleModel->HasParticle())
         {
             // Processing when particles exist
         }

When determining that a chain expression of particles has ended, use of this API only may make the wrong determination if the emitter is emitting particles intermittently. Be sure to check in conjunction with termination of particle emission by the emitter.

Checking that Emitter Emission Has Ended

The method given here is used to check if the emitter's emission time has completed.
To do this, use ParticleEmitter::IsAlive. ParticleEmitter::IsAlive checks the time given by AnimFrameController for the emitter, and returns false if the emission time has ended.
If an unlimited lifespan is set, the function always returns true as long as the resource is enabled. Specifically, emission is taken to have ended if any of the following conditions are satisfied.


CONFIDENTIAL