]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/viewer.cxx
Moved some of the low level scene graph construction code over to simgear.
[flightgear.git] / src / Main / viewer.cxx
index fd7b133125bd818c2b73f02c0a0caddee7d2056e..b32e93d2d5b8a76727be50745a47986571e44ec3 100644 (file)
 #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/model.hxx>
 
 #include "viewer.hxx"
 
@@ -186,15 +186,15 @@ void
 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;
   }
 }
 
@@ -477,20 +477,20 @@ FGViewer::getZeroElevViewPos ()
 }
 
 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...
@@ -655,17 +655,20 @@ FGViewer::recalcLookAt ()
   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()
 {