|
Lamp-Da 0.1
A compact lantern project
|
Define a particle system ALL PARTICLE SYSTEM SHARE THE SAME PARTICLE SUBSET. More...
#include <particle_system.hpp>
Public Member Functions | |
| ParticleSystem (const ParticleSystem &)=delete | |
| void | reset () |
| reset system to zero count | |
| void | set_max_particle_count (const uint16_t _particleCount) |
| Call when you want to change the particle count of the simulation Can be called once when starting the particle system. | |
| template<typename PositionGeneratorFunction > | |
| void | init_particules (const PositionGeneratorFunction &positionGeneratorFunction, const uint32_t color=colors::HTMLColorCode::White) |
| Init the particles from a initialization function. | |
| template<typename PositionGeneratorFunction > | |
| bool | init_deferred_particules (uint8_t maxParticlesToPop, const PositionGeneratorFunction &positionGeneratorFunction) |
| Init the particles from a initialization function, in a timed defered way. | |
| template<typename PositionGeneratorFunction , typename ColorGeneratorFunction > | |
| bool | init_deferred_particules (uint8_t maxParticlesToPop, const PositionGeneratorFunction &positionGeneratorFunction, const ColorGeneratorFunction &colorGeneratorFunction) |
| Init the particles from a initialization function, in a timed defered way. | |
| void | iterate_no_collisions (const utils::vec3d &accelerationCartesian, const float deltaTime_s, const bool shouldContrain=true) |
| Advance the particle simulation, ignoring collisions. | |
| void | iterate_with_collisions (const utils::vec3d &accelerationCartesian, const float deltaTime_s, const bool shouldContrain=true, const float viscosity=sandViscosity) |
| Advance the particle simulation, taking collisions in account. A led holds one particle, and a blocked particle flows around the obstacle. Resting particles update less often. | |
| template<typename ShouldDepopFunction > | |
| uint16_t | depop_particules (const ShouldDepopFunction &shouldDepopFunction) |
| Filter particles depending on condition. | |
| template<typename ShouldDepopFunction > | |
| uint16_t | depop_particules_indexed (const ShouldDepopFunction &shouldDepopFunction) |
| Same as depop_particules, but the predicate also receives the particle slot index. | |
| template<typename SampleColorFunction > | |
| uint16_t | show (const SampleColorFunction &sample_color, LampTy &lamp, const bool forceDisplay=false) const |
| Display this particle system. | |
| uint16_t | show (LampTy &lamp, const bool forceDisplay=false) const |
| uint16_t | get_number_of_active () const |
| Return the number of active particles. | |
Protected Member Functions | |
| bool | is_position_taken (const int16_t pos) const |
| Return True if the position is already occupied. | |
| template<typename PositiongeneratorFunction > | |
| void | spawn_particule (const size_t index, const PositiongeneratorFunction &positionGeneratorFunction, const uint32_t color) |
| Spawn a particle. | |
Define a particle system ALL PARTICLE SYSTEM SHARE THE SAME PARTICLE SUBSET.
|
inline |
Filter particles depending on condition.
| [in] | shouldDepopFunction | A function, that given a particle, will return true if it needs to be removed from the simulation. |
|
inline |
Same as depop_particules, but the predicate also receives the particle slot index.
|
inline |
Init the particles from a initialization function, in a timed defered way.
| [in] | maxParticlesToPop | Maximum particles to spawn at this call |
| [in] | positionGeneratorFunction | Function that takes an index and return a led strip index |
|
inline |
Init the particles from a initialization function, in a timed defered way.
| [in] | maxParticlesToPop | Maximum particles to spawn at this call |
| [in] | positionGeneratorFunction | Function that takes an index and return a led strip index |
| [in] | colorGeneratorFunction | Function that takes an index and return a color of the particle at this index |
|
inline |
Init the particles from a initialization function.
| [in] | positionGeneratorFunction | Function that takes an index and return a ledstrip index |
|
inline |
Advance the particle simulation, ignoring collisions.
| [in] | accelerationCartesian | 3d acceleration vector to apply to particles |
| [in] | deltaTime_s | Time since last update, in seconds |
| [in] | shouldContrain | If true, will constrain the particles to the lamp body. |
|
inline |
Advance the particle simulation, taking collisions in account. A led holds one particle, and a blocked particle flows around the obstacle. Resting particles update less often.
| [in] | accelerationCartesian | 3d acceleration vector to apply to particles |
| [in] | deltaTime_s | Time since last update, in seconds |
| [in] | shouldContrain | If true, will constrain the particles to the lamp body. |
| [in] | viscosity | From 0 (liquid, levels itself) to 1 (sand, forms piles) |
|
inline |
Display this particle system.
| [in] | sample_color | sampling function for the particle color |
| [in,out] | lamp | The lamp object to write to |
|
inlineprotected |
Spawn a particle.
| [in] | index | Index of this particle |
| [in] | positionGeneratorFunction | Spawn function |