www.pudn.com > waterworld_src_exe.rar > waterworld.h


//----------------------------------------------------------------------------- 
// File: waterworld.h 
// 
// Desc: Header file waterworld sample app 
//----------------------------------------------------------------------------- 
#pragma once 
 
 
 
 
//----------------------------------------------------------------------------- 
// Defines, and constants 
//----------------------------------------------------------------------------- 
// TODO: change "DirectX AppWizard Apps" to your name or the company name 
#define DXAPP_KEY        TEXT("Software\\DirectX AppWizard Apps\\waterworld") 
 
// Struct to store the current input state 
struct UserInput 
{ 
    // TODO: change as needed 
    BOOL bRotateUp; 
    BOOL bRotateDown; 
    BOOL bRotateLeft; 
    BOOL bRotateRight; 
}; 
 
 
 
 
//----------------------------------------------------------------------------- 
// Name: class CMyD3DApplication 
// Desc: Application class. The base class (CD3DApplication) provides the  
//       generic functionality needed in all Direct3D samples. CMyD3DApplication  
//       adds functionality specific to this sample program. 
//----------------------------------------------------------------------------- 
class CMyD3DApplication : public CD3DApplication 
{ 
    BOOL                    m_bLoadingApp;          // TRUE, if the app is loading 
    CD3DFont*               m_pFont;                // Font for drawing text 
    UserInput               m_UserInput;            // Struct for storing user input  
 
    FLOAT                   m_fWorldRotX;           // World rotation state X-axis 
    FLOAT                   m_fWorldRotY;           // World rotation state Y-axis 
 
	CD3DFont*	m_pStatsFont; 
    CD3DFont*	m_pSmallFont; 
 
	DWORD m_dwVertSize; 
	DWORD m_dwNumVerts; 
	DWORD m_dwNumFaces; 
	LPDIRECT3DVERTEXBUFFER9 m_pVertBuff; 
	LPDIRECT3DINDEXBUFFER9 m_pIndxBuff; 
	LPDIRECT3DVERTEXBUFFER9 m_pSkyBoxVertBuff; 
	LPDIRECT3DINDEXBUFFER9 m_pSkyBoxIndxBuff; 
	LPDIRECT3DTEXTURE9 m_pTex; 
	LPDIRECT3DTEXTURE9 m_pHeightTex; 
	LPDIRECT3DTEXTURE9 m_psBumpMap;         // The actual bumpmap 
	LPDIRECT3DCUBETEXTURE9 m_pCubeTex; 
 
	D3DXMATRIX  m_matWorld, m_matView, m_matProj, m_matInitial; 
 
	BOOL        m_bShowHelp; 
	BOOL        m_bVertexShader; 
	BOOL        m_bPixelShader; 
	BOOL        m_bZBuffer; 
 
	float       m_fXCenter; 
	float       m_fYCenter; 
	float       m_fZCenter; 
	float       m_fCamXPos; 
	float       m_fCamYPos; 
	float       m_fCamZPos; 
 
    HRESULT InitBumpMap(); 
 
    IDirect3DVertexShader9*     m_pVertexShader; 
    IDirect3DPixelShader9*       m_pPixelShader; 
    LPDIRECT3DVERTEXDECLARATION9 m_pVertexDeclaration; 
 
protected: 
    virtual HRESULT OneTimeSceneInit(); 
    virtual HRESULT InitDeviceObjects(); 
    virtual HRESULT RestoreDeviceObjects(); 
    virtual HRESULT InvalidateDeviceObjects(); 
    virtual HRESULT DeleteDeviceObjects(); 
    virtual HRESULT Render(); 
    virtual HRESULT FrameMove(); 
    virtual HRESULT FinalCleanup(); 
    virtual HRESULT ConfirmDevice( D3DCAPS9*, DWORD, D3DFORMAT ); 
 
    HRESULT RenderText(); 
 
    void    UpdateInput( UserInput* pUserInput ); 
    VOID    ReadSettings(); 
    VOID    WriteSettings(); 
 
public: 
    LRESULT MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ); 
    CMyD3DApplication(); 
    virtual ~CMyD3DApplication(); 
};