Ejemplo n.º 1
0
 public static void RenameTextures(TextureSet textures, TextureDatabase textureDatabase = null)
 {
     foreach (var texture in textures.Textures)
     {
         RenameTexture(texture, textures, textureDatabase);
     }
 }
Ejemplo n.º 2
0
        public static void SaveTextures(TextureSet textures, string outputDirectory)
        {
            Directory.CreateDirectory(outputDirectory);

            foreach (var texture in textures.Textures)
            {
                if (!TextureFormatUtilities.IsCompressed(texture.Format) || texture.IsYCbCr)
                {
                    TextureDecoder.DecodeToPNG(texture, Path.Combine(outputDirectory, texture.Name + ".png"));
                }
                else
                {
                    TextureDecoder.DecodeToDDS(texture, Path.Combine(outputDirectory, texture.Name + ".dds"));
                }
            }
        }
Ejemplo n.º 3
0
        public static void RenameTexture(Texture texture, TextureSet textures, TextureDatabase textureDatabase = null)
        {
            bool empty = string.IsNullOrEmpty(texture.Name);

            if (textureDatabase == null)
            {
                if (empty)
                {
                    texture.Name = string.Format("Texture_{0}", textures.Textures.IndexOf(texture));
                }
            }
            else
            {
                var info = textureDatabase.Textures.FirstOrDefault(x => x.Id == texture.Id);
                if (info != null)
                {
                    texture.Name = info.Name;
                }
                else if (empty)
                {
                    texture.Name = string.Format("Texture_{0}", textures.Textures.IndexOf(texture));
                }
            }
        }