This page describes the content of ParticleDemo.
This demo loads a resource and creates an instance from ResModelArray and ResEmitterArray. At this time, the SceneObject (specifically, the ParticleModel or ParticleEmitter) created by SceneBuilder::CreateObject is stored for reference resolution purposes.
The reference structure of nodes is resolved using SceneHelper::ResolveReference.
The following initial setup is performed by SetupParticleObject.
Because references to a ParticleSet from a ParticleEmitter and references to a ParticleSet from a ResParticleChildUpdater are not resolved, they are resolved here. References are resolved within an array given as an argument. Within this scope, there is no problem as long as names do not conflict. The array is passed as an argument in order to explicitly limit the scope of references. This is useful when creating mutliple instances from a single resource.
The random number type is set for each ParticleEmitter and ParticleSet based on the random number for ParticleSceneContext.
After references have been resolved for the SceneNode, it is added to the scene tree. 3D models (SkeletalModel) and particles can be mixed together in the scene tree. Configure the tree according the your application design.
The description up to here is in preparation for creating objects. The description from here on regards processing performed for each frame.
Processing equivalent to that performed by nw::demo::SceneSystem::UpdateScene is executed. Nodes are updated. If necessary, you can process all gfx animations such as material animations.
Execute nw::gfx::ParticleSceneUpdater::UpdateNode. Here, particles are updated, and animation for emitter emission and particles is performed. ParticleContext, passed as an argument, is only for maintaining memory used temporarily, so just one is enough for the system.
Because ParticleSceneUpdater is also a class that includes only processing without saving status, it can be used.
Execute normal gfx rendering. There is no specific processing for particles at the application level.
CONFIDENTIAL