Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f39ee9e787 |
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user