Recast Navigation
Navigation-mesh Toolset for Games
Loading...
Searching...
No Matches
Tool_NavMeshPrune.h
Go to the documentation of this file.
1//
2// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
3//
4// This software is provided 'as-is', without any express or implied
5// warranty. In no event will the authors be held liable for any damages
6// arising from the use of this software.
7// Permission is granted to anyone to use this software for any purpose,
8// including commercial applications, and to alter it and redistribute it
9// freely, subject to the following restrictions:
10// 1. The origin of this software must not be misrepresented; you must not
11// claim that you wrote the original software. If you use this software
12// in a product, an acknowledgment in the product documentation would be
13// appreciated but is not required.
14// 2. Altered source versions must be plainly marked as such, and must not be
15// misrepresented as being the original software.
16// 3. This notice may not be removed or altered from any source distribution.
17//
18
19#pragma once
20
21#include "DetourAssert.h"
22#include "DetourNavMesh.h"
23#include "Sample.h"
24
26{
27 const dtNavMesh* navmesh = nullptr;
28 std::vector<std::vector<unsigned char>> tileFlags;
29
30public:
31 void init(const dtNavMesh* newNavmesh);
32 void clearAllFlags();
33 [[nodiscard]] unsigned char getFlags(dtPolyRef ref) const;
34 void setFlags(dtPolyRef ref, unsigned char flags);
35};
36
39{
40 Sample* sample = nullptr;
41 NavmeshFlags* flags = nullptr;
42 float hitPos[3];
43 bool hitPosSet = false;
44
45public:
46 NavMeshPruneTool() = default;
47 ~NavMeshPruneTool() override;
52
54 void init(Sample* newSample) override { sample = newSample; }
55 void reset() override;
56 void drawMenuUI() override;
57 void onClick(const float* s, const float* p, bool shift) override;
58 void onToggle() override {}
59 void singleStep() override {}
60 void update(const float /*dt*/) override {}
61 void render() override;
62 void drawOverlayUI() override;
63};
SampleToolType
Tool types.
Definition Sample.h:33
Prune navmesh to only accessible locations from a point.
Definition Tool_NavMeshPrune.h:39
void singleStep() override
Definition Tool_NavMeshPrune.h:59
~NavMeshPruneTool() override
Definition Tool_NavMeshPrune.cpp:156
NavMeshPruneTool & operator=(const NavMeshPruneTool &&)=delete
void init(Sample *newSample) override
Definition Tool_NavMeshPrune.h:54
void drawOverlayUI() override
Definition Tool_NavMeshPrune.cpp:280
void render() override
Definition Tool_NavMeshPrune.cpp:239
SampleToolType type() override
Definition Tool_NavMeshPrune.h:53
NavMeshPruneTool & operator=(const NavMeshPruneTool &)=delete
NavMeshPruneTool(const NavMeshPruneTool &)=delete
NavMeshPruneTool()=default
void update(const float) override
Definition Tool_NavMeshPrune.h:60
void drawMenuUI() override
Definition Tool_NavMeshPrune.cpp:168
void onToggle() override
Definition Tool_NavMeshPrune.h:58
void onClick(const float *s, const float *p, bool shift) override
Definition Tool_NavMeshPrune.cpp:194
NavMeshPruneTool(const NavMeshPruneTool &&)=delete
void reset() override
Definition Tool_NavMeshPrune.cpp:161
Definition Tool_NavMeshPrune.h:26
unsigned char getFlags(dtPolyRef ref) const
Definition Tool_NavMeshPrune.cpp:132
void init(const dtNavMesh *newNavmesh)
Definition Tool_NavMeshPrune.cpp:96
void setFlags(dtPolyRef ref, unsigned char flags)
Definition Tool_NavMeshPrune.cpp:144
void clearAllFlags()
Definition Tool_NavMeshPrune.cpp:121
Definition Sample.h:116
A navigation mesh based on tiles of convex polygons.
Definition DetourNavMesh.h:336
unsigned int dtPolyRef
A handle to a polygon within a navigation mesh tile.
Definition DetourNavMesh.h:48
Definition Sample.h:85