From d1982a9a8c0bbc26d47a9be74b2298c26f13a116 Mon Sep 17 00:00:00 2001 From: ehofman Date: Thu, 17 Apr 2003 15:42:18 +0000 Subject: [PATCH] Reposition the sky modules only when the lat or long position is changed for 5 micro degree. This doesn't sound much, but at least it means the modules aren't repositioned every frame --- src/Main/main.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Main/main.cxx b/src/Main/main.cxx index 583b34268..e7fc713e8 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -507,7 +507,7 @@ void fgRenderFrame() { // update view port fgReshape( fgGetInt("/sim/startup/xsize"), - fgGetInt("/sim/startup/ysize") ); + fgGetInt("/sim/startup/ysize") ); if ( fgGetBool("/sim/rendering/clouds3d") ) { glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT ); @@ -637,7 +637,14 @@ void fgRenderFrame() { << " moon dec = " << globals->get_ephem()->getMoonDeclination() ); */ - thesky->reposition( current__view->get_view_pos(), + if ((fabs(long_curr - current__view->getLongitude_deg()) > 5e-4) + || (fabs(lat_curr - current__view->getLatitude_deg()) > 5e-4) + || (init != 0)) + { + lat_curr = current__view->getLatitude_deg(); + long_curr = current__view->getLongitude_deg(); + + thesky->reposition( current__view->get_view_pos(), current__view->get_zero_elev(), current__view->get_world_up(), current__view->getLongitude_deg() @@ -654,6 +661,7 @@ void fgRenderFrame() { globals->get_ephem()->getMoonRightAscension(), globals->get_ephem()->getMoonDeclination(), 50000.0 ); + } } glEnable( GL_DEPTH_TEST ); @@ -684,7 +692,7 @@ void fgRenderFrame() { // glMatrixMode( GL_PROJECTION ); // glLoadIdentity(); ssgSetFOV( current__view->get_h_fov(), - current__view->get_v_fov() ); + current__view->get_v_fov() ); double agl = current_aircraft.fdm_state->get_Altitude() * SG_FEET_TO_METER -- 2.39.5