diff options
| author | Matt Kosarek <matt.kosarek@canonical.com> | 2026-07-08 09:07:55 -0400 |
|---|---|---|
| committer | Matt Kosarek <matt.kosarek@canonical.com> | 2026-07-08 09:07:55 -0400 |
| commit | c8938fe29132a11126013ed1b010c3092f5645e4 (patch) | |
| tree | f6a6cd0603f25d51c08e302cc4342c28f9e10806 /themes/src/summer/sky_model.h | |
| parent | 418396ee5100eda8f6bc036ea35dbbe44db2f91a (diff) | |
feature: improved summer scene
Diffstat (limited to 'themes/src/summer/sky_model.h')
| -rw-r--r-- | themes/src/summer/sky_model.h | 43 |
1 files changed, 43 insertions, 0 deletions
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 |
