OSG简单测试框架
#include <osgDB/ReadFile>
#include <osgDB/FileUtils> #include <osg/ArgumentParser>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgGA/StateSetManipulator> #ifdef _DEBUG
#pragma comment(lib, "osgd.lib")
#pragma comment(lib, "osgDBd.lib")
#pragma comment(lib, "osgViewerd.lib")
#pragma comment(lib, "osgGAd.lib")
#else
#pragma comment(lib, "osg.lib")
#pragma comment(lib, "osgDB.lib")
#pragma comment(lib, "osgViewer.lib")
#pragma comment(lib, "osgGA.lib")
#endif // DEBUG int main(int argc, char **argv)
{
// use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(&argc, argv); // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName() + " is an OpenSceneGraph example that shows how to use the accumulation buffer to achieve a simple motion blur effect.");
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName() + " data path. e.g. D:\\OSG\\Data. 如果此参数为空,则读取当前文件目录下的Data目录");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help", "Display this information");
//arguments.getApplicationUsage()->addCommandLineOption("-arg1", "arg1"); // construct the viewer.
osgViewer::Viewer viewer; // if user request help write it out to cout.
if (arguments.read("-h") || arguments.read("--help"))
{
arguments.getApplicationUsage()->write(std::cout);
return ;
} double arg1 = 0.25;
arguments.read("-arg1", arg1); osg::ref_ptr<osg::Group> root = new osg::Group; /*// read the scene from the list of file specified command line args.
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
// if not loaded assume no arguments passed in, try use default mode instead.
if (!loadedModel) loadedModel = osgDB::readNodeFile("cow.osg");
// if no model has been successfully loaded report failure.
if (!loadedModel)
{
std::cout << arguments.getApplicationName() << ": No data loaded" << std::endl;
return 1;
}
root->addChild(loadedModel);
*/ std::string dataPath = ".";
if (argc>)
{
std::cout << argv[];
dataPath = argv[];
}
dataPath += "\\Data\\";
osgDB::DirectoryContents dirNames = osgDB::getDirectoryContents(dataPath);
for each (std::string dir in dirNames)
{
if (dir.find(".") != std::string::npos)
continue;
std::string osgbFile = dataPath + dir + "\\"+ dir+".osgb";
root->addChild(osgDB::readNodeFile(osgbFile));
}
// pass the loaded scene graph to the viewer.
viewer.setSceneData(root.get()); // add the state manipulator
viewer.addEventHandler(new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()));
// add the thread model handler
viewer.addEventHandler(new osgViewer::ThreadingHandler);
// add the window size toggle handler
viewer.addEventHandler(new osgViewer::WindowSizeHandler);
// add the stats handler
viewer.addEventHandler(new osgViewer::StatsHandler);
// add the help handler
viewer.addEventHandler(new osgViewer::HelpHandler(arguments.getApplicationUsage()));
// add the record camera path handler
viewer.addEventHandler(new osgViewer::RecordCameraPathHandler);
// add the LOD Scale handler
viewer.addEventHandler(new osgViewer::LODScaleHandler);
// add the screen capture handler
viewer.addEventHandler(new osgViewer::ScreenCaptureHandler); // create the windows and run the threads.
viewer.realize(); return viewer.run();
}
OSG简单测试框架的更多相关文章
- struts2+hibernate+spring注解版框架搭建以及简单测试(方便脑补)
为了之后学习的日子里加深对框架的理解和使用,这里将搭建步奏简单写一下,目的主要是方便以后自己回来脑补: 1:File--->New--->Other--->Maven--->M ...
- struts2+hibernate+spring配置版框架搭建以及简单测试(方便脑补)
为了之后学习的日子里加深对框架的理解和使用,这里将搭建步奏简单写一下,目的主要是方便以后自己回来脑补: 1:File--->New--->Other--->Maven--->M ...
- hapi lab测试框架简单使用
1. 依赖安装 yarn init yarn add lab code 2. 基本模式 const Lab = require('lab'); const Code = require('code') ...
- 【IDEA】单元测试:项目中引入JUnit测试框架+Mock简单了解
一.Junit 使用和说明: 参考:单元测试第三弹--使用JUnit进行单元测试-HollisChuang's Blog http://www.hollischuang.com/archives/17 ...
- php简单测试slim框架的功能
php简单测试slim框架的功能 监听主路径/ $app->get( '/', function () { $template = <<<EOT<!DOCTYPE htm ...
- OWASP出品:Xenotix XSS漏洞测试框架及简单使用
OWASP Xenotix XSS Exploit Framework是一个高效的跨站脚本漏洞(XSS)检测和攻击测试框架.它通过特有的三大浏览器引擎(包括Trident, WebKit和Gecko) ...
- selenium测试框架篇,页面对象和元素对象的管理
前期已经做好使用Jenkins做buildhttp://www.cnblogs.com/tobecrazy/p/4529399.html 做自动化框架,不可避免的就是对象库. 有一个好的对象库,可以让 ...
- Python几种常用的测试框架
一.测试的常用规则 一个测试单元必须关注一个很小的功能函数,证明它是正确的: 每个测试单元必须是完全独立的,必须能单独运行.这样意味着每一个测试方法必须重新加载数据,执行完毕后做一些清理工作.通常通过 ...
- Android开源测试框架学习
近期因工作需要,分析了一些Android的测试框架,在这也分享下整理完的资料. Android测试大致分三大块: 代码层测试 用户操作模拟,功能测试 安装部署及稳定性测试 代码层测试 对于一般java ...
随机推荐
- zookeeper集群的搭建
虚拟机为VirtualBox 4.3.12版本:系统为CentOS 6.6版本:zookeeper 3.4.7:java版本1.7.0_67. 虚拟机设置为桥接网卡,这样就可以通过主机网卡上网了.Vi ...
- C++:模板友元
模板友元函数在类内声明类外定义时都必须加模板前缀,另外模板要写在一个文件内 // generates undefined error for the operator<< function ...
- 我使用过的Linux命令之clear - 清除终端屏幕,不是cls
原文链接:http://codingstandards.iteye.com/blog/804213 用途说明 clear命令是用来清除终端屏幕的(clear the terminal screen), ...
- php类自动载入
在编写面向对象(OOP) 程序时,很多开发者为每个类新建一个 PHP 文件. 这会带来一个烦恼:每个脚本的开头,都需要包含(include)一个长长的列表(每个类都有个文件). 在 PHP 5 中,已 ...
- centos 无法ping内网 Destination Host Unreachable
centos 突然无法ping内网了. 本来是一直是好好的. 在这之前,当前服务器(centos 192.168.1.30)大量的在操作内网192.168.1.20服务器的数据库.. 会不会是流量大了 ...
- [Jobdu] 题目1408:吃豆机器人
题目描述: 淘宝公司内部有许多新鲜的小玩具,例如淘宝智能机器人.小时候,大家都玩过那个吃豆子的游戏吧,这机器人就是按照这个游戏设计的,它会朝着豆子的方向行走.不过机器人还存在一个bug,他只会朝南和朝 ...
- scikit-learn:在实际项目中用到过的知识点(总结)
零.全部项目通用的: http://blog.csdn.net/mmc2015/article/details/46851245(数据集格式和预測器) http://blog.csdn.net/mmc ...
- hdu 4217Data Structure?
树状数组+二分 就是找第几小的数,,找几次,再求和. . #include<cstdio> #include<cstring> #include<iostream> ...
- layui的点击table行选中复选框
$(document).on("click",".layui-table-body table.layui-table tbody tr",function() ...
- postgresql解决锁表
--查询是否锁表了select oid from pg_class where relname='可能锁表了的表'select pid from pg_locks where relation='上面 ...