public void LoadDDS(string FileName, BntxFile bntxFile, byte[] FileData = null, TextureData tree = 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;

            DataBlockOutput = dds.bdata;

            Format = LoadDDSFormat(dds.header.ddspf.fourCC, dds, IsSRGB);

            Texture tex = FromBitMap(DataBlockOutput, this);

            if (tree != null)
            {
                tree.LoadTexture(tex, 1);
            }
            else
            {
                textureData = new TextureData(tex, bntxFile);
            }
        }
 private void button1_Click(object sender, EventArgs e)
 {
     if (CompressedData != null)
     {
         Texture tex = FromBitMap(CompressedData, this);
         if (textureData != null)
         {
             textureData.LoadTexture(tex, 1);
         }
         else
         {
             textureData = new TextureData(tex, bntx);
         }
     }
     else
     {
         MessageBox.Show("Something went wrong???");
     }
 }
Ejemplo n.º 3
0
        public void LoadDDS(string FileName, BntxFile bntxFile, byte[] FileData = null, TextureData tree = 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);

            var formats = dds.GetFormat();

            Format     = formats.Item1;
            FormatType = formats.Item2;

            Texture tex = FromBitMap(DataBlockOutput[0], this);

            if (tree != null)
            {
                tree.LoadTexture(tex, 1);
            }
            else
            {
                textureData = new TextureData(tex, bntxFile);
            }
        }