void LoadThreadsHandler::AttachNodeToSceneByName::apply(osg::Switch& swt)
{
	if (swt.getName() == _nodeName)
	{
		if(!_attached || _multipleattach)
		{
			if(_ranged)
			{
				osg::ref_ptr<osg::LOD> newlod = new osg::LOD;
				newlod->setName("RangedLOD_" + _attachNode->getName());

				newlod->addChild(_attachNode.get(), _min, _max);

				swt.addChild(newlod.get(), true);
			}
			else
			{
				swt.addChild(_attachNode.get(), true);
			}
			
			_attached = true;
		}
	}

	traverse(swt);
}
Esempio n. 2
0
    void apply(osg::Switch& sw)
    {
        if (sw.getName().find(_name)!=std::string::npos)
        {
            _switch = &sw;
            return; // note, no need to do traverse now we've located the relevant switch
        }

        traverse(sw);
    }