Пример #1
0
        public List <byte[]> GenerateMipList(int SurfaceLevel = 0)
        {
            Bitmap Image = BitmapExtension.GetBitmap(DecompressedData[SurfaceLevel], (int)TexWidth, (int)TexHeight);

            List <byte[]> mipmaps = new List <byte[]>();

            mipmaps.Add(CTR_3DS.EncodeBlock(DecompressedData[SurfaceLevel],
                                            (int)TexWidth, (int)TexHeight, Format));

            for (int mipLevel = 0; mipLevel < MipCount; mipLevel++)
            {
                int width  = Image.Width / 2;
                int height = Image.Width / 2;
                if (Format == CTR_3DS.PICASurfaceFormat.ETC1 || Format == CTR_3DS.PICASurfaceFormat.ETC1A4)
                {
                    if (width < 16)
                    {
                        break;
                    }
                    if (height < 16)
                    {
                        break;
                    }
                }
                else
                {
                    if (width < 8)
                    {
                        break;
                    }
                    if (height < 8)
                    {
                        break;
                    }
                }

                Image = BitmapExtension.Resize(Image, width, height);
                mipmaps.Add(CTR_3DS.EncodeBlock(BitmapExtension.ImageToByte(Image),
                                                Image.Width, Image.Height, Format));
            }
            Image.Dispose();

            return(mipmaps);
        }
        public List <byte[]> GenerateMipList(int SurfaceLevel = 0)
        {
            MipCount = 1;

            Bitmap Image = BitmapExtension.GetBitmap(DecompressedData[SurfaceLevel], (int)TexWidth, (int)TexHeight);

            List <byte[]> mipmaps = new List <byte[]>();

            mipmaps.Add(CTR_3DS.EncodeBlock(DecompressedData[SurfaceLevel],
                                            (int)TexWidth, (int)TexHeight, Format));

            //while (Image.Width / 2 > 0 && Image.Height / 2 > 0)
            //      for (int mipLevel = 0; mipLevel < MipCount; mipLevel++)
            for (int mipLevel = 0; mipLevel < MipCount; mipLevel++)
            {
                Image = BitmapExtension.Resize(Image, Image.Width / 2, Image.Height / 2);
                mipmaps.Add(CTR_3DS.EncodeBlock(BitmapExtension.ImageToByte(Image),
                                                Image.Width, Image.Height, Format));
            }
            Image.Dispose();

            return(mipmaps);
        }
Пример #3
0
 public byte[] EncodeImage(STGenericTexture texture, byte[] data, uint width, uint height, int array, int mip)
 {
     return(CTR_3DS.EncodeBlock(data, (int)width, (int)height, Format));
 }