oe中的视角加速感觉好奇怪,就仿照谷歌方式去改了。

先看看oe原来的漫游器改变视角的接口:

void
CameraManipulator::setViewpoint(const Viewpoint& vp, double duration_seconds)
{// If the manip is not set up, save the viewpoint for later.if ( !established() ){_pendingViewpoint = vp;_pendingViewpointDuration.set(duration_seconds, Units::SECONDS);}else{// Save any existing tether node so we can properly invoke the callback.osg::ref_ptr<osg::Node> oldEndNode;if ( isTethering() && _tetherCallback.valid() )_setVP1->getNode(oldEndNode);// starting viewpoint; all fields will be set:_setVP0 = getViewpoint();// ending viewpoint_setVP1 = vp;// Reset the tethering offset quat._tetherRotationVP0 = _tetherRotation;_tetherRotationVP1 = osg::Quat();// Fill in any missing end-point data with defaults matching the current camera setup.// Then all fields are guaranteed to contain usable data during transition.double defPitch, defAzim;getEulerAngles( _rotation, &defAzim, &defPitch );if ( !_setVP1->heading().isSet() )_setVP1->heading() = Angle(defAzim, Units::RADIANS);if ( !_setVP1->pitch().isSet() )_setVP1->pitch() = Angle(defPitch, Units::RADIANS);if ( !_setVP1->range().isSet() )_setVP1->range() = Distance(_distance, Units::METERS);if ( !_setVP1->nodeIsSet() && !_setVP1->focalPoint().isSet() ){osg::ref_ptr<osg::Node> safeNode;if ( _setVP0->getNode( safeNode ) )_setVP1->setNode( safeNode.get() );else_setVP1->focalPoint() = _setVP0->focalPoint().get();}_setVPDuration.set( std::max(duration_seconds, 0.0), Units::SECONDS );OE_DEBUG << LC << "setViewpoint:\n"<< "    from " << _setVP0->toString() << "\n"<< "    to   " << _setVP1->toString() << "\n";// access the new tether node if it exists:osg::ref_ptr<osg::Node> endNode;_setVP1->getNode(endNode);// Timed transition, we need to calculate some things:if ( duration_seconds > 0.0 ){// Start point is the current manipulator center:
            osg::Vec3d startWorld;osg::ref_ptr<osg::Node> startNode;startWorld = _setVP0->getNode(startNode) ? computeWorld(startNode.get()) : _center;_setVPStartTime.unset();// End point is the world coordinates of the target viewpoint:
            osg::Vec3d endWorld;if ( endNode.valid() )endWorld = computeWorld(endNode.get());else_setVP1->focalPoint()->transform( _srs.get() ).toWorld(endWorld);// calculate an acceleration factor based on the Z differential._setVPArcHeight = 0.0;double range0 = _setVP0->range()->as(Units::METERS);double range1 = _setVP1->range()->as(Units::METERS);double pitch0 = _setVP0->pitch()->as(Units::RADIANS);double pitch1 = _setVP1->pitch()->as(Units::RADIANS);double h0 = range0 * sin( -pitch0 );double h1 = range1 * sin( -pitch1 );double dh = (h1 - h0);// calculate the total distance the focal point will travel and derive an arc height:double de = (endWorld - startWorld).length();// maximum height during viewpoint transitionif ( _settings->getArcViewpointTransitions() ){_setVPArcHeight = osg::maximum( de - fabs(dh), 0.0 );}// calculate acceleration coefficientsif ( _setVPArcHeight > 0.0 ){// if we're arcing, we need seperate coefficients for the up and down stagesdouble h_apex = 2.0*(h0+h1) + _setVPArcHeight;double dh2_up = fabs(h_apex - h0)/100000.0;_setVPAccel = log10( dh2_up );double dh2_down = fabs(h_apex - h1)/100000.0;_setVPAccel2 = -log10( dh2_down );}else{// on arc => simple unidirectional acceleration:double dh2 = (h1 - h0)/100000.0;_setVPAccel = fabs(dh2) <= 1.0? 0.0 : dh2 > 0.0? log10( dh2 ) : -log10( -dh2 );if ( fabs( _setVPAccel ) < 1.0 ) _setVPAccel = 0.0;}// Adjust the duration if necessary.if ( _settings->getAutoViewpointDurationEnabled() ){double maxDistance = _srs->getEllipsoid()->getRadiusEquator();double ratio = osg::clampBetween( de/maxDistance, 0.0, 1.0 );ratio = accelerationInterp( ratio, -4.5 );double minDur, maxDur;_settings->getAutoViewpointDurationLimits( minDur, maxDur );_setVPDuration.set( minDur + ratio*(maxDur-minDur), Units::SECONDS );}}else{// Immediate transition? Just do it now._setVPStartTime->set( _time_s_now, Units::SECONDS );setViewpointFrame( _time_s_now );}// Fire a tether callback if required.if ( _tetherCallback.valid() ){// starting a tether to a NEW node:if ( isTethering() && oldEndNode.get() != endNode.get() )(*_tetherCallback)( endNode.get() );// breaking a tether:else if ( !isTethering() && oldEndNode.valid() )(*_tetherCallback)( 0L );}}// reset other global state flags._thrown      = false;_task->_type = TASK_NONE;
}

这里有几个重点参数:

osgEarth::optional<osgEarth::Viewpoint>  _setVP0和_setVP1 :开始视点,结束视点

double                  _setVPAccel, _setVPAccel2; 开始点去最高点加速度,最高点去结束点加速度

修改方案:https://www.cnblogs.com/lyggqm/p/8534619.html

[osgearth][原]仿照谷歌,修改oe漫游器中focal(视角切换)功能相关推荐

  1. python修改电脑桌面壁纸_python实现桌面壁纸切换功能

    本文实例为大家分享了python实现桌面壁纸切换功能的具体实现方法,供大家参考,具体内容如下 大体分为两个部分 一.利用爬虫爬取壁纸 第一部分爬取图片url地址并且下载至本地 爬虫针对http://i ...

  2. python修改桌面壁纸_python实现桌面壁纸切换功能

    本文实例为大家分享了python实现桌面壁纸切换功能的具体实现方法,供大家参考,具体内容如下 大体分为两个部分 一.利用爬虫爬取壁纸 第一部分爬取图片url地址并且下载至本地 爬虫针对http://i ...

  3. 【转】osg中漫游器的原理

    在osg中,编写以下简单代码: 1 osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer(); 2 viewer-& ...

  4. osg中漫游器的原理(一)

    在osg中,编写以下简单代码 osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer(); viewer->se ...

  5. 在浏览器端调试代码并直接修改原文件、移动端虚拟键盘中实现搜索按钮

    在浏览器端调试代码并直接修改原文件: 此调试方法可以避免在浏览器调试完代码后在到原文件手动修改代码的弊端,其具体方法如下: 1.先将要调试的页面在浏览器(Google)打开,这里小编打开桌面test文 ...

  6. 谷歌推出新优化器Lion:优化算法的符号发现

    文章目录 谷歌推出新优化器Lion:优化算法的符号发现 Lion VS AdamW 论文实验 1.图像分类 2.视觉语言对比学习 3.扩散模型 4.语言建模和微调 5.与其他流行优化器的比较 超参数设 ...

  7. 每日 30 秒 ⏱ 漫游器法则

    简介 SEO.robot.txt.搜索引擎优化 在浩海的互联网世界中: 互联网 宛如 宇宙 站点 宛如 星系 网页 宛如 星球 网页内容 宛如 生灵万物 而在互联网世界漫游的搜索引擎爬虫小蜘蛛,就好比 ...

  8. osgEarth加载谷歌卫星地图的源码案例

    一.准备工作 安装水经注万能地图下载器,如果没有安装本软件,可以百度" 水经注软件 "到官方网站下载. 编译OSG.OSGEarth和第三方插件等,这里有一个已经编译好的vs201 ...

  9. osg漫游器的原理和执行流程

    关键词:manipulator; 漫游器; 第一人称漫游器; osg; osg漫游器的原理; osg漫游器的流程 从CameraManipulator讲起吧,CameraManipulator是漫游器 ...

最新文章

  1. 黑金花大理石_黑金花 , 经典就是经典 ! 美 !
  2. linux重命名命令
  3. Linux三剑客之awk详解
  4. 如何采用简化方法进行需求分析
  5. 自动化监控--zabbix中的用户和用户组详解
  6. 爬虫学习笔记(十一)—— Scrapy框架(六):媒体管道
  7. 卸载shockwave flash插件
  8. VS Code修改菜单栏字体大小
  9. postgresql主从备份_PostgreSQL主从流复制与手动主备切换架构
  10. 复制表、复制表结构、复制数据
  11. des java c_这个des加密,到底是用的哪种类型?
  12. 【逆序对相关/数学】【P1966】【NOIP2013D1T2】 火柴排队
  13. 机器学习-吴恩达-正规方程多变量回归公式
  14. 【渝粤教育】国家开放大学2019年春季 1349学前教育科研方法 参考试题
  15. java 名称可以包含-吗_java – 验证失败时包含参数名称的自定义...
  16. 冰冻三尺,非一日之寒。数据解析——xpath(3)
  17. 数据结构 - 线性表顺序存储结构
  18. 一台电脑控制多部手机怎么实现
  19. 根据音乐播放进度实时更新音乐播放器播放进度条
  20. 1-SII--SharedPreferences完美封装

热门文章

  1. python入门看什么书-请问初学者学Python看那本书?
  2. python菜鸟教程函数-Python 函数装饰器
  3. python使用字典格式化字符串-如何在python-3.x中使用字典格式化字符串?
  4. NVIDIA Jetson Xavier NX中安装的python库包的版本
  5. Ubuntu14.04安装中文输入法
  6. 为什么人们爱听有声书?
  7. 10个有毒的设计神器
  8. 九度OJ 1011:最大连续子序列 (DP)
  9. MS SQL backup database的俩个参数
  10. 随笔--2011.12.21