Visualization Library 2.0.0-b3

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
vl::GhostCameraManipulator Class Reference

The GhostCameraManipulator class is an UIEventListener that controls the position and orientation of a Camera. More...

#include <GhostCameraManipulator.hpp>

+ Inheritance diagram for vl::GhostCameraManipulator:

Public Member Functions

 GhostCameraManipulator ()
 Constructor. More...
 
virtual void mouseMoveEvent (int x, int y)
 Event generated when the mouse moves. More...
 
void enableEvent (bool enabled)
 Event generated whenever setEnabled() is called. More...
 
virtual void updateEvent ()
 Event generated when the bound OpenGLContext does not have any other message to process and OpenGLContext::continuousUpdate() is set to true or somebody calls OpenGLContext::update(). More...
 
virtual void initEvent ()
 Event generated when the bound OpenGLContext bocomes initialized or when the event listener is bound to an initialized OpenGLContext. More...
 
virtual void destroyEvent ()
 Event generated right before the bound OpenGLContext is destroyed. More...
 
virtual void addedListenerEvent (OpenGLContext *)
 Event generated whenever a listener is bound to an OpenGLContext context. More...
 
virtual void removedListenerEvent (OpenGLContext *)
 Event generated whenever a listener is unbound from an OpenGLContext context. More...
 
virtual void mouseUpEvent (EMouseButton, int, int)
 Event generated when one of the mouse buttons is released. More...
 
virtual void mouseDownEvent (EMouseButton, int, int)
 Event generated when one of the mouse buttons is pressed. More...
 
virtual void mouseWheelEvent (int)
 Event generated when the mouse wheel rotated. More...
 
virtual void keyPressEvent (unsigned short, EKey)
 Event generated when a key is pressed. More...
 
virtual void keyReleaseEvent (unsigned short, EKey)
 Event generated when a key is released. More...
 
virtual void resizeEvent (int, int)
 Event generated when the bound OpenGLContext is resized. More...
 
virtual void fileDroppedEvent (const std::vector< String > &)
 Event generated when one or more files are dropped on the bound OpenGLContext's area. More...
 
virtual void visibilityEvent (bool)
 Event generated when the bound OpenGLContext is shown or hidden. More...
 
void setCamera (Camera *camera)
 The camera to be manipulated. More...
 
Cameracamera ()
 The camera to be manipulated. More...
 
const Cameracamera () const
 The camera to be manipulated. More...
 
void setKeysForward (EKey key, EKey modifier=Key_None)
 Key bindings to move forward (default = Key_W). More...
 
void setKeysBackward (EKey key, EKey modifier=Key_None)
 Key bindings to move backward (default = Key_S). More...
 
void setKeysLeft (EKey key, EKey modifier=Key_None)
 Key bindings to move left (default = Key_A). More...
 
void setKeysRight (EKey key, EKey modifier=Key_None)
 Key bindings to move right (default = Key_D). More...
 
void setKeysUp (EKey key, EKey modifier=Key_None)
 Key bindings to move up (default = Key_W + Key_Shift). More...
 
void setKeysDown (EKey key, EKey modifier=Key_None)
 Key bindings to move down (default = Key_S + Key_Shift). More...
 
void setRotationSpeed (real speed)
 The camera rotation speed (default = 0.5). More...
 
real rotationSpeed () const
 The camera rotation speed (default = 0.5). More...
 
void setMovementSpeed (real speed)
 The camera translation speed (default = 50). More...
 
real movementSpeed () const
 The camera translation speed (default = 50). More...
 
- Public Member Functions inherited from vl::UIEventListener
 UIEventListener ()
 Constructor. More...
 
virtual void setEnabled (bool enabled)
 Enables or disables a UIEventListener. More...
 
bool isEnabled () const
 Returns whether the UIEventListener is currently enabled or not. More...
 
OpenGLContextopenglContext ()
 Returns the OpenGLContext to which this UIEventListener is bound or NULL if no context is bound. More...
 
const OpenGLContextopenglContext () const
 Returns the OpenGLContext to which this UIEventListener is bound or NULL if no context is bound. More...
 
- Public Member Functions inherited from vl::Object
 Object ()
 Constructor. More...
 
 Object (const Object &other)
 Copy constructor: copies the name, ref count mutex and user data. More...
 
Objectoperator= (const Object &other)
 Copy operator: copies the object's name, ref count mutex and user data. More...
 
const std::string & objectName () const
 The name of the object, by default set to the object's class name. More...
 
void setObjectName (const char *name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setObjectName (const std::string &name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setRefCountMutex (IMutex *mutex)
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
IMutexrefCountMutex ()
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
const IMutexrefCountMutex () const
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
int referenceCount () const
 Returns the number of references of an object. More...
 
void incReference () const
 Increments the reference count of an object. More...
 
void decReference ()
 Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More...
 
void setAutomaticDelete (bool autodel_on)
 If set to true the Object is deleted when its reference count reaches 0. More...
 
bool automaticDelete () const
 If set to true the Object is deleted when its reference count reaches 0. More...
 
template<class T >
T * as ()
 Casts an Object to the specified class. More...
 
template<class T >
const T * as () const
 Casts an Object to the specified class. More...
 

Protected Member Functions

void setPosition (vec3 position)
 
const vec3position () const
 
void setXDegrees (real degree)
 
real xDegrees ()
 
void setYDegrees (real degree)
 
real yDegrees ()
 
- Protected Member Functions inherited from vl::Object
virtual ~Object ()
 

Protected Attributes

ref< CameramCamera
 
vec3 mPosition
 
real mLastTime
 
real mRotationSpeed
 
real mMovementSpeed
 
real mXDegrees
 
real mYDegrees
 
EKey mKeysForward [2]
 
EKey mKeysBackward [2]
 
EKey mKeysUp [2]
 
EKey mKeysDown [2]
 
EKey mKeysLeft [2]
 
EKey mKeysRight [2]
 
- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Detailed Description

The GhostCameraManipulator class is an UIEventListener that controls the position and orientation of a Camera.

Using the GhostCameraManipulator class the user can freely fly around in the scene as if it was a ghost. Default key bindings:

Definition at line 55 of file GhostCameraManipulator.hpp.

Constructor & Destructor Documentation

◆ GhostCameraManipulator()

GhostCameraManipulator::GhostCameraManipulator ( )

Member Function Documentation

◆ addedListenerEvent()

virtual void vl::GhostCameraManipulator::addedListenerEvent ( OpenGLContext )
inlinevirtual

Event generated whenever a listener is bound to an OpenGLContext context.

Implements vl::UIEventListener.

Definition at line 75 of file GhostCameraManipulator.hpp.

◆ camera() [1/2]

Camera * GhostCameraManipulator::camera ( )

The camera to be manipulated.

Definition at line 129 of file GhostCameraManipulator.cpp.

References mCamera.

Referenced by enableEvent(), mouseMoveEvent(), setCamera(), and updateEvent().

◆ camera() [2/2]

const Camera * GhostCameraManipulator::camera ( ) const

The camera to be manipulated.

Definition at line 130 of file GhostCameraManipulator.cpp.

References mCamera.

◆ destroyEvent()

virtual void vl::GhostCameraManipulator::destroyEvent ( )
inlinevirtual

Event generated right before the bound OpenGLContext is destroyed.

Implements vl::UIEventListener.

Definition at line 73 of file GhostCameraManipulator.hpp.

◆ enableEvent()

void GhostCameraManipulator::enableEvent ( bool  enabled)
virtual

◆ fileDroppedEvent()

virtual void vl::GhostCameraManipulator::fileDroppedEvent ( const std::vector< String > &  files)
inlinevirtual

Event generated when one or more files are dropped on the bound OpenGLContext's area.

Implements vl::UIEventListener.

Definition at line 91 of file GhostCameraManipulator.hpp.

◆ initEvent()

virtual void vl::GhostCameraManipulator::initEvent ( )
inlinevirtual

Event generated when the bound OpenGLContext bocomes initialized or when the event listener is bound to an initialized OpenGLContext.

Implements vl::UIEventListener.

Definition at line 71 of file GhostCameraManipulator.hpp.

◆ keyPressEvent()

virtual void vl::GhostCameraManipulator::keyPressEvent ( unsigned  unicode_ch,
EKey  key 
)
inlinevirtual

Event generated when a key is pressed.

Implements vl::UIEventListener.

Definition at line 85 of file GhostCameraManipulator.hpp.

◆ keyReleaseEvent()

virtual void vl::GhostCameraManipulator::keyReleaseEvent ( unsigned  unicode_ch,
EKey  key 
)
inlinevirtual

Event generated when a key is released.

Implements vl::UIEventListener.

Definition at line 87 of file GhostCameraManipulator.hpp.

◆ mouseDownEvent()

virtual void vl::GhostCameraManipulator::mouseDownEvent ( EMouseButton  button,
int  x,
int  y 
)
inlinevirtual

Event generated when one of the mouse buttons is pressed.

Implements vl::UIEventListener.

Definition at line 81 of file GhostCameraManipulator.hpp.

◆ mouseMoveEvent()

void GhostCameraManipulator::mouseMoveEvent ( int  x,
int  y 
)
virtual

◆ mouseUpEvent()

virtual void vl::GhostCameraManipulator::mouseUpEvent ( EMouseButton  button,
int  x,
int  y 
)
inlinevirtual

Event generated when one of the mouse buttons is released.

Implements vl::UIEventListener.

Definition at line 79 of file GhostCameraManipulator.hpp.

◆ mouseWheelEvent()

virtual void vl::GhostCameraManipulator::mouseWheelEvent ( int  n)
inlinevirtual

Event generated when the mouse wheel rotated.

Implements vl::UIEventListener.

Definition at line 83 of file GhostCameraManipulator.hpp.

◆ movementSpeed()

real vl::GhostCameraManipulator::movementSpeed ( ) const
inline

The camera translation speed (default = 50).

Definition at line 134 of file GhostCameraManipulator.hpp.

◆ position()

const vec3& vl::GhostCameraManipulator::position ( ) const
inlineprotected

Definition at line 139 of file GhostCameraManipulator.hpp.

◆ removedListenerEvent()

virtual void vl::GhostCameraManipulator::removedListenerEvent ( OpenGLContext )
inlinevirtual

Event generated whenever a listener is unbound from an OpenGLContext context.

Implements vl::UIEventListener.

Definition at line 77 of file GhostCameraManipulator.hpp.

◆ resizeEvent()

virtual void vl::GhostCameraManipulator::resizeEvent ( int  x,
int  y 
)
inlinevirtual

Event generated when the bound OpenGLContext is resized.

Implements vl::UIEventListener.

Definition at line 89 of file GhostCameraManipulator.hpp.

◆ rotationSpeed()

real vl::GhostCameraManipulator::rotationSpeed ( ) const
inline

The camera rotation speed (default = 0.5).

Definition at line 128 of file GhostCameraManipulator.hpp.

◆ setCamera()

void GhostCameraManipulator::setCamera ( Camera camera)

The camera to be manipulated.

Definition at line 127 of file GhostCameraManipulator.cpp.

References camera(), and mCamera.

◆ setKeysBackward()

void vl::GhostCameraManipulator::setKeysBackward ( EKey  key,
EKey  modifier = Key_None 
)
inline

Key bindings to move backward (default = Key_S).

Definition at line 110 of file GhostCameraManipulator.hpp.

Referenced by GhostCameraManipulator().

◆ setKeysDown()

void vl::GhostCameraManipulator::setKeysDown ( EKey  key,
EKey  modifier = Key_None 
)
inline

Key bindings to move down (default = Key_S + Key_Shift).

Definition at line 122 of file GhostCameraManipulator.hpp.

Referenced by GhostCameraManipulator().

◆ setKeysForward()

void vl::GhostCameraManipulator::setKeysForward ( EKey  key,
EKey  modifier = Key_None 
)
inline

Key bindings to move forward (default = Key_W).

Definition at line 107 of file GhostCameraManipulator.hpp.

Referenced by GhostCameraManipulator().

◆ setKeysLeft()

void vl::GhostCameraManipulator::setKeysLeft ( EKey  key,
EKey  modifier = Key_None 
)
inline

Key bindings to move left (default = Key_A).

Definition at line 113 of file GhostCameraManipulator.hpp.

Referenced by GhostCameraManipulator().

◆ setKeysRight()

void vl::GhostCameraManipulator::setKeysRight ( EKey  key,
EKey  modifier = Key_None 
)
inline

Key bindings to move right (default = Key_D).

Definition at line 116 of file GhostCameraManipulator.hpp.

Referenced by GhostCameraManipulator().

◆ setKeysUp()

void vl::GhostCameraManipulator::setKeysUp ( EKey  key,
EKey  modifier = Key_None 
)
inline

Key bindings to move up (default = Key_W + Key_Shift).

Definition at line 119 of file GhostCameraManipulator.hpp.

Referenced by GhostCameraManipulator().

◆ setMovementSpeed()

void vl::GhostCameraManipulator::setMovementSpeed ( real  speed)
inline

The camera translation speed (default = 50).

Definition at line 131 of file GhostCameraManipulator.hpp.

◆ setPosition()

void vl::GhostCameraManipulator::setPosition ( vec3  position)
inlineprotected

Definition at line 137 of file GhostCameraManipulator.hpp.

Referenced by enableEvent().

◆ setRotationSpeed()

void vl::GhostCameraManipulator::setRotationSpeed ( real  speed)
inline

The camera rotation speed (default = 0.5).

Definition at line 125 of file GhostCameraManipulator.hpp.

◆ setXDegrees()

void vl::GhostCameraManipulator::setXDegrees ( real  degree)
inlineprotected

Definition at line 141 of file GhostCameraManipulator.hpp.

Referenced by enableEvent().

◆ setYDegrees()

void vl::GhostCameraManipulator::setYDegrees ( real  degree)
inlineprotected

Definition at line 145 of file GhostCameraManipulator.hpp.

Referenced by enableEvent().

◆ updateEvent()

void GhostCameraManipulator::updateEvent ( )
virtual

◆ visibilityEvent()

virtual void vl::GhostCameraManipulator::visibilityEvent ( bool  visible)
inlinevirtual

Event generated when the bound OpenGLContext is shown or hidden.

Implements vl::UIEventListener.

Definition at line 93 of file GhostCameraManipulator.hpp.

◆ xDegrees()

real vl::GhostCameraManipulator::xDegrees ( )
inlineprotected

Definition at line 143 of file GhostCameraManipulator.hpp.

◆ yDegrees()

real vl::GhostCameraManipulator::yDegrees ( )
inlineprotected

Definition at line 147 of file GhostCameraManipulator.hpp.

Member Data Documentation

◆ mCamera

ref<Camera> vl::GhostCameraManipulator::mCamera
protected

Definition at line 150 of file GhostCameraManipulator.hpp.

Referenced by camera(), and setCamera().

◆ mKeysBackward

EKey vl::GhostCameraManipulator::mKeysBackward[2]
protected

Definition at line 158 of file GhostCameraManipulator.hpp.

Referenced by updateEvent().

◆ mKeysDown

EKey vl::GhostCameraManipulator::mKeysDown[2]
protected

Definition at line 160 of file GhostCameraManipulator.hpp.

Referenced by updateEvent().

◆ mKeysForward

EKey vl::GhostCameraManipulator::mKeysForward[2]
protected

Definition at line 157 of file GhostCameraManipulator.hpp.

Referenced by updateEvent().

◆ mKeysLeft

EKey vl::GhostCameraManipulator::mKeysLeft[2]
protected

Definition at line 161 of file GhostCameraManipulator.hpp.

Referenced by updateEvent().

◆ mKeysRight

EKey vl::GhostCameraManipulator::mKeysRight[2]
protected

Definition at line 162 of file GhostCameraManipulator.hpp.

Referenced by updateEvent().

◆ mKeysUp

EKey vl::GhostCameraManipulator::mKeysUp[2]
protected

Definition at line 159 of file GhostCameraManipulator.hpp.

Referenced by updateEvent().

◆ mLastTime

real vl::GhostCameraManipulator::mLastTime
protected

Definition at line 152 of file GhostCameraManipulator.hpp.

Referenced by GhostCameraManipulator(), and updateEvent().

◆ mMovementSpeed

real vl::GhostCameraManipulator::mMovementSpeed
protected

Definition at line 154 of file GhostCameraManipulator.hpp.

Referenced by GhostCameraManipulator(), and updateEvent().

◆ mPosition

vec3 vl::GhostCameraManipulator::mPosition
protected

Definition at line 151 of file GhostCameraManipulator.hpp.

Referenced by GhostCameraManipulator(), and updateEvent().

◆ mRotationSpeed

real vl::GhostCameraManipulator::mRotationSpeed
protected

Definition at line 153 of file GhostCameraManipulator.hpp.

Referenced by GhostCameraManipulator(), and mouseMoveEvent().

◆ mXDegrees

real vl::GhostCameraManipulator::mXDegrees
protected

Definition at line 155 of file GhostCameraManipulator.hpp.

Referenced by GhostCameraManipulator(), mouseMoveEvent(), and updateEvent().

◆ mYDegrees

real vl::GhostCameraManipulator::mYDegrees
protected

Definition at line 156 of file GhostCameraManipulator.hpp.

Referenced by GhostCameraManipulator(), mouseMoveEvent(), and updateEvent().


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