From 25056fd5e8ea20d3c5f69052023b5ab0af7165a2 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 8 Jun 2024 15:03:04 +0200 Subject: [PATCH] . --- CMakeLists.txt | 1 + src/RecastContext.cpp | 17 ----------------- src/RecastContext.hpp | 19 ------------------- src/RecastNavMesh.cpp | 6 +++++- src/RecastNavMesh.hpp | 8 ++++++-- 5 files changed, 12 insertions(+), 39 deletions(-) delete mode 100644 src/RecastContext.cpp delete mode 100644 src/RecastContext.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index fe04474..7014273 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,3 +17,4 @@ src/RecastNavMesh.cpp target_include_directories(godot-recast-navigation PRIVATE src/) target_link_libraries(godot-recast-navigation PUBLIC godot::cpp Recast) +target_link_options(godot-recast-navigation PRIVATE -Wl,--no-undefined) diff --git a/src/RecastContext.cpp b/src/RecastContext.cpp deleted file mode 100644 index 05d7b5b..0000000 --- a/src/RecastContext.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "RecastContext.hpp" - -godot::RecastContext::RecastContext() { - -} - -godot::RecastContext::~RecastContext() { - -} - -void godot::RecastContext::_bind_methods() { - ADD_SIGNAL(MethodInfo("do_log"), PropertyInfo(Variant::INT, "category"), PropertyInfo(Variant::STRING, "msg")); -} - -void godot::RecastContext::doLog(const rcLogCategory category, const char* msg, const int len) { - -} diff --git a/src/RecastContext.hpp b/src/RecastContext.hpp deleted file mode 100644 index 9a904ce..0000000 --- a/src/RecastContext.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include "godot_cpp/classes/node3d.hpp" -#include "Recast.h" - -namespace godot { - - class RecastContext : public Object, public rcContext { - GDCLASS(RecastContext, Object) - private: - protected: - static void _bind_methods(); - virtual void doLog(const rcLogCategory category, const char* msg, const int len); - public: - RecastContext(); - ~RecastContext(); - }; - -} diff --git a/src/RecastNavMesh.cpp b/src/RecastNavMesh.cpp index a97070d..315d0b2 100644 --- a/src/RecastNavMesh.cpp +++ b/src/RecastNavMesh.cpp @@ -1,7 +1,9 @@ #include "RecastNavMesh.hpp" +#include "Recast.h" #include +#include -godot::RecastNavMesh::RecastNavMesh() { +godot::RecastNavMesh::RecastNavMesh() : Node3D(), rcContext() { } godot::RecastNavMesh::~RecastNavMesh() { @@ -9,6 +11,8 @@ godot::RecastNavMesh::~RecastNavMesh() { } void godot::RecastNavMesh::_bind_methods() { + // Context + ADD_SIGNAL(MethodInfo("do_log", PropertyInfo(Variant::INT, "category"), PropertyInfo(Variant::STRING, "msg"))); // Config ClassDB::bind_method(D_METHOD("get_width"), &RecastNavMesh::get_width); ClassDB::bind_method(D_METHOD("get_height"), &RecastNavMesh::get_height); diff --git a/src/RecastNavMesh.hpp b/src/RecastNavMesh.hpp index 9db28e6..0cadadf 100644 --- a/src/RecastNavMesh.hpp +++ b/src/RecastNavMesh.hpp @@ -1,7 +1,6 @@ #pragma once #include "godot_cpp/classes/node3d.hpp" -#include "godot_cpp/templates/vector.hpp" #include "Recast.h" @@ -14,7 +13,7 @@ enum RecastPartitionType { PARTITION_TYPE_COUNT }; -class RecastNavMesh : public Node3D { +class RecastNavMesh : public Node3D, public rcContext { GDCLASS(RecastNavMesh, Node3D) private: bool m_calculated = false; @@ -27,8 +26,13 @@ private: rcHeightfield* m_heightfield = NULL; rcCompactHeightfield* m_compact_heightfield = NULL; + rcPolyMesh* m_poly_mesh = NULL; + rcPolyMeshDetail* m_poly_mesh_detail = NULL; protected: static void _bind_methods(); + void doLog(const rcLogCategory category, const char* msg, const int len) override { + emit_signal("do_log", category, msg); + } public: RecastNavMesh(); ~RecastNavMesh();