private void LoadImage(Bitmap Image)
        {
            Image = BitmapExtension.SwapBlueRedChannels(Image);

            TexWidth  = (uint)Image.Width;
            TexHeight = (uint)Image.Height;
            MipCount  = (uint)STGenericTexture.GenerateTotalMipCount(TexWidth, TexHeight);

            DecompressedData.Add(BitmapExtension.ImageToByte(Image));

            Image.Dispose();
            if (DecompressedData.Count == 0)
            {
                throw new Exception("Failed to load " + Format);
            }
        }
Exemplo n.º 2
0
        public ImportedTexture(string fileName)
        {
            Name           = Path.GetFileNameWithoutExtension(fileName);
            SourceFilePath = fileName;
            TargetOutput   = TexFormat.RGBA8_UNORM;

            var bitmap = new Bitmap(SourceFilePath);

            Width  = bitmap.Width;
            Height = bitmap.Height;

            var rgbaImage = BitmapExtension.SwapBlueRedChannels(bitmap);

            rgba = BitmapExtension.ImageToByte(rgbaImage);

            bitmap.Dispose();
        }
Exemplo n.º 3
0
        private void LoadImage(Bitmap Image)
        {
            Image = BitmapExtension.SwapBlueRedChannels(Image);

            TexWidth  = (uint)Image.Width;
            TexHeight = (uint)Image.Height;
            MipCount  = (uint)GetTotalMipCount();

            if (TexWidth != Image.Width || TexHeight != Image.Height)
            {
                Image = BitmapExtension.Resize(Image, TexWidth, TexHeight);
            }

            DecompressedData.Add(STGenericTexture.ConvertBgraToRgba(BitmapExtension.ImageToByte(Image)));

            Image.Dispose();
            if (DecompressedData.Count == 0)
            {
                throw new Exception("Failed to load " + Format);
            }
        }
Exemplo n.º 4
0
        private void UpdateImage()
        {
            if (activeTexture == null)
            {
                return;
            }

            Thread = new Thread((ThreadStart)(() =>
            {
                pictureBoxCustom1.Image = Imaging.GetLoadingImage();
                var image = activeTexture.GetBitmap(0, 0);

                var mipmaps = STGenericTexture.CompressBlock(BitmapExtension.ImageToByte(activeImage),
                                                             activeImage.Width, activeImage.Height, Format, 0.5f);

                newImage = BitmapExtension.SwapBlueRedChannels(STGenericTexture.DecodeBlockGetBitmap(mipmaps, (uint)image.Width, (uint)image.Height, Format));

                pictureBoxCustom1.Image = newImage;
            }));
            Thread.Start();


            pictureBoxCustom1.Image = newImage;
        }