diff --git a/src/MrGameEng.Graphics/Texture2DRegion.cs b/src/MrGameEng.Graphics/Texture2DRegion.cs index ea44d11..68278c8 100644 --- a/src/MrGameEng.Graphics/Texture2DRegion.cs +++ b/src/MrGameEng.Graphics/Texture2DRegion.cs @@ -43,10 +43,13 @@ public sealed class Texture2DRegion // texture может быть null только в headless-тестах. if (texture is not null) { - U0 = bounds.X / (float)texture.Width; - V0 = bounds.Y / (float)texture.Height; - U1 = (bounds.X + bounds.Width) / (float)texture.Width; - V1 = (bounds.Y + bounds.Height) / (float)texture.Height; + // Полутексельный inset: UV идут от центра крайнего текселя к центру крайнего, а не по + // самым кромкам региона. С point-фильтрацией это гарантирует, что края тайла никогда не + // сэмплят прозрачный «жёлоб» атласа (Padding) — иначе при дробном зуме видны чёрные швы. + U0 = (bounds.X + 0.5f) / texture.Width; + V0 = (bounds.Y + 0.5f) / texture.Height; + U1 = (bounds.X + bounds.Width - 0.5f) / texture.Width; + V1 = (bounds.Y + bounds.Height - 0.5f) / texture.Height; } }