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