summaryrefslogtreecommitdiffhomepage
path: root/src/chunk-scenery.hpp
blob: 89e400788ed9aa98fbae5d6c5457e9d234558534 (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
37
38
39
40
41
42
43
44
#pragma once
#include "chunk.hpp"
#include <Corrade/Containers/Array.h>
#include <Magnum/Math/Vector2.h>

namespace floormat {

struct chunk::topo_sort_data
{
    enum m : uint8_t { mode_none, mode_static, mode_character,  };

    object* in = nullptr;
    Vector2i min, max, center;
    uint32_t in_mesh_idx;
    float slope = 0, ord;
    Vector2s bb_min = {}, bb_max = {};
    m mode : 2 = mode_none;
    uint8_t visited : 1 = false;

    bool intersects(const topo_sort_data& other) const;
};

struct chunk::object_draw_order
{
    object *e;
    uint32_t mesh_idx;
    float ord;
    topo_sort_data data;
};

struct chunk::scenery_mesh_tuple {
    GL::Mesh& mesh;
    ArrayView<object_draw_order> array;
    size_t size;
};

struct chunk::scenery_scratch_buffers
{
    Array<object_draw_order>& array;
    Array<std::array<vertex, 4>>& scenery_vertexes;
    Array<std::array<UnsignedShort, 6>>& scenery_indexes;
};

} // namespace floormat