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
/*
   Copyright (c) 2014 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 "core.h"
#include "../NavMeshes/Headers/NavMesh.h"

namespace Divide {
    namespace AI {
        namespace Navigation {

    DEFINE_SINGLETON( DivideRecast )
        protected:
           friend class NavigationMesh;
           /**
            * 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 DivideRecast::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
331 Diff Diff 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)

318 Diff Diff IonutCava picture IonutCava Sat 30 Aug, 2014 17:35:53 +0000

[Ionut]
- Wrapped the entire code in a “Divide” namespace
- VertexBuffers now call “shrink_to_fit” on all internal data storage
- Improved some vector performance by preferring “emplace_back” instead of “push_back” + proepr usage of reserve / resize
- Wrapped OIS specific types and classes in Divide::Input namespace
- Added the messageBox.layout file (forgot it in the previous few commits)

315 Diff Diff IonutCava picture IonutCava Mon 25 Aug, 2014 15:23:33 +0000

[Ionut]
- Update ReCast to the latest version available on GitHub
- Improved nav mesh target point selection
- Added basic “go to enemy flag” logic for the WarScene teams

314 Diff Diff IonutCava picture IonutCava Sun 24 Aug, 2014 19:54:33 +0000

[Ionut]
- More AI work
- Added some needed audio dlls

311 Diff Diff IonutCava picture IonutCava Mon 18 Aug, 2014 21:40:52 +0000

[Ionut]
- Added a basic AESOP implementation
- Moved all AI related classes under the “AI” namespace

310 Diff Diff IonutCava picture IonutCava Sun 17 Aug, 2014 23:31:04 +0000

[Ionut]
- Some cleanups in AI related classes

221 Diff Diff k1ngp1n picture k1ngp1n Wed 08 Jan, 2014 18:50:02 +0000

[Ionut] [[BR]]
- Merged branch “Shadows And Animations” back into trunk [[BR]]
- Added DoxygenGUI project file [[BR]]

  • Buggy *
183 k1ngp1n picture k1ngp1n Mon 18 Nov, 2013 18:35:02 +0000

[Ionut] [[BR]]
- Added a wrapper around DetourCrowd [[BR]]