From c8938fe29132a11126013ed1b010c3092f5645e4 Mon Sep 17 00:00:00 2001 From: Matt Kosarek Date: Wed, 8 Jul 2026 09:07:55 -0400 Subject: feature: improved summer scene --- themes/src/summer/sky_model.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 themes/src/summer/sky_model.h (limited to 'themes/src/summer/sky_model.h') diff --git a/themes/src/summer/sky_model.h b/themes/src/summer/sky_model.h new file mode 100644 index 0000000..d957f05 --- /dev/null +++ b/themes/src/summer/sky_model.h @@ -0,0 +1,43 @@ +#ifndef SKY_MODEL_H +#define SKY_MODEL_H + +#include "../shader.h" +#include "../types.h" + +struct WebglContext; + +/// A full-screen sky background. Renders a mid-afternoon gradient (from the +/// water horizon up to the top of the screen) and sparse, wispy procedural +/// clouds that shrink toward the horizon. Standalone: owns its own shader and +/// a two-triangle full-screen quad, drawn before the sun and water. +class SkyModel { +public: + SkyModel(); + ~SkyModel(); + + void load(WebglContext* context); + void update(f32 dtSeconds); + void render(); + void unload(); + + /// Screen-space y (0..1) of the water horizon, where the gradient starts. + f32 horizon = 0.5f; + +private: + WebglContext* context = nullptr; + Shader shader = 0; + u32 vao = 0; + u32 vbo = 0; + f32 elapsedTime = 0.f; + + struct { + i32 position = -1; + } attributes; + + struct { + i32 time = -1; + i32 horizon = -1; + } uniforms; +}; + +#endif // SKY_MODEL_H -- cgit v1.2.1