20,741
edits
| Line 443: | Line 443: | ||
=== Using Osg::Optimizer for complex Canvases === | === Using Osg::Optimizer for complex Canvases === | ||
A trivial example invoking the in-built [http://trac.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/a00554.html osg::Optimizer] for an arbitrary Canvas element would be this: | |||
<syntaxhighlight lang="cpp"> | |||
osgUtil::Optimizer optimizer; | |||
// _transform is the element specific Node containing all Canvas child nodes | |||
optimizer.optimize(_transform.get()); | |||
</syntaxhighlight> | |||
Obviously, there are additional optimization options available, for details refer to [http://trac.openscenegraph.org/projects/osg//wiki/Support/UserGuides/OptimizerOptions]. | |||
To map these options to either a C++ callback exposed via Nasal or via properties, a <code>std::map<std::string,OptimizationOptions></code> can be used. Linking requires osgUtil.lib (or libosgUtil.so under Unix/Linux)[https://www.packtpub.com/books/content/openscenegraph-methods-improving-rendering-efficiency]. | |||
Once a complex Canvas texture (MFD) has been set up, the following patch can be used for invoking osgUtil::Optimizer() to finalize and optimize the scene graph: | Once a complex Canvas texture (MFD) has been set up, the following patch can be used for invoking osgUtil::Optimizer() to finalize and optimize the scene graph: | ||
<syntaxhighlight lang="diff"> | <syntaxhighlight lang="diff"> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Tracking update frequency per Canvas/Element === | === Tracking update frequency per Canvas/Element === | ||