Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
118 lines
2.3 KiB
C++
118 lines
2.3 KiB
C++
// Z3DTexture.h: interface for the Z3DTexture class.
|
||
//
|
||
//////////////////////////////////////////////////////////////////////
|
||
|
||
#if !defined(AFX_Z3DTEXTURE_H__DDBD9A61_EC01_11D4_AD2B_0000E8EB4C69__INCLUDED_)
|
||
#define AFX_Z3DTEXTURE_H__DDBD9A61_EC01_11D4_AD2B_0000E8EB4C69__INCLUDED_
|
||
|
||
#if _MSC_VER > 1000
|
||
#pragma once
|
||
#endif // _MSC_VER > 1000
|
||
|
||
#include "misc.h"
|
||
#include "SimpleString.h"
|
||
#include <d3d8.h>
|
||
#include <d3dx8.h>
|
||
|
||
#include <stdio.h>
|
||
#include <dds.h>
|
||
|
||
struct Z3DTextureCacheNode
|
||
{
|
||
long lWidth;
|
||
long lHeight;
|
||
long lMipCount;
|
||
D3DFORMAT format;
|
||
IDirect3DTexture8* pTexture;
|
||
|
||
Z3DTextureCacheNode* pNext;
|
||
};
|
||
|
||
|
||
struct Z3DTexture
|
||
{
|
||
public:
|
||
Z3DTexture()
|
||
{
|
||
m_pTexture = NULL;
|
||
}
|
||
|
||
~Z3DTexture();
|
||
|
||
bool Create( int x, int y )
|
||
{
|
||
return SUCCEEDED( D3DXCreateTexture( ms_pDevice, x, y, 10, 0, D3DFMT_A1R5G5B5,
|
||
D3DPOOL_DEFAULT, &m_pTexture ) );
|
||
return true;
|
||
}
|
||
|
||
bool Load( const char* szFileName, UINT width = 0, UINT height = 0 );
|
||
bool Save( const char* szFilename );
|
||
|
||
bool Convert( const D3DFORMAT targetFormat );
|
||
|
||
bool ReadDDSheader( const char* szFileName, DDS_HEADER* pHeader );
|
||
bool LoadAllMipSurfaces(LPDIRECT3DBASETEXTURE8 ptex,long numMips, FILE *fp);
|
||
|
||
bool IsEmpty()
|
||
{
|
||
return (NULL == m_pTexture);
|
||
}
|
||
|
||
void Flush()
|
||
{
|
||
SAFE_RELEASE( m_pTexture );
|
||
}
|
||
|
||
D3DFORMAT GetTextureFormat()
|
||
{
|
||
if( NULL == m_pTexture )
|
||
{
|
||
return D3DFMT_UNKNOWN;
|
||
}
|
||
|
||
D3DSURFACE_DESC sd;
|
||
m_pTexture->GetLevelDesc( 0, &sd );
|
||
|
||
return sd.Format;
|
||
}
|
||
|
||
operator IDirect3DTexture8* ()
|
||
{
|
||
return m_pTexture;
|
||
}
|
||
|
||
|
||
|
||
static bool _Init( IDirect3DDevice8* pDevice, const char* szPath, long level = 0, long lMaxCacheCount = 20 );
|
||
|
||
static void _Close();
|
||
|
||
static long _GetDetailLevel()
|
||
{
|
||
return ms_lDetailLevel;
|
||
}
|
||
|
||
static IDirect3DTexture8* _GetD3DTextureInterface( long lWidth, long lHeight, long lMipCount, D3DFORMAT fmt );
|
||
static void _ReleaseD3DTextureInterface( IDirect3DTexture8* pTexture );
|
||
char m_strName[256];
|
||
|
||
protected:
|
||
IDirect3DTexture8* m_pTexture;
|
||
|
||
static IDirect3DDevice8* ms_pDevice;
|
||
//static char* ms_szDataPath;
|
||
static SimpleString ms_strDataPath;
|
||
|
||
static long ms_lDetailLevel;
|
||
|
||
// ij<><C4B3> <20><><EFBFBD><EFBFBD>Ʈ. SLL <20≯<EFBFBD> <20>߰<EFBFBD><DFB0><EFBFBD> header, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> tail <20><><EFBFBD><EFBFBD> <20>Ͼ
|
||
static long ms_lMaxCacheCount;
|
||
static long ms_lCacheCount;
|
||
static Z3DTextureCacheNode* ms_pCacheChainHeader;
|
||
|
||
|
||
};
|
||
|
||
#endif // !defined(AFX_Z3DTEXTURE_H__DDBD9A61_EC01_11D4_AD2B_0000E8EB4C69__INCLUDED_)
|