ParticleRecycleDemo

Overview

This demo re-uses instances of particles. This demo uses the demo library, demo::ParticleEffect class, and demo::ParticleNode class.

How to Use

Description

This demo re-uses instances created from resources. Creation and destruction represent highly cost-intensive processes. You can omit creation and destruction processes while the application is running by re-using instances created when the application was initialized. This can assist in executing applications at a stable cost. This is an effective technique when the particles to be used are known. The demo uses the demo::ParticleNode::Reset method.

Removing a Particle Model or Emitter From a Scene and Re-using It

To remove a particle model or emitter from a scene, remove the model or emitter from the SceneNode of the parent (usually the scene root) using DetachChild. When re-using models or emitters, you can can add using AttachChild when the immediately previous state is okay, but perform the following operations when restoring a model or emitter to initial status.

The ParticleEmitter AnimFrameController is returned to 0 by Reset. As for the Clear method, note that commands are double-buffered because calls cannot be made during GPU processing.

         void
         ResetParticle(
             nw::gfx::ParticleModel* model,
             nw::gfx::ParticleEmitter* emitter
         )
         {
             model->ForeachParticleSet(nw::gfx::ParticleSetsClear());
             model->ParticleAnimFrameController().SetFrame(0);
             emitter->Reset();
         }
      

CONFIDENTIAL