#ifndef _GROUNDCACHE_HXX
#define _GROUNDCACHE_HXX
+#include <osg/Node>
+
+namespace osgUtil
+{
+class PolytopeIntersector;
+}
+
#include <simgear/compiler.h>
#include <simgear/constants.h>
#include <simgear/math/SGMath.hxx>
+#include <simgear/math/SGGeometry.hxx>
class SGMaterial;
-class GroundCacheFillVisitor;
+class WireIntersector;
class FGGroundCache {
public:
private:
friend class GroundCacheFillVisitor;
- struct Triangle {
- Triangle() : material(0) {}
- // The edge vertices.
- SGVec3d vertices[3];
- // The surface normal.
- SGVec4d plane;
- // The bounding shpere.
- SGVec3d boundCenter;
- double boundRadius;
- // The linear and angular velocity.
- SGVec3d velocity;
- SGVec3d rotation;
- SGVec3d rotation_pivot;
- // Ground type
+
+ // Helper class to hold some properties of the ground triangle.
+ struct GroundProperty {
+ GroundProperty() : type(0), wire_id(0), material(0) {}
int type;
+ int wire_id;
+ // The linear and angular velocity.
+ SGVec3d vel;
+ SGVec3d rot;
+ SGVec3d pivot;
// the simgear material reference, contains friction coeficients ...
const SGMaterial* material;
};
+
+ struct Triangle {
+ GroundProperty gp;
+ // The triangle we represent
+ SGTriangled triangle;
+ SGSphered sphere;
+ };
struct Catapult {
+ GroundProperty gp;
SGVec3d start;
SGVec3d end;
- SGVec3d velocity;
- SGVec3d rotation;
- SGVec3d rotation_pivot;
};
struct Wire {
+ GroundProperty gp;
SGVec3d ends[2];
- SGVec3d velocity;
- SGVec3d rotation;
- SGVec3d rotation_pivot;
- int wire_id;
};
- // The center of the cache.
- SGVec3d cache_center;
// 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;
SGVec3d down;
bool found_ground;
-
- // Helper class to hold some properties of the ground triangle.
- struct GroundProperty {
- GroundProperty() : type(0), material(0) {}
- int type;
- int wire_id;
- SGVec3d vel;
- SGVec3d rot;
- SGVec3d pivot;
- const SGMaterial* material;
- };
-
- static void velocityTransformTriangle(double dt, Triangle& dst,
- const Triangle& src);
+ void getGroundProperty(osg::Drawable* drawable,
+ const osg::NodePath& nodePath,
+ GroundProperty& gp, bool& backfaceCulling);
+ static void velocityTransformTriangle(double dt, SGTriangled& dst,
+ SGSphered& sdst, const Triangle& src);
+ void getTriIntersectorResults(osgUtil::PolytopeIntersector* triInt);
+ void getWireIntersectorResults(WireIntersector* wireInt,
+ double wireCacheRadius);
};
#endif