]> git.mxchange.org Git - flightgear.git/commitdiff
Modified Files:
authorfrohlich <frohlich>
Sun, 29 Jul 2007 10:51:41 +0000 (10:51 +0000)
committerfrohlich <frohlich>
Sun, 29 Jul 2007 10:51:41 +0000 (10:51 +0000)
src/Scenery/scenery.cxx: Use geodetic down vector for
ground intersection.

src/Scenery/scenery.cxx

index e7d33aba8dc109ca2f8ee6cdb94b795da9a3a749..110631b3f3523d5e1fc5b3c7aec3daf40acf1a4d 100644 (file)
@@ -122,22 +122,23 @@ FGScenery::get_elevation_m(double lat, double lon, double max_alt,
 }
 
 bool
-FGScenery::get_elevation_m(const SGGeod& geod,
-                           double& alt, const SGMaterial** material)
+FGScenery::get_cart_elevation_m(const SGVec3d& pos, double max_altoff,
+                                double& alt, const SGMaterial** material)
 {
-  SGVec3d pos = SGVec3d::fromGeod(geod);
-  return get_cart_elevation_m(pos, 0, alt, material);
+  SGGeod geod = SGGeod::fromCart(pos);
+  geod.setElevationM(geod.getElevationM() + max_altoff);
+  return get_elevation_m(geod, alt, material);
 }
 
 bool
-FGScenery::get_cart_elevation_m(const SGVec3d& pos, double max_altoff,
-                                double& alt, const SGMaterial** material)
+FGScenery::get_elevation_m(const SGGeod& geod, double& alt,
+                           const SGMaterial** material)
 {
-  if ( norm1(pos) < 1 )
-    return false;
+  SGVec3d start = SGVec3d::fromGeod(geod);
 
-  SGVec3d start = pos + max_altoff*normalize(pos);
-  SGVec3d end(0, 0, 0);
+  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);