Skip to content

Commit d82fb2f

Browse files
authored
Minor dynamic resolution changes (#4672)
1 parent a8bc758 commit d82fb2f

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/core/modules/AtmosphereShowMySky.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,17 @@ Vec4f AtmosphereShowMySky::getMeanPixelValue()
630630
bool AtmosphereShowMySky::dynamicResolution(StelProjectorP prj, Vec3d &currPos, int width, int height)
631631
{
632632
if (!flagDynamicResolution)
633+
{
634+
// There's nothing to do here, we're drawing in full resolution and full frame rate.
633635
return false;
636+
}
637+
638+
// If the scene is rendered in real time and is practically static,
639+
// Stellarium generates approximately 18 frames per second.
640+
// We draw about one atmosphere per second at full resolution.
641+
// For faster-moving scenes, Stellarium increases the frame rate to the maximum,
642+
// perhaps 50 frames per second depending on the hardware's capabilities.
643+
// We draw about 10 atmospheres per second in reduced resolution.
634644

635645
const auto currFov=prj->getFov(), currFad=fader.getInterstate();
636646
Vec3d currSun;
@@ -651,16 +661,15 @@ bool AtmosphereShowMySky::dynamicResolution(StelProjectorP prj, Vec3d &currPos,
651661
dynResTimer--; // count down to redraw
652662
return true;
653663
}
654-
// if there is a timeout, we draw with full resolution
655-
// if the change is too large, we draw with reduced resolution
656-
atmoRes=timeout?1:reducedResolution;
664+
// if the change is too big, we draw with reduced resolution, otherwise with full resolution
665+
atmoRes=changed?reducedResolution:1;
657666
if (prevRes!=atmoRes)
658667
{
659668
resizeRenderTarget(width, height);
660669
qCDebug(Atmo) << "dynResTimer" << dynResTimer << "atmoRes" << atmoRes << "changeOfView" << changeOfView.norm() << changeOfView;
661670
}
662671
// At reduced resolution, we hurry to redraw - at full resolution, we have time.
663-
dynResTimer=timeout?17:5;
672+
dynResTimer=changed?5:17; // dynResTimer is like a clock divider.
664673
prevRes=atmoRes;
665674
prevFov=currFov;
666675
prevFad=currFad;

0 commit comments

Comments
 (0)