|
|
@ -51,13 +51,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
|
|
// //
|
|
|
|
// //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
#if HS_BUILD_FOR_WIN32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "hsConfig.h" |
|
|
|
#include "hsConfig.h" |
|
|
|
#include "hsWindows.h" |
|
|
|
#include "hsWindows.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if HS_BUILD_FOR_WIN32 |
|
|
|
#include <ddraw.h> |
|
|
|
#include <ddraw.h> |
|
|
|
#include <d3d9.h> |
|
|
|
#include <d3d9.h> |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#include "hsTypes.h" |
|
|
|
#include "hsTypes.h" |
|
|
|
#include "hsDXTDirectXCodec.h" |
|
|
|
#include "hsDXTDirectXCodec.h" |
|
|
@ -65,6 +66,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com |
|
|
|
#include "hsCodecManager.h" |
|
|
|
#include "hsCodecManager.h" |
|
|
|
#include "plPipeline/hsGDDrawDllLoad.h" |
|
|
|
#include "plPipeline/hsGDDrawDllLoad.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if HS_BUILD_FOR_WIN32 |
|
|
|
namespace { |
|
|
|
namespace { |
|
|
|
typedef HRESULT(WINAPI * DIRECTDRAWCREATEEX)( GUID*, VOID**, REFIID, IUnknown* ); |
|
|
|
typedef HRESULT(WINAPI * DIRECTDRAWCREATEEX)( GUID*, VOID**, REFIID, IUnknown* ); |
|
|
|
} |
|
|
|
} |
|
|
@ -75,6 +77,7 @@ enum |
|
|
|
D3DTEXTURE_FMT_FOURCC_DXT1 = 0x00002000, // No.14: DXTn FourCC (DXT1), format.
|
|
|
|
D3DTEXTURE_FMT_FOURCC_DXT1 = 0x00002000, // No.14: DXTn FourCC (DXT1), format.
|
|
|
|
D3DTEXTURE_FMT_FOURCC_DXT5 = 0x00020000, // No.18: DXTn FourCC (DXT5), format.
|
|
|
|
D3DTEXTURE_FMT_FOURCC_DXT5 = 0x00020000, // No.18: DXTn FourCC (DXT5), format.
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
hsBool hsDXTDirectXCodec::fRegistered = false; |
|
|
|
hsBool hsDXTDirectXCodec::fRegistered = false; |
|
|
|
|
|
|
|
|
|
|
@ -93,6 +96,7 @@ hsDXTDirectXCodec::hsDXTDirectXCodec() : fDirectDraw( nil ), fDDLibraryInstance( |
|
|
|
|
|
|
|
|
|
|
|
hsDXTDirectXCodec::~hsDXTDirectXCodec() |
|
|
|
hsDXTDirectXCodec::~hsDXTDirectXCodec() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
#if HS_BUILD_FOR_WIN32 |
|
|
|
if ((fFlags & kExternalInit) == 0) |
|
|
|
if ((fFlags & kExternalInit) == 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (fDirectDraw) |
|
|
|
if (fDirectDraw) |
|
|
@ -108,6 +112,7 @@ hsDXTDirectXCodec::~hsDXTDirectXCodec() |
|
|
|
|
|
|
|
|
|
|
|
fDirectDraw = nil; |
|
|
|
fDirectDraw = nil; |
|
|
|
fDDLibraryInstance = nil; |
|
|
|
fDDLibraryInstance = nil; |
|
|
|
|
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
hsBool hsDXTDirectXCodec::Register() |
|
|
|
hsBool hsDXTDirectXCodec::Register() |
|
|
@ -115,6 +120,7 @@ hsBool hsDXTDirectXCodec::Register() |
|
|
|
return hsCodecManager::Instance().Register( &(Instance()), plMipmap::kDirectXCompression, 500 ); |
|
|
|
return hsCodecManager::Instance().Register( &(Instance()), plMipmap::kDirectXCompression, 500 ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if HS_BUILD_FOR_WIN32 |
|
|
|
//// Initialize ///////////////////////////////////////////////////////////////
|
|
|
|
//// Initialize ///////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
void hsDXTDirectXCodec::Initialize( IDirect3DDevice8 *directDraw ) |
|
|
|
void hsDXTDirectXCodec::Initialize( IDirect3DDevice8 *directDraw ) |
|
|
@ -161,6 +167,7 @@ hsBool hsDXTDirectXCodec::IInitialize() |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
//// CreateCompressedMipmap ///////////////////////////////////////////////////
|
|
|
|
//// CreateCompressedMipmap ///////////////////////////////////////////////////
|
|
|
|
// Updated 8.15.2000 mcn to generate uncompressed mipmaps down to 1x1 (the
|
|
|
|
// Updated 8.15.2000 mcn to generate uncompressed mipmaps down to 1x1 (the
|
|
|
@ -169,6 +176,7 @@ hsBool hsDXTDirectXCodec::IInitialize() |
|
|
|
|
|
|
|
|
|
|
|
plMipmap *hsDXTDirectXCodec::CreateCompressedMipmap( plMipmap *uncompressed ) |
|
|
|
plMipmap *hsDXTDirectXCodec::CreateCompressedMipmap( plMipmap *uncompressed ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
#if HS_BUILD_FOR_WIN32 |
|
|
|
const plMipmap *b = uncompressed; |
|
|
|
const plMipmap *b = uncompressed; |
|
|
|
plMipmap *compressed = nil; |
|
|
|
plMipmap *compressed = nil; |
|
|
|
|
|
|
|
|
|
|
@ -273,6 +281,9 @@ plMipmap *hsDXTDirectXCodec::CreateCompressedMipmap( plMipmap *uncompressed ) |
|
|
|
|
|
|
|
|
|
|
|
/// All done!
|
|
|
|
/// All done!
|
|
|
|
return compressed; |
|
|
|
return compressed; |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
return nil; |
|
|
|
|
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//// CreateUncompressedMipmap /////////////////////////////////////////////////
|
|
|
|
//// CreateUncompressedMipmap /////////////////////////////////////////////////
|
|
|
@ -418,6 +429,7 @@ plMipmap *hsDXTDirectXCodec::CreateUncompressedMipmap( plMipmap *compressed, |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if HS_BUILD_FOR_WIN32 |
|
|
|
UInt32 hsDXTDirectXCodec::ICompressedFormat(const plMipmap *uncompressed) |
|
|
|
UInt32 hsDXTDirectXCodec::ICompressedFormat(const plMipmap *uncompressed) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if( uncompressed->GetFlags() & plMipmap::kAlphaChannelFlag ) |
|
|
|
if( uncompressed->GetFlags() & plMipmap::kAlphaChannelFlag ) |
|
|
@ -1236,10 +1248,9 @@ void hsDXTDirectXCodec::CheckErrorCode(HRESULT res) |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
hsBool hsDXTDirectXCodec::ColorizeCompMipmap( plMipmap *bMap, const UInt8 *colorMask ) |
|
|
|
hsBool hsDXTDirectXCodec::ColorizeCompMipmap( plMipmap *bMap, const UInt8 *colorMask ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|