mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 22:15:32 +00:00
Add option to disable DetourNavigator component to find paths
This commit is contained in:
parent
34c594f01e
commit
9626b6ec42
5 changed files with 110 additions and 11 deletions
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include <components/detournavigator/debug.hpp>
|
#include <components/detournavigator/debug.hpp>
|
||||||
#include <components/detournavigator/navigatorimpl.hpp>
|
#include <components/detournavigator/navigatorimpl.hpp>
|
||||||
|
#include <components/detournavigator/navigatorstub.hpp>
|
||||||
#include <components/detournavigator/recastglobalallocator.hpp>
|
#include <components/detournavigator/recastglobalallocator.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
|
@ -198,15 +199,21 @@ namespace MWWorld
|
||||||
|
|
||||||
mPhysics.reset(new MWPhysics::PhysicsSystem(resourceSystem, rootNode));
|
mPhysics.reset(new MWPhysics::PhysicsSystem(resourceSystem, rootNode));
|
||||||
|
|
||||||
auto navigatorSettings = DetourNavigator::makeSettingsFromSettingsManager();
|
if (auto navigatorSettings = DetourNavigator::makeSettingsFromSettingsManager())
|
||||||
navigatorSettings.mMaxClimb = MWPhysics::sStepSizeUp;
|
{
|
||||||
navigatorSettings.mMaxSlope = MWPhysics::sMaxSlope;
|
navigatorSettings->mMaxClimb = MWPhysics::sStepSizeUp;
|
||||||
navigatorSettings.mSwimHeightScale = mSwimHeightScale;
|
navigatorSettings->mMaxSlope = MWPhysics::sMaxSlope;
|
||||||
if (Settings::Manager::getBool("enable log", "Navigator"))
|
navigatorSettings->mSwimHeightScale = mSwimHeightScale;
|
||||||
DetourNavigator::Log::instance().setSink(std::unique_ptr<DetourNavigator::FileSink>(
|
if (Settings::Manager::getBool("enable log", "Navigator"))
|
||||||
new DetourNavigator::FileSink(Settings::Manager::getString("log path", "Navigator"))));
|
DetourNavigator::Log::instance().setSink(std::unique_ptr<DetourNavigator::FileSink>(
|
||||||
DetourNavigator::RecastGlobalAllocator::init();
|
new DetourNavigator::FileSink(Settings::Manager::getString("log path", "Navigator"))));
|
||||||
mNavigator.reset(new DetourNavigator::NavigatorImpl(navigatorSettings));
|
DetourNavigator::RecastGlobalAllocator::init();
|
||||||
|
mNavigator.reset(new DetourNavigator::NavigatorImpl(*navigatorSettings));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mNavigator.reset(new DetourNavigator::NavigatorStub());
|
||||||
|
}
|
||||||
|
|
||||||
mRendering.reset(new MWRender::RenderingManager(viewer, rootNode, resourceSystem, workQueue, &mFallback, resourcePath, *mNavigator));
|
mRendering.reset(new MWRender::RenderingManager(viewer, rootNode, resourceSystem, workQueue, &mFallback, resourcePath, *mNavigator));
|
||||||
mProjectileManager.reset(new ProjectileManager(mRendering->getLightRoot(), resourceSystem, mRendering.get(), mPhysics.get()));
|
mProjectileManager.reset(new ProjectileManager(mRendering->getLightRoot(), resourceSystem, mRendering.get(), mPhysics.get()));
|
||||||
|
|
83
components/detournavigator/navigatorstub.hpp
Normal file
83
components/detournavigator/navigatorstub.hpp
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_NAVIGATORSTUB_H
|
||||||
|
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_NAVIGATORSTUB_H
|
||||||
|
|
||||||
|
#include "navigator.hpp"
|
||||||
|
|
||||||
|
namespace DetourNavigator
|
||||||
|
{
|
||||||
|
struct NavigatorStub final : public Navigator
|
||||||
|
{
|
||||||
|
NavigatorStub() = default;
|
||||||
|
|
||||||
|
void addAgent(const osg::Vec3f& /*agentHalfExtents*/) override {}
|
||||||
|
|
||||||
|
void removeAgent(const osg::Vec3f& /*agentHalfExtents*/) override {}
|
||||||
|
|
||||||
|
bool addObject(const ObjectId /*id*/, const btCollisionShape& /*shape*/, const btTransform& /*transform*/) override
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool addObject(const ObjectId /*id*/, const ObjectShapes& /*shapes*/, const btTransform& /*transform*/) override
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool addObject(const ObjectId /*id*/, const DoorShapes& /*shapes*/, const btTransform& /*transform*/) override
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool updateObject(const ObjectId /*id*/, const btCollisionShape& /*shape*/, const btTransform& /*transform*/) override
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool updateObject(const ObjectId /*id*/, const ObjectShapes& /*shapes*/, const btTransform& /*transform*/) override
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool updateObject(const ObjectId /*id*/, const DoorShapes& /*shapes*/, const btTransform& /*transform*/) override
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool removeObject(const ObjectId /*id*/) override
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool addWater(const osg::Vec2i& /*cellPosition*/, const int /*cellSize*/, const btScalar /*level*/,
|
||||||
|
const btTransform& /*transform*/) override
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool removeWater(const osg::Vec2i& /*cellPosition*/) override
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void update(const osg::Vec3f& /*playerPosition*/) override {}
|
||||||
|
|
||||||
|
void wait() override {}
|
||||||
|
|
||||||
|
SharedNavMeshCacheItem getNavMesh(const osg::Vec3f& /*agentHalfExtents*/) const override
|
||||||
|
{
|
||||||
|
return SharedNavMeshCacheItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::map<osg::Vec3f, SharedNavMeshCacheItem> getNavMeshes() const override
|
||||||
|
{
|
||||||
|
return std::map<osg::Vec3f, SharedNavMeshCacheItem>();
|
||||||
|
}
|
||||||
|
|
||||||
|
Settings getSettings() const override
|
||||||
|
{
|
||||||
|
return Settings {};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -6,8 +6,11 @@
|
||||||
|
|
||||||
namespace DetourNavigator
|
namespace DetourNavigator
|
||||||
{
|
{
|
||||||
Settings makeSettingsFromSettingsManager()
|
boost::optional<Settings> makeSettingsFromSettingsManager()
|
||||||
{
|
{
|
||||||
|
if (!::Settings::Manager::getBool("enable", "Navigator"))
|
||||||
|
return boost::optional<Settings>();
|
||||||
|
|
||||||
Settings navigatorSettings;
|
Settings navigatorSettings;
|
||||||
|
|
||||||
navigatorSettings.mBorderSize = ::Settings::Manager::getInt("border size", "Navigator");
|
navigatorSettings.mBorderSize = ::Settings::Manager::getInt("border size", "Navigator");
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_SETTINGS_H
|
#ifndef OPENMW_COMPONENTS_DETOURNAVIGATOR_SETTINGS_H
|
||||||
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_SETTINGS_H
|
#define OPENMW_COMPONENTS_DETOURNAVIGATOR_SETTINGS_H
|
||||||
|
|
||||||
|
#include <boost/optional.hpp>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace DetourNavigator
|
namespace DetourNavigator
|
||||||
|
@ -37,7 +39,7 @@ namespace DetourNavigator
|
||||||
std::string mNavMeshPathPrefix;
|
std::string mNavMeshPathPrefix;
|
||||||
};
|
};
|
||||||
|
|
||||||
Settings makeSettingsFromSettingsManager();
|
boost::optional<Settings> makeSettingsFromSettingsManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -542,6 +542,10 @@ companion h = 0.63
|
||||||
|
|
||||||
[Navigator]
|
[Navigator]
|
||||||
|
|
||||||
|
# Enable navigator (true, false). When enabled background threads are started to build navmesh for world geometry.
|
||||||
|
# Pathfinding system uses navmesh to build paths. When disabled only pathgrid is used to build paths.
|
||||||
|
enable = true
|
||||||
|
|
||||||
# Scale of NavMesh coordinates to world coordinates (value > 0.0). Recastnavigation builds voxels for world geometry.
|
# Scale of NavMesh coordinates to world coordinates (value > 0.0). Recastnavigation builds voxels for world geometry.
|
||||||
# Basically voxel size is 1 / "cell size". To reduce amount of voxels we apply scale factor, to make voxel size
|
# Basically voxel size is 1 / "cell size". To reduce amount of voxels we apply scale factor, to make voxel size
|
||||||
# "recast scale factor" / "cell size". Default value calculates by this equation:
|
# "recast scale factor" / "cell size". Default value calculates by this equation:
|
||||||
|
|
Loading…
Reference in a new issue