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

最新文章

  1. spring-boot-framework 如何自动将对象返回成json格式
  2. C# RSA 分段加解密
  3. About_AJAX_02
  4. Linux:永久修改网卡的MAC地址
  5. Entity Framework: Joining in memory data with DbSet
  6. Android ListView OnItemLongClick和OnItemClick事件内部细节分享以及几个比较特别的属性
  7. Apache Commons Codec 编码解码
  8. DW(六):polybase访问Azure Blob Storage
  9. HDU 1498 50 years, 50 colors (行列匹配+最小顶点覆盖)
  10. Kinetic使用注意点--animation
  11. HW2.17
  12. C# .NET开发Oracle数据库应用程序
  13. SolrCloud 5.2.1 installation and configuration
  14. Developing your first FNC custom control
  15. zonghe
  16. Code First约定-Fluent API配置
  17. Comparing the contribution of NBA draft picks(转)
  18. 线程(java课堂笔记)
  19. 对java泛型的理解
  20. 命名空间的using声明

热门文章

  1. evpp http编程
  2. 算法:用户喜好--Map与List配合下的查找
  3. 02_View
  4. struts--CRUD优化(图片上传)
  5. Greenplum table 之 appendonly表
  6. public abstract啥时候可以省略?
  7. 关于java中的值传递和引用传递(也就是地址传递)
  8. /etc/inittab
  9. loj #2319
  10. 搭建自己的博客(八):使用fontawesome框架来添加图标以及美化详情页