Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/*
   Copyright (c) 2018 DIVIDE-Studio
   Copyright (c) 2009 Ionut Cava

   This file is part of DIVIDE Framework.

   Permission is hereby granted, free of charge, to any person obtaining a copy
   of this software
   and associated documentation files (the "Software"), to deal in the Software
   without restriction,
   including without limitation the rights to use, copy, modify, merge, publish,
   distribute, sublicense,
   and/or sell copies of the Software, and to permit persons to whom the
   Software is furnished to do so,
   subject to the following conditions:

   The above copyright notice and this permission notice shall be included in
   all copies or substantial portions of the Software.

   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   IMPLIED,
   INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
   PARTICULAR PURPOSE AND NONINFRINGEMENT.
   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
   DAMAGES OR OTHER LIABILITY,
   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
   IN CONNECTION WITH THE SOFTWARE
   OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

 */

/*
    OgreCrowd
    ---------

    Copyright (c) 2012 Jonas Hauquier

    Additional contributions by:

    - mkultra333
    - Paul Wilson

    Sincere thanks and to:

    - Mikko Mononen (developer of Recast navigation libraries)

    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to
   deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
   FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    THE SOFTWARE.

*/

#ifndef _NAVIGATION_PATH_H_
#define _NAVIGATION_PATH_H_

#include "../NavMeshes/Headers/NavMesh.h"

namespace Divide {
namespace AI {
namespace Navigation {

DEFINE_SINGLETON(DivideRecast)
  public:
    /**
     * Find a path beween start point and end point and, if possible, generates a
    *list of lines in a path.
     * It might fail if the start or end points aren't near any navmesh polygons, or
    *if the path is too long,
     * or it can't make a path, or various other reasons.
     *
     * pathSlot: The index number for the slot in which the found path is to be
    *stored.
     * target: Number identifying the target the path leads to. Recast does nothing
    *with this, but you can give them
     *   meaning in your own application.
     *
     * Return codes:
     *  PATH_ERROR_NONE                    Found path
     *  PATH_ERROR_NO_NEAREST_POLY         Couldn't find polygon nearest to start
    *point
     *  PATH_ERROR_NO_NEAREST_POLY_END     Couldn't find polygon nearest to end
    *point
     *  PATH_ERROR_COULD_NOT_CREATE_PATH   Couldn't create a path
     *  PATH_ERROR_COULD_NOT_FIND_PATH     Couldn't find a path
     *  PATH_ERROR_NO_STRAIGHT_PATH_CREATE Couldn't create a straight path
     *  PATH_ERROR_NO_STRAIGHT_PATH_FIND   Couldn't find a straight path
    **/
    PathErrorCode FindPath(const NavigationMesh& navMesh, const vec3<F32>& startPos,
                           const vec3<F32>& endPos, I32 pathSlot, I32 target);
    /**
    * Retrieve the path at specified slot defined as a line along an ordered set of
    *3D positions.
    * The path has a maximum length of MAX_PATHVERT, and is an empty list in case no
    *path is
    * defined or an invalid pathSlot index is given.
    **/
    vectorImpl<vec3<F32> > getPath(I32 pathSlot);
    /**
    * The ID number identifying the target for the path at specified slot. Targets
    *have
    * no meaning for OgreRecast but you can use them to give them their own
    *meanings.
    * Returns 0 when a faulty pathSlot is given.
    **/
    I32 getTarget(I32 pathSlot);
    /**
    * Returns a random point on the navmesh.
    **/
    bool getRandomNavMeshPoint(const NavigationMesh& navMesh, vec3<F32>& resultPt);
    /**
    * Returns a random point on the navmesh contained withing the specified circle
    **/
    bool getRandomPointAroundCircle(const NavigationMesh& navMesh,
                                    const vec3<F32>& centerPosition, F32 radius,
                                    const vec3<F32>& extents, vec3<F32>& resultPt,
                                    U8 maxIters);
    /**
    * Find a point on the navmesh closest to the specified point position, within
    *predefined
    * bounds.
    * Returns true if such a point is found (returned as resultPt), returns false
    * if no point is found. When false is returned, resultPt is not altered.
    **/
    bool findNearestPointOnNavmesh(const NavigationMesh& navMesh,
                                   const vec3<F32>& position,
                                   const vec3<F32>& extents, F32 delta,
                                   vec3<F32>& resultPt, dtPolyRef& resultPoly);

    bool findNearestPolyOnNavmesh(const NavigationMesh& navMesh,
                                  const vec3<F32>& position,
                                  const vec3<F32>& extents, vec3<F32>& resultPt,
                                  dtPolyRef& resultPoly);

  protected:
    DivideRecast();
    ~DivideRecast();

  protected:
    /// Stores all created paths
    PATHDATA _pathStore[MAX_PATHSLOT];
    /// The poly filter that will be used for all (random) point and nearest poly searches.
    dtQueryFilter* _filter;

END_SINGLETON

};  // namespace Navigation
};  // namespace AI
};  // namespace Divide

#endif

Commits for Divide-Framework/trunk/Source Code/AI/PathFinding/Headers/DivideRecast.h

Diff revisions: vs.
Revision Author Commited Message
1029 Diff Diff IonutCava picture IonutCava Tue 30 Jan, 2018 17:28:39 +0000

[Ionut]
- Update copyright notices

836 Diff Diff IonutCava picture IonutCava Fri 27 Jan, 2017 14:59:56 +0000

[IonutCava]
- Update copyright notice

713 Diff Diff IonutCava picture IonutCava Wed 25 May, 2016 15:43:38 +0000

[IonutCava]
- Removed all unique_ptr’s from the code with classic new/delete pairs. They were seriously not needed.
- Added the concept of SceneComponent to scene specific classes: aiManager, lightPool, sceneGraph, physicsInterface etc
— This allowed the removal of the global GET_ACTIVE_SCENEGRAPH call;

648 Diff Diff IonutCava picture IonutCava Sun 21 Feb, 2016 16:32:52 +0000

[IonutCava]
- Update copyright notice
- Move BoundingBox and BoundingSphere to a new BoundsComponent
— Add a temp hack in SceneGraphNode to update these

351 Diff Diff IonutCava picture IonutCava Wed 11 Feb, 2015 16:39:15 +0000

[Ionut]
- Large amount of decoupling between classes by using Attorney-style classes where friendship was required.

350 Diff Diff IonutCava picture IonutCava Tue 10 Feb, 2015 16:25:39 +0000

[Ionut]
- Simplified some Util-namespace level functions by using STL algorithms where possible
- Formatted the entire codebase using clang-format with the following style: "{BasedOnStyle: Google, IndentWidth: 4}"
- Attempted to make ProfileTimer thread-safe (temp fix until std::chrono works properly in Visual Studio)

348 Diff Diff IonutCava picture IonutCava Thu 05 Feb, 2015 17:13:01 +0000

[Ionut]
- Replaced some raw pointers with smart pointers or direct data members
- Removed redundant SceneGraph pointer from SceneGraphNode

343 Diff Diff IonutCava picture IonutCava Thu 15 Jan, 2015 17:30:12 +0000

[Ionut]
- Refactored 2 singletons into static classes (Console and TerrainLoader)
- Changed some C-casts to static_casts
- Updated copyright notices

333 Diff Diff IonutCava picture IonutCava Tue 09 Dec, 2014 16:15:44 +0000

[Ionut]
- Removed “core.h” and moved everything to their appropriate header files
- Renamed MathClasses to MathMatrices (finally)
- Renamed “-Inl.h” files to ".inl"
- Some String wrapper refactoring
- Update “InstallLibraries.bat” so that it still offers valid options

331 IonutCava picture IonutCava Sat 06 Dec, 2014 20:53:45 +0000

[Ionut]
- Limited line length to 132 characters to improve readability and diff-comparisons
- Refactored memory allocation/deallocation functions
- Fixed a few compatibility issues with HashMap.h
- Fixed a bug in GPU Skinning shaders (cast a float to int)