UltimateZoneBuilder/Source/Core/Config/AllTexturesSet.cs
MaxED a8c23266bb Changed: optimized generated voxel mesh size. Pro: they occupy ~50% less memory. Con: voxel loading takes ~30% more time.
Changed, Browse Textures window: several textures with the same name were displayed in "All" texture set when overriding WAD textures by Folder/PK3 textures.
2016-07-18 23:41:02 +00:00

79 lines
2 KiB
C#

#region ================== Copyright (c) 2007 Pascal vd Heiden
/*
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections.Generic;
using CodeImp.DoomBuilder.Data;
#endregion
namespace CodeImp.DoomBuilder.Config
{
internal sealed class AllTextureSet : TextureSet, IFilledTextureSet
{
#region ================== Constants
private const string NAME = "All";
#endregion
#region ================== Variables
// Matching textures and flats
private Dictionary<string, ImageData> textures;
private Dictionary<string, ImageData> flats;
#endregion
#region ================== Properties
public ICollection<ImageData> Textures { get { return textures.Values; } }
public ICollection<ImageData> Flats { get { return flats.Values; } }
#endregion
#region ================== Constructor / Destructor
// New texture set constructor
public AllTextureSet()
{
this.name = NAME;
this.textures = new Dictionary<string, ImageData>(StringComparer.Ordinal);
this.flats = new Dictionary<string, ImageData>(StringComparer.Ordinal);
}
#endregion
#region ================== Methods
internal void AddTexture(ImageData image)
{
//mxd. Use short name when adding a texture with "classic" name to override same-named textures
// with textures loaded from directory/pk3 containters
textures[image.DisplayName.Length > 8 ? image.Name : image.ShortName] = image;
}
internal void AddFlat(ImageData image)
{
//mxd. Same with flats
flats[image.DisplayName.Length > 8 ? image.Name : image.ShortName] = image;
}
#endregion
}
}