public virtual TextureHandler GetTexture(Enum id, out Vector2 scale) { uint pos = Convert.ToUInt32(id); uint File = GetEntry(id).File; //check if we set a custom file and we have a pos more then set entriespertexture if (File == 0 && EntriesPerTexture > 0 && pos > EntriesPerTexture) { File = (uint)(pos / EntriesPerTexture); } if (File > 0) { uint j = (uint)TextureCount.Sum(); if (File >= j) { File %= j; } } scale = Scale[File]; return(Textures[(int)File]); }
protected virtual void InitTextures(ArchiveWorker aw = null) { if (Textures == null) { Textures = new List <TextureHandler>(TextureCount.Sum()); } if (Textures.Count <= 0) { if (aw == null) { aw = new ArchiveWorker(ArchiveString); } TEX tex; Scale = new Dictionary <uint, Vector2>(TextureCount.Sum()); int b = 0; for (int j = 0; j < TextureCount.Length; j++) { for (uint i = 0; i < TextureCount[j]; i++) { string path = aw.GetListOfFiles().First(x => x.ToLower().Contains(string.Format(TextureFilename[j], i + TextureStartOffset))); tex = new TEX(ArchiveWorker.GetBinaryFile(ArchiveString, path)); if (TextureBigFilename != null && FORCE_ORIGINAL == false && b < TextureBigFilename.Length && b < TextureBigSplit.Length) { TextureHandler th = new TextureHandler(TextureBigFilename[b], tex, 2, TextureBigSplit[b++] / 2); Textures.Add(th); Scale[i] = Vector2.One;//th.GetScale(); } else { TextureHandler th = new TextureHandler(path, tex); Textures.Add(th); Scale[i] = th.GetScale(); } } } } }