GCE::GScene Class Reference

Combines Elements into one X3D Scene. More...

#include <GScene.h>

Inheritance diagram for GCE::GScene:

Inheritance graph
[legend]
Collaboration diagram for GCE::GScene:

Collaboration graph
[legend]
List of all members.

Public Slots

void setOpenGLFrame (GCE::GOpenGLFrame *frame)
void setDataPath (const QString &path)
void setRootElement (const GCS::GElementID &root)
void setMaxSceneDepth (int depth)
void renderScene ()
void renderElement (const GCS::GElement *element, int depth=1)

Public Member Functions

 GScene (GWE::GInformationInterface *info)
virtual ~GScene ()
GCS::GElementID getRootElement ()
int getMaxSceneDepth ()
QString getDataPath ()

Protected Member Functions

void loadScene (QString name)
void removeScene (const QString &name)

Protected Attributes

GWE::GInformationInterfaceInformationInterface
GCE::GOpenGLFrameFrame
GCS::GElementID RootElement
int MaxSceneDepth
QString DataPath
QMap< QString, X3DTK::X3D::Scene * > LoadedScenes
QMap< QString, X3DTK::GL::Scene * > LoadedScenesGl

Private Member Functions

const GCS::GElementfindRootElement () const
X3DTK::X3D::X3DGroupingNode * appendElementToGroup (const GCS::GElementID &element, X3DTK::X3D::X3DGroupingNode *group, bool recursive=false, int depth=1)

Detailed Description

Combines Elements into one X3D Scene.

Author:
Raphael Langerhorst
The GScene class combines the hierarchical structure of the elements that build up the world with the X3D and OpenGL scene graphs that can actually be used for rendering.

The forms of the elements are first loaded into an X3D scene graph which is then transformed to an OpenGL scene graph that can be used for the actual rendering.

Use renderScene() to render the scene into a valid OpenGL context.

GScene is usually used by GOpenGLFrame to render the world.

See also:
GOpenGLFrame


Constructor & Destructor Documentation

GCE::GScene::GScene ( GWE::GInformationInterface info  ) 

Constructor, requires a information interface to be able to collct information about elements.

GCE::GScene::~GScene (  )  [virtual]

Virtual Destructor.


Member Function Documentation

X3DTK::X3D::X3DGroupingNode* GCE::GScene::appendElementToGroup ( const GCS::GElementID element,
X3DTK::X3D::X3DGroupingNode *  group,
bool  recursive = false,
int  depth = 1 
) [private]

Loads the X3D scene for given element and inserts it with the appropriate transformationen as a child to the given X3D group node.

Parameters:
element the element of which the X3D scene graph is loaded and inserted into the group.
group parent group where the loaded X3D scene of given element is added as a child
recursive if true, all children of element are recursively added to the scene graph

const GCS::GElement * GCE::GScene::findRootElement (  )  const [private]

Searches for the top most element in the element hierarchy. Only works if an element with ID 1 is available.

See also:
WorldData

QString GCE::GScene::getDataPath (  ) 

Returns:
DataPath

int GCE::GScene::getMaxSceneDepth (  ) 

Returns:
MaxSceneDepth

GCS::GElementID GCE::GScene::getRootElement (  ) 

Returns:
RootElement

void GCE::GScene::loadScene ( QString  name  )  [protected]

If a Scene with given name is not yet loaded, it is loaded and then returned (loading on demand). If the name is empty, a default scene is loaded. If a file with given name does not exist, an error scene is loaded, which shows that data is missing.

The OpenGL scene of the loaded scene is also generated and stored in LoadedScenesGl.

See also:
LoadedScenes, LoadedScenesGl, DataPath

void GCE::GScene::removeScene ( const QString &  name  )  [protected]

Removes both the OpenGL and the X3D scene graph with given name from memory.

void GCE::GScene::renderElement ( const GCS::GElement element,
int  depth = 1 
) [slot]

Recursively renders given element and all children of given element, up to the maximum depth.

See also:
MaxSceneDepth

void GCE::GScene::renderScene (  )  [slot]

Renders the OpenGl scene into the current OpenGL context.

See also:
GlScene

void GCE::GScene::setDataPath ( const QString &  path  )  [slot]

See also:
DataPath

void GCE::GScene::setMaxSceneDepth ( int  depth  )  [slot]

Sets the maximum number of hierarchies below RootElement to be rendered.

See also:
MaxSceneDepth

void GCE::GScene::setOpenGLFrame ( GCE::GOpenGLFrame frame  )  [slot]

See also:
Frame

void GCE::GScene::setRootElement ( const GCS::GElementID root  )  [slot]

Sets the root element of the scene.

See also:
RootElement


Member Data Documentation

QString GCE::GScene::DataPath [protected]

The directory (either relative or absolute) where data files are located. For now this only affects loading of X3D files. This is prepended to the graphic data filename retrieved from the element. If set, DataPath must contain a trailing slash character (directory separator). By default DataPath is an empty string, which means data filenames are interpreted relative to the process working directory (PWD).

See also:
GCS::GElementData

LoadedScenes, loadScene

GCE::GOpenGLFrame* GCE::GScene::Frame [protected]

The OpenGLFrame in which this scene is rendered. This is currently required to be able to render text.

GWE::GInformationInterface* GCE::GScene::InformationInterface [protected]

The data interface to the world, the elements.

QMap<QString,X3DTK::X3D::Scene*> GCE::GScene::LoadedScenes [protected]

X3D Scenes used for rendering. Elements can have a X3D filename set within their element data for rendering. In such a case the respective X3D file is loaded and stored within this map. The filename is the key. So if more elements have the same filename set, the scene gets only loaded once but is rendered more than once within one render cycle.

In X3D graph node terminology, each element is a full graph in itself, stored in one X3DTK::SimpleX3DGLScene object.

QMap<QString,X3DTK::GL::Scene*> GCE::GScene::LoadedScenesGl [protected]

The OpenGL scene graphs of loaded scenes.

See also:
LoadedScenes

int GCE::GScene::MaxSceneDepth [protected]

Sets the maximum numbers of hierarchies from RootElement that are used for the scene graphs and thus for rendering.

If it is set to 1, only the RootElement and its children will be rendered. If it is set to 2, the children of these children will be rendered as well, and so on.

If set to 0, there is no hierarchy limit. This means that all elements within the RootElement will be rendered.

The default is 0.

GCS::GElementID GCE::GScene::RootElement [protected]

The top element from which the scene is built. If it is set to 0, the top element is searched automatically. The default is 0.


The documentation for this class was generated from the following files:
Generated on Thu Nov 16 07:49:32 2006 for G System by  doxygen 1.4.7