public void Save(string fileName, List <Surface> surfaces) { List <byte[]> dataList = new List <byte[]>(); foreach (var surface in surfaces) { dataList.Add(ByteUtils.CombineArray(surface.mipmaps.ToArray())); } ImageData = ByteUtils.CombineArray(dataList.ToArray()); dataList.Clear(); Save(fileName); }
public void Export(STGenericTexture texture, TextureExportSettings settings, string filePath) { List <Surface> surfaces = texture.GetSurfaces(settings.ArrayLevel, settings.ExportArrays); var format = texture.Platform.OutputFormat; ASTC atsc = new ASTC(); atsc.Width = texture.Width; atsc.Height = texture.Height; atsc.Depth = texture.Depth; atsc.BlockDimX = (byte)TextureFormatHelper.GetBlockWidth(format); atsc.BlockDimY = (byte)TextureFormatHelper.GetBlockHeight(format); atsc.BlockDimZ = (byte)TextureFormatHelper.GetBlockDepth(format); atsc.DataBlock = ByteUtils.CombineArray(surfaces[0].mipmaps.ToArray()); atsc.Save(new System.IO.FileStream(filePath, System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite)); }
public override void SetImageData(List <byte[]> imageData, uint width, uint height, int arrayLevel = 0) { Width = width; Height = height; ImageData = ByteUtils.CombineArray(imageData.ToArray()); }