]> git.mxchange.org Git - flightgear.git/commitdiff
Use actual position of view for sound manager
authoronox <denkpadje@gmail.com>
Fri, 15 May 2015 07:29:23 +0000 (09:29 +0200)
committerErik Hofman <erik@ehofman.com>
Mon, 18 May 2015 09:52:19 +0000 (11:52 +0200)
Signed-off-by: Erik Hofman <erik@ehofman.com>
src/Sound/soundmanager.cxx
src/Sound/soundmanager.hxx

index 906ffd7983ac7bff876444d5b50adb5a9bedcfba..bb1b83418bf07e252fe9604148e82ffe92d90b5f 100644 (file)
@@ -71,9 +71,10 @@ void FGSoundManager::init()
     _device_name   = fgGetNode("/sim/sound/device-name");
 
     _currentView   = fgGetNode("sim/current-view");
-    _viewPosLon    = fgGetNode("sim/current-view/viewer-lon-deg");
-    _viewPosLat    = fgGetNode("sim/current-view/viewer-lat-deg");
-    _viewPosElev   = fgGetNode("sim/current-view/viewer-elev-ft");
+
+    _viewX = _currentView->getNode("viewer-x-m", true);
+    _viewY = _currentView->getNode("viewer-y-m", true);
+    _viewZ = _currentView->getNode("viewer-z-m", true);
   
     _velocityNorthFPS = fgGetNode("velocities/speed-north-fps", true);
     _velocityEastFPS  = fgGetNode("velocities/speed-east-fps", true);
@@ -172,12 +173,12 @@ void FGSoundManager::update(double dt)
         }
         if (enabled)
         {
-            SGGeod viewPosGeod(SGGeod::fromDegFt(_viewPosLon->getDoubleValue(),
-                                                 _viewPosLat->getDoubleValue(),
-                                                 _viewPosElev->getDoubleValue()));
-            SGVec3d cartPos = SGVec3d::fromGeod(viewPosGeod);
+            SGVec3d cartPos(_viewX->getDoubleValue(),
+                            _viewY->getDoubleValue(),
+                            _viewZ->getDoubleValue());
+            SGGeod geodPos = SGGeod::fromCart(cartPos);
 
-            set_position(cartPos, viewPosGeod);
+            set_position(cartPos, geodPos);
 
             SGQuatd viewOrientation;
             for (int i=0; i<4; ++i) {
index 7f5a164990a1936ff7ca5dc6b56c66a3bb2499e0..f76be4b80d46887a2e716e31ae12d0c6ea83bcb6 100644 (file)
@@ -55,7 +55,7 @@ private:
     bool _is_initialized, _enabled;
     SGPropertyNode_ptr _sound_working, _sound_enabled, _volume, _device_name;
     SGPropertyNode_ptr _currentView;
-    SGPropertyNode_ptr _viewPosLon, _viewPosLat, _viewPosElev;
+    SGPropertyNode_ptr _viewX, _viewY, _viewZ;
     SGPropertyNode_ptr _velocityNorthFPS, _velocityEastFPS, _velocityDownFPS;
     SGPropertyNode_ptr _viewXoffset, _viewYoffset, _viewZoffset;
     std::auto_ptr<Listener> _listener;