#include <vrj/Kernel/App.h>
Inheritance diagram for vrj::App:


Public Member Functions | |
| App (Kernel *kern=NULL) | |
| Constructor. | |
| virtual | ~App () |
| virtual void | init () |
| Application initialization function. | |
| virtual void | apiInit () |
| Application graphics API initialization function. | |
| virtual void | exit () |
| Executes any final clean-up needed for this application before exiting. | |
| virtual void | preFrame () |
| Executes any code needed to set up the application object state prior to rendering the scene. | |
| virtual void | latePreFrame () |
| Function called after preFrame() and application-specific data synchronization (in a cluster configuration) but before the start of a new frame. | |
| virtual void | intraFrame () |
| Function called during this application's drawing time. | |
| virtual void | postFrame () |
| Function called before updating input devices but after the frame rendering is complete. | |
| virtual void | reset () |
| Resets this application. | |
| bool | haveFocus () |
| Does this application currently have focus? If an application has focus, the user may be attempting to interact with it, so this application should process input. | |
| virtual void | focusChanged () |
| Called by the kernel when the focus state changes. | |
| void | setFocus (bool newState) |
| Sets the focus state. | |
| virtual float | getDrawScaleFactor () |
| Returns the scale factor to convert from Juggler units (meters) to application units. | |
Default config handlers. | |
| virtual bool | configCanHandle (jccl::ConfigElementPtr element) |
| Defaults to handling nothing. | |
| virtual bool | depSatisfied () |
| Are any application dependencies satisfied? If this application requires anything special of the system for successful initialization, check it here. | |
Factory functions | |
| virtual DrawManager * | getDrawManager ()=0 |
| Gets the Draw Manager to use. | |
| virtual SoundManager * | getSoundManager () |
| Get the SoundManager to use. | |
Public Attributes | |
| Kernel * | mKernel |
| The Juggler kernel (here for convienence). | |
| bool | mHaveFocus |
| The current focus state of this app object. | |
Protected Member Functions | |
| virtual bool | configAdd (jccl::ConfigElementPtr element) |
| |
| virtual bool | configRemove (jccl::ConfigElementPtr element) |
| |
This defines the base class for all graphics API-specific application object types. The interface given is what the VR Juggler kernel expects in order to communicate with the application. Most of the application's interface will be defined in the derived graphics API-specific classes.
Users should write their application objectcs as subclasses of the graphics API-specific classes. Overriding the virtual functions in this class and in the graphics API-specific subclasses is the method by which the application programmer interfaces with VR Juggler.
The VR Juggler kernel control loop will look similar to this:
while (drawing)
{
<b>app_obj->preFrame()</b>;
<b>app_obj->latePreFrame()</b>;
draw();
<b>app_obj->intraFrame()</b>;
sync();
<b>app_obj->postFrame()</b>;
updateAllDevices();
}
Definition at line 83 of file App.h.
| vrj::App::App | ( | Kernel * | kern = NULL |
) |
Constructor.
| kern | The vrj::Kernel instance that is active (so that the application has easy access to the kernel). If NULL, defaults to value from vrj::Kernel::instance() |
Definition at line 49 of file App.cpp.
References mKernel.
00050 : mKernel(kern) 00051 , mHaveFocus(true) 00052 { 00053 if(NULL == kern) 00054 { 00055 mKernel = Kernel::instance(); 00056 } 00057 }
| virtual vrj::App::~App | ( | ) | [inline, virtual] |
| virtual void vrj::App::init | ( | ) | [inline, virtual] |
Application initialization function.
Execute any initialization needed before the grahpics API is started.
Reimplemented in vrj::OpenSGApp, and vrj::OsgApp.
Definition at line 110 of file App.h.
Referenced by vrj::OsgApp::init(), vrj::OpenSGApp::init(), and vrj::Kernel::startDrawManager().
| virtual void vrj::App::apiInit | ( | ) | [inline, virtual] |
Application graphics API initialization function.
Execute any initialization needed after the graphics API is started but before the Draw Manager starts the rendering loop(s).
Reimplemented in vrj::OpenSGApp.
Definition at line 118 of file App.h.
Referenced by vrj::Kernel::startDrawManager().
| virtual void vrj::App::exit | ( | ) | [inline, virtual] |
Executes any final clean-up needed for this application before exiting.
This is invoked by the kernel prior to this application object being removed from the kernel.
Reimplemented in vrj::OpenSGApp.
Definition at line 126 of file App.h.
| virtual void vrj::App::preFrame | ( | ) | [inline, virtual] |
Executes any code needed to set up the application object state prior to rendering the scene.
This is invoked by the kernel once per pass through the Juggler frame loop. This is called after input device updates but before the start of rendering a new frame of the scene.
Reimplemented in vrj::GlProcAppWrapper.
Definition at line 135 of file App.h.
Referenced by vrj::Kernel::controlLoop().
| virtual void vrj::App::latePreFrame | ( | ) | [inline, virtual] |
Function called after preFrame() and application-specific data synchronization (in a cluster configuration) but before the start of a new frame.
Reimplemented in vrj::OsgApp.
Definition at line 146 of file App.h.
Referenced by vrj::Kernel::controlLoop().
| virtual void vrj::App::intraFrame | ( | ) | [inline, virtual] |
Function called during this application's drawing time.
This can be used for "free" parallel processing, but it introduces a critical section to the code. If the rendering process is reading state data, this method should not be modifying any of that data. Instead, a double- or triple-buffering scheme must be used to allow parallel reading and writing of all application state used for rendering.
Reimplemented in vrj::GlProcAppWrapper.
Definition at line 157 of file App.h.
Referenced by vrj::Kernel::controlLoop().
| virtual void vrj::App::postFrame | ( | ) | [inline, virtual] |
Function called before updating input devices but after the frame rendering is complete.
Reimplemented in vrj::GlProcAppWrapper.
Definition at line 164 of file App.h.
Referenced by vrj::Kernel::controlLoop().
| virtual void vrj::App::reset | ( | ) | [inline, virtual] |
Resets this application.
This is used when the kernel (or applications) would like this application object to reset to its initial state. This is one of the only methods that can be safe for cross-calls from other application object interface methodss. That is, of course, as long as the override of this method is implemented in a safe manner. The override should be implemented such that it can be invoked at any time during the Juggler frame loop by the kernel or from a method such as preFrame() or postFrame() by the application object itself.
Definition at line 178 of file App.h.
| bool vrj::App::haveFocus | ( | ) | [inline] |
Does this application currently have focus? If an application has focus, the user may be attempting to interact with it, so this application should process input.
If not, the user is not interating with it, so ignore all input. However, the user may still be viewing it, so render, update any animations, etc. This is akin to the way a user can only interact with a GUI window that has focus.
Definition at line 189 of file App.h.
00190 { 00191 return mHaveFocus; 00192 }
| virtual void vrj::App::focusChanged | ( | ) | [inline, virtual] |
| void vrj::App::setFocus | ( | bool | newState | ) | [inline] |
Sets the focus state.
| newState | A Boolean value indicating whether this application now has focus. |
Definition at line 208 of file App.h.
00209 { 00210 if(newState != mHaveFocus) 00211 { 00212 mHaveFocus = newState; 00213 this->focusChanged(); 00214 } 00215 }
| virtual float vrj::App::getDrawScaleFactor | ( | ) | [inline, virtual] |
Returns the scale factor to convert from Juggler units (meters) to application units.
Internally, VR Juggler stores and processes all position values in meters. The scale factor returned by this method is used by VR Juggler to scale the rendering state from meters to whatever units this application wants to use.
For example, to use feet as this application object's unit, return 3.28. Conversion constants can be found in the namespace gadget::PositionUnitConversion which is defined in the header file gadget/Type/Position/PositionUnitConversion.h from the Gadgeteer library.
Definition at line 230 of file App.h.
Referenced by vrj::PfDrawManager::updatePfProjections().
| bool vrj::App::configCanHandle | ( | jccl::ConfigElementPtr | element | ) | [virtual] |
| virtual bool vrj::App::depSatisfied | ( | ) | [inline, virtual] |
Are any application dependencies satisfied? If this application requires anything special of the system for successful initialization, check it here.
If the return value is false, then this application will not be started yet. If the return value is true, then this application will be allowed to enter the system.
Definition at line 255 of file App.h.
Referenced by vrj::Kernel::checkForReconfig().
| bool vrj::App::configAdd | ( | jccl::ConfigElementPtr | element | ) | [protected, virtual] |
| bool vrj::App::configRemove | ( | jccl::ConfigElementPtr | element | ) | [protected, virtual] |
| virtual DrawManager* vrj::App::getDrawManager | ( | ) | [pure virtual] |
Gets the Draw Manager to use.
Implemented in vrj::GlApp, and vrj::PfApp.
Referenced by vrj::Kernel::changeApplication().
| SoundManager * vrj::App::getSoundManager | ( | ) | [virtual] |
Get the SoundManager to use.
Definition at line 79 of file App.cpp.
References vrj::SoundManagerFactory::get().
Referenced by vrj::Kernel::changeApplication().
00080 { 00081 return &SoundManagerFactory::get(); 00082 }
| bool vrj::App::mHaveFocus |
1.5.1