]> git.mxchange.org Git - flightgear.git/commitdiff
View-Mgr absolute position is gone.
authorJames Turner <zakalawe@mac.com>
Thu, 21 Jan 2016 02:02:46 +0000 (21:02 -0500)
committerJames Turner <zakalawe@mac.com>
Wed, 17 Feb 2016 21:25:39 +0000 (21:25 +0000)
src/Viewer/viewer.cxx
src/Viewer/viewer.hxx
src/Viewer/viewmgr.cxx

index 331f41b4bb87c4cbd3aa2d0139db0f0312a49f2a..0a710fac9b7227ef4825a87d54db2066e6949ac4 100644 (file)
@@ -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();
index 30d339f653dbf827574df365ccbd4d8341aeec87..e556e6411621abaeb2c4cbbe16db8dd5dc318f84 100644 (file)
@@ -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;
index 6c35fd554ba15b4a8d981d84cb2571217590c43b..90891d04b0209deab99f80fb8a1a345ce33ab21e 100644 (file)
@@ -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<double>(&abs_viewer_position[0]));
-  _tiedProperties.Tie(n->getNode("viewer-y-m", true),SGRawValuePointer<double>(&abs_viewer_position[1]));
-  _tiedProperties.Tie(n->getNode("viewer-z-m", true),SGRawValuePointer<double>(&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<flightgear::CameraGroup> 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());