Exemplo n.º 1
0
        public void LoadDDS(string FileName, byte[] FileData = null)
        {
            TexName = Path.GetFileNameWithoutExtension(FileName);

            DDS dds = new DDS();

            if (FileData != null)
            {
                dds.Load(new FileReader(new MemoryStream(FileData)));
            }
            else
            {
                dds.Load(new FileReader(FileName));
            }
            MipCount    = dds.header.mipmapCount;
            TexWidth    = dds.header.width;
            TexHeight   = dds.header.height;
            arrayLength = 1;
            if (dds.header.caps2 == (uint)DDS.DDSCAPS2.CUBEMAP_ALLFACES)
            {
                arrayLength = 6;
            }
            DataBlockOutput.Add(dds.bdata);

            Format = LoadDDSFormat(dds.header.ddspf.fourCC, dds, IsSRGB);
        }
Exemplo n.º 2
0
        public void LoadBitMap(Image Image, string FileName)
        {
            DecompressedData.Clear();

            TexName = Path.GetFileNameWithoutExtension(FileName);
            Format  = (GTX.GX2SurfaceFormat)FTEX.ConvertToGx2Format(Runtime.PreferredTexFormat);

            GenerateMipmaps = true;
            LoadImage(new Bitmap(Image));
        }
Exemplo n.º 3
0
        public void LoadBitMap(string FileName)
        {
            DecompressedData.Clear();

            TexName = Path.GetFileNameWithoutExtension(FileName);

            Format          = (GTX.GX2SurfaceFormat)FTEX.ConvertToGx2Format(Runtime.PreferredTexFormat);
            GenerateMipmaps = true;

            //If a texture is .tga, we need to convert it
            Bitmap Image = null;

            if (Utils.GetExtension(FileName) == ".tga")
            {
                Image = Paloma.TargaImage.LoadTargaImage(FileName);
            }
            else
            {
                Image = new Bitmap(FileName);
            }

            LoadImage(Image);
        }
Exemplo n.º 4
0
        public void LoadBitMap(string FileName)
        {
            DecompressedData.Clear();

            TexName         = Path.GetFileNameWithoutExtension(FileName);
            Format          = GTX.GX2SurfaceFormat.T_BC1_SRGB;
            GenerateMipmaps = true;

            Bitmap Image = new Bitmap(FileName);

            Image = TextureData.SwapBlueRedChannels(Image);

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

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

            Image.Dispose();
            if (DecompressedData.Count == 0)
            {
                throw new Exception("Failed to load " + Format);
            }
        }