The HOpCameraWalk allows the user to walk "inside" of the current scene with optional collision detection.
More...
#include <HOpCameraWalk.h>
|
virtual HBaseOperator * | Clone () |
|
void | FitControlsToCorner () |
|
float | GetAvatarHeight () |
|
bool | GetLightFollowsCamera () |
|
virtual const char * | GetName () |
|
float | GetSpeed () |
|
| HOpCameraWalk (HBaseView *view, int DoRepeat=0, int DoCapture=1) |
|
void | OnButtonWalk (char const *action, HButtonState buttonstate) |
|
int | OnKeyDown (HEventInfo &hevent) |
|
void | OnKeyWalk (float requested_time, float actual_time) |
|
virtual int | OnLButtonDown (HEventInfo &hevent) |
|
virtual int | OnLButtonDownAndMove (HEventInfo &hevent) |
|
virtual int | OnLButtonUp (HEventInfo &hevent) |
|
virtual int | OnMButtonDown (HEventInfo &hevent) |
|
virtual int | OnMButtonDownAndMove (HEventInfo &hevent) |
|
virtual int | OnMButtonUp (HEventInfo &hevent) |
|
virtual int | OnMouseWheel (HEventInfo &hevent) |
|
void | OnWalk (float requested_time, float actual_time) |
|
void | RemoveNavigationWindow () |
|
void | SetAvatarHeight (float ah) |
|
void | SetCollision (bool c) |
|
void | SetKeyboardWalk (bool kw) |
|
void | SetLightFollowsCamera (bool follow) |
|
void | SetSnapToFloor (bool s) |
|
void | SetSpeed (float s) |
|
void | SetStepHeightDown (float shd) |
|
void | SetStepHeightUp (float shu) |
|
void | ShowNavigationWindow (const char *image_dir=0) |
|
void | ViewDeleted () |
|
int | Capture () |
| Returns whether we are currently in mouse capture mode. See this class' constructor for a more detailed description of what this means. This method has been deprecated.
|
|
HPoint const | GetFirstPoint () |
| Returns the initial selection point.
|
|
HPoint const | GetNewPoint () |
| Returns the current selection point.
|
|
HBaseView * | GetView () |
| Returns a pointer to the view that this operator is associated with.
|
|
| HBaseOperator (HBaseView *view, int DoRepeat=0, int DoCapture=1) |
|
virtual int | OnKeyUp (HEventInfo &hevent) |
|
virtual int | OnLButtonDblClk (HEventInfo &hevent) |
|
virtual int | OnLRButtonDownAndMove (HEventInfo &hevent) |
|
virtual int | OnMButtonDblClk (HEventInfo &hevent) |
|
virtual int | OnMouseMove (HEventInfo &hevent) |
|
virtual int | OnNoButtonDownAndMove (HEventInfo &hevent) |
|
virtual int | OnRButtonDblClk (HEventInfo &hevent) |
|
virtual int | OnRButtonDown (HEventInfo &hevent) |
|
virtual int | OnRButtonDownAndMove (HEventInfo &hevent) |
|
virtual int | OnRButtonUp (HEventInfo &hevent) |
|
virtual int | OnTimer (HEventInfo &hevent) |
|
virtual int | OnTouchesDown (HEventInfo &hevent) |
|
virtual int | OnTouchesMove (HEventInfo &hevent) |
|
virtual int | OnTouchesUp (HEventInfo &hevent) |
|
virtual bool | OperatorStarted () |
| Operator has been started if true, and has not been started if false.
|
|
int | Repeat () |
| Returns whether the operation is repeatable. This method has been deprecated.
|
|
void | SetFirstPoint (HPoint const &new_point) |
| Sets the initial selection point.
|
|
void | SetMapTouchesToMouseEvents (bool val) |
| Touch Events are mapped to mouse events if true, and are not if false.
|
|
void | SetNewPoint (HPoint const &new_point) |
| Sets the current selection point.
|
|
void | SetOperatorStarted (bool val) |
| Operator has been started if true, and has not been started if false.
|
|
void | SetView (HBaseView *new_view) |
| Sets the view that this operator is associated with.
|
|
|
static float | CalculateExtents (HBaseView *view) |
|
static int | ImageAction (HImageRegion *ii, void *data, HButtonState keyup) |
|
static bool | WalkTimerClbk (float request_time, float actual_time, void *user_data) |
|
|
void | AdjustCameraCollision (HCamera &oldcamera, bool noextrude=false) |
|
void | AdjustHeight (HCamera &oldcamera) |
|
void | ReadjustPosition () |
|
void | SetupControls (char forward, char backward, char strafe_left, char strafe_right, char up, char down) |
|
void | SnapToGround () |
|
bool | IsSpecialKey (HC_KEY key) |
|
|
static bool | signal_callback (int signal, void *signal_data, void *user_data) |
|
The HOpCameraWalk allows the user to walk "inside" of the current scene with optional collision detection.
There are two different control schemes for camera manipulation which are keyboard or mouse based.
Keyboard based WASD Control:
This control scheme centers around the keyboard for movement and the mouse for changes in orientation. The "W" and "S" keys move the camera forward and backwards respectively while "A" and "D" allow for left and right strafing/dollying. "Q" and "Z" move the camera up and down. Alternatively the up and down arrow keys can be used for forward/backward, the left/right arrow keys for straffing and PageUp/PageDown for up/down movement. Holding down the left mouse button and dragging the mouse across the screen changes the camera orientation Additionally collision detection can be activated programatically. To override collision detection while walking hold down the "SHIFT" key.
Mouse based Control:
By Pressing the left mouse button and dragging the mouse forward or backward the camera moves along the current view vector. Dragging the mouse left and right rotates the camera around its current up-vector. Holding down the middle mouse button allows for up and down movement as well as straffing. The mouse wheel tilts the view around the horizontal camera axis
The "Space" Key recenters the camera along the current ground plane.
◆ HOpCameraWalk()
HOpCameraWalk::HOpCameraWalk |
( |
HBaseView * |
view, |
|
|
int |
DoRepeat = 0 , |
|
|
int |
DoCapture = 1 |
|
) |
| |
Constructs an HOpCameraWalk object.
- Parameters
-
view | A pointer to an HBaseView object. |
DoRepeat | An integer denoting whether this is a repeatable operator. This parameter has been deprecated. |
DoCapture | An integer denoting whether the mouse state should be captured, which means that all mouse events should be received after a mousedown, even if it leaves the window. This parameter has been deprecated. |
◆ Clone()
Creates a new operator which is a copy of the current operator. The user is responsible for deleting the newly created operator.
- Returns
- A pointer to the newly created HOpCameraWalk object.
Reimplemented from HBaseOperator.
◆ GetAvatarHeight()
float HOpCameraWalk::GetAvatarHeight |
( |
| ) |
|
|
inline |
- Returns
- The eye level height of camera in relation to the floor plane.
◆ GetLightFollowsCamera()
bool HOpCameraWalk::GetLightFollowsCamera |
( |
| ) |
|
|
inline |
- Returns
- True if the light follows the camera or false if it doesn't.
◆ GetName()
virtual const char* HOpCameraWalk::GetName |
( |
| ) |
|
|
virtual |
- Returns
- A pointer to a character string denoting the name of the operator which is 'HOpCameraWalk'.
Reimplemented from HBaseOperator.
◆ OnKeyDown()
int HOpCameraWalk::OnKeyDown |
( |
HEventInfo & |
hevent | ) |
|
|
virtual |
The derived operator should overload this function to intercept and handle the case where a keyboard key has been pressed down. It will be automatically called from the HOOPS/GUI toolkit when such an event occurs, and should be manually called by platform-specific UI code if HOOPS/GUI is not being used.
- Parameters
-
hevent | An HEventInfo object containing information about the current event |
- Returns
- An HOperatorReturn indicating the status of the event.
Reimplemented from HBaseOperator.
◆ OnKeyWalk()
void HOpCameraWalk::OnKeyWalk |
( |
float |
requested_time, |
|
|
float |
actual_time |
|
) |
| |
This is the keyboard centric walking function called from timer callback.
- Parameters
-
requested_time | the time that the event had requested. |
actual_time | The actual time that this method was called. |
◆ OnLButtonDown()
virtual int HOpCameraWalk::OnLButtonDown |
( |
HEventInfo & |
hevent | ) |
|
|
virtual |
The left button down handler defines the starting point for walk/rotation.
- Parameters
-
hevent | An HEventInfo object containing information about the current event |
- Returns
- An HOperatorReturn indicating the status of the event.
Reimplemented from HBaseOperator.
◆ OnLButtonDownAndMove()
virtual int HOpCameraWalk::OnLButtonDownAndMove |
( |
HEventInfo & |
hevent | ) |
|
|
virtual |
The left button down and move handler let the user drag the mouse forward and back to move the camera back and forth with a speed based on the distance to the initial mouse position. Moving the mouse horizontally rotates the camera.
- Parameters
-
hevent | An HEventInfo object containing information about the current event |
- Returns
- An HOperatorReturn indicating the status of the event.
Reimplemented from HBaseOperator.
◆ OnLButtonUp()
virtual int HOpCameraWalk::OnLButtonUp |
( |
HEventInfo & |
hevent | ) |
|
|
virtual |
Left button up handler ends the operation.
- Parameters
-
hevent | An HEventInfo object containing information about the current event |
- Returns
- An HOperatorReturn indicating the status of the event.
Reimplemented from HBaseOperator.
◆ OnMButtonDown()
virtual int HOpCameraWalk::OnMButtonDown |
( |
HEventInfo & |
hevent | ) |
|
|
virtual |
The middle button down handler defines the starting point for straffing and up/down movement.
- Parameters
-
hevent | An HEventInfo object containing information about the current event |
- Returns
- An HOperatorReturn indicating the status of the event.
Reimplemented from HBaseOperator.
◆ OnMButtonDownAndMove()
virtual int HOpCameraWalk::OnMButtonDownAndMove |
( |
HEventInfo & |
hevent | ) |
|
|
virtual |
The middle button down and move handler let the user drag the mouse forward and backward to move the camera up/down based on the distance to the initial mouse position. Moving the mouse horizontally strafes the camera left/right.
- Parameters
-
hevent | An HEventInfo object containing information about the current event |
- Returns
- An HOperatorReturn indicating the status of the event.
Reimplemented from HBaseOperator.
◆ OnMButtonUp()
virtual int HOpCameraWalk::OnMButtonUp |
( |
HEventInfo & |
hevent | ) |
|
|
virtual |
The middle button up handler uses event information to end the operation.
- Parameters
-
hevent | An HEventInfo object containing information about the current event |
- Returns
- An HOperatorReturn indicating the status of the event.
Reimplemented from HBaseOperator.
◆ OnMouseWheel()
virtual int HOpCameraWalk::OnMouseWheel |
( |
HEventInfo & |
hevent | ) |
|
|
virtual |
The mouse wheel handler uses event information to tilt the camera around the horizontal axis.
- Parameters
-
hevent | An HEventInfo object containing information about the current event |
- Returns
- An HOperatorReturn indicating the status of the event.
Reimplemented from HBaseOperator.
◆ OnWalk()
void HOpCameraWalk::OnWalk |
( |
float |
requested_time, |
|
|
float |
actual_time |
|
) |
| |
This is a mouse centric walking function called from timer callback.
- Parameters
-
requested_time | the time that the event had requested. |
actual_time | the actual time |
◆ RemoveNavigationWindow()
void HOpCameraWalk::RemoveNavigationWindow |
( |
| ) |
|
Remove the navigation bar from the window.
◆ SetAvatarHeight()
void HOpCameraWalk::SetAvatarHeight |
( |
float |
ah | ) |
|
|
inline |
Sets distance from floor to camera position if floor snapping is on.
- Parameters
-
ah | The height of the camera from the floor. |
◆ SetCollision()
void HOpCameraWalk::SetCollision |
( |
bool |
c | ) |
|
|
inline |
Activates/Deactivates collision detection during walk.
- Parameters
-
c | Pass true to turn on collision detection. |
◆ SetKeyboardWalk()
void HOpCameraWalk::SetKeyboardWalk |
( |
bool |
kw | ) |
|
|
inline |
Activates/deactivates keyboard centric walking.
- Parameters
-
kw | Pass true to activate walking via keyboard controls. |
◆ SetLightFollowsCamera()
void HOpCameraWalk::SetLightFollowsCamera |
( |
bool |
follow | ) |
|
|
inline |
SetLightFollowsCamera sets the lights to follow the camera or to stay in one place during orbit. This has the effect of either lighting the scene during orbit or allowing the camera to move through shadow. The default is off.
- Parameters
-
follow | Pass true to have the light follow the camera. |
◆ SetSnapToFloor()
void HOpCameraWalk::SetSnapToFloor |
( |
bool |
s | ) |
|
|
inline |
Activates/Deactivates automatic adjustment of position to geometry "under" the camera.
- Parameters
-
s | Pass true to turn on snapping to the floor. |
◆ SetSpeed()
void HOpCameraWalk::SetSpeed |
( |
float |
s | ) |
|
|
inline |
Sets Movement Speed. This value hich is initially set to to a quarter of the diagonal of the world bounding box represents the number of "units" the camera moves forward or strafes sideways per second.
- Parameters
-
s | The speed of the movement forward, back or across the scene. |
◆ SetStepHeightDown()
void HOpCameraWalk::SetStepHeightDown |
( |
float |
shd | ) |
|
|
inline |
Sets maximum "down" step height. While "walking" with collision detection, this value determines the maximum vertical distance decrease when moving from one object at a given elevation to another one at a lower elevation.
- Parameters
-
shd | The maximum height decrease of the camera when moving from one object to another. |
◆ SetStepHeightUp()
void HOpCameraWalk::SetStepHeightUp |
( |
float |
shu | ) |
|
|
inline |
Sets maximum "up" step height. While "walking" with collision detection, this value determines what maximum vertical distance increased allowed when moving from one object at a given elevation to another one at a higher elevation.
- Parameters
-
shu | The maximum height increase of the camera when moving from one object to another. |
◆ ShowNavigationWindow()
void HOpCameraWalk::ShowNavigationWindow |
( |
const char * |
image_dir = 0 | ) |
|
Displays a navigation bar in the Window which users can then use to control the camera movement within the scene.
◆ ViewDeleted()
void HOpCameraWalk::ViewDeleted |
( |
| ) |
|
|
inline |
Use this method to indicate that the HBaseView object associated to this operator has been deleted.
◆ WalkTimerClbk()
static bool HOpCameraWalk::WalkTimerClbk |
( |
float |
request_time, |
|
|
float |
actual_time, |
|
|
void * |
user_data |
|
) |
| |
|
static |
This is the walking function called from timer.
- Parameters
-
request_time | the time that the event had requested. |
actual_time | The actual time that this method was called.
|
user_data | Optional user data.
|
- Returns
- Success
The documentation for this class was generated from the following file: