//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
#include <simgear/compiler.h>
#include <simgear/constants.h>
+class SGMaterial;
+
class FGGroundCache {
public:
FGGroundCache();
// Return the altitude above ground below the wgs84 point pt
- // Search for the nearest triangle to pt.
+ // Search for highest triangle not higher than pt + max_altoff.
// Return ground properties like the ground type, the maximum load
// this kind kind of ground can carry, the friction factor between
// 0 and 1 which can be used to model lower friction with wet runways
// and finally the altitude above ground.
- bool get_agl(double t, const double pt[3],
+ bool get_agl(double t, const double pt[3], double max_altoff,
double contact[3], double normal[3], double vel[3],
- int *type, double *loadCapacity,
- double *frictionFactor, double *agl);
-
+ int *type, const SGMaterial** material, double *agl);
// Return 1 if the hook intersects with a wire.
// That test is done by checking if the quad spanned by the points pt*
private:
struct Triangle {
+ Triangle() : material(0) {}
// The edge vertices.
sgdVec3 vertices[3];
// The surface normal.
sgdVec4 plane;
// The bounding shpere.
sgdSphere sphere;
- // The linear velocity.
+ // The linear and angular velocity.
sgdVec3 velocity;
+ sgdVec3 rotation;
+ sgdVec3 rotation_pivot;
// Ground type
int type;
+ // the simgear material reference, contains friction coeficients ...
+ const SGMaterial* material;
};
struct Catapult {
sgdVec3 start;
sgdVec3 end;
sgdVec3 velocity;
+ sgdVec3 rotation;
+ sgdVec3 rotation_pivot;
};
struct Wire {
sgdVec3 ends[2];
sgdVec3 velocity;
+ sgdVec3 rotation;
+ sgdVec3 rotation_pivot;
int wire_id;
};
// Helper class to hold some properties of the ground triangle.
struct GroundProperty {
- GroundProperty() : type(0) {}
+ GroundProperty() : type(0), material(0) {}
int type;
int wire_id;
- sgVec3 vel;
- // not yet implemented ...
-// double loadCapacity;
+ sgdVec3 vel;
+ sgdVec3 rot;
+ sgdVec3 pivot;
+ const SGMaterial* material;
};
// compute the ground property of this leaf.