Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
DivideRecast.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2018 DIVIDE-Studio
3 Copyright (c) 2009 Ionut Cava
4
5 This file is part of DIVIDE Framework.
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software
9 and associated documentation files (the "Software"), to deal in the Software
10 without restriction,
11 including without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense,
13 and/or sell copies of the Software, and to permit persons to whom the
14 Software is furnished to do so,
15 subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 IMPLIED,
22 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23 PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25 DAMAGES OR OTHER LIABILITY,
26 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27 IN CONNECTION WITH THE SOFTWARE
28 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30 */
31
32/*
33 OgreCrowd
34 ---------
35
36 Copyright (c) 2012 Jonas Hauquier
37
38 Additional contributions by:
39
40 - mkultra333
41 - Paul Wilson
42
43 Sincere thanks and to:
44
45 - Mikko Mononen (developer of Recast navigation libraries)
46
47 Permission is hereby granted, free of charge, to any person obtaining a copy
48 of this software and associated documentation files (the "Software"), to
49 deal
50 in the Software without restriction, including without limitation the rights
51 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
52 copies of the Software, and to permit persons to whom the Software is
53 furnished to do so, subject to the following conditions:
54
55 The above copyright notice and this permission notice shall be included in
56 all copies or substantial portions of the Software.
57
58 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
59 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
60 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
61 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
62 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
63 FROM,
64 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
65 THE SOFTWARE.
66
67*/
68
69#pragma once
70#ifndef DVD_NAVIGATION_PATH_H_
71#define DVD_NAVIGATION_PATH_H_
72
74
75namespace Divide {
76namespace AI {
77namespace Navigation {
78
80 public:
82
107 PathErrorCode FindPath(const NavigationMesh& navMesh, const vec3<F32>& startPos,
108 const vec3<F32>& endPos, U32 pathSlot, I32 target);
116 vector<vec3<F32> > getPath(I32 pathSlot);
124 I32 getTarget(I32 pathSlot) noexcept;
128 bool getRandomNavMeshPoint(const NavigationMesh& navMesh, vec3<F32>& resultPt) const;
132 bool getRandomPointAroundCircle(const NavigationMesh& navMesh,
133 const vec3<F32>& centerPosition, F32 radius,
134 const vec3<F32>& extents, vec3<F32>& resultPt,
135 U8 maxIters) const;
143 bool findNearestPointOnNavmesh(const NavigationMesh& navMesh,
144 const vec3<F32>& position,
145 const vec3<F32>& extents, F32 delta,
146 vec3<F32>& resultPt, dtPolyRef& resultPoly) const;
147
148 bool findNearestPolyOnNavmesh(const NavigationMesh& navMesh,
149 const vec3<F32>& position,
150 const vec3<F32>& extents, vec3<F32>& resultPt,
151 dtPolyRef& resultPoly) const;
152
153 protected:
155 std::array<PATHDATA, MAX_PATHSLOT> _pathStore;
157 std::unique_ptr<dtQueryFilter> _filter;
158
159};
160
161} // namespace Navigation
162} // namespace AI
163} // namespace Divide
164
165#endif //DVD_NAVIGATION_PATH_H_
bool getRandomNavMeshPoint(const NavigationMesh &navMesh, vec3< F32 > &resultPt) const
bool findNearestPointOnNavmesh(const NavigationMesh &navMesh, const vec3< F32 > &position, const vec3< F32 > &extents, F32 delta, vec3< F32 > &resultPt, dtPolyRef &resultPoly) const
PathErrorCode FindPath(const NavigationMesh &navMesh, const vec3< F32 > &startPos, const vec3< F32 > &endPos, U32 pathSlot, I32 target)
vector< vec3< F32 > > getPath(I32 pathSlot)
I32 getTarget(I32 pathSlot) noexcept
std::unique_ptr< dtQueryFilter > _filter
The poly filter that will be used for all (random) point and nearest poly searches.
Definition: DivideRecast.h:157
bool getRandomPointAroundCircle(const NavigationMesh &navMesh, const vec3< F32 > &centerPosition, F32 radius, const vec3< F32 > &extents, vec3< F32 > &resultPt, U8 maxIters) const
std::array< PATHDATA, MAX_PATHSLOT > _pathStore
Stores all created paths.
Definition: DivideRecast.h:155
bool findNearestPolyOnNavmesh(const NavigationMesh &navMesh, const vec3< F32 > &position, const vec3< F32 > &extents, vec3< F32 > &resultPt, dtPolyRef &resultPoly) const
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
int32_t I32
uint8_t U8
eastl::vector< Type > vector
Definition: Vector.h:42
uint32_t U32