home *** CD-ROM | disk | FTP | other *** search
/ Programming an RTS Game with Direct3D / Programming an RTS Game with Direct3D.iso / Examples / Chapter 5 / Example 5.6 / camera.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-06-29  |  978 b   |  43 lines

  1. #ifndef _CAMERA
  2. #define _CAMERA
  3.  
  4. #include <d3dx9.h>
  5. #include "mouse.h"
  6. #include "debug.h"
  7.  
  8. class CAMERA{
  9.     friend class APPLICATION;
  10.     public:
  11.         //Init Camera
  12.         CAMERA();
  13.         void Init(IDirect3DDevice9* Dev);
  14.  
  15.         //Movement
  16.         void Scroll(D3DXVECTOR3 vec);    //Move Focus
  17.         void Pitch(float f);            //Change B-angle
  18.         void Yaw(float f);                //Change A-angle
  19.         void Zoom(float f);                //Change FOV
  20.         void ChangeRadius(float f);        //Change Radius... douh
  21.  
  22.         //Calculate Eye position etc
  23.         void Update(MOUSE &mouse, float timeDelta);
  24.         void CalculateFrustum(D3DXMATRIX view, D3DXMATRIX projection);
  25.         bool Cull(BBOX bBox);
  26.         bool Cull(BSPHERE bSphere);
  27.  
  28.         //Calculate Matrices
  29.         D3DXMATRIX GetViewMatrix();
  30.         D3DXMATRIX GetProjectionMatrix();
  31.  
  32.     private:
  33.  
  34.         IDirect3DDevice9* m_pDevice;
  35.         float m_alpha, m_beta, m_radius, m_fov;
  36.         D3DXVECTOR3 m_eye, m_focus, m_right, m_look;
  37.  
  38.         //6-planes to store our view frustum
  39.         D3DXPLANE m_frustum[6];
  40. };
  41.  
  42. #endif
  43.