Tutorial


General Architecture


Implementation and namespaces



This architecture is implemented in the libAnimAL-X3DTK-Qt.so which is located in $ANIMAL/lib.
To compile this library: cd $ANIMAL/animal/X3DTK ; qmake ; make

This AnimAL-X3DTK-Qt library shows how to implement AnimaL in a specific architecture: This AnimAL-X3DTK-Qt library is in the main namespace X3DTK which is itself divided in three namespaces: The directory $ANIMAL/animal/X3DTK is organized in the same way.

Graphic User Interface (GUI)



In AnimAL-X3DTK-Qt library, the main Graphic User Interface is composed of: You can plug your own viewer if this one inherits from X3DTK::Qt::Viewer.
You just have to add in the main file:
mainController->setViewer(new  YourOwnViewer(mainController.centralWidget(), "Your own viewer"));
See the code of $ANIMAL/examples/X3DTK/qtapp/qtapp.cpp.

Modules of AnimaL

Here we present:

What is an engine ?

The modules of animation are similar to an abstract component we call animal::Engine.
The main role of an animal::Engine is to be:

How to create an engine ?

To create a new engine in AnimaL, follow the code of animal::SpinningCubeEngine in $ANIMAL/examples/X3DTK/spinningCube/spinningCubeEngine.h.
This class , as a specific engine, inherits from animal::Engine.
The specification of animal::SpinningCubeEngine is:

X3D node corresponding to an engine

In the library AnimAL-X3DTK-Qt, the external and internal 3D model use the X3DToolKit library.
In order to represent an engine in the x3d graph, to load and save it in a file .x3d, we can define a x3d node, but this is not an obligation.
In the X3DToolKit documentation, there is examples for the creation of a new x3d node.

Go on the same example animal::SpinningCubeEngine.
First you have to define the x3d node tag and its attributes in the file .x3d (see $ANIMAL/examples/X3DTK/files-x3d/spinningCube.x3d).
Now code the corresponding x3d node in order to load it.
To proceed look at the code in $ANIMAL/examples/X3DTK/spinningCube/spinningCubeNode.h

GUI controller corresponding to an engine

You can create a GUI controller for one engine in order to control its behaviour, but this is not an obligation.
Actually, the associated controller QWidget to one engine is associated to its corresponding x3d node.
To proceed follow the code in $ANIMAL/examples/X3DTK/spinningCube/spinningCubeQt.h.

To test an engine

To test an engine, its x3d node and its GUI, follow the example $ANIMAL/examples/X3DTK/qtapp/qtapp.cpp. Thus, after parsing the x3d file, a animal::Engine relative to a specific x3d node is automatically created, connected, moved and drawn. The GUI controller corresponding to the engine will be automatically created by double-clicking on the item corresponding to the engine in the x3d tree of the main GUI.

If you don't create the associated x3d node and GUI like animal::SpinningHexahedronEngine defined in $ANIMAL/examples/X3DTK/spinningHexahedron/spinningHexahedronEngine.h, then uncomment and add this code in $ANIMAL/examples/X3DTK/qtapp/qtapp.cpp: Thus the specific engine is automatically created, moved and drawn.

External 3D animated models

In order to reuse an existed code, i.e. 3D animated models in C++ which are external to AnimaL, it can be implemented like an animal::Engine.
That is, to insert external code within AnimaL, you just have to implement a new class which inherits from animal::Engine.
To understand how it works, see How to create an engine ?.
Francois Faure (Francois.Faure@imag.fr) & Laure Heigeas (Laure.Heigeas@imag.fr) / 2004-12-23