From: James Turner Date: Thu, 21 Jan 2016 02:02:46 +0000 (-0500) Subject: View-Mgr absolute position is gone. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=daf8c797055fa737df98c47bc2678bcf45416d1d;p=flightgear.git View-Mgr absolute position is gone. --- diff --git a/src/Viewer/viewer.cxx b/src/Viewer/viewer.cxx index 331f41b4b..0a710fac9 100644 --- a/src/Viewer/viewer.cxx +++ b/src/Viewer/viewer.cxx @@ -277,6 +277,10 @@ View::bind () _tiedProperties.Tie("raw-orientation", 2, this, &View::getRawOrientation_y); _tiedProperties.Tie("raw-orientation", 3, this, &View::getRawOrientation_z); + _tiedProperties.Tie("viewer-x-m", this, &View::getAbsolutePosition_x); + _tiedProperties.Tie("viewer-y-m", this, &View::getAbsolutePosition_y); + _tiedProperties.Tie("viewer-z-m", this, &View::getAbsolutePosition_z); + // following config properties are exposed on current-view but don't change, // so we can simply copy them here. _tiedProperties.getRoot()->setStringValue("name", _name); @@ -899,6 +903,21 @@ View::update (double dt) recalc(); } +double View::getAbsolutePosition_x() const +{ + return _absolute_view_pos.x(); +} + +double View::getAbsolutePosition_y() const +{ + return _absolute_view_pos.y(); +} + +double View::getAbsolutePosition_z() const +{ + return _absolute_view_pos.z(); +} + double View::getRawOrientation_w() const { return mViewOrientation.w(); diff --git a/src/Viewer/viewer.hxx b/src/Viewer/viewer.hxx index 30d339f65..e556e6411 100644 --- a/src/Viewer/viewer.hxx +++ b/src/Viewer/viewer.hxx @@ -253,6 +253,10 @@ private: void setPosition (const SGGeod& geod); void setTargetPosition (const SGGeod& geod); + double getAbsolutePosition_x() const; + double getAbsolutePosition_y() const; + double getAbsolutePosition_z() const; + double getRawOrientation_w() const; double getRawOrientation_x() const; double getRawOrientation_y() const; diff --git a/src/Viewer/viewmgr.cxx b/src/Viewer/viewmgr.cxx index 6c35fd554..90891d04b 100644 --- a/src/Viewer/viewmgr.cxx +++ b/src/Viewer/viewmgr.cxx @@ -44,7 +44,6 @@ FGViewMgr::FGViewMgr( void ) : inited(false), view_number(fgGetNode("/sim/current-view/view-number", true)), config_list(fgGetNode("/sim", true)->getChildren("view")), - abs_viewer_position(SGVec3d::zeros()), current(0) { } @@ -160,11 +159,6 @@ FGViewMgr::do_bind() &FGViewMgr::getNear_m, &FGViewMgr::setNear_m); fgSetArchivable("/sim/current-view/ground-level-nearplane-m"); - SGPropertyNode *n = fgGetNode("/sim/current-view", true); - _tiedProperties.Tie(n->getNode("viewer-x-m", true),SGRawValuePointer(&abs_viewer_position[0])); - _tiedProperties.Tie(n->getNode("viewer-y-m", true),SGRawValuePointer(&abs_viewer_position[1])); - _tiedProperties.Tie(n->getNode("viewer-z-m", true),SGRawValuePointer(&abs_viewer_position[2])); - _tiedProperties.Tie("viewer-lon-deg", this, &FGViewMgr::getViewLon_deg); _tiedProperties.Tie("viewer-lat-deg", this, &FGViewMgr::getViewLat_deg); _tiedProperties.Tie("viewer-elev-ft", this, &FGViewMgr::getViewElev_ft); @@ -212,12 +206,11 @@ FGViewMgr::update (double dt) // Update the current view do_axes(); currentView->update(dt); - abs_viewer_position = currentView->getViewPosition(); // update the camera now osg::ref_ptr cameraGroup = flightgear::CameraGroup::getDefault(); - cameraGroup->update(toOsg(abs_viewer_position), + cameraGroup->update(toOsg(currentView->getViewPosition()), toOsg(currentView->getViewOrientation())); cameraGroup->setCameraParameters(currentView->get_v_fov(), cameraGroup->getMasterAspectRatio());