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[6];
0061: LPDIRECT3DTEXTURE9 m_pTexColor[6];
0062: LPDIRECT3DTEXTURE9 m_pTexNormal[6];
0063:
0064:
0065: LPDIRECT3DVERTEXDECLARATION9 m_pDecl;
0066: LPD3DXEFFECT m_pEffect;
0067: D3DXHANDLE m_hmWVP;
0068: D3DXHANDLE m_hvEye;
0069: D3DXHANDLE m_hvLight;
0070:
0071: D3DXMATRIX m_mWorld;
0072: D3DXMATRIX m_mView;
0073: D3DXMATRIX m_mProj;
0074: D3DXVECTOR3 m_Eye;
0075:
0076: FLOAT m_fWorldRotX;
0077: FLOAT m_fWorldRotY;
0078:
0079: BOOL m_bLoadingApp;
0080: CD3DFont* m_pFont;
0081: UserInput m_UserInput;
0082:
0083: protected:
0084: virtual HRESULT OneTimeSceneInit();
0085: virtual HRESULT InitDeviceObjects();
0086: virtual HRESULT RestoreDeviceObjects();
0087: virtual HRESULT InvalidateDeviceObjects();
0088: virtual HRESULT DeleteDeviceObjects();
0089: virtual HRESULT Render();
0090: virtual HRESULT FrameMove();
0091: virtual HRESULT FinalCleanup();
0092: virtual HRESULT ConfirmDevice(D3DCAPS9*, DWORD, D3DFORMAT);
0093:
0094: HRESULT RenderText();
0095:
0096: void UpdateInput( UserInput* pUserInput );
0097: public:
0098: LRESULT MsgProc( HWND hWnd, UINT msg
0099: , WPARAM wParam, LPARAM lParam );
0100: CMyD3DApplication();
0101: virtual ~CMyD3DApplication();
0102: };
0103: