Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/145.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 如何为.IV文件中的渲染几何体应用状态集_C++_Openscenegraph - Fatal编程技术网

C++ 如何为.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

我想将状态集应用于.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::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());