Kemena3D
Loading...
Searching...
No Matches
kparticle.h
Go to the documentation of this file.
1
5
6#ifndef KPARTICLE_H
7#define KPARTICLE_H
8
9#include "kexport.h"
10#include "kdatatype.h"
11
12#include <vector>
13
14namespace kemena
15{
23 {
25 kString name = "Particle System";
26 bool isActive = true;
27 bool looping = true;
28
29 // Emitter
30 int maxParticles = 100;
31 float emissionRate = 10.0f;
32 float lifetime = 2.0f;
33 float gravityScale = 1.0f;
34
35 // Velocity
36 kVec3 startVelocity = kVec3(0.0f, 1.0f, 0.0f);
37 float startSpeed = 1.0f;
38 kVec3 velocityVariance = kVec3(0.1f, 0.1f, 0.1f);
39
40 // Visual
41 kVec4 colorStart = kVec4(1.0f, 1.0f, 1.0f, 1.0f);
42 kVec4 colorEnd = kVec4(1.0f, 1.0f, 1.0f, 0.0f);
43 float sizeStart = 0.1f;
44 float sizeEnd = 0.0f;
45 };
46
54 {
55 public:
57 kParticleManager() = default;
58
60 ~kParticleManager() = default;
61
66 void update(float dt);
67
72 void addEmitter(kParticle *particle);
73
78 void removeEmitter(const kString &uuid);
79
80 private:
81 std::vector<kParticle *> emitters;
82 };
83
84} // namespace kemena
85
86#endif // KPARTICLE_H
void removeEmitter(const kString &uuid)
Removes a particle descriptor from simulation by UUID.
kParticleManager()=default
Constructs an empty particle manager with no registered emitters.
void addEmitter(kParticle *particle)
Registers a particle descriptor for simulation.
void update(float dt)
Advances all active emitters by dt seconds.
~kParticleManager()=default
Destroys the manager; does not own the registered descriptors.
Core type aliases, enumerations, structs, and utility functions used throughout the engine.
Symbol visibility / linkage macro for the Kemena3D library.
#define KEMENA3D_API
Definition kexport.h:35
Top-level Kemena3D engine namespace.
Definition kanimation.h:23
std::string kString
Standard string alias.
Definition kdatatype.h:42
glm::vec4 kVec4
4-component float vector.
Definition kdatatype.h:34
glm::vec3 kVec3
3-component float vector.
Definition kdatatype.h:33
Data descriptor for a single particle system attached to a scene object.
Definition kparticle.h:23
float sizeStart
Particle size at birth.
Definition kparticle.h:43
kVec4 colorStart
Particle color (RGBA) at birth.
Definition kparticle.h:41
float gravityScale
Multiplier applied to gravity acting on particles.
Definition kparticle.h:33
float emissionRate
Particles spawned per second.
Definition kparticle.h:31
float lifetime
Each particle's lifespan in seconds.
Definition kparticle.h:32
kString uuid
Unique identifier for this particle system.
Definition kparticle.h:24
bool looping
Whether emission restarts after one cycle.
Definition kparticle.h:27
kVec3 velocityVariance
Per-axis random spread added to start velocity.
Definition kparticle.h:38
float startSpeed
Scalar speed applied to the start velocity.
Definition kparticle.h:37
int maxParticles
Maximum number of live particles at once.
Definition kparticle.h:30
bool isActive
Whether this system emits/simulates particles.
Definition kparticle.h:26
kVec4 colorEnd
Particle color (RGBA) at death.
Definition kparticle.h:42
kString name
Human-readable display name.
Definition kparticle.h:25
kVec3 startVelocity
Base initial velocity direction/magnitude.
Definition kparticle.h:36
float sizeEnd
Particle size at death.
Definition kparticle.h:44