1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"[]> 2<html xml:lang="en-US" lang="en-US"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <meta http-equiv="Content-Style-Type" content="text/css" /> 6 <link rel="stylesheet" href="../../../css/document.css" type="text/css" /> 7 <title>Graphix Library (gfx) Sample Demos</title> 8 </head> 9 <body> 10 <h1>ParticleRecycleDemo</h1> 11 <div class="section"><img src="images/ParticleRecycleDemo.png" border="0" width="400" height="240" /></div> 12 <h2>Overview</h2> 13 <p>This demo re-uses instances of particles. This demo uses the demo library, <a href="../../../nw/demo/ParticleEffect/Overview.html">demo::ParticleEffect</a> class, and <a href="../../../nw/demo/ParticleNode/Overview.html">demo::ParticleNode</a> class.<br /> 14 </p> 15 <h2>How to Use</h2> 16 <p> 17 <ul> 18 <li>Demo-specific operations</li> 19 <ul> 20 <li>None.</li> 21 </ul> 22 <li>Common Operations</li> 23 <ul> 24 <li>Slide pad: Rotate the camera</li> 25 <li>Slide pad + A Button: Move the camera back and forth</li> 26 <li>Slide pad + B Button: Move the camera in parallel</li> 27 <li>Slide pad + Y Button: Move the camera up and down</li> 28 <li>X Button: Reset the camera position</li> 29 <li>START Button: Restart the demo.</li> 30 </ul> 31 </ul> 32 </p> 33 <h2>Description</h2> 34 <p>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 <a href="../../../nw/demo/ParticleNode/Reset.html">demo::ParticleNode::Reset</a> method. </p> 35 36 <h2>Removing a Particle Model or Emitter From a Scene and Re-using It </h2> 37 <p> 38 To remove a particle model or emitter from a scene, remove the model or emitter from the <a href="../../../nw/gfx/SceneNode/Overview.html">SceneNode</a> of the parent (usually the scene root) using <a href="../../../nw/gfx/SceneNode/DetachChild.html">DetachChild</a>. When re-using models or emitters, you can can add using <a href="../../../nw/gfx/SceneNode/AttachChild.html">AttachChild</a> when the immediately previous state is okay, but perform the following operations when restoring a model or emitter to initial status.<br /> 39 </p> 40 <ul> 41 <li><a href="../../../nw/gfx/ParticleCollection/Overview.html">ParticleCollection</a> <a href="../../../nw/gfx/ParticleCollection/Clear.html">Clear</a></li> 42 <li><a href="../../../nw/gfx/ParticleEmitter/Overview.html">ParticleEmitter</a> <a href="../../../nw/gfx/ParticleEmitter/Reset.html">Reset</a></li> 43 <li>Restore the <a href="../../../nw/gfx/ParticleModel/Overview.html">ParticleModel</a> <a href="../../../nw/gfx/ParticleModel/ParticleAnimFrameController.html">AnimFrameController</a> frame to 0</li> 44 </ul> 45 <p> 46 The ParticleEmitter AnimFrameController is returned to 0 by <a href="../../../nw/gfx/ParticleEmitter/Reset.html">Reset</a>. As for the <a href="../../../nw/gfx/ParticleCollection/Clear.html">Clear</a> method, note that commands are double-buffered because calls cannot be made during GPU processing.</p> 47 <pre> 48 void 49 ResetParticle( 50 nw::gfx::ParticleModel* model, 51 nw::gfx::ParticleEmitter* emitter 52 ) 53 { 54 model->ForeachParticleSet(nw::gfx::ParticleSetsClear()); 55 model->ParticleAnimFrameController().SetFrame(0); 56 emitter->Reset(); 57 } 58 </pre> 59 <hr><p>CONFIDENTIAL</p></body> 60</html> 61