#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简单测试框架的更多相关文章

  1. struts2+hibernate+spring注解版框架搭建以及简单测试(方便脑补)

    为了之后学习的日子里加深对框架的理解和使用,这里将搭建步奏简单写一下,目的主要是方便以后自己回来脑补: 1:File--->New--->Other--->Maven--->M ...

  2. struts2+hibernate+spring配置版框架搭建以及简单测试(方便脑补)

    为了之后学习的日子里加深对框架的理解和使用,这里将搭建步奏简单写一下,目的主要是方便以后自己回来脑补: 1:File--->New--->Other--->Maven--->M ...

  3. hapi lab测试框架简单使用

    1. 依赖安装 yarn init yarn add lab code 2. 基本模式 const Lab = require('lab'); const Code = require('code') ...

  4. 【IDEA】单元测试:项目中引入JUnit测试框架+Mock简单了解

    一.Junit 使用和说明: 参考:单元测试第三弹--使用JUnit进行单元测试-HollisChuang's Blog http://www.hollischuang.com/archives/17 ...

  5. php简单测试slim框架的功能

    php简单测试slim框架的功能 监听主路径/ $app->get( '/', function () { $template = <<<EOT<!DOCTYPE htm ...

  6. OWASP出品:Xenotix XSS漏洞测试框架及简单使用

    OWASP Xenotix XSS Exploit Framework是一个高效的跨站脚本漏洞(XSS)检测和攻击测试框架.它通过特有的三大浏览器引擎(包括Trident, WebKit和Gecko) ...

  7. selenium测试框架篇,页面对象和元素对象的管理

    前期已经做好使用Jenkins做buildhttp://www.cnblogs.com/tobecrazy/p/4529399.html 做自动化框架,不可避免的就是对象库. 有一个好的对象库,可以让 ...

  8. Python几种常用的测试框架

    一.测试的常用规则 一个测试单元必须关注一个很小的功能函数,证明它是正确的: 每个测试单元必须是完全独立的,必须能单独运行.这样意味着每一个测试方法必须重新加载数据,执行完毕后做一些清理工作.通常通过 ...

  9. Android开源测试框架学习

    近期因工作需要,分析了一些Android的测试框架,在这也分享下整理完的资料. Android测试大致分三大块: 代码层测试 用户操作模拟,功能测试 安装部署及稳定性测试 代码层测试 对于一般java ...

随机推荐

  1. 【LeetCode】33. Search in Rotated Sorted Array (4 solutions)

    Search in Rotated Sorted Array Suppose a sorted array is rotated at some pivot unknown to you before ...

  2. Android成长之路-实现简单动画

    实现简单动画: 在drawable目录中放入图片, 并且创建xml文件 frame.xml 存入图片,如下: <pre class="html" name="cod ...

  3. angularjs requeirjs配置相关

    尝试了网上的yeoman generator 生成的脚手架项目不甚理想 npm install -g generator-angular-require yo angular-require 就不用那 ...

  4. MFC总结之CListCtrl用法及技巧(一)

    本文根据本人在项目中的应用,来谈谈CListCtrl的部分用法及技巧.当初学习时,查了很多资料,零零碎碎的作了些记录,现在主要是来做个总结,方便以后查阅.主要包括以下十三点内容:基本操作.获取选中行的 ...

  5. Guid.NewGuid().ToString()得几种格式显示

    1.Guid.NewGuid().ToString("N") 结果为:        38bddf48f43c48588e0d78761eaa1ce6 2.Guid.NewGuid ...

  6. mysql常见数据提示 mysql报错提示大全

    错误代码和消息 目录 B.1. 服务器错误代码和消息 B.2. 客户端错误代码和消息 本章列出了当你用任何主机语言调用MySQL时可能出现的错误.首先列出了服务器错误消息.其次列出了客户端程序消息. ...

  7. Memory leak patterns in JavaScript

    Handling circular references in JavaScript applications Plugging memory leaks in JavaScript is easy ...

  8. C#趣味程序---爱因斯坦的台阶问题

    问题:设有一阶梯,每步跨2阶.最后余1阶.每步跨3阶.最后余2阶:每步跨5阶.最后余4阶:每步跨6阶.最后余5阶:每步跨7阶.刚好到阶顶.问共同拥有多少阶梯? using System; namesp ...

  9. android对话框,checkBox,同一时候在同一个页面上保存数据

    package com.example.selectonlyonle; import android.app.Activity; import android.app.AlertDialog; imp ...

  10. quick-cocos2dx-2.2.4环境搭建

    1.Quick-Coco2d-x介绍 Quick-Coco2d-x是Cocos2d-x在Lua上的增强和扩展版本,廖宇雷廖大觉得官方Cocos2d-x的Lua版本不是太好用,于是便在官方Lua版本的基 ...