#ifdef _WIN32
#include <Windows.h>
#endif // _WIN32
#include<iostream> #include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgViewer/CompositeViewer> #include <osgDB/ReadFile> #include <osg/Geode>
#include <osg/Node>
#include <osg/Geometry>
#include <osg/GraphicsContext>
#include <osg/ShapeDrawable>
#include <osg/Material>
#include <osg/Image>
#include <osg/Texture2D>
#include <osg/TexEnv>
#include <osg/TexGen>
#include <osg/NodeVisitor>
#include <osg/MatrixTransform>
#include <osg/PositionAttitudeTransform>
#include <osg/AnimationPath>
#include <osg/Matrixd>
#include <osg/PagedLOD>
#include <osg/Camera> #include <osgGA/TrackballManipulator>
#include <osgGA/GUIEventHandler>
#include <osgGA/CameraManipulator>
#include <osgGA/StandardManipulator>
#include <osgGA/OrbitManipulator>
#include <osgGA/TrackballManipulator> #include <osgUtil/IntersectionVisitor>
#include <osgUtil/LineSegmentIntersector> osg::ref_ptr<osg::Group> createCameras(osg::ref_ptr<osg::Node> node1)
{ osg::ref_ptr<osg::Group> group1 = new osg::Group;
unsigned int width, height; osg::ref_ptr<osg::Camera> camera1 = new osg::Camera;
//osg::ref_ptr<osg::Node> node1 = osgDB::readNodeFile("D:\\参考手册\\BIM\\osg\\build20190628.osgb"); //camera1->setGraphicsContext(graphics1);
camera1->addChild(node1);
camera1->setViewport(, , , );
camera1->setClearColor(osg::Vec4(1.0, 1.0, 1.0, 0.0));
camera1->setName("camera1"); osg::ref_ptr<osg::Camera> cameraRight = new osg::Camera;
osg::Vec3d eyeRight, centerRight, upRight; //修改相机参数
eyeRight = osg::Vec3d(0.0, 0.0, 0.0);
centerRight = osg::Vec3d(0.0, 1.0, 0.0);
upRight = osg::Vec3d(0.0, 0.0, 0.0); cameraRight->addChild(node1);
cameraRight->setViewport(, , , );
cameraRight->setClearColor(osg::Vec4(1.0, 1.0, 1.0, 0.0));
cameraRight->setName("camera2"); //viewer->getCamera()->setViewMatrixAsLookAt(eye, center, up);
//cameraRight->setViewMatrixAsLookAt(eyeRight, centerRight, upRight);
cameraRight->setViewMatrix(osg::Matrix::rotate(osg::DegreesToRadians(-90.0),0.0,0.0,1.0)); //viewer1->addSlave(camera1.get());
group1->addChild(camera1.get());
group1->addChild(cameraRight.get()); return group1;
} int main()
{
osg::ref_ptr<osgViewer::Viewer> viewer1 = new osgViewer::Viewer;
osg::ref_ptr<osg::Group> group1 = new osg::Group;
//osg::ref_ptr<osg::Camera> camera1 = new osg::Camera; osg::ref_ptr<osg::Node> node1 = osgDB::readNodeFile("D:\\参考手册\\BIM\\osg\\build20190628.osgb");
//osg::ref_ptr<osg::Node> node2 = osgDB::readNodeFile("D:\\参考手册\\BIM\\osg\\build20190628.osgb"); //camera1->addChild(node1);
//camera1->setViewport(0, 0, 300, 220);
//camera1->setClearColor(osg::Vec4(0.0,0.0,0.0,0.0)); group1->addChild(node1.get());
//group1->addChild(camera1.get());
group1->addChild(createCameras(node1)); //createCameras1(node1, viewer1); viewer1->setSceneData(group1.get());
//createCamera(viewer1); viewer1->setUpViewInWindow(, , , , ); viewer1->run();
}

最新文章

  1. [nRF51822] 13、浅谈nRF51822和NRF24LE1/NRF24LU1/NRF24L01经典2.4G模块无线通信配置与流程
  2. 2016 CCPC 东北地区重现赛
  3. jquery easyui DataGrid 数据表格 属性
  4. c/s 与b/s构架
  5. 十六、Struts2文件上传与下载
  6. MSP430常见问题之IO端口类
  7. 【Uvalive 5834】 Genghis Khan the Conqueror (生成树,最优替代边)
  8. objective-c基础教程
  9. UVa340 Master-Mind Hints
  10. ZOJ 3935 2016
  11. ASP.NET MVC最新特性
  12. C-sizeof和strlen区别,以及sizeof如何计算结构体大小
  13. zw版足彩大数据&报价
  14. 【算法】LeetCode算法题-Remove Duplicates from Sorted Array
  15. (1)Python基础
  16. python3+scrapy 趣头条爬虫实例
  17. 【洛谷p2312】解方程
  18. Alpha课堂展示(麻瓜制造者)
  19. [python]接口签名
  20. 【CF700E】Cool Slogans 后缀自动机+线段树合并

热门文章

  1. DataTable通过Select进行过滤
  2. vb开发最全教程
  3. 学习了武沛齐讲的Day10-完
  4. java+下载+大文件断点续传
  5. dp * 3
  6. Centos 如何扩充/增加磁盘
  7. vue的学习--如何使用Intellij IDEA配置并运行vue项目
  8. ROS中make_plan服务的使用
  9. 快速打造自己的PHPStorm主题
  10. 如何设置xshell代理?