diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /apps/openmb/scene/GridSystem.hpp | |
Diffstat (limited to 'apps/openmb/scene/GridSystem.hpp')
| -rw-r--r-- | apps/openmb/scene/GridSystem.hpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/apps/openmb/scene/GridSystem.hpp b/apps/openmb/scene/GridSystem.hpp new file mode 100644 index 0000000..7fff5d2 --- /dev/null +++ b/apps/openmb/scene/GridSystem.hpp @@ -0,0 +1,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 |