2020-01-20 22:06:47 +00:00
|
|
|
#include "navigator.hpp"
|
2021-11-05 23:14:41 +00:00
|
|
|
#include "navigatorimpl.hpp"
|
|
|
|
#include "navigatorstub.hpp"
|
|
|
|
#include "recastglobalallocator.hpp"
|
2020-01-20 22:06:47 +00:00
|
|
|
|
2022-01-27 20:18:01 +00:00
|
|
|
#include <components/debug/debuglog.hpp>
|
|
|
|
|
2020-01-20 22:06:47 +00:00
|
|
|
namespace DetourNavigator
|
|
|
|
{
|
2021-07-09 20:51:42 +00:00
|
|
|
std::unique_ptr<Navigator> makeNavigator(const Settings& settings, const std::string& userDataPath)
|
2021-11-05 23:14:41 +00:00
|
|
|
{
|
|
|
|
DetourNavigator::RecastGlobalAllocator::init();
|
2021-07-09 20:51:42 +00:00
|
|
|
|
|
|
|
std::unique_ptr<NavMeshDb> db;
|
|
|
|
if (settings.mEnableNavMeshDiskCache)
|
2022-01-27 20:18:01 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2022-03-10 17:34:35 +00:00
|
|
|
db = std::make_unique<NavMeshDb>(userDataPath + "/navmesh.db", settings.mMaxDbFileSize);
|
2022-01-27 20:18:01 +00:00
|
|
|
}
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
|
|
|
Log(Debug::Error) << e.what() << ", navigation mesh disk cache will be disabled";
|
|
|
|
}
|
|
|
|
}
|
2021-07-09 20:51:42 +00:00
|
|
|
|
|
|
|
return std::make_unique<NavigatorImpl>(settings, std::move(db));
|
2021-11-05 23:14:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<Navigator> makeNavigatorStub()
|
|
|
|
{
|
|
|
|
return std::make_unique<NavigatorStub>();
|
|
|
|
}
|
2020-01-20 22:06:47 +00:00
|
|
|
}
|