#include #include #include #include #include #include #include #include #include #include #include void write_usage(ostream& out,const std::string& name) { out << std::endl; out <<"usage:"<< std::endl; out <<" "< commandLine; for(int i=1;i(model)==0) { const osg::BoundingSphere& bs = model->getBound(); if (bs.isValid()) { osg::Impostor* impostor = new osg::Impostor; // standard LOD settings impostor->addChild(model); impostor->setRange(0,0.0f); impostor->setRange(1,1e7f); impostor->setCenter(bs.center()); // impostor specfic settings. impostor->setImpostorThresholdToBound(5.0f); model = impostor; } } // we insert an impostor node above the model, so we keep a handle // on the rootnode of the model, the is required since the // InsertImpostorsVisitor can add a new root in automatically and // we would know about it, other than by following the parent path // up from model. This is really what should be done, but I'll pass // on it right now as it requires a getRoots() method to be added to // osg::Node, and we're about to make a release so no new features! osg::Group* rootnode = new osg::Group; rootnode->addChild(model); // now insert impostors in the model using the InsertImpostorsVisitor. osgUtil::InsertImpostorsVisitor ov; // traverse the model and collect all osg::Group's and osg::LOD's. // however, don't traverse the rootnode since we want to keep it as // the start of traversal, otherwise the insertImpostor could insert // and Impostor above the current root, making it nolonger a root! model->accept(ov); // insert the Impostors above groups and LOD's ov.insertImpostors(); osg::Timer_t after_load = timer.tick(); std::cout << "Time for load = "<