0001:
0002:
0003:
0004:
0005:
0006: #pragma once
0007:
0008:
0009:
0010:
0011:
0012:
0013:
0014:
0015: struct UserInput
0016: {
0017: BOOL bRotateUp;
0018: BOOL bRotateDown;
0019: BOOL bRotateLeft;
0020: BOOL bRotateRight;
0021: };
0022:
0023:
0024:
0025:
0026:
0027:
0028: class CPlane {
0029: typedef struct {
0030: FLOAT p[3];
0031: FLOAT n[3];
0032: FLOAT tu, tv;
0033: }Vertex;
0034: static const DWORD FVF;
0035: static D3DVERTEXELEMENT9 CPlane::decl[];
0036:
0037: LPDIRECT3DVERTEXDECLARATION9 m_pDecl;
0038: LPDIRECT3DVERTEXBUFFER9 m_pVB;
0039: LPDIRECT3DINDEXBUFFER9 m_pIB;
0040: DWORD m_dwNumVertices;
0041: DWORD m_dwNumFaces;
0042:
0043: public:
0044: CPlane();
0045: ~CPlane();
0046:
0047: HRESULT Create ( LPDIRECT3DDEVICE9 lpD3DDev );
0048: HRESULT Render ( LPDIRECT3DDEVICE9 lpD3DDev );
0049: HRESULT DeleteDeviceObjects ();
0050: };
0051:
0052:
0053:
0054:
0055:
0056:
0057: class CMyD3DApplication : public CD3DApplication
0058: {
0059: CPlane *m_pPlane;
0060: LPDIRECT3DTEXTURE9 m_pTexDepth;
0061: LPDIRECT3DTEXTURE9 m_pTexColor;
0062:
0063:
0064: LPDIRECT3DVERTEXDECLARATION9 m_pDecl;
0065: LPD3DXEFFECT m_pEffect;
0066: D3DXHANDLE m_hmWVP;
0067: D3DXHANDLE m_hvEye;
0068:
0069: D3DXMATRIX m_mWorld;
0070: D3DXMATRIX m_mView;
0071: D3DXMATRIX m_mProj;
0072: D3DXVECTOR3 m_Eye;
0073:
0074: FLOAT m_fWorldRotX;
0075: FLOAT m_fWorldRotY;
0076:
0077: BOOL m_bLoadingApp;
0078: CD3DFont* m_pFont;
0079: UserInput m_UserInput;
0080:
0081: protected:
0082: virtual HRESULT OneTimeSceneInit();
0083: virtual HRESULT InitDeviceObjects();
0084: virtual HRESULT RestoreDeviceObjects();
0085: virtual HRESULT InvalidateDeviceObjects();
0086: virtual HRESULT DeleteDeviceObjects();
0087: virtual HRESULT Render();
0088: virtual HRESULT FrameMove();
0089: virtual HRESULT FinalCleanup();
0090: virtual HRESULT ConfirmDevice(D3DCAPS9*, DWORD, D3DFORMAT);
0091:
0092: HRESULT RenderText();
0093:
0094: void UpdateInput( UserInput* pUserInput );
0095: public:
0096: LRESULT MsgProc( HWND hWnd, UINT msg
0097: , WPARAM wParam, LPARAM lParam );
0098: CMyD3DApplication();
0099: virtual ~CMyD3DApplication();
0100: };
0101: