// D3D9GraphicLayer.h: interface for the CD3D9GraphicLayer class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_D3D9GRAPHICLAYER_H__1026F404_E2F8_4612_A94C_A84F641A0C9A__INCLUDED_) #define AFX_D3D9GRAPHICLAYER_H__1026F404_E2F8_4612_A94C_A84F641A0C9A__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "Caldron.h" #include "./ExceptionMgr.h" #include "./LogMgr.h" /* ********************************************************************* * CD3D9GraphicLayer * ÆÄÀÏ : D3D9GraphicLayer.h * ±â´É : Caldron Engine³» D3D9 µð¹ÙÀ̽ºµîÀ» Å©¸®¿¡ÀÌÆ® ½ÃÄÑÁÖ´Â BaseGraphic Layer ½Ç app¿¡¼­ »ç¿ëÇÒ ½Ã¿¡ ÀÌ ·¹À̾ »ó¼Ó¹Þ¾Æ D3d Layer·Î »ç¿ëÇÑ´Ù. * ÀÛ¼ºÀÏ : 2003.10.30 * history : wizardbug ( 2003.10.30) ********************************************************************** */ namespace Caldron { namespace Base { class CD3D9GraphicLayer { public: class CD3D9WindowInfo { public: bool m_bWindowed; DWORD m_dwWidth; DWORD m_dwHeight; bool m_bD3DRunning; HINSTANCE m_hInstance; CD3D9WindowInfo() { m_bWindowed = true; m_dwWidth = 800; m_dwHeight = 600; m_bD3DRunning = true; m_hInstance = 0; } ~CD3D9WindowInfo() {} }; class CD3D9ModeInfo { public: DWORD m_dwVertexProcessing; D3DFORMAT m_ColorFormat; D3DFORMAT m_DepthStencilFormat; D3DMULTISAMPLE_TYPE m_MultiSampling; CD3D9ModeInfo() { m_dwVertexProcessing = D3DCREATE_HARDWARE_VERTEXPROCESSING; m_ColorFormat = D3DFMT_R5G6B5; m_DepthStencilFormat = D3DFMT_D16; m_MultiSampling = D3DMULTISAMPLE_NONE; } ~CD3D9ModeInfo() {} }; protected: LPDIRECT3D9 m_pD3D9Obj; static LPDIRECT3DDEVICE9 ms_pD3DDevice; HWND m_hWnd; D3DPRESENT_PARAMETERS m_PresentParameters; D3DCAPS9 m_DeviceCaps; CExceptionMgr *m_pExceptionMgr; public: static CD3D9WindowInfo m_WindowInfo; static CD3D9ModeInfo m_ModeInfo; static inline void _GetWindowSize(DWORD &dwWidth,DWORD &dwHeight) { dwWidth = m_WindowInfo.m_dwWidth; dwHeight = m_WindowInfo.m_dwHeight; } //static inline CD3D9ModeInfo _GetModeInfo() { return m_ModeInfo;} static inline LPDIRECT3DDEVICE9 _GetDevice() { return (ms_pD3DDevice != NULL) ? ms_pD3DDevice : NULL; } inline HWND GetHwnd() { return m_hWnd;} inline bool IsFullScreen() { return m_WindowInfo.m_bWindowed; } inline bool IsD3DRunning() { return m_WindowInfo.m_bD3DRunning; } // Change Fullscreen Mode HRESULT SetFullScreen(bool bWin); CD3D9GraphicLayer(); virtual ~CD3D9GraphicLayer(); // Device Create HRESULT InitD3DLayer(HINSTANCE hInstance, HWND hWnd, DWORD dwWidth, DWORD dwHeight, bool bWindowed = true, D3DFORMAT ColorFormat = D3DFMT_R5G6B5, D3DFORMAT ZFormat = D3DFMT_D16, DWORD dwVertexProcessing = D3DCREATE_HARDWARE_VERTEXPROCESSING, D3DMULTISAMPLE_TYPE Antial = D3DMULTISAMPLE_NONE ); void SaveSetting(); // Save D3D Create Info void LoadSetting(); // Load D3D Create Info // Device ·Î½ºÆ® µÇ¾ú³ª Å×½ºÆÃ HRESULT CheckDeviceLost(); // Change Bit , width, height ..etc.. HRESULT ChangeMode(DWORD dwWidth, DWORD dwHeight, D3DFORMAT Pixel, D3DFORMAT Zbuffer,UINT UIPresent = D3DPRESENT_INTERVAL_IMMEDIATE); HRESULT ChangePresentMode(UINT UIPresent = D3DPRESENT_INTERVAL_IMMEDIATE); // Àüü ¸ðµå½Ã Color Bit Áö¿øµÇ´Â°¡ check HRESULT CheckD3DFormat(bool bFullScreen,D3DFORMAT iDepth,D3DFORMAT *pFormat); D3DFORMAT Find16BitMode(); D3DFORMAT Find32BitMode(); void ReleaseAll(); virtual HRESULT CheckDeviceCaps(); virtual void InitScene(); void Render(); // ½Ç ·»´õ¸µ Äڵ尡 µé¾î°¥ ºÎºÐ Render Scene ºÎºÐ virtual void RenderScene(){}; virtual void Update(){}; virtual void Destroy(){}; }; }; }; #endif // !defined(AFX_D3D9GRAPHICLAYER_H__1026F404_E2F8_4612_A94C_A84F641A0C9A__INCLUDED_)