1
0
Fork 0

Fix a problem with external views where the sky lighting was calculated

in reverse.
This commit is contained in:
curt 2001-02-02 23:15:03 +00:00
parent d1a50b5667
commit 8830f5c6a8
4 changed files with 10 additions and 0 deletions

View file

@ -68,6 +68,7 @@ protected:
// the current view offset angle from forward (rotated about the // the current view offset angle from forward (rotated about the
// view_up vector) // view_up vector)
double view_offset; double view_offset;
bool reverse_view_offset;
// the goal view offset angle (used for smooth view changes) // the goal view offset angle (used for smooth view changes)
double goal_view_offset; double goal_view_offset;
@ -142,6 +143,9 @@ public:
set_dirty(); set_dirty();
goal_view_offset = a; 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 ) { inline void set_geod_view_pos( double lon, double lat, double alt ) {
// data should be in radians and meters asl // data should be in radians and meters asl
set_dirty(); set_dirty();
@ -168,6 +172,7 @@ public:
inline double get_fov() const { return fov; } inline double get_fov() const { return fov; }
inline double get_win_ratio() const { return win_ratio; } inline double get_win_ratio() const { return win_ratio; }
inline double get_view_offset() const { return view_offset; } 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_goal_view_offset() const { return goal_view_offset; }
inline double *get_geod_view_pos() { return geod_view_pos; } inline double *get_geod_view_pos() { return geod_view_pos; }
inline float *get_pilot_offset() { return pilot_offset; } inline float *get_pilot_offset() { return pilot_offset; }

View file

@ -45,6 +45,7 @@
// Constructor // Constructor
FGViewerLookAt::FGViewerLookAt( void ) FGViewerLookAt::FGViewerLookAt( void )
{ {
set_reverse_view_offset(true);
} }

View file

@ -46,6 +46,7 @@
// Constructor // Constructor
FGViewerRPH::FGViewerRPH( void ) FGViewerRPH::FGViewerRPH( void )
{ {
set_reverse_view_offset(false);
#ifndef USE_FAST_VIEWROT #ifndef USE_FAST_VIEWROT
// This never changes -- NHV // This never changes -- NHV
LARC_TO_SSG[0][0] = 0.0; LARC_TO_SSG[0][0] = 0.0;

View file

@ -169,6 +169,9 @@ void fgLIGHT::UpdateAdjFog( void ) {
// direction to the sun // direction to the sun
rotation = -(sun_rotation + FG_PI) rotation = -(sun_rotation + FG_PI)
- (f->get_Psi() - globals->get_current_view()->get_view_offset()); - (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 ) { while ( rotation < 0 ) {
rotation += FG_2PI; rotation += FG_2PI;
} }