mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
Add command to enable NavMesh render
togglenavmesh or tnm
This commit is contained in:
parent
1caa18bb4f
commit
70a369f70e
25 changed files with 436 additions and 22 deletions
22
components/sceneutil/navmesh.cpp
Normal file
22
components/sceneutil/navmesh.cpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
#include "navmesh.hpp"
|
||||
#include "detourdebugdraw.hpp"
|
||||
|
||||
#include <components/detournavigator/settings.hpp>
|
||||
|
||||
#include <DetourDebugDraw.h>
|
||||
|
||||
#include <osg/Group>
|
||||
|
||||
namespace SceneUtil
|
||||
{
|
||||
osg::ref_ptr<osg::Group> createNavMeshGroup(const dtNavMesh& navMesh, const DetourNavigator::Settings& settings)
|
||||
{
|
||||
const osg::ref_ptr<osg::Group> group(new osg::Group);
|
||||
DebugDraw debugDraw(*group, osg::Vec3f(0, 0, 10), 1.0f / settings.mRecastScaleFactor);
|
||||
dtNavMeshQuery navMeshQuery;
|
||||
navMeshQuery.init(&navMesh, settings.mMaxNavMeshQueryNodes);
|
||||
duDebugDrawNavMeshWithClosedList(&debugDraw, navMesh, navMeshQuery,
|
||||
DU_DRAWNAVMESH_OFFMESHCONS | DU_DRAWNAVMESH_CLOSEDLIST);
|
||||
return group;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue