210 lines
6.4 KiB
C++
210 lines
6.4 KiB
C++
#ifndef __KRESOURCEDX_H__
|
|
#define __KRESOURCEDX_H__
|
|
|
|
#include "KResource.h"
|
|
#include <D3D9.h>
|
|
|
|
class K3DRenderDeviceDX;
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
class K3DTextureDX : public K3DTexture
|
|
{
|
|
public:
|
|
K3DTextureDX( K3DRenderDeviceDX *dev );
|
|
protected:
|
|
virtual ~K3DTextureDX();
|
|
public:
|
|
|
|
bool CreateNew( DWORD width, DWORD height, DWORD usage, K3DFORMAT format, D3DPOOL pool = D3DPOOL_DEFAULT );
|
|
bool CreateNew( DWORD width, DWORD height, K3DFORMAT format, D3DPOOL pool = D3DPOOL_MANAGED, int nLevel = 1 );
|
|
bool Initialize( KStream &stream, int nQuality, D3DPOOL pool = D3DPOOL_MANAGED, K3DFORMAT fmt = K3DFMT_UNKNOWN );
|
|
|
|
virtual bool IsValid() const;
|
|
virtual void Refresh( KStream &stream, int nQuality );
|
|
virtual void LockRect( KRect *rect, void** ppBuf, int& stride );
|
|
virtual void Unlock();
|
|
|
|
virtual bool PreReload();
|
|
virtual bool Reload();
|
|
|
|
int GetOriginWidth() const { return m_origin_size.width; }
|
|
int GetOriginHeight() const { return m_origin_size.height; }
|
|
|
|
IDirect3DTexture9 *GetD3DTexture() { return m_d3dtex; }
|
|
virtual bool SaveToFile( const std::string& strFile );
|
|
|
|
virtual bool LoadFromFile( const std::string& strFile ); // 추가. bintitle.
|
|
|
|
|
|
virtual HRESULT LoadSurfaceFromSurface( K3DTexture* pDestTexture, DWORD c1, DWORD c2, DWORD c3, DWORD c4, short nMode );
|
|
|
|
protected:
|
|
bool m_bLocked;
|
|
K3DRenderDeviceDX* m_dev;
|
|
IDirect3DTexture9* m_d3dtex;
|
|
DWORD m_usage;
|
|
D3DPOOL m_pool;
|
|
K3DFORMAT m_fmt; ///< 강제 Load 포맷
|
|
|
|
KSize m_origin_size; //
|
|
};
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
class K3DRenderTargetDX : public K3DRenderTarget
|
|
{
|
|
public:
|
|
K3DRenderTargetDX( K3DRenderDeviceDX *dev );
|
|
protected:
|
|
virtual ~K3DRenderTargetDX();
|
|
|
|
public:
|
|
void Clear();
|
|
bool CreateNew( DWORD width, DWORD height, UINT nLevels, K3DFORMAT format, DWORD dwDepthUsage, bool bDepth16Bit=false );
|
|
|
|
virtual bool IsValid() const;
|
|
virtual K3DTexture *CreateCloneTexture();
|
|
virtual void CopyTo( K3DTexture *pTex );
|
|
|
|
virtual void LockRect( KRect *rect, void** ppBuf, int& stride );
|
|
virtual void Unlock();
|
|
|
|
virtual bool PreReload();
|
|
virtual bool Reload();
|
|
|
|
DWORD GetDepthUsage() { return m_dwDepthUsage; }
|
|
|
|
virtual void Refresh( KStream &stream, int nQuality ) {}
|
|
|
|
IDirect3DTexture9 *GetD3DTexture() { return m_d3dtex; }
|
|
IDirect3DSurface9 *GetDepth() { return m_pD3DDepth; }
|
|
virtual bool SaveToFile( const std::string& strFile );
|
|
|
|
protected:
|
|
bool m_bLocked;
|
|
K3DRenderDeviceDX* m_dev;
|
|
IDirect3DTexture9* m_d3dtex;
|
|
IDirect3DSurface9* m_pD3DDepth;
|
|
DWORD m_dwDepthUsage;
|
|
#ifdef _KUI_INVALIDATION
|
|
bool m_bDepth16Bit;
|
|
#endif
|
|
};
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
class K3DRenderTargetCubeDX : public K3DRenderTargetCube
|
|
{
|
|
protected:
|
|
virtual ~K3DRenderTargetCubeDX();
|
|
public:
|
|
K3DRenderTargetCubeDX( K3DRenderDeviceDX *dev );
|
|
|
|
public:
|
|
void Clear();
|
|
bool CreateNew( DWORD size, UINT nLevels, K3DFORMAT format, DWORD dwDepthUsage );
|
|
|
|
virtual bool IsValid() const;
|
|
virtual K3DTexture *CreateCloneTexture();
|
|
virtual void CopyTo( K3DTexture *pTex );
|
|
|
|
virtual void LockRect( KRect *rect, void** ppBuf, int& stride );
|
|
virtual void Unlock();
|
|
|
|
virtual bool PreReload();
|
|
virtual bool Reload();
|
|
|
|
DWORD GetDepthUsage() { return m_dwDepthUsage; }
|
|
|
|
virtual void Refresh( KStream &stream, int nQuality ) {}
|
|
|
|
IDirect3DCubeTexture9 *GetD3DCubeTexture() { return m_d3dcubetex; }
|
|
IDirect3DSurface9 *GetDepth() { return m_pD3DDepth; }
|
|
|
|
void GetCubeMapSurface( K3DRenderTargetCubeDX* pCubeTexture, D3DCUBEMAP_FACES cubeFace );
|
|
|
|
protected:
|
|
bool m_bLocked;
|
|
K3DRenderDeviceDX* m_dev;
|
|
IDirect3DCubeTexture9* m_d3dcubetex;
|
|
IDirect3DSurface9* m_pD3DDepth;
|
|
DWORD m_dwDepthUsage;
|
|
|
|
};
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
class K3DIndexBufferDX : public K3DIndexBuffer
|
|
{
|
|
public:
|
|
K3DIndexBufferDX( K3DRenderDeviceDX *dev );
|
|
protected:
|
|
virtual ~K3DIndexBufferDX();
|
|
public:
|
|
bool CreateNew( int count, bool use32bit = false );
|
|
bool Initialize( KStream &stream, int count, bool use32bit = false );
|
|
|
|
virtual void Lock( void** ppBuf, int& size, DWORD flags = 0);
|
|
virtual void Unlock();
|
|
|
|
virtual bool PreReload();
|
|
virtual bool Reload();
|
|
|
|
IDirect3DIndexBuffer9* GetD3DIndexBuffer() const { return m_d3dib; }
|
|
protected:
|
|
K3DRenderDeviceDX* m_dev;
|
|
IDirect3DIndexBuffer9* m_d3dib;
|
|
bool m_bLocked;
|
|
};
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
class K3DVertexBufferDX : public K3DVertexBuffer
|
|
{
|
|
public:
|
|
/// Speed Tree 때문에 추가 ;;;
|
|
K3DVertexBufferDX();
|
|
K3DVertexBufferDX( K3DRenderDeviceDX *dev );
|
|
protected:
|
|
virtual ~K3DVertexBufferDX();
|
|
public:
|
|
|
|
/// 재사용
|
|
virtual void Recycle();
|
|
|
|
/// 작업중~
|
|
bool CreateNewBlend( unsigned int nStride, int count, int vertexformat );
|
|
bool CreateNewPoolDefault( unsigned int nStride, int count, int vertexformat, DWORD Usage );
|
|
bool CreateNewSpeedTree( unsigned int nStride, DWORD Usage, int count, int vertexformat );
|
|
bool CreateNewSpeedGrass( unsigned int nStride, DWORD Usage, int count, int vertexformat );
|
|
|
|
bool CreateNew( int vertexformat, int count );
|
|
bool Initialize( KStream &stream, int vertexformat, int count );
|
|
|
|
virtual void Lock( void** ppBuf, int& size, DWORD flags = 0);
|
|
virtual void Unlock();
|
|
|
|
virtual bool Backup();
|
|
virtual bool PreReload();
|
|
virtual bool Reload();
|
|
|
|
virtual bool IsLock() { return m_bLocked; }
|
|
|
|
IDirect3DVertexBuffer9* GetD3DVertexBuffer() const { return m_d3dvb; }
|
|
protected:
|
|
K3DRenderDeviceDX* m_dev;
|
|
IDirect3DVertexBuffer9* m_d3dvb;
|
|
volatile bool m_bLocked;
|
|
|
|
void* m_pBackUpBuf; ///< Device Lost 처리
|
|
|
|
bool m_bIsDeviceLost; ///< Device Lost
|
|
};
|
|
|
|
#endif |