0001: //-------------------------------------------------------------
0002: // File: main.h
0003: //
0004: // Desc: レリーフテクスチャ
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: // Name: class CWave
0026: // Desc: 平面ポリゴンのオブジェクト
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: // Name: class CMyD3DApplication
0055: // Desc: アプリケーションのクラス
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;   // X軸回転
0075:     FLOAT                       m_fWorldRotY;   // Y軸回転
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: