mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-10 22:22:10 +08:00
dds volume texture fix - img_dds.c
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user