gwnavruntime/database/navmeshelementmanager.h Source File

navmeshelementmanager.h
Go to the documentation of this file.
1 /*
2 * Copyright 2016 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 #pragma once
8 
12 
13 namespace Kaim
14 {
15 
16 class Database;
17 class NavGraphManager;
18 
24 {
25  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_WorldFwk)
27 public:
28 
31 
34 
35 public: // internal
38  void SetNavGraphManager(NavGraphManager* navGraphManager);
39  void Clear();
40 
41  NavMeshElement* InsertNavMeshElement(const NavMeshElementBlob* navMeshElementBlob); // Call by the Database
42  void PrepareNavMeshRemoval(NavMeshElement* navMeshElement); // Call by the Database
43  void RemoveNavMeshElement(NavMeshElement* navMeshElement); // Call by the Database
44  void UpdateNavMeshAccordingToGuidCompound(CellBox& activenessChangeCellBox, bool forceActiveIfAlone = false);
45 
46 public:
47 
52  KyResult CheckGenerationParameters(const NavMeshGenParameters& navMeshGenParameters);
53 
56  bool IsCompatibleWith(const NavMeshGenParameters& navMeshGenParameters) const;
57 
58 public: // internal
59  // Used by the generation
60  NavMeshElement* SingleInsertion(const NavMeshElementBlob* navMeshElementBlob, bool forceActiveIfAlone = false);
61  void SingleRemoval(NavMeshElement* navMeshElement);
62 
63 public: // internal
64  Database* m_database;
65  ActiveGuids m_activatedGuids;
66  GuidCompoundUpdater m_guidCompoundUpdater;
67  // Note: we can probably directly sort and manage m_navMeshElements without using the redundant GuidCompoundSorter::m_elements
68 
69 private:
70  TrackedCollection<Ptr<NavMeshElement>, MemStat_NavData> m_navMeshElements;
71 };
72 
73 KY_INLINE NavMeshElementManager::~NavMeshElementManager() { Clear(); }
74 
75 KY_INLINE KyUInt32 NavMeshElementManager::GetNavMeshElementCount() const { return m_navMeshElements.GetCount(); }
76 
78 {
79  KY_DEBUG_ASSERTN(idx < GetNavMeshElementCount(), ("Input idx must be lower than GetNavMeshElementCount() == %d", GetNavMeshElementCount()));
80  return m_navMeshElements[idx];
81 }
82 
83 KY_INLINE void NavMeshElementManager::UpdateNavMeshAccordingToGuidCompound(CellBox& activenessChangeCellBox, bool forceActiveIfAlone)
84 {
85  m_guidCompoundUpdater.UpdateNavMeshAccordingToGuidCompound(m_activatedGuids, activenessChangeCellBox, forceActiveIfAlone);
86 }
87 
88 }
89 
90 
91 
bool IsCompatibleWith(const NavMeshGenParameters &navMeshGenParameters) const
Indicates whether the specified NavMeshElement was created with the same generation parameters as the...
Definition: navmeshelementmanager.cpp:94
KyResult CheckGenerationParameters(const NavMeshGenParameters &navMeshGenParameters)
Called internally before adding a NavMeshElement to the NavMeshElementManager.
Definition: navmeshelementmanager.cpp:80
2d axis aligned box of 32bits integers. Very Important: CountX() returns m_max.x - m_min...
Definition: box2i.h:17
This class is a runtime wrapper of a NavMeshElementBlob.
Definition: navmeshelement.h:21
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
TrackedCollection is a class which is a "Collection" of T=C* or T = Ptr< c="" /> (not sorted...
Definition: collection.h:77
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:196
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:132
NavMeshElement * GetNavMeshElement(KyUInt32 idx) const
Retrieves the NavMesh with the specified index from within the list of NavMeshes in the NavMeshElemen...
Definition: navmeshelementmanager.h:77
This class is a runtime container for all NavData that represents the world from the point of view of...
Definition: database.h:57
This object indicates the settings used to generate the NavMeshElementBlob, and thereby the physical ...
Definition: navmeshelementblob.h:22
Navigation return code class.
Definition: types.h:108
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
The NavMeshElementBlob contains the NavMesh static data (a set of NavCellBlob) for an element (a Guid...
Definition: navmeshelementblob.h:46
KyUInt32 GetNavMeshElementCount() const
Indicates the number of NavMeshes that have been added to the NavMeshElementManager.
Definition: navmeshelementmanager.h:75
This class is a runtime container for the all NavMeshElement that are created from the NavMeshElement...
Definition: navmeshelementmanager.h:23