创建读取文件回调类
//.h
class CReadFileCallbackEx : public osgDB::ReadFileCallback
{
public:
CReadFileCallbackEx();
virtual ~CReadFileCallbackEx();
virtual osgDB::ReaderWriter::ReadResult readNode(const std::string& filename, const osgDB::ReaderWriter::Options* options);
};
//.cpp
osgDB::ReaderWriter::ReadResult CReadFileCallbackEx::readNode( const std::string& filename, const osgDB::ReaderWriter::Options* options )
{
osgDB::ReaderWriter::ReadResult rs = osgDB::ReadFileCallback::readNode(filename,options);
if (rs.validNode())
{
//处理数据节点,可以设置显示颜色等参数
osg::Node* pNode = rs.getNode();
}
return rs;
}
来源:CSDN
作者:元宝1124
链接:https://blog.csdn.net/snowwind_51/article/details/104516429