C++ 如何为.IV文件中的渲染几何体应用状态集
我想将状态集应用于.iv文件中的渲染几何体。 例如C++ 如何为.IV文件中的渲染几何体应用状态集,c++,openscenegraph,C++,Openscenegraph,我想将状态集应用于.iv文件中的渲染几何体。 例如 // this will render the geometry; osg::ref_ptr<osg::Group> root = dynamic_cast <osg::Group*>(osgDB::ReadNodeFile("cow.osg")); // want to apply stateset for above rendered file from .iv file `osg::ref_ptr<osg
// this will render the geometry;
osg::ref_ptr<osg::Group> root = dynamic_cast <osg::Group*>(osgDB::ReadNodeFile("cow.osg"));
// want to apply stateset for above rendered file from .iv file
`osg::ref_ptr<osg::Stateset> state = dynamic_cast <osg::Stateset*>(osgDB::ReadNodeFile("gold.osg"));`
如果第二个文件只有一个具有所需状态集的节点,则可以执行以下操作:
root->setStateSet(osgDB::ReadNodeFile("gold.osg")->getOrCreateStateSet());
这不适用。。我尝试将osg文件更改为,但它没有应用root->setStateSet(osgDB::ReadNodeFile(“cow.osg”)->getOrCreateStateSet());然后,
“gold.osg”
中的第一个节点可能没有保存该材质。你能通过显示该文件的内容来强化你的问题吗?
root->setStateSet(osgDB::ReadNodeFile("gold.osg")->getOrCreateStateSet());