gwnavruntime/database/activeguids.h Source File

activeguids.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 NavMeshElement;
17 
18 class ActiveGuids
19 {
20  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_NavData)
21 public:
22  void AddActiveKyGuid(const KyGuid& kyGuid);
23  void RemoveActiveKyGuid(const KyGuid& kyGuid);
24 
25  //activatedGuid must be sorted
26  KY_INLINE bool IsGuidCompoundCompatible(const GuidCompound& guidCompound) const
27  {
28  if (guidCompound.GetKyGuidCount() == 1)
29  // we assume that all the GuidCompound with only one KyGuid are compatible since they are from a "main" sector
30  return true;
31 
32  return IsNotMainGuidCompoundCompatible(guidCompound);
33  }
34 
35  void Clear() { m_activeGuids.ClearAndRelease(); }
36 
37 private:
38  bool IsNotMainGuidCompoundCompatible(const GuidCompound& guidCompound) const;
39 
40 public:
41  KyArray<KyGuid, MemStat_NavData> m_activeGuids;
42 };
43 
44 class GuidCompoundUpdater
45 {
46  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_WorldFwk)
47  KY_CLASS_WITHOUT_COPY(GuidCompoundUpdater)
48 
49 public:
50  GuidCompoundUpdater() {}
51 
52  void AddNavMeshElement(NavMeshElement* navMeshElement);
53  void RemoveNavMeshElement(NavMeshElement* navMeshElement);
54 
55  // Sort by m_guidCompound , update navMeshElement->m_guidCompoundSortedIdx
56  // Also compare with activeGuids, update navMeshElement->m_guidCompoundIsCompatible and activenessChangeCellBox
57  // forceActiveIfAlone is used in particular cases in the NavigationLab or Generation
58  // activenessChangeCellBox is inout/output, it won't be cleared by the function
59  void UpdateNavMeshAccordingToGuidCompound(const ActiveGuids& activeGuids, CellBox& activenessChangeCellBox, bool forceActiveIfAlone = false);
60 
61 public:
62  KyArray<NavMeshElement*, MemStat_NavData> m_elements;
63 };
64 
65 }
66 
67 
68 
Box2i CellBox
A type that represents a bounding box around cells in a 2D grid.
Definition: navmeshtypes.h:31
#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
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17