|
|
|
@ -127,7 +127,7 @@ namespace
|
|
|
|
|
mNavigator->addAgent(mAgentHalfExtents);
|
|
|
|
|
mNavigator->addObject(ObjectId(&shape), shape, btTransform::getIdentity());
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait(mListener);
|
|
|
|
|
mNavigator->wait(mListener, WaitConditionType::requiredTilesPresent);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mAreaCosts, mOut), Status::Success);
|
|
|
|
|
|
|
|
|
@ -177,7 +177,7 @@ namespace
|
|
|
|
|
mNavigator->addAgent(mAgentHalfExtents);
|
|
|
|
|
mNavigator->addObject(ObjectId(&heightfieldShape), heightfieldShape, btTransform::getIdentity());
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait(mListener);
|
|
|
|
|
mNavigator->wait(mListener, WaitConditionType::allJobsDone);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mAreaCosts, mOut), Status::Success);
|
|
|
|
|
|
|
|
|
@ -209,7 +209,7 @@ namespace
|
|
|
|
|
|
|
|
|
|
mNavigator->addObject(ObjectId(&compoundShape), compoundShape, btTransform::getIdentity());
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait(mListener);
|
|
|
|
|
mNavigator->wait(mListener, WaitConditionType::allJobsDone);
|
|
|
|
|
|
|
|
|
|
mPath.clear();
|
|
|
|
|
mOut = std::back_inserter(mPath);
|
|
|
|
@ -262,7 +262,7 @@ namespace
|
|
|
|
|
mNavigator->addObject(ObjectId(&heightfieldShape), heightfieldShape, btTransform::getIdentity());
|
|
|
|
|
mNavigator->addObject(ObjectId(&compoundShape), compoundShape, btTransform::getIdentity());
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait(mListener);
|
|
|
|
|
mNavigator->wait(mListener, WaitConditionType::allJobsDone);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mAreaCosts, mOut), Status::Success);
|
|
|
|
|
|
|
|
|
@ -296,7 +296,7 @@ namespace
|
|
|
|
|
|
|
|
|
|
mNavigator->updateObject(ObjectId(&compoundShape), compoundShape, btTransform::getIdentity());
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait(mListener);
|
|
|
|
|
mNavigator->wait(mListener, WaitConditionType::allJobsDone);
|
|
|
|
|
|
|
|
|
|
mPath.clear();
|
|
|
|
|
mOut = std::back_inserter(mPath);
|
|
|
|
@ -355,7 +355,7 @@ namespace
|
|
|
|
|
mNavigator->addObject(ObjectId(&shape), shape, btTransform::getIdentity());
|
|
|
|
|
mNavigator->addObject(ObjectId(&shape2), shape2, btTransform::getIdentity());
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait(mListener);
|
|
|
|
|
mNavigator->wait(mListener, WaitConditionType::allJobsDone);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mAreaCosts, mOut), Status::Success);
|
|
|
|
|
|
|
|
|
@ -411,7 +411,7 @@ namespace
|
|
|
|
|
mNavigator->addAgent(mAgentHalfExtents);
|
|
|
|
|
mNavigator->addObject(ObjectId(&shape), ObjectShapes {shape, &shapeAvoid}, btTransform::getIdentity());
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait(mListener);
|
|
|
|
|
mNavigator->wait(mListener, WaitConditionType::allJobsDone);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mAreaCosts, mOut), Status::Success);
|
|
|
|
|
|
|
|
|
@ -459,7 +459,7 @@ namespace
|
|
|
|
|
mNavigator->addWater(osg::Vec2i(0, 0), 128 * 4, 300, btTransform::getIdentity());
|
|
|
|
|
mNavigator->addObject(ObjectId(&shape), shape, btTransform::getIdentity());
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait(mListener);
|
|
|
|
|
mNavigator->wait(mListener, WaitConditionType::allJobsDone);
|
|
|
|
|
|
|
|
|
|
mStart.x() = 0;
|
|
|
|
|
mStart.z() = 300;
|
|
|
|
@ -507,7 +507,7 @@ namespace
|
|
|
|
|
mNavigator->addWater(osg::Vec2i(0, 0), 128 * 4, -25, btTransform::getIdentity());
|
|
|
|
|
mNavigator->addObject(ObjectId(&shape), shape, btTransform::getIdentity());
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait(mListener);
|
|
|
|
|
mNavigator->wait(mListener, WaitConditionType::allJobsDone);
|
|
|
|
|
|
|
|
|
|
mStart.x() = 0;
|
|
|
|
|
mEnd.x() = 0;
|
|
|
|
@ -554,7 +554,7 @@ namespace
|
|
|
|
|
mNavigator->addObject(ObjectId(&shape), shape, btTransform::getIdentity());
|
|
|
|
|
mNavigator->addWater(osg::Vec2i(0, 0), std::numeric_limits<int>::max(), -25, btTransform::getIdentity());
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait(mListener);
|
|
|
|
|
mNavigator->wait(mListener, WaitConditionType::allJobsDone);
|
|
|
|
|
|
|
|
|
|
mStart.x() = 0;
|
|
|
|
|
mEnd.x() = 0;
|
|
|
|
@ -601,7 +601,7 @@ namespace
|
|
|
|
|
mNavigator->addWater(osg::Vec2i(0, 0), 128 * 4, -25, btTransform::getIdentity());
|
|
|
|
|
mNavigator->addObject(ObjectId(&shape), shape, btTransform::getIdentity());
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait(mListener);
|
|
|
|
|
mNavigator->wait(mListener, WaitConditionType::allJobsDone);
|
|
|
|
|
|
|
|
|
|
mStart.x() = 0;
|
|
|
|
|
mEnd.x() = 0;
|
|
|
|
@ -645,15 +645,15 @@ namespace
|
|
|
|
|
mNavigator->addAgent(mAgentHalfExtents);
|
|
|
|
|
mNavigator->addObject(ObjectId(&shape), shape, btTransform::getIdentity());
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait(mListener);
|
|
|
|
|
mNavigator->wait(mListener, WaitConditionType::allJobsDone);
|
|
|
|
|
|
|
|
|
|
mNavigator->removeObject(ObjectId(&shape));
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait(mListener);
|
|
|
|
|
mNavigator->wait(mListener, WaitConditionType::allJobsDone);
|
|
|
|
|
|
|
|
|
|
mNavigator->addObject(ObjectId(&shape), shape, btTransform::getIdentity());
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait(mListener);
|
|
|
|
|
mNavigator->wait(mListener, WaitConditionType::allJobsDone);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mAreaCosts, mOut), Status::Success);
|
|
|
|
|
|
|
|
|
@ -699,7 +699,7 @@ namespace
|
|
|
|
|
mNavigator->addAgent(mAgentHalfExtents);
|
|
|
|
|
mNavigator->addObject(ObjectId(&shape), shape, btTransform::getIdentity());
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait(mListener);
|
|
|
|
|
mNavigator->wait(mListener, WaitConditionType::allJobsDone);
|
|
|
|
|
|
|
|
|
|
Misc::Rng::init(42);
|
|
|
|
|
|
|
|
|
@ -748,7 +748,7 @@ namespace
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait(mListener);
|
|
|
|
|
mNavigator->wait(mListener, WaitConditionType::allJobsDone);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mAreaCosts, mOut), Status::Success);
|
|
|
|
|
|
|
|
|
@ -791,7 +791,7 @@ namespace
|
|
|
|
|
mNavigator->addObject(ObjectId(&shapes[i]), shapes[i], transform);
|
|
|
|
|
}
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait(mListener);
|
|
|
|
|
mNavigator->wait(mListener, WaitConditionType::allJobsDone);
|
|
|
|
|
|
|
|
|
|
const auto start = std::chrono::steady_clock::now();
|
|
|
|
|
for (std::size_t i = 0; i < shapes.size(); ++i)
|
|
|
|
@ -800,7 +800,7 @@ namespace
|
|
|
|
|
mNavigator->updateObject(ObjectId(&shapes[i]), shapes[i], transform);
|
|
|
|
|
}
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait(mListener);
|
|
|
|
|
mNavigator->wait(mListener, WaitConditionType::allJobsDone);
|
|
|
|
|
|
|
|
|
|
for (std::size_t i = 0; i < shapes.size(); ++i)
|
|
|
|
|
{
|
|
|
|
@ -808,7 +808,7 @@ namespace
|
|
|
|
|
mNavigator->updateObject(ObjectId(&shapes[i]), shapes[i], transform);
|
|
|
|
|
}
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait(mListener);
|
|
|
|
|
mNavigator->wait(mListener, WaitConditionType::allJobsDone);
|
|
|
|
|
|
|
|
|
|
const auto duration = std::chrono::steady_clock::now() - start;
|
|
|
|
|
|
|
|
|
@ -831,7 +831,7 @@ namespace
|
|
|
|
|
mNavigator->addAgent(mAgentHalfExtents);
|
|
|
|
|
mNavigator->addObject(ObjectId(&shape), shape, btTransform::getIdentity());
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait(mListener);
|
|
|
|
|
mNavigator->wait(mListener, WaitConditionType::allJobsDone);
|
|
|
|
|
|
|
|
|
|
const auto result = mNavigator->raycast(mAgentHalfExtents, mStart, mEnd, Flag_walk);
|
|
|
|
|
|
|
|
|
@ -862,7 +862,7 @@ namespace
|
|
|
|
|
mNavigator->addObject(ObjectId(&boderBoxShape), boderBoxShape,
|
|
|
|
|
btTransform(btMatrix3x3::getIdentity(), oscillatingBoxShapePosition + btVector3(0, 0, 200)));
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait(mListener);
|
|
|
|
|
mNavigator->wait(mListener, WaitConditionType::allJobsDone);
|
|
|
|
|
|
|
|
|
|
const auto navMeshes = mNavigator->getNavMeshes();
|
|
|
|
|
ASSERT_EQ(navMeshes.size(), 1);
|
|
|
|
@ -878,7 +878,7 @@ namespace
|
|
|
|
|
oscillatingBoxShapePosition);
|
|
|
|
|
mNavigator->updateObject(ObjectId(&oscillatingBoxShape), oscillatingBoxShape, transform);
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait(mListener);
|
|
|
|
|
mNavigator->wait(mListener, WaitConditionType::allJobsDone);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ASSERT_EQ(navMeshes.size(), 1);
|
|
|
|
|