-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
OpenSceneGraph 3.0: Beginner's Guide
To create serializers for a class and make it accessible from OSG native formats, there are some preconditions: firstly, the class must be derived from osg::Object, either directly or indirectly; secondly, the class must be declared in a namespace, and uses META_Object to define the correct namespace and class names; finally and most importantly, the class must have at least a getter and a setter method for each member property, which makes it serializable, that is, it can be stored to OSG native scene files and deserialized to a cloned scene object at any time.
Include the necessary headers:
#include <osg/Node> #include <osgDB/ObjectWrapper> #include <osgDB/Registry> #include <osgDB/ReadFile> #include <osgDB/WriteFile> #include <iostream>
We define the testNS::ExampleNode class to be serialized. It is easy to understand and will do nothing except record an unsigned integer number, _exampleID...
Change the font size
Change margin width
Change background colour