56 auto update(
float dt) -> void;
68 [[nodiscard]]
auto getName()
const -> std::string;
75 std::string
name =
"Emitter";
77 std::shared_ptr<ParticleBlock>
block;
nlohmann::json json
Definition Json.cpp:19
A container for holding and updating particles that are all the same type.
Creates Particles, based on initial conditions set in the editor, with potential randomness.
auto operator=(const ParticleEmitter &other) -> ParticleEmitter &
Definition ParticleEmitter.cpp:66
std::shared_ptr< ParticleBlock > block
where the particles generated by the emitter are stored. this block is also referenced by sys::Partic...
Definition ParticleEmitter.h:77
auto setParentTransform(const AffineMatrix &affineMatrix, Vector4D scale, float rot) -> void
set the transforms for the parent Entity, so that Particles will be generated at the right scale and ...
Definition ParticleEmitter.cpp:98
ParticleEmitter()
Definition ParticleEmitter.cpp:32
friend auto to_json(json &j, const ParticleEmitter &n) -> void
Definition ParticleEmitter.cpp:170
float parentRot
parent rotation, as last set by setParentTransform
Definition ParticleEmitter.h:86
std::unique_ptr< ParticleSpawner > spawner
the ParticleSpawner is what actually creates the particles
Definition ParticleEmitter.h:79
auto reset() -> void
resets the timer on the emitter, so that particles will be emitted next time it updates
Definition ParticleEmitter.cpp:150
~ParticleEmitter()
Definition ParticleEmitter.cpp:38
friend auto from_json(const json &j, ParticleEmitter &n) -> void
Definition ParticleEmitter.cpp:179
AffineMatrix parentTransform
parent transform, as last set by setParentTransform
Definition ParticleEmitter.h:82
float timeToNextSpawn
how long until particles will spawn next
Definition ParticleEmitter.h:90
float spawnsPerSecond
how often particles should spawn
Definition ParticleEmitter.h:88
Vector4D parentScale
parent scale, as last set by setParentTransform
Definition ParticleEmitter.h:84
std::string name
The name of the emitter, for ease of reference in editor.
Definition ParticleEmitter.h:75
auto registerWithParticles() const -> void
registers the ParticleEmitter with sys::ParticleManager, so that the particles can be updated
Definition ParticleEmitter.cpp:27
auto getTimeBetweenSpawns() const -> float
helper function for calculating time between spawns, based on how many spawnsPerSecond
Definition ParticleEmitter.cpp:160
auto update(float dt) -> void
runs update for the emitter, the emitter will automatically count down to decide when to emit particl...
Definition ParticleEmitter.cpp:106
auto showMenu() -> void
Draw the ImGui menu for the Emitter, has controls for what types of particles are emitted,...
Definition ParticleEmitter.cpp:124
auto getName() const -> std::string
Definition ParticleEmitter.cpp:155
Definition AffineMatrix.h:30