fbx模型在OSG中渲染
int main() { osg::ref_ptr<osgViewer::Viewer> viewer1 = new osgViewer::Viewer; osg::ref_ptr<osg::Group> group1 = new osg::Group; osg::ref_ptr<osg::Group> group2 = new osg::Group; //osg::ref_ptr<osg::Node> node1 = osgDB::readNodeFile("I:\\BIM\\fbx\\jiaoxuelou20190304.fbx"); //osg::ref_ptr<osg::Node> node1 = osgDB::readNodeFile("I:\\BIM\\fbx\\Worker201907.fbx"); //osg::ref_ptr<osg::Node> node1 = osgDB::readNodeFile("I:\\BIM\\fbx\\buildings6.fbx"); //osg::ref_ptr<osg::Node> node1 = osgDB::readNodeFile("I:\\BIM\\fbx\\wdq.fbx"); //osg::ref_ptr<osg::Node> node1 = osgDB::readNodeFile("I:\\BIM\\fbx\\wall20190707.fbx"); osg::ref_ptr<osg::Node> node1 = osgDB::readNodeFile("I:\\BIM\\fbx\\wujiaodalou20190709.fbx"); group1->addChild(node1.get()); group2->addChild(makeCoordinate(10.0, 10.0, 10.0, 4)); group2->addChild(group1.get()); //viewer1->setSceneData(group1.get()); viewer1->setSceneData(group2.get()); viewer1->setUpViewInWindow(200, 200, 800, 600, 0); //遍历节点 //AnimationManagerFinder animationManagerFinder1; //group1->accept(animationManagerFinder1); std::cout << "--------------------------------" << std::endl; printOsgGroup(group1); //BoundVisitor boundVisitor1; //group1->accept(boundVisitor1); //int nodeChildCount = node1->getNumChildrenRequiringEventTraversal(); //std::cout << "----count:" <<nodeChildCount<< std::endl; viewer1->addEventHandler(new CPickHandler(viewer1)); return viewer1->run(); }
QQ 3087438119