diff options
| author | Mel <einebeere@gmail.com> | 2023-07-11 04:52:24 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2023-07-11 04:52:24 +0200 |
| commit | 0ce26f2a49fd6d64a690b84b1932126edfbfbee6 (patch) | |
| tree | f0846f7f0e394d3c213986a2f85e0240dc8e5402 /src/World/Clouds.hpp | |
| parent | e6812d2df6bd8a0a71375096abe46f8039d8c570 (diff) | |
| download | meowcraft-0ce26f2a49fd6d64a690b84b1932126edfbfbee6.tar.zst meowcraft-0ce26f2a49fd6d64a690b84b1932126edfbfbee6.zip | |
Add simple scrolling non-tiling 2D clouds
Diffstat (limited to 'src/World/Clouds.hpp')
| -rw-r--r-- | src/World/Clouds.hpp | 36 |
1 files changed, 36 insertions, 0 deletions
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<CloudMatrixSize, CloudMatrixSize, Bool>; + + 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; +}; + +} |
