Example #1
0
        public static void WriteFTEXData(XmlWriter writer, ResU.Texture texture)
        {
            writer.WriteStartElement("FTEX");

            writer.WriteAttributeString("Name", texture.Name);
            writer.WriteAttributeString("Dim", texture.Dim.ToString());
            writer.WriteAttributeString("Width", texture.Width.ToString());
            writer.WriteAttributeString("Height", texture.Height.ToString());
            writer.WriteAttributeString("Depth", texture.Depth.ToString());
            writer.WriteAttributeString("MipCount", texture.MipCount.ToString());
            writer.WriteAttributeString("Format", texture.Format.ToString());
            writer.WriteAttributeString("AAMode", texture.AAMode.ToString());
            writer.WriteAttributeString("Usage", texture.Use.ToString());
            writer.WriteAttributeString("TileMode", texture.TileMode.ToString());
            writer.WriteAttributeString("Swizzle", texture.Swizzle.ToString());
            writer.WriteAttributeString("Alignment", texture.Alignment.ToString());
            writer.WriteAttributeString("Pitch", texture.Pitch.ToString());
            writer.WriteAttributeString("FirstSlice", texture.ViewSliceFirst.ToString());
            writer.WriteAttributeString("SliceCount", texture.ViewSliceCount.ToString());
            writer.WriteAttributeString("CompSelR", texture.CompSelR.ToString());
            writer.WriteAttributeString("CompSelG", texture.CompSelG.ToString());
            writer.WriteAttributeString("CompSelB", texture.CompSelB.ToString());
            writer.WriteAttributeString("CompSelA", texture.CompSelA.ToString());
            writer.WriteAttributeString("Regs", texture.Regs.ToString());
            writer.WriteAttributeString("ArrayLength", texture.ArrayLength.ToString());
            writer.WriteAttributeString("Path", texture.Path);

            // These should be written as binary files, not ASCII
            writer.WriteAttributeString("Data", texture.Data.ToString());
            writer.WriteAttributeString("MipData", texture.MipData.ToString());

            writer.WriteAttributeString("UserData", texture.UserData.ToString());

            writer.WriteEndElement();
        }
        public static Texture WiiUToSwicthBNTXTexture(ResU.Texture textureU)
        {
            Texture texture = new Texture();

            texture.Height       = textureU.Height;
            texture.Width        = textureU.Width;
            texture.Format       = ConvertGX2ToSwitchFormat(textureU.Format);
            texture.Alignment    = (int)textureU.Alignment;
            texture.ArrayLength  = textureU.ArrayLength;
            texture.ChannelRed   = ConvertWiiUToBNTXChannel(textureU.CompSelR);
            texture.ChannelGreen = ConvertWiiUToBNTXChannel(textureU.CompSelG);
            texture.ChannelBlue  = ConvertWiiUToBNTXChannel(textureU.CompSelB);
            texture.ChannelAlpha = ConvertWiiUToBNTXChannel(textureU.CompSelA);
            texture.MipCount     = textureU.MipCount == 0 ? 1 : texture.MipCount;
            texture.Swizzle      = 0;

            return(texture);
        }