]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/main.cxx
Added a <solve-weight> subtag of the approach/cruise parameters that can
[flightgear.git] / src / Main / main.cxx
index beab15df0097ddf5a89b43213e21417324561318..502207bf2ee0646cb156fff0720c4891c9a005b8 100644 (file)
@@ -54,7 +54,6 @@
 #include <simgear/ephemeris/ephemeris.hxx>
 #include <simgear/scene/model/placement.hxx>
 #include <simgear/math/sg_random.h>
-#include <simgear/route/route.hxx>
 #include <simgear/scene/model/modellib.hxx>
 
 #ifdef FG_USE_CLOUDS_3D
@@ -64,7 +63,6 @@
 
 #include <Include/general.hxx>
 #include <Scenery/tileentry.hxx>
-#include <Time/FGEventMgr.hxx>
 #include <Time/light.hxx>
 #include <Time/light.hxx>
 #include <Aircraft/aircraft.hxx>
 #include <ATC/ATCdisplay.hxx>
 #include <ATC/ATCmgr.hxx>
 #include <ATC/AIMgr.hxx>
-#include <Autopilot/newauto.hxx>
 #include <Replay/replay.hxx>
 #include <Time/tmp.hxx>
 #include <Time/fg_timer.hxx>
 #include <Environment/environment_mgr.hxx>
 
-#ifdef FG_NETWORK_OLK
-#include <NetworkOLK/network.h>
-#endif
-
 #ifdef FG_MPLAYER_AS
 #include <MultiPlayer/multiplaytxmgr.hxx>
 #include <MultiPlayer/multiplayrxmgr.hxx>
@@ -118,6 +111,7 @@ sgVec3 rway_ols;
 float scene_nearplane = 0.5f;
 float scene_farplane = 120000.0f;
 
+static double real_delta_time_sec = 0.0;
 static double delta_time_sec = 0.0;
 
 glPointParameterfProc glPointParameterfPtr = 0;
@@ -133,8 +127,6 @@ bool glPointParameterIsSupported = false;
 #  include <console.h>         // -dw- for command line dialog
 #endif
 
-FGEventMgr global_events;
-
 // This is a record containing a bit of global housekeeping information
 FGGeneral general;
 
@@ -154,11 +146,6 @@ static GLfloat rwy_exp2_punch_through;
 static GLfloat taxi_exp2_punch_through;
 static GLfloat ground_exp2_punch_through;
 
-#ifdef FG_NETWORK_OLK
-ssgSelector *fgd_sel = NULL;
-ssgTransform *fgd_pos = NULL;
-#endif
-
 // Sky structures
 SGSky *thesky;
 
@@ -340,7 +327,7 @@ void trRenderFrame( void ) {
 
     // we need a white diffuse light for the phase of the moon
     ssgGetLight( 0 ) -> setColour( GL_DIFFUSE, white );
-    thesky->preDraw( cur_fdm_state->get_Altitude() * SG_FEET_TO_METER );
+    thesky->preDraw( cur_fdm_state->get_Altitude() * SG_FEET_TO_METER, fog_exp2_density );
 
     // draw the ssg scene
     // return to the desired diffuse color
@@ -352,6 +339,7 @@ void trRenderFrame( void ) {
     // draw the lights
     glFogf (GL_FOG_DENSITY, rwy_exp2_punch_through);
     ssgSetNearFar( scene_nearplane, scene_farplane );
+    ssgCullAndDraw( globals->get_scenery()->get_vasi_lights_root() );
     ssgCullAndDraw( globals->get_scenery()->get_rwy_lights_root() );
 
     ssgCullAndDraw( globals->get_scenery()->get_gnd_lights_root() );
@@ -374,9 +362,6 @@ void fgRenderFrame() {
     GLfloat black[4] = { 0.0, 0.0, 0.0, 1.0 };
     GLfloat white[4] = { 1.0, 1.0, 1.0, 1.0 };
 
-    // Process/manage pending events
-    global_events.update( delta_time_sec );
-
     // static const SGPropertyNode *longitude
     //     = fgGetNode("/position/longitude-deg");
     // static const SGPropertyNode *latitude
@@ -510,18 +495,18 @@ void fgRenderFrame() {
         if ( skyblend ) {
             /*
              SG_LOG( SG_GENERAL, SG_BULK, "thesky->repaint() sky_color = "
-             << cur_light_params.sky_color[0] << " "
-             << cur_light_params.sky_color[1] << " "
-             << cur_light_params.sky_color[2] << " "
-             << cur_light_params.sky_color[3] );
+             << l->sky_color()[0] << " "
+             << l->sky_color()[1] << " "
+             << l->sky_color()[2] << " "
+             << l->sky_color()[3] );
             SG_LOG( SG_GENERAL, SG_BULK, "    fog = "
-             << cur_light_params.fog_color[0] << " "
-             << cur_light_params.fog_color[1] << " "
-             << cur_light_params.fog_color[2] << " "
-             << cur_light_params.fog_color[3] ); 
+             << l->fog_color()[0] << " "
+             << l->fog_color()[1] << " "
+             << l->fog_color()[2] << " "
+             << l->fog_color()[3] ); 
             SG_LOG( SG_GENERAL, SG_BULK,
-                    "    sun_angle = " << cur_light_params.sun_angle
-             << "    moon_angle = " << cur_light_params.moon_angle );
+                    "    sun_angle = " << l->sun_angle
+             << "    moon_angle = " << l->moon_angle );
             */
 
             static SGSkyColor scolor;
@@ -549,7 +534,7 @@ void fgRenderFrame() {
              << " lon = " << cur_fdm_state->get_Longitude()
              << " lat = " << cur_fdm_state->get_Latitude() );
             SG_LOG( SG_GENERAL, SG_BULK,
-                    "    sun_rot = " << cur_light_params.sun_rotation
+                    "    sun_rot = " << l->get_sun_rotation
              << " gst = " << SGTime::cur_time_params->getGst() );
             SG_LOG( SG_GENERAL, SG_BULK,
                  "    sun ra = " << globals->get_ephem()->getSunRightAscension()
@@ -638,32 +623,6 @@ void fgRenderFrame() {
 
         ssgSetNearFar( scene_nearplane, scene_farplane );
 
-        // $$$ begin - added VS Renganthan 17 Oct 2K
-        if(objc)
-          fgUpdateDCS();
-        // $$$ end - added VS Renganthan 17 Oct 2K
-
-# ifdef FG_NETWORK_OLK
-        if ( fgGetBool("/sim/networking/network-olk") ) {
-            sgCoord fgdpos;
-            other = head->next;             /* put listpointer to start  */
-            while ( other != tail) {        /* display all except myself */
-            if ( strcmp( other->ipadr, fgd_mcp_ip) != 0) {
-                other->fgd_sel->select(1);
-                sgSetCoord( &fgdpos, other->sgFGD_COORD );
-                other->fgd_pos->setTransform( &fgdpos );
-            }
-            other = other->next;
-            }
-
-            // fgd_sel->select(1);
-            // sgCopyMat4( sgTUX, current_view.sgVIEW);
-            // sgCoord fgdpos;
-            // sgSetCoord( &fgdpos, sgFGD_VIEW );
-            // fgd_pos->setTransform( &fgdpos);
-        }
-# endif
-
 #ifdef FG_MPLAYER_AS
         // Update any multiplayer models
         globals->get_multiplayer_rx_mgr()->Update();
@@ -676,16 +635,10 @@ void fgRenderFrame() {
             // we need a white diffuse light for the phase of the moon
             ssgGetLight( 0 ) -> setColour( GL_DIFFUSE, white );
 
-            thesky->preDraw( cur_fdm_state->get_Altitude() * SG_FEET_TO_METER );
+            thesky->preDraw( cur_fdm_state->get_Altitude() * SG_FEET_TO_METER, fog_exp2_density );
 
             // return to the desired diffuse color
             ssgGetLight( 0 ) -> setColour( GL_DIFFUSE, l->scene_diffuse() );
-
-            // FIXME: This should not be needed, but at this time (08/15/2003)
-            //        certain NVidia drivers don't seem to implement
-            //        fgPushAttrib(FG_FOG_BIT) properly. The result is that
-            //        there is not fog when looking at the sun.
-            glFogf ( GL_FOG_DENSITY, fog_exp2_density );
         }
 
         // draw the ssg scene
@@ -757,6 +710,7 @@ void fgRenderFrame() {
 
         // draw runway lighting
         if ( draw_otw ) {
+            ssgCullAndDraw( globals->get_scenery()->get_vasi_lights_root() );
             ssgCullAndDraw( globals->get_scenery()->get_rwy_lights_root() );
         }
 
@@ -929,7 +883,6 @@ void fgUpdateTimeDepCalcs() {
         }
 
         if ( ! replay_master->getBoolValue() ) {
-            globals->get_autopilot()->update( delta_time_sec );
             cur_fdm_state->update( delta_time_sec );
         } else {
             FGReplay *r = (FGReplay *)(globals->get_subsystem( "replay" ));
@@ -1005,14 +958,21 @@ static void fgMainLoop( void ) {
         current_time_stamp.stamp();
     }
 
-    delta_time_sec = double(current_time_stamp - last_time_stamp) / 1000000.0;
+    real_delta_time_sec
+        = double(current_time_stamp - last_time_stamp) / 1000000.0;
     if ( clock_freeze->getBoolValue() ) {
         delta_time_sec = 0;
-    } 
+    } else {
+        delta_time_sec = real_delta_time_sec;
+    }
     last_time_stamp = current_time_stamp;
     globals->inc_sim_time_sec( delta_time_sec );
     SGAnimation::set_sim_time_sec( globals->get_sim_time_sec() );
 
+    // These are useful, especially for Nasal scripts.
+    fgSetDouble("/sim/time/delta-realtime-sec", real_delta_time_sec);
+    fgSetDouble("/sim/time/delta-sec", delta_time_sec);
+
     static long remainder = 0;
     long elapsed;
 #ifdef FANCY_FRAME_COUNTER
@@ -1025,7 +985,7 @@ static void fgMainLoop( void ) {
 
     SGTime *t = globals->get_time_params();
 
-    sglog().setLogLevels( SG_ALL, (sgDebugPriority)fgGetInt("/sim/log-level") );
+    globals->get_event_mgr()->update(delta_time_sec);
 
     SGLocation * acmodel_location = 0;
     if(cur_fdm_state->getACModel() != 0) {
@@ -1035,16 +995,6 @@ static void fgMainLoop( void ) {
     SG_LOG( SG_ALL, SG_DEBUG, "Running Main Loop");
     SG_LOG( SG_ALL, SG_DEBUG, "======= ==== ====");
 
-#ifdef FG_NETWORK_OLK
-    if ( fgGetBool("/sim/networking/network-olk") ) {
-        if ( net_is_registered == 0 ) {             // We first have to reg. to fgd
-            // printf("FGD: Netupdate\n");
-            fgd_send_com( "A", FGFS_host);   // Send Mat4 data
-            fgd_send_com( "B", FGFS_host);   // Recv Mat4 data
-        }
-    }
-#endif
-
 #if defined( ENABLE_PLIB_JOYSTICK )
     // Read joystick and update control settings
     // if ( fgGetString("/sim/control-mode") == "joystick" )
@@ -1103,6 +1053,11 @@ static void fgMainLoop( void ) {
                cur_time_override->getLongValue(),
                globals->get_warp() );
 
+    if (globals->get_warp_delta() != 0) {
+       FGLight *l = (FGLight *)(globals->get_subsystem("lighting"));
+       l->update( 0.5 );
+    }
+
     // update magvar model
     globals->get_mag()->update( longitude->getDoubleValue()
                               * SGD_DEGREES_TO_RADIANS,
@@ -1183,7 +1138,7 @@ static void fgMainLoop( void ) {
     }
 
     // Do any I/O channel work that might need to be done
-    globals->get_io()->update( delta_time_sec );
+    globals->get_io()->update( real_delta_time_sec );
 
     // see if we need to load any deferred-load textures
     globals->get_matlib()->load_next_deferred();
@@ -1254,10 +1209,11 @@ static void fgMainLoop( void ) {
     // END Tile Manager udpates
 
     if (fgGetBool("/sim/rendering/specular-highlight")) {
-        glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);        glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
+        glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
+       // glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
     } else {
         glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SINGLE_COLOR);
-         glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
+        // glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
     }
 
     // redraw display
@@ -1280,7 +1236,7 @@ static void fgIdleFunction ( void ) {
     if ( idle_state == 0 ) {
         // Initialize the splash screen right away
         if ( fgGetBool("/sim/startup/splash-screen") ) {
-            fgSplashInit();
+            fgSplashInit(fgGetString("/sim/startup/splash-texture"));
         }
         
         idle_state++;
@@ -1522,7 +1478,7 @@ bool fgMainInit( int argc, char **argv ) {
 #endif
 
     // set default log levels
-    sglog().setLogLevels( SG_ALL, SG_INFO );
+    sglog().setLogLevels( SG_ALL, SG_ALERT );
 
     string version;
 #ifdef FLIGHTGEAR_VERSION
@@ -1542,9 +1498,6 @@ bool fgMainInit( int argc, char **argv ) {
     // seed the random number generater
     sg_srandom_time();
 
-    SGRoute *route = new SGRoute;
-    globals->set_route( route );
-
     FGControls *controls = new FGControls;
     globals->set_controls( controls );
 
@@ -1556,7 +1509,7 @@ bool fgMainInit( int argc, char **argv ) {
     fgInitFGRoot(argc, argv);
 
     // Check for the correct base package version
-    static char required_version[] = "0.9.2";
+    static char required_version[] = "0.9.3";
     string base_version = fgBasePackageVersion();
     if ( !(base_version == required_version) ) {
         // tell the operator how to use this application
@@ -1749,18 +1702,6 @@ bool fgMainInit( int argc, char **argv ) {
     // airport->setName( "Airport Lighting" );
     // lighting->addKid( airport );
 
-    // ADA
-    fgLoadDCS();
-    // ADA
-
-#ifdef FG_NETWORK_OLK
-    // Do the network intialization
-    if ( fgGetBool("/sim/networking/network-olk") ) {
-        printf("Multipilot mode %s\n",
-               fg_net_init( globals->get_scenery()->get_scene_graph() ) );
-    }
-#endif
-
     // build our custom render states
     fgBuildRenderStates();
     
@@ -1773,319 +1714,4 @@ bool fgMainInit( int argc, char **argv ) {
 }
 
 
-// $$$ end - added VS Renganathan, 15 Oct 2K
-//         - added Venky         , 12 Nov 2K
-
-
-void fgLoadDCS(void) {
-
-    ssgEntity *ship_obj = NULL;
-
-    char obj_filename[25];
-
-    for ( int k = 0; k < 32; k++ ) {
-        ship_pos[k]=NULL;
-    }
-
-    SGPath tile_path( globals->get_fg_root());
-    tile_path.append( "Scenery" );
-    tile_path.append( "Objects.txt" );
-    sg_gzifstream in( tile_path.str() );
-    if ( ! in.is_open() ) {
-        SG_LOG( SG_TERRAIN, SG_ALERT, "Cannot open file: " << tile_path.str() );
-    } else {
-
-        SGPath modelpath( globals->get_fg_root() );
-        modelpath.append( "Models" );
-        modelpath.append( "Geometry" );
-  
-        SGPath texturepath( globals->get_fg_root() );
-        texturepath.append( "Models" );
-        texturepath.append( "Textures" );
-        ssgModelPath( (char *)modelpath.c_str() );
-        ssgTexturePath( (char *)texturepath.c_str() );
-
-        ship_sel = new ssgSelector;
-
-        char c;
-        while ( ! in.eof() ) {
-            in >> ::skipws;
-            if ( in.get( c ) && c == '#' ) { 
-                in >> skipeol;
-            } else { 
-                in.putback(c);
-                in >> obj_filename >> obj_lat[objc] >> obj_lon[objc] >> obj_alt[objc];
-                /* cout << endl << obj_filename << " " << obj_lat[objc] << " " << obj_lon[objc] <<  " " << obj_alt[objc] << endl;
-                   int chj=getchar();*/
-                
-                obj_lon[objc] *=SGD_DEGREES_TO_RADIANS;
-                obj_lat[objc] *=SGD_DEGREES_TO_RADIANS;
-                
-                ship_pos[objc] = new ssgTransform;
-       
-                // type "repeat" in objects.txt to load one more
-                // instance of the last object.
-
-                if ( strcmp(obj_filename,"repeat") != 0) {
-                    ship_obj =
-                      globals->get_model_lib()->load_model( globals->get_fg_root(), obj_filename, globals->get_props(), globals->get_sim_time_sec() );
-                }
-      
-                if ( ship_obj != NULL ) {
-                               ship_obj->setName(obj_filename);
-                            if (objc == 0)
-                                       ship_obj->clrTraversalMaskBits( SSGTRAV_HOT );
-                               else
-                                       ship_obj->setTraversalMaskBits( SSGTRAV_HOT );
-                    ship_pos[objc]->addKid( ship_obj ); // add object to transform node
-                    ship_sel->addKid( ship_pos[objc] ); // add transform node to selector
-                    SG_LOG( SG_TERRAIN, SG_ALERT, "Loaded file: "
-                            << obj_filename );
-                } else {
-                    SG_LOG( SG_TERRAIN, SG_ALERT, "Cannot open file: "
-                            << obj_filename );
-                }
-            
-                            // temporary hack for deck lights - ultimately should move to PLib (when??)
-                            //const char *extn = file_extension ( obj_filename ) ;
-                            if ( objc == 1 ){
-                                // ssgVertexArray *lights = new ssgVertexArray( 100 );
-                               ssgVertexArray *lightpoints = new ssgVertexArray( 100 );
-                               ssgVertexArray *lightnormals = new ssgVertexArray( 100 );
-                               ssgVertexArray *lightdir = new ssgVertexArray( 100 );
-                               int ltype[500], light_type = 0;
-                               static int ltcount = 0;
-                                string token;
-                               sgVec3 rway_dir,rway_normal,lightpt;
-                               Point3D node;
-                               modelpath.append(obj_filename);
-                               sg_gzifstream in1( modelpath.str() );
-                               if ( ! in1.is_open() ) {
-                                       SG_LOG( SG_TERRAIN, SG_ALERT, "Cannot open file: " << modelpath.str() );
-                               } else {
-                                       while ( ! in1.eof() ) {
-                                                        in1 >> ::skipws;
-                                               if ( in1.get( c ) && c == '#' ) { 
-                                                       in1 >> skipeol;
-                                               } else { 
-                                                       in1.putback(c);
-                                                       in1 >> token;
-                                                       //cout << token << endl;
-                                                       if ( token == "runway" ) {
-                                                               in1 >> node;
-                                                               sgSetVec3 (rway_dir, node[0], node[1], node[2] );                        
-                                                       } else if ( token == "edgelight" ) {
-                                                               in1 >> node;
-                                                               sgSetVec3 (rway_normal, node[0], node[1], node[2] );
-                                                               light_type = 1;
-                                                       } else if ( token == "taxi" ) {
-                                                               in1 >> node;
-                                                               sgSetVec3 (rway_normal, node[0], node[1], node[2] );                     
-                                                               light_type = 2;
-                                                       } else if ( token == "vasi" ) {
-                                                               in1 >> node;
-                                                               sgSetVec3 (rway_normal, node[0], node[1], node[2] );                     
-                                                               light_type = 3;
-                                                       } else if ( token == "threshold" ) {
-                                                               in1 >> node;
-                                                               sgSetVec3 (rway_normal, node[0], node[1], node[2] );                     
-                                                               light_type = 4;
-                                                       } else if ( token == "rabbit" ) {
-                                                               in1 >> node;
-                                                               sgSetVec3 (rway_normal, node[0], node[1], node[2] );
-                                                               light_type = 5;
-                                                       } else if ( token == "ols" ) {
-                                                               in1 >> node;
-                                                               sgSetVec3 (rway_ols, node[0], node[1], node[2] );
-                                                               light_type = 6;
-                                                       } else if ( token == "red" ) {
-                                                               in1 >> node;
-                                                               sgSetVec3 (rway_normal, node[0], node[1], node[2] );
-                                                               light_type = 7;
-                                                       } else if ( token == "green" ) {
-                                                               in1 >> node;
-                                                               sgSetVec3 (rway_normal, node[0], node[1], node[2] );
-                                                               light_type = 8;
-                                                       } else if ( token == "lp" ) {
-                                                               in1 >> node;
-                                                               sgSetVec3 (lightpt, node[0], node[1], node[2] );
-                                                               lightpoints->add( lightpt );
-                                                               lightnormals->add( rway_normal );
-                                                               lightdir->add( rway_dir );
-                                                               ltype[ltcount]= light_type;
-                                                               ltcount++;
-                                                       }
-                                                       if (in1.eof()) break;
-                                               } 
-                                       }  //while
-
-#if 0        
-                                       if ( lightpoints->getNum() ) {
-                                               ssgBranch *lightpoints_branch;
-                                               long int dummy = -999;
-                                               dummy_tile = new FGTileEntry((SGBucket)dummy);
-                                               dummy_tile->lightmaps_sequence = new ssgSelector;
-                                               dummy_tile->ols_transform = new ssgTransform;
-
-                                               // call function to generate the runway lights
-                                               lightpoints_branch = 
-                                               dummy_tile->gen_runway_lights( lightpoints, lightnormals,
-                                                                                                                       lightdir, ltype);
-                                               lightpoints_brightness->addKid(lightpoints_branch);
-                                               lightpoints_transform->addKid(lightpoints_brightness);
-                                           //dummy_tile->lightmaps_sequence->setTraversalMaskBits( SSGTRAV_HOT );
-                                               lightpoints_transform->addKid( dummy_tile->lightmaps_sequence );
-                                               lightpoints_transform->ref();
-                                               globals->get_scenery()->get_gnd_lights_root()->addKid( lightpoints_transform );
-                                       } 
-#endif
-                               } //if in1 
-                } //if objc
-                            // end hack for deck lights
-
-                objc++;
-
-                if (in.eof()) break;
-            }
-        } // while
-
-        SG_LOG ( SG_TERRAIN, SG_ALERT, "Finished object processing." );
-
-        globals->get_scenery()->get_terrain_branch()->addKid( ship_sel ); //add selector node to root node 
-    }
-
-    return;
- }
-
-
-void fgUpdateDCS (void) {
-
-    // double eye_lat,eye_lon,eye_alt;
-    // static double obj_head;
-    double sl_radius,obj_latgc;
-    // float nresultmat[4][4];
-    // sgMat4 Trans,rothead,rotlon,rot180,rotlat,resultmat1,resultmat2,resultmat3;
-    double bz[3];
-
-    // Instantaneous Geodetic Lat/Lon/Alt of moving object
-    FGADA *fdm = (FGADA *)current_aircraft.fdm_state;
-    
-    // Deck should be the first object in objects.txt in case of fdm=ada
-
-    if (!strcmp(fgGetString("/sim/flight-model"), "ada")) {
-            if ((fdm->get_iaux(1))==1)
-            {
-                    obj_lat[1] = fdm->get_daux(1)*SGD_DEGREES_TO_RADIANS;
-                    obj_lon[1] = fdm->get_daux(2)*SGD_DEGREES_TO_RADIANS;
-                    obj_alt[1] = fdm->get_daux(3);
-                    obj_pitch[1] = fdm->get_faux(1);
-                    obj_roll[1] = fdm->get_faux(2);
-            }
-    }
-    
-    for ( int m = 0; m < objc; m++ ) {
-       //cout << endl <<  obj_lat[m]*SGD_RADIANS_TO_DEGREES << " " << obj_lon[m]*SGD_RADIANS_TO_DEGREES << " " << obj_alt[m] << " " << objc << endl;
-        //int v=getchar();
-
-        //Geodetic to Geocentric angles for rotation
-        sgGeodToGeoc(obj_lat[m],obj_alt[m],&sl_radius,&obj_latgc);
-
-        //moving object gbs-posn in cartesian coords
-        Point3D obj_posn = Point3D( obj_lon[m],obj_lat[m],obj_alt[m]);
-        Point3D obj_pos = sgGeodToCart( obj_posn );
-
-        // Translate moving object w.r.t eye
-        Point3D Objtrans = obj_pos - globals->get_scenery()->get_center();
-        bz[0]=Objtrans.x();
-        bz[1]=Objtrans.y();
-        bz[2]=Objtrans.z();
-
-       // rotate dynamic objects for lat,lon & alt and other motion about its axes
-        
-        sgMat4 sgTRANS;
-        sgMakeTransMat4( sgTRANS, bz[0],bz[1],bz[2]);
-
-        sgVec3 ship_fwd,ship_rt,ship_up;
-        sgSetVec3( ship_fwd, 1.0, 0.0, 0.0);//east,roll
-        sgSetVec3( ship_rt, 0.0, 1.0, 0.0);//up,pitch
-        sgSetVec3( ship_up, 0.0, 0.0, 1.0); //north,yaw
-
-        sgMat4 sgROT_lon, sgROT_lat, sgROT_hdg, sgROT_pitch, sgROT_roll;
-        sgMakeRotMat4( sgROT_lon, obj_lon[m]*SGD_RADIANS_TO_DEGREES, ship_up );
-        sgMakeRotMat4( sgROT_lat, 90-obj_latgc*SGD_RADIANS_TO_DEGREES, ship_rt );
-        sgMakeRotMat4( sgROT_hdg, 180.0, ship_up );
-        sgMakeRotMat4( sgROT_pitch, obj_pitch[m], ship_rt );
-        sgMakeRotMat4( sgROT_roll, obj_roll[m], ship_fwd );
-        
-        sgMat4 sgTUX;
-        sgCopyMat4( sgTUX, sgROT_hdg );
-        sgPostMultMat4( sgTUX, sgROT_pitch );
-        sgPostMultMat4( sgTUX, sgROT_roll );
-        sgPostMultMat4( sgTUX, sgROT_lat );
-        sgPostMultMat4( sgTUX, sgROT_lon );
-        sgPostMultMat4( sgTUX, sgTRANS );
-
-        sgCoord shippos;
-        sgSetCoord(&shippos, sgTUX );
-        ship_pos[m]->setTransform( &shippos );
-        // temporary hack for deck lights - ultimately should move to PLib (when ??)
-        if (m == 1) {
-            if (lightpoints_transform) {
-                lightpoints_transform->setTransform( &shippos );
-                FGLight *l = (FGLight *)(globals->get_subsystem("lighting"));
-                float sun_angle = l->get_sun_angle() * SGD_RADIANS_TO_DEGREES;
-                if ( sun_angle > 89 ) {
-                        lightpoints_brightness->select(0x01);
-                } else {
-                        lightpoints_brightness->select(0x00);
-                }
-            }
-
-            float elev;
-            sgVec3 rp,to;
-            float *vp;
-            float alt;
-            float ref_elev;
-            sgXformPnt3( rp, rway_ols, sgTUX );
-            vp = globals->get_current_view()->get_view_pos();
-            to[0] = rp[0]-vp[0];
-            to[1] = rp[1]-vp[1];
-            to[2] = rp[2]-vp[2];
-            float dist = sgLengthVec3( to );
-            alt = (current_aircraft.fdm_state->get_Altitude() * SG_FEET_TO_METER)-rway_ols[2];
-
-            elev = asin(alt/dist)*SGD_RADIANS_TO_DEGREES;
-
-            ref_elev = elev - 3.75; // +ve above, -ve below
-        
-            unsigned int sel;
-            sel = 0xFF;
-// DO NOT DELETE THIS CODE - This is to compare a discrete FLOLS (without LOD) with analog FLOLS
-//             if (ref_elev > 0.51) sel = 0x21;
-//             if ((ref_elev <= 0.51) & (ref_elev > 0.17)) sel = 0x22;
-//             if ((ref_elev <= 0.17) & (ref_elev >= -0.17)) sel = 0x24;
-//             if ((ref_elev < -0.17) & (ref_elev >= -0.51)) sel = 0x28;
-//             if (ref_elev < -0.51) sel = 0x30;
-// DO NOT DELETE THIS CODE - This is to compare a discrete FLOLS (without LOD) with analog FLOLS
-            // dummy_tile->lightmaps_sequence->select(sel);
-
-            sgVec3 up;
-            sgCopyVec3 (up, ship_up);
-            if (dist > 750) 
-                    sgScaleVec3 (up, 4.0*ref_elev*dist/750.0);
-            else
-                    sgScaleVec3 (up, 4.0*ref_elev);
-            // dummy_tile->ols_transform->setTransform(up);
-            //cout << "ref_elev  " << ref_elev << endl;
-        }
-    // end hack for deck lights
-
-    }
-    if ( ship_sel != NULL ) {
-        ship_sel->select(0xFFFFFFFE); // first object is ownship, added to acmodel
-    }
-}
-
-// $$$ end - added VS Renganathan, 15 Oct 2K
-//           added Venky         , 12 Nov 2K
+// end of main.cxx