gwnavruntime/world/boxobstacleblob.h Source File

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