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 12 <div class="section"><img src="images/ParticleRecycleDemo.png" border="0" width="400" height="240" /></div> 13 14 <h2>Overview</h2> 15 <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.html">demo::ParticleNode</a> class.<br /> 16 </p> 17 18 <h2>How to Use</h2> 19 <p> 20 <ul> 21 <li>Demo-specific operations</li> 22 <ul> 23 <li>None.</li> 24 </ul> 25 <li>Common Operations</li> 26 <ul> 27 <li>Slide pad: Rotate the camera</li> 28 <li>Slide pad + A Button: Move the camera back and forth</li> 29 <li>Slide pad + B Button: Move the camera in parallel</li> 30 <li>Slide pad + Y Button: Move the camera up and down</li> 31 <li>X Button: Reset the camera position</li> 32 <li>START Button: Restart the demo.</li> 33 </ul> 34 </ul> 35 </p> 36 37 <h2>Description</h2> 38 <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 <span>demo::ParticleNode::Reset</span> method.</p> 39 40 <h2>Removing a Particle Model or Emitter From a Scene and Re-using It </h2> 41 <p> 42 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 /> 43 </p> 44 <ul> 45 <li><a href="../../../nw/gfx/ParticleCollection/Overview.html">ParticleCollection</a> <a href="../../../nw/gfx/ParticleCollection/Clear.html">Clear</a></li> 46 <li><a href="../../../nw/gfx/ParticleEmitter/Overview.html">ParticleEmitter</a> <a href="../../../nw/gfx/ParticleEmitter/Reset.html">Reset</a></li> 47 <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> 48 </ul> 49 <p> 50 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> 51 <pre> 52 void 53 ResetParticle( 54 nw::gfx::ParticleModel* model, 55 nw::gfx::ParticleEmitter* emitter 56 ) 57 { 58 model->ForeachParticleSet(nw::gfx::ParticleSetsClear()); 59 model->ParticleAnimFrameController().SetFrame(0); 60 emitter->Reset(); 61 } 62 </pre> 63 <hr><p>CONFIDENTIAL</p></body> 64</html> 65 66