0001: // ----------------------------------------------------------------------------
0002: //
0003: // draw.h - 全体的な定義
0004: // 
0005: // Copyright (c) 2001 if (if@edokko.com)
0006: // All Rights Reserved.
0007: //
0008: // ----------------------------------------------------------------------------
0009: #ifndef _DRAW_H
0010: #define _DRAW_H
0011: 
0012: #include <d3d8.h>
0013: #include <d3dx8.h>
0014: 
0015: 
0016: HRESULT InitRender(LPDIRECT3DDEVICE8 lpD3DDEV);                 // 初期化
0017: void Render(LPDIRECT3DDEVICE8 lpD3DDEV);                        // 描画
0018: void CleanRender(LPDIRECT3DDEVICE8 lpD3DDEV);                   // 後片付け
0019: 
0020: // ----------------------------------------------------------------------------
0021: // ビュー座標系の管理
0022: // ----------------------------------------------------------------------------
0023: class CMyView{
0024:     D3DXMATRIX              m_mView;    // ビュー行列
0025:     D3DXVECTOR4             m_eye;      // カメラの位置
0026:     D3DXVECTOR4             m_lookAt;   // カメラの注目点
0027:     D3DXVECTOR4             m_up;       // カメラの上方向
0028: 
0029:     void Calc(){D3DXMatrixLookAtLH(&m_mView,(D3DXVECTOR3*)&m_eye,(D3DXVECTOR3*)&m_lookAt,(D3DXVECTOR3*)&m_up);}
0030: public:
0031:     CMyView(){Init();}
0032:     void Init(){m_eye.x    = 0.0f; m_eye.y    = 0.0f; m_eye.z    =-2.5f; m_eye.w    = 1.0f;
0033:                 m_lookAt.x = 0.0f; m_lookAt.y = 0.0f; m_lookAt.z = 0.0f; m_lookAt.w = 1.0f; 
0034:                 m_up.x     = 0.0f; m_up.y     = 1.0f; m_up.z     = 0.0f; m_up.w     = 1.0f; 
0035:                 this->Calc();}
0036:     void SetEye   (D3DXVECTOR4    eye){m_eye   =   eye;this->Calc();}
0037:     void SetLookAt(D3DXVECTOR4 lookAt){m_lookAt=lookAt;this->Calc();}
0038:     void SetUp    (D3DXVECTOR4     up){m_up    =    up;this->Calc();}
0039:     D3DXVECTOR4 GetEye()   {return m_eye;}
0040:     D3DXVECTOR4 GetLookAt(){return m_lookAt;}
0041:     D3DXVECTOR4 GetUp()    {return m_up;}
0042:     D3DXMATRIX Get(){return m_mView;}
0043: };
0044: extern CMyView  view;
0045: 
0046: 
0047: #endif /* !_DRAW_H */
0048: