Example #1
0
        public void ReplaceTex(string texName, Images.DDS dds)
        {
            var target  = Textures.Where(x => x.Name == texName).First();
            var encoded = DDSEncoder.EncodeTex(dds);

            target.Data            = encoded.Data;
            target.TextureType     = (int)TextureType.Image2D;
            target.Format          = (uint)encoded.Encoding.formatCode;
            target.ChannelTypes    = 0x05040302;
            target.Width           = dds.Width;
            target.Height          = dds.Height;
            target.TileMode        = 0;
            target.SwizzleSize     = 0;
            target.Reversed1A      = 0;
            target.Reserved4C      = 0;
            target.Reserved48      = 0;
            target.Reserved44      = 0;
            target.Reserved40      = 0;
            target.Reserved3C      = 0;
            target.Reserved38      = 0x00010007;
            target.MipmapCount     = 1;
            target.Flags           = 0x01;
            target.Depth           = 1;
            target.BlockHeightLog2 = encoded.BlockHeightLog2;
            target.Alignment       = 0x200;
            target.AccessFlags     = 0x20;
        }
Example #2
0
        //this will work only for a BC1 image, other formats are not implemented, sizes different than 720p haven't been tested
        public void ReplaceTex(string texName, byte[] DDS)
        {
            var dds = DDSEncoder.LoadDDS(DDS);

            ReplaceTex(texName, dds);
        }