Visualization Library 2.0.0
A 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. More... | |
void | initialize () |
Initializes the default rendering (with Rendering), the default scene manager (with SceneManagerActorTree) and camera manipulators (GhostCameraManipulator and TrackballManipulator). More... | |
virtual void | addedListenerEvent (OpenGLContext *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 | keyReleaseEvent (unsigned short, EKey key) |
Event generated when a key is released. More... | |
virtual void | destroyEvent () |
Event generated right before the bound OpenGLContext is destroyed. 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 | resizeEvent (int, int) |
Event generated when the bound OpenGLContext is resized. 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 | enableEvent (bool) |
Event generated whenever setEnabled() is called. More... | |
virtual void | mouseMoveEvent (int, int) |
Event generated when the mouse moves. 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 | 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... | |
RenderingAbstract * | rendering () |
The rendering used by the Applet, by default a Rendering. More... | |
const RenderingAbstract * | rendering () const |
The rendering used by the Applet, by default a Rendering. More... | |
void | setRendering (RenderingAbstract *rendering) |
Sets the rendering used by the Applet, by default a Rendering. More... | |
SceneManagerActorTree * | sceneManager () |
The scene manager used by the default rendering. More... | |
const SceneManagerActorTree * | sceneManager () const |
The scene manager used by the default rendering. More... | |
void | setGhostCameraManipulator (GhostCameraManipulator *gcm) |
GhostCameraManipulator used by the applet, activated by the "F" key. More... | |
GhostCameraManipulator * | ghostCameraManipulator () |
GhostCameraManipulator used by the applet, activated by the "F" key. More... | |
const GhostCameraManipulator * | ghostCameraManipulator () const |
void | setTrackball (TrackballManipulator *trackball) |
TrackballManipulator used by the applet, activated by the "T" key. More... | |
TrackballManipulator * | trackball () |
TrackballManipulator used by the applet, activated by the "T" key. More... | |
const TrackballManipulator * | trackball () const |
double | fps () const |
Current average frames per second (updated every 500ms). More... | |
virtual void | updateScene () |
Override this to update the content of your scene. More... | |
void | setAppletName (const String &app_name) |
Sets the applet name, used for the window title and for naming screenshots. More... | |
const String & | appletName () const |
The applet name, used for the window title and for naming screenshots. 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 | bindManipulators (Camera *camera) |
Protected Member Functions inherited from vl::Object | |
virtual | ~Object () |
Protected Attributes | |
ref< RenderingAbstract > | mRendering |
ref< GhostCameraManipulator > | mFly |
ref< TrackballManipulator > | mTrackball |
ref< SceneManagerActorTree > | mSceneManagerActorTree |
ref< ReadPixels > | mReadPixels |
String | mAppletName |
double | mStartTime |
double | mFPS |
int | mFrameCount |
Protected Attributes inherited from vl::Object | |
std::string | mObjectName |
IMutex * | mRefCountMutex |
int | mReferenceCount |
bool | mAutomaticDelete |
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(), mAppletName, mFPS, mFrameCount, mReadPixels, and mStartTime.
|
virtual |
Event generated whenever a listener is bound to an OpenGLContext context.
Implements vl::UIEventListener.
Definition at line 167 of file Applet.cpp.
References vl::OpenGLContext::addEventListener(), mFly, mTrackball, NULL, and VL_CHECK.
|
inline |
The applet name, used for the window title and for naming screenshots.
Definition at line 152 of file Applet.hpp.
Referenced by keyReleaseEvent().
|
protected |
Definition at line 159 of file Applet.cpp.
References mFly, mTrackball, and NULL.
Referenced by initialize().
|
virtual |
Event generated right before the bound OpenGLContext is destroyed.
Implements vl::UIEventListener.
Definition at line 190 of file Applet.cpp.
References mFly, mReadPixels, mRendering, mSceneManagerActorTree, mTrackball, NULL, vl::UIEventListener::openglContext(), and vl::OpenGLContext::removeEventListener().
|
inlinevirtual |
Event generated whenever setEnabled() is called.
Implements vl::UIEventListener.
Definition at line 90 of file Applet.hpp.
|
inlinevirtual |
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.
|
inline |
Current average frames per second (updated every 500ms).
Definition at line 138 of file Applet.hpp.
|
inline |
GhostCameraManipulator used by the applet, activated by the "F" key.
Definition at line 127 of file Applet.hpp.
|
inline |
Definition at line 128 of file Applet.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 88 of file Applet.hpp.
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::Rendering::camera(), vl::ref< T >::get(), mFly, mSceneManagerActorTree, mTrackball, rendering(), sceneManager(), vl::Rendering::sceneManagers(), and setRendering().
|
inlinevirtual |
Event generated when a key is pressed.
Implements vl::UIEventListener.
Definition at line 100 of file Applet.hpp.
|
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::Time::hour(), vl::Key_C, vl::Key_Escape, vl::Key_F, vl::Key_F1, vl::Key_F5, vl::Key_T, vl::Key_U, mFly, vl::Time::month(), mReadPixels, mTrackball, vl::RenderingAbstract::onFinishedCallbacks(), vl::UIEventListener::openglContext(), vl::Log::print(), vl::OpenGLContext::quitApplication(), vl::RDB_BACK_LEFT, rendering(), vl::Time::second(), vl::OpenGLContext::setContinuousUpdate(), vl::OpenGLContext::setFullscreen(), vl::OpenGLContext::update(), and vl::Time::year().
|
inlinevirtual |
Event generated when one of the mouse buttons is pressed.
Implements vl::UIEventListener.
Definition at line 96 of file Applet.hpp.
|
inlinevirtual |
Event generated when the mouse moves.
Implements vl::UIEventListener.
Definition at line 92 of file Applet.hpp.
|
inlinevirtual |
Event generated when one of the mouse buttons is released.
Implements vl::UIEventListener.
Definition at line 94 of file Applet.hpp.
|
inlinevirtual |
Event generated when the mouse wheel rotated.
Implements vl::UIEventListener.
Definition at line 98 of file Applet.hpp.
|
virtual |
Event generated whenever a listener is unbound from an OpenGLContext context.
Implements vl::UIEventListener.
Definition at line 178 of file Applet.cpp.
References mFly, mTrackball, and vl::OpenGLContext::removeEventListener().
|
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().
|
inline |
The rendering used by the Applet, by default a Rendering.
Definition at line 112 of file Applet.hpp.
|
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::set(), vl::Camera::setProjectionPerspective(), vl::Camera::viewport(), VL_CHECK, and vl::Framebuffer::width().
|
inline |
The scene manager used by the default rendering.
Definition at line 118 of file Applet.hpp.
Referenced by initialize().
|
inline |
The scene manager used by the default rendering.
Definition at line 121 of file Applet.hpp.
|
inline |
Sets the applet name, used for the window title and for naming screenshots.
Definition at line 149 of file Applet.hpp.
|
inline |
GhostCameraManipulator used by the applet, activated by the "F" key.
Definition at line 124 of file Applet.hpp.
|
inline |
Sets the rendering used by the Applet, by default a Rendering.
Definition at line 115 of file Applet.hpp.
Referenced by initialize().
|
inline |
TrackballManipulator used by the applet, activated by the "T" key.
Definition at line 131 of file Applet.hpp.
|
inline |
TrackballManipulator used by the applet, activated by the "T" key.
Definition at line 134 of file Applet.hpp.
|
inline |
Definition at line 135 of file Applet.hpp.
|
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(), mFPS, mFrameCount, mStartTime, vl::UIEventListener::openglContext(), vl::RenderingAbstract::render(), rendering(), vl::RenderingAbstract::setFrameClock(), vl::OpenGLContext::swapBuffers(), updateScene(), and VL_CHECK_OGL.
|
inlinevirtual |
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().
|
inlinevirtual |
Event generated when the bound OpenGLContext is shown or hidden.
Implements vl::UIEventListener.
Definition at line 104 of file Applet.hpp.
|
protected |
Definition at line 163 of file Applet.hpp.
Referenced by Applet().
|
protected |
Definition at line 159 of file Applet.hpp.
Referenced by addedListenerEvent(), bindManipulators(), destroyEvent(), initialize(), keyReleaseEvent(), and removedListenerEvent().
|
protected |
Definition at line 165 of file Applet.hpp.
Referenced by Applet(), and updateEvent().
|
protected |
Definition at line 166 of file Applet.hpp.
Referenced by Applet(), and updateEvent().
|
protected |
Definition at line 162 of file Applet.hpp.
Referenced by Applet(), destroyEvent(), and keyReleaseEvent().
|
protected |
Definition at line 158 of file Applet.hpp.
Referenced by destroyEvent().
|
protected |
Definition at line 161 of file Applet.hpp.
Referenced by destroyEvent(), and initialize().
|
protected |
Definition at line 164 of file Applet.hpp.
Referenced by Applet(), and updateEvent().
|
protected |
Definition at line 160 of file Applet.hpp.
Referenced by addedListenerEvent(), bindManipulators(), destroyEvent(), initialize(), keyReleaseEvent(), and removedListenerEvent().
Visualization Library 2.0.0 Reference Documentation
Updated on Wed Dec 23 2020 12:44:05.
© Copyright Michele Bosi. All rights reserved.