Osiris Framework  0.3
OCameraController Class Reference

Camera control class. More...

#include <OsirisSDK/OCameraController.h>

Inheritance diagram for OCameraController:
OObject

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...
 

Detailed Description

Camera control class.

Objects from this class will receive input information from mouse and keyboard and move the camera and change it's orientation.

Member Enumeration Documentation

Camera movement events.

Enumerator
MoveForward 

Move camera forward.

MoveBack 

Move camera back.

MoveLeft 

Move camera left.

MoveRight 

Move camera right.

MoveUp 

Move camera up.

MoveDown 

Move camera down.

Mouse orientation mode.

The camera orientation can be changed by mouse movement, either enabled or passive.

Enumerator
OrientationDisabled 

Mouse orientation disabled.

ActiveOrientation 

Orientation by enabled mouse movement (button pressed).

PassiveOrientation 

Orientation by mouse motion over the screen, without any buttons pressed.

Constructor & Destructor Documentation

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.

Parameters
appThe application object.
orModeCamera orientation mode: enabled or passive mouse movement, or disabled.
orMouseBtnIn case of enabled mouse motion, which button triggers camera movement.
movementAccelerationCamera movement acceleration in space units per sec^2.
movementMaxSpeedCamera maximum speed in space units per sec.

Member Function Documentation

float OCameraController::movementAcceleration ( ) const

Returns camera movement acceleration value.

Returns
Movement acceleration in units of space per sec^2.
float OCameraController::movementMaxSpeed ( ) const

Returns camera maximum movement speed.

Returns
Maximum speed in units of space per sec.
void OCameraController::onKeyboardPress ( const OKeyboardPressEvent evt)
protectedvirtual

Keyboard press event handler.

This handler is only called if the object is set as an event recipient. By default does nothing.

Parameters
evtKeyboard event object.

Reimplemented from OObject.

void OCameraController::onKeyboardRelease ( const OKeyboardPressEvent evt)
protectedvirtual

Mouse release event handler.

This handler is only called if the object is set as an event recipient. By default does nothing.

Parameters
evtMouse click event object.

Reimplemented from OObject.

void OCameraController::onMouseClick ( const OMouseClickEvent evt)
protectedvirtual

Mouse click event handler.

This handler is only called if the object is set as an event recipient. By default does nothing.

Parameters
evtMouse click event object.

Reimplemented from OObject.

void OCameraController::onMouseMove ( const OMouseMoveEvent evt)
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.

Parameters
evtMouse move event object.

Reimplemented from OObject.

void OCameraController::setMoveEventKey ( OKeyboardPressEvent::KeyCode  key,
CameraMoveDir  camEvt 
)

Bind keyboard event to camera movement.

Parameters
keyKey code.
camEvtCamera movement event.
void OCameraController::setMovementAcceleration ( float  acc)

Set camera movement acceleration value.

Parameters
accMovement acceleration in units of space per sec^2.
void OCameraController::setMovementMaxSpeed ( float  maxSpeed)

Set camera maximum movement speed.

Parameters
maxSpeedMaximum speed in units of space per sec.
void OCameraController::update ( const OTimeIndex timeIndex)

Updates the camera position and orientation for a given time index.

Parameters
timeIndexTime index.

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