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