mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-17 12:09:19 +02:00
fix(editor): no crash laying track with the mouse outside the window
- with no position of the mouse the ray gave NaN and the ground under it was looked up in a grid cell out of range; the lay and drag tools keep the last cursor then, the ground is not asked about points which are not numbers
This commit is contained in:
@@ -567,6 +567,8 @@ std::vector<double> editor_mode::ground_heights(std::vector<glm::dvec3> const &P
|
||||
for (std::size_t i = 0; i < Points.size(); ++i)
|
||||
{
|
||||
auto const &p = Points[i];
|
||||
if (false == std::isfinite(p.x) || false == std::isfinite(p.y) || false == std::isfinite(p.z))
|
||||
continue;
|
||||
std::pair<int, int> const key{static_cast<int>(std::floor(p.x / ground_tile_size)), static_cast<int>(std::floor(p.z / ground_tile_size))};
|
||||
auto &tile = ground_tiles[key];
|
||||
bool const missing = (tile.grid == nullptr);
|
||||
|
||||
Reference in New Issue
Block a user