]> git.mxchange.org Git - flightgear.git/blobdiff - src/Time/moonpos.cxx
Add support for moving cloud layers
[flightgear.git] / src / Time / moonpos.cxx
index 8cac8cafdffb35566cab2ec8cd3809a67e9627c2..4c88c6c91b70f6d157cdca31383abe8710561918 100644 (file)
 #include <simgear/math/polar3d.hxx>
 #include <simgear/math/sg_geodesy.hxx>
 #include <simgear/math/vector.hxx>
+#include <simgear/timing/sg_time.hxx>
 
 #include <Main/globals.hxx>
+#include <Main/viewer.hxx>
 #include <Scenery/scenery.hxx>
 #include <Time/light.hxx>
 
@@ -335,7 +337,7 @@ static void fgMoonPositionGST(double gst, double *lon, double *lat) {
 // update the cur_time_params structure with the current moon position
 void fgUpdateMoonPos( void ) {
     fgLIGHT *l;
-    FGViewerRPH *v;
+    FGViewer *v;
     sgVec3 nup, nmoon;
     Point3D p, rel_moonpos;
     double dot, east_dot;
@@ -350,7 +352,7 @@ void fgUpdateMoonPos( void ) {
 
     l = &cur_light_params;
     SGTime *t = globals->get_time_params();
-    v = (FGViewerRPH *)globals->get_current_view();
+    v = globals->get_current_view();
 
     SG_LOG( SG_EVENT, SG_INFO, "  Updating Moon position" );
 
@@ -398,7 +400,7 @@ void fgUpdateMoonPos( void ) {
     Point3D vp( v->get_view_pos()[0],
                v->get_view_pos()[1],
                v->get_view_pos()[2] );
-    rel_moonpos = l->fg_moonpos - ( vp + scenery.center );
+    rel_moonpos = l->fg_moonpos - ( vp + globals->get_scenery()->get_center() );
     sgSetVec3( to_moon, rel_moonpos.x(), rel_moonpos.y(), rel_moonpos.z() );
     // printf( "Vector to moon = %.2f %.2f %.2f\n",
     //         to_moon[0], to_moon[1], to_moon[2]);