56 auto update(
float dt) -> void;
78 [[nodiscard]]
auto getName()
const -> std::string;
90 std::string
name =
"Emitter";
92 std::shared_ptr<ParticleBlock>
block;
sys::Json Stream
Definition AudioObject.h:20
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:72
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:92
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:104
ParticleEmitter()
Definition ParticleEmitter.cpp:33
friend auto to_json(json &j, const ParticleEmitter &n) -> void
Definition ParticleEmitter.cpp:305
float parentRot
parent rotation, as last set by setParentTransform
Definition ParticleEmitter.h:101
auto setParticleSpawnerEndColor(const Vector4D &vec) -> void
Definition ParticleEmitter.cpp:270
std::unique_ptr< ParticleSpawner > spawner
the ParticleSpawner is what actually creates the particles
Definition ParticleEmitter.h:94
auto reset() -> void
resets the timer on the emitter, so that particles will be emitted next time it updates
Definition ParticleEmitter.cpp:250
~ParticleEmitter()
Definition ParticleEmitter.cpp:39
friend auto from_json(const json &j, ParticleEmitter &n) -> void
Definition ParticleEmitter.cpp:315
AffineMatrix parentTransform
parent transform, as last set by setParentTransform
Definition ParticleEmitter.h:97
float timeToNextSpawn
how long until particles will spawn next
Definition ParticleEmitter.h:105
auto destroyed() -> bool
check if the emitter was deleted via the ImGui Menu
Definition ParticleEmitter.cpp:255
float spawnsPerSecond
how often particles should spawn
Definition ParticleEmitter.h:103
auto setName(const std::string &setName) -> void
Definition ParticleEmitter.cpp:280
auto save(Stream &stream) const -> void
Definition ParticleEmitter.cpp:285
auto setParticleSpawnerColor(const Vector4D &vec) -> void
Definition ParticleEmitter.cpp:265
auto load(const Stream &stream) -> void
Definition ParticleEmitter.cpp:290
Vector4D parentScale
parent scale, as last set by setParentTransform
Definition ParticleEmitter.h:99
std::string name
The name of the emitter, for ease of reference in editor.
Definition ParticleEmitter.h:90
auto registerWithParticles() const -> void
registers the ParticleEmitter with sys::ParticleManager, so that the particles can be updated
Definition ParticleEmitter.cpp:28
auto getTimeBetweenSpawns() const -> float
helper function for calculating time between spawns, based on how many spawnsPerSecond
Definition ParticleEmitter.cpp:295
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:112
bool isDestroyed
if the particleEmitter should be removed because it was deleted in the menu
Definition ParticleEmitter.h:108
auto destroy() -> void
Definition ParticleEmitter.cpp:260
auto showMenu() -> void
Draw the ImGui menu for the Emitter, has controls for what types of particles are emitted,...
Definition ParticleEmitter.cpp:130
auto getName() const -> std::string
Definition ParticleEmitter.cpp:275
Definition AffineMatrix.h:30