Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

vrj::App Class Reference

Encapsulates the actually application. More...

#include <App.h>

Inheritance diagram for vrj::App:

Inheritance graph
[legend]
Collaboration diagram for vrj::App:

Collaboration graph
[legend]
List of all members.

Public Methods

 App (Kernel *kern)
 Constructor. More...

 App ()
 Just call App(vrj::Kernel::instance()). More...

virtual ~App ()
virtual void init ()
 Application initialization function. More...

virtual void apiInit ()
 Application API initialization function. More...

virtual void exit ()
 Executes any final cleanup needed for the application. More...

virtual void preFrame ()
 Function called before the Juggler frame starts. More...

virtual void latePreFrame ()
 Function called after preFrame() and ApplicationData syncronization, but before draw() function. More...

virtual void intraFrame ()
 Function called during the application's drawing time. More...

virtual void postFrame ()
 Function called before updating trackers but after the frame is complete. More...

virtual void reset ()
 Resets the application. More...

bool haveFocus ()
 Does the application currently have focus? If an application has focus, the user may be attempting to interact with it, so the app should process input. More...

virtual void focusChanged ()
 Called when the focus state changes. More...

void setFocus (bool newState)
 Sets the focus state. More...

virtual float getDrawScaleFactor ()
 Returns scale scale factor to get from Juggler units (meters) to application units. More...

virtual bool configCanHandle (jccl::ConfigElementPtr element)
 Default to handling nothing. More...

virtual bool depSatisfied ()
 Are any application dependencies satisfied? If the application requires anything special of the system for successful initialization, check it here. More...

virtual DrawManagergetDrawManager ()=0
 Gets the Draw Manager to use. More...

virtual SoundManagergetSoundManager ()
 Get the SoundManager to use. More...


Public Attributes

KernelmKernel
bool mHaveFocus

Protected Methods

virtual bool configAdd (jccl::ConfigElementPtr element)
virtual bool configRemove (jccl::ConfigElementPtr element)

Detailed Description

Encapsulates the actually application.

This class defines the class that all API specific application classes should be derived from. The interface given is the interface that the Kernel expects in order to interface with the application. Most of the application's interface will be defined in the derived API specific classes.

Users should sub-class the API specific classes to create user-defined applications. A user application is required to provide function definitions for any of the virual functions that the application needs to use. This is the method that the application programmer uses to interface with VR Juggler.

The control loop will look similar to this:

Note:
One time through the loop is a Juggler Frame
while (drawing)
{
preFrame();
draw();
intraFrame();
sync();
postFrame();

UpdateTrackers();
}

Definition at line 82 of file App.h.


Constructor & Destructor Documentation

vrj::App::App Kernel   kern
 

Constructor.

Parameters:
kern  The Kernel that is active (so application has easy access to the kernel).

Definition at line 40 of file App.cpp.

References mHaveFocus, and mKernel.

Referenced by vrj::PfApp::PfApp.

00041 {
00042    vprASSERT(kern != NULL);    // We don't want a NULL Kernel
00043    mKernel = kern;
00044    mHaveFocus = true;
00045 }

vrj::App::App  
 

Just call App(vrj::Kernel::instance()).

Definition at line 47 of file App.cpp.

References mHaveFocus, and mKernel.

00048 {
00049    mKernel = Kernel::instance();
00050    mHaveFocus = true;
00051 }

virtual vrj::App::~App   [inline, virtual]
 

Definition at line 95 of file App.h.

00096    {
00097       /* Do nothing. */ ;
00098    }


Member Function Documentation

virtual void vrj::App::init   [inline, virtual]
 

Application initialization function.

Execute any initialization needed before the API is started.

Note:
Derived classes MUST call base class version of this method.

Reimplemented in vrj::OpenSGApp.

Definition at line 107 of file App.h.

Referenced by vrj::Kernel::startDrawManager.

00108    {;}

virtual void vrj::App::apiInit   [inline, virtual]
 

Application API initialization function.

Execute any initialization needed after API is started but before the drawManager starts the drawing loops.

Reimplemented in vrj::OpenSGApp.

Definition at line 115 of file App.h.

Referenced by vrj::Kernel::startDrawManager.

00116    {;}

virtual void vrj::App::exit   [inline, virtual]
 

Executes any final cleanup needed for the application.

Reimplemented in vrj::OpenSGApp.

Definition at line 119 of file App.h.

Referenced by vrj::Kernel::changeApplication.

00120    {;}

virtual void vrj::App::preFrame   [inline, virtual]
 

Function called before the Juggler frame starts.

Called after tracker update but before start of a new frame.

Reimplemented in vrj::GlProcAppWrapper.

Definition at line 126 of file App.h.

Referenced by vrj::Kernel::controlLoop.

00127    {;}

virtual void vrj::App::latePreFrame   [inline, virtual]
 

Function called after preFrame() and ApplicationData syncronization, but before draw() function.

Note:
This is required because we cannot update data in the draw() function since it might be called more than once.

Definition at line 136 of file App.h.

Referenced by vrj::Kernel::controlLoop.

00137    {;}

virtual void vrj::App::intraFrame   [inline, virtual]
 

Function called during the application's drawing time.

Reimplemented in vrj::GlProcAppWrapper.

Definition at line 140 of file App.h.

Referenced by vrj::Kernel::controlLoop.

00141    {;}

virtual void vrj::App::postFrame   [inline, virtual]
 

Function called before updating trackers but after the frame is complete.

Reimplemented in vrj::GlProcAppWrapper.

Definition at line 146 of file App.h.

Referenced by vrj::Kernel::controlLoop.

00147    {;}

virtual void vrj::App::reset   [inline, virtual]
 

Resets the application.

This is used when the system (or applications) would like the application to reset to the initial state that it started in.

Definition at line 154 of file App.h.

00155    {;}

bool vrj::App::haveFocus   [inline]
 

Does the application currently have focus? If an application has focus, the user may be attempting to interact with it, so the app should process input.

If not, the user is not interating with it, so ignore all input, but the user may still be viewing it, so render and update any animations, etc.

This is akin to the way a user can only interact with a GUI window that has focus (i.e., the mouse is over the window).

Definition at line 167 of file App.h.

00168    {
00169       return mHaveFocus;
00170    }

virtual void vrj::App::focusChanged   [inline, virtual]
 

Called when the focus state changes.

Definition at line 173 of file App.h.

00174    {;}

void vrj::App::setFocus bool    newState [inline]
 

Sets the focus state.

Postcondition:
If state has changed, then calls focusChanged().
See also:
focusChanged()

Definition at line 182 of file App.h.

00183    {
00184       if(newState != mHaveFocus)
00185       {
00186          mHaveFocus = newState;
00187          this->focusChanged();
00188       }
00189    }

virtual float vrj::App::getDrawScaleFactor   [inline, virtual]
 

Returns scale scale factor to get 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 OpenGL drawing state from meters to whatever local units the application wants to use.

Example: to use feet as local app unit, return 3.28;

Definition at line 200 of file App.h.

00201    {
00202       return gadget::PositionUnitConversion::ConvertToFeet;
00203    }

virtual bool vrj::App::configCanHandle jccl::ConfigElementPtr    element [inline, virtual]
 

Default to handling nothing.

Definition at line 208 of file App.h.

00209    {
00210       boost::ignore_unused_variable_warning(element);
00211       return false;
00212    }

virtual bool vrj::App::depSatisfied   [inline, virtual]
 

Are any application dependencies satisfied? If the application requires anything special of the system for successful initialization, check it here.

If the return value is false, then the application will not be started yet. If the return value is true, application will be allowed to enter the system.

Definition at line 221 of file App.h.

Referenced by vrj::Kernel::checkForReconfig.

00222    {
00223       return true;
00224    }

virtual bool vrj::App::configAdd jccl::ConfigElementPtr    element [inline, protected, virtual]
 

Note:
Inherited from jccl::ConfigElementHandler.

Definition at line 228 of file App.h.

00229    {
00230       boost::ignore_unused_variable_warning(element);
00231       vprASSERT(false);
00232       return false;
00233    }

virtual bool vrj::App::configRemove jccl::ConfigElementPtr    element [inline, protected, virtual]
 

Note:
Inherited from jccl::ConfigElementHandler.

Definition at line 236 of file App.h.

00237    {
00238       boost::ignore_unused_variable_warning(element);
00239       vprASSERT(false);
00240       return false;
00241    }

virtual DrawManager* vrj::App::getDrawManager   [pure virtual]
 

Gets the Draw Manager to use.

Note:
Each derived app MUST implement this function.

Implemented in vrj::GlApp.

Referenced by vrj::Kernel::changeApplication.

virtual SoundManager* vrj::App::getSoundManager   [inline, virtual]
 

Get the SoundManager to use.

Note:
Each derived app could implement this function if needed.

Definition at line 258 of file App.h.

Referenced by vrj::Kernel::changeApplication.

00259    {
00260       return &SoundManagerFactory::get();
00261    }


Member Data Documentation

Kernel* vrj::App::mKernel
 

Definition at line 244 of file App.h.

Referenced by App.

bool vrj::App::mHaveFocus
 

Definition at line 245 of file App.h.

Referenced by App.


The documentation for this class was generated from the following files:
Generated on Sun May 2 15:11:15 2004 for VR Juggler by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002