QVR 4.1.0
A library to build Virtual Reality applications
|
QVR application interface. More...
#include <app.hpp>
Public Member Functions | |
virtual void | render (QVRWindow *w, const QVRRenderContext &context, const unsigned int *textures)=0 |
Render the current frame. | |
virtual void | update (const QList< QVRObserver * > &observers) |
Update scene state. | |
virtual void | getNearFar (float &nearPlane, float &farPlane) |
Set the near and far clipping plane. | |
virtual bool | wantExit () |
Indicate if the application wants to exit. | |
virtual bool | initProcess (QVRProcess *p) |
Initialize an appplication process. | |
virtual void | exitProcess (QVRProcess *p) |
Cleanup an application process before exiting. | |
virtual void | preRenderProcess (QVRProcess *p) |
Perform actions once before each frame on each process. | |
virtual void | postRenderProcess (QVRProcess *p) |
Perform actions once after each frame on each process. | |
virtual bool | initWindow (QVRWindow *w) |
Initialize a window. | |
virtual void | exitWindow (QVRWindow *w) |
Cleanup a window before exiting. | |
virtual void | preRenderWindow (QVRWindow *w) |
Perform actions once before each frame on each window. | |
virtual void | postRenderWindow (QVRWindow *w) |
Perform actions once after each frame on each window. | |
virtual void | serializeDynamicData (QDataStream &ds) const |
Serialize data that changes between frames. | |
virtual void | deserializeDynamicData (QDataStream &ds) |
Deserialize data that changes between frames. | |
virtual void | serializeStaticData (QDataStream &ds) const |
Serialize data that does not change after initialization. | |
virtual void | deserializeStaticData (QDataStream &ds) |
Deserialize data that does not change after initialization. | |
virtual void | keyPressEvent (const QVRRenderContext &context, QKeyEvent *event) |
Handle a key press event. | |
virtual void | keyReleaseEvent (const QVRRenderContext &context, QKeyEvent *event) |
Handle a key release event. | |
virtual void | mouseMoveEvent (const QVRRenderContext &context, QMouseEvent *event) |
Handle a mouse move release event. | |
virtual void | mousePressEvent (const QVRRenderContext &context, QMouseEvent *event) |
Handle a mouse press event. | |
virtual void | mouseReleaseEvent (const QVRRenderContext &context, QMouseEvent *event) |
Handle a mouse release event. | |
virtual void | mouseDoubleClickEvent (const QVRRenderContext &context, QMouseEvent *event) |
Handle a mouse double click event. | |
virtual void | wheelEvent (const QVRRenderContext &context, QWheelEvent *event) |
Handle a wheel event. | |
virtual void | deviceButtonPressEvent (QVRDeviceEvent *event) |
Handle a device button press event. | |
virtual void | deviceButtonReleaseEvent (QVRDeviceEvent *event) |
Handle a device button release event. | |
virtual void | deviceAnalogChangeEvent (QVRDeviceEvent *event) |
Handle a device analog element change event. | |
QVR application interface.
This is the central interface that VR applications must implement. Most functions provide a default implementation. The only function that must be implemented is render().
Overview:
A key concept of QVR is that an application uses only one OpenGL context. This context is available to almost all functions in the interface.
|
inlinevirtual |
Deserialize data that changes between frames.
ds | Stream to read the serialization data from. |
Implement this if you want to support multi-process configurations. Only serialize data that is required by render() and may change; this is typically what you manipulate in update().
See also serializeDynamicData().
|
inlinevirtual |
Deserialize data that does not change after initialization.
ds | Stream to read the serialization data from. |
Only implement this if you want to support multi-process configurations and your application benefits from transferring initialized data to child processes instead of initializing the data in each process.
See also serializeStaticData().
|
inlinevirtual |
Handle a device analog element change event.
event | The event |
All events from all devices are gathered by the QVRManager.
This function is called once for each event before each frame on the main process, before update().
|
inlinevirtual |
Handle a device button press event.
event | The event |
All events from all devices are gathered by the QVRManager.
This function is called once for each event before each frame on the main process, before update().
|
inlinevirtual |
Handle a device button release event.
event | The event |
All events from all devices are gathered by the QVRManager.
This function is called once for each event before each frame on the main process, before update().
|
inlinevirtual |
Cleanup an application process before exiting.
p | The process |
This function cleans up process-specific data.
It is called by QVRManager when the application is terminated.
Called once per process at termination time.
|
inlinevirtual |
Cleanup a window before exiting.
w | The window |
This function cleans up window-specific data (this is usually unnecessary).
It is called by QVRManager when the application is terminated.
Called once per window at termination time.
|
inlinevirtual |
Set the near and far clipping plane.
nearPlane | Near clipping plane |
farPlane | Far clipping plane |
Called once before each frame on the main process.
|
inlinevirtual |
Initialize an appplication process.
p | The process |
This function typically sets up process-specific data for rendering, e.g. OpenGL textures and vertex array buffers.
This function is called from QVRManager::init(). If it returns false, then QVRManager initialization will fail.
Called once per process at initialization time.
|
inlinevirtual |
Initialize a window.
w | The window |
This function may set up window-specific data. This is usually unnecessary.
This function is called from QVRManager::init(). If it returns false, then QVRManager initialization will fail.
Called once per window at initialization time.
|
inlinevirtual |
Handle a key press event.
context | The context that this event originated from |
event | The event |
All events from all windows on all processes are gathered by the QVRManager.
This function is called once before each frame on the main process, before update().
|
inlinevirtual |
Handle a key release event.
context | The context that this event originated from |
event | The event |
All events from all windows on all processes are gathered by the QVRManager.
This function is called once for each event before each frame on the main process, before update().
|
inlinevirtual |
Handle a mouse double click event.
context | The context that this event originated from |
event | The event |
All events from all windows on all processes are gathered by the QVRManager.
This function is called once for each event before each frame on the main process, before update().
|
inlinevirtual |
Handle a mouse move release event.
context | The context that this event originated from |
event | The event |
All events from all windows on all processes are gathered by the QVRManager.
This function is called once for each event before each frame on the main process, before update().
|
inlinevirtual |
Handle a mouse press event.
context | The context that this event originated from |
event | The event |
All events from all windows on all processes are gathered by the QVRManager.
This function is called once for each event before each frame on the main process, before update().
|
inlinevirtual |
Handle a mouse release event.
context | The context that this event originated from |
event | The event |
All events from all windows on all processes are gathered by the QVRManager.
This function is called once for each event before each frame on the main process, before update().
|
inlinevirtual |
Perform actions once after each frame on each process.
p | The process |
This function is called once for each process after each frame.
|
inlinevirtual |
Perform actions once after each frame on each window.
w | The window |
This function is called once for each window after each frame.
|
inlinevirtual |
Perform actions once before each frame on each process.
p | The process |
This function is called once for each process before each frame.
|
inlinevirtual |
Perform actions once before each frame on each window.
w | The window |
This function is called once for each window before each frame.
|
pure virtual |
Render the current frame.
w | The window |
context | The render context with information on how to render |
textures | The textures to render into |
This function is called for each window to render the current frame into textures. Monoscopic windows require one view per frame (for a single eye), and stereoscopic windows require two views (one for each eye). The context provides information about the required views and how to render them.
A typical implementation does the following:
This example renders one or two views sequentially. As an alternative, some platform-dependent OpenGL extensions allow to render two views at once to reduce rendering costs.
|
inlinevirtual |
Serialize data that changes between frames.
ds | Stream to write the serialization data to. |
Implement this if you want to support multi-process configurations. Only serialize data that is required by render() and may change; this is typically what you manipulate in update().
See also deserializeDynamicData().
|
inlinevirtual |
Serialize data that does not change after initialization.
ds | Stream to write the serialization data to. |
Only implement this if you want to support multi-process configurations and your application benefits from transferring initialized data to child processes instead of initializing the data in each process.
See also deserializeStaticData().
|
inlinevirtual |
Update scene state.
observers | A list of observers that the application may modify. |
Update scene state, e.g. for animations and interaction.
You can query the state of interaction devices via QVRManager::deviceCount() and QVRManager::device(). This is useful for implementing interaction, tracking, and navigation functionality (all optional).
The list of observers contains all observers in the active configuration. You can update these observers to implement your own tracking and/or navigation functionality (optional). You should only update an observer's navigation information via QVRObserver::setNavigation() if its navigation type is QVR_Navigation_Custom. You should only update an observer's tracking information via QVRObserver::setTracking() if its tracking type is QVR_Tracking_Custom.
Called once before each frame on the main process.
|
inlinevirtual |
Indicate if the application wants to exit.
When this function returns true, the application will be terminated by the QVRManager. Typically an application returns true when ESC is pressed.
Called once before each frame on the main process.
|
inlinevirtual |
Handle a wheel event.
context | The context that this event originated from |
event | The event |
All events from all windows on all processes are gathered by the QVRManager.
This function is called once for each event before each frame on the main process, before update().