Scene *create(int level, const Vec &c, double r) { Scene *s = new Sphere(c, r); if (level == 1) return s; Scenes child; child.push_back(s); double rn = 3*r/sqrt(12.); for (int dz=-1; dz<=1; dz+=2) for (int dx=-1; dx<=1; dx+=2) child.push_back(create(level-1, c + rn*Vec(dx, 1, dz), r/2)); return new Group(Sphere(c, 3*r), child);}
void CompositeViewer::getScenes(Scenes& scenes, bool onlyValid) { scenes.clear(); typedef std::set<osgViewer::Scene*> SceneSet; SceneSet sceneSet; for(RefViews::iterator vitr = _views.begin(); vitr != _views.end(); ++vitr) { osgViewer::View* view = vitr->get(); if (view->getScene() && (!onlyValid || view->getScene()->getSceneData())) { if (sceneSet.count(view->getScene())==0) { sceneSet.insert(view->getScene()); scenes.push_back(view->getScene()); } } } }
void CompositeViewer::getScenes(Scenes& scenes, bool onlyValid) { typedef std::set<osgViewer::Scene*> SceneSet; SceneSet sceneSet; for(RefViews::iterator vitr = _views.begin(); vitr != _views.end(); ++vitr) { osgViewer::View* view = vitr->get(); if (view->getScene() && (!onlyValid || view->getScene()->getSceneData())) { sceneSet.insert(view->getScene()); } } for(SceneSet::iterator sitr = sceneSet.begin(); sitr != sceneSet.end(); ++sitr) { scenes.push_back(const_cast<osgViewer::Scene*>(*sitr)); } }