Ocular Engine
Ocular::Core::FreeFlyController Class Reference

#include <FreeFlyController.hpp>

Inheritance diagram for Ocular::Core::FreeFlyController:
Ocular::Core::ARoutine Ocular::Core::Object Ocular::Core::AEventListener Ocular::Core::ObjectIO Ocular::Core::Exposable Ocular::Core::Buildable

Public Member Functions

virtual void onUpdate (float const delta) override
 
virtual bool onEvent (std::shared_ptr< AEvent > event) override
 
void setLookSensitivity (float sensitivity)
 
float getLookSensitivity () const
 
void setMovementSpeed (float speed)
 
float getMovementSpeed () const
 
void setBurstSpeedModifier (float modifier)
 
float getBurstSpeedModifier () const
 
void setPreventRoll (bool prevent)
 
bool getPreventRoll () const
 
- Public Member Functions inherited from Ocular::Core::ARoutine
 ARoutine (std::string const &name, std::string const &type)
 
bool operator< (ARoutine const &rhs)
 
bool operator> (ARoutine const &rhs)
 
virtual void onSceneStart ()
 
virtual void onSceneEnd ()
 
virtual void onCreation ()
 
virtual void onDestruction ()
 
virtual void onPause ()
 
virtual void onUnpause ()
 
virtual float onTimedUpdate ()
 
virtual void onPreRender ()
 
virtual void onPostRender ()
 
Priority getPriorityLevel () const
 
SceneObjectgetParent () const
 
std::string const & getName () const
 
- Public Member Functions inherited from Ocular::Core::Object
 Object (std::string name, std::string className)
 Creates a new Object with the specified name and class. More...
 
 Object (std::string name)
 Creates a new Object with the specified name. More...
 
 Object ()
 Creates a new Object with the default name ('Name').
 
std::string const & getName () const
 
void setName (std::string name)
 Sets the name of the Object. More...
 
std::string const & getClass () const
 
void setUUID (std::string const &uuid)
 
UUID const & getUUID () const
 
int64_t getCreationTime () const
 
virtual std::string toString () const
 
template<class T >
bool isType ()
 
- Public Member Functions inherited from Ocular::Core::ObjectIO
virtual void onLoad (BuilderNode const *node) override
 
virtual void onSave (BuilderNode *node) const override
 
- Public Member Functions inherited from Ocular::Core::Exposable
void getAllExposedNames (std::vector< std::string > &names) const
 
bool getVariable (std::string const &name, ExposedVariable &var)
 
template<typename T >
bool getVariableValue (std::string const &name, T &var)
 
template<typename T >
bool setVariableValue (std::string const &name, T const &value)
 
virtual void onVariableModified (std::string const &varName)
 

Protected Member Functions

void handleMovement (float delta)
 
void handleMouseRotation ()
 
- Protected Member Functions inherited from Ocular::Core::ARoutine
virtual void setParent (SceneObject *object)
 
void setName (std::string const &name)
 
- Protected Member Functions inherited from Ocular::Core::Exposable
void exposeVariable (std::string const &name, std::string const &type, bool isPointer, bool isExposed, void *data)
 

Additional Inherited Members

- Protected Attributes inherited from Ocular::Core::ARoutine
Priority m_Priority
 Priority level of this Routine in the Routine Queue.
 
SceneObjectm_Parent
 The SceneObject instance that this routine is attached to.
 
- Protected Attributes inherited from Ocular::Core::Object
std::string m_Name
 
std::string m_Class
 
UUID m_UUID
 
const int64_t m_CreationTime
 
- Protected Attributes inherited from Ocular::Core::Exposable
std::unordered_map< std::string, ExposedVariablem_ExposedVariables
 

Detailed Description

Controller that allows for basic free-fly movement for any SceneObject it is attached to. The following controls are employed:

Key Action
W Move forward
A Move backward
S Move left
D Move right
Q Move up
Z Move down
Up Arrow Move forward
Down Arrow Move backward
Left Arrow Move left
Right Arrow Move right
Left Shift Apply movement burst
Spacebar Reset orientation
Mouse Rotation

Member Function Documentation

float Ocular::Core::FreeFlyController::getBurstSpeedModifier ( ) const
Returns
The burst speed modifier
float Ocular::Core::FreeFlyController::getLookSensitivity ( ) const
Returns
The mouse look sensitivity modifier.
float Ocular::Core::FreeFlyController::getMovementSpeed ( ) const
Returns
The movement speed in units per-second
bool Ocular::Core::FreeFlyController::getPreventRoll ( ) const
Returns
Whether roll changes are being prevented
bool Ocular::Core::FreeFlyController::onEvent ( std::shared_ptr< AEvent event)
overridevirtual

Called when an event occurs that the routine is registered as a listener for.

Parameters
[in]eventPointer to the event
Returns
TRUE to keep processing this event after this listener, FALSE to consume this event

Reimplemented from Ocular::Core::ARoutine.

void Ocular::Core::FreeFlyController::onUpdate ( float const  delta)
overridevirtual

Called once per frame. Generally, Routines are updated in the order they are traversed in a Scene.

If a special circumstance requires that a Routine's update is called before or after other Routines, then the priority level can be adjusted.

Parameters
[in]deltaCurrent delta time (time in seconds that the last frame took to complete).

Reimplemented from Ocular::Core::ARoutine.

void Ocular::Core::FreeFlyController::setBurstSpeedModifier ( float  modifier)

Sets the burst speed modifier used when left-shift is being held down.

Parameters
[in]modifierBurst speed modifier (default 5.0)
void Ocular::Core::FreeFlyController::setLookSensitivity ( float  sensitivity)

Sets the mouse look sensitivity modifier

Parameters
[in]sensitivityMouse sensitivity (default 1.0)
void Ocular::Core::FreeFlyController::setMovementSpeed ( float  speed)

Sets the default movement speed in units per-second

Parameters
[in]speedMovement speed in units per-second (default 1.0)
void Ocular::Core::FreeFlyController::setPreventRoll ( bool  prevent)

If TRUE, the controller will prevent any changes in the roll (z-axis rotation).

Parameters
[in]preventWhether to prevent rolling (default TRUE)

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