VRG3D::VRApp Class Reference

#include <VRApp.H>

List of all members.

Public Member Functions

 VRApp ()
 Call init() after creating a new VRApp.
virtual ~VRApp ()
virtual void init (const std::string &vrSetup, Log *appLog=NULL)
virtual void init (GWindow *_gwindow, RenderDevice *_renderDevice, DisplayTile _tile, Array< InputDevice * > _inputDevices, CoordinateFrame initialHeadFrame, const std::string &_clusterServerName="", Log *_log=NULL)
 This constructor provides flexibility for other non-standard setups.
virtual void doUserInput (Array< VRG3D::EventRef > &events)
 This is intended to normally be reimplemented in subclasses.
virtual void doGraphics (RenderDevice *rd)
 This is also intended to normally be reimplemented in subclasses.
virtual void run ()
 Call this after init() to startup the program.
virtual void guiProcessGEvents (Array< GEvent > &gevents, Array< VRG3D::EventRef > &newGuiEvents)
virtual GuiButton * addGuiButtonAndTrapEvent (GuiPane *pane, const std::string &eventToGenerate, const GuiCaption &text, GuiButton::Style style=GuiButton::NORMAL_STYLE)
virtual void oneFrame ()
virtual void oneFrameGraphics ()
CoordinateFrame getHeadFrame ()
Log * getLog ()
ProjectionVRCameraRef getCamera ()
RenderDevice * getRenderDevice ()
bool getReadyToEndProgram ()
UserInput * getG3DUserInput ()
WidgetManagerRef getG3DWidgetManager ()
void clientSetup ()
 For clustered rendering (Client side).
void clientRequestEvents ()
void clientReceiveEvents (Array< EventRef > &events)
void clientRequestAndWaitForOkToSwap ()
void clientCheckConnection ()
void setClearColor (Color4 clearColor)

Static Public Member Functions

static void setupInputDevicesFromConfigFile (const std::string &filename, Log *log, Array< InputDevice * > &inputDevices)
static void pollWindowForGEvents (RenderDevice *rd, Array< GEvent > &gEvents)
static void appendGEventsToEvents (RenderDevice *rd, DisplayTile &tile, Array< EventRef > &events, Array< GEvent > &gEvents, Vector2 &mousePos)
static std::string getKeyName (GKey::Value key, GKeyMod mod)
static std::string findVRG3DDataFile (const std::string &filename)

Protected Attributes

Log * _log
DisplayTile _tile
GWindow * _gwindow
RenderDevice * _renderDevice
Array< InputDevice * > _inputDevices
ProjectionVRCameraRef _camera
bool _endProgram
Vector2 _curMousePos
int64 _frameCounter
Color4 _clearColor
bool _isAClusterClient
std::string _clusterServerName
SynchItClient * _clusterSynchIt
char * _clusterSynchItBuf
NetworkDevice * _networkDevice
ReliableConduitRef _conduitToServer
WidgetManagerRef _widgetManager
UserInput * _userInput
Table< GuiButton *, std::string > _guiBtnToEventMap

Detailed Description

Base class for a basic G3D-style VR application. This class provides a typical application structure that may be useful for many applications. See vrg3d-demo.cpp for an example.

Constructor & Destructor Documentation

VRG3D::VRApp::VRApp (  ) 

Call init() after creating a new VRApp.

virtual VRG3D::VRApp::~VRApp (  )  [virtual]

Member Function Documentation

virtual void VRG3D::VRApp::init ( const std::string &  vrSetup,
Log *  appLog = NULL 
) [virtual]

This is an easy constructor to use for many typical situations. The vrSetup argument corresponds to a config file that specifies the type of window to open and devices to connect to. Look in $G/share/VRG3D/desktop.vrsetup for an example. Or, run with vrSetup == "" to print out a list of installed VR setups.

virtual void VRG3D::VRApp::init ( GWindow *  _gwindow,
RenderDevice *  _renderDevice,
DisplayTile  _tile,
Array< InputDevice * >  _inputDevices,
CoordinateFrame  initialHeadFrame,
const std::string &  _clusterServerName = "",
Log *  _log = NULL 
) [virtual]

This constructor provides flexibility for other non-standard setups.

virtual void VRG3D::VRApp::doUserInput ( Array< VRG3D::EventRef > &  events  )  [virtual]

This is intended to normally be reimplemented in subclasses.

virtual void VRG3D::VRApp::doGraphics ( RenderDevice *  rd  )  [virtual]

This is also intended to normally be reimplemented in subclasses.

virtual void VRG3D::VRApp::run (  )  [virtual]

Call this after init() to startup the program.

virtual void VRG3D::VRApp::guiProcessGEvents ( Array< GEvent > &  gevents,
Array< VRG3D::EventRef > &  newGuiEvents 
) [virtual]

If you need access to the raw GEvent's generated by G3D, you can reimplement this, but use with care. One reason to get GEvent's is to work with the G3D::Gui* 2D screen gui elements. The default implementation of this routine already does the necessary processing for you to use G3D::Gui* if you register your GuiWindow with VRApp's _widgetManager.

virtual GuiButton* VRG3D::VRApp::addGuiButtonAndTrapEvent ( GuiPane *  pane,
const std::string &  eventToGenerate,
const GuiCaption &  text,
GuiButton::Style  style = GuiButton::NORMAL_STYLE 
) [virtual]

When working with G3D::Gui*, use this routine rather than GuiPane::addButton() to have the event generated by the button click transformed into a VRG3D::Event named eventToGenerate.

virtual void VRG3D::VRApp::oneFrame (  )  [virtual]

This is the guts of the main program loop. It's unusual to need to reimplemet this.

virtual void VRG3D::VRApp::oneFrameGraphics (  )  [virtual]

This is the graphics portion of the main program loop. It's unusual to need to reimplement this.

CoordinateFrame VRG3D::VRApp::getHeadFrame (  )  [inline]

References _camera.

Log* VRG3D::VRApp::getLog (  )  [inline]

References _log.

ProjectionVRCameraRef VRG3D::VRApp::getCamera (  )  [inline]

References _camera.

RenderDevice* VRG3D::VRApp::getRenderDevice (  )  [inline]

bool VRG3D::VRApp::getReadyToEndProgram (  )  [inline]

References _endProgram.

UserInput* VRG3D::VRApp::getG3DUserInput (  )  [inline]

References _userInput.

WidgetManagerRef VRG3D::VRApp::getG3DWidgetManager (  )  [inline]

References _widgetManager.

void VRG3D::VRApp::clientSetup (  ) 

For clustered rendering (Client side).

void VRG3D::VRApp::clientRequestEvents (  ) 

void VRG3D::VRApp::clientReceiveEvents ( Array< EventRef > &  events  ) 

void VRG3D::VRApp::clientRequestAndWaitForOkToSwap (  ) 

void VRG3D::VRApp::clientCheckConnection (  ) 

void VRG3D::VRApp::setClearColor ( Color4  clearColor  )  [inline]

References _clearColor.

static void VRG3D::VRApp::setupInputDevicesFromConfigFile ( const std::string &  filename,
Log *  log,
Array< InputDevice * > &  inputDevices 
) [static]

static void VRG3D::VRApp::pollWindowForGEvents ( RenderDevice *  rd,
Array< GEvent > &  gEvents 
) [static]

static void VRG3D::VRApp::appendGEventsToEvents ( RenderDevice *  rd,
DisplayTile tile,
Array< EventRef > &  events,
Array< GEvent > &  gEvents,
Vector2 &  mousePos 
) [static]

static std::string VRG3D::VRApp::getKeyName ( GKey::Value  key,
GKeyMod  mod 
) [static]

static std::string VRG3D::VRApp::findVRG3DDataFile ( const std::string &  filename  )  [static]

Looks for filename first in the current directory, if it is not there, then looks in the default location $G/lib/VRG3D/. Returns the full path to the file if it is found or "" if not.

Member Data Documentation

Log* VRG3D::VRApp::_log [protected]

Referenced by getLog().

GWindow* VRG3D::VRApp::_gwindow [protected]

RenderDevice* VRG3D::VRApp::_renderDevice [protected]

Referenced by getCamera(), and getHeadFrame().

bool VRG3D::VRApp::_endProgram [protected]

Referenced by getReadyToEndProgram().

Vector2 VRG3D::VRApp::_curMousePos [protected]

int64 VRG3D::VRApp::_frameCounter [protected]

Color4 VRG3D::VRApp::_clearColor [protected]

Referenced by setClearColor().

std::string VRG3D::VRApp::_clusterServerName [protected]

SynchItClient* VRG3D::VRApp::_clusterSynchIt [protected]

NetworkDevice* VRG3D::VRApp::_networkDevice [protected]

ReliableConduitRef VRG3D::VRApp::_conduitToServer [protected]

WidgetManagerRef VRG3D::VRApp::_widgetManager [protected]

Referenced by getG3DWidgetManager().

UserInput* VRG3D::VRApp::_userInput [protected]

Referenced by getG3DUserInput().

Table<GuiButton*, std::string> VRG3D::VRApp::_guiBtnToEventMap [protected]

The documentation for this class was generated from the following file:

Generated on Wed Jan 26 06:36:00 2011 for VRG3D by  doxygen 1.5.6