From: curt Date: Fri, 2 Feb 2001 23:15:03 +0000 (+0000) Subject: Fix a problem with external views where the sky lighting was calculated X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=8830f5c6a837bf150020498219c98ea5b15d6d7a;p=flightgear.git Fix a problem with external views where the sky lighting was calculated in reverse. --- diff --git a/src/Main/viewer.hxx b/src/Main/viewer.hxx index 0854934c5..8c9a93116 100644 --- a/src/Main/viewer.hxx +++ b/src/Main/viewer.hxx @@ -68,6 +68,7 @@ protected: // the current view offset angle from forward (rotated about the // view_up vector) double view_offset; + bool reverse_view_offset; // the goal view offset angle (used for smooth view changes) double goal_view_offset; @@ -142,6 +143,9 @@ public: set_dirty(); goal_view_offset = a; } + inline void set_reverse_view_offset( bool val ) { + reverse_view_offset = val; + } inline void set_geod_view_pos( double lon, double lat, double alt ) { // data should be in radians and meters asl set_dirty(); @@ -168,6 +172,7 @@ public: inline double get_fov() const { return fov; } inline double get_win_ratio() const { return win_ratio; } inline double get_view_offset() const { return view_offset; } + inline bool get_reverse_view_offset() const { return reverse_view_offset; } inline double get_goal_view_offset() const { return goal_view_offset; } inline double *get_geod_view_pos() { return geod_view_pos; } inline float *get_pilot_offset() { return pilot_offset; } diff --git a/src/Main/viewer_lookat.cxx b/src/Main/viewer_lookat.cxx index fed2b3025..82c35cce8 100644 --- a/src/Main/viewer_lookat.cxx +++ b/src/Main/viewer_lookat.cxx @@ -45,6 +45,7 @@ // Constructor FGViewerLookAt::FGViewerLookAt( void ) { + set_reverse_view_offset(true); } diff --git a/src/Main/viewer_rph.cxx b/src/Main/viewer_rph.cxx index a1be07d04..53128e7ff 100644 --- a/src/Main/viewer_rph.cxx +++ b/src/Main/viewer_rph.cxx @@ -46,6 +46,7 @@ // Constructor FGViewerRPH::FGViewerRPH( void ) { + set_reverse_view_offset(false); #ifndef USE_FAST_VIEWROT // This never changes -- NHV LARC_TO_SSG[0][0] = 0.0; diff --git a/src/Time/light.cxx b/src/Time/light.cxx index 4854125ce..beedc1eed 100644 --- a/src/Time/light.cxx +++ b/src/Time/light.cxx @@ -169,6 +169,9 @@ void fgLIGHT::UpdateAdjFog( void ) { // direction to the sun rotation = -(sun_rotation + FG_PI) - (f->get_Psi() - globals->get_current_view()->get_view_offset()); + if ( globals->get_current_view()->get_reverse_view_offset() ) { + rotation += FG_PI; + } while ( rotation < 0 ) { rotation += FG_2PI; }