Modified Files:
src/Scenery/scenery.cxx: Use geodetic down vector for ground intersection.
This commit is contained in:
parent
17262df51c
commit
ed677676c0
1 changed files with 13 additions and 12 deletions
|
@ -121,23 +121,24 @@ FGScenery::get_elevation_m(double lat, double lon, double max_alt,
|
|||
return get_elevation_m(SGGeod::fromDegM(lon, lat, max_alt), alt, material);
|
||||
}
|
||||
|
||||
bool
|
||||
FGScenery::get_elevation_m(const SGGeod& geod,
|
||||
double& alt, const SGMaterial** material)
|
||||
{
|
||||
SGVec3d pos = SGVec3d::fromGeod(geod);
|
||||
return get_cart_elevation_m(pos, 0, alt, material);
|
||||
}
|
||||
|
||||
bool
|
||||
FGScenery::get_cart_elevation_m(const SGVec3d& pos, double max_altoff,
|
||||
double& alt, const SGMaterial** material)
|
||||
{
|
||||
if ( norm1(pos) < 1 )
|
||||
return false;
|
||||
SGGeod geod = SGGeod::fromCart(pos);
|
||||
geod.setElevationM(geod.getElevationM() + max_altoff);
|
||||
return get_elevation_m(geod, alt, material);
|
||||
}
|
||||
|
||||
SGVec3d start = pos + max_altoff*normalize(pos);
|
||||
SGVec3d end(0, 0, 0);
|
||||
bool
|
||||
FGScenery::get_elevation_m(const SGGeod& geod, double& alt,
|
||||
const SGMaterial** material)
|
||||
{
|
||||
SGVec3d start = SGVec3d::fromGeod(geod);
|
||||
|
||||
SGGeod geodEnd = geod;
|
||||
geodEnd.setElevationM(SGMiscd::min(geod.getElevationM() - 10, -10000));
|
||||
SGVec3d end = SGVec3d::fromGeod(geodEnd);
|
||||
|
||||
osgUtil::IntersectVisitor intersectVisitor;
|
||||
intersectVisitor.setTraversalMask(SG_NODEMASK_TERRAIN_BIT);
|
||||
|
|
Loading…
Reference in a new issue