This class implements a simple particle system. More...
#include <Luminous/SpriteRenderer.hpp>
Classes | |
| struct | Sprite |
| Individual sprite. More... | |
Public Types | |
| typedef std::vector< Sprite > | SpriteVector |
| The container type where the sprites are stored. | |
Public Member Functions | |
| const BlendMode & | blendMode () const |
| Blend mode used during rendering. More... | |
| void | createFuzzyTexture (int dim, float centerDotSize=0.25f, float haloweight=0.75f, float halodescent=1.0f) |
| Create a blurry texture Creates a basic square texture with radial gradient pattern. More... | |
| void | render (Luminous::RenderContext &r) const |
| Renders the sprites. | |
| void | resize (size_t n) |
| Resize the sprite buffer. | |
| void | setBlendMode (const Luminous::BlendMode &mode) |
| Set the blend mode used for rendering the particles. More... | |
| void | setImage (const Luminous::Image &image) |
| Sets the texture that is used in the rendering process. | |
| void | setVelocityScale (float velscale) |
| Set the velocity scaling factor. More... | |
| size_t | spriteCount () const |
| Returns the number of allocated sprites. | |
| SpriteRenderer () | |
| Constructor. | |
| SpriteVector & | sprites () |
| Return the vector containing the sprites. | |
| void | uploadData () |
| float | velocityScale () const |
| Velocity scaling factor is used to stretch the particles along the velocity vector during rendering. More... | |
| ~SpriteRenderer () | |
| Destructor. | |
This class implements a simple particle system.
This class can be used to draw a great number of sprites on the screen. It relies on geometry, vertex, and pixels shaders to to increase its performance. Consequently it may not run on outdated or very low-end hardware.
The maximum number of particles depends on the hardware, and the particle update logic. Typically the limiting factor is the CPU-based calculation of the particle parameters.
| const BlendMode& Luminous::SpriteRenderer::blendMode | ( | ) | const |
Blend mode used during rendering.
| void Luminous::SpriteRenderer::createFuzzyTexture | ( | int | dim, |
| float | centerDotSize = 0.25f, |
||
| float | haloweight = 0.75f, |
||
| float | halodescent = 1.0f |
||
| ) |
Create a blurry texture Creates a basic square texture with radial gradient pattern.
| dim | texture dimensions |
| centerDotSize | size of the opaque center dot |
| haloweight | weighting factor for the radial gradient |
| halodescent | factor for how fast the gradient drops to zero |
| void Luminous::SpriteRenderer::setBlendMode | ( | const Luminous::BlendMode & | mode | ) |
Set the blend mode used for rendering the particles.
| mode | blend mode |
| void Luminous::SpriteRenderer::setVelocityScale | ( | float | velscale | ) |
| float Luminous::SpriteRenderer::velocityScale | ( | ) | const |
Velocity scaling factor is used to stretch the particles along the velocity vector during rendering.
Set to zero to disable stretching. Default value is zero.