Further fixes.

This commit is contained in:
Ottermandias 2022-09-29 13:50:52 +02:00
parent fabe2a9a16
commit 6014d37bed
3 changed files with 4 additions and 3 deletions

View file

@ -131,7 +131,7 @@ public partial class CombinedTexture : IDisposable
private static ScratchImage AddMipMaps( ScratchImage input, bool mipMaps ) private static ScratchImage AddMipMaps( ScratchImage input, bool mipMaps )
=> mipMaps => mipMaps
? input.GenerateMipMaps( Math.Min( 13, 1 + BitOperations.Log2( ( uint )Math.Max( input.Meta.Width, input.Meta.Height ) ) ) ) ? input.GenerateMipMaps( Math.Min( 13, 1 + BitOperations.Log2( ( uint )Math.Max( input.Meta.Width, input.Meta.Height ) ) ), FilterFlags.SeparateAlpha )
: input; : input;
private static ScratchImage CreateUncompressed( ScratchImage input, bool mipMaps ) private static ScratchImage CreateUncompressed( ScratchImage input, bool mipMaps )

View file

@ -41,6 +41,7 @@ public static class TexFileParser
var lastOffset = 0L; var lastOffset = 0L;
var lastSize = 80L; var lastSize = 80L;
var minSize = meta.Format.IsCompressed() ? 4 : 1;
for( var i = 0; i < 13; ++i ) for( var i = 0; i < 13; ++i )
{ {
var offset = header.OffsetToSurface[ i ]; var offset = header.OffsetToSurface[ i ];
@ -61,8 +62,8 @@ public static class TexFileParser
return i; return i;
} }
width = Math.Max( width / 2, 1 ); width = Math.Max( width / 2, minSize );
height = Math.Max( height / 2, 1 ); height = Math.Max( height / 2, minSize );
lastOffset = offset; lastOffset = offset;
lastSize = requiredSize; lastSize = requiredSize;
} }

Binary file not shown.