Visualization Library 2.1.0
A lightweight C++ OpenGL middleware for 2D/3D graphics
|
[Download] [Tutorials] [All Classes] [Grouped Classes] |
The GhostCameraManipulator class is an UIEventListener that controls the position and orientation of a Camera. More...
#include <GhostCameraManipulator.hpp>
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... | |
Camera * | camera () |
The camera to be manipulated. More... | |
const Camera * | camera () 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... | |
OpenGLContext * | openglContext () |
Returns the OpenGLContext to which this UIEventListener is bound or NULL if no context is bound. More... | |
const OpenGLContext * | openglContext () 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... | |
Object & | operator= (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... | |
IMutex * | refCountMutex () |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
const IMutex * | refCountMutex () 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 vec3 & | position () 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< Camera > | mCamera |
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 |
IMutex * | mRefCountMutex |
int | mReferenceCount |
bool | mAutomaticDelete |
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:
Key_W
Key_S
Key_A
Key_D
Key_W
+ Key_Shift
Key_S
+ Key_Shift
Definition at line 55 of file GhostCameraManipulator.hpp.
GhostCameraManipulator::GhostCameraManipulator | ( | ) |
Constructor.
Definition at line 41 of file GhostCameraManipulator.cpp.
References vl::Key_A, vl::Key_D, vl::Key_S, vl::Key_Shift, vl::Key_W, mLastTime, mMovementSpeed, mPosition, mRotationSpeed, mXDegrees, mYDegrees, setKeysBackward(), setKeysDown(), setKeysForward(), setKeysLeft(), setKeysRight(), and setKeysUp().
|
inlinevirtual |
Event generated whenever a listener is bound to an OpenGLContext context.
Implements vl::UIEventListener.
Definition at line 75 of file GhostCameraManipulator.hpp.
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().
const Camera * GhostCameraManipulator::camera | ( | ) | const |
The camera to be manipulated.
Definition at line 130 of file GhostCameraManipulator.cpp.
References mCamera.
|
inlinevirtual |
Event generated right before the bound OpenGLContext is destroyed.
Implements vl::UIEventListener.
Definition at line 73 of file GhostCameraManipulator.hpp.
|
virtual |
Event generated whenever setEnabled() is called.
Implements vl::UIEventListener.
Definition at line 132 of file GhostCameraManipulator.cpp.
References camera(), vl::Viewport::center(), vl::OpenGLContext::framebuffer(), vl::Matrix4< T_Scalar >::getYXRotationAngles(), vl::Viewport::height(), vl::FramebufferObject::height(), vl::OpenGLContext::ignoreNextMouseMoveEvent(), vl::Camera::modelingMatrix(), NULL, vl::UIEventListener::openglContext(), vl::OpenGLContext::setContinuousUpdate(), vl::OpenGLContext::setMousePosition(), vl::OpenGLContext::setMouseVisible(), setPosition(), setXDegrees(), setYDegrees(), vl::Camera::viewport(), vl::Vector2< T_Scalar >::x(), and vl::Viewport::y().
|
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.
|
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.
|
inlinevirtual |
Event generated when a key is pressed.
Implements vl::UIEventListener.
Definition at line 85 of file GhostCameraManipulator.hpp.
|
inlinevirtual |
Event generated when a key is released.
Implements vl::UIEventListener.
Definition at line 87 of file GhostCameraManipulator.hpp.
|
inlinevirtual |
Event generated when one of the mouse buttons is pressed.
Implements vl::UIEventListener.
Definition at line 81 of file GhostCameraManipulator.hpp.
|
virtual |
Event generated when the mouse moves.
Implements vl::UIEventListener.
Definition at line 59 of file GhostCameraManipulator.cpp.
References camera(), vl::Viewport::center(), vl::OpenGLContext::framebuffer(), vl::Viewport::height(), vl::FramebufferObject::height(), vl::OpenGLContext::ignoreNextMouseMoveEvent(), mRotationSpeed, mXDegrees, mYDegrees, NULL, vl::UIEventListener::openglContext(), vl::OpenGLContext::setMousePosition(), vl::Camera::viewport(), VL_CHECK, vl::Vector2< T_Scalar >::x(), and vl::Viewport::y().
|
inlinevirtual |
Event generated when one of the mouse buttons is released.
Implements vl::UIEventListener.
Definition at line 79 of file GhostCameraManipulator.hpp.
|
inlinevirtual |
Event generated when the mouse wheel rotated.
Implements vl::UIEventListener.
Definition at line 83 of file GhostCameraManipulator.hpp.
|
inline |
The camera translation speed (default = 50).
Definition at line 134 of file GhostCameraManipulator.hpp.
|
inlineprotected |
Definition at line 139 of file GhostCameraManipulator.hpp.
|
inlinevirtual |
Event generated whenever a listener is unbound from an OpenGLContext context.
Implements vl::UIEventListener.
Definition at line 77 of file GhostCameraManipulator.hpp.
|
inlinevirtual |
Event generated when the bound OpenGLContext is resized.
Implements vl::UIEventListener.
Definition at line 89 of file GhostCameraManipulator.hpp.
|
inline |
The camera rotation speed (default = 0.5).
Definition at line 128 of file GhostCameraManipulator.hpp.
void GhostCameraManipulator::setCamera | ( | Camera * | camera | ) |
The camera to be manipulated.
Definition at line 127 of file GhostCameraManipulator.cpp.
Key bindings to move backward (default = Key_S).
Definition at line 110 of file GhostCameraManipulator.hpp.
Referenced by GhostCameraManipulator().
Key bindings to move down (default = Key_S + Key_Shift).
Definition at line 122 of file GhostCameraManipulator.hpp.
Referenced by GhostCameraManipulator().
Key bindings to move forward (default = Key_W).
Definition at line 107 of file GhostCameraManipulator.hpp.
Referenced by GhostCameraManipulator().
Key bindings to move left (default = Key_A).
Definition at line 113 of file GhostCameraManipulator.hpp.
Referenced by GhostCameraManipulator().
Key bindings to move right (default = Key_D).
Definition at line 116 of file GhostCameraManipulator.hpp.
Referenced by GhostCameraManipulator().
Key bindings to move up (default = Key_W + Key_Shift).
Definition at line 119 of file GhostCameraManipulator.hpp.
Referenced by GhostCameraManipulator().
|
inline |
The camera translation speed (default = 50).
Definition at line 131 of file GhostCameraManipulator.hpp.
|
inlineprotected |
Definition at line 137 of file GhostCameraManipulator.hpp.
Referenced by enableEvent().
|
inline |
The camera rotation speed (default = 0.5).
Definition at line 125 of file GhostCameraManipulator.hpp.
|
inlineprotected |
Definition at line 141 of file GhostCameraManipulator.hpp.
Referenced by enableEvent().
|
inlineprotected |
Definition at line 145 of file GhostCameraManipulator.hpp.
Referenced by enableEvent().
|
virtual |
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().
Implements vl::UIEventListener.
Definition at line 74 of file GhostCameraManipulator.cpp.
References camera(), vl::Time::currentTime(), vl::Matrix4< float >::getRotation(), vl::Matrix4< float >::getTranslation(), vl::Matrix4< T_Scalar >::getX(), vl::Matrix4< T_Scalar >::getY(), vl::Matrix4< T_Scalar >::getZ(), vl::OpenGLContext::isKeyPressed(), vl::Key_Alt, vl::Key_Ctrl, vl::Key_None, vl::Key_Shift, mKeysBackward, mKeysDown, mKeysForward, mKeysLeft, mKeysRight, mKeysUp, mLastTime, mMovementSpeed, vl::Camera::modelingMatrix(), mPosition, mXDegrees, mYDegrees, vl::Vector3< T_Scalar >::normalize(), NULL, vl::UIEventListener::openglContext(), vl::Camera::setModelingMatrix(), vl::Vector3< T_Scalar >::x(), vl::Vector3< T_Scalar >::y(), and vl::Vector3< T_Scalar >::z().
|
inlinevirtual |
Event generated when the bound OpenGLContext is shown or hidden.
Implements vl::UIEventListener.
Definition at line 93 of file GhostCameraManipulator.hpp.
|
inlineprotected |
Definition at line 143 of file GhostCameraManipulator.hpp.
|
inlineprotected |
Definition at line 147 of file GhostCameraManipulator.hpp.
Definition at line 150 of file GhostCameraManipulator.hpp.
Referenced by camera(), and setCamera().
|
protected |
Definition at line 158 of file GhostCameraManipulator.hpp.
Referenced by updateEvent().
|
protected |
Definition at line 160 of file GhostCameraManipulator.hpp.
Referenced by updateEvent().
|
protected |
Definition at line 157 of file GhostCameraManipulator.hpp.
Referenced by updateEvent().
|
protected |
Definition at line 161 of file GhostCameraManipulator.hpp.
Referenced by updateEvent().
|
protected |
Definition at line 162 of file GhostCameraManipulator.hpp.
Referenced by updateEvent().
|
protected |
Definition at line 159 of file GhostCameraManipulator.hpp.
Referenced by updateEvent().
|
protected |
Definition at line 152 of file GhostCameraManipulator.hpp.
Referenced by GhostCameraManipulator(), and updateEvent().
|
protected |
Definition at line 154 of file GhostCameraManipulator.hpp.
Referenced by GhostCameraManipulator(), and updateEvent().
|
protected |
Definition at line 151 of file GhostCameraManipulator.hpp.
Referenced by GhostCameraManipulator(), and updateEvent().
|
protected |
Definition at line 153 of file GhostCameraManipulator.hpp.
Referenced by GhostCameraManipulator(), and mouseMoveEvent().
|
protected |
Definition at line 155 of file GhostCameraManipulator.hpp.
Referenced by GhostCameraManipulator(), mouseMoveEvent(), and updateEvent().
|
protected |
Definition at line 156 of file GhostCameraManipulator.hpp.
Referenced by GhostCameraManipulator(), mouseMoveEvent(), and updateEvent().
Visualization Library 2.1.0 Reference Documentation
Updated on Wed Mar 10 2021 16:02:50.
© Copyright Michele Bosi. All rights reserved.