summaryrefslogtreecommitdiffstats
path: root/game/shared/world/chunk_aabb.hh
blob: bd4a0c5ee2eb682f3de4a3da3bce1d0eac837867 (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
#ifndef SHARED_CHUNK_AABB
#define SHARED_CHUNK_AABB 1
#pragma once

#include "shared/types.hh"

namespace world
{
class ChunkAABB final {
public:
    ChunkAABB(void) = default;
    virtual ~ChunkAABB(void) = default;

    void set_bounds(const chunk_pos& min, const chunk_pos& max);
    void set_offset(const chunk_pos& base, const chunk_pos& size);

    const chunk_pos& get_min(void) const;
    const chunk_pos& get_max(void) const;

    bool contains(const chunk_pos& point) const;
    bool intersect(const ChunkAABB& other_box) const;

    ChunkAABB combine_with(const ChunkAABB& other_box) const;
    ChunkAABB multiply_with(const ChunkAABB& other_box) const;
    ChunkAABB push(const chunk_pos& vector) const;

public:
    chunk_pos min;
    chunk_pos max;
};
} // namespace world

#endif // SHARED_CHUNK_AABB