However this can be useful when you debug an application that builds or modifies a scene graph.
Some important functions and classes:
It knows all the standard X3D nodes.X3D::Loader *loader();
Second, an X3DTK::GraphTester processor is built:
GraphTester tester();
To cleanly close the application, we use the X3DTK::MemReleaser to release the dynamically allocated scene graph.
MemReleaser releaser();
Then, the scene can be loaded from the file:
X3D::Scene *s = loader.load(argv[1]);
And the processor can be applied to the scene:
tester.test(s);
The final step is to release the scene graph:
releaser.release(s);
Notice that to be more concise but less clean, we could have written:
GraphTester().test(loader().load(argv[1]));
#include <X3DTK/X3D/scenegraph.h> #include <X3DTK/graphtester.h> #include <X3DTK/memreleaser.h> #include <iostream> using namespace X3DTK; using namespace std; int main(int argc, char *argv[]) { if (argc <= 1) { cerr << "usage: graphtester input" << endl; exit(0); } // Default loader for the X3D Nodes. X3D::Loader loader; // Instanciation of X3DTK::GraphTester. GraphTester tester; // Instanciation of X3DTK::MemReleaser. MemReleaser releaser; // Loads the scene. X3D::Scene *s = loader.load(argv[1]); // Tests the scene graph. tester.test(s); // Releases the scene graph. releaser.release(s); return 1; }