Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HOpCameraWalk Class Reference

The HOpCameraWalk allows the user to walk "inside" of the current scene with optional collision detection. More...

#include <HOpCameraWalk.h>

List of all members.

Public Member Functions

virtual HBaseOperatorClone ()
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 (char *image_dir=0)
void ViewDeleted ()

Static Public Member Functions

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)

Protected Member Functions

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 ()

Static Protected Member Functions

static bool signal_callback (int signal, void *signal_data, void *user_data)

Detailed Description

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.


Constructor & Destructor Documentation

HOpCameraWalk::HOpCameraWalk ( HBaseView view,
int  DoRepeat = 0,
int  DoCapture = 1 
)

Constructs an HOpCameraWalk object.

Parameters:
viewA pointer to an HBaseView object.
DoRepeatAn integer denoting whether this is a repeatable operator. This parameter has been deprecated.
DoCaptureAn 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.

Member Function Documentation

virtual HBaseOperator* HOpCameraWalk::Clone ( ) [virtual]

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.

float HOpCameraWalk::GetAvatarHeight ( ) [inline]
Returns:
The eye level height of camera in relation to the floor plane.
bool HOpCameraWalk::GetLightFollowsCamera ( ) [inline]
Returns:
True if the light follows the camera or false if it doesn't.
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.

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:
heventAn HEventInfo object containing information about the current event
Returns:
An HOperatorReturn indicating the status of the event.

Reimplemented from HBaseOperator.

void HOpCameraWalk::OnKeyWalk ( float  requested_time,
float  actual_time 
)

This is the keyboard centric walking function called from timer callback.

Parameters:
requested_timethe time that the event had requested.
actual_timeThe actual time that this method was called.
virtual int HOpCameraWalk::OnLButtonDown ( HEventInfo hevent) [virtual]

The left button down handler defines the starting point for walk/rotation.

Parameters:
heventAn HEventInfo object containing information about the current event
Returns:
An HOperatorReturn indicating the status of the event.

Reimplemented from HBaseOperator.

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:
heventAn HEventInfo object containing information about the current event
Returns:
An HOperatorReturn indicating the status of the event.

Reimplemented from HBaseOperator.

virtual int HOpCameraWalk::OnLButtonUp ( HEventInfo hevent) [virtual]

Left button up handler ends the operation.

Parameters:
heventAn HEventInfo object containing information about the current event
Returns:
An HOperatorReturn indicating the status of the event.

Reimplemented from HBaseOperator.

virtual int HOpCameraWalk::OnMButtonDown ( HEventInfo hevent) [virtual]

The middle button down handler defines the starting point for straffing and up/down movement.

Parameters:
heventAn HEventInfo object containing information about the current event
Returns:
An HOperatorReturn indicating the status of the event.

Reimplemented from HBaseOperator.

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:
heventAn HEventInfo object containing information about the current event
Returns:
An HOperatorReturn indicating the status of the event.

Reimplemented from HBaseOperator.

virtual int HOpCameraWalk::OnMButtonUp ( HEventInfo hevent) [virtual]

The middle button up handler uses event information to end the operation.

Parameters:
heventAn HEventInfo object containing information about the current event
Returns:
An HOperatorReturn indicating the status of the event.

Reimplemented from HBaseOperator.

virtual int HOpCameraWalk::OnMouseWheel ( HEventInfo hevent) [virtual]

The mouse wheel handler uses event information to tilt the camera around the horizontal axis.

Parameters:
heventAn HEventInfo object containing information about the current event
Returns:
An HOperatorReturn indicating the status of the event.

Reimplemented from HBaseOperator.

void HOpCameraWalk::OnWalk ( float  requested_time,
float  actual_time 
)

This is a mouse centric walking function called from timer callback.

Parameters:
requested_timethe time that the event had requested.
actual_timethe actual time
void HOpCameraWalk::RemoveNavigationWindow ( )

Remove the navigation bar from the window.

void HOpCameraWalk::SetAvatarHeight ( float  ah) [inline]

Sets distance from floor to camera position if floor snapping is on.

Parameters:
ahThe height of the camera from the floor.
void HOpCameraWalk::SetCollision ( bool  c) [inline]

Activates/Deactivates collision detection during walk.

Parameters:
cPass true to turn on collision detection.
void HOpCameraWalk::SetKeyboardWalk ( bool  kw) [inline]

Activates/deactivates keyboard centric walking.

Parameters:
kwPass true to activate walking via keyboard controls.
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:
followPass true to have the light follow the camera.
void HOpCameraWalk::SetSnapToFloor ( bool  s) [inline]

Activates/Deactivates automatic adjustment of position to geometry "under" the camera.

Parameters:
sPass true to turn on snapping to the floor.
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:
sThe speed of the movement forward, back or across the scene.
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:
shdThe maximum height decrease of the camera when moving from one object to another.
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:
shuThe maximum height increase of the camera when moving from one object to another.
void HOpCameraWalk::ShowNavigationWindow ( char *  image_dir = 0)

Displays a navigation bar in the Window which users can then use to control the camera movement within the scene.

void HOpCameraWalk::ViewDeleted ( ) [inline]

Use this method to indicate that the HBaseView object associated to this operator has been deleted.

static bool HOpCameraWalk::WalkTimerClbk ( float  request_time,
float  actual_time,
void *  user_data 
) [static]

This is the walking function called from timer.

Parameters:
request_timethe time that the event had requested.
actual_timeThe actual time that this method was called.
user_dataOptional user data.
Returns:
Success

The documentation for this class was generated from the following file: