]> git.mxchange.org Git - flightgear.git/commitdiff
Try to improve frame rate and reduce jitter
authorTim Moore <timoore@redhat.com>
Wed, 30 Sep 2009 06:03:46 +0000 (08:03 +0200)
committerTim Moore <timoore@redhat.com>
Wed, 30 Sep 2009 06:08:09 +0000 (08:08 +0200)
Signed-off-by: v meazza <vivian.meazza@lineone.net>
Conflicts:

src/AIModel/AIGroundVehicle.cxx

src/AIModel/AIFlightPlanCreateCruise.cxx [changed mode: 0755->0644]
src/AIModel/AIGroundVehicle.cxx
src/AIModel/AIMultiplayer.cxx [changed mode: 0755->0644]
src/AIModel/AIMultiplayer.hxx [changed mode: 0755->0644]
src/AIModel/AIShip.cxx

old mode 100755 (executable)
new mode 100644 (file)
index 82901e527059d4a1ed8024748e77211f369a42ae..21bc80d5ed70a5f46ae069c026ce35aca6f69667 100644 (file)
@@ -210,7 +210,7 @@ bool FGAIGroundVehicle::getGroundElev(SGGeod inpos) {
 
     double height_m ;
 
-    if (globals->get_scenery()->get_elevation_m(SGGeod::fromGeodM(inpos, 10000), height_m, &_material,0)){
+    if (globals->get_scenery()->get_elevation_m(SGGeod::fromGeodM(inpos, 3000), height_m, &_material,0)){
             _ht_agl_ft = inpos.getElevationFt() - height_m * SG_METER_TO_FEET;
 
             if (_material) {
@@ -261,14 +261,14 @@ bool FGAIGroundVehicle::getPitch() {
         double elev_rear = 0;
         double max_alt = 10000;
 
-        if (globals->get_scenery()->get_elevation_m(SGGeod::fromGeodM(geodFront, 10000), elev_front,
+        if (globals->get_scenery()->get_elevation_m(SGGeod::fromGeodM(geodFront, 3000), elev_front,
              &_material, 0)){
                 front_elev_m = elev_front;
         } else
             return false;
 
-        if (globals->get_scenery()->get_elevation_m(SGGeod::fromGeodM(geodRear, 10000),
-            elev_rear, &_material,0)){
+        if (globals->get_scenery()->get_elevation_m(SGGeod::fromGeodM(geodRear, 3000),
+            elev_rear, &_material, 0)){
                 rear_elev_m = elev_rear;
         } else
             return false;
@@ -296,6 +296,7 @@ bool FGAIGroundVehicle::getPitch() {
         static double prev_alt;
 
         if (_new_waypoint){
+            cout << "new waypoint, calculating pitch " << endl;
             curr_alt = curr->altitude * SG_METER_TO_FEET;
             prev_alt = prev->altitude * SG_METER_TO_FEET;
             d_alt = curr_alt - prev_alt;
@@ -304,13 +305,15 @@ bool FGAIGroundVehicle::getPitch() {
             SGGeod::fromDeg(curr->longitude, curr->latitude));
 
             _pitch = atan2(d_alt, distance * SG_METER_TO_FEET) * SG_RADIANS_TO_DEGREES;
+//            cout << "new waypoint, calculating pitch " <<  _pitch << endl;
         }
 
 
         double distance_to_go = SGGeodesy::distanceM(SGGeod::fromDeg(pos.getLongitudeDeg(), pos.getLatitudeDeg()),
             SGGeod::fromDeg(curr->longitude, curr->latitude));
 
-        //cout << "distance curr & prev " << prev->name << " " << curr->name << " " << distance * SG_METER_TO_FEET
+        //cout << "tunnel " << _tunnel
+        //     << " distance curr & prev " << prev->name << " " << curr->name << " " << distance * SG_METER_TO_FEET
         //     << " distance to go " << distance_to_go * SG_METER_TO_FEET
         //     << " d_alt ft " << d_alt
         //     << endl;
@@ -524,13 +527,14 @@ void FGAIGroundVehicle::RunGroundVehicle(double dt){
     // Check execution time (currently once every 0.05 sec or 20 fps)
     // Add a bit of randomization to prevent the execution of all flight plans
     // in synchrony, which can add significant periodic framerate flutter.
+    // Randomization removed to get better appearance
     ///////////////////////////////////////////////////////////////////////////
 
     //cout << "_start_sec " << _start_sec << " time_sec " << time_sec << endl;
     if (_dt_count < _next_run)
         return;
 
-    _next_run = 0.055 + (0.015 * sg_random());
+    _next_run = 0.055 /*+ (0.015 * sg_random())*/;
 
     if (getPitch()){
         setElevation(_elevation, _dt_count, _elevation_coeff);
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 3a2e83ec0e8fdd820ec1396498fc2e1561378967..76b470d6d00b8e1a19c68837b3fad34fe7dbe7d7 100644 (file)
@@ -1045,8 +1045,8 @@ void FGAIShip::setWPPos() {
 
     if (curr->on_ground){
 
-        if (globals->get_scenery()->get_elevation_m(SGGeod::fromGeodM(wppos, 10000),
-            elevation_m, &_material)){
+        if (globals->get_scenery()->get_elevation_m(SGGeod::fromGeodM(wppos, 3000),
+            elevation_m, &_material, 0)){
                 wppos.setElevationM(elevation_m);
         }