mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-05 19:19:39 -06:00
Base orbit update on actual previous values instead of time jump concept. Fix OpenGL invalid value bug caused by negative buffer size. (#346)
This commit is contained in:
committed by
Alexander Bock
parent
46179922b7
commit
4318a2b709
@@ -138,6 +138,7 @@ RenderableTrailOrbit::RenderableTrailOrbit(const ghoul::Dictionary& dictionary)
|
||||
, _resolution("resolution", "Number of Samples along Orbit", 10000, 1, 1000000)
|
||||
, _needsFullSweep(true)
|
||||
, _indexBufferDirty(true)
|
||||
, _previousTime(0)
|
||||
{
|
||||
documentation::testSpecificationAndThrow(
|
||||
Documentation(),
|
||||
@@ -284,7 +285,7 @@ void RenderableTrailOrbit::update(const UpdateData& data) {
|
||||
// The current index
|
||||
int i = _primaryRenderInformation.first;
|
||||
// Number of values
|
||||
int n = report.nUpdated + 1; // +1 for the floating position
|
||||
int n = std::abs(report.nUpdated) + 1; // +1 for the floating position
|
||||
// Total size of the array
|
||||
int s = _primaryRenderInformation.count;
|
||||
|
||||
@@ -309,23 +310,21 @@ void RenderableTrailOrbit::update(const UpdateData& data) {
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
|
||||
|
||||
glBindVertexArray(0);
|
||||
_previousTime = data.time.j2000Seconds();
|
||||
}
|
||||
|
||||
RenderableTrailOrbit::UpdateReport RenderableTrailOrbit::updateTrails(
|
||||
const UpdateData& data)
|
||||
{
|
||||
// If we are doing a time jump, it is in general faster to recalculate everything
|
||||
// than to only update parts of the array
|
||||
if (data.time.timeJumped()) {
|
||||
_needsFullSweep = true;
|
||||
}
|
||||
if (_needsFullSweep) {
|
||||
fullSweep(data.time.j2000Seconds());
|
||||
return { true, UpdateReport::All } ;
|
||||
}
|
||||
|
||||
|
||||
const double Epsilon = 1e-7;
|
||||
// When time stands still (at the iron hill), we don't need to perform any work
|
||||
if (data.time.deltaTime() == 0.0) {
|
||||
if (std::abs(data.time.j2000Seconds() - _previousTime) < Epsilon) {
|
||||
return { false, 0 };
|
||||
}
|
||||
|
||||
@@ -339,7 +338,7 @@ RenderableTrailOrbit::UpdateReport RenderableTrailOrbit::updateTrails(
|
||||
//
|
||||
// This might become a bigger issue if we are starting to look at very short time
|
||||
// intervals
|
||||
const double Epsilon = 1e-7;
|
||||
|
||||
if (std::abs(delta) < Epsilon) {
|
||||
return { false, 0 };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user