mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-23 12:39:24 -05:00
Remove unnecessary debug messages and return false in update() if renderable is disabled
This commit is contained in:
@@ -155,74 +155,76 @@ void RenderableFieldlinesSequence::render(const RenderData& data, RendererTasks&
|
||||
}
|
||||
|
||||
void RenderableFieldlinesSequence::update(const UpdateData& data) {
|
||||
// This node shouldn't do anything if its been disabled from the gui!
|
||||
if (!_enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_shaderProgram->isDirty()) {
|
||||
_shaderProgram->rebuildFromFile();
|
||||
}
|
||||
|
||||
// This node shouldn't do anything if its been disabled from the gui!
|
||||
if (_enabled) {
|
||||
const double currentTime = data.time.j2000Seconds();
|
||||
// Check if current time in OpenSpace is within sequence interval
|
||||
if (isWithinSequenceInterval(currentTime)) {
|
||||
const int nextIdx = _activeTriggerTimeIndex + 1;
|
||||
if (_activeTriggerTimeIndex < 0 // true => Previous frame was not within the sequence interval
|
||||
|| currentTime < _startTimes[_activeTriggerTimeIndex] // true => OpenSpace has stepped back to a time represented by another state
|
||||
|| (nextIdx < _nStates && currentTime >= _startTimes[nextIdx])) { // true => OpenSpace has stepped forward to a time represented by another state
|
||||
const double currentTime = data.time.j2000Seconds();
|
||||
// Check if current time in OpenSpace is within sequence interval
|
||||
if (isWithinSequenceInterval(currentTime)) {
|
||||
const int nextIdx = _activeTriggerTimeIndex + 1;
|
||||
if (_activeTriggerTimeIndex < 0 // true => Previous frame was not within the sequence interval
|
||||
|| currentTime < _startTimes[_activeTriggerTimeIndex] // true => OpenSpace has stepped back to a time represented by another state
|
||||
|| (nextIdx < _nStates && currentTime >= _startTimes[nextIdx])) { // true => OpenSpace has stepped forward to a time represented by another state
|
||||
|
||||
updateActiveTriggerTimeIndex(currentTime);
|
||||
updateActiveTriggerTimeIndex(currentTime);
|
||||
|
||||
if (_loadingStatesDynamically) {
|
||||
_mustLoadNewStateFromDisk = true;
|
||||
} else {
|
||||
_needsUpdate = true;
|
||||
_activeStateIndex = _activeTriggerTimeIndex;
|
||||
}
|
||||
} // else {we're still in same state as previous frame (no changes needed)}
|
||||
} else {
|
||||
// Not in interval => set everything to false
|
||||
_activeTriggerTimeIndex = -1;
|
||||
_mustLoadNewStateFromDisk = false;
|
||||
_needsUpdate = false;
|
||||
}
|
||||
|
||||
if (_mustLoadNewStateFromDisk) {
|
||||
if (!_isLoadingStateFromDisk && !_newStateIsReady) {
|
||||
_isLoadingStateFromDisk = true;
|
||||
_mustLoadNewStateFromDisk = false;
|
||||
const std::string filePath = _sourceFiles[_activeTriggerTimeIndex];
|
||||
std::thread readBinaryThread([this, filePath] {
|
||||
this->readNewState(filePath);
|
||||
});
|
||||
readBinaryThread.detach();
|
||||
}
|
||||
}
|
||||
|
||||
if (_needsUpdate || _newStateIsReady) {
|
||||
if (_loadingStatesDynamically) {
|
||||
_states[0] = std::move(*_newState);
|
||||
_mustLoadNewStateFromDisk = true;
|
||||
} else {
|
||||
_needsUpdate = true;
|
||||
_activeStateIndex = _activeTriggerTimeIndex;
|
||||
}
|
||||
} // else {we're still in same state as previous frame (no changes needed)}
|
||||
} else {
|
||||
// Not in interval => set everything to false
|
||||
_activeTriggerTimeIndex = -1;
|
||||
_mustLoadNewStateFromDisk = false;
|
||||
_needsUpdate = false;
|
||||
}
|
||||
|
||||
updateVertexPositionBuffer();
|
||||
if (_mustLoadNewStateFromDisk) {
|
||||
if (!_isLoadingStateFromDisk && !_newStateIsReady) {
|
||||
_isLoadingStateFromDisk = true;
|
||||
_mustLoadNewStateFromDisk = false;
|
||||
const std::string filePath = _sourceFiles[_activeTriggerTimeIndex];
|
||||
std::thread readBinaryThread([this, filePath] {
|
||||
this->readNewState(filePath);
|
||||
});
|
||||
readBinaryThread.detach();
|
||||
}
|
||||
}
|
||||
|
||||
if (_states[_activeStateIndex].nExtraQuantities() > 0) {
|
||||
_shouldUpdateColorBuffer = true;
|
||||
_shouldUpdateMaskingBuffer = true;
|
||||
}
|
||||
|
||||
// Everything is set and ready for rendering!
|
||||
_needsUpdate = false;
|
||||
_newStateIsReady = false;
|
||||
if (_needsUpdate || _newStateIsReady) {
|
||||
if (_loadingStatesDynamically) {
|
||||
_states[0] = std::move(*_newState);
|
||||
}
|
||||
|
||||
if (_shouldUpdateColorBuffer) {
|
||||
updateVertexColorBuffer();
|
||||
_shouldUpdateColorBuffer = false;
|
||||
updateVertexPositionBuffer();
|
||||
|
||||
if (_states[_activeStateIndex].nExtraQuantities() > 0) {
|
||||
_shouldUpdateColorBuffer = true;
|
||||
_shouldUpdateMaskingBuffer = true;
|
||||
}
|
||||
|
||||
if (_shouldUpdateMaskingBuffer) {
|
||||
updateVertexMaskingBuffer();
|
||||
_shouldUpdateMaskingBuffer = false;
|
||||
}
|
||||
// Everything is set and ready for rendering!
|
||||
_needsUpdate = false;
|
||||
_newStateIsReady = false;
|
||||
}
|
||||
|
||||
if (_shouldUpdateColorBuffer) {
|
||||
updateVertexColorBuffer();
|
||||
_shouldUpdateColorBuffer = false;
|
||||
}
|
||||
|
||||
if (_shouldUpdateMaskingBuffer) {
|
||||
updateVertexMaskingBuffer();
|
||||
_shouldUpdateMaskingBuffer = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -574,7 +574,6 @@ void RenderableFieldlinesSequence::definePropertyCallbackFunctions() {
|
||||
bool hasExtras = _states[0].nExtraQuantities() > 0;
|
||||
if (hasExtras) {
|
||||
_pColorQuantity.onChange([this] {
|
||||
LDEBUG("CHANGED COLORING QUANTITY");
|
||||
_shouldUpdateColorBuffer = true;
|
||||
_pColorQuantityMin = std::to_string(_colorTableRanges[_pColorQuantity].x);
|
||||
_pColorQuantityMax = std::to_string(_colorTableRanges[_pColorQuantity].y);
|
||||
@@ -587,35 +586,30 @@ void RenderableFieldlinesSequence::definePropertyCallbackFunctions() {
|
||||
});
|
||||
|
||||
_pColorQuantityMin.onChange([this] {
|
||||
LDEBUG("CHANGED MIN VALUE");
|
||||
float f = stringToFloat(_pColorQuantityMin, _colorTableRanges[_pColorQuantity].x);
|
||||
_pColorQuantityMin = std::to_string(f);
|
||||
_colorTableRanges[_pColorQuantity].x = f;
|
||||
});
|
||||
|
||||
_pColorQuantityMax.onChange([this] {
|
||||
LDEBUG("CHANGED MAX VALUE");
|
||||
float f = stringToFloat(_pColorQuantityMax, _colorTableRanges[_pColorQuantity].y);
|
||||
_pColorQuantityMax = std::to_string(f);
|
||||
_colorTableRanges[_pColorQuantity].y = f;
|
||||
});
|
||||
|
||||
_pMaskingQuantity.onChange([this] {
|
||||
LDEBUG("CHANGED MASKING QUANTITY");
|
||||
_shouldUpdateMaskingBuffer = true;
|
||||
_pMaskingMin = std::to_string(_maskingRanges[_pMaskingQuantity].x);
|
||||
_pMaskingMax = std::to_string(_maskingRanges[_pMaskingQuantity].y);
|
||||
});
|
||||
|
||||
_pMaskingMin.onChange([this] {
|
||||
LDEBUG("CHANGED LOWER MASKING LIMIT");
|
||||
float f = stringToFloat(_pMaskingMin, _maskingRanges[_pMaskingQuantity].x);
|
||||
_pMaskingMin = std::to_string(f);
|
||||
_maskingRanges[_pMaskingQuantity].x = f;
|
||||
});
|
||||
|
||||
_pMaskingMax.onChange([this] {
|
||||
LDEBUG("CHANGED UPPER MASKING LIMIT");
|
||||
float f = stringToFloat(_pMaskingMax, _maskingRanges[_pMaskingQuantity].y);
|
||||
_pMaskingMax = std::to_string(f);
|
||||
_maskingRanges[_pMaskingQuantity].y = f;
|
||||
@@ -623,7 +617,6 @@ void RenderableFieldlinesSequence::definePropertyCallbackFunctions() {
|
||||
}
|
||||
|
||||
_pFocusOnOriginBtn.onChange([this] {
|
||||
LDEBUG("SET FOCUS NODE TO PARENT");
|
||||
SceneGraphNode* node = OsEng.renderEngine().scene()->sceneGraphNode(_name);
|
||||
if (!node) {
|
||||
LWARNING("Could not find a node in scenegraph called '" << _name << "'");
|
||||
@@ -634,7 +627,6 @@ void RenderableFieldlinesSequence::definePropertyCallbackFunctions() {
|
||||
});
|
||||
|
||||
_pJumpToStartBtn.onChange([this] {
|
||||
LDEBUG("Jump in time to start of sequence!");
|
||||
OsEng.timeManager().time().setTime(_startTimes[0]);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user