From: Frederic Bouvier Date: Thu, 31 May 2012 18:22:40 +0000 (+0200) Subject: Fix lights when added as submodels X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e7e06c89e12a6a327286a06afd60ab31f3d89229;p=simgear.git Fix lights when added as submodels --- diff --git a/simgear/scene/model/SGReaderWriterXML.cxx b/simgear/scene/model/SGReaderWriterXML.cxx index a0428691..fc7d67f3 100644 --- a/simgear/scene/model/SGReaderWriterXML.cxx +++ b/simgear/scene/model/SGReaderWriterXML.cxx @@ -198,9 +198,10 @@ void makeEffectAnimations(PropertyList& animation_nodes, } } -class SGSetNodeMaskVisitor : public osg::NodeVisitor { +namespace simgear { +class SetNodeMaskVisitor : public osg::NodeVisitor { public: - SGSetNodeMaskVisitor(osg::Node::NodeMask nms, osg::Node::NodeMask nmc) : + SetNodeMaskVisitor(osg::Node::NodeMask nms, osg::Node::NodeMask nmc) : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), nodeMaskSet(nms), nodeMaskClear(nmc) {} virtual void apply(osg::Geode& node) { @@ -211,6 +212,7 @@ private: osg::Node::NodeMask nodeMaskSet; osg::Node::NodeMask nodeMaskClear; }; +} static osg::Node * sgLoad3DModel_internal(const SGPath& path, @@ -311,6 +313,9 @@ sgLoad3DModel_internal(const SGPath& path, // but introducing new data for velocities. UserDataCopyVisitor userDataCopyVisitor; model->accept(userDataCopyVisitor); + + SetNodeMaskVisitor setNodeMaskVisitor(0, simgear::MODELLIGHT_BIT); + model->accept(setNodeMaskVisitor); } model->setName(modelpath.str()); @@ -455,8 +460,6 @@ sgLoad3DModel_internal(const SGPath& path, group = static_cast(modelWithEffects.get()); } - SGSetNodeMaskVisitor snmv(0, simgear::MODELLIGHT_BIT); - group->accept(snmv); for (unsigned i = 0; i < animation_nodes.size(); ++i) /// OSGFIXME: duh, why not only model????? SGAnimation::animate(group.get(), animation_nodes[i], prop_root,