From 0ce26f2a49fd6d64a690b84b1932126edfbfbee6 Mon Sep 17 00:00:00 2001 From: Mel Date: Tue, 11 Jul 2023 04:52:24 +0200 Subject: Add simple scrolling non-tiling 2D clouds --- src/World/Clouds.hpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/World/Clouds.hpp (limited to 'src/World/Clouds.hpp') diff --git a/src/World/Clouds.hpp b/src/World/Clouds.hpp new file mode 100644 index 0000000..6a91901 --- /dev/null +++ b/src/World/Clouds.hpp @@ -0,0 +1,36 @@ +#pragma once + +#include "../GFX/Binder.hpp" +#include "../GFX/Shading/Program.hpp" +#include "../GFX/Shading/Uniform.hpp" +#include "../GFX/Camera.hpp" + +namespace MC::World { + +class Clouds { +public: + Clouds(Real ascept, Real fov, Real near, Real far, Vector<3, F32> sky_color); + + void update(U64 time); + void render(const GFX::Camera& camera) const; +private: + constexpr static U32 CloudMatrixSize = 128; + using CloudMatrix = Matrix; + + static CloudMatrix create_cloud_matrix(); + static GFX::Mesh create_mesh(const CloudMatrix& cloud_matrix); + + static const Char* vertex; + static const Char* fragment; + + Vector<3> m_position; + + GFX::Shading::Program m_program; + GFX::BindableMesh m_mesh; + + GFX::Shading::Uniform m_model_uniform; + GFX::Shading::Uniform m_view_uniform; + GFX::Shading::Uniform m_projection_uniform; +}; + +} -- cgit 1.4.1