@@ -20,7 +20,7 @@ namespace ZPathfinding {
2020
2121 void readJson (simdjson::ondemand::object json);
2222
23- void writeJson (std::ostream &f) const ;
23+ void writeJson (std::ostream &f, const std::string& propertyName = " position " ) const ;
2424 };
2525
2626 class Rotation {
@@ -52,34 +52,36 @@ namespace ZPathfinding {
5252 void writeJson (std::ostream &f) const ;
5353 };
5454
55- class Scale {
55+ class Vec3Wrapped {
5656 public:
57- Scale () {
57+ Vec3Wrapped () {
5858 };
5959
60- Scale ( std::string type, Vec3 data) : type(type), data(data) {
60+ Vec3Wrapped ( const std::string& type, const Vec3 data) : type(type), data(data) {
6161 };
6262 std::string type{};
6363 Vec3 data{};
6464
6565 void readJson (simdjson::ondemand::object json);
6666
67- void writeJson (std::ostream &f ) const ;
67+ void writeJson (std::ostream& f, std::string propertyName = " scale " ) const ;
6868 };
6969
7070 class Entity {
7171 public:
7272 Entity () {
73- };
73+ }
7474 std::string id;
7575 std::string name;
7676 std::string tblu;
7777 Vec3 position;
7878 Rotation rotation;
7979 PfBoxType type;
80- Scale scale;
80+ Vec3Wrapped scale;
8181
8282 void readJson (simdjson::ondemand::object json);
83+
84+ void writeJson (std::ostream &f) const ;
8385 };
8486
8587 class HashesAndEntity {
@@ -107,7 +109,7 @@ namespace ZPathfinding {
107109 std::string name;
108110 std::string tblu;
109111 Vec3 pos{};
110- Scale scale{};
112+ Vec3Wrapped scale{};
111113 Rotation rotation{};
112114
113115 void writeJson (std::ostream &f) const ;
@@ -129,9 +131,9 @@ namespace ZPathfinding {
129131 public:
130132 PfBox () = default ;
131133
132- PfBox (const std::string &id, const std::string &name, const std::string &tblu, const Vec3 pos, const Vec3 scale,
133- const Rotation rotation, const PfBoxType &type) : id(id), name(name), tblu(tblu), pos(pos), scale(scale),
134- rotation (rotation), type(type) {
134+ PfBox (const std::string &id, const std::string &name, const std::string &tblu, const Vec3 pos,
135+ const Vec3 scale, const Rotation rotation, const PfBoxType &type) :
136+ id (id), name(name), tblu(tblu), pos(pos), scale(scale), rotation(rotation), type(type) {
135137 }
136138
137139 std::string id{};
@@ -162,6 +164,206 @@ namespace ZPathfinding {
162164 std::vector<Entity> entities{};
163165 };
164166
167+ class Gate {
168+ public:
169+ Gate () = default ;
170+
171+ Gate (const std::string &id, const std::string &name, const std::string &tblu, const Vec3 position,
172+ Rotation rotation, const Vec3 bboxCenter, const Vec3 bboxHalfSize) : id(id), name(name), tblu(tblu), position(position), rotation(rotation),
173+ bboxCenter (bboxCenter), bboxHalfSize(bboxHalfSize) {
174+ }
175+
176+ std::string id;
177+ std::string name;
178+ std::string tblu;
179+ Vec3 position{};
180+ Rotation rotation{};
181+ Vec3 bboxCenter{};
182+ Vec3 bboxHalfSize{};
183+
184+ void writeJson (std::ostream &f) const ;
185+
186+ void readJson (simdjson::ondemand::object json);
187+ };
188+
189+ class Gates {
190+ public:
191+ Gates () = default ;
192+
193+ explicit Gates (simdjson::ondemand::array gatesJson);
194+
195+ std::vector<Gate> gates{};
196+ };
197+
198+ class Room {
199+ public:
200+ Room () = default ;
201+
202+ Room (const std::string &id, const std::string &name, const std::string &tblu, const Vec3 position,
203+ Rotation rotation, const Vec3Wrapped& roomExtentMin, const Vec3Wrapped& roomExtentMax) : id(id), name(name), tblu(tblu), position(position), rotation(rotation),
204+ roomExtentMin (roomExtentMin), roomExtentMax(roomExtentMax) {
205+ }
206+
207+ std::string id;
208+ std::string name;
209+ std::string tblu;
210+ Vec3 position{};
211+ Rotation rotation{};
212+ Vec3Wrapped roomExtentMin{};
213+ Vec3Wrapped roomExtentMax{};
214+
215+ void writeJson (std::ostream &f) const ;
216+
217+ void readJson (simdjson::ondemand::object json);
218+ };
219+
220+ class Rooms {
221+ public:
222+ Rooms () = default ;
223+
224+ explicit Rooms (simdjson::ondemand::array roomsJson);
225+
226+ std::vector<Room> rooms{};
227+ };
228+
229+ class AiAreaWorld {
230+ public:
231+ AiAreaWorld () = default ;
232+
233+ AiAreaWorld (const std::string &id, const std::string &name, const std::string &tblu,
234+ const Rotation rotation) : id(id), name(name), tblu(tblu), rotation(rotation) {
235+ }
236+
237+ std::string id;
238+ std::string name;
239+ std::string tblu;
240+ Rotation rotation{};
241+
242+ void writeJson (std::ostream &f) const ;
243+
244+ void readJson (simdjson::ondemand::object json);
245+ };
246+
247+ class AiAreaWorlds {
248+ public:
249+ AiAreaWorlds () = default ;
250+
251+ explicit AiAreaWorlds (simdjson::ondemand::array aiAreaWorldsJson);
252+
253+ std::vector<AiAreaWorld> aiAreaWorlds{};
254+ };
255+
256+ class ParentData {
257+ public:
258+ ParentData () = default ;
259+
260+ ParentData (const std::string &id, const std::string &name, const std::string &source, const std::string &tblu, const std::string &type) : id(id), name(name), source(source), tblu(tblu), type(type) {
261+ }
262+
263+ std::string id;
264+ std::string name;
265+ std::string source;
266+ std::string tblu;
267+ std::string type;
268+
269+ void writeJson (std::ostream &f) const ;
270+
271+ void readJson (simdjson::ondemand::object json);
272+ };
273+
274+ class Parent {
275+ public:
276+ Parent () = default ;
277+
278+ Parent (const std::string &type, const ParentData &data) : type(type), data(data) {
279+ }
280+
281+ std::string type;
282+ ParentData data{};
283+
284+ void writeJson (std::ostream &f) const ;
285+
286+ void readJson (simdjson::ondemand::object json);
287+ };
288+
289+ class AiArea {
290+ public:
291+ AiArea () = default ;
292+
293+ AiArea (const std::string &id, const std::string &name, const std::string &tblu,
294+ const Rotation rotation, Parent parent) : id(id), name(name), tblu(tblu),
295+ rotation (rotation), parent(parent) {
296+ }
297+
298+ std::string id;
299+ std::string name;
300+ std::string tblu;
301+ Rotation rotation{};
302+ std::vector<std::string> logicalParents;
303+ std::vector<std::string> areaVolumeNames;
304+ Parent parent{};
305+
306+ void writeJson (std::ostream &f) const ;
307+
308+ void readJson (simdjson::ondemand::object json);
309+ };
310+
311+ class AiAreas {
312+ public:
313+ AiAreas () = default ;
314+
315+ explicit AiAreas (simdjson::ondemand::array aiAreasJson);
316+
317+ std::vector<AiArea> aiAreas{};
318+ };
319+
320+ class VolumeBoxes {
321+ public:
322+ VolumeBoxes () = default ;
323+ explicit VolumeBoxes (simdjson::ondemand::array volumeBoxesJson);
324+ std::vector<Entity> volumeBoxes{};
325+ };
326+
327+ class Radius {
328+ public:
329+ Radius () = default ;
330+
331+ Radius (const std::string &type, const float data) : type(type), data(data) {
332+ }
333+
334+ std::string type;
335+ float data;
336+ void writeJson (std::ostream &f) const ;
337+
338+ void readJson (simdjson::ondemand::object json);
339+ };
340+
341+ class VolumeSphere {
342+ public:
343+ VolumeSphere () = default ;
344+
345+ VolumeSphere (const std::string &id, const std::string &name, const Vec3 &position,
346+ const Rotation &rotation, const Radius &radius) : id(id), name(name), position(position),
347+ rotation (rotation), radius(radius) {
348+ }
349+
350+ std::string id;
351+ std::string name;
352+ Vec3 position{};
353+ Rotation rotation{};
354+ Radius radius{};
355+ void writeJson (std::ostream &f) const ;
356+
357+ void readJson (simdjson::ondemand::object json);
358+ };
359+
360+ class VolumeSpheres {
361+ public:
362+ VolumeSpheres () = default ;
363+ explicit VolumeSpheres (simdjson::ondemand::array volumeSpheresJson);
364+ std::vector<VolumeSphere> volumeSpheres{};
365+ };
366+
165367 class PfSeedPoint {
166368 public:
167369 PfSeedPoint () = default ;
0 commit comments