summaryrefslogtreecommitdiff
path: root/themes/src/Snowflake.h
diff options
context:
space:
mode:
authormattkae <mattkae@protonmail.com>2022-12-23 12:47:10 -0500
committermattkae <mattkae@protonmail.com>2022-12-23 12:47:10 -0500
commit7228b2e1a2d0a8399facce3493d71a3569d250d5 (patch)
tree8eb5e4b686bf68fa12fcbb270ef88dd29aa1d704 /themes/src/Snowflake.h
parentf63d0af456f76d713e56ca17be114fba0af22f6c (diff)
Improved the makefile considerably
Diffstat (limited to 'themes/src/Snowflake.h')
-rw-r--r--themes/src/Snowflake.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/themes/src/Snowflake.h b/themes/src/Snowflake.h
new file mode 100644
index 0000000..c6323d6
--- /dev/null
+++ b/themes/src/Snowflake.h
@@ -0,0 +1,47 @@
+#include "types.h"
+#include "mathlib.h"
+#include "list.h"
+
+struct Renderer2d;
+struct Vertex2D;
+
+struct SnowflakeLoadParameters {
+ i32 numSnowflakes = 1000;
+ f32 rateOfSnowfall = 0.1f;
+ Vector2 flakeV0 = { 0, 1 };
+ f32 flakeSize = 5.f;
+ f32 flakeSizeDeviation = 1.f;
+ Vector4 snowColor = { 0.8, 0.8, 0.8, 1.0 };
+ f32 windIntervalSeconds = 1.5;
+};
+
+struct SnowflakeUpdateData {
+ Vector2 v0;
+ Vector2 velocity;
+ Vector2 position;
+ f32 rotation;
+ bool onGround = false;
+
+ i32 vtxIdx = 0;
+ i32 numVertices = 0;
+};
+
+struct SnowflakeParticleRenderer {
+ f32 xMax = 0;
+ f32 yMax = 0;
+ f32 windIntervalSeconds = 1.5;
+ i32 numSnowflakes = 0;
+ Vector2 windSpeed;
+ SnowflakeUpdateData* updateData;
+ f32 timeUntilNextWindSeconds = 0;
+
+ u32 vao;
+ u32 vbo;
+ Mat4x4 model;
+ matte::List<Vertex2D> vertices;
+
+ void load(SnowflakeLoadParameters params, Renderer2d* renderer);
+ void update(f32 dtSeconds);
+ void render(Renderer2d* renderer);
+ void unload();
+};