gwnavruntime/navmesh/dynamicfloorsatcellposblob.h Source File

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