]> git.mxchange.org Git - flightgear.git/blobdiff - src/Scenery/hitlist.cxx
Make sure pu.h doesn't include glut by accident.
[flightgear.git] / src / Scenery / hitlist.cxx
index aa0e3b546c44e01761fbac95efe6bab3e91b3726..6d0182269f4628290376fc95d56f84807004c6b8 100644 (file)
@@ -507,7 +507,7 @@ void FGHitList::Intersect( ssgBranch *scene, sgdMat4 m, sgdVec3 orig, sgdVec3 di
 
 // Determine scenery altitude via ssg.
 // returned results are in meters
-static double hitlist1_time = 0.0;
+// static double hitlist1_time = 0.0;
 
 bool fgCurrentElev( sgdVec3 abs_view_pos, double max_alt_m,
                     sgdVec3 scenery_center,
@@ -537,10 +537,11 @@ bool fgCurrentElev( sgdVec3 abs_view_pos, double max_alt_m,
     int hitcount = hit_list->num_hits();
     // cout << "hits = " << hitcount << endl;
     for ( int i = 0; i < hitcount; ++i ) {
-        geoc = sgCartToPolar3d( sc + hit_list->get_point(i) );
-        double lat_geod, alt, sea_level_r;
-        sgGeocToGeod(geoc.lat(), geoc.radius(), &lat_geod,
-                     &alt, &sea_level_r);
+        // FIXME: sgCartToGeod is slow.  Call it just once for the
+        // "sc" point, and then handle the rest with a geodetic "up"
+        // vector approximation.  Across one tile, this will be
+        // acceptable.
+        double alt = sgCartToGeod( sc + hit_list->get_point(i) ).elev();
         // cout << "hit " << i << " lon = " << geoc.lon() << " lat = "
         //      << lat_geod << " alt = " << alt << "  max alt = " << max_alt_m
         //      << endl;
@@ -589,7 +590,7 @@ bool fgCurrentElev( sgdVec3 abs_view_pos, double max_alt_m,
 }
 
 
-static double hitlist2_time = 0.0;
+// static double hitlist2_time = 0.0;
 
 // Determine scenery altitude via ssg.
 // returned results are in meters
@@ -629,10 +630,11 @@ bool fgCurrentElev( sgdVec3 abs_view_pos, double max_alt_m,
     int hitcount = hit_list->num_hits();
     // cout << "hits = " << hitcount << endl;
     for ( int i = 0; i < hitcount; ++i ) {
-        geoc = sgCartToPolar3d( sc + hit_list->get_point(i) );
-        double lat_geod, alt, sea_level_r;
-        sgGeocToGeod(geoc.lat(), geoc.radius(), &lat_geod,
-                     &alt, &sea_level_r);
+        // FIXME: sgCartToGeod is slow.  Call it just once for the
+        // "sc" point, and then handle the rest with a geodetic "up"
+        // vector approximation.  Across one tile, this will be
+        // acceptable.
+        double alt = sgCartToGeod( sc + hit_list->get_point(i) ).elev();
         // cout << "hit " << i << " lon = " << geoc.lon() << " lat = "
         //      << lat_geod << " alt = " << alt << "  max alt = " << max_alt_m
         //      << endl;