Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

OIVAppShell Class Reference

A class providing basic OIV and CAVELib integration. More...

Inheritance diagram for OIVAppShell:

Inheritance graph
[legend]
List of all members.

Public Methods

 OIVAppShell (int, char **)
 Constructor will perform initializations of Inventor and time.

virtual ~OIVAppShell ()
 Virtual destructor.

virtual void buildScene ()
 Build the scene graph. Must be explicitly called.

virtual void displayInit ()
 Initialize the display or thread.

virtual void frameDraw ()
 Draw the current frame.

virtual void frameUpdate ()
 Update the engine and time values.

virtual void handleEvents ()
 Once-per-frame event handling such as wands and buttons are here.

void setBackgroundColor (const SbColor &)
 Set the background color.


Static Public Methods

CAVELib callback functions
void DisplayInitCB (OIVAppShell *)
 Display initialization callback. Also used to initialize threads.

void FrameDrawCB (OIVAppShell *)
 Frame draw callback called for each draw update.

void FrameUpdateCB (OIVAppShell *)
 Frame update callback called once per frame cycle.


Protected Methods

void drawInventorScene (SoGLRenderAction *, SoSeparator *)
 Renders the Inventor scene graph.


Protected Attributes

SbColor m_bgColor
 Background color for the environment.

SoSeparator * m_sceneRoot
 Root scene graph node.


Detailed Description

A class providing basic OIV and CAVELib integration.

Author:
Chris Scharver
This class provides simple bindings between the CAVELib and Open Inventor. It has a single root node, and it implements the required calls for that node to get rendered into the CAVE. It performs initialization of Inventor, and through the use of the CAVE_THREAD compile definition, it has support for using multiple threads for rendering.

Static callback functions for assignment to the CAVELib callbacks are in place, and a reference to the application instance should be passed as user data. This will allow subclasses to correctly use inheritance in calling bound functions. Below is a sample implementation:

  app = new VirtoccApp(argc, argv);
  CAVEInitApplication((CAVECALLBACK) OIVAppShell::DisplayInitCB, 1, app);
  app->buildScene();
  CAVEFrameFunction((CAVECALLBACK) OIVAppShell::FrameUpdateCB, 1, app);
  CAVEDisplay((CAVECALLBACK) OIVAppShell::FrameDrawCB, 1, app);


Constructor & Destructor Documentation

OIVAppShell::OIVAppShell int    argc,
char **    argv
 

Constructor will perform initializations of Inventor and time.

The constructor handlines initialization of Inventor classes and creates the single root Separator. This constructor should be called by any subclasses. Custom Inventor classes may safely call their initClass() functions in subclass constructors. Command line arguments can be parsed from the main application.

Parameters:
argc  Number of command line arguments.
argv  Character arrays of command line arguments.

OIVAppShell::~OIVAppShell   [virtual]
 

Virtual destructor.


Member Function Documentation

void OIVAppShell::buildScene   [virtual]
 

Build the scene graph. Must be explicitly called.

Reimplemented in RICDemoApp.

void OIVAppShell::displayInit   [virtual]
 

Initialize the display or thread.

void OIVAppShell::DisplayInitCB OIVAppShell *    [static]
 

Display initialization callback. Also used to initialize threads.

void OIVAppShell::drawInventorScene SoGLRenderAction *    pAction,
SoSeparator *    scene
[protected]
 

Renders the Inventor scene graph.

A GLRenderAction is passed to this function along with a scene graph to render. Matrix and projection calls are handled within this function to properly handle display with the CAVELib. The structure of this code was copied from documentation provided by TGS for handling Inventor and the CAVELib. This method is called after OIVAppShell::frameDraw() has updated the viewport information.

Parameters:
pAction  GLRenderAction for drawing the scene. This action has been created externally, and it is passed here from OIVAppShell::frameDraw().
scene  Inventor scene graph to render.

void OIVAppShell::frameDraw   [virtual]
 

Draw the current frame.

void OIVAppShell::FrameDrawCB OIVAppShell *    [static]
 

Frame draw callback called for each draw update.

void OIVAppShell::frameUpdate   [virtual]
 

Update the engine and time values.

Reimplemented in RICDemoApp.

void OIVAppShell::FrameUpdateCB OIVAppShell *    [static]
 

Frame update callback called once per frame cycle.

virtual void OIVAppShell::handleEvents   [inline, virtual]
 

Once-per-frame event handling such as wands and buttons are here.

void OIVAppShell::setBackgroundColor const SbColor &   
 

Set the background color.


Member Data Documentation

SbColor OIVAppShell::m_bgColor [protected]
 

Background color for the environment.

SoSeparator* OIVAppShell::m_sceneRoot [protected]
 

Root scene graph node.


The documentation for this class was generated from the following files:
Generated on Thu Jun 12 10:13:13 2003 for RICDemo by doxygen1.2.18