- // save the eye positon...
- sgCopyVec3(eye_pos, _location->get_view_pos());
-
- // copy data from location class to local items...
- copyLocationData();
-
- // make sg vectors view up, right and forward vectors from LOCAL
- sgSetVec3( _view_up, LOCAL[2][0], LOCAL[2][1], LOCAL[2][2] );
- sgSetVec3( right, LOCAL[1][0], LOCAL[1][1], LOCAL[1][2] );
-
- // Note that when in "lookat" view the "world up" vector is always applied
- // to the viewer. World up is based on verticle at a given lon/lat (see
- // matrix "UP" above).
-
- // Orientation Offsets matrix
- MakeVIEW_OFFSET( VIEW_OFFSET,
- (_heading_offset_deg -_heading_deg) * SG_DEGREES_TO_RADIANS, _world_up,
- _pitch_offset_deg * SG_DEGREES_TO_RADIANS, right );
-
- // add in the Orientation Offsets here
- sgSetVec3( position_offset, _x_offset_m, _y_offset_m, _z_offset_m );
- sgXformVec3( position_offset, position_offset, UP);
-
- sgXformVec3( position_offset, position_offset, VIEW_OFFSET );
-
- // add the Position offsets from object to the eye position
- sgAddVec3( eye_pos, eye_pos, position_offset );
-
- // Make the VIEW matrix for a "LOOKAT".
- sgMakeLookAtMat4( VIEW, eye_pos, at_pos, _view_up );
-
-}
-
-// copy results from location class to viewer...
-// FIXME: some of these should be changed to reference directly to FGLocation...
-void
-FGViewer::copyLocationData()
-{
- // Get our friendly vectors from the eye location...
- sgCopyVec3(_zero_elev_view_pos, _location->get_zero_elev());
- sgCopyVec3(_relative_view_pos, _location->get_view_pos());
- sgdCopyVec3(_absolute_view_pos, _location->get_absolute_view_pos());
- sgCopyMat4(UP, _location->getCachedUpMatrix());
- sgCopyVec3(_world_up, _location->get_world_up());
- // these are the vectors that the sun and moon code like to get...
- sgCopyVec3(_surface_east, _location->get_surface_east());
- sgCopyVec3(_surface_south, _location->get_surface_south());
-
- // Update viewer's postion data for the eye location...
- _lon_deg = _location->getLongitude_deg();
- _lat_deg = _location->getLatitude_deg();
- _alt_ft = _location->getAltitudeASL_ft();
- _roll_deg = _location->getRoll_deg();
- _pitch_deg = _location->getPitch_deg();
- _heading_deg = _location->getHeading_deg();
-
- // Update viewer's postion data for the target (at object) location
- if (_type == FG_LOOKAT) {
- _target_lon_deg = _target_location->getLongitude_deg();
- _target_lat_deg = _target_location->getLatitude_deg();
- _target_alt_ft = _target_location->getAltitudeASL_ft();
- _target_roll_deg = _target_location->getRoll_deg();
- _target_pitch_deg = _target_location->getPitch_deg();
- _target_heading_deg = _target_location->getHeading_deg();