This commit is contained in:
Tim Blume 2024-06-04 11:42:58 +02:00
parent fd1e24e442
commit 2a8b530c98
3 changed files with 40 additions and 2 deletions

15
src/RecastNavMesh.cpp Normal file
View file

@ -0,0 +1,15 @@
#include "RecastNavMesh.hpp"
RecastNavMesh::RecastNavMesh() {
}
RecastNavMesh::~RecastNavMesh() {
}
void RecastNavMesh::_bind_methods() {
}

22
src/RecastNavMesh.hpp Normal file
View file

@ -0,0 +1,22 @@
#pragma once
#include <godot_cpp/classes/node3d.hpp>
namespace godot {
class RecastNavMesh : public Node3D {
GDCLASS(RecastNavMesh, Node3D)
private:
bool calculated = false;
protected:
static void _bind_methods();
public:
RecastNavMesh();
~RecastNavMesh();
void clear_vertices();
bool add_vertices(const PackedByteArray& vertices);
bool recalculate_navmesh();
bool is_calculated() { return calculated; }
};
}

View file

@ -1,12 +1,14 @@
#include <godot_cpp/godot.hpp>
#include <godot_cpp/core/class_db.hpp>
#include "RecastNavMesh.hpp"
void register_gameplay_types(godot::ModuleInitializationLevel p_level) {
if (p_level != godot::ModuleInitializationLevel::MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
// REGISTER CLASSES HERE LATER
ClassDB::register_class<RecastNavMesh>();
}
void unregister_gameplay_types(godot::ModuleInitializationLevel p_level) {
@ -15,7 +17,6 @@ void unregister_gameplay_types(godot::ModuleInitializationLevel p_level) {
extern "C" {
GDExtensionBool GDE_EXPORT recastnavigation_library_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) {
godot::GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization);
init_obj.register_initializer(register_gameplay_types);