#include <simgear/math/vector.hxx>
#include <Main/globals.hxx>
+#include <Main/viewer.hxx>
#include <Scenery/scenery.hxx>
#include <Time/light.hxx>
/* lazy test to ensure gregorian calendar */
if (y < 1583) {
- FG_LOG( FG_EVENT, FG_ALERT,
+ SG_LOG( SG_EVENT, SG_ALERT,
"WHOOPS! Julian dates only valid for 1582 oct 15 or later" );
}
// 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;
l = &cur_light_params;
SGTime *t = globals->get_time_params();
- v = (FGViewerRPH *)globals->get_current_view();
+ v = globals->get_current_view();
- FG_LOG( FG_EVENT, FG_INFO, " Updating Moon position" );
+ SG_LOG( SG_EVENT, SG_INFO, " Updating Moon position" );
// (not sure why there was two)
// fgMoonPosition(t->cur_time, &l->moon_lon, &moon_gd_lat);
p = Point3D( l->moon_lon, l->moon_gc_lat, sl_radius );
l->fg_moonpos = sgPolarToCart3d(p);
- FG_LOG( FG_EVENT, FG_INFO, " t->cur_time = " << t->get_cur_time() );
- FG_LOG( FG_EVENT, FG_INFO,
+ SG_LOG( SG_EVENT, SG_INFO, " t->cur_time = " << t->get_cur_time() );
+ SG_LOG( SG_EVENT, SG_INFO,
" Moon Geodetic lat = " << moon_gd_lat
<< " Geocentric lat = " << l->moon_gc_lat );
// << nmoon[2] << endl;
l->moon_angle = acos( sgScalarProductVec3( nup, nmoon ) );
- FG_LOG( FG_EVENT, FG_INFO, "moon angle relative to current location = "
+ SG_LOG( SG_EVENT, SG_INFO, "moon angle relative to current location = "
<< l->moon_angle );
// calculate vector to moon's position on the earth's surface
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 + 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]);
l->moon_rotation = -acos(dot);
}
// cout << " Sky needs to rotate = " << angle << " rads = "
- // << angle * RAD_TO_DEG << " degrees." << endl;
+ // << angle * SGD_RADIANS_TO_DEGREES << " degrees." << endl;
}