|
发表于 2017-3-15 21:31:28
|
显示全部楼层
您好,能帮我看一下我这段代码的问题吗,模型位置设置不对
osg::ref_ptr <osgViewer::Viewer>viewer = new osgViewer::Viewer;
osg::ref_ptr <osg::Group>root = new osg::Group;
osg::ref_ptr <osg:agedLOD >page1 = new osg:agedLOD;
osg::ref_ptr <osg:agedLOD >page2 = new osg:agedLOD;
page1->setCenter(osg::Vec3(-100, 0, 0));
page1->setFileName(0, "cow.osg");
page1->setRange(0, 0, 20000);
page2->setCenter(osg::Vec3(100, 0, 0));
page2->setFileName(0, "spaceship.osgt");
page2->setRange(0, 0, 20000);
root->addChild(page1.get());
root->addChild(page2.get());
osgUtil::Optimizer optimizer;
optimizer.optimize(root.get());
viewer->setSceneData(root.get());
return viewer->run();
运行程序后,模型cow和spaceship总是粘在一起,完全感觉不到setCenter()的作用 |
|