From d6e3aa07719122b156f584db42b44b387d5519d1 Mon Sep 17 00:00:00 2001 From: Anders Lundkvist <57524362+lundkvistarn@users.noreply.github.com> Date: Thu, 28 Aug 2025 09:53:18 -0400 Subject: [PATCH] Fix todays sun fieldline color inconsistency during time changes (#3786) * Fix fieldline color inconsistency during time changes --- .../renderablefieldlinessequence.cpp | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp b/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp index d38ca7ea2c..164615d8d2 100644 --- a/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp +++ b/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp @@ -1094,7 +1094,11 @@ void RenderableFieldlinesSequence::update(const UpdateData& data) { currentTime >= _files[0].timestamp && currentTime < _sequenceEndTime; - // For the sake of this if statment, it is easiest to think of activeIndex as the + // Track if we need to update buffers + bool needsBufferUpdate = false; + bool fileWasJustLoaded = false; + + // For the sake of this if statement, it is easiest to think of activeIndex as the // previous index and nextIndex as the current const int nextIndex = _activeIndex + 1; // if _activeIndex is -1 but we are in interval, it means we were before the start @@ -1127,14 +1131,20 @@ void RenderableFieldlinesSequence::update(const UpdateData& data) { _atLeastOneFileLoaded = true; computeSequenceEndTime(); trackOldest(file); - } - // If we have a new index, buffers needs to update - if (previousIndex != _activeIndex) { - _shouldUpdateColorBuffer = true; - _shouldUpdateMaskingBuffer = true; + fileWasJustLoaded = true; } + // If we have a new index or just loaded a file, buffers need to update + if (previousIndex != _activeIndex || fileWasJustLoaded) { + needsBufferUpdate = true; + } + } + + // Update all buffers together to maintain consistency + if (needsBufferUpdate) { updateVertexPositionBuffer(); + _shouldUpdateColorBuffer = true; + _shouldUpdateMaskingBuffer = true; } if (_shouldUpdateColorBuffer) {