TexturePacker
A static class in Root.Township, Alta.Customization.
Packs every cosmetic part's texture and normal map into the character's 4096 atlas render textures. Used by CosmeticPacker.
- Listed in Customization and screenshots
- Nested types
ExistingBlit
Fields
9 private and internal fields
| Member | What it is |
|---|---|
private static Dictionary<TexturePacker.ExistingBlit, Vector4> existing | Spots already used per texture and colour pair in this pack. |
private static Logger logger | NLog logger for this class. |
private const RenderTextureFormat NormalRenderTextureFormat | Format of the normal atlas (ARGB32). |
private const int NormalSize | Normal atlas size, 4096. Not scaled by the size multiplier. |
private const RenderTextureFormat renderTextureFormat | Format of the diffuse atlas (ARGB32). |
private const int Size | Diffuse atlas size before the multiplier, 4096. |
private const int Step | Grid cell size in pixels, 32. |
private static int[,] taken | Grid of used cells, cleared each pack. |
private const int TakenSize | Cells per side of the grid, 128. |
Methods
| Member | What it is |
|---|---|
static async Task Pack(Dictionary<CosmeticPacker.PartId, ICosmeticMeshPartBase> partMap, IEnumerable<CosmeticPacker.Input> parts, Texture2D defaultNormal, RenderTexture diffuse, RenderTexture normals, bool isSharingAllowed = true, float sizeMultiplier = 1) | Places each part's texture in a free spot on a 32 px grid, largest first, and blits diffuse and normals there. Same texture and colours reuse a spot. |
static void SetupTextures(ref RenderTexture diffuse, ref RenderTexture normals, float sizeMultiplier = 1) | Creates the diffuse (scaled by the multiplier) and normal atlas render textures if they are null. |