mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-06 09:55:35 +00:00
Add factory functions to create navigator implementations
This commit is contained in:
parent
b6d2c57de2
commit
5e99454cc4
@ -27,10 +27,7 @@
|
||||
|
||||
#include <components/sceneutil/positionattitudetransform.hpp>
|
||||
|
||||
#include <components/detournavigator/debug.hpp>
|
||||
#include <components/detournavigator/navigatorimpl.hpp>
|
||||
#include <components/detournavigator/navigatorstub.hpp>
|
||||
#include <components/detournavigator/recastglobalallocator.hpp>
|
||||
#include <components/detournavigator/navigator.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
@ -197,12 +194,11 @@ namespace MWWorld
|
||||
{
|
||||
auto navigatorSettings = DetourNavigator::makeSettingsFromSettingsManager();
|
||||
navigatorSettings.mSwimHeightScale = mSwimHeightScale;
|
||||
DetourNavigator::RecastGlobalAllocator::init();
|
||||
mNavigator.reset(new DetourNavigator::NavigatorImpl(navigatorSettings));
|
||||
mNavigator = DetourNavigator::makeNavigator(navigatorSettings);
|
||||
}
|
||||
else
|
||||
{
|
||||
mNavigator.reset(new DetourNavigator::NavigatorStub());
|
||||
mNavigator = DetourNavigator::makeNavigatorStub();
|
||||
}
|
||||
|
||||
mRendering.reset(new MWRender::RenderingManager(viewer, rootNode, resourceSystem, workQueue, resourcePath, *mNavigator));
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "findrandompointaroundcircle.hpp"
|
||||
#include "navigator.hpp"
|
||||
#include "raycast.hpp"
|
||||
#include "navigatorimpl.hpp"
|
||||
#include "navigatorstub.hpp"
|
||||
#include "recastglobalallocator.hpp"
|
||||
|
||||
namespace DetourNavigator
|
||||
{
|
||||
@ -33,4 +36,15 @@ namespace DetourNavigator
|
||||
return {};
|
||||
return fromNavMeshCoordinates(settings, *result);
|
||||
}
|
||||
|
||||
std::unique_ptr<Navigator> makeNavigator(const Settings& settings)
|
||||
{
|
||||
DetourNavigator::RecastGlobalAllocator::init();
|
||||
return std::make_unique<NavigatorImpl>(settings);
|
||||
}
|
||||
|
||||
std::unique_ptr<Navigator> makeNavigatorStub()
|
||||
{
|
||||
return std::make_unique<NavigatorStub>();
|
||||
}
|
||||
}
|
||||
|
@ -240,6 +240,10 @@ namespace DetourNavigator
|
||||
|
||||
virtual float getMaxNavmeshAreaRealRadius() const = 0;
|
||||
};
|
||||
|
||||
std::unique_ptr<Navigator> makeNavigator(const Settings& settings);
|
||||
|
||||
std::unique_ptr<Navigator> makeNavigatorStub();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user