vkmEngine 1.0.0
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
particle_emitter.h
1#pragma once
2
3#include <cstdint>
4
5#include <glm/glm.hpp>
6
7#include "core/reflect.h"
8
9namespace Vkm::Engine {
10
19 bool emitting = true;
20 float rate = 30.0f;
21 float lifetime = 1.5f;
22 uint32_t maxParticles = 256;
23
24 glm::vec3 velocity{0.0f, 2.0f, 0.0f};
25 float spread = 1.0f;
26 glm::vec3 acceleration{0.0f, -2.0f, 0.0f};
27
28 // Lerped start -> end over each particle's life
29 glm::vec4 startColor{1.0f, 0.8f, 0.4f, 1.0f};
30 glm::vec4 endColor{1.0f, 0.2f, 0.0f, 0.0f};
31 float startSize = 0.25f;
32 float endSize = 0.02f;
33 float softness = 1.0f;
34 bool additive = true;
35};
36
37} // namespace Vkm::Engine
38
39VKM_REFLECT_BEGIN(::Vkm::Engine::ParticleEmitter)
40 VKM_F(emitting)
41 VKM_F(rate)
42 VKM_F(lifetime)
43 VKM_F(maxParticles)
44 VKM_F(velocity)
45 VKM_F(spread)
46 VKM_F(acceleration)
47 VKM_F(startColor)
48 VKM_F(endColor)
49 VKM_F(startSize)
50 VKM_F(endSize)
51 VKM_F(softness)
52 VKM_F(additive)
53VKM_REFLECT_END()
CPU-simulated particle emitter - muzzle flashes, impacts, smoke puffs.
Definition particle_emitter.h:18
float softness
1 = soft blob, 0 = hard disc.
Definition particle_emitter.h:33
bool additive
Additive (sparks/fire) vs alpha (smoke).
Definition particle_emitter.h:34
float spread
Random velocity added per axis.
Definition particle_emitter.h:25
float rate
Per second.
Definition particle_emitter.h:20
float lifetime
Seconds.
Definition particle_emitter.h:21
glm::vec3 velocity
Initial, world space.
Definition particle_emitter.h:24
uint32_t maxParticles
Cap on live particles.
Definition particle_emitter.h:22