0001: //-----------------------------------------------------------------------------
0002: // File: main.h
0003: //
0004: // Desc: Header file main sample app
0005: //-----------------------------------------------------------------------------
0006: #pragma once
0007: #include "CShadowVolume.h"
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: };
0026: 
0027: 
0028: 
0029: //-----------------------------------------------------------------------------
0030: // 全画面描画ポリゴン
0031: //-----------------------------------------------------------------------------
0032: class CBigSquare {
0033: private:
0034:     typedef struct {
0035:         D3DXVECTOR4 p;
0036:         D3DCOLOR    color;
0037:     } SHADOWVERTEX;
0038:     static const DWORD FVF;
0039: 
0040:     LPDIRECT3DVERTEXBUFFER9 m_pVB;
0041: public:
0042:     CBigSquare();
0043:     HRESULT     Create( LPDIRECT3DDEVICE9 pd3dDevice );
0044:     void        RestoreDeviceObjects( FLOAT sx, FLOAT sy );
0045:     void        Destroy();
0046:     void        Render( LPDIRECT3DDEVICE9 pd3dDevice );
0047: };
0048: 
0049: //-----------------------------------------------------------------------------
0050: // Name: class CMyD3DApplication
0051: // Desc: Application class. The base class (CD3DApplication) provides the 
0052: //       generic functionality needed in all Direct3D samples. CMyD3DApplication 
0053: //       adds functionality specific to this sample program.
0054: //-----------------------------------------------------------------------------
0055: class CMyD3DApplication : public CD3DApplication
0056: {
0057:     CBigSquare*             m_pBigSquare;           // 影描画用全画面ポリゴン
0058:     CD3DMesh*               m_pMeshBG;              // 背景モデル
0059:     CD3DMesh*               m_pMeshBox;             // 箱モデル
0060:     CShadowVolume*          m_pShadowBox;           // 箱モデルの影
0061: 
0062:     // シェーダ
0063:     LPD3DXEFFECT            m_pFx;     // シェーダが書かれたエフェクト
0064:     D3DXHANDLE              m_hmWVP;   // ワールド×ビュー×射影行列
0065:     D3DXHANDLE              m_hvPos;   // ライトの位置
0066: 
0067:     BOOL                    m_bLoadingApp;          // TRUE, if the app is loading
0068:     CD3DFont*               m_pFont;                // Font for drawing text
0069:     UserInput               m_UserInput;            // Struct for storing user input 
0070: 
0071:     D3DXMATRIX              m_mView;
0072:     D3DXMATRIX              m_mProj;
0073:     D3DXVECTOR3             m_LighPos;
0074: 
0075:     FLOAT                   m_fWorldRotX;           // World rotation state X-axis
0076:     FLOAT                   m_fWorldRotY;           // World rotation state Y-axis
0077: 
0078: protected:
0079:     virtual HRESULT OneTimeSceneInit();
0080:     virtual HRESULT InitDeviceObjects();
0081:     virtual HRESULT RestoreDeviceObjects();
0082:     virtual HRESULT InvalidateDeviceObjects();
0083:     virtual HRESULT DeleteDeviceObjects();
0084:     virtual HRESULT Render();
0085:     virtual HRESULT FrameMove();
0086:     virtual HRESULT FinalCleanup();
0087:     virtual HRESULT ConfirmDevice( D3DCAPS9*, DWORD, D3DFORMAT, D3DFORMAT );
0088: 
0089:     HRESULT RenderText();
0090: 
0091:     void    UpdateInput( UserInput* pUserInput );
0092: public:
0093:     LRESULT MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
0094:     CMyD3DApplication();
0095:     virtual ~CMyD3DApplication();
0096: };
0097: 
0098: