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: HRESULT InitRender(LPDIRECT3DDEVICE8 lpD3DDEV); // 初期化
0016: void Render(LPDIRECT3DDEVICE8 lpD3DDEV);        // 描画
0017: void CleanRender(LPDIRECT3DDEVICE8 lpD3DDEV);   // 後片付け
0018: 
0019: // ----------------------------------------------------------------------------
0020: // ビュー座標系の管理
0021: // ----------------------------------------------------------------------------
0022: class CMyView{
0023:     D3DXMATRIX              m_mView;    // ビュー行列
0024:     D3DXVECTOR4             m_eye;      // カメラの位置
0025:     D3DXVECTOR4             m_lookAt;   // カメラの注目点
0026:     D3DXVECTOR4             m_up;       // カメラの上方向
0027: 
0028:     void Calc(){D3DXMatrixLookAtLH(&m_mView,(D3DXVECTOR3*)&m_eye,(D3DXVECTOR3*)&m_lookAt,(D3DXVECTOR3*)&m_up);}
0029: public:
0030:     CMyView(){Init();}
0031:     void Init(){m_eye.x    = 0.0f; m_eye.y    = 1.0f; m_eye.z    = 2.5f; m_eye.w    = 1.0f;
0032:                 m_lookAt.x = 0.0f; m_lookAt.y = 0.5f; m_lookAt.z = 0.0f; m_lookAt.w = 1.0f; 
0033:                 m_up.x     = 0.0f; m_up.y     = 1.0f; m_up.z     = 0.0f; m_up.w     = 1.0f; 
0034:                 this->Calc();}
0035:     void SetEye   (const D3DXVECTOR4    eye){m_eye   =   eye;this->Calc();}
0036:     void SetLookAt(const D3DXVECTOR4 lookAt){m_lookAt=lookAt;this->Calc();}
0037:     void SetUp    (const D3DXVECTOR4     up){m_up    =    up;this->Calc();}
0038:     const D3DXVECTOR4 &GetEye()    const {return m_eye;}
0039:     const D3DXVECTOR4 &GetLookAt() const {return m_lookAt;}
0040:     const D3DXVECTOR4 &GetUp()     const {return m_up;}
0041:     const D3DXMATRIX  &Get()       const {return m_mView;}
0042: };
0043: #endif /* !_DRAW_H */
0044: