minor changes to floorplan
fixed some compile issues worked on nav-meshes added some tests
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "../../geo/Heading.h"
|
||||
#include "../NavMeshLocation.h"
|
||||
#include "../NavMeshType.h"
|
||||
|
||||
namespace NM {
|
||||
|
||||
@@ -20,12 +21,18 @@ namespace NM {
|
||||
|
||||
Assert::isTrue(isValid(), "invalid step-sizes given");
|
||||
|
||||
if (start.tria->isPlain()) {
|
||||
return stepSizeFloor_m * steps;
|
||||
} else {
|
||||
if (start.tria->getType() == (int) NM::NavMeshType::STAIR_SKEWED) {
|
||||
return stepSizeStair_m * steps;
|
||||
} else {
|
||||
return stepSizeFloor_m * steps;
|
||||
}
|
||||
|
||||
// if (start.tria->isPlain()) {
|
||||
// return stepSizeFloor_m * steps;
|
||||
// } else {
|
||||
// return stepSizeStair_m * steps;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
@@ -36,9 +43,6 @@ namespace NM {
|
||||
/** walk starts here (pos/tria) */
|
||||
NavMeshLocation<Tria> start;
|
||||
|
||||
// /** to-be-walked distance */
|
||||
// float distance_m;
|
||||
|
||||
/** direction to walk to */
|
||||
Heading heading;
|
||||
|
||||
@@ -54,9 +58,17 @@ namespace NM {
|
||||
|
||||
/** get the to-be-walked distance (steps vs. current location [stair/floor/..]) */
|
||||
float getToBeWalkedDistance() const {
|
||||
return stepSizes.inMeter(numSteps, start);
|
||||
if (_toBeWalkedDistance != _toBeWalkedDistance) {
|
||||
_toBeWalkedDistance = stepSizes.inMeter(numSteps, start);
|
||||
}
|
||||
return _toBeWalkedDistance;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
// precalc
|
||||
mutable float _toBeWalkedDistance = NAN;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user