Class doing particle as well as their spawners handling. More...
#include <particles.h>
Public Member Functions | |
ParticleManager (ClientEnvironment *env) | |
~ParticleManager () | |
void | step (float dtime) |
void | handleParticleEvent (ClientEvent *event, Client *client, LocalPlayer *player) |
void | addDiggingParticles (IGameDef *gamedef, LocalPlayer *player, v3s16 pos, const MapNode &n, const ContentFeatures &f) |
void | addNodeParticle (IGameDef *gamedef, LocalPlayer *player, v3s16 pos, const MapNode &n, const ContentFeatures &f) |
u64 | generateSpawnerId () |
This function is only used by client particle spawners. More... | |
Protected Member Functions | |
void | addParticle (Particle *toadd) |
Static Protected Member Functions | |
static bool | getNodeParticleParams (const MapNode &n, const ContentFeatures &f, ParticleParameters &p, video::ITexture **texture, v2f &texpos, v2f &texsize, video::SColor *color, u8 tilenum=0) |
Private Member Functions | |
void | addParticleSpawner (u64 id, ParticleSpawner *toadd) |
void | deleteParticleSpawner (u64 id) |
void | stepParticles (float dtime) |
void | stepSpawners (float dtime) |
void | clearAll () |
Private Attributes | |
std::vector< Particle * > | m_particles |
std::unordered_map< u64, ParticleSpawner * > | m_particle_spawners |
u64 | m_next_particle_spawner_id = U32_MAX + 1 |
ClientEnvironment * | m_env |
std::mutex | m_particle_list_lock |
std::mutex | m_spawner_list_lock |
Friends | |
class | ParticleSpawner |
Class doing particle as well as their spawners handling.
ParticleManager::ParticleManager | ( | ClientEnvironment * | env | ) |
ParticleManager::~ParticleManager | ( | ) |
void ParticleManager::addDiggingParticles | ( | IGameDef * | gamedef, |
LocalPlayer * | player, | ||
v3s16 | pos, | ||
const MapNode & | n, | ||
const ContentFeatures & | f | ||
) |
References addNodeParticle(), ContentFeatures::drawtype, and NDT_AIRLIKE.
void ParticleManager::addNodeParticle | ( | IGameDef * | gamedef, |
LocalPlayer * | player, | ||
v3s16 | pos, | ||
const MapNode & | n, | ||
const ContentFeatures & | f | ||
) |
References addParticle(), BS, getNodeParticleParams(), m_env, Player::movement_gravity, p(), and LocalPlayer::physics_override_gravity.
Referenced by addDiggingParticles().
|
protected |
References m_particle_list_lock, and m_particles.
Referenced by addNodeParticle(), handleParticleEvent(), and ParticleSpawner::spawnParticle().
|
private |
References m_particle_spawners, and m_spawner_list_lock.
Referenced by handleParticleEvent().
|
private |
References m_particle_list_lock, m_particle_spawners, m_particles, and m_spawner_list_lock.
Referenced by ~ParticleManager().
|
private |
References m_particle_spawners, and m_spawner_list_lock.
Referenced by handleParticleEvent().
|
inline |
This function is only used by client particle spawners.
We don't need to check the particle spawner list because client ID will never overlap (u64)
References m_next_particle_spawner_id.
Referenced by ModApiParticlesLocal::l_add_particlespawner().
|
staticprotected |
References BS, TileLayer::color, ContentFeatures::drawtype, TileLayer::frames, MapNode::getColor(), TileLayer::has_color, TileSpec::layers, MATERIAL_FLAG_ANIMATION, TileLayer::material_flags, NDT_AIRLIKE, p(), TileLayer::scale, TAT_NONE, TileLayer::texture, and ContentFeatures::tiles.
Referenced by addNodeParticle(), handleParticleEvent(), and ParticleSpawner::spawnParticle().
void ParticleManager::handleParticleEvent | ( | ClientEvent * | event, |
Client * | client, | ||
LocalPlayer * | player | ||
) |
References ClientEvent::add_particlespawner, addParticle(), addParticleSpawner(), CE_ADD_PARTICLESPAWNER, CE_DELETE_PARTICLESPAWNER, CE_SPAWN_PARTICLE, CONTENT_IGNORE, ClientEvent::delete_particlespawner, deleteParticleSpawner(), NodeDefManager::get(), ClientEnvironment::getGameDef(), getNodeParticleParams(), m_env, IGameDef::ndef(), p(), ParticleSpawner, and ClientEvent::type.
void ParticleManager::step | ( | float | dtime | ) |
|
private |
References m_particle_list_lock, and m_particles.
Referenced by step().
|
private |
References m_env, m_particle_spawners, and m_spawner_list_lock.
Referenced by step().
|
friend |
Referenced by handleParticleEvent().
|
private |
Referenced by addNodeParticle(), handleParticleEvent(), ParticleSpawner::spawnParticle(), and stepSpawners().
|
private |
Referenced by generateSpawnerId().
|
private |
Referenced by addParticle(), clearAll(), and stepParticles().
|
private |
Referenced by addParticleSpawner(), clearAll(), deleteParticleSpawner(), and stepSpawners().
|
private |
Referenced by addParticle(), clearAll(), and stepParticles().
|
private |
Referenced by addParticleSpawner(), clearAll(), deleteParticleSpawner(), and stepSpawners().