#include <simgear/math/point3d.hxx>
#include <simgear/math/polar3d.hxx>
#include <simgear/math/sg_geodesy.hxx>
-
-#include <Scenery/scenery.hxx>
-
+#include <simgear/scene/model/location.hxx>
+#include <simgear/scene/model/placement.hxx>
#include <simgear/math/vector.hxx>
+
#include <Main/globals.hxx>
+#include <Scenery/scenery.hxx>
#include <Model/acmodel.hxx>
-#include <Model/placement.hxx>
#include "viewer.hxx"
FGViewer::init ()
{
if ( _from_model )
- _location = (FGLocation *) globals->get_aircraft_model()->get3DModel()->getFGLocation();
+ _location = (SGLocation *) globals->get_aircraft_model()->get3DModel()->getSGLocation();
else
- _location = (FGLocation *) new FGLocation;
+ _location = (SGLocation *) new SGLocation;
if ( _type == FG_LOOKAT ) {
if ( _at_model )
- _target_location = (FGLocation *) globals->get_aircraft_model()->get3DModel()->getFGLocation();
+ _target_location = (SGLocation *) globals->get_aircraft_model()->get3DModel()->getSGLocation();
else
- _target_location = (FGLocation *) new FGLocation;
+ _target_location = (SGLocation *) new SGLocation;
}
}
}
void
-FGViewer::updateFromModelLocation (FGLocation * location)
+FGViewer::updateFromModelLocation (SGLocation * location)
{
sgCopyMat4(LOCAL, location->getCachedTransformMatrix());
}
void
-FGViewer::updateAtModelLocation (FGLocation * location)
+FGViewer::updateAtModelLocation (SGLocation * location)
{
sgCopyMat4(ATLOCAL,
location->getCachedTransformMatrix());
}
void
-FGViewer::recalcOurOwnLocation (FGLocation * location, double lon_deg, double lat_deg, double alt_ft,
+FGViewer::recalcOurOwnLocation (SGLocation * location, double lon_deg, double lat_deg, double alt_ft,
double roll_deg, double pitch_deg, double heading_deg)
{
// update from our own data...
sgAddVec3( eye_pos, eye_pos, position_offset );
// add target offsets to at_position...
- sgSetVec3(target_position_offset, _target_z_offset_m, _target_x_offset_m, _target_y_offset_m );
+ sgSetVec3(target_position_offset, _target_z_offset_m, _target_x_offset_m,
+ _target_y_offset_m );
sgXformVec3(target_position_offset, target_position_offset, ATLOCAL);
sgAddVec3( at_pos, at_pos, target_position_offset);
+ sgAddVec3( eye_pos, eye_pos, target_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...
+// FIXME: some of these should be changed to reference directly to SGLocation...
void
FGViewer::copyLocationData()
{