Exemple #1
0
        public static int GetDataSizeWithMips(uint format, uint Width, uint Height, uint MipCount)
        {
            int size = 0;

            for (int m = 0; m < MipCount; m++)
            {
                uint width  = (uint)Math.Max(1, Width >> m);
                uint height = (uint)Math.Max(1, Height >> m);

                size = +Decode_Gamecube.GetDataSize(format, width, height);
            }

            return(size);
        }
Exemple #2
0
        public static byte[] GetMipLevel(byte[] ImageData, uint Width, uint Height, uint MipCount, uint MipLevel, TextureFormats format)
        {
            uint offset = 0;

            for (int m = 0; m < MipCount; m++)
            {
                uint width  = (uint)Math.Max(1, Width >> m);
                uint height = (uint)Math.Max(1, Height >> m);

                uint size = (uint)Decode_Gamecube.GetDataSize(format, (int)width, (int)height);

                if (MipLevel == m)
                {
                    return(Utils.SubArray(ImageData, offset, size));
                }

                offset += size;
            }

            return(ImageData);
        }