Beispiel #1
0
        public void LoadDDS(string FileName, byte[] FileData = null)
        {
            TexName = STGenericTexture.SetNameFromPath(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;

            var surfaces = DDS.GetArrayFaces(dds, dds.ArrayCount);

            RedComp   = dds.RedChannel;
            GreenComp = dds.GreenChannel;
            BlueComp  = dds.BlueChannel;
            AlphaComp = dds.AlphaChannel;

            foreach (var surface in surfaces)
            {
                DataBlockOutput.Add(Utils.CombineByteArray(surface.mipmaps.ToArray()));
            }

            Format = Decode_Gamecube.FromGenericFormat(dds.Format);
        }
Beispiel #2
0
        public void LoadBitMap(Image Image, string Name)
        {
            DecompressedData.Clear();

            TexName = STGenericTexture.SetNameFromPath(Name);

            Format = Decode_Gamecube.TextureFormats.CMPR;

            GenerateMipmaps = true;
            LoadImage(new Bitmap(Image));
        }
        public void Read(FileReader reader)
        {
            byte format = reader.ReadByte();

            Padding = reader.ReadByte();
            Width   = reader.ReadUInt16();
            Height  = reader.ReadUInt16();
            reader.ReadBytes(26);

            if (!FormatList.ContainsKey(format))
            {
                throw new Exception($"Unknown textue format! {format}");
            }

            Format = FormatList[format];
            var size = Decode_Gamecube.GetDataSize(Format, Width, Height);

            ImageData = reader.ReadBytes(size);
        }
Beispiel #4
0
        public void LoadBitMap(string FileName)
        {
            DecompressedData.Clear();

            TexName = STGenericTexture.SetNameFromPath(FileName);

            Format = Decode_Gamecube.TextureFormats.CMPR;

            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);
        }
Beispiel #5
0
 public GamecubeSwizzle(Decode_Gamecube.TextureFormats format, Decode_Gamecube.PaletteFormats paletteFormat)
 {
     Format        = format;
     PaletteFormat = paletteFormat;
 }
Beispiel #6
0
 public GamecubeSwizzle(Decode_Gamecube.TextureFormats format)
 {
     Format = format;
 }