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