aboutsummaryrefslogtreecommitdiff
path: root/apps/openmb/scene/GridSystem.hpp
blob: 7fff5d26ad6d17b7fbffc32c8c7875dc76b278e7 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef OPENMB_APPS_OPENMB_SCENE_GRIDSYSTEM_H
#define OPENMB_APPS_OPENMB_SCENE_GRIDSYSTEM_H

#include <glm/glm.hpp>

namespace scene {

class GridSystem {
  public:
    GridSystem();
    ~GridSystem() = default;

    float getCellSize() const;

    float getFloorY() const;

    int getGridWidth() const;

    int getGridDepth() const;

    int getWallHeight() const;

    glm::vec3 gridToWorld( int gridX, int gridZ, float y ) const;

    glm::vec3 gridToWorldFloor( int gridX, int gridZ ) const;

    bool worldToGrid( const glm::vec3& worldPos, int& outGridX, int& outGridZ ) const;

    glm::vec3 getCellCenter( int gridX, int gridZ, int cellY ) const;

    float getMinWorldX() const;

    float getMaxWorldX() const;

    float getMinWorldZ() const;

    float getMaxWorldZ() const;

    float getHalfWidth() const;

    float getHalfDepth() const;

    float getFrontWallZ() const;

    float getBackWallZ() const;

    float getLeftWallX() const;

    float getRightWallX() const;

    float getWallMinY() const;

    float getWallMaxY() const;

    float getWallBaseY() const;

  private:
    float mCellSize;
    float mFloorY;
    int   mGridWidth;
    int   mGridDepth;
    int   mWallHeight;
};
}   // namespace scene

#endif