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.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'game/geoData.cpp') diff --git a/game/geoData.cpp b/game/geoData.cpp index 34a1030..76550cc 100644 --- a/game/geoData.cpp +++ b/game/geoData.cpp @@ -100,6 +100,7 @@ GeoData::positionAt(const glm::vec2 wcoord) const } GeoData::RayTracer::RayTracer(glm::vec2 p0, glm::vec2 p1) : RayTracer {p0, p1, glm::abs(p1)} { } + GeoData::RayTracer::RayTracer(glm::vec2 p0, glm::vec2 p1, glm::vec2 d) : RayTracer {p0, d, byAxis(p0, p1, d, 0), byAxis(p0, p1, d, 1)} { -- 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.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'game/geoData.cpp') diff --git a/game/geoData.cpp b/game/geoData.cpp index 76550cc..da067f7 100644 --- a/game/geoData.cpp +++ b/game/geoData.cpp @@ -31,7 +31,7 @@ GeoData::generateRandom() std::uniform_int_distribution<> rxpos(limit.first.x + 2, limit.second.x - 2), rypos(limit.first.y + 2, limit.second.y - 2); std::uniform_int_distribution<> rsize(10, 30); - std::uniform_real_distribution rheight(1, 3); + std::uniform_real_distribution rheight(1000, 3000); for (int h = 0; h < 500;) { const glm::ivec2 hpos {rxpos(gen), rypos(gen)}; const glm::ivec2 hsize {rsize(gen), rsize(gen)}; -- cgit v1.2.3 From 0aa665c3648d788755b00c9e431c872d57fddbb8 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 25 Nov 2023 16:28:39 +0000 Subject: Model positions as integers Introduces test failure in arcs due to rounding, but I don't want to create a complicated fix as link positions are still floats and hopefully that'll go away... somehow --- game/geoData.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'game/geoData.cpp') diff --git a/game/geoData.cpp b/game/geoData.cpp index da067f7..ec990ea 100644 --- a/game/geoData.cpp +++ b/game/geoData.cpp @@ -73,7 +73,7 @@ GeoData::loadFromImages(const std::filesystem::path & fileName, float scale_) } GeoData::Quad -GeoData::quad(glm::vec2 wcoord) const +GeoData::quad(Position2D wcoord) const { constexpr static const std::array corners {{{0, 0}, {0, 1}, {1, 0}, {1, 1}}}; return transform_array(transform_array(corners, @@ -154,7 +154,7 @@ GeoData::intersectRay(const Ray & ray) const try { const auto point = quad(n); for (auto offset : {0U, 1U}) { - glm::vec2 bary; + BaryPosition bary; float distance; if (glm::intersectRayTriangle(ray.start, ray.direction, point[offset], point[offset + 1], point[offset + 2], bary, distance)) { -- cgit v1.2.3