gwnavruntime/navmesh/dynamicfloorsatcellposblob.h Source File

dynamicfloorsatcellposblob.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 
9 // ---------- Primary contact: JUBA - secondary contact: NOBODY
10 #ifndef Navigation_DynamicFloorsAtCellPosBlob_H
11 #define Navigation_DynamicFloorsAtCellPosBlob_H
12 
17 
18 namespace Kaim
19 {
20 class NavCell;
21 
22 class DynamicNavFloorsInCellBlob
23 {
24  KY_CLASS_WITHOUT_COPY(DynamicNavFloorsInCellBlob)
25 public:
26  DynamicNavFloorsInCellBlob() {}
27 
28 public:
29  GuidCompound m_navMeshGuidCompound;
30  NavCellIdx m_cellIdxInNavMesh;
31  BlobArray<BlobRef<NavFloorBlob> > m_floors;
32 };
33 
34 // Swaps the endianness of the data in the specified object. This function allows this type of object to be serialized through the blob framework.
35 // The first parameter specifies the target endianness, and the second parameter provides the object whose data is to be swapped.
36 inline void SwapEndianness(Endianness::Target e, DynamicNavFloorsInCellBlob& self)
37 {
38  SwapEndianness(e, self.m_navMeshGuidCompound);
39  SwapEndianness(e, self.m_cellIdxInNavMesh);
40  SwapEndianness(e, self.m_floors);
41 }
42 
43 
44 class DynamicNavFloorsBlobBuilder : public BaseBlobBuilder<DynamicNavFloorsInCellBlob>
45 {
46 public:
47  DynamicNavFloorsBlobBuilder(NavCell* navCell) : m_navCell(navCell) {}
48 
49 private:
50  virtual void DoBuild();
51 
52 private:
53  NavCell* m_navCell;
54 };
55 
56 
57 // Creates a DynamicNavFloorsInCellBlob to remove in a database all dynamic navcells registered in another DynamicNavFloorsInCellBlob.
58 // INTERNAL: Used for the visualDebugging of dynamic NavMesh in Lab.
59 // Implementation: Creates a DynamicNavFloorsInCellBlob from another one, and forces all navcells to be empty.
60 class DynamicNavFloorsRemoverBlobBuilder : public BaseBlobBuilder<DynamicNavFloorsInCellBlob>
61 {
62 public:
63  DynamicNavFloorsRemoverBlobBuilder(const DynamicNavFloorsInCellBlob* dynamicNavFloorsToRemove) : m_dynamicNavFloorsToRemove(dynamicNavFloorsToRemove) {}
64 
65 private:
66  virtual void DoBuild();
67 
68 private:
69  const DynamicNavFloorsInCellBlob* m_dynamicNavFloorsToRemove;
70 };
71 
72 
73 // The NavCellBlob contains the static data for a NavCell: a single cell within the grid of cells maintained by a NavMesh.
74 class DynamicFloorsAtCellPosBlob
75 {
76  KY_ROOT_BLOB_CLASS(Runtime, DynamicFloorsAtCellPosBlob, 0)
77  KY_CLASS_WITHOUT_COPY(DynamicFloorsAtCellPosBlob)
78 
79 public:
80 
81  DynamicFloorsAtCellPosBlob() {}
82 
83 public:
84  KyUInt32 m_databaseIndex;
85  CellPos m_cellPos;
86  BlobArray<DynamicNavFloorsInCellBlob > m_dynamicNavFloorsInCellBlobs;
87 };
88 
89 // Swaps the endianness of the data in the specified object. This function allows this type of object to be serialized through the blob framework.
90 // The first parameter specifies the target endianness, and the second parameter provides the object whose data is to be swapped.
91 inline void SwapEndianness(Endianness::Target e, DynamicFloorsAtCellPosBlob& self)
92 {
93  SwapEndianness(e, self.m_databaseIndex);
94  SwapEndianness(e, self.m_cellPos);
95  SwapEndianness(e, self.m_dynamicNavFloorsInCellBlobs);
96 }
97 
98 
99 class DynamicFloorsAtCellPosBuilder : public BaseBlobBuilder<DynamicFloorsAtCellPosBlob>
100 {
101 public:
102  DynamicFloorsAtCellPosBuilder(NavCell** navCells, KyUInt32 navCellCount, KyUInt32 databaseIndex) :
103  m_navCells(navCells), m_navCellCount(navCellCount), m_databaseIndex(databaseIndex) {}
104 
105 private:
106  virtual void DoBuild();
107 
108 private:
109  NavCell** m_navCells;
110  KyUInt32 m_navCellCount;
111  KyUInt32 m_databaseIndex;
112 };
113 
114 
115 
116 class DynamicFloorsAtCellPosRemoverBlobBuilder : public BaseBlobBuilder<DynamicFloorsAtCellPosBlob>
117 {
118 public:
119  DynamicFloorsAtCellPosRemoverBlobBuilder(const DynamicFloorsAtCellPosBlob* src) : m_src(src) {}
120 
121 private:
122  virtual void DoBuild();
123 
124 private:
125  const DynamicFloorsAtCellPosBlob* m_src;
126 };
127 
128 
129 }
130 
131 #endif //Navigation_DynamicFloorsAtCellPosBlob_H
132 
Vec2i CellPos
A type that represents the position of a cell within a 2D grid.
Definition: navmeshtypes.h:33
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
KyUInt32 NavCellIdx
An index that uniquely identifies a single NavCell within the set of NavCells owned by a NavMesh...
Definition: navmeshtypes.h:123
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:35
Definition: gamekitcrowddispersion.h:20
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36