osg::Camera 参数修改
#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 参数修改的更多相关文章
- 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( ...
- [Oracle] 参数修改小结
v$parameter Oracle参数的修改比较复杂,有些参数是可以在session级别修改,有些则必须在system级别修改,有些参数修改后马上生效(不需要重启),有些参数则必须重启才能生效,那么 ...
- js 获取url中的参数 修改url 参数 移除url参数
js 获取url中的参数 修改url 参数 移除url参数 var jsUrlHelper = { getUrlParam : function(url, ref) { var str = " ...
- 11.2.0.4rac service_name参数修改
环境介绍 )客户环境11. 两节点 rac,集群重启后,集群资源一切正常,应用cs架构,连接数据库报错,提示连接对象不存在 )分析报错原因,连接数据库方式:ip:Port/service_name方式 ...
- Mysql - 参数修改
概述 mysql的参数可以分为两类:a. 动态参数,数据库启动期间能被修改,而修改又分为两种(global级,session级).b. 静态参数,即数据库启动期间不能修改. 接下来利用参数wait_t ...
- Oracle参数修改是否需要重启等
Oracle参数修改小结Oracle中有些参数是可以在session级别修改,有些则必须在system级别修改,有些参数不需要重启就能马上生效,有些参数必须重启才能生效,那么如何知道这些信息呢?可以从 ...
- Javascript动态方法调用与参数修改的问题
Javascript中可以对所传参数在函数内进行修改,如下 ? 1 2 3 4 5 function func1(name) { name = 'lily'; alert(name); ...
- MySQL wait_timeout参数修改
MySQL wait_timeout参数修改问题,可能经常会有DBA遇到过,下面就试验一下并看看会有什么现象. wait_timeout分为global级及session级别,如未进行配置,默认值为2 ...
- docker环境下mysql参数修改
原文:docker环境下mysql参数修改 需要修改log_bin为on,看了好几个博客说都需要删掉容器重新生成,然而并非如此, 我们可以用docker cp 命令将docker的文件"下载 ...
随机推荐
- javascript数据判断是否有指定元素
jquery方法: $.inArray(dataKey, dataArray) == -1 javascript方法: indexOf() 功能:根据指定的数据,从左向右,查询在数组中出现的位置,如果 ...
- 【转】Lombok Pojo默认初始值问题
Lombok以注解形式来简化java代码,提高开发效率.比如我们常用的@Builder.@Data.@AllArgsConstructor.@NoArgsConstructor.@ToString等. ...
- java基础(2)---基本语法
一.程序注释 二.HelloWorld 三.关键字 四.常量 五.变量 六.标识符: 七.数据类型 数据类型间的转换: (1)自主转换:不需要明确指出所要转化的类型是什么,而是由java虚拟机自动转化 ...
- zookeeper学习(2)----zookeeper和kafka的关系
转载: Zookeeper 在 Kafka 中的作用 leader 选举 和 follower 信息同步 如上图所示,kafaka集群的 broker,和 Consumer 都需要连接 Zookeep ...
- .NET Core SignalR 和 .NET SignalR 区别
由于要转 .NET Core ,对于以前用到的一些进行迁移. 在迁移 SignalR 的时候发现 .NET Core 下的和 .NET 下的区别还是挺大的. 功能差异 自定重新连接 .NET 下的 S ...
- Java并发包--ConcurrentHashMap原理解析
ConcurrentHashMap实现原理及源码分析 ConcurrentHashMap是Java并发包中提供的一个线程安全且高效的HashMap实现(若对HashMap的实现原理还不甚了解,可参 ...
- TinyMCE 工具栏配置
plugins: { type: [String, Array], default: 'lists image media wordcount advlist bbcode code charmap ...
- java 数组对象的应用
public class Student 2 { 3 // 成员变量 4 private String name; 5 private int age; 6 7 // 构造方法 8 public St ...
- ueditor+flash粘贴word
实现方式: 1.前端引用代码 .粘贴word里面的图片路径是fill://D 这种格式 我理解这种是非浏览器安全的 许多浏览器也不支持 目前项目是用了一种变通的方式: 先把word上传到后台 .poi ...
- zabbix数据的时序-
gj的proxy服务器经过重启之后时序有变化. zabbix数据库中数据的存储是以哪方为准server端还是agent端, 触发事件跟恢复时间反了,本应该恢复的事件在数据库中查询event,得到的事件 ...