0001:
0002:
0003:
0004:
0005:
0006: #pragma once
0007:
0008:
0009:
0010:
0011:
0012:
0013:
0014:
0015: #define DXAPP_KEY TEXT("Software\\DirectX AppWizard Apps\\main")
0016:
0017:
0018: struct UserInput
0019: {
0020:
0021: BOOL bRotateUp;
0022: BOOL bRotateDown;
0023: BOOL bRotateLeft;
0024: BOOL bRotateRight;
0025: BOOL bZoomIn;
0026: BOOL bZoomOut;
0027: };
0028:
0029:
0030:
0031:
0032:
0033:
0034:
0035:
0036:
0037:
0038: class CMyD3DApplication : public CD3DApplication
0039: {
0040: CD3DMesh *m_pMeshCar;
0041: CD3DMesh *m_pMeshChess;
0042:
0043:
0044: LPD3DXEFFECT m_pFx;
0045: D3DXHANDLE m_hmWVP;
0046: D3DXHANDLE m_hmWLP;
0047: D3DXHANDLE m_hmWLPB;
0048: D3DXHANDLE m_hvCol;
0049: D3DXHANDLE m_hvDir;
0050:
0051:
0052:
0053: LPDIRECT3DTEXTURE9 m_pShadowMap;
0054: LPDIRECT3DSURFACE9 m_pShadowMapSurf;
0055: LPDIRECT3DSURFACE9 m_pShadowMapZ;
0056:
0057:
0058: D3DXMATRIX m_mWorld;
0059: D3DXMATRIX m_mView;
0060: D3DXMATRIX m_mProj;
0061: D3DXMATRIX m_mLightVP;
0062:
0063: D3DXVECTOR3 m_LighPos;
0064:
0065: BOOL m_bLoadingApp;
0066: CD3DFont* m_pFont;
0067: UserInput m_UserInput;
0068:
0069: FLOAT m_fWorldRotX;
0070: FLOAT m_fWorldRotY;
0071: FLOAT m_fViewZoom;
0072:
0073:
0074: VOID DrawModel( int pass );
0075: protected:
0076: virtual HRESULT OneTimeSceneInit();
0077: virtual HRESULT InitDeviceObjects();
0078: virtual HRESULT RestoreDeviceObjects();
0079: virtual HRESULT InvalidateDeviceObjects();
0080: virtual HRESULT DeleteDeviceObjects();
0081: virtual HRESULT Render();
0082: virtual HRESULT FrameMove();
0083: virtual HRESULT FinalCleanup();
0084: virtual HRESULT ConfirmDevice( D3DCAPS9*, DWORD, D3DFORMAT );
0085:
0086: HRESULT RenderText();
0087:
0088: void UpdateInput( UserInput* pUserInput );
0089: public:
0090: LRESULT MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
0091: CMyD3DApplication();
0092: virtual ~CMyD3DApplication();
0093: };
0094:
0095: