1
0
Fork 0

Compositor: FG now gracefully quits if no valid Compositor has been found. Added a command line option (--compositor) to choose the default Compositor.

This commit is contained in:
Fernando García Liñán 2019-02-20 03:09:17 +01:00
parent 16dedfe78f
commit bec41e7e17
2 changed files with 12 additions and 6 deletions

View file

@ -1629,6 +1629,7 @@ struct OptionDesc {
{"disable-rembrandt", false, OPTION_BOOL, "/sim/rendering/rembrandt/enabled", false, "", 0 },
{"enable-rembrandt", false, OPTION_BOOL, "/sim/rendering/rembrandt/enabled", true, "", 0 },
{"renderer", true, OPTION_STRING, "/sim/rendering/rembrandt/renderer", false, "", 0 },
{"compositor", true, OPTION_STRING, "/sim/rendering/default-compositor", false, "", 0 },
{"disable-splash-screen", false, OPTION_BOOL, "/sim/startup/splash-screen", false, "", 0 },
{"enable-splash-screen", false, OPTION_BOOL, "/sim/startup/splash-screen", true, "", 0 },
{"disable-mouse-pointer", false, OPTION_STRING, "/sim/startup/mouse-pointer", false, "disabled", 0 },

View file

@ -27,6 +27,7 @@
#include <simgear/math/SGRect.hxx>
#include <simgear/props/props.hxx>
#include <simgear/props/props_io.hxx> // for copyProperties
#include <simgear/structure/exception.hxx>
#include <simgear/structure/OSGUtils.hxx>
#include <simgear/structure/OSGVersion.hxx>
#include <simgear/scene/material/EffectCullVisitor.hxx>
@ -682,16 +683,20 @@ void CameraGroup::buildCamera(SGPropertyNode* cameraNode)
// If no width or height has been specified, fill the entire window
viewportNode->getDoubleValue("width", window->gc->getTraits()->width),
viewportNode->getDoubleValue("height",window->gc->getTraits()->height));
std::string comp_path = cameraNode->getStringValue("compositor",
"Compositor/default");
std::string default_compositor =
fgGetString("/sim/rendering/default-compositor", "Compositor/default");
std::string compositor_path =
cameraNode->getStringValue("compositor", default_compositor.c_str());
Compositor *compositor = Compositor::create(_viewer,
window->gc,
viewport,
comp_path);
if (compositor)
compositor_path);
if (compositor) {
info->compositor = compositor;
else
SG_LOG(SG_INPUT, SG_WARN, "Unable to build Compositor");
} else {
throw sg_exception(std::string("Failed to create Compositor in path '") +
compositor_path + "'");
}
// Distortion camera needs the viewport which is created by addCamera().
if (psNode) {