#ifndef _GROUNDCACHE_HXX
#define _GROUNDCACHE_HXX
-#include <osg/Group>
-#include <osg/ref_ptr>
-
#include <simgear/compiler.h>
#include <simgear/constants.h>
#include <simgear/math/SGMath.hxx>
#include <simgear/math/SGGeometry.hxx>
-#include <simgear/scene/bvh/BVHNode.hxx>
+#include <simgear/bvh/BVHNode.hxx>
#include <simgear/structure/SGSharedPtr.hxx>
-class SGMaterial;
+// #define GROUNDCACHE_DEBUG
+#ifdef GROUNDCACHE_DEBUG
+#include <osg/Group>
+#include <osg/ref_ptr>
+#include <simgear/timing/timestamp.hxx>
+#endif
+
namespace simgear {
class BVHLineGeometry;
+class BVHMaterial;
}
class FGGroundCache {
const SGVec3d& get_down() const
{ return down; }
+ // The time offset that originates from a simtime different than zero
+ // at initialization time of the fdm.
double get_cache_time_offset() const
{ return cache_time_offset; }
void set_cache_time_offset(double time_offset)
// 0 and 1 which can be used to model lower friction with wet runways.
bool get_agl(double t, const SGVec3d& pt, SGVec3d& contact,
SGVec3d& normal, SGVec3d& linearVel, SGVec3d& angularVel,
- simgear::BVHNode::Id& id, const SGMaterial*& material);
+ simgear::BVHNode::Id& id,
+ const simgear::BVHMaterial*& material);
bool get_nearest(double t, const SGVec3d& pt, double maxDist,
SGVec3d& contact, SGVec3d& linearVel, SGVec3d& angularVel,
- simgear::BVHNode::Id& id, const SGMaterial*& material);
+ simgear::BVHNode::Id& id,
+ const simgear::BVHMaterial*& material);
// Return 1 if the hook intersects with a wire.
// That test is done by checking if the quad spanned by the points pt*
// In case the aircraft is too high above ground.
double _altitude;
// the simgear material reference, contains friction coeficients ...
- const SGMaterial* _material;
+ const simgear::BVHMaterial* _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;
bool found_ground;
SGSharedPtr<simgear::BVHNode> _localBvhTree;
+
+#ifdef GROUNDCACHE_DEBUG
+ SGTimeStamp _lookupTime;
+ unsigned _lookupCount;
+ SGTimeStamp _buildTime;
+ unsigned _buildCount;
+
+ osg::ref_ptr<osg::Group> _group;
+#endif
};
#endif