diff --git a/.idea/editor.xml b/.idea/editor.xml
index 9c7f164..24e51ae 100644
--- a/.idea/editor.xml
+++ b/.idea/editor.xml
@@ -6,14 +6,14 @@
-
+
-
-
+
+
@@ -154,7 +154,7 @@
-
+
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
index d430b8c..2e42a84 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -1,6 +1,9 @@
+
+
+
@@ -8,6 +11,7 @@
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 51ead9c..2a337dc 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -7,4 +7,9 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a70b680..7b2810b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,7 +3,7 @@ cmake_policy(SET CMP0141 NEW)
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$,EditAndContinue,ProgramDatabase>" CACHE STRING "MSVC debug information format")
project(
NavKit
- VERSION 2.12.3
+ VERSION 2.13.0
DESCRIPTION "An app to create NAVP and AIRG files for use with Hitman: World of Assassination"
LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
diff --git a/README.md b/README.md
index bb73212..fbcaee2 100644
--- a/README.md
+++ b/README.md
@@ -85,17 +85,17 @@ Functions available are loading and saving Navp and Navp.json, loading Airg and
# How NavKit generates Navp and Airg files
NavKit performs the following series of steps to be able to generate Navp files.
1. Connect to the Editor server of the running Hitman game, and issue commands to: rebuild the entity tree, find the scene's ZGeomEntities, PFBox entities, and PFSeedPoint entities and send their data back to NavKit, where they are saved to `output.nav.json` in the specified output folder.
-1. Extract all the necessary Aloc or Prim files from the rpkg files to the `aloc` or `prim` folder of the specified output folder using glacier2obj (A rust library included in the installer).
-1. Open the blender cli and run the `glacier2obj.py` script to generate an obj by importing all the Aloc or Prim files, copy them the number if times they are used in the scene, and transform each one according to what was sent by the game, and save it to `output.obj` in the specified output folder.
+1. Extract all the necessary Aloc or Prim files from the rpkg files to the `aloc` or `prim` folder of the specified output folder using navkit-rpkg-lib (A rust library included in the installer).
+1. Open the blender cli and run the `glacier2obj.py` script to generate an obj by importing all the Aloc or Prim files, copy them the number if times they are used in the scene, and transform each one according to what was sent by the game, and save it to `output.obj` and / or `output.blend` in the specified output folder.
1. Load `output.obj` from the specified output folder or another specified Obj file.
-1. At this point, the build Navp section of the menu will be available, and you can customize the parameters with "Settings > Recast Settings" on the menu bar, then press "Build > Build Navp" on the menu bar to call Recast to generate the Navmesh. Then you can save the Navmesh as a Navp or Navp.json file by pressing the Save Navp button.
+1. At this point, the build Navp section of the menu will be available. You can customize the parameters with "Settings > Recast Settings" on the menu bar, then press "Build > Build Navp" on the menu bar to call Recast to generate the Navmesh. Then you can save the Navmesh as a Navp or Navp.json file by pressing the Save Navp button.
1. At this point, the build Airg section of the menu will be available, and you can customize the parameters, then press build to generate the Airg.
# Disclaimer
-*NavKit is still a work in progress, and there may be glitches or issues with Obj, Navp, or Airg generation in the current version. If you encounter any problems while running NavKit please create an issue on this GitHub repo.*
+*NavKit is still a work in progress, and there may be glitches or issues with Obj, Blend, Navp, or Airg generation in the current version. If you encounter any problems while running NavKit, please create an issue on this GitHub repo.*
# Future enhancements
* Faster Scene generation
* Linux and macOS support
-* More issues on the Issues tab
+* More planned features are on the Issues tab
# Building instructions (CLion or Visual Studio)
1. Clone this repository with the '--recurse-submodules' option
1. Open in Visual Studio or CLion
@@ -127,8 +127,10 @@ Jojje
Kercyx
Kevin Rudd
LaNombre
+xiuliu⅃
Luka
Lyssa
+Mark2580
NoFate
Notex
Pavle
diff --git a/include/NavKit/NavKitConfig.h b/include/NavKit/NavKitConfig.h
index 72bc9df..08bb7ad 100644
--- a/include/NavKit/NavKitConfig.h
+++ b/include/NavKit/NavKitConfig.h
@@ -1,3 +1,3 @@
#define NavKit_VERSION_MAJOR "2"
-#define NavKit_VERSION_MINOR "12"
-#define NavKit_VERSION_PATCH "3"
+#define NavKit_VERSION_MINOR "13"
+#define NavKit_VERSION_PATCH "0"
diff --git a/include/NavKit/model/Json.h b/include/NavKit/model/Json.h
index 77beb79..d6e05a7 100644
--- a/include/NavKit/model/Json.h
+++ b/include/NavKit/model/Json.h
@@ -9,30 +9,48 @@
namespace Json {
template struct SimdJsonTypeMap;
- template <> struct SimdJsonTypeMap { using type = double; };
- template <> struct SimdJsonTypeMap { using type = double; };
- template <> struct SimdJsonTypeMap { using type = int64_t; };
- template <> struct SimdJsonTypeMap { using type = bool; };
- template <> struct SimdJsonTypeMap { using type = std::string_view; };
+ template <> struct SimdJsonTypeMap {
+ using type = double;
+ };
+
+ template <> struct SimdJsonTypeMap {
+ using type = double;
+ };
+
+ template <> struct SimdJsonTypeMap {
+ using type = int64_t;
+ };
+
+ template <> struct SimdJsonTypeMap {
+ using type = bool;
+ };
+
+ template <> struct SimdJsonTypeMap {
+ using type = std::string_view;
+ };
+
std::string toString(double val);
+
std::string toString(int64_t val);
+
std::string toString(bool val);
+
std::string toString(std::string_view val);
+
struct JsonValueProxy {
simdjson::ondemand::object json;
std::string field;
- template ::type>
- operator t();
+
+ template ::type> operator t();
};
+
JsonValueProxy getValue(simdjson::ondemand::object json, const std::string& field);
class Vec3 {
public:
- Vec3(): x(0), y(0), z(0) {
- } ;
+ Vec3() : x(0), y(0), z(0) {} ;
- Vec3(const float x, const float y, const float z) : x(x), y(y), z(z) {
- }
+ Vec3(const float x, const float y, const float z) : x(x), y(y), z(z) {}
float x;
float y;
@@ -40,16 +58,15 @@ namespace Json {
void readJson(simdjson::ondemand::object json);
- void writeJson(std::ostream &f, const std::string& propertyName = "position") const;
+ void writeJson(std::ostream& f, const std::string& propertyName = "position") const;
};
class Rotation {
public:
- Rotation(): x(0), y(0), z(0), w(0) {
- } ;
+ Rotation() : x(0), y(0), z(0), w(0) {} ;
+
+ Rotation(float x, float y, float z, float w) : x(x), y(y), z(z), w(w) {} ;
- Rotation(float x, float y, float z, float w): x(x), y(y), z(z), w(w) {
- } ;
float x;
float y;
float z;
@@ -57,28 +74,27 @@ namespace Json {
void readJson(simdjson::ondemand::object json);
- void writeJson(std::ostream &f) const;
+ void writeJson(std::ostream& f) const;
};
class PfBoxType {
public:
- PfBoxType(): type(""), data("") {
- };
+ PfBoxType() : type(""), data("") {};
+
std::string type{};
std::string data{};
void readJson(simdjson::ondemand::object json);
- void writeJson(std::ostream &f) const;
+ void writeJson(std::ostream& f) const;
};
class Vec3Wrapped {
public:
- Vec3Wrapped() {
- };
+ Vec3Wrapped() {};
+
+ Vec3Wrapped(const std::string& type, const Vec3 data) : type(type), data(data) {};
- Vec3Wrapped(const std::string& type, const Vec3 data) : type(type), data(data) {
- };
std::string type{};
Vec3 data{};
@@ -89,11 +105,10 @@ namespace Json {
class Entity {
public:
- Entity() {
- }
+ Entity() {}
+
std::string id;
std::string name;
- std::string tblu;
Vec3 position;
Rotation rotation;
PfBoxType type;
@@ -101,7 +116,7 @@ namespace Json {
void readJson(simdjson::ondemand::object json);
- void writeJson(std::ostream &f) const;
+ void writeJson(std::ostream& f) const;
};
class HashesAndEntity {
@@ -125,52 +140,47 @@ namespace Json {
std::string primHash;
std::string roomName;
std::string roomFolderName;
- std::string id;
+ Entity entity;
std::string name;
- std::string tblu;
Vec3 pos{};
Vec3Wrapped scale{};
Rotation rotation{};
- void writeJson(std::ostream &f) const;
+ void writeJson(std::ostream& f) const;
+
+ void readJson(simdjson::ondemand::object json);
};
class Meshes {
public:
- Meshes() {
- }
-
- Meshes(simdjson::ondemand::array alocs);
+ Meshes() = default;
- std::vector readMeshes() const;
+ Meshes(simdjson::ondemand::array meshesJson);
- std::vector hashesAndEntities{};
+ std::vector meshes{};
};
class PfBox {
public:
PfBox() = default;
- PfBox(const std::string &id, const std::string &name, const std::string &tblu, const Vec3 pos,
- const Vec3 scale, const Rotation rotation, const PfBoxType &type) :
- id(id), name(name), tblu(tblu), pos(pos), scale(scale), rotation(rotation), type(type) {
- }
+ PfBox(const std::string& id, const std::string& name, const Vec3 pos,
+ const Vec3 scale, const Rotation rotation, const PfBoxType& type) :
+ id(id), name(name), pos(pos), scale(scale), rotation(rotation), type(type) {}
std::string id{};
std::string name{};
- std::string tblu{};
Vec3 pos{};
Vec3 scale{};
Rotation rotation{};
PfBoxType type{};
- void writeJson(std::ostream &f) const;
+ void writeJson(std::ostream& f) const;
};
class PfBoxes {
public:
- PfBoxes() {
- }
+ PfBoxes() {}
static inline const std::string INCLUDE_TYPE = "PFBT_INCLUDE_MESH_COLLISION";
static inline const std::string EXCLUDE_TYPE = "PFBT_EXCLUDE_MESH_COLLISION";
@@ -188,20 +198,19 @@ namespace Json {
public:
Gate() = default;
- Gate(const std::string &id, const std::string &name, const std::string &tblu, const Vec3 position,
- Rotation rotation, const Vec3 bboxCenter, const Vec3 bboxHalfSize) : id(id), name(name), tblu(tblu), position(position), rotation(rotation),
- bboxCenter(bboxCenter), bboxHalfSize(bboxHalfSize) {
- }
+ Gate(const std::string& id, const std::string& name, const Vec3 position,
+ Rotation rotation, const Vec3 bboxCenter, const Vec3 bboxHalfSize) : id(id), name(name),
+ position(position), rotation(rotation),
+ bboxCenter(bboxCenter), bboxHalfSize(bboxHalfSize) {}
std::string id;
std::string name;
- std::string tblu;
Vec3 position{};
Rotation rotation{};
Vec3 bboxCenter{};
Vec3 bboxHalfSize{};
- void writeJson(std::ostream &f) const;
+ void writeJson(std::ostream& f) const;
void readJson(simdjson::ondemand::object json);
};
@@ -219,20 +228,19 @@ namespace Json {
public:
Room() = default;
- Room(const std::string &id, const std::string &name, const std::string &tblu, const Vec3 position,
- Rotation rotation, const Vec3Wrapped& roomExtentMin, const Vec3Wrapped& roomExtentMax) : id(id), name(name), tblu(tblu), position(position), rotation(rotation),
- roomExtentMin(roomExtentMin), roomExtentMax(roomExtentMax) {
- }
+ Room(const std::string& id, const std::string& name, const Vec3 position,
+ Rotation rotation, const Vec3Wrapped& roomExtentMin,
+ const Vec3Wrapped& roomExtentMax) : id(id), name(name), position(position), rotation(rotation),
+ roomExtentMin(roomExtentMin), roomExtentMax(roomExtentMax) {}
std::string id;
std::string name;
- std::string tblu;
Vec3 position{};
Rotation rotation{};
Vec3Wrapped roomExtentMin{};
Vec3Wrapped roomExtentMax{};
- void writeJson(std::ostream &f) const;
+ void writeJson(std::ostream& f) const;
void readJson(simdjson::ondemand::object json);
};
@@ -250,16 +258,14 @@ namespace Json {
public:
AiAreaWorld() = default;
- AiAreaWorld(const std::string &id, const std::string &name, const std::string &tblu,
- const Rotation rotation) : id(id), name(name), tblu(tblu), rotation(rotation) {
- }
+ AiAreaWorld(const std::string& id, const std::string& name,
+ const Rotation rotation) : id(id), name(name), rotation(rotation) {}
std::string id;
std::string name;
- std::string tblu;
Rotation rotation{};
- void writeJson(std::ostream &f) const;
+ void writeJson(std::ostream& f) const;
void readJson(simdjson::ondemand::object json);
};
@@ -277,16 +283,15 @@ namespace Json {
public:
ParentData() = default;
- 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) {
- }
+ ParentData(const std::string& id, const std::string& name, const std::string& source,
+ const std::string& type) : id(id), name(name), source(source), type(type) {}
std::string id;
std::string name;
std::string source;
- std::string tblu;
std::string type;
- void writeJson(std::ostream &f) const;
+ void writeJson(std::ostream& f) const;
void readJson(simdjson::ondemand::object json);
};
@@ -295,13 +300,12 @@ namespace Json {
public:
Parent() = default;
- Parent(const std::string &type, const ParentData &data) : type(type), data(data) {
- }
+ Parent(const std::string& type, const ParentData& data) : type(type), data(data) {}
std::string type;
ParentData data{};
- void writeJson(std::ostream &f) const;
+ void writeJson(std::ostream& f) const;
void readJson(simdjson::ondemand::object json);
};
@@ -310,20 +314,18 @@ namespace Json {
public:
AiArea() = default;
- AiArea(const std::string &id, const std::string &name, const std::string &tblu,
- const Rotation rotation, Parent parent) : id(id), name(name), tblu(tblu),
- rotation(rotation), parent(parent) {
- }
+ AiArea(const std::string& id, const std::string& name,
+ const Rotation rotation, Parent parent) : id(id), name(name),
+ rotation(rotation), parent(parent) {}
std::string id;
std::string name;
- std::string tblu;
Rotation rotation{};
std::vector logicalParents;
std::vector areaVolumeNames;
Parent parent{};
- void writeJson(std::ostream &f) const;
+ void writeJson(std::ostream& f) const;
void readJson(simdjson::ondemand::object json);
};
@@ -340,7 +342,9 @@ namespace Json {
class VolumeBoxes {
public:
VolumeBoxes() = default;
+
explicit VolumeBoxes(simdjson::ondemand::array volumeBoxesJson);
+
std::vector volumeBoxes{};
};
@@ -348,12 +352,12 @@ namespace Json {
public:
Radius() = default;
- Radius(const std::string &type, const float data) : type(type), data(data) {
- }
+ Radius(const std::string& type, const float data) : type(type), data(data) {}
std::string type;
float data;
- void writeJson(std::ostream &f) const;
+
+ void writeJson(std::ostream& f) const;
void readJson(simdjson::ondemand::object json);
};
@@ -362,17 +366,17 @@ namespace Json {
public:
VolumeSphere() = default;
- VolumeSphere(const std::string &id, const std::string &name, const Vec3 &position,
- const Rotation &rotation, const Radius &radius) : id(id), name(name), position(position),
- rotation(rotation), radius(radius) {
- }
+ VolumeSphere(const std::string& id, const std::string& name, const Vec3& position,
+ const Rotation& rotation, const Radius& radius) : id(id), name(name), position(position),
+ rotation(rotation), radius(radius) {}
std::string id;
std::string name;
Vec3 position{};
Rotation rotation{};
Radius radius{};
- void writeJson(std::ostream &f) const;
+
+ void writeJson(std::ostream& f) const;
void readJson(simdjson::ondemand::object json);
};
@@ -380,7 +384,9 @@ namespace Json {
class VolumeSpheres {
public:
VolumeSpheres() = default;
+
explicit VolumeSpheres(simdjson::ondemand::array volumeSpheresJson);
+
std::vector volumeSpheres{};
};
@@ -388,23 +394,20 @@ namespace Json {
public:
PfSeedPoint() = default;
- PfSeedPoint(const std::string &id, const std::string &name, const std::string &tblu, const Vec3 pos,
- Rotation rotation) : id(id), name(name), tblu(tblu), pos(pos), rotation(rotation) {
- }
+ PfSeedPoint(const std::string& id, const std::string& name, const Vec3 pos,
+ Rotation rotation) : id(id), name(name), pos(pos), rotation(rotation) {}
std::string id;
std::string name;
- std::string tblu;
Vec3 pos{};
Rotation rotation{};
- void writeJson(std::ostream &f) const;
+ void writeJson(std::ostream& f) const;
};
class PfSeedPoints {
public:
- PfSeedPoints() {
- }
+ PfSeedPoints() {}
PfSeedPoints(simdjson::ondemand::array pfSeedPoints);
@@ -424,7 +427,6 @@ namespace Json {
void writeJson(std::ostream& f) const;
std::string hash;
- std::string className;
std::string diffuse;
std::string normal;
std::string specular;
@@ -432,8 +434,7 @@ namespace Json {
class Matis {
public:
- Matis() {
- }
+ Matis() {}
Matis(simdjson::ondemand::array matisJson);
@@ -442,11 +443,11 @@ namespace Json {
class PrimMati {
public:
- PrimMati() {
+ PrimMati() {}
- }
std::string primHash;
std::vector matiHashes{};
+
void readJson(simdjson::ondemand::object jsonDocument);
void writeJson(std::ostream& f) const;
@@ -454,8 +455,7 @@ namespace Json {
class PrimMatis {
public:
- PrimMatis() {
- }
+ PrimMatis() {}
PrimMatis(simdjson::ondemand::array primMatisJson);
diff --git a/include/NavKit/module/Airg.h b/include/NavKit/module/Airg.h
index 9714b95..1241ed9 100644
--- a/include/NavKit/module/Airg.h
+++ b/include/NavKit/module/Airg.h
@@ -1,4 +1,5 @@
#pragma once
+#include
#include
#include
#include
@@ -132,6 +133,7 @@ class Airg {
static std::string selectedRpkgAirg;
static std::map airgHashIoiStringMap;
+ static std::mutex airgHashIoiStringMapMutex;
private:
static GLuint airgLineVbo;
diff --git a/include/NavKit/module/Navp.h b/include/NavKit/module/Navp.h
index bc005bc..9450cf2 100644
--- a/include/NavKit/module/Navp.h
+++ b/include/NavKit/module/Navp.h
@@ -1,4 +1,5 @@
#pragma once
+#include
#include