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