20,741
edits
m (→FG1000) |
m (→FG1000: PM 2 wiki ...) |
||
| Line 1,141: | Line 1,141: | ||
</script> | </script> | ||
</binding> | </binding> | ||
</syntaxhighlight> | |||
Another thing worth trying is running the built-on OSG optimizer on the root group, this requires patching SG/FG respectively: | |||
<syntaxhighlight lang="diff"> | |||
diff --git a/simgear/canvas/elements/CanvasGroup.hxx b/simgear/canvas/elements/CanvasGroup.hxx | |||
index 33687637..288da23d 100644 | |||
--- a/simgear/canvas/elements/CanvasGroup.hxx | |||
+++ b/simgear/canvas/elements/CanvasGroup.hxx | |||
@@ -20,6 +20,8 @@ | |||
#ifndef CANVAS_GROUP_HXX_ | |||
#define CANVAS_GROUP_HXX_ | |||
+#include <osgUtil/Optimizer> | |||
+ | |||
#include "CanvasElement.hxx" | |||
#include <list> | |||
@@ -97,6 +99,11 @@ namespace canvas | |||
osg::BoundingBox | |||
getTransformedBounds(const osg::Matrix& m) const override; | |||
+ void optimize () { | |||
+ osgUtil::Optimizer opt; | |||
+ opt.optimize(_scene_group.get() ); | |||
+ } | |||
+ | |||
protected: | |||
static ElementFactories _child_factories; | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="diff"> | |||
diff --git a/src/Scripting/NasalCanvas.cxx b/src/Scripting/NasalCanvas.cxx | |||
index 602f06989..23aadfb36 100644 | |||
--- a/src/Scripting/NasalCanvas.cxx | |||
+++ b/src/Scripting/NasalCanvas.cxx | |||
@@ -521,7 +521,8 @@ naRef initNasalCanvas(naRef globals, naContext c) | |||
.bases<NasalElement>() | |||
.method("_createChild", &f_groupCreateChild) | |||
.method( "_getChild", &f_groupGetChild) | |||
- .method("_getElementById", &sc::Group::getElementById); | |||
+ .method("_getElementById", &sc::Group::getElementById) | |||
+ .method("optimize", &sc::Group::optimize); | |||
NasalText::init("canvas.Text") | |||
.bases<NasalElement>() | |||
.method("heightForWidth", &sc::Text::heightForWidth) | |||
</syntaxhighlight> | </syntaxhighlight> | ||