raSystem  1.0 bata
raRawInputCamera.h
Go to the documentation of this file.
1 #pragma once
2 
3  class raRawInputCamera : public raClass
4  {
5  public:
6  raRawInputCamera() : raClass() { }
7 
8  ~raRawInputCamera(void);
9 
10  virtual void FrameMove( float fTime, float FPS )
11  {
12  D3DXMatrixInverse((D3DXMATRIX *) &m_mCameraWorld, NULL,(D3DXMATRIX *) &m_mView );
13  }
14 
15  // Functions to change camera matrices
16  virtual void Reset();
17  virtual void SetViewParams( raVector3* pvEyePt, raVector3* pvLookatPt );
18  virtual void SetProjParams( float fFOV, float fAspect, float fNearPlane, float fFarPlane );
19  virtual void SetOrthoCamera( raVector2* pvWindowSize, float fNearPlane, float fFarPlane);
20  // Functions to change behavior
21  virtual void SetDragRect( RECT& rc )
22  {
23  m_rcDrag = rc;
24  }
25  void SetInvertPitch( bool bInvertPitch )
26  {
27  m_bInvertPitch = bInvertPitch;
28  }
29  void SetDrag( bool bMovementDrag, FLOAT fTotalDragTimeToZero = 0.25f )
30  {
31  m_bMovementDrag = bMovementDrag; m_fTotalDragTimeToZero = fTotalDragTimeToZero;
32  }
33  void SetEnableYAxisMovement( bool bEnableYAxisMovement )
34  {
35  m_bEnableYAxisMovement = bEnableYAxisMovement;
36  }
37  void SetEnablePositionMovement( bool bEnablePositionMovement )
38  {
39  m_bEnablePositionMovement = bEnablePositionMovement;
40  }
41  void SetClipToBoundary( bool bClipToBoundary, D3DXVECTOR3* pvMinBoundary,
42  raVector3* pvMaxBoundary )
43  {
44  m_bClipToBoundary = bClipToBoundary; if( pvMinBoundary ) m_vMinBoundary = *pvMinBoundary;
45  if( pvMaxBoundary ) m_vMaxBoundary = *pvMaxBoundary;
46  }
47  void SetScalers( FLOAT fRotationScaler = 0.01f, FLOAT fMoveScaler = 5.0f )
48  {
49  m_fRotationScaler = fRotationScaler; m_fMoveScaler = fMoveScaler;
50  }
52  {
53  if( nFrames > 0 ) m_fFramesToSmoothMouseData = ( float )nFrames;
54  }
55  void SetResetCursorAfterMove( bool bResetCursorAfterMove )
56  {
57  m_bResetCursorAfterMove = bResetCursorAfterMove;
58  }
59 
60  // Functions to get state
61  virtual const raMatrix GetViewMatrix()
62  {
63  return raMatrix(m_mView);
64  }
65  virtual const raMatrix GetProjMatrix()
66  {
67  return raMatrix(m_mProj);
68  }
69  virtual const raMatrix GetOrthoMatrix()
70  {
71  return raMatrix(m_mOrtho);
72  }
73  virtual raVector3* GetEyePt()
74  {
75  return &raVector3(m_vEye);
76  }
78  {
79  return &raVector3(m_vLookAt);
80  }
81  virtual float GetNearClip()
82  {
83  return m_fNearPlane;
84  }
85  virtual float GetFarClip()
86  {
87  return m_fFarPlane;
88  }
89 
91  {
92  return &m_mCameraWorld;
93  }
94 
96  {
97  return (raVector3*)&m_mCameraWorld.m11;
98  }
99  virtual raVector3 *GetWorldUp()
100  {
101  return (raVector3*)&m_mCameraWorld.m21;
102  }
104  {
105  return (raVector3*)&m_mCameraWorld.m31;
106  }
108  {
109  return &m_vVelocity;
110  }
111 
113  {
115  }
117  {
118  return m_bMouseLButtonDown;
119  }
121  {
122  return m_bMouseMButtonDown;
123  }
125  {
126  return m_bMouseRButtonDown;
127  }
128 
129  virtual void GetInput(IRARawDevice* input);
130  protected:
131  // Functions to map a WM_KEYDOWN key to a D3DUtil_CameraKeys enum
132  void ConstrainToBoundary( raVector3* pV );
133  void UpdateMouseDelta();
134  void UpdateVelocity( float fElapsedTime );
135 
136  protected:
144 
156 
163 
164  RECT m_rcDrag;
171 
172  float m_fFOV;
173  float m_fAspect;
175  float m_fFarPlane;
176 
179 
183 
187 
189  HWND m_hwnd ;
190  };
virtual void SetOrthoCamera(raVector2 *pvWindowSize, float fNearPlane, float fFarPlane)
virtual float GetFarClip()
float m11
Definition: raMatrix.h:12
virtual float GetNearClip()
void SetScalers(FLOAT fRotationScaler=0.01f, FLOAT fMoveScaler=5.0f)
raVector3 m_vDefaultLookAt
void SetDrag(bool bMovementDrag, FLOAT fTotalDragTimeToZero=0.25f)
raVector3 m_vVelocityDrag
virtual raVector3 * GetWorldUp()
double m_GamePadLastActive[4]
virtual void GetInput(IRARawDevice *input)
void SetNumberOfFramesToSmoothMouseData(int nFrames)
raVector3 m_vMaxBoundary
float m_fFramesToSmoothMouseData
virtual void FrameMove(float fTime, float FPS)
raVector3 m_vGamePadLeftThumb
raVector3 * GetVelocity()
raVector2 m_vRotVelocity
void SetEnableYAxisMovement(bool bEnableYAxisMovement)
float m31
Definition: raMatrix.h:12
virtual void SetProjParams(float fFOV, float fAspect, float fNearPlane, float fFarPlane)
void UpdateVelocity(float fElapsedTime)
void ConstrainToBoundary(raVector3 *pV)
void SetEnablePositionMovement(bool bEnablePositionMovement)
virtual void SetDragRect(RECT &rc)
virtual const raMatrix GetProjMatrix()
void SetInvertPitch(bool bInvertPitch)
void UpdateMouseDelta()
void SetResetCursorAfterMove(bool bResetCursorAfterMove)
virtual void SetViewParams(raVector3 *pvEyePt, raVector3 *pvLookatPt)
virtual void Reset()
virtual raVector3 * GetWorldAhead()
BYTE m_aKeys[CAM_MAX_KEYS]
virtual raMatrix * GetWorldMatrix()
raVector3 m_vGamePadRightThumb
void SetClipToBoundary(bool bClipToBoundary, D3DXVECTOR3 *pvMinBoundary, raVector3 *pvMaxBoundary)
raVector3 m_vMinBoundary
virtual raVector3 * GetWorldRight()
class RAPI raMatrix
Definition: raVector3.h:3
virtual const raMatrix GetOrthoMatrix()
virtual raVector3 * GetLookAtPt()
virtual raVector3 * GetEyePt()
virtual const raMatrix GetViewMatrix()
float m21
Definition: raMatrix.h:12
raVector3 m_vKeyboardDirection