diff options
| author | Matt Kosarek <matt.kosarek@canonical.com> | 2025-12-29 09:34:00 -0500 |
|---|---|---|
| committer | Matt Kosarek <matt.kosarek@canonical.com> | 2025-12-29 09:34:00 -0500 |
| commit | bf4b3a5c35152c1292757134123b3363d0f81bf6 (patch) | |
| tree | 7796e03d309c43115596f78d553a74f911f82218 /themes/src/autumn/leaf_particle_render.h | |
| parent | 25c93a0ab9c855f75ee48df635fb5422c8eaba95 (diff) | |
Renamed PascalCase files to snake_case
Diffstat (limited to 'themes/src/autumn/leaf_particle_render.h')
| -rw-r--r-- | themes/src/autumn/leaf_particle_render.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/themes/src/autumn/leaf_particle_render.h b/themes/src/autumn/leaf_particle_render.h new file mode 100644 index 0000000..1209e1b --- /dev/null +++ b/themes/src/autumn/leaf_particle_render.h @@ -0,0 +1,58 @@ +#include "../renderer_2d.h" +#include "../mathlib.h" +#include "../types.h" + +struct TreeShapeLoadResult; + +struct LeafParticleLoadData { + Vector2 initPosition; + Vector4 initColor; + int numLeaves = 48; +}; + +enum LeafParticleState { + OnTree, + Falling, + OnGround, + Remerging +}; + +struct LeafParticleUpdateData { + LeafParticleState state = LeafParticleState::Remerging; + + Vertex2D* vertexToFollow = NULL; + Vector4 color = Vector4(1.f, 0.f, 0.f, 0.f); + f32 scale = 1.f; + + f32 timeElapsedSeconds = 0.f; + i32 fallChance = -1; + Vector2 fallPosition; + f32 fallVerticalVelocity; + f32 fallHorizontalFrequency; + + f32 resetTime = 0.f; + + Vertex2D* vertexPtr = NULL; +}; + +struct LeafParticleRender { + f32 elapsedTimeSeconds = 0.5; + f32 fallIntervalSeconds = 1.f; + + // Update data + i32 numLeaves = 0; + + LeafParticleUpdateData* updateData = NULL; + Vertex2D* vertices = NULL; + + // Render data + u32 vao; + u32 vbo; + u32 numVertices = 0; + Mat4x4 model; + + void load(Renderer2d* renderer, TreeShapeLoadResult* lr); + void update(f32 dtSeconds); + void render(Renderer2d* renderer); + void unload(); +};
\ No newline at end of file |
