1
0
Fork 0

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.
This commit is contained in:
frohlich 2007-01-02 09:50:35 +00:00
parent f63c96bf0e
commit 93cb29608a
2 changed files with 13 additions and 3 deletions

View file

@ -364,6 +364,7 @@ public:
gp.type = gp.material->get_solid() ? FGInterface::Solid : FGInterface::Water; gp.type = gp.material->get_solid() ? FGInterface::Solid : FGInterface::Water;
return true; return true;
} }
gp.type = FGInterface::Unknown;
osg::Referenced* base = node.getUserData(); osg::Referenced* base = node.getUserData();
if (!base) if (!base)
return true; return true;
@ -527,7 +528,7 @@ public:
t.rotation = mGroundProperty.rot; t.rotation = mGroundProperty.rot;
t.rotation_pivot = mGroundProperty.pivot - mGroundCache->cache_center; t.rotation_pivot = mGroundProperty.pivot - mGroundCache->cache_center;
t.type = mGroundProperty.type; t.type = mGroundProperty.type;
t.material=mGroundProperty.material; t.material = mGroundProperty.material;
mGroundCache->triangles.push_back(t); mGroundCache->triangles.push_back(t);
} }
} }
@ -543,8 +544,11 @@ public:
isectpoint.osg() = isectpoint.osg()*mLocalToGlobal; isectpoint.osg() = isectpoint.osg()*mLocalToGlobal;
isectpoint += mGroundCache->cache_center; isectpoint += mGroundCache->cache_center;
double this_radius = length(isectpoint); double this_radius = length(isectpoint);
if (mGroundCache->ground_radius < this_radius) if (mGroundCache->ground_radius < this_radius) {
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 // The altitude is the distance of the requested point from the
// contact point. // contact point.
*agl = dot(down, contact - dpt); *agl = dot(down, contact - dpt);
*type = FGInterface::Unknown; *type = _type;
if (material)
*material = _material;
return ret; return ret;
} }

View file

@ -122,6 +122,10 @@ private:
// Approximate ground radius. // Approximate ground radius.
// In case the aircraft is too high above ground. // In case the aircraft is too high above ground.
double ground_radius; 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. // The time reference for later call to intersection test routines.
// Is required since we will have moving triangles in carriers. // Is required since we will have moving triangles in carriers.
double cache_ref_time; double cache_ref_time;