dds volume texture fix - img_dds.c

This commit is contained in:
ncuxonaT
2025-11-27 23:17:18 +08:00
committed by a1batross
parent d5347a82cb
commit c7f18d7abe
+6 -2
View File
@@ -218,14 +218,15 @@ static void Image_DXTGetPixelFormat( dds_t *hdr, dds_header_dxt10_t *headerExt )
static size_t Image_DXTCalcMipmapSize( dds_t *hdr )
{
size_t buffsize = 0;
int i, width, height;
int i, width, height, depth;
// now correct buffer size
for( i = 0; i < Q_max( 1, ( hdr->dwMipMapCount )); i++ )
{
width = Q_max( 1, ( hdr->dwWidth >> i ));
height = Q_max( 1, ( hdr->dwHeight >> i ));
buffsize += Image_ComputeSize( image.type, width, height, image.depth );
depth = Q_max( 1, ( image.depth >> i ));
buffsize += Image_ComputeSize( image.type, width, height, depth );
}
return buffsize;
@@ -368,6 +369,9 @@ qboolean Image_LoadDDS( const char *name, const byte *buffer, fs_offset_t filesi
SetBits( image.flags, IMAGE_HAS_ALPHA );
if( !FBitSet( header.dsPixelFormat.dwFlags, DDS_LUMINANCE ))
SetBits( image.flags, IMAGE_HAS_COLOR );
if (image.type == PF_BGRA_32 || image.type == PF_RGBA_32)
SetBits( image.flags, IMAGE_HAS_ALPHA );
break;
}