#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的更多相关文章

随机推荐

  1. 13. 请看TED 的演讲, 谈谈你对压力的看法,以及怎么和别人合作, 帮助别人,把压力转化为动力,在互相帮助的环境中成长。------------答题者:徐潇瑞

    看了ted的演讲,我觉得压力就像一根弹簧,有多大的压力,它就有多大的弹力:现实中只要你学会用一种永远不服输的顽强精神,去对待人生和社会中遇到的一切困难与挫折,宠辱不惊的看云卷云舒,悟潮起潮落.可是存在 ...

  2. Python函数式编程-map/reduce

    1.map map()传入的第一个参数是f,即函数对象本身. map()函数接收两个参数,一个是函数,一个是Interable,map将传入的函数依次作用到序列的每个元素,并把结果作为新的Iterat ...

  3. 请求类型 GET 和 POST 的区别

    一.GET 一个简单的 GET 请求: xmlhttp.open("GET","demo_get.asp",true); xmlhttp.send(); 在上面 ...

  4. git 在不同服务器主机上同步 git 仓库

    git 在不同服务器主机上同步 git 仓库 参考链接:https://opentechguides.com/how-to/article/git/177/git-sync-repos.html 1. ...

  5. Selenium常用API的使用java语言之18-浏览器cookie操作

    有时候我们需要验证浏览器中Cookie是否正确, 因为基于真实Cookie的测试是无法通过白盒测试和集成测试进行的.WebDriver提供了操作Cookie的相关方法可以读取. 添加和删除Cookie ...

  6. django.db.models.fields.related_descriptors.RelatedObjectDoesNotExist

    Enrollment has no customer.

  7. python 单引号与双引号的转义

    import simplejson a = """{"a":"\\""}""" b = & ...

  8. codeforces#572Div2 E---Count Pairs【数学】【同余】

    题目:http://codeforces.com/contest/1189/problem/E 题意:给定$n$个互不相同数,一个$k$和一个质数$p$.问这$n$个数中有多少对数$(a_i+a_j) ...

  9. 加入redis缓存的 优 缺 点以及解决方案

    redis(支持十万级的并发) 优点:         1.减轻数据库压力         2.增强系统的并发量         3.提高用户体验 缺点:         1.数据不一致(延迟更新) ...

  10. icpc 银川 H. Delivery Route SPFA优化

    Problem Description Pony is the boss of a courier company. The company needs to deliver packages to ...