0001:
0002:
0003:
0004:
0005:
0006: #pragma once
0007:
0008: #define REDUCTION_MAPS 2
0009:
0010:
0011:
0012:
0013:
0014: struct UserInput
0015: {
0016: BOOL bRotateUp;
0017: BOOL bRotateDown;
0018: BOOL bRotateLeft;
0019: BOOL bRotateRight;
0020: BOOL bZoomIn;
0021: BOOL bZoomOut;
0022: BOOL bChangeShader;
0023: };
0024:
0025:
0026:
0027:
0028:
0029:
0030:
0031:
0032: class CMyD3DApplication : public CD3DApplication
0033: {
0034: int m_iState;
0035: int m_iChangeState;
0036: int m_iCount;
0037:
0038: int m_Shader;
0039:
0040: CD3DMesh *m_pMeshBg;
0041:
0042:
0043: LPD3DXEFFECT m_pEffect;
0044: D3DXHANDLE m_hTechnique;
0045: D3DXHANDLE m_hmWVP;
0046: D3DXHANDLE m_htSrcTex;
0047:
0048:
0049: LPDIRECT3DSURFACE9 m_pMapZ;
0050: LPDIRECT3DTEXTURE9 m_pPosTex;
0051: LPDIRECT3DSURFACE9 m_pPosSurf;
0052: LPDIRECT3DTEXTURE9 m_pPosLockTex;
0053: LPDIRECT3DSURFACE9 m_pPosLockSurf;
0054: LPDIRECT3DTEXTURE9 m_pNormalTex;
0055: LPDIRECT3DSURFACE9 m_pNormalSurf;
0056: LPDIRECT3DTEXTURE9 m_pNormalLockTex;
0057: LPDIRECT3DSURFACE9 m_pNormalLockSurf;
0058: LPDIRECT3DTEXTURE9 m_pDiffuseTex;
0059: LPDIRECT3DSURFACE9 m_pDiffuseSurf;
0060: LPDIRECT3DTEXTURE9 m_pFinalTex;
0061: LPDIRECT3DSURFACE9 m_pFinalSurf;
0062: LPDIRECT3DTEXTURE9 m_pReductionTex [REDUCTION_MAPS];
0063: LPDIRECT3DSURFACE9 m_pReductionSurf[REDUCTION_MAPS];
0064: LPDIRECT3DTEXTURE9 m_pMaskTex;
0065:
0066:
0067:
0068: D3DXMATRIX m_mWorld;
0069: D3DXMATRIX m_mView;
0070: D3DXMATRIX m_mProj;
0071:
0072: D3DXVECTOR3 m_LighPos;
0073:
0074: BOOL m_bLoadingApp;
0075: CD3DFont* m_pFont;
0076: UserInput m_UserInput;
0077:
0078: FLOAT m_fWorldRotX;
0079: FLOAT m_fWorldRotY;
0080: FLOAT m_fViewZoom;
0081:
0082: protected:
0083: virtual HRESULT OneTimeSceneInit();
0084: virtual HRESULT InitDeviceObjects();
0085: virtual HRESULT RestoreDeviceObjects();
0086: virtual HRESULT InvalidateDeviceObjects();
0087: virtual HRESULT DeleteDeviceObjects();
0088: virtual HRESULT Render();
0089: virtual HRESULT FrameMove();
0090: virtual HRESULT FinalCleanup();
0091: virtual HRESULT ConfirmDevice( D3DCAPS9*, DWORD, D3DFORMAT );
0092:
0093:
0094: virtual int FrameMoveCreateMap();
0095: virtual void RenderCreateMap();
0096:
0097: virtual int FrameMoveFinalGathering();
0098: virtual void RenderFinalGathering();
0099:
0100: HRESULT RenderText();
0101:
0102: void UpdateInput( UserInput* pUserInput );
0103: public:
0104: LRESULT MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
0105: CMyD3DApplication();
0106: virtual ~CMyD3DApplication();
0107: };
0108:
0109: