Set world framebuffer size based on minimum zoom.

This avoids reallocating buffers each time the player changes zoom level.
This commit is contained in:
Paul Chote
2021-05-15 13:45:09 +01:00
committed by reaperrr
parent 0735345674
commit 0d4b81fe6f
4 changed files with 38 additions and 19 deletions

View File

@@ -250,6 +250,9 @@ namespace OpenRA.Graphics
else
Zoom = Zoom.Clamp(minZoom, maxZoom);
var maxSize = (1f / (unlockMinZoom ? unlockedMinZoom : minZoom) * new float2(Game.Renderer.NativeResolution));
Game.Renderer.SetMaximumViewportSize(new Size((int)maxSize.X, (int)maxSize.Y));
foreach (var t in worldRenderer.World.WorldActor.TraitsImplementing<INotifyViewportZoomExtentsChanged>())
t.ViewportZoomExtentsChanged(minZoom, maxZoom);
}