DragonNest/Common/EternityEngine/D3DDevice9/EtDDSLoader.h
2024-12-19 09:48:26 +08:00

59 lines
No EOL
2.7 KiB
C++

#pragma once
class CEtDDSLoader
{
private:
typedef struct _DDSURFACEDESC2_32BIT
{
DWORD dwSize; // size of the DDSURFACEDESC structure
DWORD dwFlags; // determines what fields are valid
DWORD dwHeight; // height of surface to be created
DWORD dwWidth; // width of input surface
union
{
LONG lPitch; // distance to start of next line (return value only)
DWORD dwLinearSize; // Formless late-allocated optimized surface size
} DUMMYUNIONNAMEN( 1 );
union
{
DWORD dwBackBufferCount; // number of back buffers requested
DWORD dwDepth; // the depth if this is a volume texture
} DUMMYUNIONNAMEN( 5 );
union
{
DWORD dwMipMapCount; // number of mip-map levels requestde
// dwZBufferBitDepth removed, use ddpfPixelFormat one instead
DWORD dwRefreshRate; // refresh rate (used when display mode is described)
DWORD dwSrcVBHandle; // The source used in VB::Optimize
} DUMMYUNIONNAMEN( 2 );
DWORD dwAlphaBitDepth; // depth of alpha buffer requested
DWORD dwReserved; // reserved
DWORD lpSurface32; // this ptr isn't 64bit safe in the ddraw.h header
union
{
DDCOLORKEY ddckCKDestOverlay; // color key for destination overlay use
DWORD dwEmptyFaceColor; // Physical color for empty cubemap faces
} DUMMYUNIONNAMEN( 3 );
DDCOLORKEY ddckCKDestBlt; // color key for destination blt use
DDCOLORKEY ddckCKSrcOverlay; // color key for source overlay use
DDCOLORKEY ddckCKSrcBlt; // color key for source blt use
union
{
DDPIXELFORMAT ddpfPixelFormat; // pixel format description of the surface
DWORD dwFVF; // vertex format description of vertex buffers
} DUMMYUNIONNAMEN( 4 );
DDSCAPS2 ddsCaps; // direct draw surface capabilities
DWORD dwTextureStage; // stage in multitexture cascade
} DDSURFACEDESC2_32BIT;
public:
BOOL LoadTextureDataFromFile( CHAR* szFileName, BYTE** ppHeapData, DDSURFACEDESC2_32BIT** ppSurfDesc, BYTE** ppBitData, UINT* pBitSize );
UINT BitsPerPixel( D3DFORMAT fmt );
void GetSurfaceInfo( UINT width, UINT height, D3DFORMAT fmt, UINT* pNumBytes, UINT* pRowBytes, UINT* pNumRows );
D3DFORMAT GetD3D9Format( DDPIXELFORMAT ddpf );
HRESULT CreateTextureFromDDS( LPDIRECT3DDEVICE9 pDev, DDSURFACEDESC2_32BIT* pSurfDesc, BYTE* pBitData, UINT BitSize, LPDIRECT3DTEXTURE9* ppTex );
public:
HRESULT CreateDDSTextureFromFile( LPDIRECT3DDEVICE9 pDev, CHAR* szFileName, LPDIRECT3DTEXTURE9* ppTex );
};