DdsImage IBitmap.ToDds(int index) { if (index < 0 || index >= 1) { throw new ArgumentOutOfRangeException(nameof(index)); } byte[] data; using (var reader = item.Container.CreateReader()) { var size = Height * Width * MapCount * Format.Bpp() / 8; reader.Seek(item.Address + DataOffset, SeekOrigin.Begin); data = reader.ReadBytes(size); } if (isBigEndian) { var unitSize = Format.LinearUnitSize(); if (unitSize > 1) { for (int i = 0; i < data.Length; i += unitSize) { Array.Reverse(data, i, unitSize); } } } return(TextureUtils.GetDds(Height * MapCount, Width, Format, false, data)); //if (MapCount == 6) //{ // dds.TextureFlags = TextureFlags.DdsSurfaceFlagsCubemap; // dds.CubemapFlags = CubemapFlags.DdsCubemapAllFaces; // dds.DX10ResourceFlags = D3D10ResourceMiscFlags.TextureCube; //} }