Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Friends | List of all members
Menge::SceneGraph::GLScene Class Reference

The class which contains the entire drawable scene. More...

#include <GLScene.h>

Public Member Functions

 GLScene ()
 Default constructor.
 
 ~GLScene ()
 Destructor.
 
void finish ()
 Informs the scene that it is done being used. More...
 
void newGLContext ()
 Allows the scene to recreate any unique OpenGL objects for all elements of the scene due to acquisition of a new OpenGL context.
 
void drawGL (const GLCamera &camera, const GLLightVector &lights, int vWidth, int vHeight)
 Causes the scene to draw into an open gl context. More...
 
bool selectGL (const GLCamera &camera, int vWidth, int vHeight, int *selectPoint)
 Draws the selectable elements of the scene in preparation for selection. More...
 
bool updateScene (float time)
 Updates the state of the scene graph to the global time. More...
 
bool addNode (GLNode *node, GLDagNode *parent=0x0)
 Add a node to the scene (with an optional parent) More...
 
bool addSystem (System *system)
 Adds a System to the scene. More...
 
void setContext (Context *context)
 Sets the context the scene will use to handle UI events. More...
 
ContextResult handleMouse (SDL_Event &e)
 Allows the scene to respond to a mouse event. More...
 
ContextResult handleKeyboard (SDL_Event &e)
 Allows the scene to respond to a keyboard event. More...
 

Friends

class SelectContext
 

Detailed Description

The class which contains the entire drawable scene.

Member Function Documentation

bool Menge::SceneGraph::GLScene::addNode ( GLNode node,
GLDagNode parent = 0x0 
)

Add a node to the scene (with an optional parent)

A node is added to the scene. If no parent is specified, the node is a child of the scene directly. Otherwise, it is a child of the parent. NOTE: No test is performed to confirm that the parent already exists in the scene. It is the responsibility of the caller to confirm that this is the case.

Parameters
nodeThe node to add to the scene.
parentThe optional parent node.
Returns
Indication if the addition was successful (true) or not (false). Currently, this function always returns true.
bool Menge::SceneGraph::GLScene::addSystem ( System system)

Adds a System to the scene.

Parameters
systemThe system to add to the scene.
Returns
True if the system is successfully added, false otherwise. In this implementation, it is always successful.
void Menge::SceneGraph::GLScene::drawGL ( const GLCamera camera,
const GLLightVector &  lights,
int  vWidth,
int  vHeight 
)

Causes the scene to draw into an open gl context.

Parameters
cameraThe camera from which to derive the draw the scene.
lightsThe lights to illuminate the 3D elements.
vWidthThe viewport width, in pixels, used in text overlay.
vHeightThe viewport height, in pixels, used in text overlay.
void Menge::SceneGraph::GLScene::finish ( )

Informs the scene that it is done being used.

This gives the scene the chance to free up memory and stop whatever processes it may have been using (e.g., flushing caches, etc.) Typically just called by the viewer at the conclusion of visualization. More particularly, it gives the scene's systems to clean up and conclude their processes.

ContextResult Menge::SceneGraph::GLScene::handleKeyboard ( SDL_Event e)

Allows the scene to respond to a keyboard event.

Parameters
eAn instance of a keyboard event.
Returns
An instance of a ContextResult, reporting whether the event has been handled and whether a redraw is necessary.
ContextResult Menge::SceneGraph::GLScene::handleMouse ( SDL_Event e)

Allows the scene to respond to a mouse event.

Parameters
eAn instance of a mouse event.
Returns
An instance of a ContextResult, reporting whether the event has been handled and whether a redraw is necessary.
bool Menge::SceneGraph::GLScene::selectGL ( const GLCamera camera,
int  vWidth,
int  vHeight,
int *  selectPoint 
)

Draws the selectable elements of the scene in preparation for selection.

This uses the OpenGL selection context to perform active selection of elements in the scene.

Parameters
cameraThe camera from which to derive the draw the scene.
vWidthThe viewport width, in pixels, used in text overlay.
vHeightThe viewport height, in pixels, used in text overlay.
selectPointThe point in screen space at which selection should occur.
Returns
True if the selection changed, false otherwise.
void Menge::SceneGraph::GLScene::setContext ( Context context)

Sets the context the scene will use to handle UI events.

If the scene already has a context assigned, that context will be deactivated and deleted.

Parameters
contextThe scene's context.
bool Menge::SceneGraph::GLScene::updateScene ( float  time)

Updates the state of the scene graph to the global time.

Parameters
timeThe time for which the scene should be drawn.
Returns
A boolean reporting if a redraw is necessary (true) or not (false).

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