Texture2D GetFlat(string name) { name = name.ToUpper(); if (flatCache == null) { flatCache = new Dictionary <string, Texture2D>(); } if (flatCache.ContainsKey(name)) { return(flatCache[name]); } DoomFlat flat; if (wad.Contains(name)) { Texture2D output; DataType type = wad.DetectType(name); if (type == DataType.DoomFlat) { flat = new DoomFlat(wad.GetLump(name)); output = flat.ToRenderMap(); lastTexturePNG = false; } else if (type == DataType.PNG) { output = new Texture2D(2, 2, TextureFormat.ARGB32, false); ImageConversion.LoadImage(output, wad.GetLump(name)); output.filterMode = FilterMode.Point; lastTexturePNG = true; } else { throw new Exception("Unknown flat type: " + name); } flatCache.Add(name, output); return(output); } else { if (textureTable.Contains(name)) { return(DoomGraphic.BuildTexture(name, wad, textureTable)); } } throw new Exception("Cannot find flat: " + name); }
Texture2D GetFlat(string name) { name = name.ToUpper(); if (flatCache == null) { flatCache = new Dictionary <string, Texture2D>(); } if (flatCache.ContainsKey(name)) { return(flatCache[name]); } DoomFlat flat = new DoomFlat(wad.GetLump(name)); Texture2D output = flat.ToRenderMap(); flatCache.Add(name, output); return(output); }