AnimaL |
Tutorial |
Documentation |
#include <mainScene.h>
x3d scene graph and openGL scene graph, in order to load x3d files, to save the scene in x3d files, to animate and draw the scene
Definition at line 58 of file mainScene.h.
Public Member Functions | |
MainScene () | |
Constructor. | |
virtual | ~MainScene () |
Destructor. | |
virtual void | load (const char *file, bool fileValidation=false) |
Load the scene from file. It erases the existed x3d scene. | |
void | load (const char *file, X3D::X3DNode *node, bool fileValidation=false) |
Load the scene from the given file and insert the scene's children from the given node. | |
virtual void | draw () |
Draw the scene from the openGL graph glscene. | |
void | save (const char *file) |
Save the x3d graphe in a file.x3d. | |
void | reset () |
Reset the scene for the animation. | |
virtual void | move (double dt) |
Move the scene. | |
bool | computeBbox () |
Compute a bounding box from the x3d scene. | |
bool | pastNode (X3DAbstractNode *node, X3DAbstractNode *parentNode) |
Past a node from a parent node. | |
void | deleteNode (X3DAbstractNode *node, X3DAbstractNode *parentNode) |
Delete a node i.e break the link between the node and its current parent node and delete it. | |
bool | cutNode (X3DAbstractNode *node, X3DAbstractNode *parentNode) |
Cut a node, i.e break the link between the node and its current parent node. | |
template<typename GroupingNode_t> void | newX4DClass () |
Define a new x3d grouping node. | |
void | addEngine (animal::Engine *engine) |
Add an engine. | |
void | removeEngine (animal::Engine *engine) |
Remove an engine. | |
void | clearEngines () |
Clear the engines list. | |
X3D::Scene * | getX3DScene () const |
Get the x3d scene. | |
SFVec3f | getBboxMin () const |
Get the Bounding Box minima. | |
SFVec3f | getBboxMax () const |
Get the Bounding Box maxima. | |
MainController * | getMainController () const |
Get the main GUI. | |
void | setMainController (MainController *MC) |
void | keyPressEvent (animal::KeyEvent *e) |
Deal with key press event. Return false if the event is not handled. | |
void | mouseDoubleClickEvent (animal::MouseEvent *e) |
Deal with mouse double-click event. Return false if the event is not handled. | |
void | mouseMoveEvent (animal::MouseEvent *e) |
Deal with mouse move event. Return false if the event is not handled. | |
void | mousePressEvent (animal::MouseEvent *e) |
Deal with mouse press event. Return false if the event is not handled. | |
void | mouseReleaseEvent (animal::MouseEvent *e) |
Deal with mouse release event. Return false if the event is not handled. | |
animal::ConstrainedItem * | pickPoint (float origin[3], float direction[3], float threshold) |
void | setSelectedNode (X3D::X3DBoundedObject *) |
highlight a node | |
void | updateGL () |
Update all the gl nodes contained in the list glNodeToUpdate. | |
Public Attributes | |
X3DGLMap | x3dGLMap |
The map which links X3DTK::X3D::X3DNode to their corresponding X3DTK::GL::X3DNode. | |
Protected Attributes | |
X3D::Scene * | x3dscene |
The x3d scene graph. | |
GL::Scene * | glscene |
The openGL scene graph. | |
SFVec3f | min |
Minima for the bounding box. | |
SFVec3f | max |
Maxima for the bounding box. | |
GLUpdates | glUpdates |
gl updates to perform after an animation step | |
Private Member Functions | |
void | buildGL () |
Build the glscene from the x3dscene, update the list glNodeToUpdate and compute the bounding box of the scene. | |
void | releaseNode (X3DAbstractNode *node) |
Release a node, i.e delete it if there is no more parent link. | |
bool | isADescendant (X3DAbstractNode *node1, X3DAbstractNode *node2) |
Test if node1 is a descendant of node2. | |
Private Attributes | |
X3DTK::X3D::GroupingNodeCreator | groupingNodeCreator |
X3D::Loader * | x3dloader |
The x3d scene graph loader from a file .x3d. | |
X3D::EngineLoader * | engineLoader |
The visitor used for creating animal::engines associated with x3d nodes. | |
GL::MyRenderer | renderer |
The openGL scene graph renderer. | |
AnimalEngines | animalEngines |
The group of engines which do not belong to the scene graph (added directly using method addEngine). | |
X3D::EngineNodes | allEngineNodes |
The group of engines which belong to the scene graph. | |
X3D::EngineNodes | kinematicEngines |
engines which do not react to collisions (subset of allEngineNodes) | |
X3D::EngineNodes | dynamicEngines |
engines which can react to collisions (subset of allEngineNodes) | |
X3D::EngineNodes | collisionEngines |
collision detection engines (subset of allEngineNodes) | |
MainController * | mainController |
The main GUI. | |
X3D::X3DBoundedObject * | m_selectedNode |
A selected object which must be highlighted. | |
X3D::BBoxUpdater * | bbupdater |
update the bounding box of the scene |
|
Constructor.
Definition at line 35 of file mainScene.cpp. References allEngineNodes, bbupdater, buildGL(), collisionEngines, dynamicEngines, engineLoader, kinematicEngines, and x3dscene. |
|
Destructor.
Definition at line 59 of file mainScene.cpp. References glscene, releaseNode(), x3dloader, and x3dscene. |
|
Add an engine.
Definition at line 464 of file mainScene.cpp. References animalEngines, computeBbox(), and animal::Engine::init(). Referenced by MainController::addEngine(). |
|
Build the glscene from the x3dscene, update the list glNodeToUpdate and compute the bounding box of the scene.
Definition at line 502 of file mainScene.cpp. References X3DTK::GL::X3DGLMapBuilder::build(), X3DTK::X3D::EngineNode::declareOutputs(), glscene, glUpdates, releaseNode(), X3DTK::X3D::X3D_X3DNodeList, x3dGLMap, and x3dscene. Referenced by cutNode(), load(), MainScene(), and pastNode(). |
|
Clear the engines list.
Definition at line 479 of file mainScene.cpp. References animalEngines, and computeBbox(). |
|
Compute a bounding box from the x3d scene.
Definition at line 386 of file mainScene.cpp. References allEngineNodes, animalEngines, bbupdater, max, min, and x3dscene. Referenced by addEngine(), clearEngines(), MainController::computeBbox(), removeEngine(), and updateGL(). |
|
Cut a node, i.e break the link between the node and its current parent node. parentNode can be NULL, for example when node == scene. In this case all the children of scene are cut. Definition at line 209 of file mainScene.cpp. References buildGL(), deleteNode(), engineLoader, X3DTK::X3D::EngineLoader::release(), and x3dscene. Referenced by deleteNode(). |
|
Delete a node i.e break the link between the node and its current parent node and delete it. parentNode can be NULL, for example when node == scene. In this case all the children of scene are deleted. Definition at line 260 of file mainScene.cpp. References cutNode(), isADescendant(), mainController, releaseNode(), MainController::removeX3DQtMap(), and x3dscene. Referenced by cutNode(), and releaseNode(). |
|
Draw the scene from the openGL graph glscene.
Definition at line 305 of file mainScene.cpp. References animalEngines, glscene, X3DTK::GL::MyRenderer::render(), and renderer. |
|
Get the Bounding Box maxima.
Definition at line 145 of file mainScene.h. References max. |
|
Get the Bounding Box minima.
Definition at line 142 of file mainScene.h. References min. |
|
Get the main GUI.
Definition at line 148 of file mainScene.h. References mainController. |
|
Get the x3d scene.
Definition at line 139 of file mainScene.h. References x3dscene. Referenced by MainController::fileOpen(), and MainController::fileReload(). |
|
Test if node1 is a descendant of node2.
Definition at line 581 of file mainScene.cpp. Referenced by deleteNode(), and pastNode(). |
|
Deal with key press event. Return false if the event is not handled.
Definition at line 597 of file mainScene.cpp. References animalEngines. Referenced by MainController::keyPressEvent(). |
|
Load the scene from the given file and insert the scene's children from the given node.
Definition at line 127 of file mainScene.cpp. References engineLoader, X3DTK::X3D::EngineLoader::initialize(), pastNode(), and x3dloader. |
|
Load the scene from file. It erases the existed x3d scene.
Definition at line 106 of file mainScene.cpp. References buildGL(), engineLoader, X3DTK::X3D::EngineLoader::initialize(), releaseNode(), x3dloader, and x3dscene. Referenced by MainController::fileInsert(), MainController::fileOpen(), and MainController::fileReload(). |
|
Deal with mouse double-click event. Return false if the event is not handled.
Definition at line 603 of file mainScene.cpp. References animalEngines. Referenced by MainController::mouseDoubleClickEvent(). |
|
Deal with mouse move event. Return false if the event is not handled.
Definition at line 609 of file mainScene.cpp. References animalEngines. Referenced by MainController::mouseMoveEvent(). |
|
Deal with mouse press event. Return false if the event is not handled.
Definition at line 615 of file mainScene.cpp. References animalEngines. Referenced by MainController::mousePressEvent(). |
|
Deal with mouse release event. Return false if the event is not handled.
Definition at line 621 of file mainScene.cpp. References animalEngines. Referenced by MainController::mouseReleaseEvent(). |
|
Move the scene.
Definition at line 361 of file mainScene.cpp. References allEngineNodes, animalEngines, and updateGL(). Referenced by MainController::doStep(). |
|
Define a new x3d grouping node.
Definition at line 118 of file mainScene.h. References groupingNodeCreator, X3DTK::X3D::GroupingNodeCreator::newX4DClass(), and x3dloader. |
|
Past a node from a parent node.
Definition at line 161 of file mainScene.cpp. References buildGL(), engineLoader, X3DTK::X3D::EngineLoader::initialize(), and isADescendant(). Referenced by load(). |
|
Definition at line 629 of file mainScene.cpp. References allEngineNodes, and animalEngines. Referenced by MainController::pickPoint(). |
|
Release a node, i.e delete it if there is no more parent link. if node == scene, all the children of scene are released. Definition at line 284 of file mainScene.cpp. References deleteNode(), glUpdates, and x3dscene. Referenced by buildGL(), deleteNode(), load(), and ~MainScene(). |
|
Remove an engine.
Definition at line 472 of file mainScene.cpp. References animalEngines, and computeBbox(). |
|
Reset the scene for the animation.
Definition at line 343 of file mainScene.cpp. References allEngineNodes, animalEngines, and updateGL(). Referenced by MainController::reset(). |
|
Save the x3d graphe in a file.x3d.
Definition at line 329 of file mainScene.cpp. References allEngineNodes, and x3dscene. Referenced by MainController::fileSave(). |
|
Definition at line 151 of file mainScene.h. References mainController. Referenced by MainController::MainController(). |
|
highlight a node
Definition at line 656 of file mainScene.cpp. References m_selectedNode, renderer, and X3DTK::GL::MyRenderer::setBoundedObject(). |
|
Update all the gl nodes contained in the list glNodeToUpdate.
Definition at line 486 of file mainScene.cpp. References computeBbox(), and glUpdates. |
|
The group of engines which belong to the scene graph.
Definition at line 228 of file mainScene.h. Referenced by computeBbox(), MainScene(), move(), pickPoint(), reset(), and save(). |
|
The group of engines which do not belong to the scene graph (added directly using method addEngine).
Definition at line 224 of file mainScene.h. Referenced by addEngine(), clearEngines(), computeBbox(), draw(), keyPressEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), move(), pickPoint(), removeEngine(), and reset(). |
|
update the bounding box of the scene
Definition at line 240 of file mainScene.h. Referenced by computeBbox(), and MainScene(). |
|
collision detection engines (subset of allEngineNodes)
Definition at line 231 of file mainScene.h. Referenced by MainScene(). |
|
engines which can react to collisions (subset of allEngineNodes)
Definition at line 230 of file mainScene.h. Referenced by MainScene(). |
|
The visitor used for creating animal::engines associated with x3d nodes.
Definition at line 213 of file mainScene.h. Referenced by cutNode(), load(), MainScene(), and pastNode(). |
|
The openGL scene graph.
Definition at line 195 of file mainScene.h. Referenced by buildGL(), draw(), and ~MainScene(). |
|
gl updates to perform after an animation step
Definition at line 203 of file mainScene.h. Referenced by buildGL(), releaseNode(), and updateGL(). |
|
Definition at line 207 of file mainScene.h. Referenced by newX4DClass(). |
|
engines which do not react to collisions (subset of allEngineNodes)
Definition at line 229 of file mainScene.h. Referenced by MainScene(). |
|
A selected object which must be highlighted.
Definition at line 237 of file mainScene.h. Referenced by setSelectedNode(). |
|
The main GUI.
Definition at line 234 of file mainScene.h. Referenced by deleteNode(), getMainController(), and setMainController(). |
|
Maxima for the bounding box.
Definition at line 201 of file mainScene.h. Referenced by computeBbox(), and getBboxMax(). |
|
Minima for the bounding box.
Definition at line 198 of file mainScene.h. Referenced by computeBbox(), and getBboxMin(). |
|
The openGL scene graph renderer.
Definition at line 221 of file mainScene.h. Referenced by draw(), and setSelectedNode(). |
|
The map which links X3DTK::X3D::X3DNode to their corresponding X3DTK::GL::X3DNode.
Definition at line 217 of file mainScene.h. Referenced by buildGL(). |
|
The x3d scene graph loader from a file .x3d.
Definition at line 210 of file mainScene.h. Referenced by load(), newX4DClass(), and ~MainScene(). |
|
The x3d scene graph.
Definition at line 192 of file mainScene.h. Referenced by buildGL(), computeBbox(), cutNode(), deleteNode(), getX3DScene(), load(), MainScene(), releaseNode(), save(), and ~MainScene(). |