]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/groundcache.hxx
Remove the StaticLeaf visitor methods.
[flightgear.git] / src / FDM / groundcache.hxx
index 48c46d938a949caaf6803a3684f353502b70f6c9..ea8cc16d76d6c7082be0a945e2d5039155d5ffd6 100644 (file)
 #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/structure/SGSharedPtr.hxx>
 
 class SGMaterial;
-class GroundCacheFillVisitor;
+namespace simgear {
+class BVHLineGeometry;
+}
 
 class FGGroundCache {
 public:
@@ -82,41 +89,14 @@ public:
     void release_wire(void);
 
 private:
-    friend class GroundCacheFillVisitor;
-
-    struct Triangle {
-      Triangle() : material(0) {}
-      // The triangle we represent
-      SGTriangled triangle;
-      SGSphered sphere;
-      // The linear and angular velocity.
-      SGVec3d velocity;
-      SGVec3d rotation;
-      SGVec3d rotation_pivot;
-      // Ground type
-      int type;
-      // the simgear material reference, contains friction coeficients ...
-      const SGMaterial* material;
-    };
-    struct Catapult {
-      SGVec3d start;
-      SGVec3d end;
-      SGVec3d velocity;
-      SGVec3d rotation;
-      SGVec3d rotation_pivot;
-    };
-    struct Wire {
-      SGVec3d ends[2];
-      SGVec3d velocity;
-      SGVec3d rotation;
-      SGVec3d rotation_pivot;
-      int wire_id;
-    };
-
+    class CacheFill;
+    class CatapultFinder;
+    class WireIntersector;
+    class WireFinder;
 
     // Approximate ground radius.
     // In case the aircraft is too high above ground.
-    double ground_radius;
+    double _altitude;
     // Ground type
     int _type;
     // the simgear material reference, contains friction coeficients ...
@@ -124,13 +104,8 @@ private:
     // The time reference for later call to intersection test routines.
     // Is required since we will have moving triangles in carriers.
     double cache_ref_time;
-    // The wire identifier to track.
-    int wire_id;
-
-    // Containers which hold all the essential information about this cache.
-    std::vector<Triangle> triangles;
-    std::vector<Catapult> catapults;
-    std::vector<Wire> wires;
+    // The wire to track.
+    const simgear::BVHLineGeometry* _wire;
 
     // The point and radius where the cache is built around.
     // That are the arguments that were given to prepare_ground_cache.
@@ -139,20 +114,7 @@ private:
     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, SGTriangled& dst,
-                                          SGSphered& sdst, const Triangle& src);
+    SGSharedPtr<simgear::BVHNode> _localBvhTree;
 };
 
 #endif