aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system/ParticleSystem.h
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-11-18 14:08:36 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-11-18 14:08:36 +0100
commit20fc8401083e23e414feae2a9a4d217b228b8f15 (patch)
tree08c9e9c4ddcde5438eb54f6b051895c0896f935b /src/crepe/system/ParticleSystem.h
parent60669b60e63532bc264ecd6d106bd15f0688a5b6 (diff)
parent121b64b1cb6cfead5814070c8b0185d3d7308095 (diff)
Merge remote-tracking branch 'origin/master' into niels/rendering_color
Diffstat (limited to 'src/crepe/system/ParticleSystem.h')
-rw-r--r--src/crepe/system/ParticleSystem.h77
1 files changed, 43 insertions, 34 deletions
diff --git a/src/crepe/system/ParticleSystem.h b/src/crepe/system/ParticleSystem.h
index d7ca148..c647284 100644
--- a/src/crepe/system/ParticleSystem.h
+++ b/src/crepe/system/ParticleSystem.h
@@ -5,66 +5,75 @@
#include "System.h"
namespace crepe {
+
class ParticleEmitter;
class Transform;
+
/**
- * \brief ParticleSystem class responsible for managing particle emission, updates, and bounds checking.
- */
+ * \brief ParticleSystem class responsible for managing particle emission, updates, and bounds
+ * checking.
+ */
class ParticleSystem : public System {
public:
+ using System::System;
/**
- * \brief Updates all particle emitters by emitting particles, updating particle states, and checking bounds.
- */
+ * \brief Updates all particle emitters by emitting particles, updating particle states, and
+ * checking bounds.
+ */
void update() override;
private:
/**
- * \brief Emits a particle from the specified emitter based on its emission properties.
- *
- * \param emitter Reference to the ParticleEmitter.
- * \param transform Const reference to the Transform component associated with the emitter.
- */
+ * \brief Emits a particle from the specified emitter based on its emission properties.
+ *
+ * \param emitter Reference to the ParticleEmitter.
+ * \param transform Const reference to the Transform component associated with the emitter.
+ */
void emit_particle(ParticleEmitter & emitter, const Transform & transform);
/**
- * \brief Calculates the number of times particles should be emitted based on emission rate and update count.
- *
- * \param count Current update count.
- * \param emission Emission rate.
- * \return The number of particles to emit.
- */
+ * \brief Calculates the number of times particles should be emitted based on emission rate
+ * and update count.
+ *
+ * \param count Current update count.
+ * \param emission Emission rate.
+ * \return The number of particles to emit.
+ */
int calculate_update(int count, double emission) const;
/**
- * \brief Checks whether particles are within the emitter’s boundary, resets or stops particles if they exit.
- *
- * \param emitter Reference to the ParticleEmitter.
- * \param transform Const reference to the Transform component associated with the emitter.
- */
+ * \brief Checks whether particles are within the emitter’s boundary, resets or stops
+ * particles if they exit.
+ *
+ * \param emitter Reference to the ParticleEmitter.
+ * \param transform Const reference to the Transform component associated with the emitter.
+ */
void check_bounds(ParticleEmitter & emitter, const Transform & transform);
/**
- * \brief Generates a random angle for particle emission within the specified range.
- *
- * \param min_angle Minimum emission angle in degrees.
- * \param max_angle Maximum emission angle in degrees.
- * \return Random angle in degrees.
- */
+ * \brief Generates a random angle for particle emission within the specified range.
+ *
+ * \param min_angle Minimum emission angle in degrees.
+ * \param max_angle Maximum emission angle in degrees.
+ * \return Random angle in degrees.
+ */
double generate_random_angle(double min_angle, double max_angle) const;
/**
- * \brief Generates a random speed for particle emission within the specified range.
- *
- * \param min_speed Minimum emission speed.
- * \param max_speed Maximum emission speed.
- * \return Random speed.
- */
+ * \brief Generates a random speed for particle emission within the specified range.
+ *
+ * \param min_speed Minimum emission speed.
+ * \param max_speed Maximum emission speed.
+ * \return Random speed.
+ */
double generate_random_speed(double min_speed, double max_speed) const;
private:
- //! Counter to count updates to determine how many times emit_particle is called.
+ //! Counter to count updates to determine how many times emit_particle is
+ // called.
unsigned int update_count = 0;
- //! Determines the lowest amount of emission rate (1000 = 0.001 = 1 particle per 1000 updates).
+ //! Determines the lowest amount of emission rate (1000 = 0.001 = 1 particle per 1000
+ // updates).
static constexpr unsigned int MAX_UPDATE_COUNT = 100;
};