Fix a bug in ground elevation measuring for the first frame after we cross
a tile boundary. (Potentially imposes a slight performance penalty, but getting the correct answer needs to be higher priority than getting the wrong answer really quickly.)
This commit is contained in:
parent
a01f92f0d1
commit
7df3da668c
1 changed files with 26 additions and 24 deletions
|
@ -402,17 +402,18 @@ int FGTileMgr::update( double lon, double lat, double visibility_meters,
|
||||||
|
|
||||||
// no reason to update this if we haven't moved...
|
// no reason to update this if we haven't moved...
|
||||||
if ( longitude != last_longitude || latitude != last_latitude ) {
|
if ( longitude != last_longitude || latitude != last_latitude ) {
|
||||||
// update current elevation...
|
// update current elevation...
|
||||||
if (updateCurrentElevAtPos(abs_pos_vector, center)) {
|
if ( updateCurrentElevAtPos( abs_pos_vector, center )
|
||||||
last_longitude = longitude;
|
)
|
||||||
last_latitude = latitude;
|
/*if ( updateCurrentElevAtPos( abs_pos_vector,
|
||||||
}
|
globals->get_scenery()->get_next_center() )
|
||||||
|
)*/
|
||||||
|
{
|
||||||
|
last_longitude = longitude;
|
||||||
|
last_latitude = latitude;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -457,25 +458,26 @@ int FGTileMgr::updateCurrentElevAtPos(sgdVec3 abs_pos_vector, Point3D center) {
|
||||||
|
|
||||||
bool hit = false;
|
bool hit = false;
|
||||||
if ( fabs(sc[0]) > 1.0 || fabs(sc[1]) > 1.0 || fabs(sc[2]) > 1.0 ) {
|
if ( fabs(sc[0]) > 1.0 || fabs(sc[1]) > 1.0 || fabs(sc[2]) > 1.0 ) {
|
||||||
// scenery center has been properly defined so any hit
|
// scenery center has been properly defined so any hit should
|
||||||
// should be valid (and not just luck)
|
// be valid (and not just luck)
|
||||||
hit = fgCurrentElev(abs_pos_vector,
|
hit = fgCurrentElev(abs_pos_vector,
|
||||||
sc,
|
sc,
|
||||||
current_tile->get_terra_transform(),
|
// current_tile->get_terra_transform(),
|
||||||
&hit_list,
|
&hit_list,
|
||||||
&hit_elev,
|
&hit_elev,
|
||||||
&hit_radius,
|
&hit_radius,
|
||||||
hit_normal);
|
hit_normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( hit ) {
|
if ( hit ) {
|
||||||
globals->get_scenery()->set_cur_elev( hit_elev );
|
// cout << "elev = " << hit_elev << " " << hit_radius << endl;
|
||||||
globals->get_scenery()->set_cur_radius( hit_radius );
|
globals->get_scenery()->set_cur_elev( hit_elev );
|
||||||
globals->get_scenery()->set_cur_normal( hit_normal );
|
globals->get_scenery()->set_cur_radius( hit_radius );
|
||||||
|
globals->get_scenery()->set_cur_normal( hit_normal );
|
||||||
} else {
|
} else {
|
||||||
globals->get_scenery()->set_cur_elev( -9999.0 );
|
globals->get_scenery()->set_cur_elev( -9999.0 );
|
||||||
globals->get_scenery()->set_cur_radius( 0.0 );
|
globals->get_scenery()->set_cur_radius( 0.0 );
|
||||||
globals->get_scenery()->set_cur_normal( hit_normal );
|
globals->get_scenery()->set_cur_normal( hit_normal );
|
||||||
}
|
}
|
||||||
return hit;
|
return hit;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue