Skip to content

Commit 23f44ae

Browse files
committed
Added DDS support to dxCreateTexture (pixel data)
1 parent 177078e commit 23f44ae

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

MTA10/core/CPixelsManager.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ bool CPixelsManager::GetPixelsSize ( const CPixels& pixels, uint& uiOutWidth, ui
567567
//
568568
// CPixelsManager::GetPixelsFormat
569569
//
570-
// Auto detect PNG, JPEG or PLAIN
570+
// Auto detect PNG, JPEG, DDS or PLAIN
571571
//
572572
////////////////////////////////////////////////////////////////
573573
EPixelsFormatType CPixelsManager::GetPixelsFormat ( const CPixels& pixels )
@@ -583,6 +583,11 @@ EPixelsFormatType CPixelsManager::GetPixelsFormat ( const CPixels& pixels )
583583
if ( IsJpeg ( pData, uiDataSize ) )
584584
return EPixelsFormat::JPEG;
585585

586+
// Check if dds
587+
static byte ddsHeader[] = { 0x44, 0x44, 0x53, 0x20 };
588+
if ( uiDataSize >= sizeof ( ddsHeader ) && memcmp ( pData, ddsHeader, sizeof ( ddsHeader ) ) == 0 )
589+
return EPixelsFormat::DDS;
590+
586591
// Check if plain
587592
if ( uiDataSize >= 8 )
588593
{

MTA10/sdk/core/CPixelsManagerInterface.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace EPixelsFormat
1616
PLAIN,
1717
JPEG,
1818
PNG,
19+
DDS
1920
};
2021
}
2122
using EPixelsFormat::EPixelsFormatType;

0 commit comments

Comments
 (0)