0001:
0002:
0003:
0004:
0005:
0006:
0007: #pragma once
0008:
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: BOOL bPause;
0024: };
0025:
0026:
0027:
0028:
0029:
0030:
0031:
0032:
0033:
0034:
0035: class CMyD3DApplication : public CD3DApplication
0036: {
0037:
0038: bool m_bPause;
0039:
0040:
0041: CD3DMesh *m_pMesh;
0042: CD3DMesh *m_pMeshBg;
0043: CD3DMesh *m_pMeshEnv;
0044:
0045:
0046: D3DXVECTOR3 m_pos;
0047: D3DXVECTOR3 m_vel;
0048: D3DXVECTOR3 m_rot;
0049: D3DXVECTOR3 m_omega;
0050:
0051:
0052: LPD3DXEFFECT m_pEffect;
0053: D3DXHANDLE m_hTechnique;
0054: D3DXHANDLE m_hmWV;
0055: D3DXHANDLE m_hmWVP;
0056: D3DXHANDLE m_htSrcTex;
0057: D3DXHANDLE m_fWidth;
0058: D3DXHANDLE m_fHeight;
0059:
0060:
0061: LPDIRECT3DSURFACE9 m_pMapZ;
0062: LPDIRECT3DTEXTURE9 m_pParaboloidTex[2];
0063: LPDIRECT3DSURFACE9 m_pParaboloidSurf[2];
0064: LPDIRECT3DTEXTURE9 m_pTetrahedronTex[4];
0065: LPDIRECT3DSURFACE9 m_pTetrahedronSurf[4];
0066:
0067:
0068: D3DXMATRIX m_mWorld;
0069: D3DXMATRIX m_mView;
0070: D3DXMATRIX m_mProj;
0071:
0072: D3DXMATRIX m_mViewTetrahedron[4];
0073: D3DXMATRIX m_mProjTetrahedron;
0074:
0075: LPDIRECT3DVERTEXBUFFER9 m_pVB;
0076: LPDIRECT3DINDEXBUFFER9 m_pIB;
0077:
0078: FLOAT m_fWorldRotX;
0079: FLOAT m_fWorldRotY;
0080: FLOAT m_fViewZoom;
0081:
0082: BOOL m_bLoadingApp;
0083: CD3DFont* m_pFont;
0084: UserInput m_UserInput;
0085:
0086: protected:
0087: virtual HRESULT OneTimeSceneInit();
0088: virtual HRESULT InitDeviceObjects();
0089: virtual HRESULT RestoreDeviceObjects();
0090: virtual HRESULT InvalidateDeviceObjects();
0091: virtual HRESULT DeleteDeviceObjects();
0092: virtual HRESULT Render();
0093: virtual HRESULT FrameMove();
0094: virtual HRESULT FinalCleanup();
0095: virtual HRESULT ConfirmDevice( D3DCAPS9*, DWORD, D3DFORMAT );
0096:
0097: void RenderParaboloidMap();
0098: void DeleteQuad( );
0099: void RenderQuad();
0100: void InitQuad( );
0101:
0102: HRESULT RenderText();
0103:
0104: void UpdateInput( UserInput* pUserInput );
0105: public:
0106: LRESULT MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
0107: CMyD3DApplication();
0108: virtual ~CMyD3DApplication();
0109: };
0110:
0111: