Managing The Solid Particle System
The SPS mesh when built has all the properties and methods that you can apply to any mesh. In addition there are useful properties you can use with the SPS. Some you should have met already.
Property | Type | Use |
---|---|---|
Property SPS.particles | Type particle[] | Use iterate over this array in initParticles() |
Property SPS.nbParticles | Type number | Use total number of particles in the SPS |
Property SPS.billboard | Type Boolean | Use turns particles towards camera; false by default |
Property SPS.counter | Type number | Use for your own usage, its not set by the SPS |
When working with JavaScript you can add your own properties like capacity or rate if needed.
When you don't need your SPS any longer, you can dispose it to free the memory with
SPS.dispose();SPS = null; // tells the GC the reference can be cleaned up also
When you are not going to use some particle features you can set other properties of the SPS to false disable them. You can always enable them again with true. This improve the performance of the scene as no attempt will be made to update these properties.
Property | Type | Default | Use | |
---|---|---|---|---|
Property SPS.computeParticleRotation | Type Boolean | Default true | Use allows or prevents computing particle.rotation | |
Property SPS.computeParticleTexture | Type Boolean | Default true | Use allows or prevents computing particle.uvs | |
Property SPS.computeParticleColor | Type Boolean | Default true | Use allows or prevents from computing particle.color | |
Property SPS.computeParticleVertex | Type Boolean | Default false | Use allows or prevents calling the custom updateParticleVertex() function |
These properties affect the SPS.setParticles() process only. You can change them between calls to SPS.setParticles(). For example setting SPS.computeParticleColor to false after the first call to SPS.setParticles() allows particle colors set during initParticles() to be applied but prevents any call to updating colors in subsequent calls to SPS.setParticles(). When SPS.setParticles() is inside the render loop this can be very beneficial.
Tetra fountain color and texture not updated: Tetrahedron Fountain Color And Texture Not Updated