Beispiel #1
0
        public static void TexConvImg(TexConvImgOptions option)
        {
            TXS3ImageFormat format = option.Format switch
            {
                "DXT1" => TXS3ImageFormat.DXT1,
                "DXT3" => TXS3ImageFormat.DXT3,
                "DXT5" => TXS3ImageFormat.DXT5,
                "DXT10" => TXS3ImageFormat.DXT10,
            };

            if (format == TXS3ImageFormat.Unknown)
            {
                Console.WriteLine("Wrong format. Expected DXT1/DXT3/DXT5/DXT10.");
                return;
            }


            foreach (var file in option.InputFiles)
            {
                if (!File.Exists(file))
                {
                    Console.WriteLine($"File '{file}' does not exist.");
                    continue;
                }


                TextureSet3 texSet = new TextureSet3();
                texSet.WriteNames   = option.WriteNames;
                texSet.LittleEndian = option.LittleEndian;

                if (texSet.AddFromStandardImage(file, format))
                {
                    texSet.ConvertToTXS(Path.ChangeExtension(file, ".img"));
                    Console.WriteLine($"Converted {file} to TXS3.");
                }
                else
                {
                    Console.WriteLine($"Could not process {file}.");
                }
            }
        }