#include <GScene.h>
Inheritance diagram for GCE::GScene:


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::GInformationInterface * | InformationInterface |
| GCE::GOpenGLFrame * | Frame |
| GCS::GElementID | RootElement |
| int | MaxSceneDepth |
| QString | DataPath |
| QMap< QString, X3DTK::X3D::Scene * > | LoadedScenes |
| QMap< QString, X3DTK::GL::Scene * > | LoadedScenesGl |
Private Member Functions | |
| const GCS::GElement * | findRootElement () const |
| X3DTK::X3D::X3DGroupingNode * | appendElementToGroup (const GCS::GElementID &element, X3DTK::X3D::X3DGroupingNode *group, bool recursive=false, int depth=1) |
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.
| 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.
| 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.
| 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.
| QString GCE::GScene::getDataPath | ( | ) |
| int GCE::GScene::getMaxSceneDepth | ( | ) |
| GCS::GElementID GCE::GScene::getRootElement | ( | ) |
| 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.
| 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.
| void GCE::GScene::renderScene | ( | ) | [slot] |
Renders the OpenGl scene into the current OpenGL context.
| void GCE::GScene::setDataPath | ( | const QString & | path | ) | [slot] |
| void GCE::GScene::setMaxSceneDepth | ( | int | depth | ) | [slot] |
Sets the maximum number of hierarchies below RootElement to be rendered.
| void GCE::GScene::setOpenGLFrame | ( | GCE::GOpenGLFrame * | frame | ) | [slot] |
| void GCE::GScene::setRootElement | ( | const GCS::GElementID & | root | ) | [slot] |
Sets the root element of the scene.
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).
GCE::GOpenGLFrame* GCE::GScene::Frame [protected] |
The OpenGLFrame in which this scene is rendered. This is currently required to be able to render text.
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.
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.
1.4.7