summary refs log tree commit diff
path: root/src/World/Clouds.hpp
blob: 7246e7beea3c18a033f7b8865350b759e3a0de17 (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
#pragma once

#include "../Time.hpp"
#include "../GFX/Actions.hpp"
#include "../GFX/Camera.hpp"
#include "../GFX/Mesh.hpp"

namespace MC::World {

class Clouds {
public:
    Clouds() : m_mesh(create_mesh(create_cloud_matrix())) {}

    void update(Time const& time);
    void render(GFX::Actions& actions, Position::World player_position);
private:
    constexpr static U32 CloudMatrixSize = 128;
    constexpr static Int Height = 200;
    constexpr static Real Scale = 15;
    constexpr static Real TileSize = CloudMatrixSize * Scale;

    using CloudMatrix = Matrix<CloudMatrixSize, CloudMatrixSize, Bool>;

    void render_single_instance(GFX::Actions& actions, Int x, Int y);

    static CloudMatrix create_cloud_matrix();
    static GFX::Mesh create_mesh(CloudMatrix const& cloud_matrix);

    Real m_x_offset = 0.0;
    GFX::Mesh m_mesh;
};

}