0001:
0002:
0003:
0004:
0005:
0006:
0007: #pragma once
0008:
0009:
0010:
0011:
0012:
0013:
0014:
0015:
0016:
0017: struct UserInput
0018: {
0019: BOOL bRotateUp;
0020: BOOL bRotateDown;
0021: BOOL bRotateLeft;
0022: BOOL bRotateRight;
0023: BOOL bZoomIn;
0024: BOOL bZoomOut;
0025: BOOL bChangeShader;
0026: BOOL bPause;
0027: };
0028:
0029:
0030:
0031:
0032:
0033:
0034:
0035:
0036:
0037:
0038: class CMyD3DApplication : public CD3DApplication
0039: {
0040: enum{
0041: L_MAX = 1,
0042: TEX_MAX = ((L_MAX+1)*(L_MAX+1)+3)/4,
0043:
0044: REDUCTION_MAPS = 3,
0045: };
0046:
0047:
0048: int m_iState;
0049: int m_iChangeState;
0050: int m_iCount;
0051: bool m_bPause;
0052:
0053:
0054: CD3DMesh *m_pMesh;
0055: CD3DMesh *m_pMeshBg;
0056: CD3DMesh *m_pMeshEnv;
0057:
0058:
0059: D3DXVECTOR3 m_pos;
0060: D3DXVECTOR3 m_vel;
0061: D3DXVECTOR3 m_rot;
0062: D3DXVECTOR3 m_omega;
0063:
0064:
0065: int m_Shader;
0066: LPD3DXEFFECT m_pEffect;
0067: D3DXHANDLE m_hTechnique;
0068: D3DXHANDLE m_hmWV;
0069: D3DXHANDLE m_hmWVP;
0070: D3DXHANDLE m_htSrcTex;
0071: D3DXHANDLE m_fWidth;
0072: D3DXHANDLE m_fHeight;
0073:
0074:
0075: LPDIRECT3DSURFACE9 m_pMapZ;
0076: LPDIRECT3DTEXTURE9 m_pPosTex;
0077: LPDIRECT3DSURFACE9 m_pPosSurf;
0078: LPDIRECT3DTEXTURE9 m_pPosLockTex;
0079: LPDIRECT3DSURFACE9 m_pPosLockSurf;
0080: LPDIRECT3DTEXTURE9 m_pNormalTex;
0081: LPDIRECT3DSURFACE9 m_pNormalSurf;
0082: LPDIRECT3DTEXTURE9 m_pNormalLockTex;
0083: LPDIRECT3DSURFACE9 m_pNormalLockSurf;
0084:
0085: LPDIRECT3DTEXTURE9 m_pParaboloidTex[2];
0086: LPDIRECT3DSURFACE9 m_pParaboloidSurf[2];
0087: LPDIRECT3DTEXTURE9 m_pJacobianTex[TEX_MAX][2];
0088:
0089: LPDIRECT3DTEXTURE9 m_pReductionTex [REDUCTION_MAPS];
0090: LPDIRECT3DSURFACE9 m_pReductionSurf[REDUCTION_MAPS];
0091:
0092: LPDIRECT3DTEXTURE9 m_p64Tex ;
0093: LPDIRECT3DSURFACE9 m_p64Surf;
0094: LPDIRECT3DTEXTURE9 m_p8Tex ;
0095: LPDIRECT3DSURFACE9 m_p8Surf;
0096:
0097: LPDIRECT3DTEXTURE9 m_pFinalTex[TEX_MAX];
0098: LPDIRECT3DSURFACE9 m_pFinalSurf[TEX_MAX];
0099: LPDIRECT3DTEXTURE9 m_pMaskTex;
0100: #ifdef NV3X
0101: LPDIRECT3DTEXTURE9 m_pPrtTex;
0102: #endif
0103:
0104:
0105: D3DXMATRIX m_mWorld;
0106: D3DXMATRIX m_mView;
0107: D3DXMATRIX m_mProj;
0108:
0109: FLOAT m_fWorldRotX;
0110: FLOAT m_fWorldRotY;
0111: FLOAT m_fViewZoom;
0112:
0113: BOOL m_bLoadingApp;
0114: CD3DFont* m_pFont;
0115: UserInput m_UserInput;
0116:
0117: protected:
0118: virtual HRESULT OneTimeSceneInit();
0119: virtual HRESULT InitDeviceObjects();
0120: virtual HRESULT RestoreDeviceObjects();
0121: virtual HRESULT InvalidateDeviceObjects();
0122: virtual HRESULT DeleteDeviceObjects();
0123: virtual HRESULT Render();
0124: virtual HRESULT FrameMove();
0125: virtual HRESULT FinalCleanup();
0126: virtual HRESULT ConfirmDevice( D3DCAPS9*, DWORD, D3DFORMAT );
0127:
0128: int FrameMoveCreateMap();
0129: void RenderCreateMap();
0130: int FrameMovePRT();
0131: void RenderPRT();
0132: void RenderParaboloidMap();
0133:
0134: HRESULT RenderText();
0135:
0136: void UpdateInput( UserInput* pUserInput );
0137: public:
0138: LRESULT MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
0139: CMyD3DApplication();
0140: virtual ~CMyD3DApplication();
0141: };
0142:
0143: