#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>
// update the cur_time_params structure with the current sun position
void fgUpdateSunPos( void ) {
fgLIGHT *l;
- FGViewerRPH *v;
+ FGViewer *v;
sgVec3 nup, nsun;
Point3D p, rel_sunpos;
double dot, east_dot;
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 Sun position" );
SG_LOG( SG_EVENT, SG_INFO, " Gst = " << t->getGst() );
Point3D vp( v->get_view_pos()[0],
v->get_view_pos()[1],
v->get_view_pos()[2] );
- rel_sunpos = l->fg_sunpos - ( vp + scenery.center );
+ rel_sunpos = l->fg_sunpos - ( vp + globals->get_scenery()->get_center() );
sgSetVec3( to_sun, rel_sunpos.x(), rel_sunpos.y(), rel_sunpos.z() );
// printf( "Vector to sun = %.2f %.2f %.2f\n",
// v->to_sun[0], v->to_sun[1], v->to_sun[2]);