HOpCameraWalk
Functions
char const * |
|
int |
|
int |
|
int |
|
void |
|
bool |
|
int |
|
int |
|
int |
|
int |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
float |
|
void |
|
float |
|
int |
|
void |
|
void |
|
void |
|
bool |
|
float |
|
int |
Detailed Description
-
class HOpCameraWalk : public HBaseOperator
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.
Public Functions
-
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.
-
virtual ~HOpCameraWalk()
-
virtual char const *GetName()
- Returns:
A pointer to a character string denoting the name of the operator which is ‘HOpCameraWalk’.
-
virtual int OnLButtonDown(HEventInfo &hevent)
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.
-
virtual int OnLButtonDownAndMove(HEventInfo &hevent)
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.
-
virtual int OnLButtonUp(HEventInfo &hevent)
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.
-
inline void SetLightFollowsCamera(bool follow)
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.
-
inline bool GetLightFollowsCamera()
- Returns:
True if the light follows the camera or false if it doesn’t.
-
virtual int OnMouseWheel(HEventInfo &hevent)
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.
-
virtual int OnMButtonDown(HEventInfo &hevent)
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.
-
virtual int OnMButtonDownAndMove(HEventInfo &hevent)
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.
-
virtual int OnMButtonUp(HEventInfo &hevent)
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.
-
virtual HBaseOperator *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.
-
void 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
-
void 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.
-
void OnButtonWalk(char const *action, HButtonState buttonstate)
-
inline void ViewDeleted()
Use this method to indicate that the HBaseView object associated to this operator has been deleted.
-
inline void SetKeyboardWalk(bool kw)
Activates/deactivates keyboard centric walking.
- Parameters:
kw – Pass true to activate walking via keyboard controls.
-
inline void SetCollision(bool c)
Activates/Deactivates collision detection during walk.
- Parameters:
c – Pass true to turn on collision detection.
-
inline void SetSnapToFloor(bool s)
Activates/Deactivates automatic adjustment of position to geometry “under” the camera.
- Parameters:
s – Pass true to turn on snapping to the floor.
-
inline void SetAvatarHeight(float ah)
Sets distance from floor to camera position if floor snapping is on.
- Parameters:
ah – The height of the camera from the floor.
-
inline void SetStepHeightUp(float shu)
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.
-
inline void SetStepHeightDown(float shd)
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.
-
inline float GetAvatarHeight()
- Returns:
The eye level height of camera in relation to the floor plane.
-
inline void SetSpeed(float s)
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.
-
inline float GetSpeed()
-
virtual int OnKeyDown(HEventInfo &hevent)
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.
Displays a navigation bar in the Window which users can then use to control the camera movement within the scene.
Remove the navigation bar from the window.
-
void FitControlsToCorner()
Public Static Functions
-
static bool WalkTimerClbk(float request_time, float actual_time, void *user_data)
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
-
static int ImageAction(HImageRegion *ii, void *data, HButtonState keyup)
-
HOpCameraWalk(HBaseView *view, int DoRepeat = 0, int DoCapture = 1)