/// <summary>
        /// Given a BSP file and a WAD list, returns a list of textures that are referenced by the map
        /// The returned textures contain texture data
        /// </summary>
        /// <param name="bspFile"></param>
        /// <param name="wadList"></param>
        /// <returns></returns>
        public static List <MipTexture> GetUsedTextures(BSPFile bspFile, WADList wadList)
        {
            if (bspFile == null)
            {
                throw new ArgumentNullException(nameof(bspFile));
            }

            if (wadList == null)
            {
                throw new ArgumentNullException(nameof(wadList));
            }

            //BSP files contain a list of used textures, so we can just use that to filter out the ones we need
            //In the event that BSP files contain unused textures, we'd need to make a list of all used textures from the faces and then filter with that

            var names = bspFile.MipTextures;

            var usedTextures = new List <MipTexture>();

            foreach (var name in names)
            {
                var used = wadList.FindTexture(name.Name);

                //Non-embedded textures can be missing if the WAD file was not provided
                if (used != null)
                {
                    usedTextures.Add(used);
                }
            }

            return(usedTextures);
        }
        /// <summary>
        /// Creates a WAD file from a BSP file's embedded textures
        /// The WAD file will be backed by the BSP file's textures, and changes will be reflected
        /// </summary>
        /// <param name="bspFile"></param>
        /// <returns></returns>
        public static WADFile CreateWADFromBSP(BSPFile bspFile)
        {
            if (bspFile == null)
            {
                throw new ArgumentNullException(nameof(bspFile));
            }

            return(new WADFile
            {
                Version = WADVersion.WAD3,
                MipTextures = bspFile.MipTextures.Where(t => t.Data[0] != null).ToList()
            });
        }