From 0fe14f7c363bdca51b3fcd90d9978f61a71837a6 Mon Sep 17 00:00:00 2001 From: James Turner Date: Wed, 25 Jan 2017 22:19:15 +0000 Subject: [PATCH] Use enable-hot flag in model manager. Allow control of the terrain flag on models added via the model manager at runtime. Designed and requested by Henning Stahlke --- src/Model/modelmgr.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Model/modelmgr.cxx b/src/Model/modelmgr.cxx index 2b2e35924..7fe04e0bb 100644 --- a/src/Model/modelmgr.cxx +++ b/src/Model/modelmgr.cxx @@ -129,6 +129,17 @@ FGModelMgr::add_model (SGPropertyNode * node) else model->setHeadingDeg(node->getDoubleValue("heading-deg")); + + if (node->hasChild("enable-hot")) { + osg::Node::NodeMask mask = model->getSceneGraph()->getNodeMask(); + if (node->getBoolValue("enable-hot")) { + mask |= SG_NODEMASK_TERRAIN_BIT; + } else { + mask &= ~SG_NODEMASK_TERRAIN_BIT; + } + model->getSceneGraph()->setNodeMask(mask); + } + // Add this model to the global scene graph globals->get_scenery()->get_scene_graph()->addChild(model->getSceneGraph());