summary refs log tree commit diff
path: root/src/World/Clouds.hpp
blob: 6a919015f1deac7a9c07be3fd95d438c440467c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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;
};

}