gwnavruntime/navmesh/navmeshelement.h Source File

navmeshelement.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 // ---------- Primary contact: JUBA - secondary contact: NOBODY
8 #ifndef Navigation_NavMeshElement_H
9 #define Navigation_NavMeshElement_H
10 
12 
13 namespace Kaim
14 {
15 
16 class NavCell;
17 class Database;
22 class NavMeshElement
23 {
27 
28 public:
29  bool IsStillLoaded() const;
30  const NavMeshElementBlob* GetNavMeshElementBlob() const;
31  const GuidCompound& GetGuidCompound() const;
32 
33 public: // internal
34  void OnRemove(); // Call OnRemove on each NavCell
35 
36  KyUInt32 GetIndexInCollection() const; // contract to be in a TrackedCollection
37  void SetIndexInCollection(KyUInt32 indexInCollection); // contract to be in a TrackedCollection
38 
39  static Ptr<NavMeshElement> Create(const NavMeshElementBlob& navMeshElementBlob, Database* database, MemoryHeap* pheap = KY_NULL);
40 private:
41  static KyUInt32 ComputeSizeForNavMeshElement(const NavMeshElementBlob& navMeshElementBlob);
42  static KyUInt32 ComputeTotalSizeForNavMeshElement(const NavMeshElementBlob& navMeshElementBlob);
43 
44  ~NavMeshElement(); // This object is create by a placement new within a big buffer. Its destructor is never called.
45 
46 public: // internal
50 
52  KyUInt32 m_guidCompoundSortedIdx;
53  bool m_guidCompoundIsCompatible;
54 private:
56 };
57 
58 KY_INLINE bool NavMeshElement::IsStillLoaded() const { return m_navMeshElementBlob != KY_NULL; }
59 
60 KY_INLINE const NavMeshElementBlob* NavMeshElement::GetNavMeshElementBlob() const
61 {
62  KY_DEBUG_ASSERTN(IsStillLoaded(),("You Cannot call this function if NavMeshElement has been unloaded or not loaded yet"));
63  return m_navMeshElementBlob;
64 }
65 
66 KY_INLINE const GuidCompound& NavMeshElement::GetGuidCompound() const
67 {
68  KY_DEBUG_ASSERTN(IsStillLoaded(),("You Cannot call this function if NavMeshElement has been unloaded or not loaded yet"));
70 }
71 KY_INLINE KyUInt32 NavMeshElement::GetIndexInCollection() const { return m_indexInCollection; }
72 KY_INLINE void NavMeshElement::SetIndexInCollection(KyUInt32 indexInCollection) { m_indexInCollection = indexInCollection; }
73 
74 KY_INLINE KyUInt32 NavMeshElement::ComputeSizeForNavMeshElement(const NavMeshElementBlob& navMeshElementBlob)
75 {
76  return sizeof(NavMeshElement) + navMeshElementBlob.GetNavCellBlobCount() * (KyUInt32)sizeof(void*);
77 }
78 }
79 
80 #endif //Navigation_NavMeshElement_H
81 
This class is a runtime wrapper of a NavMeshElementBlob.
Definition: navmeshelement.h:24
const NavMeshElementBlob * m_navMeshElementBlob
The NavMeshElementBlob that contains the static data for this NavMesh. Do not modify.
Definition: navmeshelement.h:66
#define KY_REFCOUNT_MALLOC_FREE(ClassName)
Specific to RefCounting, no inheritance involved, used to make RefCount-able classes compatible with ...
Definition: memory.h:145
#define KY_NULL
Null value.
Definition: types.h:247
GuidCompound m_guidCompound
The GuidCompound that uniquely identifies this NavMeshElementBlob. For internal use. Do not modify.
Definition: navmeshelementblob.h:85
bool IsStillLoaded() const
This function returns false if the NavData containing corresponding NavMeshElementBlob has been remov...
Definition: navmeshelement.h:69
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
This class is a runtime wrapper of a NavCellBlob.
Definition: navcell.h:33
This class is a runtime container for all NavData that represents the world from the point of view of...
Definition: database.h:64
NavCell ** m_navCells
The array of NavCells that make up this NavMeshElement. Do not modify.
Definition: navmeshelement.h:58
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
const GuidCompound & GetGuidCompound() const
Retrieves the GuidCompound that uniquely identifies this NavMeshElement.
Definition: navmeshelement.h:77
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
KyUInt32 m_numberOfCells
The number of NavCells in m_navCells. Do not modify.
Definition: navmeshelement.h:59
KyUInt32 m_indexInCollection
For TrackedCollection.
Definition: navmeshelement.h:61
Database * m_database
The Database in which the parentNavData has been added to. Do not modify.
Definition: navmeshelement.h:57