From 93cb29608a9eaebc84dee6a9d39872308ff0651e Mon Sep 17 00:00:00 2001 From: frohlich Date: Tue, 2 Jan 2007 09:50:35 +0000 Subject: [PATCH] Modified Files: src/FDM/groundcache.cxx src/FDM/groundcache.hxx: Store the material that was used to get the croase agl level and return that material in case we need to make use of that croase value. --- src/FDM/groundcache.cxx | 12 +++++++++--- src/FDM/groundcache.hxx | 4 ++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/FDM/groundcache.cxx b/src/FDM/groundcache.cxx index 3ffc28331..1fad256c5 100644 --- a/src/FDM/groundcache.cxx +++ b/src/FDM/groundcache.cxx @@ -364,6 +364,7 @@ public: gp.type = gp.material->get_solid() ? FGInterface::Solid : FGInterface::Water; return true; } + gp.type = FGInterface::Unknown; osg::Referenced* base = node.getUserData(); if (!base) return true; @@ -527,7 +528,7 @@ public: t.rotation = mGroundProperty.rot; t.rotation_pivot = mGroundProperty.pivot - mGroundCache->cache_center; t.type = mGroundProperty.type; - t.material=mGroundProperty.material; + t.material = mGroundProperty.material; mGroundCache->triangles.push_back(t); } } @@ -543,8 +544,11 @@ public: isectpoint.osg() = isectpoint.osg()*mLocalToGlobal; isectpoint += mGroundCache->cache_center; double this_radius = length(isectpoint); - if (mGroundCache->ground_radius < this_radius) + if (mGroundCache->ground_radius < this_radius) { mGroundCache->ground_radius = this_radius; + mGroundCache->_type = mGroundProperty.type; + mGroundCache->_material = mGroundProperty.material; + } } } @@ -840,7 +844,9 @@ FGGroundCache::get_agl(double t, const SGVec3d& dpt, double max_altoff, // The altitude is the distance of the requested point from the // contact point. *agl = dot(down, contact - dpt); - *type = FGInterface::Unknown; + *type = _type; + if (material) + *material = _material; return ret; } diff --git a/src/FDM/groundcache.hxx b/src/FDM/groundcache.hxx index 754d53921..f00fb40c1 100644 --- a/src/FDM/groundcache.hxx +++ b/src/FDM/groundcache.hxx @@ -122,6 +122,10 @@ private: // Approximate ground radius. // In case the aircraft is too high above ground. double ground_radius; + // Ground type + int _type; + // the simgear material reference, contains friction coeficients ... + const SGMaterial* _material; // The time reference for later call to intersection test routines. // Is required since we will have moving triangles in carriers. double cache_ref_time; -- 2.39.2