FGViewer *loop_view = (FGViewer *)get_view(current);
SGPropertyNode *n = config_list[current];
double lon_deg, lat_deg, alt_ft, roll_deg, pitch_deg, heading_deg;
- SGVec3f velocity = SGVec3f(0,0,0);
// Set up view location and orientation
} else {
// force recalc in viewer
loop_view->set_dirty();
-
- // get the model velocity for the in-cockpit view
- FGAircraftModel *aircraft = globals->get_aircraft_model();
- velocity = aircraft->getVelocity();
}
// if lookat (type 1) then get target data...
// update audio listener values
// set the viewer posotion in Cartesian coordinates in meters
- smgr->set_position(abs_viewer_position);
+ smgr->set_position(-abs_viewer_position);
smgr->set_orientation(loop_view->getViewOrientation());
+
+ // get the model velocity for the in-cockpit view
+ SGVec3f velocity = SGVec3f(0,0,0);
+ if ( !stationary() ) {
+ FGAircraftModel *aircraft = globals->get_aircraft_model();
+ velocity = aircraft->getVelocity();
+ }
smgr->set_velocity(velocity);
}
}
}
+bool
+FGViewMgr::stationary () const
+{
+ const FGViewer * view = get_current_view();
+ if (view != 0) {
+ if (((FGViewer *)view)->getXOffset_m() == 0.0 &&
+ ((FGViewer *)view)->getYOffset_m() == 0.0 &&
+ ((FGViewer *)view)->getZOffset_m() == 0.0)
+ return true;
+ }
+
+ return false;
+}
+
double
FGViewMgr::getViewTargetXOffset_m () const
{
void setViewAxisLat (double axis);
int getView () const;
void setView (int newview);
+ bool stationary () const;
SGPropertyNode_ptr view_number;
vector<SGPropertyNode_ptr> config_list;
_pitch(0),
_roll(0),
_heading(0),
- _speed(0),
- _speed_up(0)
+ _speed(0)
{
SGSoundMgr *smgr;
smgr = (SGSoundMgr *)globals->get_subsystem("soundmgr");
_pitch = fgGetNode("orientation/pitch-deg", true);
_roll = fgGetNode("orientation/roll-deg", true);
_heading = fgGetNode("orientation/heading-deg", true);
- _speed = fgGetNode("velocities/true-airspeed-kt", true);
- _speed_up = fgGetNode("velocities/vertical-speed-fps", true);
+ _speed = fgGetNode("velocities/groundspeed-kt", true);
}
void
// update model's audio sample values
// Get the Cartesian coordinates in meters
SGVec3d pos = SGVec3d::fromGeod(_aircraft->getPosition());
- _fx->set_position( pos );
+ _fx->set_position( -pos );
SGQuatd orient_m = SGQuatd::fromLonLat(_aircraft->getPosition());
orient_m *= SGQuatd::fromYawPitchRollDeg(_heading->getDoubleValue(),
_pitch->getDoubleValue(),
_roll->getDoubleValue());
SGVec3d orient = -orient_m.rotate(SGVec3d::e1());
- _fx->set_orientation( toVec3f(orient) );
+ _fx->set_orientation( toVec3f( orient ) );
// For now assume the aircraft speed is always along the longitudinal
// axis, so sideslipping is not taken into account. This should be fine
// for audio.
- _velocity = toVec3f(orient * _speed->getDoubleValue() * SG_KT_TO_FPS);
- // _velocity[2] = _speed_up->getFloatValue();
- _velocity *= SG_FEET_TO_METER;
+ _velocity = toVec3f(orient * _speed->getDoubleValue() * SG_KT_TO_MPS);
_fx->set_velocity( _velocity );
}
SGPropertyNode * _roll;
SGPropertyNode * _heading;
SGPropertyNode * _speed;
- SGPropertyNode * _speed_up;
};
_volume( fgGetNode("/sim/sound/volume") )
{
SGSampleGroup::_smgr = smgr;
+ SGSampleGroup::_refname = refname;
SGSampleGroup::_smgr->add(this, refname);
SGSampleGroup::_active = _smgr->is_working();
}