summaryrefslogtreecommitdiff
path: root/ui/gameMainWindow.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-01-10 02:07:53 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2022-01-10 02:07:53 +0000
commit94f0e426bc8f298aec90fd0d4fcf6f823f8c399c (patch)
treec1be0231cab6f9680aa8c3f9e0acf531d8debb89 /ui/gameMainWindow.cpp
parentTweak ray tracer calls to account for scale (diff)
downloadilt-94f0e426bc8f298aec90fd0d4fcf6f823f8c399c.tar.bz2
ilt-94f0e426bc8f298aec90fd0d4fcf6f823f8c399c.tar.xz
ilt-94f0e426bc8f298aec90fd0d4fcf6f823f8c399c.zip
Ray Trace cursor clicks to terrain surface
Diffstat (limited to 'ui/gameMainWindow.cpp')
-rw-r--r--ui/gameMainWindow.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/ui/gameMainWindow.cpp b/ui/gameMainWindow.cpp
index d53db4b..1724927 100644
--- a/ui/gameMainWindow.cpp
+++ b/ui/gameMainWindow.cpp
@@ -70,16 +70,11 @@ public:
const auto & ref = *selected.base()->get();
clicked = typeid(ref).name();
}
+ else if (const auto pos = gameState->geoData->intersectRay(ray)) {
+ clicked = streamed_string(*pos);
+ }
else {
- try {
- const auto dist = camera->pos.z / -ray.direction.z;
- const auto pos = !camera->pos + (!ray.direction * dist);
-
- clicked = streamed_string(gameState->geoData->positionAt(pos));
- }
- catch (std::range_error &) {
- clicked.clear();
- }
+ clicked.clear();
}
}
}