The X3D scene graph

Introduction

The X3D scene graph is the typed version of the XML DOM tree where all attributes are strings. It is the entry point of the library, an X3D file must be loaded into an X3D scene graph. Inversely, it is used to save X3D files. It has no specific behaviour and is just a container. X3D nodes inherit the scene graph API of which description can be found here.

How to use it

A common way to use the library is to load the X3D file into an X3D scene graph, translate it into another structure that can be a GL scene graph, a MESH scene graph or a personal structure. At any time, you can save your structure to an X3D scene graph that can be saved as an X3D file. At that moment, only the provided MESH scene graph API MESH scene graph can be translated into an X3D scene graph.

Loading a scene

You need to use a loader:
// Loading by accessing a singleton loader X3DTK::X3D::Scene *scene = X3DTK::Singleton<X3DTK::X3D::Loader>::getInstance()->load("MyFile.x3d", false);
Here the scene is loaded but no validation is made due to the second argument of the load method. You can see the graphTester for an example of loading a scene.

Saving a scene

You now need a saver:
// Saving by keeping the file name X3DTK::Singleton<X3DTK::X3D::SceneSaver>::getInstance()->save(scene); // Saving by changing the file name X3DTK::Singleton<X3DTK::X3D::SceneSaver>::getInstance()->saveAs(scene, "MyNewFile.x3d");
You can see the infoReader for an example of saving a scene.

Examples

Here is the list of the examples where the X3D scene graph is used:
Generated on Fri Jul 30 12:02:31 2004 for X3DToolKit by doxygen 1.3.6