#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();
}

osg::Camera 参数修改的更多相关文章

  1. NGUI创建Camera参数为Simple 2D的UI UI对象的结构UI Root(2D)

    NGUI创建Camera参数为Simple 2D的UI UI对象的结构UI Root(2D) 使用NGUI创建的Camera参数为Simple 2D的UI,会在游戏的场景中生成1个名为UI Root( ...

  2. [Oracle] 参数修改小结

    v$parameter Oracle参数的修改比较复杂,有些参数是可以在session级别修改,有些则必须在system级别修改,有些参数修改后马上生效(不需要重启),有些参数则必须重启才能生效,那么 ...

  3. js 获取url中的参数 修改url 参数 移除url参数

    js 获取url中的参数 修改url 参数 移除url参数 var jsUrlHelper = { getUrlParam : function(url, ref) { var str = " ...

  4. 11.2.0.4rac service_name参数修改

    环境介绍 )客户环境11. 两节点 rac,集群重启后,集群资源一切正常,应用cs架构,连接数据库报错,提示连接对象不存在 )分析报错原因,连接数据库方式:ip:Port/service_name方式 ...

  5. Mysql - 参数修改

    概述 mysql的参数可以分为两类:a. 动态参数,数据库启动期间能被修改,而修改又分为两种(global级,session级).b. 静态参数,即数据库启动期间不能修改. 接下来利用参数wait_t ...

  6. Oracle参数修改是否需要重启等

    Oracle参数修改小结Oracle中有些参数是可以在session级别修改,有些则必须在system级别修改,有些参数不需要重启就能马上生效,有些参数必须重启才能生效,那么如何知道这些信息呢?可以从 ...

  7. Javascript动态方法调用与参数修改的问题

    Javascript中可以对所传参数在函数内进行修改,如下 ? 1 2 3 4 5 function func1(name) {     name = 'lily';     alert(name); ...

  8. MySQL wait_timeout参数修改

    MySQL wait_timeout参数修改问题,可能经常会有DBA遇到过,下面就试验一下并看看会有什么现象. wait_timeout分为global级及session级别,如未进行配置,默认值为2 ...

  9. docker环境下mysql参数修改

    原文:docker环境下mysql参数修改 需要修改log_bin为on,看了好几个博客说都需要删掉容器重新生成,然而并非如此, 我们可以用docker cp 命令将docker的文件"下载 ...

随机推荐

  1. Linux 本机/异机文件对比

    一:提取异步机器文件 #ssh 192.168.1.2 "cat /etc/glance/glance-api.conf | grep -v '#' |grep -v ^$" 二: ...

  2. python----print线程安全问题

    在Python2中print是非线程安全的,Python3中是安全的 https://www.jianshu.com/p/acdaf2ffd81b

  3. MySQL之三张表关联

    创建三张表 1.学生表 mysql> create table students( sid int primary key auto_increment, sname ) not null, a ...

  4. mysql - 所有笔记

    # 编码: 1. 查看创建数据库时设置的编码格式: shwo create database 数据库名; 2. 查看创建表时所设置的 编码格式 和 字段详细 show create table 表名; ...

  5. Linux 介绍与安装

  6. mongoose 5.0 链接数据库 代码保存

    const mongoose = require('mongoose'); const dbSrc = 'mongodb://localhost/douban-trailer' mongoose.Pr ...

  7. python 操作excle 之第三方库 openpyxl学习

    目录 python 操作excle 之第三方库 openpyxl学习 安装 pip install openpyxl 英文文档链接 : 点击这里~ 1,定位excel 2,读取excle中的内容 3, ...

  8. Vue.js最佳实践(五招助你成为vuejs大师)

    转自https://www.jb51.net/article/139448.htm 本文面向对象是有一定Vue.js编程经验的开发者.如果有人需要Vue.js入门系列的文章可以在评论区告诉我,有空就给 ...

  9. Spring事务采坑 —— timeout

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/qq_18860653/article/d ...

  10. 三十.数据库服务概述 构建MySQL服务器 、 数据库基本管理 MySQL数据类型

    mysql50:192.168.4.50 1.构建MySQL服务器 安装MySQL-server.MySQl-client软件包 修改数据库用户root的密码 确认MySQL服务程序运行.root可控 ...