current_panel->setVisibility(true);
}
- // new rule .. "fov" shouldn't get messed with like this.
- /* if ( panel_status ) {
- fov *= 0.4232;
- } else {
- fov *= (1.0 / 0.4232);
- } */
-
fgReshape( xsize, ysize);
if( !freeze )
// Distances in meters of course.
sgVec3 pilot_offset;
- // vector in cartesian coordinates from current position to the
- // postion on the earth's surface the sun is directly over
- sgVec3 to_sun;
-
- // surface direction to go to head towards sun
- sgVec3 surface_to_sun;
-
- // vector in cartesian coordinates from current position to the
- // postion on the earth's surface the moon is directly over
- sgVec3 to_moon;
-
- // surface direction to go to head towards moon
- sgVec3 surface_to_moon;
-
// surface vector heading south
sgVec3 surface_south;
if ( dirty ) { update(); }
return UP;
}
-
- //////////////////////////////////////////////////////////////////////
- // need to fix these
- //////////////////////////////////////////////////////////////////////
- inline float *get_to_sun() { return to_sun; }
- inline void set_to_sun( float x, float y, float z ) {
- sgSetVec3( to_sun, x, y, z );
- }
- inline float *get_surface_to_sun() { return surface_to_sun; }
- inline void set_surface_to_sun( float x, float y, float z) {
- sgSetVec3( surface_to_sun, x, y, z );
- }
- inline float *get_to_moon() { return to_moon; }
- inline void set_to_moon( float x, float y, float z) {
- sgSetVec3( to_moon, x, y, z );
- }
- inline float *get_surface_to_moon() { return surface_to_moon; }
- inline void set_surface_to_moon( float x, float y, float z) {
- sgSetVec3( surface_to_moon, x, y, z );
- }
};
void fgUpdateMoonPos( void ) {
fgLIGHT *l;
FGViewerRPH *v;
- sgVec3 nup, nmoon, surface_to_moon;
+ sgVec3 nup, nmoon;
Point3D p, rel_moonpos;
double dot, east_dot;
double moon_gd_lat, sl_radius;
+ // vector in cartesian coordinates from current position to the
+ // postion on the earth's surface the moon is directly over
+ sgVec3 to_moon;
+
+ // surface direction to go to head towards moon
+ sgVec3 surface_to_moon;
+
l = &cur_light_params;
SGTime *t = globals->get_time_params();
v = (FGViewerRPH *)globals->get_current_view();
// 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()[1] );
+ v->get_view_pos()[2] );
rel_moonpos = l->fg_moonpos - ( vp + scenery.center );
- v->set_to_moon( rel_moonpos.x(), rel_moonpos.y(), rel_moonpos.z() );
+ sgSetVec3( to_moon, rel_moonpos.x(), rel_moonpos.y(), rel_moonpos.z() );
// printf( "Vector to moon = %.2f %.2f %.2f\n",
- // v->to_moon[0], v->to_moon[1], v->to_moon[2]);
+ // to_moon[0], to_moon[1], to_moon[2]);
// Given a vector from the view position to the point on the
// earth's surface the moon is directly over, map into onto the
// local plane representing "horizontal".
sgmap_vec_onto_cur_surface_plane( v->get_world_up(), v->get_view_pos(),
- v->get_to_moon(), surface_to_moon );
+ to_moon, surface_to_moon );
sgNormalizeVec3(surface_to_moon);
- v->set_surface_to_moon( surface_to_moon[0], surface_to_moon[1],
- surface_to_moon[2] );
// cout << "(sg) Surface direction to moon is "
// << surface_to_moon[0] << ","
// << surface_to_moon[1] << ","
void fgUpdateSunPos( void ) {
fgLIGHT *l;
FGViewerRPH *v;
- sgVec3 nup, nsun, surface_to_sun;
+ sgVec3 nup, nsun;
Point3D p, rel_sunpos;
double dot, east_dot;
double sun_gd_lat, sl_radius;
+ // vector in cartesian coordinates from current position to the
+ // postion on the earth's surface the sun is directly over
+ sgVec3 to_sun;
+
+ // surface direction to go to head towards sun
+ sgVec3 surface_to_sun;
+
l = &cur_light_params;
SGTime *t = globals->get_time_params();
v = (FGViewerRPH *)globals->get_current_view();
// calculate vector to sun's position on the earth's surface
Point3D vp( v->get_view_pos()[0],
v->get_view_pos()[1],
- v->get_view_pos()[1] );
+ v->get_view_pos()[2] );
rel_sunpos = l->fg_sunpos - ( vp + scenery.center );
- v->set_to_sun( rel_sunpos.x(), rel_sunpos.y(), rel_sunpos.z() );
+ 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]);
// local plane representing "horizontal".
sgmap_vec_onto_cur_surface_plane( v->get_world_up(), v->get_view_pos(),
- v->get_to_sun(), surface_to_sun );
+ to_sun, surface_to_sun );
sgNormalizeVec3(surface_to_sun);
- v->set_surface_to_sun( surface_to_sun[0], surface_to_sun[1],
- surface_to_sun[2] );
// cout << "(sg) Surface direction to sun is "
// << surface_to_sun[0] << ","
// << surface_to_sun[1] << ","
// cout << "Should be close to zero = "
// << sgScalarProductVec3(nup, surface_to_sun) << endl;
- // calculate the angle between v->surface_to_sun and
- // v->surface_east. We do this so we can sort out the acos()
- // ambiguity. I wish I could think of a more efficient way ... :-(
+ // calculate the angle between surface_to_sun and
+ // v->get_surface_east(). We do this so we can sort out the
+ // acos() ambiguity. I wish I could think of a more efficient
+ // way. :-(
east_dot = sgScalarProductVec3( surface_to_sun, v->get_surface_east() );
// cout << " East dot product = " << east_dot << endl;