From 0a018706e4a0eaf0359ba7d2e6132684f080e081 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 24 Apr 2023 23:07:49 +0200 Subject: [PATCH] pad textures by default --- ExampleMod.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ExampleMod.cs b/ExampleMod.cs index 4e05a91..737c5a0 100644 --- a/ExampleMod.cs +++ b/ExampleMod.cs @@ -113,10 +113,11 @@ public class ExampleMod : Mod { // loads a texture atlas with the given amount of separate texture regions in the x and y axes // we submit it to the texture packer to increase rendering performance. The callback is invoked once packing is completed - texturePacker.Add(new UniformTextureAtlas(content.Load("CustomTops"), 4, 11), r => this.customTops = r); - texturePacker.Add(new UniformTextureAtlas(content.Load("CustomHairs"), 4, 5), r => this.customHairs = r); - texturePacker.Add(new UniformTextureAtlas(content.Load("CustomBottomsShoes"), 8, 6), r => this.customBottoms = r); - texturePacker.Add(new UniformTextureAtlas(content.Load("UiTextures"), 8, 8), r => this.uiTextures = r); + // additionally, we pad all texture regions by 1 pixel, so that rounding errors during rendering don't cause visual artifacts + texturePacker.Add(new UniformTextureAtlas(content.Load("CustomTops"), 4, 11), r => this.customTops = r, 1, true); + texturePacker.Add(new UniformTextureAtlas(content.Load("CustomHairs"), 4, 5), r => this.customHairs = r, 1, true); + texturePacker.Add(new UniformTextureAtlas(content.Load("CustomBottomsShoes"), 8, 6), r => this.customBottoms = r, 1, true); + texturePacker.Add(new UniformTextureAtlas(content.Load("UiTextures"), 8, 8), r => this.uiTextures = r, 1, true); // wallpaper textures require special treatment to work with openings, the x and y values are passed to the UniformTextureAtlas constructor WallMode.ApplyMasks(content.Load("Wallpapers"), 4, 5, texturePacker, r => this.wallpaperTextures = r); }