Osiris Framework
0.3
|
Camera control class. More...
#include <OsirisSDK/OCameraController.h>
Public Types | |
enum | MouseOrientationMode { OrientationDisabled =0, ActiveOrientation, PassiveOrientation } |
Mouse orientation mode. More... | |
enum | CameraMoveDir { MoveForward = 0x01, MoveBack, MoveLeft, MoveRight, MoveUp, MoveDown } |
Camera movement events. More... | |
Public Member Functions | |
OCameraController (OApplication *app, MouseOrientationMode orMode=ActiveOrientation, OMouseClickEvent::MouseButton orMouseBtn=OMouseClickEvent::LeftButton, float movementAcceleration=OSIRIS_CAMCTRL_DEFAULT_ACC, float movementMaxSpeed=OSIRIS_CAMCTRL_DEFAULT_MAXSPEED) | |
Class constructor. More... | |
virtual | ~OCameraController () |
Class destructor. | |
void | setMovementMaxSpeed (float maxSpeed) |
Set camera maximum movement speed. More... | |
float | movementMaxSpeed () const |
Returns camera maximum movement speed. More... | |
void | setMovementAcceleration (float acc) |
Set camera movement acceleration value. More... | |
float | movementAcceleration () const |
Returns camera movement acceleration value. More... | |
void | setMoveEventKey (OKeyboardPressEvent::KeyCode key, CameraMoveDir camEvt) |
Bind keyboard event to camera movement. More... | |
void | update (const OTimeIndex &timeIndex) |
Updates the camera position and orientation for a given time index. More... | |
Public Member Functions inherited from OObject | |
OObject () | |
Class constructor. | |
virtual | ~OObject () |
Class destructor. | |
void | scheduleDelete () |
Schedule this object for deletion at the end of an application loop. | |
virtual void | processEvent (const OEvent *evt) |
Main event handle. More... | |
Protected Member Functions | |
virtual void | onKeyboardPress (const OKeyboardPressEvent *evt) |
Keyboard press event handler. More... | |
virtual void | onKeyboardRelease (const OKeyboardPressEvent *evt) |
Mouse release event handler. More... | |
virtual void | onMouseMove (const OMouseMoveEvent *evt) |
Mouse active and passive move event handler. More... | |
virtual void | onMouseClick (const OMouseClickEvent *evt) |
Mouse click event handler. More... | |
Protected Member Functions inherited from OObject | |
virtual void | onScreenResize (const OResizeEvent *evt) |
Screen resize event handler. More... | |
Camera control class.
Objects from this class will receive input information from mouse and keyboard and move the camera and change it's orientation.
Mouse orientation mode.
The camera orientation can be changed by mouse movement, either enabled or passive.
OCameraController::OCameraController | ( | OApplication * | app, |
MouseOrientationMode | orMode = ActiveOrientation , |
||
OMouseClickEvent::MouseButton | orMouseBtn = OMouseClickEvent::LeftButton , |
||
float | movementAcceleration = OSIRIS_CAMCTRL_DEFAULT_ACC , |
||
float | movementMaxSpeed = OSIRIS_CAMCTRL_DEFAULT_MAXSPEED |
||
) |
Class constructor.
This constructor will also connect itself to the application in order to receive events.
app | The application object. |
orMode | Camera orientation mode: enabled or passive mouse movement, or disabled. |
orMouseBtn | In case of enabled mouse motion, which button triggers camera movement. |
movementAcceleration | Camera movement acceleration in space units per sec^2. |
movementMaxSpeed | Camera maximum speed in space units per sec. |
float OCameraController::movementAcceleration | ( | ) | const |
Returns camera movement acceleration value.
float OCameraController::movementMaxSpeed | ( | ) | const |
Returns camera maximum movement speed.
|
protectedvirtual |
Keyboard press event handler.
This handler is only called if the object is set as an event recipient. By default does nothing.
evt | Keyboard event object. |
Reimplemented from OObject.
|
protectedvirtual |
Mouse release event handler.
This handler is only called if the object is set as an event recipient. By default does nothing.
evt | Mouse click event object. |
Reimplemented from OObject.
|
protectedvirtual |
Mouse click event handler.
This handler is only called if the object is set as an event recipient. By default does nothing.
evt | Mouse click event object. |
Reimplemented from OObject.
|
protectedvirtual |
Mouse active and passive move event handler.
This handler is only called if the object is set as an event recipient. By default does nothing.
evt | Mouse move event object. |
Reimplemented from OObject.
void OCameraController::setMoveEventKey | ( | OKeyboardPressEvent::KeyCode | key, |
CameraMoveDir | camEvt | ||
) |
Bind keyboard event to camera movement.
key | Key code. |
camEvt | Camera movement event. |
void OCameraController::setMovementAcceleration | ( | float | acc | ) |
Set camera movement acceleration value.
acc | Movement acceleration in units of space per sec^2. |
void OCameraController::setMovementMaxSpeed | ( | float | maxSpeed | ) |
Set camera maximum movement speed.
maxSpeed | Maximum speed in units of space per sec. |
void OCameraController::update | ( | const OTimeIndex & | timeIndex | ) |
Updates the camera position and orientation for a given time index.
timeIndex | Time index. |