0001: //-----------------------------------------------------------------------------
0002: // File: main.h
0003: //
0004: // Desc: Header file main sample app
0005: //-----------------------------------------------------------------------------
0006: #pragma once
0007: 
0008: 
0009: 
0010: 
0011: //-----------------------------------------------------------------------------
0012: // Defines, and constants
0013: //-----------------------------------------------------------------------------
0014: // TODO: change "DirectX AppWizard Apps" to your name or the company name
0015: #define DXAPP_KEY        TEXT("Software\\DirectX AppWizard Apps\\main")
0016: 
0017: // Struct to store the current input state
0018: struct UserInput
0019: {
0020:     // TODO: change as needed
0021:     BOOL bRotateUp;
0022:     BOOL bRotateDown;
0023:     BOOL bRotateLeft;
0024:     BOOL bRotateRight;
0025:     BOOL bZoomIn;
0026:     BOOL bZoomOut;
0027: };
0028: 
0029: 
0030: 
0031: 
0032: //-----------------------------------------------------------------------------
0033: // Name: class CMyD3DApplication
0034: // Desc: Application class. The base class (CD3DApplication) provides the 
0035: //       generic functionality needed in all Direct3D samples. CMyD3DApplication 
0036: //       adds functionality specific to this sample program.
0037: //-----------------------------------------------------------------------------
0038: class CMyD3DApplication : public CD3DApplication
0039: {
0040:     CD3DMesh                *m_pMeshCar;
0041:     CD3DMesh                *m_pMeshChess;
0042:             
0043:     // シェーダ
0044:     LPD3DXEFFECT     m_pFx;     // シェーダが書かれたエフェクト
0045:     D3DXHANDLE       m_hmWVP;   // ワールド×ビュー×射影行列
0046:     D3DXHANDLE       m_hmWLP;   // ライト方向からの変換行列
0047:     D3DXHANDLE       m_hmWLPB;  // ライト方向からの変換行列
0048:     D3DXHANDLE       m_hvCol;   // メッシュの色
0049:     D3DXHANDLE       m_hvDir;   // ライトの方向
0050: 
0051: 
0052:     // シャドウマップ
0053:     LPDIRECT3DTEXTURE9      m_pShadowMap;
0054:     LPDIRECT3DSURFACE9      m_pShadowMapSurf;
0055:     LPDIRECT3DSURFACE9      m_pShadowMapZ;
0056: 
0057:     // 通常の座標変換行列
0058:     D3DXMATRIX              m_mWorld;
0059:     D3DXMATRIX              m_mView;
0060:     D3DXMATRIX              m_mProj;
0061:     D3DXMATRIX              m_mLightVP;
0062: 
0063:     D3DXVECTOR3             m_LighPos;      // 光源の方向
0064: 
0065:     BOOL                    m_bLoadingApp;  // TRUE, if the app is loading
0066:     CD3DFont*               m_pFont;        // Font for drawing text
0067:     UserInput               m_UserInput;    // Struct for storing user input 
0068: 
0069:     FLOAT                   m_fWorldRotX;   // World rotation state X-axis
0070:     FLOAT                   m_fWorldRotY;   // World rotation state Y-axis
0071:     FLOAT                   m_fViewZoom;    // 視点の距離
0072: 
0073: 
0074:     VOID DrawModel( int pass ); // 各パスで呼ばれるモデルの描画
0075: protected:
0076:     virtual HRESULT OneTimeSceneInit();
0077:     virtual HRESULT InitDeviceObjects();
0078:     virtual HRESULT RestoreDeviceObjects();
0079:     virtual HRESULT InvalidateDeviceObjects();
0080:     virtual HRESULT DeleteDeviceObjects();
0081:     virtual HRESULT Render();
0082:     virtual HRESULT FrameMove();
0083:     virtual HRESULT FinalCleanup();
0084:     virtual HRESULT ConfirmDevice( D3DCAPS9*, DWORD, D3DFORMAT );
0085: 
0086:     HRESULT RenderText();
0087: 
0088:     void    UpdateInput( UserInput* pUserInput );
0089: public:
0090:     LRESULT MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
0091:     CMyD3DApplication();
0092:     virtual ~CMyD3DApplication();
0093: };
0094: 
0095: