some refactorings/fixes
worked on nav-mesh stuff new tests
This commit is contained in:
@@ -11,7 +11,9 @@
|
||||
namespace NM {
|
||||
|
||||
/** distance/neighbor-to-the target for each of the 3 triangle edge points */
|
||||
struct NavMeshTriangleDijkstra {
|
||||
class NavMeshTriangleDijkstra {
|
||||
|
||||
public:
|
||||
|
||||
/** next hop towards the pedestrian's target */
|
||||
struct ToTarget {
|
||||
@@ -47,8 +49,12 @@ namespace NM {
|
||||
ToTarget spFromP3;
|
||||
|
||||
/** interpolate the distance towards the garget for the given point */
|
||||
template <typename T> float getDistanceToDestination(const Point3 p) const {
|
||||
return T::interpolate(p, spFromP1.distance, spFromP2.distance, spFromP3.distance);
|
||||
template <typename UserTriangleClass> float getDistanceToDestination(const Point3 p) const {
|
||||
// this one is a little bit awkward.. normally NavMeshTriangleDijkstra should extend NavMeshTriangle..
|
||||
// however, this often yields issues for user-classes, extending NavMeshTriangle more than once
|
||||
StaticAssert::AinheritsB<UserTriangleClass, NavMeshTriangle>();
|
||||
const UserTriangleClass* userClass = static_cast<const UserTriangleClass*>(this); // must inherit NavMeshTriangle
|
||||
return userClass->interpolate(p, spFromP1.distance, spFromP2.distance, spFromP3.distance);
|
||||
}
|
||||
|
||||
/** get the next neighbor-point/triangle for the given point */
|
||||
|
||||
Reference in New Issue
Block a user