My Project
AutoCamera.h
1 #pragma once
2 #include "BaseCamera.h"
3 
4 namespace ParaEngine
5 {
6  class CBipedObject;
15 {
16 public:
17  CAutoCamera(void);
18  ~CAutoCamera(void);
19 
20  enum CameraConstraintEnum
21  {
22  CameraConstraintFocus,
23  CameraConstraintNone
24  };
25 
26 
28  {
29  protected:
30  CameraConstraintEnum m_typeConstraint;
31  public:
32  void SetConstraintType(CameraConstraintEnum typeC){m_typeConstraint = typeC;};
33  CameraConstraintEnum GetConstraintType(){return m_typeConstraint;};
34 
37  Vector3 m_vMaxLookAt;
38 
41  Vector3 m_vMaxEye;
42  public:
43  void ConstrainToBoundary( Vector3* pV, const Vector3* pvMin, const Vector3* pvMax );
44  void ConstrainToOuterBoundary( Vector3* pV, const Vector3* pvMin, const Vector3* pvMax );
45 
46  void UpdateFocusConstraint(const Vector3* pV,
47  FLOAT fLookAtRadius, FLOAT fLookAtMinHeight,FLOAT fLookAtMaxHeight,
48  FLOAT fEyeRadius, FLOAT fEyeMinHeight,FLOAT fEyeMaxHeight);
49  void BoundToFocusConstraint(Vector3* pEye, Vector3* pLookAt);
50 
52  {
53  m_typeConstraint = CameraConstraintNone;
54  };
55  };
56 
57 public:
59  // implementation of IAttributeFields
60 
62  virtual int GetAttributeClassID(){return ATTRIBUTE_CLASSID_CAutoCamera;}
64  virtual const char* GetAttributeClassName(){static const char name[] = "CAutoCamera"; return name;}
66  virtual const char* GetAttributeClassDescription(){static const char desc[] = ""; return desc;}
68  virtual int InstallFields(CAttributeClass* pClass, bool bOverride);
69 
70 
71  ATTRIBUTE_METHOD1(CAutoCamera, IsAlwaysRun_s, bool*) {*p1 = cls->IsAlwaysRun(); return S_OK;}
72  ATTRIBUTE_METHOD1(CAutoCamera, SetAlwaysRun_s, bool) {cls->SetAlwaysRun(p1); return S_OK;}
73 
74  ATTRIBUTE_METHOD1(CAutoCamera, IsCamAlwaysBehindObject_s, bool*) {*p1 = cls->IsCamAlwaysBehindObject(); return S_OK;}
75  ATTRIBUTE_METHOD1(CAutoCamera, SetCamAlwaysBehindObject_s, bool) {cls->SetCamAlwaysBehindObject(p1); return S_OK;}
76 
77  ATTRIBUTE_METHOD1(CAutoCamera, IsUseRightButtonBipedFacing_s, bool*) {*p1 = cls->IsUseRightButtonBipedFacing(); return S_OK;}
78  ATTRIBUTE_METHOD1(CAutoCamera, SetUseRightButtonBipedFacing_s, bool) {cls->SetUseRightButtonBipedFacing(p1); return S_OK;}
79 
80 
81  ATTRIBUTE_METHOD(CAutoCamera, Reset_s) {cls->Reset(); return S_OK;}
82  ATTRIBUTE_METHOD(CAutoCamera, FreeCameraMode_s) {cls->FreeCameraMode(); return S_OK;}
83  ATTRIBUTE_METHOD(CAutoCamera, FollowMode_s) {cls->FollowMode(); return S_OK;}
84  ATTRIBUTE_METHOD1(CAutoCamera, GetCameraMode_s, int*) {*p1 = (int)(cls->GetCameraMode()); return S_OK;}
85  ATTRIBUTE_METHOD1(CAutoCamera, SetCameraMode_s, int) {cls->SetCameraMode((CameraMode)p1); return S_OK;}
86 
87  ATTRIBUTE_METHOD1(CAutoCamera, GetKeyboardMovVelocity_s, float*) {*p1 = cls->GetKeyboardMovVelocity(); return S_OK;}
88  ATTRIBUTE_METHOD1(CAutoCamera, SetKeyboardMovVelocity_s, float) {cls->SetKeyboardMovVelocity(p1); return S_OK;}
89 
90  ATTRIBUTE_METHOD1(CAutoCamera, GetKeyboardRotVelocity_s, float*) {*p1 = cls->GetKeyboardRotVelocity(); return S_OK;}
91  ATTRIBUTE_METHOD1(CAutoCamera, SetKeyboardRotVelocity_s, float) {cls->SetKeyboardRotVelocity(p1); return S_OK;}
92 
93  ATTRIBUTE_METHOD1(CAutoCamera, GetCameraObjectDistance_s, double*) { *p1 = cls->GetCameraObjectDistance(); return S_OK; }
94  ATTRIBUTE_METHOD1(CAutoCamera, SetCameraObjectDistance_s, double) { cls->SetCameraObjectDistance(p1); return S_OK; }
95 
96  ATTRIBUTE_METHOD1(CAutoCamera, GetCameraLiftupAngle_s, double*) { *p1 = cls->GetCameraLiftupAngle(); return S_OK; }
97  ATTRIBUTE_METHOD1(CAutoCamera, SetCameraLiftupAngle_s, double) { cls->SetCameraLiftupAngle(p1); return S_OK; }
98 
99  ATTRIBUTE_METHOD1(CAutoCamera, GetCameraRotX_s, double*) { *p1 = cls->GetCameraRotX(); return S_OK; }
100  ATTRIBUTE_METHOD1(CAutoCamera, SetCameraRotX_s, double) { cls->SetCameraRotX(p1); return S_OK; }
101 
102  ATTRIBUTE_METHOD1(CAutoCamera, GetCameraRotY_s, double*) { *p1 = cls->GetCameraRotY(); return S_OK; }
103  ATTRIBUTE_METHOD1(CAutoCamera, SetCameraRotY_s, double) { cls->SetCameraRotY(p1); return S_OK; }
104 
105  ATTRIBUTE_METHOD1(CAutoCamera, GetCameraRotZ_s, double*) { *p1 = cls->GetCameraRotZ(); return S_OK; }
106  ATTRIBUTE_METHOD1(CAutoCamera, SetCameraRotZ_s, double) { cls->SetCameraRotZ(p1); return S_OK; }
107 
108  ATTRIBUTE_METHOD1(CAutoCamera, GetLookAtShiftY_s, double*) { *p1 = cls->GetLookAtShiftY(); return S_OK; }
109  ATTRIBUTE_METHOD1(CAutoCamera, SetLookAtShiftY_s, double) { cls->SetLookAtShiftY(p1); return S_OK; }
110 
111  ATTRIBUTE_METHOD1(CAutoCamera, GetEnableKeyboard_s, bool*) {*p1 = cls->GetEnableKeyboard(); return S_OK;}
112  ATTRIBUTE_METHOD1(CAutoCamera, EnableKeyboard_s, bool) {cls->EnableKeyboard(p1); return S_OK;}
113 
114  ATTRIBUTE_METHOD1(CAutoCamera, GetEnableMouseLeftButton_s, bool*) {*p1 = cls->GetEnableMouseLeftButton(); return S_OK;}
115  ATTRIBUTE_METHOD1(CAutoCamera, EnableMouseLeftButton_s, bool) {cls->EnableMouseLeftButton(p1); return S_OK;}
116 
117  ATTRIBUTE_METHOD1(CAutoCamera, GetEnableMouseRightButton_s, bool*) {*p1 = cls->GetEnableMouseRightButton(); return S_OK;}
118  ATTRIBUTE_METHOD1(CAutoCamera, EnableMouseRightButton_s, bool) {cls->EnableMouseRightButton(p1); return S_OK;}
119 
120  ATTRIBUTE_METHOD1(CAutoCamera, GetEnableMouseWheel_s, bool*) {*p1 = cls->GetEnableMouseWheel(); return S_OK;}
121  ATTRIBUTE_METHOD1(CAutoCamera, EnableMouseWheel_s, bool) {cls->EnableMouseWheel(p1); return S_OK;}
122 
123  ATTRIBUTE_METHOD1(CAutoCamera, GetPhysicsGroupMask_s, DWORD*) {*p1 = cls->GetPhysicsGroupMask(); return S_OK;}
124  ATTRIBUTE_METHOD1(CAutoCamera, SetPhysicsGroupMask_s, DWORD) {cls->SetPhysicsGroupMask(p1); return S_OK;}
125 
126  ATTRIBUTE_METHOD1(CAutoCamera, IsEnableMouseRightDrag_s, bool*) {*p1 = cls->IsEnableMouseRightDrag(); return S_OK;}
127  ATTRIBUTE_METHOD1(CAutoCamera, EnableMouseRightDrag_s, bool) {cls->EnableMouseRightDrag(p1); return S_OK;}
128 
129  ATTRIBUTE_METHOD1(CAutoCamera, IsEnableMouseLeftDrag_s, bool*) {*p1 = cls->IsEnableMouseLeftDrag(); return S_OK;}
130  ATTRIBUTE_METHOD1(CAutoCamera, EnableMouseLeftDrag_s, bool) {cls->EnableMouseLeftDrag(p1); return S_OK;}
131 
132  ATTRIBUTE_METHOD1(CAutoCamera, IsLockMouseWhenDragging_s, bool*) { *p1 = cls->IsLockMouseWhenDragging(); return S_OK; }
133  ATTRIBUTE_METHOD1(CAutoCamera, SetLockMouseWhenDragging_s, bool) { cls->SetLockMouseWhenDragging(p1); return S_OK; }
134 
135  ATTRIBUTE_METHOD1(CAutoCamera, IsUseCharacterLookup_s, bool*) {*p1 = cls->IsUseCharacterLookup(); return S_OK;}
136  ATTRIBUTE_METHOD1(CAutoCamera, SetUseCharacterLookup_s, bool) {cls->SetUseCharacterLookup(p1); return S_OK;}
137 
138  ATTRIBUTE_METHOD1(CAutoCamera, GetAlwaysRotateCameraWhenFPS_s, bool*) {*p1 = cls->GetAlwaysRotateCameraWhenFPS(); return S_OK;}
139  ATTRIBUTE_METHOD1(CAutoCamera, EnableAlwaysRotateCameraWhenFPS_s, bool) {cls->EnableAlwaysRotateCameraWhenFPS(p1); return S_OK;}
140 
141 
142  ATTRIBUTE_METHOD1(CAutoCamera, IsUseCharacterLookupWhenMounted_s, bool*) {*p1 = cls->IsUseCharacterLookupWhenMounted(); return S_OK;}
143  ATTRIBUTE_METHOD1(CAutoCamera, SetUseCharacterLookupWhenMounted_s, bool) {cls->SetUseCharacterLookupWhenMounted(p1); return S_OK;}
144 
145  ATTRIBUTE_METHOD1(CAutoCamera, GetCharacterLookupBoneIndex_s, int*) {*p1 = cls->GetCharacterLookupBoneIndex(); return S_OK;}
146  ATTRIBUTE_METHOD1(CAutoCamera, SetCharacterLookupBoneIndex_s, int) {cls->SetCharacterLookupBoneIndex(p1); return S_OK;}
147 
148  ATTRIBUTE_METHOD1(CAutoCamera, IsCameraMoved_s, bool*) {*p1 = cls->IsCameraMoved(); return S_OK;}
149 
150  ATTRIBUTE_METHOD1(CAutoCamera, IsBlockInput_s, bool*) {*p1 = cls->IsBlockInput(); return S_OK;}
151  ATTRIBUTE_METHOD1(CAutoCamera, SetBlockInput_s, bool) {cls->SetBlockInput(p1); return S_OK;}
152 
153  ATTRIBUTE_METHOD1(CAutoCamera, GetMaxCameraObjectDistance_s, double*) {*p1 = cls->GetMaxCameraObjectDistance(); return S_OK;}
154  ATTRIBUTE_METHOD1(CAutoCamera, SetMaxCameraObjectDistance_s, double) { cls->SetMaxCameraObjectDistance(p1); return S_OK; }
155 
156  ATTRIBUTE_METHOD1(CAutoCamera, GetMinCameraObjectDistance_s, double*) { *p1 = cls->GetMinCameraObjectDistance(); return S_OK; }
157  ATTRIBUTE_METHOD1(CAutoCamera, SetMinCameraObjectDistance_s, double) { cls->SetMinCameraObjectDistance(p1); return S_OK; }
158 
159  ATTRIBUTE_METHOD1(CAutoCamera, GetCameraRollbackSpeed_s, float*) { *p1 = cls->GetCameraRollbackSpeed(); return S_OK; }
160  ATTRIBUTE_METHOD1(CAutoCamera, SetCameraRollbackSpeed_s, float) { cls->SetCameraRollbackSpeed(p1); return S_OK; }
161 
162  ATTRIBUTE_METHOD1(CAutoCamera, GetCameraLookatOffset_s, Vector3*) {*p1 = cls->GetCameraLookatOffset(); return S_OK;}
163  ATTRIBUTE_METHOD1(CAutoCamera, SetCameraLookatOffset_s, Vector3) {cls->SetCameraLookatOffset(p1); return S_OK;}
164 
165  ATTRIBUTE_METHOD1(CAutoCamera, GetAdditionalCameraRotate_s, Vector3*) { *p1 = cls->GetAdditionalCameraRotate(); return S_OK; }
166  ATTRIBUTE_METHOD1(CAutoCamera, SetAdditionalCameraRotate_s, Vector3) { cls->SetAdditionalCameraRotate(p1); return S_OK; }
167 
168  ATTRIBUTE_METHOD1(CAutoCamera, GetMaxYShiftSpeed_s, float*) {*p1 = cls->GetMaxYShiftSpeed(); return S_OK;}
169  ATTRIBUTE_METHOD1(CAutoCamera, SetMaxYShiftSpeed_s, float) {cls->SetMaxYShiftSpeed(p1); return S_OK;}
170 
171  ATTRIBUTE_METHOD1(CAutoCamera, GetMaxAllowedYShift_s, float*) {*p1 = cls->GetMaxAllowedYShift(); return S_OK;}
172  ATTRIBUTE_METHOD1(CAutoCamera, SetMaxAllowedYShift_s, float) {cls->SetMaxAllowedYShift(p1); return S_OK;}
173 
174  ATTRIBUTE_METHOD1(CAutoCamera, IsControlBiped_s, bool*) { *p1 = cls->IsControlBiped(); return S_OK; }
175  ATTRIBUTE_METHOD1(CAutoCamera, SetControlBiped_s, bool) { cls->SetControlBiped(p1); return S_OK; }
176 
177  ATTRIBUTE_METHOD1(CAutoCamera, IsEnableBlockCollision_s, bool*) { *p1 = cls->IsEnableBlockCollision(); return S_OK; }
178  ATTRIBUTE_METHOD1(CAutoCamera, SetEnableBlockCollision_s, bool) { cls->SetEnableBlockCollision(p1); return S_OK; }
179 
180  ATTRIBUTE_METHOD1(CAutoCamera, IsIgnoreEyeBlockCollisionInSunlight_s, bool*) { *p1 = cls->IsIgnoreEyeBlockCollisionInSunlight(); return S_OK; }
181  ATTRIBUTE_METHOD1(CAutoCamera, SetIgnoreEyeBlockCollisionInSunlight_s, bool) { cls->SetIgnoreEyeBlockCollisionInSunlight(p1); return S_OK; }
182 
183  ATTRIBUTE_METHOD1(CAutoCamera, GetRenderOrigin_s, Vector3*) { *p1 = cls->GetRenderOrigin(); return S_OK; }
184  ATTRIBUTE_METHOD1(CAutoCamera, GetViewProjMatrix_s, Matrix4*) { *p1 = *(cls->GetViewProjMatrix()); return S_OK; }
185  ATTRIBUTE_METHOD1(CAutoCamera, GetViewMatrix_s, Matrix4*) { *p1 = *(cls->GetViewMatrix()); return S_OK; }
186  ATTRIBUTE_METHOD1(CAutoCamera, GetProjMatrix_s, Matrix4*) { *p1 = *(cls->GetProjMatrix()); return S_OK; }
187 
188  ATTRIBUTE_METHOD(CAutoCamera, UpdateBipedFlyDir_s) { cls->UpdateBipedFlyDir(); return S_OK; }
189 
190 
195 
197  virtual VOID FrameMove( FLOAT fElapsedTime );
198 
199  void UpdateBipedFlyDir(CBipedObject * pBiped = NULL);
200  CBipedObject * GetTargetAsBiped();
201 
202  virtual LRESULT HandleMessages(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
203  virtual void SetViewParams(const DVector3& vEyePt, const DVector3& vLookatPt);
204 
205  void FollowBiped( CBaseObject* pBiped, CameraMode modeCamera, double dTransitionTime);
206  void FollowBiped( CBaseObject* pBiped, int nTranstionMode, int modeCamera, double Param0, double Param1, double Param2);
207  void SetCameraMode(CameraMode modeCamera);
208  virtual CameraMode GetCameraMode();
209 
210  virtual void SetFollowTarget(CBaseObject* pObj){m_pTargetObject = pObj;};
211  virtual CBaseObject* GetFollowTarget(){return m_pTargetObject;};
212 
218  bool SmoothMove(DVector3* result, DVector3 vPosTarget, DVector3 vPos, float fIncrease, float fTolerance = 0);
219 
220  void UpdateViewProjMatrix();
221  Matrix4* GetViewProjMatrix();
225  void ComputeViewMatrix(Matrix4 *pOut, const DVector3 *pEye, const DVector3 *pAt, const Vector3 *pUp);
226 
229  void UpdateViewMatrix();
230 
232  void HandleUserInput();
233 
238  bool IsAlwaysRun() {return m_bAlwaysRun;}
239  void SetAlwaysRun(bool bAlwaysRun) {m_bAlwaysRun = bAlwaysRun;}
240 
242  bool IsCameraMoved();
243 
246 
251  bool IsCamAlwaysBehindObject() {return m_bIsCamAlwaysBehindObject;}
252  void SetCamAlwaysBehindObject(bool bIsCamAlwaysBehindObject) {m_bIsCamAlwaysBehindObject = bIsCamAlwaysBehindObject;}
253 
255  bool IsUseCharacterLookup();
256 
258  void SetUseCharacterLookup(bool bUseCharacterLookup);
259 
262 
264  void SetUseCharacterLookupWhenMounted(bool bUseCharacterLookup);
265 
268 
270  void SetCharacterLookupBoneIndex(int nIndex);
271 
275  bool IsUseRightButtonBipedFacing() {return m_bUseRightButtonBipedFacing;}
276  void SetUseRightButtonBipedFacing(bool bUseRightButtonBipedFacing) {m_bUseRightButtonBipedFacing = bUseRightButtonBipedFacing;}
277 
279  bool IsEnableMouseRightDrag() {return m_bEnableMouseRightDrag;}
280 
282  void EnableMouseRightDrag(bool bEnabled) {m_bEnableMouseRightDrag = bEnabled;}
283 
285  bool IsEnableMouseLeftDrag() {return m_bEnableMouseLeftDrag;}
286 
288  void EnableMouseLeftDrag(bool bEnabled) {m_bEnableMouseLeftDrag = bEnabled;}
289 
291  bool IsLockMouseWhenDragging() const;
292  void SetLockMouseWhenDragging(bool val);
293 
297  void Reset();
301  void FreeCameraMode();
305  void FollowMode();
306 
307  float GetKeyboardMovVelocity();
312  void SetKeyboardMovVelocity(float fValue);
313 
314 
315  float GetKeyboardRotVelocity();
320  void SetKeyboardRotVelocity(float fValue);
321 
326  void EnableStereoVision(bool bEnable) {m_bEnableStereoVision = bEnable;};
327  bool IsStereoVisionEnabled() {return m_bEnableStereoVision;};
328 
330  void SetStereoEyeShiftDistance(float fDist) {m_fStereoEyeShiftDistance = fDist;}
331  float GetStereoEyeShiftDistance() {return m_fStereoEyeShiftDistance;}
332 
334  void SetCameraObjectDistance(double fDist);
335  double GetCameraObjectDistance() { return m_fCameraObjectDistance; }
336 
338  void SetCameraLiftupAngle(double fValue) { m_fCameraLiftupAngle = fValue; }
339  double GetCameraLiftupAngle() {return m_fCameraLiftupAngle;}
340 
342  void SetCameraRotX(double fValue) { m_fCameraRotX = fValue; }
343  double GetCameraRotX() { return m_fCameraRotX; }
344 
346  void SetCameraRotY(double fValue) { m_fCameraRotY = fValue; }
347  double GetCameraRotY() { return m_fCameraRotY; }
348 
350  void SetCameraRotZ(double fValue) { m_fCameraRotZ = fValue; }
351  double GetCameraRotZ() { return m_fCameraRotZ; }
352 
356  void SetLookAtShiftY(double fValue) { m_fLookAtShiftY = fValue; }
357  double GetLookAtShiftY() { return m_fLookAtShiftY; }
358 
360  void EnableKeyboard(bool bValue);
361  bool GetEnableKeyboard() {return m_bEnableKeyboard;}
362 
364  void EnableMouseLeftButton(bool bValue);
365  bool GetEnableMouseLeftButton() {return m_bEnableMouseLeftButton;}
366 
368  void EnableMouseRightButton(bool bValue);
369  bool GetEnableMouseRightButton() {return m_bEnableMouseRightButton;}
370 
372  void EnableAlwaysRotateCameraWhenFPS(bool bValue);
373  bool GetAlwaysRotateCameraWhenFPS();
374 
376  void EnableMouseWheel(bool bValue) {m_bEnableMouseWheel = bValue;}
377  bool GetEnableMouseWheel() {return m_bEnableMouseWheel;}
378 
380  void SetPhysicsGroupMask(DWORD dwValue) {m_dwPhysicsGroupMask = dwValue;}
381 
383  DWORD GetPhysicsGroupMask() {return m_dwPhysicsGroupMask;}
384 
386  bool IsBlockInput();
387  void SetBlockInput(bool bBlockInput);
388 
390  void SetMaxCameraObjectDistance(double fValue) { m_fMaxCameraObjectDistance = fValue; }
391  double GetMaxCameraObjectDistance() { return m_fMaxCameraObjectDistance; }
392 
394  void SetMinCameraObjectDistance(double fValue) { m_fMinCameraObjectDistance = fValue; }
395  double GetMinCameraObjectDistance() { return m_fMinCameraObjectDistance; }
396 
398  void SetCameraRollbackSpeed(float fValue) { m_fCameraRollbackSpeed = fValue; }
399  float GetCameraRollbackSpeed() { return m_fCameraRollbackSpeed; }
400 
402  void SetCameraLookatOffset(const Vector3& v) { m_vLookAtOffset = v; }
403  Vector3 GetCameraLookatOffset() { return m_vLookAtOffset; }
404 
406  Vector3 GetAdditionalCameraRotate() const { return m_vAdditionalCameraRotate; }
407  void SetAdditionalCameraRotate(const Vector3& val) { m_vAdditionalCameraRotate = val; }
408 
410  float GetMaxAllowedYShift();
411  void SetMaxAllowedYShift(float fValue);
412 
414  float GetMaxYShiftSpeed();
415  void SetMaxYShiftSpeed(float fValue);
416 
418  bool IsFirstPersonView();
419 
421  bool IsControlBiped() const;
423  void SetControlBiped(bool val);
424 
427  virtual int On_FrameMove(float fElapsedTime);
428 
430  bool IsEnableBlockCollision() const;
431  void SetEnableBlockCollision(bool val);
432 
436  bool IsIgnoreEyeBlockCollisionInSunlight() const { return m_bIgnoreEyeBlockCollisionInSunlight; }
437  void SetIgnoreEyeBlockCollisionInSunlight(bool val) { m_bIgnoreEyeBlockCollisionInSunlight = val; }
438 
439  virtual Vector3 GetRenderEyePosition();
440 
441 private:
446  void SetKeyDownState(CharacterAndCameraKeys nKey, bool bIsKeyDown);
447 
448  void SetDefaultAngles();
449 
450  /* as if no key button is pressed. used before disable key board*/
451  void ClearKeyStates();
452 
453  /* as if no mouse button is down. used before disable mouse */
454  void ClearMouseStates();
455 
456  void SetMouseDragLock(bool bLock);
457 
458 public:
463 
464 private:
465  Matrix4 m_matViewProj;
466  bool m_bEnableKeyboard;
467  bool m_bEnableMouseLeftButton;
468  bool m_bEnableMouseRightButton;
469  bool m_bEnableMouseWheel;
470 
472  CBaseObject* m_pTargetObject;
474  CameraMode m_currentCameraMode;
475 
477  CameraMode m_lastCameraMode;
480  double m_dTransitionAmt;
481 
482 
484  DVector3 m_vEyeLast;
486  FLOAT m_fEyeSpeed;
488  DVector3 m_vLookAtLast;
490  DVector3 m_vRenderEyePos;
492  FLOAT m_fLookAtSpeed;
494  Vector3 m_vLookUpLast;
496  FLOAT m_fLookUpSpeed;
497 
498  /*parameter about each of the camera mode*/
500  FLOAT m_fMaximumHeight;
502  FLOAT m_fMinimumHeight;
504  FLOAT m_fKeyboardRotVelocity;
506  FLOAT m_fKeyboardMovVelocity;
510  double m_fCameraObjectDistance;
512  double m_fMaxCameraObjectDistance;
514  double m_fMinCameraObjectDistance;
516  double m_fLastCameraObjectDistance;
518  double m_fCameraLiftupAngle;
520  double m_fCameraRotX;
522  double m_fCameraRotY;
524  double m_fCameraRotZ;
526  bool m_bIsCamAlwaysBehindObject;
529  double m_fLookAtShiftY;
530 
532  float m_fCamZoomSpeed;
533 
535  bool m_bControlBiped;
536 
538  bool m_bAlwaysRun;
541  CameraConstraint m_constrants;
542 
543  CEventBinding *m_event;
545  float m_fCameraRollbackSpeed;
548  int m_nForceNoRollbackFrames;
549 
553  bool m_bEnableStereoVision;
554 
556  float m_fStereoEyeShiftDistance;
557 
558  // the pixel mouse drag distance from a mouse down and mouse move
559  int m_nMouseDragDistance;
560 
562  DWORD m_dwPhysicsGroupMask;
563 
565  bool m_bUseRightButtonBipedFacing;
566 
568  bool m_bEnableMouseLeftDrag;
569 
571  bool m_bEnableMouseRightDrag;
572 
574  bool m_bUseCharacterLookup;
575 
577  bool m_bUseCharacterLookupWhenMounted;
578 
580  int m_nCharacterLookupBoneIndex;
581 
583  bool m_bAlwaysRotateCameraWhenFPS;
584 
586  bool m_bBlockInput;
587 
588  //whether to
589  bool m_resetFlyNormal;
590 
592  bool m_bFirstPerson;
593 
595  bool m_bEnableBlockCollision;
596 
600  bool m_bIgnoreEyeBlockCollisionInSunlight;
601 
603  bool m_bLockMouseWhenDragging;
604 
605  Vector3 m_bipedFlyNormal;
606 
608  Vector3 m_vLookAtOffset;
610  Vector3 m_vAdditionalCameraRotate;
611 
613  float m_fAllowedCharYShift;
614  float m_fMaxYShiftSpeed;
615  double m_fLastCharY;
616  double m_fLastUsedCharY;
617 public:
618  friend CSceneObject;
619  friend ShadowVolume;
620 };
621 
622 }
void ComputeViewMatrix(Matrix4 *pOut, const DVector3 *pEye, const DVector3 *pAt, const Vector3 *pUp)
compute view matrix by coordinate in world space.
Definition: AutoCamera.cpp:1772
void SetCameraObjectDistance(double fDist)
the camera object distance after all kinds of constraints are applied.
Definition: AutoCamera.cpp:2216
void UpdateViewMatrix()
it calls ComputeViewMatrix() with the current eye settings.
Definition: AutoCamera.cpp:1805
void FollowBiped(CBaseObject *pBiped, CameraMode modeCamera, double dTransitionTime)
Desc: Get the mouse pay for object picking [in] dTransitionTime: can be 0 or greater than 0 when dTra...
Definition: AutoCamera.cpp:326
Vector3 m_vMinEye
the box within which the camera eyeat point must be
Definition: AutoCamera.h:40
bool IsBlockInput()
whether to block all user input (both key and mouse).
Definition: AutoCamera.cpp:2337
Vector3 GetRenderOrigin()
current render origin.
Definition: AutoCamera.cpp:2482
3-dimensional vector with double precision.
Definition: ParaDVector3.h:17
an attribute class is a collection of attribute fields.
Definition: AttributeClass.h:10
void SetCameraRotY(double fValue)
rotation of the camera around the Y axis, in the world coordinate.
Definition: AutoCamera.h:346
ShadowVolume is a structure for storing shadow volume geometries.
Definition: ShadowVolume.h:39
bool IsUseCharacterLookupWhenMounted()
Default to true.
Definition: AutoCamera.cpp:1862
Definition: BaseCamera.h:376
bool IsEnableMouseLeftDrag()
whether camera dragging with left button if enabled.
Definition: AutoCamera.h:285
CEventBinding * GetEventBinding()
Get the current event binding object.
Definition: AutoCamera.cpp:268
virtual int On_FrameMove(float fElapsedTime)
called every frame move when this character is sentient.
Definition: AutoCamera.cpp:475
void SetUseCharacterLookup(bool bUseCharacterLookup)
whether the camera look up vector will use the character look up.
Definition: AutoCamera.cpp:1857
bool IsUseCharacterLookup()
whether the camera look up vector will use the character look up.
Definition: AutoCamera.cpp:1852
bool IsLockMouseWhenDragging() const
whether to lock mouse during dragging, default to false.
Definition: AutoCamera.cpp:2249
void LoadDefaultEventBinding()
load the default camera key and mouse event binding.
Definition: AutoCamera.cpp:213
void SetCameraLiftupAngle(double fValue)
lift up angle of the camera.
Definition: AutoCamera.h:338
void EnableMouseRightDrag(bool bEnabled)
set whether camera dragging with right button if enabled.
Definition: AutoCamera.h:282
different physics engine has different winding order.
Definition: EventBinding.h:32
bool IsControlBiped() const
whether the camera is able to control the biped movement.
Definition: AutoCamera.cpp:2430
Auto Camera is designed to handle smooth transitions between supported camera type, such as first person camera, third person camera, and rotation camera.
Definition: AutoCamera.h:14
virtual const char * GetAttributeClassName()
a static string, describing the attribute class object's name
Definition: AutoCamera.h:64
bool m_bIsLastFrameChanged
true if the camera is changed since last frame
Definition: AutoCamera.h:462
void SetCameraRotX(double fValue)
rotation of the camera around the X axis, in the world coordinate.
Definition: AutoCamera.h:342
void EnableMouseRightButton(bool bValue)
whether Enable Mouse Right Button
Definition: AutoCamera.cpp:2294
CameraMode
Definition: BaseCamera.h:12
void SetMinCameraObjectDistance(double fValue)
min camera object distance when mouse wheel is used for zooming.
Definition: AutoCamera.h:394
bool IsEnableBlockCollision() const
enabled by default.
Definition: AutoCamera.cpp:2440
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
void SetStereoEyeShiftDistance(float fDist)
this is usually half of the Stereo eye separation distance.
Definition: AutoCamera.h:330
Vector3 GetAdditionalCameraRotate() const
additional camera rotation in camera space.
Definition: AutoCamera.h:406
void SetCameraRotZ(double fValue)
rotation of the camera around the Z axis, in the world coordinate.
Definition: AutoCamera.h:350
void Reset()
reset camera, without playing transitions.
Definition: AutoCamera.cpp:2221
void SetCameraLookatOffset(const Vector3 &v)
additional camera offset in camera space.
Definition: AutoCamera.h:402
void SetCameraRollbackSpeed(float fValue)
the camera roll back speed in meters per second.
Definition: AutoCamera.h:398
void EnableMouseWheel(bool bValue)
whether Enable Mouse wheel Button
Definition: AutoCamera.h:376
bool IsCameraMoved()
whether camera moved since last frame
Definition: AutoCamera.cpp:2420
bool IsUseRightButtonBipedFacing()
when set to true, the right mouse drag will change character facing when biped is standing still...
Definition: AutoCamera.h:275
void EnableMouseLeftDrag(bool bEnabled)
set whether camera dragging with left button if enabled.
Definition: AutoCamera.h:288
DWORD GetPhysicsGroupMask()
get groups Mask used to filter physics objects, default to 0xffffffff
Definition: AutoCamera.h:383
void SetKeyboardMovVelocity(float fValue)
max speed of movement velocity using keyboard.
Definition: AutoCamera.cpp:2264
int GetCharacterLookupBoneIndex()
-1 to disable, otherwise this is the attachment bone id to which we will bind the camera's lookup to...
Definition: AutoCamera.cpp:2390
CAutoCamera(void)
Definition: AutoCamera.cpp:149
bool IsEnableMouseRightDrag()
whether camera dragging with right button if enabled.
Definition: AutoCamera.h:279
void FreeCameraMode()
switch to free camera mode
Definition: AutoCamera.cpp:2227
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: ParaMatrix4.h:23
float GetMaxYShiftSpeed()
the max speed camera interpolation speed along y axis.
Definition: AutoCamera.cpp:2410
void EnableMouseLeftButton(bool bValue)
whether Enable Mouse Left Button
Definition: AutoCamera.cpp:2279
BOOL m_bIsFollowMode
true to follow target
Definition: AutoCamera.h:460
void SetControlBiped(bool val)
whether the camera is able to control the biped movement.
Definition: AutoCamera.cpp:2435
virtual int GetAttributeClassID()
attribute class ID should be identical, unless one knows how overriding rules work.
Definition: AutoCamera.h:62
virtual int InstallFields(CAttributeClass *pClass, bool bOverride)
this class should be implemented if one wants to add new attribute.
Definition: AutoCamera.cpp:2487
The top level scene management class.
Definition: SceneObject.h:58
void SetLookAtShiftY(double fValue)
the Y shift of the camera look at position during follow mode.
Definition: AutoCamera.h:356
void HandleUserInput()
Handle the user input from direct input: update the key state, process key event, process mouse event...
Definition: AutoCamera.cpp:1890
void FollowMode()
switch to follow mode.
Definition: AutoCamera.cpp:2236
bool IsAlwaysRun()
always running
Definition: AutoCamera.h:238
void SetPhysicsGroupMask(DWORD dwValue)
set groups Mask used to filter physics objects, default to 0xffffffff
Definition: AutoCamera.h:380
This class is for maintaining the event binding table and script binding table.
Definition: EventBinding.h:51
void SetKeyboardRotVelocity(float fValue)
max speed of rotational velocity using keyboard.
Definition: AutoCamera.cpp:2274
void EnableAlwaysRotateCameraWhenFPS(bool bValue)
Default to true.
Definition: AutoCamera.cpp:2380
Vector3 m_vMinLookAt
the box within which the camera lookat point must be
Definition: AutoCamera.h:33
void EnableKeyboard(bool bValue)
whether handler keyboard message
Definition: AutoCamera.cpp:2309
Defines the base class of all scene elements:CBaseObject for Parallel World Engine.
Definition: BaseObject.h:230
void EnableStereoVision(bool bEnable)
whether to enable stereo vision.
Definition: AutoCamera.h:326
bool IsFirstPersonView()
whether first person view mode
Definition: AutoCamera.cpp:2425
void ConstrainToBoundary(Vector3 *pV, const Vector3 *pvMin, const Vector3 *pvMax)
Desc: Clamps pV to lie inside vMinBoundary & MaxBoundary.
Definition: AutoCamera.cpp:81
void UpdateFocusConstraint(const Vector3 *pV, FLOAT fLookAtRadius, FLOAT fLookAtMinHeight, FLOAT fLookAtMaxHeight, FLOAT fEyeRadius, FLOAT fEyeMinHeight, FLOAT fEyeMaxHeight)
Name: UpdateFocusConstraint Desc: Set internal constraint based on the parameters param: pV is the ob...
Definition: AutoCamera.cpp:118
void ConstrainToOuterBoundary(Vector3 *pV, const Vector3 *pvMin, const Vector3 *pvMax)
Desc: Clamps pV to lie outside vMinBoundary & MaxBoundary.
Definition: AutoCamera.cpp:97
void SetUseCharacterLookupWhenMounted(bool bUseCharacterLookup)
Default to true.
Definition: AutoCamera.cpp:1867
void SetMaxCameraObjectDistance(double fValue)
max camera object distance when mouse wheel is used for zooming.
Definition: AutoCamera.h:390
virtual VOID FrameMove(FLOAT fElapsedTime)
Call these from client and use Get*Matrix() to read new matrices.
Definition: AutoCamera.cpp:491
float GetMaxAllowedYShift()
we will smooth the camera movement on the y direction when the followed biped's y movement is smaller...
Definition: AutoCamera.cpp:2400
bool IsCamAlwaysBehindObject()
whether camera is locked behind the current character.
Definition: AutoCamera.h:251
It can be used to represent biped object(like human, re spawning monsters) in the scene without inher...
Definition: BipedObject.h:60
bool SmoothMove(DVector3 *result, DVector3 vPosTarget, DVector3 vPos, float fIncrease, float fTolerance=0)
linearly (smoothly) move vPos to vPosTarget by the amount fIncrease
Definition: AutoCamera.cpp:448
void SetCharacterLookupBoneIndex(int nIndex)
-1 to disable, otherwise this is the attachment bone id to which we will bind the camera's lookup to...
Definition: AutoCamera.cpp:2395
virtual void SetViewParams(const DVector3 &vEyePt, const DVector3 &vLookatPt)
Definition: AutoCamera.cpp:1812
bool IsIgnoreEyeBlockCollisionInSunlight() const
enabled by default.
Definition: AutoCamera.h:436
virtual const char * GetAttributeClassDescription()
a static string, describing the attribute class object
Definition: AutoCamera.h:66