private void ImportBitmap(Surface Surface)
        {
            LoadedTagMeta.Bitmaps[CurrentBitmapIndex].Width = (short)Surface.Description.Width; 
            LoadedTagMeta.Bitmaps[CurrentBitmapIndex].Height = (short)Surface.Description.Height;
            LoadedTagMeta.Bitmaps[CurrentBitmapIndex].Depth = (short)Surface.Description.Depth;
            LoadedTagMeta.Bitmaps[CurrentBitmapIndex].MIPMapCount = (short)Surface.Description.MipMapCount;
            LoadedTagMeta.Bitmaps[CurrentBitmapIndex].Format = Surface.Format;
            if ((Surface.Description.Caps.Caps2 & Surface.SurfaceDescription.Capibilities.EdwCaps2.DDSCAPS2_CUBEMAP) == Surface.SurfaceDescription.Capibilities.EdwCaps2.DDSCAPS2_CUBEMAP)
                LoadedTagMeta.Bitmaps[CurrentBitmapIndex].Type = H2BitmapCollection.EType.CUBEMAPS;
            else
                LoadedTagMeta.Bitmaps[CurrentBitmapIndex].Type = H2BitmapCollection.EType.TEXTURES_2D;

            LoadedTagMeta.Bitmaps[CurrentBitmapIndex].Flags = LoadedTagMeta.Bitmaps[CurrentBitmapIndex].Width % 2 == 0 && LoadedTagMeta.Bitmaps[CurrentBitmapIndex].Height % 2 == 0 ? H2BitmapCollection.BitmapData.EFlags.Power_Of_2_Dimensions : 0;

            int infoIndex = LoadedTagMeta.Bitmaps[CurrentBitmapIndex].LOD1Offset;
            LoadedTags[CurrentTagIndex].ReplaceRaw(infoIndex, Surface.GetData());

            MemoryStream memStream = new MemoryStream();
            LoadedTagMeta.Serialize(memStream, 0, H2BitmapCollection.SizeOf, 0);
            LoadedTags[CurrentTagIndex].TagStream = memStream;

            CurrentTagIndex = CurrentTagIndex;
        }
Beispiel #2
0
 private void toolStripButton2_Click(object sender, EventArgs e)
 {
     if (openDialog.ShowDialog() == DialogResult.OK)
     {
         FileStream File = new FileStream(openDialog.FileName, FileMode.Open);
         Surface Surface = new Surface(File);
         ImportBitmap(Surface);
         RefreshBitmapInformation();
     }
 }