]> git.mxchange.org Git - flightgear.git/blobdiff - src/Scenery/tilemgr.cxx
Multiplayer client/server system -- MessageBuf class and test harness complete
[flightgear.git] / src / Scenery / tilemgr.cxx
index c5fd377500945b7707afb62da67486d4e5518754..7c601bbecae94625a7b60248ad53f6b98d77d1b7 100644 (file)
 #include <simgear/math/polar3d.hxx>
 #include <simgear/math/sg_geodesy.hxx>
 #include <simgear/math/vector.hxx>
-#include <simgear/misc/exception.hxx>
+#include <simgear/structure/exception.hxx>
+#include <simgear/scene/model/modellib.hxx>
 
 #include <Main/globals.hxx>
 #include <Main/fg_props.hxx>
 #include <Main/viewer.hxx>
-#include <Model/loader.hxx>
-#include <Objects/obj.hxx>
 
 #include "newcache.hxx"
 #include "scenery.hxx"
@@ -281,7 +280,10 @@ void FGTileMgr::update_queues()
         try
         {
             ssgEntity *obj_model =
-                  globals->get_model_loader()->load_model(dm->get_model_path());
+                globals->get_model_lib()->load_model( ".",
+                                                      dm->get_model_path(),
+                                                      globals->get_props(),
+                                                      globals->get_sim_time_sec() );
             if ( obj_model != NULL ) {
                 dm->get_obj_trans()->addKid( obj_model );
             }
@@ -314,6 +316,7 @@ void FGTileMgr::update_queues()
 #endif
         e->add_ssg_nodes( globals->get_scenery()->get_terrain_branch(),
                           globals->get_scenery()->get_gnd_lights_root(),
+                          globals->get_scenery()->get_taxi_lights_root(),
                           globals->get_scenery()->get_rwy_lights_root(),
                           globals->get_scenery()->get_taxi_lights_root() );
         // cout << "Adding ssg nodes for "
@@ -351,7 +354,7 @@ void FGTileMgr::update_queues()
 // disk.
 int FGTileMgr::update( double visibility_meters )
 {
-    FGLocation *location = globals->get_current_view()->getFGLocation();
+    SGLocation *location = globals->get_current_view()->getSGLocation();
     sgdVec3 abs_pos_vector;
     sgdCopyVec3( abs_pos_vector,
                  globals->get_current_view()->get_absolute_view_pos() );
@@ -359,7 +362,7 @@ int FGTileMgr::update( double visibility_meters )
 }
 
 
-int FGTileMgr::update( FGLocation *location, double visibility_meters,
+int FGTileMgr::update( SGLocation *location, double visibility_meters,
                        sgdVec3 abs_pos_vector )
 {
     longitude = location->getLongitude_deg();
@@ -370,6 +373,7 @@ int FGTileMgr::update( FGLocation *location, double visibility_meters,
     current_bucket.set_bucket( longitude, latitude );
     // SG_LOG( SG_TERRAIN, SG_DEBUG, "Updating tile list for "
     //         << current_bucket );
+    fgSetInt( "/environment/current-tile-id", current_bucket.gen_index() );
 
     // set global scenery center from current tile center
     current_tile = tile_cache.get_tile( current_bucket );
@@ -446,6 +450,9 @@ int FGTileMgr::updateCurrentElevAtPos(sgdVec3 abs_pos_vector, Point3D center) {
         // be valid (and not just luck)
         hit = fgCurrentElev(abs_pos_vector,
                             sc,
+               // uncomment next paramater to fly under
+               // bridges and a slightly faster algorithm
+               // but you won't be able to land on aircraft carriers
                             // current_tile->get_terra_transform(),
                             &hit_list,
                             &hit_elev,
@@ -467,7 +474,7 @@ int FGTileMgr::updateCurrentElevAtPos(sgdVec3 abs_pos_vector, Point3D center) {
 }
 
 
-void FGTileMgr::prep_ssg_nodes( FGLocation *location, float vis ) {
+void FGTileMgr::prep_ssg_nodes( SGLocation *location, float vis ) {
 
     // traverse the potentially viewable tile list and update range
     // selector and transform