Beispiel #1
0
        public MK64Image(TKMK00Block tkmk, string name)
        {
            TextureOffset      = -1;
            TextureEncoding    = MK64ImageEncoding.TKMK00;
            TextureBlockOffset = 0;

            PaletteOffset      = new List <int>();
            PaletteEncoding    = new List <MK64ImageEncoding>();
            PaletteBlockOffset = new List <int>();
            PaletteColorCount  = new List <int>();
            PaletteColorOffset = new List <int>();

            TKMKLength     = tkmk.RawDataSize;
            TKMKAlphaColor = tkmk.ImageAlphaColor;

            Format          = Texture.ImageFormat.RGBA;
            PixelSize       = Texture.PixelInfo.Size_16b;
            Width           = tkmk.Image.Width;
            Height          = tkmk.Image.Height;
            IsOriginalImage = false;

            if (string.IsNullOrWhiteSpace(name))
            {
                ImageName = TextureOffset.ToString("X");
            }
            else
            {
                ImageName = name;
            }

            TKMKReference = tkmk;
            IsValidImage  = (tkmk != null);
        }
Beispiel #2
0
        //Constructors to add a new image in without needing an offset (NO MIO0 ENCODING FOR THIS YET)
        public MK64Image(F3DEXImage image, string name, bool encodeTextureInMIO0 = false)
        {
            TextureOffset      = -1;
            TextureEncoding    = (encodeTextureInMIO0 ? MK64ImageEncoding.MIO0 : MK64ImageEncoding.Raw);
            TextureBlockOffset = 0;

            PaletteOffset      = image.BasePalettes.Select <Palette, int>(p => p.FileOffset).ToList();
            PaletteEncoding    = Enumerable.Repeat(MK64ImageEncoding.Raw, image.BasePalettes.Count).ToList();
            PaletteBlockOffset = Enumerable.Repeat((int)0, image.BasePalettes.Count).ToList();
            PaletteColorCount  = image.BasePalettes.Select <Palette, int>(p => p.Colors.Length).ToList();
            PaletteColorOffset = Enumerable.Repeat((int)0, image.BasePalettes.Count).ToList();

            TKMKLength     = 0;
            TKMKAlphaColor = 0;

            Format          = image.Texture.Format;
            PixelSize       = image.Texture.PixelSize;
            Width           = image.Texture.Width;
            Height          = image.Texture.Height;
            IsOriginalImage = false;

            if (string.IsNullOrWhiteSpace(name))
            {
                ImageName = TextureOffset.ToString("X");
            }
            else
            {
                ImageName = name;
            }

            ImageReference = image;
            IsValidImage   = image.ValidImage;
        }