VCTravel
#pragma once
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgViewer/CompositeViewer>
#include <osgDB/ReadFile>
#include <osg/Geode>
#include <osg/Node>
#include <osgGA/TrackballManipulator>
#include <osg/GraphicsContext>
#include <osg/ShapeDrawable>
#include <osg/Material>
#include <osg/Image>
#include <osg/Texture2D>
#include <osg/TexEnv>
#include <osg/TexGen>
#include <osg/MatrixTransform>
#include <osg/PositionAttitudeTransform>
#include <osg/AnimationPath>
#include <osg/Matrixd> #include <osgGA/GUIEventHandler>
#include <osgGA/CameraManipulator>
#include <osgGA/StandardManipulator>
#include <osgGA/OrbitManipulator>
#include <osgGA/TrackballManipulator> class VCTravel :
//public MatrixManipulator
public osgGA::CameraManipulator
{
public:
VCTravel();
~VCTravel(); //设置当前视口
virtual void setByMatrix(const osg::Matrixd& matrix);
//
virtual void setByInverseMatrix(const osg::Matrixd& matrix);
//获取
virtual osg::Matrixd getMatrix() const;
//得到矩阵逆
virtual osg::Matrixd getInverseMatrix() const; private:
//视点
osg::Vec3 vec_position;
//方向
osg::Vec3 vec_rotation; };
#include "VCTravel.h" VCTravel::VCTravel()
{
vec_position = osg::Vec3(0.0,0.0,0.0);
vec_rotation = osg::Vec3(0.0, 0.0, 0.0);
} VCTravel::~VCTravel()
{ } //设置当前视口
void VCTravel::setByMatrix(const osg::Matrixd& matrix)
{ }
//
void VCTravel::setByInverseMatrix(const osg::Matrixd& matrix)
{ }
//获取
osg::Matrixd VCTravel::getMatrix() const
{
osg::Matrixd mat;
mat.makeTranslate(vec_position);
return mat*osg::Matrixd::rotate(vec_rotation[], osg::X_AXIS, vec_rotation[], osg::Y_AXIS, vec_rotation[], osg::Z_AXIS);
}
//得到矩阵逆
osg::Matrixd VCTravel::getInverseMatrix() const
{
osg::Matrixd mat;
mat.makeTranslate(vec_position);
//return mat*osg::Matrixd::rotate(vec_rotation[0], osg::X_AXIS, vec_rotation[1], osg::Y_AXIS, vec_rotation[2], osg::Z_AXIS);
return osg::Matrixd::inverse(mat*osg::Matrixd::rotate(vec_rotation[], osg::X_AXIS, vec_rotation[], osg::Y_AXIS, vec_rotation[], osg::Z_AXIS));
}
VCTravel的更多相关文章
随机推荐
- Mybatis3.0_动态SQL元素:foreach-遍历集合_
foreach-遍历集合 -笔记要点 <!--foreach 遍历标签 collection : 指定要遍历的集合; list类型的参数会特殊处理封装在Map中,map的key就叫做list; ...
- MyBatis 3.0_[tp-24-25]_映射文件_参数处理_#与$取值区别_#{}更丰富的用法
笔记要点出错分析与总结 /**================Mybatis参数值的获取:#和$符号的区别=============== * #{}:可以获得map中的值或者pojo对象属性的值; * ...
- Bcompare 提示 “这个授权密钥已被吊销” 解决方法
Bcompare 提示 “这个授权密钥已被吊销” 解决方法 打开文件夹 %appdata%\Scooter Software 找到相应的版本,例如 Beyond Compare 3 删除里面的 BCS ...
- 301、404、200、304等HTTP状态
在网站建设的实际应用中,容易出现很多小小的失误,就像mysql当初优化不到位,影响整体网站的浏览效果一样,其实,网站的常规http状态码的表现也是一样,Google无法验证网站几种解决办法,提及到由于 ...
- js for/in循环及其它
for in 循环不仅可以遍历对象的属性,还可以遍历数组. Js 中为数组提供了多种遍历方式 const ary = ['a', 'b', 'c']; // 最基本的方式, 只能遍历下标有序递增的数组 ...
- CF480E Parking Lot(two-pointers + 单调队列优化)
题面 动态加障碍物,同时查询最大子正方形. n,m≤2000n,m\leq2000n,m≤2000 题解 加障碍不好做,直接离线后反着做,每次就是清除一个障碍物. 显然倒着做答案是递增的,而且答案的值 ...
- 使用JS动态操作css的集中方法
内联样式 在咱们深入一些复杂的知识之前,先回来顾一下一些基础知识.例如,咱们可以通过修改它的.style属性来编辑给定的HTMLElement的内联样式. const el = document.cr ...
- MongoDB 3.2变动一览
3.2测试版本总算release了!E叔带大家来一览MongoDB 3.2版本的真容. (PS:内容比较多,在此仅针对个人认为比较重要的进行讲解,markdown写的,貌似WP的markdown插件有 ...
- bzoj 2111: [ZJOI2010]Perm 排列计数 Lucas
题意:称一个1,2,...,N的排列P1,P2...,Pn是Magic的,当且仅当2<=i<=N时,Pi>Pi/2. 计算1,2,...N的排列中有多少是Magic的,答案可能很大, ...
- WallpaperEngine 导入 mp4 文件出现 failed opening video
WallpaperEngine 导入 mp4 文件出现 failed opening video 如图 下载这个插件 链接:点击打开链接 密码:dkf8