FGATC::FGATC() :
_voiceOK(false),
+ _playing(false),
_sgr(NULL),
freqClear(true),
receiving(false),
// we may want to move this to its own class at some point
//
double visibility_meters = fgGetDouble("/environment/visibility-m");
-
globals->get_tile_mgr()->prep_ssg_nodes( visibility_meters );
+
// update tile manager for view...
SGVec3d viewPos = globals->get_current_view()->get_view_pos();
SGGeod geodViewPos = SGGeod::fromCart(viewPos);
// update the view angle as late as possible, but before sound calculations
globals->get_viewmgr()->update(real_delta_time_sec);
- ////////////////////////////////////////////////////////////////////
// Update the sound manager last so it can use the CPU while the GPU
// is processing the scenery (doubled the frame-rate for me) -EMH-
- ////////////////////////////////////////////////////////////////////
#ifdef ENABLE_AUDIO_SUPPORT
- static SGSoundMgr *smgr = globals->get_soundmgr();
- smgr->update_late(delta_time_sec);
+ globals->get_soundmgr()->update(delta_time_sec);
#endif
// END Tile Manager udpates
fgSetBool("sim/sceneryloaded",true);
#ifdef ENABLE_AUDIO_SUPPORT
if (fgGetBool("/sim/sound/enabled") == true) {
- smgr->set_volume(fgGetFloat("/sim/sound/volume"));
- smgr->activate();
+ float volume = fgGetFloat("/sim/sound/volume");
+ globals->get_soundmgr()->set_volume(volume);
+ globals->get_soundmgr()->activate();
}
else
- smgr->stop();
+ globals->get_soundmgr()->stop();
#endif
}
SGQuatd hlToBody = SGQuatd::fromYawPitchRollDeg(head, pitch, roll);
// The rotation offset, don't know why heading is negative here ...
- SGQuatd viewOffsetOr
+ mViewOffsetOr
= SGQuatd::fromYawPitchRollDeg(-_heading_offset_deg, _pitch_offset_deg,
_roll_offset_deg);
SGQuatd q(-0.5, -0.5, 0.5, 0.5);
_absolute_view_pos = position + (ec2body*q).backTransform(_offset_m);
- mViewOrientation = ec2body*viewOffsetOr*q;
+ mViewOrientation = ec2body*mViewOffsetOr*q;
}
void
SGQuatd geodEyeHlOr = SGQuatd::fromLonLat(_position);
// the rotation offset, don't know why heading is negative here ...
- SGQuatd eyeOffsetOr =
+ mViewOffsetOr =
SGQuatd::fromYawPitchRollDeg(-_heading_offset_deg + 180, _pitch_offset_deg,
_roll_offset_deg);
SGVec3d eyeOff(-_offset_m.z(), _offset_m.x(), -_offset_m.y());
SGQuatd ec2eye = geodEyeHlOr*geodEyeOr;
SGVec3d eyeCart = SGVec3d::fromGeod(_position);
- eyeCart += (ec2eye*eyeOffsetOr).backTransform(eyeOff);
+ eyeCart += (ec2eye*mViewOffsetOr).backTransform(eyeOff);
SGVec3d atCart = SGVec3d::fromGeod(_target);
const SGVec3d& get_view_pos() { if ( _dirty ) { recalc(); } return _absolute_view_pos; }
const SGVec3d& getViewPosition() { if ( _dirty ) { recalc(); } return _absolute_view_pos; }
const SGQuatd& getViewOrientation() { if ( _dirty ) { recalc(); } return mViewOrientation; }
+ const SGQuatd& getViewOrientationOffset() { if ( _dirty ) { recalc(); } return mViewOffsetOr; }
//////////////////////////////////////////////////////////////////////
// Part 4: View and frustrum data setters and getters
bool _dirty;
SGQuatd mViewOrientation;
+ SGQuatd mViewOffsetOr;
SGVec3d _absolute_view_pos;
SGGeod _position;
// update audio listener values
// set the viewer posotion in Cartesian coordinates in meters
smgr->set_position( abs_viewer_position );
- smgr->set_orientation(loop_view->getViewOrientation());
+ smgr->set_orientation(loop_view->getViewOrientation(),
+ loop_view->getViewOrientationOffset());
// get the model velocity for the in-cockpit view
SGVec3d velocity = SGVec3d(0,0,0);
_roll->getDoubleValue());
_fx->set_orientation( orient );
- _velocity = SGVec3d( -_speed_n->getDoubleValue(),
- _speed_e->getDoubleValue(),
- _speed_d->getDoubleValue());
+ SGQuatd q(-0.5, -0.5, 0.5, 0.5);
+ _velocity = q.backTransform( SGVec3d( _speed_n->getDoubleValue(),
+ _speed_e->getDoubleValue(),
+ _speed_d->getDoubleValue()) );
_fx->set_velocity( _velocity );
}