Added SDK 0.28.0
The ParticleRenderable object is used to provide the necessary glue between a ParticleSystem and a Scene. The object provides a necessary subset of the Renderable interface required to include ParticleSystems into a Scene with minimal effort.
The ParticleRenderable will be assigned a ParticleSystem to be rendered, and will manage the creation and deletion of ParticleViews for each unique Camera instance used to render a Scene. The ParticleRenderable will take part in the Scenes culling, and as a by-product of the scene being rendered will the ParticleSystem‘s sync method be called so that only visible ParticleSystems will ever be updated.
The ParticleRenderable exposes an API which permits ParticleSystems to be lazily allocated when the renderable is first rendered so that effects may be created all around a Scene, with those that have never become visible existing purely as an empty renderable in in the world. A similar API permits lazy allocation of ParticleViews instead of always creating a new ParticleView so that pooling of ParticleViews may also be achieved.
Renderable API not supported by ParticleRenderable
Additionally, it is assumed that a ParticleRenderable should also be used as a transparent renderable, being sorted along side other transparent renderables in a Scene.
Transformation
A ParticleRenderable has its own local transform. If the renderable has fixedOrientation true, then the rotational and scaling components of any parent transforms are used only to compute the world position for the renderable, enforcing that only the rotation and scaling defined on the renderables local transform are used. If fixedOrientation is false, then a simple multiplication with the parent transform will be performed.
Note
This is a low-level particle system API.
Summary
Create a new ParticleRenderable
Syntax
var renderable = ParticleRenderable.create({
graphicsDevice: graphicsDevice,
passIndex: renderer.passIndex.transparent,
system: particleSystem,
sharedRenderContext: sharedRenderContext
});
Summary
Set the ParticleSystem to be rendered by this renderable. This method should not be used whilst the renderable is inside a Scene.
Syntax
renderable.setSystem(system);
Summary
Assign a callback function to be used when the renderable is first made visible to assign a ParticleSystem to be rendered from that point on.
Syntax
renderable.setLazySystem(systemCallback, center, halfExtents);
The function to be called to allocate a ParticleSystem when renderable is first made visible. This function must return a valid ParticleSystem.
Setting the callback to null is permitted, but it is assumed that a non-null system or callback will be defined for the renderable before it is added to a Scene.
Summary
Assign a callback function to be used when a new (or first) Camera instance makes visible the renderable for the first time to enable pooling of ParticleView objects.
If no lazy view callback is assigned, then the renderable will allocate a new view itself.
Syntax
renderable.setLazyView(viewCallback);
The function to be called to allocate a ParticleView when a new Camera makes visible the renderable for the first time.
This function is permitted to return null, in which case a new ParticleView will be allocated.
This callback may also be re-set to null via this method.
Summary
Remove all ParticleViews from the renderable, invoking the provided callback for each view to enable pooling when a ParticleRenderable is removed from a Scene.
Syntax
renderable.releaseViews(function (view)
{
...
});
Callback called for each ParticleView removed from the renderable.
If callback is not specified, then the ParticleView objects will instead be destroyed.
Summary
Destroy the renderable, rendering it invalid for future use, and destroying any remaining ParticleViews assigned to it.
Syntax
renderable.destroy();
Summary
Set the fixedOrientation flag on this renderable.
Syntax
renderable.setFixedOrientation(true);
Summary
Set the localTransform field on this renderable. If changes are made directly to the renderables localTransform, this function must still be called to enact the necessary side-effects.
Syntax
renderable.setLocalTransform(transform);
transform (Optional)
If argument is unspecified, it is assumed that direct modifications were made to the local transform. Otherwise the provided Matrix43 transform will first be copied to the renderables local transform.
Summary
The currently bound ParticleSystem for this renderable. To modify this field use the setSystem or setLazySystem methods.
Note
Read Only
Summary
Fixed orientation flag of this renderable. To modify this flag use the setFixedOrientation method.
Note
Read Only