Canvas troubleshooting: Difference between revisions

Jump to navigation Jump to search
m
no edit summary
mNo edit summary
Line 425: Line 425:
root.dumpSceneGraph('my-canvas-scenegraph.osg');
root.dumpSceneGraph('my-canvas-scenegraph.osg');
</syntaxhighlight>
</syntaxhighlight>
Now, let's consider another example - this time actually building a little scene graph hierarchy with multiple groups and nodes, using a for loop:
<syntaxhighlight lang="nasal">
var window = canvas.Window.new([320,160],"dialog");
var myCanvas = window.createCanvas().set("background", canvas.style.getColor("bg_color"));
var root = myCanvas.createGroup();
var group = root.createChild('group', 'level:0');
for (var i=0;i<=5;i+=1) {
var textNode = group.createChild("text")
        .setText("text node in group #1"~i)
        .setTranslation(20, 200)
        .set("alignment", "left-center")
        .set("character-size", 15)
        .set("font", "LiberationFonts/LiberationSans-Bold.ttf")
        .set("fill", "#ff0000");
var myGroup = root.createChild('group', 'my group');
group = group.createChild('group', 'level:'~i);
}
</syntaxhighlight>
This will create a new group for each text node, added to its parent group.
Once we inspect the scene graph, we'll see that it contains quite a bit of redundant state.
However, this is where osg::Optimizer can shine, by optimizing our scene graph to get rid of redundant state sets and flatten the scene graph.
{{WIP}}


Next, we're going to explore dumping complex scene graphs to disk, i.e. those created by Canvas MFDs like the [[NavDisplay]] - so that we can check what the scene graph looks like after optimizing/simplifying it using osg::Simplifier and osg::Optimizer respectively, while also investigating which additional OSG properties may be helpful to expose for the optimizer/simplifier to provide satisfying results.
Next, we're going to explore dumping complex scene graphs to disk, i.e. those created by Canvas MFDs like the [[NavDisplay]] - so that we can check what the scene graph looks like after optimizing/simplifying it using osg::Simplifier and osg::Optimizer respectively, while also investigating which additional OSG properties may be helpful to expose for the optimizer/simplifier to provide satisfying results.

Navigation menu