osg学习笔记2, 命令行参数解析器ArgumentParser
ArgumentParser主要负责命令行参数的读取
#include <osgDB/ReadFile> #include <osgViewer/Viewer> int main(int argc, char **argv) { //命令行参数读取 osg::ArgumentParser arguments(&argc, argv); std::string filename; arguments.read("--model", filename); osg::ref_ptr<osg::Node> root = osgDB::readNodeFile(filename); osgViewer::Viewer viewer; viewer.setSceneData(root.get()); return viewer.run(); }