Visualization Library v1.0.3A lightweight C++ OpenGL middleware for 2D/3D graphics |
[Download] [Tutorials] [All Classes] [Grouped Classes] |
The Applet class is an utilitly UIEventListener that features a ghost manipulator, trackball manipulator, an FPS counter and a simple rendering pipeline. More...
#include <Applet.hpp>
Public Member Functions | |
Applet () | |
Constructor. | |
void | initialize () |
Initializes the default rendering (with Rendering), the default scene manager (with SceneManagerActorTree) and camera manipulators (GhostCameraManipulator and TrackballManipulator). | |
virtual void | addedListenerEvent (OpenGLContext *openglContext) |
Event generated whenever a listener is bound to an OpenGLContext context. | |
virtual void | removedListenerEvent (OpenGLContext *) |
Event generated whenever a listener is unbound from an OpenGLContext context. | |
virtual void | keyReleaseEvent (unsigned short, EKey key) |
Event generated when a key is released. | |
virtual void | destroyEvent () |
Event generated right before the bound OpenGLContext is destroyed. | |
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(). | |
virtual void | resizeEvent (int, int) |
Event generated when the bound OpenGLContext is resized. | |
virtual void | initEvent () |
Event generated when the bound OpenGLContext bocomes initialized or when the event listener is bound to an initialized OpenGLContext. | |
virtual void | enableEvent (bool) |
Event generated whenever setEnabled() is called. | |
virtual void | mouseMoveEvent (int, int) |
Event generated when the mouse moves. | |
virtual void | mouseUpEvent (EMouseButton, int, int) |
Event generated when one of the mouse buttons is released. | |
virtual void | mouseDownEvent (EMouseButton, int, int) |
Event generated when one of the mouse buttons is pressed. | |
virtual void | mouseWheelEvent (int) |
Event generated when the mouse wheel rotated. | |
virtual void | keyPressEvent (unsigned short, EKey) |
Event generated when a key is pressed. | |
virtual void | fileDroppedEvent (const std::vector< String > &) |
Event generated when one or more files are dropped on the bound OpenGLContext's area. | |
virtual void | visibilityEvent (bool) |
Event generated when the bound OpenGLContext is shown or hidden. | |
RenderingAbstract * | rendering () |
The rendering used by the Applet, by default a Rendering. | |
const RenderingAbstract * | rendering () const |
The rendering used by the Applet, by default a Rendering. | |
void | setRendering (RenderingAbstract *rendering) |
Sets the rendering used by the Applet, by default a Rendering. | |
SceneManagerActorTree * | sceneManager () |
The scene manager used by the default rendering. | |
const SceneManagerActorTree * | sceneManager () const |
The scene manager used by the default rendering. | |
void | setGhostCameraManipulator (GhostCameraManipulator *gcm) |
GhostCameraManipulator used by the applet, activated by the "F" key. | |
GhostCameraManipulator * | ghostCameraManipulator () |
GhostCameraManipulator used by the applet, activated by the "F" key. | |
const GhostCameraManipulator * | ghostCameraManipulator () const |
void | setTrackball (TrackballManipulator *trackball) |
TrackballManipulator used by the applet, activated by the "T" key. | |
TrackballManipulator * | trackball () |
TrackballManipulator used by the applet, activated by the "T" key. | |
const TrackballManipulator * | trackball () const |
double | fps () const |
Current average frames per second (updated every 500ms). | |
virtual void | updateScene () |
Override this to update the content of your scene. | |
void | setAppletName (const String &app_name) |
Sets the applet name, used for the window title and for naming screenshots. | |
const String & | appletName () const |
The applet name, used for the window title and for naming screenshots. | |
Protected Member Functions | |
void | bindManipulators (Camera *camera) |
The Applet class is an utilitly UIEventListener that features a ghost manipulator, trackball manipulator, an FPS counter and a simple rendering pipeline.
Default key bindings:
Definition at line 60 of file Applet.hpp.
Applet::Applet | ( | ) |
Constructor.
Definition at line 44 of file Applet.cpp.
References vl::Time::currentTime(), and VL_DEBUG_SET_OBJECT_NAME.
void Applet::initialize | ( | ) |
Initializes the default rendering (with Rendering), the default scene manager (with SceneManagerActorTree) and camera manipulators (GhostCameraManipulator and TrackballManipulator).
Definition at line 54 of file Applet.cpp.
References vl::Object::as(), bindManipulators(), vl::ref< T >::get(), rendering(), sceneManager(), and setRendering().
void Applet::addedListenerEvent | ( | OpenGLContext * | ) | [virtual] |
Event generated whenever a listener is bound to an OpenGLContext context.
Implements vl::UIEventListener.
Definition at line 168 of file Applet.cpp.
References vl::OpenGLContext::addEventListener(), vl::ref< T >::get(), NULL, and VL_CHECK.
void Applet::removedListenerEvent | ( | OpenGLContext * | ) | [virtual] |
Event generated whenever a listener is unbound from an OpenGLContext context.
Implements vl::UIEventListener.
Definition at line 179 of file Applet.cpp.
References vl::ref< T >::get(), and vl::OpenGLContext::removeEventListener().
void Applet::keyReleaseEvent | ( | unsigned | unicode_ch, |
EKey | key | ||
) | [virtual] |
Event generated when a key is released.
Implements vl::UIEventListener.
Definition at line 107 of file Applet.cpp.
References appletName(), vl::Time::dayOfMonth(), vl::ref< T >::get(), vl::Time::hour(), vl::Key_C, vl::Key_Escape, vl::Key_F, vl::Key_F1, vl::Key_F5, vl::Key_T, vl::Key_U, vl::Time::month(), vl::RenderingAbstract::onFinishedCallbacks(), vl::UIEventListener::openglContext(), vl::Log::print(), vl::Collection< T >::push_back(), vl::OpenGLContext::quitApplication(), vl::RDB_BACK_LEFT, rendering(), vl::Time::second(), vl::OpenGLContext::setContinuousUpdate(), vl::OpenGLContext::setFullscreen(), vl::OpenGLContext::update(), and vl::Time::year().
void Applet::destroyEvent | ( | ) | [virtual] |
Event generated right before the bound OpenGLContext is destroyed.
Implements vl::UIEventListener.
Definition at line 185 of file Applet.cpp.
References NULL.
void Applet::updateEvent | ( | ) | [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 75 of file Applet.cpp.
References vl::Time::currentTime(), vl::UIEventListener::openglContext(), vl::RenderingAbstract::render(), rendering(), vl::RenderingAbstract::setFrameClock(), vl::OpenGLContext::swapBuffers(), updateScene(), and VL_CHECK_OGL.
void Applet::resizeEvent | ( | int | x, |
int | y | ||
) | [virtual] |
Event generated when the bound OpenGLContext is resized.
Implements vl::UIEventListener.
Definition at line 146 of file Applet.cpp.
References vl::Rendering::camera(), vl::Renderer::framebuffer(), vl::Framebuffer::height(), vl::Rendering::renderer(), rendering(), vl::Viewport::setHeight(), vl::Camera::setProjectionPerspective(), vl::Viewport::setWidth(), vl::Camera::viewport(), VL_CHECK, and vl::Framebuffer::width().
virtual void vl::Applet::initEvent | ( | ) | [inline, virtual] |
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 88 of file Applet.hpp.
virtual void vl::Applet::enableEvent | ( | bool | enabled ) | [inline, virtual] |
Event generated whenever setEnabled() is called.
Implements vl::UIEventListener.
Definition at line 90 of file Applet.hpp.
virtual void vl::Applet::mouseMoveEvent | ( | int | x, |
int | y | ||
) | [inline, virtual] |
Event generated when the mouse moves.
Implements vl::UIEventListener.
Definition at line 92 of file Applet.hpp.
virtual void vl::Applet::mouseUpEvent | ( | EMouseButton | button, |
int | x, | ||
int | y | ||
) | [inline, virtual] |
Event generated when one of the mouse buttons is released.
Implements vl::UIEventListener.
Definition at line 94 of file Applet.hpp.
virtual void vl::Applet::mouseDownEvent | ( | EMouseButton | button, |
int | x, | ||
int | y | ||
) | [inline, virtual] |
Event generated when one of the mouse buttons is pressed.
Implements vl::UIEventListener.
Definition at line 96 of file Applet.hpp.
virtual void vl::Applet::mouseWheelEvent | ( | int | n ) | [inline, virtual] |
Event generated when the mouse wheel rotated.
Implements vl::UIEventListener.
Definition at line 98 of file Applet.hpp.
virtual void vl::Applet::keyPressEvent | ( | unsigned | unicode_ch, |
EKey | key | ||
) | [inline, virtual] |
Event generated when a key is pressed.
Implements vl::UIEventListener.
Definition at line 100 of file Applet.hpp.
virtual void vl::Applet::fileDroppedEvent | ( | const std::vector< String > & | files ) | [inline, virtual] |
Event generated when one or more files are dropped on the bound OpenGLContext's area.
Implements vl::UIEventListener.
Definition at line 102 of file Applet.hpp.
virtual void vl::Applet::visibilityEvent | ( | bool | visible ) | [inline, virtual] |
Event generated when the bound OpenGLContext is shown or hidden.
Implements vl::UIEventListener.
Definition at line 104 of file Applet.hpp.
RenderingAbstract* vl::Applet::rendering | ( | ) | [inline] |
The rendering used by the Applet, by default a Rendering.
Definition at line 109 of file Applet.hpp.
Referenced by initialize(), keyReleaseEvent(), resizeEvent(), and updateEvent().
const RenderingAbstract* vl::Applet::rendering | ( | ) | const [inline] |
The rendering used by the Applet, by default a Rendering.
Definition at line 112 of file Applet.hpp.
void vl::Applet::setRendering | ( | RenderingAbstract * | rendering ) | [inline] |
Sets the rendering used by the Applet, by default a Rendering.
Definition at line 115 of file Applet.hpp.
Referenced by initialize().
SceneManagerActorTree* vl::Applet::sceneManager | ( | ) | [inline] |
The scene manager used by the default rendering.
Definition at line 118 of file Applet.hpp.
Referenced by initialize().
const SceneManagerActorTree* vl::Applet::sceneManager | ( | ) | const [inline] |
The scene manager used by the default rendering.
Definition at line 121 of file Applet.hpp.
void vl::Applet::setGhostCameraManipulator | ( | GhostCameraManipulator * | gcm ) | [inline] |
GhostCameraManipulator used by the applet, activated by the "F" key.
Definition at line 124 of file Applet.hpp.
GhostCameraManipulator* vl::Applet::ghostCameraManipulator | ( | ) | [inline] |
GhostCameraManipulator used by the applet, activated by the "F" key.
Definition at line 127 of file Applet.hpp.
const GhostCameraManipulator* vl::Applet::ghostCameraManipulator | ( | ) | const [inline] |
Definition at line 128 of file Applet.hpp.
void vl::Applet::setTrackball | ( | TrackballManipulator * | trackball ) | [inline] |
TrackballManipulator used by the applet, activated by the "T" key.
Definition at line 131 of file Applet.hpp.
TrackballManipulator* vl::Applet::trackball | ( | ) | [inline] |
TrackballManipulator used by the applet, activated by the "T" key.
Definition at line 134 of file Applet.hpp.
const TrackballManipulator* vl::Applet::trackball | ( | ) | const [inline] |
Definition at line 135 of file Applet.hpp.
double vl::Applet::fps | ( | ) | const [inline] |
Current average frames per second (updated every 500ms).
Definition at line 138 of file Applet.hpp.
virtual void vl::Applet::updateScene | ( | ) | [inline, virtual] |
Override this to update the content of your scene.
Called by updateEvent() right before rendering()->render() and swapping opengl front/back buffers.
true
. Definition at line 146 of file Applet.hpp.
Referenced by updateEvent().
void vl::Applet::setAppletName | ( | const String & | app_name ) | [inline] |
Sets the applet name, used for the window title and for naming screenshots.
Definition at line 149 of file Applet.hpp.
const String& vl::Applet::appletName | ( | ) | const [inline] |
The applet name, used for the window title and for naming screenshots.
Definition at line 152 of file Applet.hpp.
Referenced by keyReleaseEvent().
void Applet::bindManipulators | ( | Camera * | camera ) | [protected] |