gwnavruntime/world/boxobstacleblob.h Source File

boxobstacleblob.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 
8 #pragma once
9 
16 
17 
18 namespace Kaim
19 {
20 
22 //
23 // BoxObstacleSpatializedCylindersBlob
24 //
26 class BoxObstacleSpatializedCylindersBlob
27 {
28  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
29  KY_ROOT_BLOB_CLASS(Runtime, BoxObstacleSpatializedCylindersBlob, 0)
30 public:
31  BoxObstacleSpatializedCylindersBlob() {}
32 
33  KyUInt32 m_visualDebugId;
34  BlobArray<SpatializedCylinderBlob> m_spatializedCylinderBlobs;
35 };
36 
37 inline void SwapEndianness(Endianness::Target e, BoxObstacleSpatializedCylindersBlob& self)
38 {
39  SwapEndianness(e, self.m_visualDebugId);
40  SwapEndianness(e, self.m_spatializedCylinderBlobs);
41 }
42 
43 class BoxObstacleSpatializedCylindersBlobBuilder : public BaseBlobBuilder<BoxObstacleSpatializedCylindersBlob>
44 {
45  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
46 public:
47  BoxObstacleSpatializedCylindersBlobBuilder(const BoxObstacle* boxObstacle, KyUInt32 visualDebugId)
48  : m_visualDebugId(visualDebugId), m_boxObstacle(boxObstacle) {}
49  virtual void DoBuild();
50 
51 private:
52  KyUInt32 m_visualDebugId;
53  const BoxObstacle* m_boxObstacle;
54 };
55 
56 
58 //
59 // BoxObstacle spatialized cylinders configs Blob
60 //
62 class BoxObstacleSpatializedCylinderConfigsBlob
63 {
64  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
65  KY_ROOT_BLOB_CLASS(Runtime, BoxObstacleSpatializedCylinderConfigsBlob, 0)
66 
67 public:
68  BoxObstacleSpatializedCylinderConfigsBlob() {}
69 
70  KyUInt32 m_visualDebugId;
71  BlobArray<SpatializedCylinderConfigBlob> m_spatializedCylinderConfigBlobs;
72  DatabaseBindingBlob m_databaseBinding;
73 };
74 
75 inline void SwapEndianness(Endianness::Target e, BoxObstacleSpatializedCylinderConfigsBlob& self)
76 {
77  SwapEndianness(e, self.m_visualDebugId);
78  SwapEndianness(e, self.m_spatializedCylinderConfigBlobs);
79  SwapEndianness(e, self.m_databaseBinding);
80 }
81 
82 class BoxObstacleSpatializedCylinderConfigsBlobBuilder : public BaseBlobBuilder<BoxObstacleSpatializedCylinderConfigsBlob>
83 {
84  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
85 public:
86  BoxObstacleSpatializedCylinderConfigsBlobBuilder(const BoxObstacle* boxObstacle, KyUInt32 visualDebugId)
87  : m_visualDebugId(visualDebugId), m_boxObstacle(boxObstacle) {}
88  virtual void DoBuild();
89 
90 private:
91  KyUInt32 m_visualDebugId;
92  const BoxObstacle* m_boxObstacle;
93 };
94 
95 
97 //
98 // BoxObstacle spatialization results blob
99 //
101 class BoxObstacleSpatializationResultsBlob
102 {
103  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
104  KY_ROOT_BLOB_CLASS(Runtime, BoxObstacleSpatializationResultsBlob, 0)
105 
106 public:
107  BoxObstacleSpatializationResultsBlob() {}
108 
109  KyUInt32 GetOutsideNavmeshCount() const;
110  KyUInt32 GetOutsideNavmeshCount(KyUInt32 databaseIndex) const;
111 
112 public:
113  KyUInt32 m_visualDebugId;
114  BlobArray<SpatializationResultBlob> m_spatializationResultBlobs;
115 };
116 
117 inline void SwapEndianness(Endianness::Target e, BoxObstacleSpatializationResultsBlob& self)
118 {
119  SwapEndianness(e, self.m_visualDebugId);
120  SwapEndianness(e, self.m_spatializationResultBlobs);
121 }
122 
123 class BoxObstacleSpatializationResultsBlobBuilder : public BaseBlobBuilder<BoxObstacleSpatializationResultsBlob>
124 {
125  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
126 public:
127  BoxObstacleSpatializationResultsBlobBuilder(const BoxObstacle* boxObstacle, KyUInt32 visualDebugId)
128  : m_visualDebugId(visualDebugId), m_boxObstacle(boxObstacle) {}
129  virtual void DoBuild();
130 
131 private:
132  KyUInt32 m_visualDebugId;
133  const BoxObstacle* m_boxObstacle;
134 };
135 
136 
138 //
139 // BoxObstacleBlob
140 //
142 class BoxObstacleBlob
143 {
144  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
145  KY_ROOT_BLOB_CLASS(Runtime, BoxObstacleBlob, 0)
146 public:
147  BoxObstacleBlob() {}
148 
149  void GetWorldPosition(Vec3f& worldPosition) const { worldPosition = m_worldTransform.DoTransform(m_localCenter); }
150  void GetWorldAABB(Box3f& worldAABB) const;
151 
152  Vec3f m_localCenter;
153  Vec3f m_localHalfExtents;
154  Transform m_worldTransform;
155 
156  Vec3f m_linearVelocity;
157  Vec3f m_angularVelocity;
158  KyUInt32 m_rotationMode;
159 
160  KyUInt32 m_tagVolumeIntegrationStatus;
161  KyUInt32 m_visualDebugId;
162 };
163 
164 inline void SwapEndianness(Endianness::Target e, BoxObstacleBlob& self)
165 {
166  SwapEndianness(e, self.m_localCenter);
167  SwapEndianness(e, self.m_localHalfExtents);
168  SwapEndianness(e, self.m_worldTransform);
169  SwapEndianness(e, self.m_linearVelocity);
170  SwapEndianness(e, self.m_angularVelocity);
171  SwapEndianness(e, self.m_rotationMode);
172  SwapEndianness(e, self.m_tagVolumeIntegrationStatus);
173  SwapEndianness(e, self.m_visualDebugId);
174 }
175 
176 class BoxObstacleBlobBuilder : public BaseBlobBuilder<BoxObstacleBlob>
177 {
178  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
179 public:
180  BoxObstacleBlobBuilder(const BoxObstacle* boxObstacle) : m_boxObstacle(boxObstacle)
181  {}
182 
183 private:
184  virtual void DoBuild();
185 
186  const BoxObstacle* m_boxObstacle;
187 };
188 
189 
191 //
192 // BoxObstaclesCollectionBlob and BoxObstaclesCollectionBlobBuilder
193 //
195 
196 /* A type of blob that serializes data for several BoxObstacleBlobs that are managed through the BoxObstaclesCollectionBlobBuilder class.
197  */
198 class BoxObstaclesCollectionBlob
199 {
200  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
201  KY_ROOT_BLOB_CLASS(Runtime, BoxObstaclesCollectionBlob, 0)
202 public:
203  BlobArray<BoxObstacleBlob> m_boxObstacles;
204 };
205 inline void SwapEndianness(Endianness::Target e, BoxObstaclesCollectionBlob& self)
206 {
207  SwapEndianness(e, self.m_boxObstacles);
208 }
209 
212 class BoxObstaclesCollectionBlobBuilder : public BaseBlobBuilder<BoxObstaclesCollectionBlob>
213 {
214 public:
215  /* \param boxObstacles The List of BoxObstacles serialized by this blob builder. */
216  BoxObstaclesCollectionBlobBuilder(const TrackedCollection<Ptr<BoxObstacle>, MemStat_BoxObstacle>& boxObstacles)
217  : m_boxObstacles(&boxObstacles)
218  {}
219 
220  virtual void DoBuild();
221 
222 private:
223  const TrackedCollection<Ptr<BoxObstacle>, MemStat_BoxObstacle>* m_boxObstacles;
224 };
225 
226 
227 } // namespace Kaim
228 
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_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:132
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:27
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
A type of blob builder that creates a BoxObstaclesCollectionBlob from a list of box BoxObstacles (Kai...
Definition: boxobstacleblob.h:212
BaseBlobBuilder is an abstract base class that builds a blob within a contiguous block of memory...
Definition: baseblobbuilder.h:27