From df0f0a531fcc9a2dd157c40f4953700bbfca1268 Mon Sep 17 00:00:00 2001 From: mfranz Date: Fri, 19 Dec 2008 13:37:54 +0000 Subject: [PATCH] export absolute viewer coordinates --- src/Main/viewmgr.cxx | 7 +++++++ src/Main/viewmgr.hxx | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/src/Main/viewmgr.cxx b/src/Main/viewmgr.cxx index 806d9451a..75785e1c3 100644 --- a/src/Main/viewmgr.cxx +++ b/src/Main/viewmgr.cxx @@ -212,6 +212,9 @@ FGViewMgr::bind () &FGViewMgr::getNear_m, &FGViewMgr::setNear_m); fgSetArchivable("/sim/current-view/ground-level-nearplane-m"); + fgTie("/sim/current-view/viewer-x-m", this, &FGViewMgr::getViewerPositionX_m); + fgTie("/sim/current-view/viewer-y-m", this, &FGViewMgr::getViewerPositionY_m); + fgTie("/sim/current-view/viewer-z-m", this, &FGViewMgr::getViewerPositionZ_m); } void @@ -229,6 +232,9 @@ FGViewMgr::unbind () fgUntie("/sim/current-view/axes/long"); fgUntie("/sim/current-view/axes/lat"); fgUntie("/sim/current-view/ground-level-nearplane-m"); + fgUntie("/sim/current-view/viewer-x-m"); + fgUntie("/sim/current-view/viewer-y-m"); + fgUntie("/sim/current-view/viewer-z-m"); } void @@ -287,6 +293,7 @@ FGViewMgr::update (double dt) // Update the current view do_axes(); view->update(dt); + abs_viewer_position = loop_view->getViewPosition(); } void diff --git a/src/Main/viewmgr.hxx b/src/Main/viewmgr.hxx index f59371568..f3b85136d 100644 --- a/src/Main/viewmgr.hxx +++ b/src/Main/viewmgr.hxx @@ -147,11 +147,15 @@ private: void setViewAxisLat (double axis); int getView () const; void setView (int newview); + double getViewerPositionX_m () const { return abs_viewer_position[0]; } + double getViewerPositionY_m () const { return abs_viewer_position[1]; } + double getViewerPositionZ_m () const { return abs_viewer_position[2]; } SGPropertyNode_ptr view_number; vector config_list; typedef vector > viewer_list; viewer_list views; + SGVec3d abs_viewer_position; int current;