From 2f8d7643d03f39fa848576692264d0fe3a37ed91 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 6 Nov 2023 20:48:33 +0000 Subject: Reformat with new clang-format --- game/geoData.h | 1 + 1 file changed, 1 insertion(+) (limited to 'game/geoData.h') diff --git a/game/geoData.h b/game/geoData.h index f433a5c..f9a7d7b 100644 --- a/game/geoData.h +++ b/game/geoData.h @@ -15,6 +15,7 @@ public: struct Node { float height {-1.5F}; }; + using Quad = std::array; using Limits = std::pair; -- cgit v1.2.3 From d6e99a696aa582b81018078b68f6600c8030d643 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 7 Nov 2023 02:51:42 +0000 Subject: WIP typedefing all the things - headers --- game/geoData.h | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'game/geoData.h') diff --git a/game/geoData.h b/game/geoData.h index f9a7d7b..b3ec51d 100644 --- a/game/geoData.h +++ b/game/geoData.h @@ -1,5 +1,6 @@ #pragma once +#include "config/types.h" #include #include #include @@ -16,47 +17,47 @@ public: float height {-1.5F}; }; - using Quad = std::array; + using Quad = std::array; - using Limits = std::pair; + using Limits = std::pair, glm::vec<2, int>>; explicit GeoData(Limits limit, float scale = 10.F); void generateRandom(); void loadFromImages(const std::filesystem::path &, float scale); - [[nodiscard]] glm::vec3 positionAt(glm::vec2) const; - [[nodiscard]] std::optional intersectRay(const Ray &) const; + [[nodiscard]] Position3D positionAt(Position2D) const; + [[nodiscard]] std::optional intersectRay(const Ray &) const; - [[nodiscard]] unsigned int at(glm::ivec2) const; + [[nodiscard]] unsigned int at(glm::vec<2, int>) const; [[nodiscard]] unsigned int at(int x, int y) const; - [[nodiscard]] Quad quad(glm::vec2) const; + [[nodiscard]] Quad quad(Position2D) const; [[nodiscard]] Limits getLimit() const; - [[nodiscard]] glm::uvec2 getSize() const; + [[nodiscard]] glm::vec<2, unsigned int> getSize() const; [[nodiscard]] float getScale() const; [[nodiscard]] std::span getNodes() const; class RayTracer { public: - RayTracer(glm::vec2 p0, glm::vec2 p1); + RayTracer(Position2D p0, Position2D p1); - glm::vec2 next(); + Position2D next(); private: - RayTracer(glm::vec2 p0, glm::vec2 p1, glm::vec2 d); - RayTracer(glm::vec2 p0, glm::vec2 d, std::pair, std::pair); - static std::pair byAxis(glm::vec2 p0, glm::vec2 p1, glm::vec2 d, glm::length_t); + RayTracer(Position2D p0, Position2D p1, Position2D d); + RayTracer(Position2D p0, Position2D d, std::pair, std::pair); + static std::pair byAxis(Position2D p0, Position2D p1, Position2D d, glm::length_t); - glm::vec2 p; - const glm::vec2 d; + Position2D p; + const Position2D d; float error; - glm::vec2 inc; + Position2D inc; }; protected: Limits limit {}; // Base grid limits first(x,y) -> second(x,y) - glm::uvec2 size {}; + glm::vec<2, unsigned> size {}; float scale {1}; std::vector nodes; }; -- cgit v1.2.3 From 685b33980cc7a346574b24732464f0cbe3115a1f Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 15 Nov 2023 01:29:24 +0000 Subject: Switch to millimeters for spatial units Mostly a case of changing far too many magic numbers, something else to fix I guess. I probably missed something. Also there's some hackery when loading 3D models, which are still assumed to be in metres. --- game/geoData.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'game/geoData.h') diff --git a/game/geoData.h b/game/geoData.h index b3ec51d..3bceb9c 100644 --- a/game/geoData.h +++ b/game/geoData.h @@ -14,7 +14,7 @@ class Ray; class GeoData { public: struct Node { - float height {-1.5F}; + float height {-1500.F}; }; using Quad = std::array; -- cgit v1.2.3