Several small fixes.

This commit is contained in:
Ottermandias 2022-10-03 11:36:17 +02:00
parent 6014d37bed
commit 097923f5ff
7 changed files with 314 additions and 93 deletions

View file

@ -25,6 +25,10 @@ public static class TexFileParser
}
meta.MipLevels = CountMipLevels( data, in meta, in header );
if( meta.MipLevels == 0 )
{
throw new Exception( "Could not load file. Image is corrupted and does not contain enough data for its size." );
}
var scratch = ScratchImage.Initialize( meta );
@ -142,7 +146,9 @@ public static class TexFileParser
}
for( ; idx < 13; ++idx )
{
header.OffsetToSurface[ idx ] = 0;
}
header.LodOffset[ 0 ] = 0;
header.LodOffset[ 1 ] = 1;

View file

@ -138,7 +138,7 @@ public sealed class Texture : IDisposable
try
{
var _ = System.IO.Path.GetExtension( Path ) switch
var _ = System.IO.Path.GetExtension( Path ).ToLowerInvariant() switch
{
".dds" => LoadDds(),
".png" => LoadPng(),