1
0
Fork 0

With this patch, you can fly under bridges, then turn around and land on

them lengthwise.
This commit is contained in:
curt 2003-11-21 04:41:01 +00:00
parent 0f1c24bbed
commit ca6067cbc0
4 changed files with 28 additions and 9 deletions

View file

@ -511,7 +511,8 @@ static void ssgGetCurrentBSphere( ssgEntity *entity, sgVec3 center, float *radiu
// ======================
// Determine scenery altitude via ssg.
// returned results are in meters
bool fgCurrentElev( sgdVec3 abs_view_pos, sgdVec3 scenery_center,
bool fgCurrentElev( sgdVec3 abs_view_pos, double max_alt_m,
sgdVec3 scenery_center,
FGHitList *hit_list,
double *terrain_elev, double *radius, double *normal)
{
@ -539,7 +540,8 @@ bool fgCurrentElev( sgdVec3 abs_view_pos, sgdVec3 scenery_center,
&alt, &sea_level_r);
// cout << "hit " << i << " lon = " << geoc.lon() << " lat = "
// << lat_geod << " alt = " << alt << endl;
if ( alt > result && alt < 10000 ) {
if ( alt > result && alt < max_alt_m ) {
// cout << " it's a keeper" << endl;
result = alt;
this_hit = i;
}
@ -571,7 +573,8 @@ bool fgCurrentElev( sgdVec3 abs_view_pos, sgdVec3 scenery_center,
// ======================
// Determine scenery altitude via ssg.
// returned results are in meters
bool fgCurrentElev( sgdVec3 abs_view_pos, sgdVec3 scenery_center,
bool fgCurrentElev( sgdVec3 abs_view_pos, double max_alt_m,
sgdVec3 scenery_center,
ssgTransform *terra_transform,
FGHitList *hit_list,
double *terrain_elev, double *radius, double *normal)
@ -604,7 +607,7 @@ bool fgCurrentElev( sgdVec3 abs_view_pos, sgdVec3 scenery_center,
double lat_geod, alt, sea_level_r;
sgGeocToGeod(geoc.lat(), geoc.radius(), &lat_geod,
&alt, &sea_level_r);
if ( alt > result && alt < 20000 ) {
if ( alt > result && alt < max_alt_m ) {
result = alt;
this_hit = i;
}
@ -624,7 +627,7 @@ bool fgCurrentElev( sgdVec3 abs_view_pos, sgdVec3 scenery_center,
return true;
} else {
SG_LOG( SG_TERRAIN, SG_DEBUG, "DOING FULL TERRAIN INTERSECTION" );
return fgCurrentElev( abs_view_pos, scenery_center, hit_list,
return fgCurrentElev( abs_view_pos, max_alt_m, scenery_center, hit_list,
terrain_elev,radius,normal);
}
}

View file

@ -85,6 +85,7 @@ public:
// center, find the current terrain intersection elevation for the
// point specified.
bool fgCurrentElev( sgdVec3 abs_view_pos,
double max_alt_m,
sgdVec3 scenery_center,
ssgTransform *terra_transform,
FGHitList *hit_list,
@ -93,6 +94,7 @@ bool fgCurrentElev( sgdVec3 abs_view_pos,
double *normal );
bool fgCurrentElev( sgdVec3 abs_view_pos,
double max_alt_m,
sgdVec3 scenery_center,
FGHitList *hit_list,
double *terrain_elev,

View file

@ -367,6 +367,15 @@ int FGTileMgr::update( SGLocation *location, double visibility_meters,
{
longitude = location->getLongitude_deg();
latitude = location->getLatitude_deg();
// add 2.0m to the max altitude to give a little leeway to the
// ground reaction code.
altitude_m = location->getAltitudeASL_ft() * SG_FEET_TO_METER + 2.0;
// if current altitude is apparently not initialized, set max
// altitude to something big.
if ( altitude_m < -1000 ) {
altitude_m = 10000;
}
// SG_LOG( SG_TERRAIN, SG_DEBUG, "FGTileMgr::update() for "
// << longitude << " " << latatitude );
@ -411,7 +420,7 @@ int FGTileMgr::update( SGLocation *location, double visibility_meters,
// no reason to update this if we haven't moved...
if ( longitude != last_longitude || latitude != last_latitude ) {
// update current elevation...
if ( updateCurrentElevAtPos( abs_pos_vector,
if ( updateCurrentElevAtPos( abs_pos_vector, altitude_m,
location->get_tile_center() ) )
{
last_longitude = longitude;
@ -432,8 +441,10 @@ void FGTileMgr::refresh_view_timestamps() {
}
int FGTileMgr::updateCurrentElevAtPos(sgdVec3 abs_pos_vector, Point3D center) {
int FGTileMgr::updateCurrentElevAtPos( sgdVec3 abs_pos_vector,
double max_alt_m,
Point3D center)
{
sgdVec3 sc;
sgdSetVec3( sc, center[0], center[1], center[2]);
@ -449,6 +460,7 @@ int FGTileMgr::updateCurrentElevAtPos(sgdVec3 abs_pos_vector, Point3D center) {
// scenery center has been properly defined so any hit should
// be valid (and not just luck)
hit = fgCurrentElev(abs_pos_vector,
max_alt_m,
sc,
// uncomment next paramater to fly under
// bridges and a slightly faster algorithm

View file

@ -100,6 +100,7 @@ private:
// current longitude latitude
double longitude;
double latitude;
double altitude_m;
double last_longitude;
double last_latitude;
@ -166,7 +167,8 @@ public:
int update( SGLocation *location, double visibility_meters,
sgdVec3 abs_pos_vector );
int updateCurrentElevAtPos(sgdVec3 abs_pos_vector, Point3D center );
int updateCurrentElevAtPos( sgdVec3 abs_pos_vector, double altitude_m,
Point3D center );
// Determine scenery altitude. Normally this just happens when we
// render the scene, but we'd also like to be able to do this