mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-05 19:19:39 -06:00
Revent point overflow when viewing the solar system position far in the future (closes #3021)
This commit is contained in:
@@ -378,7 +378,7 @@ RenderableTrailOrbit::UpdateReport RenderableTrailOrbit::updateTrails(
|
||||
}
|
||||
|
||||
// See how many points we need to drop
|
||||
const int nNewPoints = static_cast<int>(floor(delta / secondsPerPoint));
|
||||
const uint64_t nNewPoints = static_cast<uint64_t>(floor(delta / secondsPerPoint));
|
||||
|
||||
// If we would need to generate more new points than there are total points in the
|
||||
// array, it is faster to regenerate the entire array
|
||||
@@ -412,12 +412,13 @@ RenderableTrailOrbit::UpdateReport RenderableTrailOrbit::updateTrails(
|
||||
// future
|
||||
_firstPointTime += nNewPoints * secondsPerPoint;
|
||||
|
||||
return { false, true, nNewPoints };
|
||||
return { false, true, static_cast<int>(nNewPoints) };
|
||||
}
|
||||
else {
|
||||
// See how many new points needs to be generated. Delta is negative, so we need
|
||||
// to invert the ratio
|
||||
const int nNewPoints = -(static_cast<int>(floor(delta / secondsPerPoint)));
|
||||
const uint64_t nNewPoints =
|
||||
-(static_cast<uint64_t>(floor(delta / secondsPerPoint)));
|
||||
|
||||
// If we would need to generate more new points than there are total points in the
|
||||
// array, it is faster to regenerate the entire array
|
||||
@@ -453,7 +454,7 @@ RenderableTrailOrbit::UpdateReport RenderableTrailOrbit::updateTrails(
|
||||
// The previously youngest point has become nNewPoints steps older
|
||||
_lastPointTime -= nNewPoints * secondsPerPoint;
|
||||
|
||||
return { false, true, -nNewPoints };
|
||||
return { false, true, static_cast<int>(-nNewPoints) };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user