More robust behaviour when the tilemanager reports 'no scenery'.
Insert log if this happens. Modified Files: flight.cxx groundcache.cxx
This commit is contained in:
parent
0e72224559
commit
16211c9440
2 changed files with 15 additions and 11 deletions
|
@ -731,9 +731,8 @@ FGInterface::get_agl_m(double t, const double pt[3], double max_altoff,
|
|||
SGVec3d pt_m = SGVec3d(pt) - max_altoff*ground_cache.get_down();
|
||||
SGVec3d _contact, _normal, _linearVel, _angularVel;
|
||||
material = 0;
|
||||
if (!ground_cache.get_agl(t, pt_m, _contact, _normal, _linearVel,
|
||||
_angularVel, id, material))
|
||||
return false;
|
||||
bool ret = ground_cache.get_agl(t, pt_m, _contact, _normal, _linearVel,
|
||||
_angularVel, id, material);
|
||||
// correct the linear velocity, since the line intersector delivers
|
||||
// values for the start point and the get_agl function should
|
||||
// traditionally deliver for the contact point
|
||||
|
@ -743,7 +742,7 @@ FGInterface::get_agl_m(double t, const double pt[3], double max_altoff,
|
|||
assign(normal, _normal);
|
||||
assign(linearVel, _linearVel);
|
||||
assign(angularVel, _angularVel);
|
||||
return true;
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -757,9 +756,8 @@ FGInterface::get_agl_ft(double t, const double pt[3], double max_altoff,
|
|||
pt_m *= SG_FEET_TO_METER;
|
||||
SGVec3d _contact, _normal, _linearVel, _angularVel;
|
||||
material = 0;
|
||||
if (!ground_cache.get_agl(t, pt_m, _contact, _normal, _linearVel,
|
||||
_angularVel, id, material))
|
||||
return false;
|
||||
bool ret = ground_cache.get_agl(t, pt_m, _contact, _normal, _linearVel,
|
||||
_angularVel, id, material);
|
||||
// correct the linear velocity, since the line intersector delivers
|
||||
// values for the start point and the get_agl function should
|
||||
// traditionally deliver for the contact point
|
||||
|
@ -770,7 +768,7 @@ FGInterface::get_agl_ft(double t, const double pt[3], double max_altoff,
|
|||
assign( normal, _normal );
|
||||
assign( linearVel, SG_METER_TO_FEET*_linearVel );
|
||||
assign( angularVel, _angularVel );
|
||||
return true;
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -245,9 +245,12 @@ FGGroundCache::prepare_ground_cache(double ref_time, const SGVec3d& pt,
|
|||
SGGeod geodPt = SGGeod::fromCart(pt);
|
||||
// Don't blow away the cache ground_radius and stuff if there's no
|
||||
// scenery
|
||||
if (!globals->get_tile_mgr()->scenery_available(geodPt, rad))
|
||||
if (!globals->get_tile_mgr()->scenery_available(geodPt, rad)) {
|
||||
SG_LOG(SG_FLIGHT, SG_WARN, "prepare_ground_cache(): scenery_available "
|
||||
"returns false at " << geodPt << " " << pt << " " << rad);
|
||||
return false;
|
||||
_altitude = 0;
|
||||
}
|
||||
_material = 0;
|
||||
|
||||
// If we have an active wire, get some more area into the groundcache
|
||||
if (_wire)
|
||||
|
@ -283,8 +286,11 @@ FGGroundCache::prepare_ground_cache(double ref_time, const SGVec3d& pt,
|
|||
found_ground = true;
|
||||
} else {
|
||||
// Else do a crude scene query for the current point
|
||||
double alt = 0;
|
||||
found_ground = globals->get_scenery()->
|
||||
get_cart_elevation_m(pt, rad, _altitude, &_material);
|
||||
get_cart_elevation_m(pt, rad, alt, &_material);
|
||||
if (found_ground)
|
||||
_altitude = alt;
|
||||
}
|
||||
|
||||
// Still not sucessful??
|
||||
|
|
Loading…
Reference in a new issue