gwnavruntime/database/navmeshelementmanager.h Source File

navmeshelementmanager.h
Go to the documentation of this file.
1 /*
2 * Copyright 2015 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 
8 // ---------- Primary contact: JUBA - secondary contact: NOBODY
9 #ifndef Navigation_NavMeshElementManager_H
10 #define Navigation_NavMeshElementManager_H
11 
14 
16 
17 
18 namespace Kaim
19 {
20 
21 class Database;
22 class NavGraphManager;
23 
28 class NavMeshElementManager
29 {
32 public:
33 
36 
39 
40 public: // internal
43  void SetNavGraphManager(NavGraphManager* navGraphManager);
44  void Clear();
45 
46  NavMeshElement* InsertNavMeshElement(const NavMeshElementBlob* navMeshElementBlob); // Call by the Database
47  void PrepareNavMeshRemoval(NavMeshElement* navMeshElement); // Call by the Database
48  void RemoveNavMeshElement(NavMeshElement* navMeshElement); // Call by the Database
49  void SortNavMeshAccordingToGuidCompound(CellBox& currentUpdateCellBox, bool forceActiveIfAlone = false);
50 
51 public:
52 
57  KyResult CheckGenerationParameters(const NavMeshGenParameters& navMeshGenParameters);
58 
61  bool IsCompatibleWith(const NavMeshGenParameters& navMeshGenParameters) const;
62 
63 public: // internal
64  // Used by the generationd
65  NavMeshElement* SingleInsertion(const NavMeshElementBlob* navMeshElementBlob, bool forceActiveIfAlone = false);
66  void SingleRemoval(NavMeshElement* navMeshElement);
67 public: // internal
68  Database* m_database;
69 
70  ActiveGuids m_activatedGuids;
71  GuidCompoundSorter m_guidCompoundSorter;
72 
73 private:
74  TrackedCollection<Ptr<NavMeshElement>, MemStat_NavData> m_navMeshElements;
75 };
76 
77 KY_INLINE NavMeshElementManager::~NavMeshElementManager() { Clear(); }
78 
79 KY_INLINE KyUInt32 NavMeshElementManager::GetNavMeshElementCount() const { return m_navMeshElements.GetCount(); }
80 
81 KY_INLINE NavMeshElement* NavMeshElementManager::GetNavMeshElement(KyUInt32 idx) const
82 {
83  KY_DEBUG_ASSERTN(idx < GetNavMeshElementCount(), ("Input idx must be lower than GetNumberOfInsertedNavMesh() == %d", GetNavMeshElementCount()));
84  return m_navMeshElements[idx];
85 }
86 
87 KY_INLINE void NavMeshElementManager::SortNavMeshAccordingToGuidCompound(CellBox& currentUpdateCellBox, bool forceActiveIfAlone)
88 {
89  m_guidCompoundSorter.Sort(m_activatedGuids, currentUpdateCellBox, forceActiveIfAlone);
90 }
91 
92 }
93 
94 
95 #endif //Navigation_NavMeshElementManager_H
96 
bool IsCompatibleWith(const NavMeshGenParameters &navMeshGenParameters) const
Indicates whether the specified NavMeshElement was created with the same generation parameters as the...
KyResult CheckGenerationParameters(const NavMeshGenParameters &navMeshGenParameters)
Called internally before adding a NavMeshElement to the NavMeshElementManager.
This class represents a two-dimensional axis-aligned bounding box whose dimensions are stored using 3...
Definition: box2i.h:119
This class is a runtime wrapper of a NavMeshElementBlob.
Definition: navmeshelement.h:24
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
Box2i CellBox
A type that represents a bounding box around cells in a 2D grid.
Definition: navmeshtypes.h:34
TrackedCollection is a class which is a "Collection" of T=C* or T = Ptr< c="" /> (not sorted...
Definition: collection.h:87
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
NavMeshElement * GetNavMeshElement(KyUInt32 idx) const
Retrieves the NavMesh with the specified index from within the list of NavMeshes in the NavMeshElemen...
Definition: navmeshelementmanager.h:95
This class is a runtime container for all NavData that represents the world from the point of view of...
Definition: database.h:64
This object indicates the settings used to generate the NavMeshElementBlob, and thereby the physical ...
Definition: navmeshelementblob.h:24
Definition: gamekitcrowddispersion.h:20
The NavMeshElementBlob contains the NavMesh static data (a set of NavCellBlob) for an element (a Guid...
Definition: navmeshelementblob.h:51
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
KyUInt32 GetNavMeshElementCount() const
Indicates the number of NavMeshes that have been added to the NavMeshElementManager.
Definition: navmeshelementmanager.h:93
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
This class is a runtime container for the all NavMeshElement that are created from the NavMeshElement...
Definition: navmeshelementmanager.h:30