mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-07 04:00:37 -06:00
Add a dirty flag to only update the layermanager once per frame
This commit is contained in:
@@ -923,6 +923,20 @@ void RenderableGlobe::update(const UpdateData& data) {
|
||||
_shadowComponent.update(data);
|
||||
}
|
||||
|
||||
// abock (2020-08-21)
|
||||
// This is a bit nasty every since we removed the second update call from the render
|
||||
// loop. The problem is when we enable a new layer, the dirty flags above will be set
|
||||
// to true, but the update method hasn't run yet. So we need to move the layerManager
|
||||
// update method to the render function call, but we don't want to *actually* update
|
||||
// the layers once per render call; hence this nasty dirty flag
|
||||
//
|
||||
// How it is without in the frame when we enable a layer:
|
||||
//
|
||||
// RenderableGlobe::update() // updated with the old number of layers
|
||||
// // Lua script to enable layer is executed and sets the dirty flags
|
||||
// RenderableGlobe::render() // rendering with the new number of layers but the
|
||||
// // LayerManager hasn't updated yet :o
|
||||
_layerManagerDirty = true;
|
||||
}
|
||||
|
||||
bool RenderableGlobe::renderedWithDesiredData() const {
|
||||
@@ -955,7 +969,11 @@ void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&,
|
||||
{
|
||||
ZoneScoped
|
||||
|
||||
_layerManager.update();
|
||||
|
||||
if (_layerManagerDirty) {
|
||||
_layerManager.update();
|
||||
_layerManagerDirty = false;
|
||||
}
|
||||
|
||||
if (_nLayersIsDirty) {
|
||||
std::array<LayerGroup*, LayerManager::NumLayerGroups> lgs =
|
||||
|
||||
@@ -289,6 +289,7 @@ private:
|
||||
bool _chunkCornersDirty = true;
|
||||
bool _nLayersIsDirty = true;
|
||||
bool _allChunksAvailable = true;
|
||||
bool _layerManagerDirty = true;
|
||||
size_t _iterationsOfAvailableData = 0;
|
||||
size_t _iterationsOfUnavailableData = 0;
|
||||
Layer* _lastChangedLayer = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user