mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 14:57:44 +00:00
Add navi mesh folder to world config
This commit is contained in:
parent
86f74da325
commit
25713edbc9
3 changed files with 12 additions and 9 deletions
|
@ -10,7 +10,7 @@ Sapphire::World::Manager::NaviMgr::NaviMgr( FrameworkPtr pFw ) :
|
||||||
|
|
||||||
bool Sapphire::World::Manager::NaviMgr::setupTerritory( const std::string& internalName )
|
bool Sapphire::World::Manager::NaviMgr::setupTerritory( const std::string& internalName )
|
||||||
{
|
{
|
||||||
auto provider = Navi::make_NaviProvider( internalName );
|
auto provider = Navi::make_NaviProvider( internalName, m_pFw );
|
||||||
|
|
||||||
if( provider->init() )
|
if( provider->init() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#include <Framework.h>
|
#include <Framework.h>
|
||||||
#include <Territory/Zone.h>
|
#include <Territory/Zone.h>
|
||||||
#include <Logging/Logger.h>
|
#include <Logging/Logger.h>
|
||||||
|
#include <Config/ConfigMgr.h>
|
||||||
|
|
||||||
|
|
||||||
#include "NaviProvider.h"
|
#include "NaviProvider.h"
|
||||||
|
|
||||||
|
@ -11,21 +13,21 @@
|
||||||
#include <recastnavigation/Recast/Include/Recast.h>
|
#include <recastnavigation/Recast/Include/Recast.h>
|
||||||
#include <experimental/filesystem>
|
#include <experimental/filesystem>
|
||||||
|
|
||||||
|
Sapphire::World::Navi::NaviProvider::NaviProvider( const std::string& internalName, FrameworkPtr pFw ) :
|
||||||
Sapphire::World::Navi::NaviProvider::NaviProvider( const std::string& internalName ) :
|
|
||||||
m_naviMesh( nullptr ),
|
m_naviMesh( nullptr ),
|
||||||
m_naviMeshQuery( nullptr ),
|
m_naviMeshQuery( nullptr ),
|
||||||
m_internalName( internalName )
|
m_internalName( internalName ),
|
||||||
|
m_pFw( pFw )
|
||||||
{
|
{
|
||||||
// Set defaults
|
// Set defaults
|
||||||
m_polyFindRange[0] = 10;
|
m_polyFindRange[ 0 ] = 10;
|
||||||
m_polyFindRange[1] = 20;
|
m_polyFindRange[ 1 ] = 20;
|
||||||
m_polyFindRange[2] = 10;
|
m_polyFindRange[ 2 ] = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sapphire::World::Navi::NaviProvider::init()
|
bool Sapphire::World::Navi::NaviProvider::init()
|
||||||
{
|
{
|
||||||
auto meshesFolder = std::experimental::filesystem::path( "navi" );
|
auto meshesFolder = std::experimental::filesystem::path( m_pFw->get< Sapphire::ConfigMgr >()->getValue< std::string >( "Navigation", "MeshPath", "navi" ) );
|
||||||
auto meshFolder = meshesFolder / std::experimental::filesystem::path( m_internalName );
|
auto meshFolder = meshesFolder / std::experimental::filesystem::path( m_internalName );
|
||||||
|
|
||||||
if( std::experimental::filesystem::exists( meshFolder ) )
|
if( std::experimental::filesystem::exists( meshFolder ) )
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace Sapphire::World::Navi
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit NaviProvider( const std::string& internalName );
|
explicit NaviProvider( const std::string& internalName, FrameworkPtr pFw );
|
||||||
|
|
||||||
bool init();
|
bool init();
|
||||||
void loadMesh( const std::string& path );
|
void loadMesh( const std::string& path );
|
||||||
|
@ -60,6 +60,7 @@ namespace Sapphire::World::Navi
|
||||||
const dtPolyRef* path, const int32_t pathSize, float* steerPos, uint8_t& steerPosFlag,
|
const dtPolyRef* path, const int32_t pathSize, float* steerPos, uint8_t& steerPosFlag,
|
||||||
dtPolyRef& steerPosRef, float* outPoints = 0, int32_t* outPointCount = 0 );
|
dtPolyRef& steerPosRef, float* outPoints = 0, int32_t* outPointCount = 0 );
|
||||||
|
|
||||||
|
FrameworkPtr m_pFw;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue