Introduction

Getting Started

Programming Guides

API Reference

Additional Resources

HOpCameraWalk.h
1 // HOpCameraPan.h : interface of the HOpCameraPan class
2 // pans the camera of current view
3 
4 #ifndef _HOpCameraWalk_H
5 #define _HOpCameraWalk_H
6 
7 #ifdef H_PACK_8
8 #pragma pack(push)
9 #pragma pack(8)
10 #endif
11 
12 #include "HTools.h"
13 #include "HBaseOperator.h"
14 #include "HObjects.h"
15 class HTClient;
16 class HImageItem;
17 
19 
44 class MVO_API HOpCameraWalk : public HBaseOperator
45 {
46 public:
47 
55  HOpCameraWalk(HBaseView* view, int DoRepeat=0, int DoCapture=1);
56  virtual ~HOpCameraWalk();
57 
58 
62  virtual const char * GetName();
63 
69  virtual int OnLButtonDown (HEventInfo &hevent);
70 
77  virtual int OnLButtonDownAndMove(HEventInfo &hevent);
78 
84  virtual int OnLButtonUp (HEventInfo &hevent);
85 
92  void SetLightFollowsCamera(bool follow){m_LightFollowsCamera = follow;};
94  bool GetLightFollowsCamera(){return m_LightFollowsCamera;};
95 
96 
102  virtual int OnMouseWheel(HEventInfo &hevent);
103 
104 
110  virtual int OnMButtonDown(HEventInfo &hevent);
111 
118  virtual int OnMButtonDownAndMove(HEventInfo &hevent);
119 
125  virtual int OnMButtonUp(HEventInfo &hevent);
126 
132  virtual HBaseOperator * Clone();
133 
134 
140  void OnWalk(float requested_time, float actual_time);
146  void OnKeyWalk(float requested_time, float actual_time);
147 
148  void OnButtonWalk(char const * action, HButtonState buttonstate);
149 
150 
158  static bool WalkTimerClbk(float request_time, float actual_time, void * user_data);
159 
163  void ViewDeleted() { m_bViewDeleted = true; }
164 
169  void SetKeyboardWalk(bool kw) { m_bKeyboardWalk = kw; }
174  void SetCollision(bool c) { m_bCollision = c; }
179  void SetSnapToFloor(bool s) { m_bSnapToFloor = s; }
184  void SetAvatarHeight(float ah) { m_AvatarHeight = ah; m_bOldSnappedToGround = false; }
191  void SetStepHeightUp(float shu) { m_MaxUpGap = shu; }
198  void SetStepHeightDown(float shd) { m_MaxDownGap = shd; }
202  float GetAvatarHeight() { return m_AvatarHeight; }
208  void SetSpeed(float s) { m_Speed = s; }
209  float GetSpeed() { return m_Speed; }
210 
213  static float CalculateExtents(HBaseView *view);
214  int OnKeyDown(HEventInfo &hevent);
215  static int ImageAction(HImageRegion *ii,void *data, HButtonState keyup);
216 
221  void ShowNavigationWindow(char *image_dir = 0);
225  void RemoveNavigationWindow();
226 
227  void FitControlsToCorner();
228 
229  protected:
230  void SnapToGround();
231  void AdjustCameraCollision(HCamera &oldcamera, bool noextrude = false);
232  void AdjustHeight(HCamera &oldcamera);
233 
234  static bool signal_callback(int signal, void *signal_data, void *user_data);
235 
236  void ReadjustPosition();
237 
238  void SetupControls(char forward, char backward, char strafe_left, char strafe_right, char up, char down);
239 
240  private:
241 
242 
243  HCamera m_oldcamera;
244  bool m_bOperatorCreated;
245  void ResetPosition();
246  void Level();
247  bool m_LightFollowsCamera;
248  HPoint camera,target, up;
249  float m_time;
250  unsigned m_timer;
251  float m_max_world_extent;
252  float m_alpha;
253  float m_beta;
254  float m_rotate, m_move, m_tilt, m_updown, m_strafe;
255  bool m_walkmode;
256  int m_AxisMode;
257  bool m_bChange;
258  bool doOnce;
259  bool m_bViewDeleted;
260  HTClient* m_pWalkTimer;
261  int m_cookie;
262  bool m_bBlocked;
263  bool m_bBlockedForward;
264  bool m_bBlockedBackward;
265  bool m_bSnappedToGround;
266  bool m_bOldSnappedToGround;
267  bool m_bKeyboardWalk;
268  bool m_bCollision;
269  bool m_bSnapToFloor;
270 
271  float m_MaxUpGap;
272  float m_MaxDownGap;
273  float m_AvatarDiameter;
274  float m_AvatarHeight;
275  float m_Speed;
276  float m_totalrotate;
277  float m_totalrotateold;
278  char m_c_forward;
279  char m_c_backward;
280  char m_c_strafe_left;
281  char m_c_strafe_right;
282  char m_c_up;
283  char m_c_down;
284  bool m_bNoKeyMove;
285  bool m_bNavigationWindowActive;
286 };
287 
288 
289 #ifdef H_PACK_8
290 #pragma pack(pop)
291 #endif
292 
293 #endif
294 
295 
296 
virtual int OnLButtonDownAndMove(HEventInfo &hevent)
virtual int OnMButtonDown(HEventInfo &hevent)
virtual const char * GetName()
void SetLightFollowsCamera(bool follow)
Definition: HOpCameraWalk.h:92
void ViewDeleted()
Definition: HOpCameraWalk.h:163
float GetAvatarHeight()
Definition: HOpCameraWalk.h:202
virtual int OnLButtonUp(HEventInfo &hevent)
void SetSnapToFloor(bool s)
Definition: HOpCameraWalk.h:179
The HCamera class is the data type of a HOOPS Camera Attribute.
Definition: HUtility.h:537
Definition: HTManager.h:157
void SetStepHeightDown(float shd)
Definition: HOpCameraWalk.h:198
bool GetLightFollowsCamera()
Definition: HOpCameraWalk.h:94
virtual int OnMButtonUp(HEventInfo &hevent)
virtual HBaseOperator * Clone()
The HImageRegion class represents selectable regions inside an image panel.
Definition: HObjects.h:108
The HBaseOperator class serves as a base for classes which handle user input and operate on the scene...
Definition: HBaseOperator.h:60
void SetSpeed(float s)
Definition: HOpCameraWalk.h:208
The HPoint class is the data type of a three-dimensional point.
Definition: HGlobals.h:121
The HBaseView class defines and manages a view of model information.
Definition: HBaseView.h:332
void SetStepHeightUp(float shu)
Definition: HOpCameraWalk.h:191
virtual int OnMButtonDownAndMove(HEventInfo &hevent)
The HEventInfo class stores and manages event information.
Definition: HEventInfo.h:207
virtual int OnKeyDown(HEventInfo &hevent)
virtual int OnLButtonDown(HEventInfo &hevent)
void SetAvatarHeight(float ah)
Definition: HOpCameraWalk.h:184
void SetCollision(bool c)
Definition: HOpCameraWalk.h:174
virtual int OnMouseWheel(HEventInfo &hevent)
The HOpCameraWalk allows the user to walk "inside" of the current scene with optional collision detec...
Definition: HOpCameraWalk.h:44
void SetKeyboardWalk(bool kw)
Definition: HOpCameraWalk.h:169