public static int GetDataSizeWithMips(uint format, uint Width, uint Height, uint MipCount) { if (MipCount == 0) { MipCount = 1; } int size = 0; for (int m = 0; m < MipCount; m++) { uint width = (uint)Math.Max(1, Width >> m); uint height = (uint)Math.Max(1, Height >> m); size += Decode_Gamecube.GetDataSize(format, width, height); } return(size); }
private int GetImageSizeGCN() { var platform = (GamecubeSwizzle)Platform; int totalSize = 0; for (int arrayLevel = 0; arrayLevel < ArrayCount; arrayLevel++) { for (int mipLevel = 0; mipLevel < MipCount; mipLevel++) { uint width = (uint)Math.Max(1, Width >> mipLevel); uint height = (uint)Math.Max(1, Height >> mipLevel); totalSize += Decode_Gamecube.GetDataSize((uint)platform.Format, width, height); } } return(totalSize); }
public static byte[] GetMipLevel(byte[] ImageData, uint Width, uint Height, uint MipCount, uint MipLevel, TextureFormats format) { uint offset = 0; for (int m = 0; m < MipCount; m++) { uint width = (uint)Math.Max(1, Width >> m); uint height = (uint)Math.Max(1, Height >> m); uint size = (uint)Decode_Gamecube.GetDataSize(format, (int)width, (int)height); if (MipLevel == m) { return(ByteUtils.SubArray(ImageData, offset, size)); } offset += size; } return(ImageData); }