From 53d81367b1b64c3d7966980c14c18634acad1911 Mon Sep 17 00:00:00 2001 From: Christopher Bruns Date: Thu, 20 Jun 2024 10:28:04 -0700 Subject: [PATCH] Only use catrom at finest mipmap level. Reduce minimum zoom level to 0.45. --- vmg/shared.frag | 4 +++- vmg/state.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/vmg/shared.frag b/vmg/shared.frag index 2e6810a..8087663 100644 --- a/vmg/shared.frag +++ b/vmg/shared.frag @@ -83,7 +83,9 @@ vec4 clip_n_filter(sampler2D image, vec2 tc, int pixelFilter, bool wrap) return vec4(0); } - if (pixelFilter == FILTER_NEAREST) { + float mipmapLevel = textureQueryLod(image, tc).x; + if (mipmapLevel > 0 || pixelFilter == FILTER_NEAREST) + { if (wrap) return nearest_wrap(image, tc); else diff --git a/vmg/state.py b/vmg/state.py index 6957518..e91f256 100644 --- a/vmg/state.py +++ b/vmg/state.py @@ -463,8 +463,8 @@ def zoom_relative(self, zoom_factor: float, zoom_center: Optional[QPoint]): old_zoom = self._zoom new_zoom = self._zoom * zoom_factor # Limit zoom-out because you never need more than twice the image dimension to move around - if new_zoom <= 1: - new_zoom = 1 + if new_zoom <= 0.45: + new_zoom = 0.45 self._zoom = new_zoom if zoom_center is not None: p_qwn = LocationQwn(zoom_center.x(), zoom_center.y(), 1)