group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
DeathDissolveEffect.hpp
Go to the documentation of this file.
1
4
5#pragma once
6
8
9#include <cstdint>
10#include <glm/glm.hpp>
11#include <vector>
12
23{
24public:
29 void spawn(const std::vector<glm::vec3>& worldPoints, glm::vec3 center, glm::vec4 baseColor);
30
32 void update(float dt);
33
35 [[nodiscard]] const BillboardParticle* data() const { return gpu_.data(); }
36 [[nodiscard]] uint32_t count() const { return static_cast<uint32_t>(gpu_.size()); }
37
38private:
40 struct Particle
41 {
42 glm::vec3 basePos;
43 glm::vec3 vel;
44 glm::vec4 color;
45 float size = 1.5f;
46 float delay = 0.0f;
47 float age = 0.0f;
48 float fly = 1.5f;
49 };
50
51 static constexpr uint32_t k_maxParticles = 30000;
52
53 std::vector<Particle> particles_;
54 std::vector<BillboardParticle> gpu_;
55};
GPU-uploadable particle structs for all effect categories.
One-shot disintegration effect spawned from a character's skinned mesh at the moment of death.
Definition DeathDissolveEffect.hpp:23
const BillboardParticle * data() const
Live particle data for upload (rebuilt each update).
Definition DeathDissolveEffect.hpp:35
uint32_t count() const
Definition DeathDissolveEffect.hpp:36
void update(float dt)
Advance the simulation and rebuild the GPU billboard array.
Definition DeathDissolveEffect.cpp:78
void spawn(const std::vector< glm::vec3 > &worldPoints, glm::vec3 center, glm::vec4 baseColor)
Spawn a dissolve from posed mesh points.
Definition DeathDissolveEffect.cpp:29
std::vector< Particle > particles_
Definition DeathDissolveEffect.hpp:53
static constexpr uint32_t k_maxParticles
Definition DeathDissolveEffect.hpp:51
std::vector< BillboardParticle > gpu_
Rebuilt every frame for upload.
Definition DeathDissolveEffect.hpp:54
Single billboard particle (sparks, impact flash, shockwave ring).
Definition ParticleTypes.hpp:21
Full CPU simulation state for one dissolve particle.
Definition DeathDissolveEffect.hpp:41
glm::vec3 basePos
Resting (pre-dissolve) world position.
Definition DeathDissolveEffect.hpp:42
glm::vec3 vel
Drift velocity once active.
Definition DeathDissolveEffect.hpp:43
float age
Seconds since spawn.
Definition DeathDissolveEffect.hpp:47
glm::vec4 color
Base tint (alpha is faded per frame).
Definition DeathDissolveEffect.hpp:44
float fly
Drift+fade duration after the delay.
Definition DeathDissolveEffect.hpp:48
float delay
Seconds to hold at basePos before drifting.
Definition DeathDissolveEffect.hpp:46
float size
Billboard half-extent (world units).
Definition DeathDissolveEffect.hpp:45