1
0
Fork 0

Stash properties

This commit is contained in:
ThorstenB 2012-10-10 20:34:02 +02:00
parent 78b5dfb58b
commit 9bb9a78249
2 changed files with 11 additions and 6 deletions

View file

@ -74,6 +74,10 @@ void FGSoundManager::init()
_velocityEastFPS = fgGetNode("velocities/speed-east-fps", true); _velocityEastFPS = fgGetNode("velocities/speed-east-fps", true);
_velocityDownFPS = fgGetNode("velocities/speed-down-fps", true); _velocityDownFPS = fgGetNode("velocities/speed-down-fps", true);
_viewXoffset = _currentView->getNode("x-offset-m", true);
_viewYoffset = _currentView->getNode("y-offset-m", true);
_viewZoffset = _currentView->getNode("z-offset-m", true);
reinit(); reinit();
} }
@ -123,13 +127,13 @@ void FGSoundManager::update_device_list()
devices.clear(); devices.clear();
} }
bool FGSoundManager::stationary() const bool FGSoundManager::stationaryView() const
{ {
// this is an ugly hack to decide if the *viewer* is stationary, // this is an ugly hack to decide if the *viewer* is stationary,
// since we don't model the viewer velocity directly. // since we don't model the viewer velocity directly.
return (_currentView->getDoubleValue("x-offset-m") == 0.0) && return (_viewXoffset->getDoubleValue() == 0.0) &&
(_currentView->getDoubleValue("y-offset-m") == 0.0) && (_viewYoffset->getDoubleValue() == 0.0) &&
(_currentView->getDoubleValue("z-offset-m") == 0.0); (_viewZoffset->getDoubleValue() == 0.0);
} }
// Update sound manager and propagate property values, // Update sound manager and propagate property values,
@ -165,7 +169,7 @@ void FGSoundManager::update(double dt)
set_orientation( viewOrientation ); set_orientation( viewOrientation );
SGVec3d velocity(SGVec3d::zeros()); SGVec3d velocity(SGVec3d::zeros());
if (!stationary()) { if (!stationaryView()) {
velocity = SGVec3d(_velocityNorthFPS->getDoubleValue(), velocity = SGVec3d(_velocityNorthFPS->getDoubleValue(),
_velocityEastFPS->getDoubleValue(), _velocityEastFPS->getDoubleValue(),
_velocityDownFPS->getDoubleValue() ); _velocityDownFPS->getDoubleValue() );

View file

@ -46,13 +46,14 @@ public:
void update_device_list(); void update_device_list();
private: private:
bool stationary() const; bool stationaryView() const;
bool _is_initialized, _enabled; bool _is_initialized, _enabled;
SGPropertyNode_ptr _sound_working, _sound_enabled, _volume, _device_name; SGPropertyNode_ptr _sound_working, _sound_enabled, _volume, _device_name;
SGPropertyNode_ptr _currentView; SGPropertyNode_ptr _currentView;
SGPropertyNode_ptr _viewPosLon, _viewPosLat, _viewPosElev; SGPropertyNode_ptr _viewPosLon, _viewPosLat, _viewPosElev;
SGPropertyNode_ptr _velocityNorthFPS, _velocityEastFPS, _velocityDownFPS; SGPropertyNode_ptr _velocityNorthFPS, _velocityEastFPS, _velocityDownFPS;
SGPropertyNode_ptr _viewXoffset, _viewYoffset, _viewZoffset;
Listener* _listener; Listener* _listener;
}; };
#else #else