You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
Rename GdNavigationServer to GodotNavigationServer
And rename `gdnavigation` module to simply `navigation`.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* gd_navigation_server.cpp */
|
/* godot_navigation_server.cpp */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* This file is part of: */
|
/* This file is part of: */
|
||||||
/* GODOT ENGINE */
|
/* GODOT ENGINE */
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#include "gd_navigation_server.h"
|
#include "godot_navigation_server.h"
|
||||||
|
|
||||||
#include "core/os/mutex.h"
|
#include "core/os/mutex.h"
|
||||||
|
|
||||||
@@ -50,16 +50,16 @@
|
|||||||
MERGE(F_NAME, _command) \
|
MERGE(F_NAME, _command) \
|
||||||
(T_0 p_d_0) : \
|
(T_0 p_d_0) : \
|
||||||
d_0(p_d_0) {} \
|
d_0(p_d_0) {} \
|
||||||
virtual void exec(GdNavigationServer *server) { \
|
virtual void exec(GodotNavigationServer *server) { \
|
||||||
server->MERGE(_cmd_, F_NAME)(d_0); \
|
server->MERGE(_cmd_, F_NAME)(d_0); \
|
||||||
} \
|
} \
|
||||||
}; \
|
}; \
|
||||||
void GdNavigationServer::F_NAME(T_0 D_0) const { \
|
void GodotNavigationServer::F_NAME(T_0 D_0) const { \
|
||||||
auto cmd = memnew(MERGE(F_NAME, _command)( \
|
auto cmd = memnew(MERGE(F_NAME, _command)( \
|
||||||
D_0)); \
|
D_0)); \
|
||||||
add_command(cmd); \
|
add_command(cmd); \
|
||||||
} \
|
} \
|
||||||
void GdNavigationServer::MERGE(_cmd_, F_NAME)(T_0 D_0)
|
void GodotNavigationServer::MERGE(_cmd_, F_NAME)(T_0 D_0)
|
||||||
|
|
||||||
#define COMMAND_2(F_NAME, T_0, D_0, T_1, D_1) \
|
#define COMMAND_2(F_NAME, T_0, D_0, T_1, D_1) \
|
||||||
struct MERGE(F_NAME, _command) : public SetCommand { \
|
struct MERGE(F_NAME, _command) : public SetCommand { \
|
||||||
@@ -71,17 +71,17 @@
|
|||||||
T_1 p_d_1) : \
|
T_1 p_d_1) : \
|
||||||
d_0(p_d_0), \
|
d_0(p_d_0), \
|
||||||
d_1(p_d_1) {} \
|
d_1(p_d_1) {} \
|
||||||
virtual void exec(GdNavigationServer *server) { \
|
virtual void exec(GodotNavigationServer *server) { \
|
||||||
server->MERGE(_cmd_, F_NAME)(d_0, d_1); \
|
server->MERGE(_cmd_, F_NAME)(d_0, d_1); \
|
||||||
} \
|
} \
|
||||||
}; \
|
}; \
|
||||||
void GdNavigationServer::F_NAME(T_0 D_0, T_1 D_1) const { \
|
void GodotNavigationServer::F_NAME(T_0 D_0, T_1 D_1) const { \
|
||||||
auto cmd = memnew(MERGE(F_NAME, _command)( \
|
auto cmd = memnew(MERGE(F_NAME, _command)( \
|
||||||
D_0, \
|
D_0, \
|
||||||
D_1)); \
|
D_1)); \
|
||||||
add_command(cmd); \
|
add_command(cmd); \
|
||||||
} \
|
} \
|
||||||
void GdNavigationServer::MERGE(_cmd_, F_NAME)(T_0 D_0, T_1 D_1)
|
void GodotNavigationServer::MERGE(_cmd_, F_NAME)(T_0 D_0, T_1 D_1)
|
||||||
|
|
||||||
#define COMMAND_4(F_NAME, T_0, D_0, T_1, D_1, T_2, D_2, T_3, D_3) \
|
#define COMMAND_4(F_NAME, T_0, D_0, T_1, D_1, T_2, D_2, T_3, D_3) \
|
||||||
struct MERGE(F_NAME, _command) : public SetCommand { \
|
struct MERGE(F_NAME, _command) : public SetCommand { \
|
||||||
@@ -99,11 +99,11 @@
|
|||||||
d_1(p_d_1), \
|
d_1(p_d_1), \
|
||||||
d_2(p_d_2), \
|
d_2(p_d_2), \
|
||||||
d_3(p_d_3) {} \
|
d_3(p_d_3) {} \
|
||||||
virtual void exec(GdNavigationServer *server) { \
|
virtual void exec(GodotNavigationServer *server) { \
|
||||||
server->MERGE(_cmd_, F_NAME)(d_0, d_1, d_2, d_3); \
|
server->MERGE(_cmd_, F_NAME)(d_0, d_1, d_2, d_3); \
|
||||||
} \
|
} \
|
||||||
}; \
|
}; \
|
||||||
void GdNavigationServer::F_NAME(T_0 D_0, T_1 D_1, T_2 D_2, T_3 D_3) const { \
|
void GodotNavigationServer::F_NAME(T_0 D_0, T_1 D_1, T_2 D_2, T_3 D_3) const { \
|
||||||
auto cmd = memnew(MERGE(F_NAME, _command)( \
|
auto cmd = memnew(MERGE(F_NAME, _command)( \
|
||||||
D_0, \
|
D_0, \
|
||||||
D_1, \
|
D_1, \
|
||||||
@@ -111,26 +111,26 @@
|
|||||||
D_3)); \
|
D_3)); \
|
||||||
add_command(cmd); \
|
add_command(cmd); \
|
||||||
} \
|
} \
|
||||||
void GdNavigationServer::MERGE(_cmd_, F_NAME)(T_0 D_0, T_1 D_1, T_2 D_2, T_3 D_3)
|
void GodotNavigationServer::MERGE(_cmd_, F_NAME)(T_0 D_0, T_1 D_1, T_2 D_2, T_3 D_3)
|
||||||
|
|
||||||
GdNavigationServer::GdNavigationServer() :
|
GodotNavigationServer::GodotNavigationServer() :
|
||||||
NavigationServer3D() {
|
NavigationServer3D() {
|
||||||
}
|
}
|
||||||
|
|
||||||
GdNavigationServer::~GdNavigationServer() {
|
GodotNavigationServer::~GodotNavigationServer() {
|
||||||
flush_queries();
|
flush_queries();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdNavigationServer::add_command(SetCommand *command) const {
|
void GodotNavigationServer::add_command(SetCommand *command) const {
|
||||||
GdNavigationServer *mut_this = const_cast<GdNavigationServer *>(this);
|
GodotNavigationServer *mut_this = const_cast<GodotNavigationServer *>(this);
|
||||||
{
|
{
|
||||||
MutexLock lock(commands_mutex);
|
MutexLock lock(commands_mutex);
|
||||||
mut_this->commands.push_back(command);
|
mut_this->commands.push_back(command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RID GdNavigationServer::map_create() const {
|
RID GodotNavigationServer::map_create() const {
|
||||||
GdNavigationServer *mut_this = const_cast<GdNavigationServer *>(this);
|
GodotNavigationServer *mut_this = const_cast<GodotNavigationServer *>(this);
|
||||||
MutexLock lock(mut_this->operations_mutex);
|
MutexLock lock(mut_this->operations_mutex);
|
||||||
RID rid = map_owner.make_rid();
|
RID rid = map_owner.make_rid();
|
||||||
NavMap *space = map_owner.getornull(rid);
|
NavMap *space = map_owner.getornull(rid);
|
||||||
@@ -155,7 +155,7 @@ COMMAND_2(map_set_active, RID, p_map, bool, p_active) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GdNavigationServer::map_is_active(RID p_map) const {
|
bool GodotNavigationServer::map_is_active(RID p_map) const {
|
||||||
NavMap *map = map_owner.getornull(p_map);
|
NavMap *map = map_owner.getornull(p_map);
|
||||||
ERR_FAIL_COND_V(map == nullptr, false);
|
ERR_FAIL_COND_V(map == nullptr, false);
|
||||||
|
|
||||||
@@ -169,7 +169,7 @@ COMMAND_2(map_set_up, RID, p_map, Vector3, p_up) {
|
|||||||
map->set_up(p_up);
|
map->set_up(p_up);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 GdNavigationServer::map_get_up(RID p_map) const {
|
Vector3 GodotNavigationServer::map_get_up(RID p_map) const {
|
||||||
const NavMap *map = map_owner.getornull(p_map);
|
const NavMap *map = map_owner.getornull(p_map);
|
||||||
ERR_FAIL_COND_V(map == nullptr, Vector3());
|
ERR_FAIL_COND_V(map == nullptr, Vector3());
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ COMMAND_2(map_set_cell_size, RID, p_map, real_t, p_cell_size) {
|
|||||||
map->set_cell_size(p_cell_size);
|
map->set_cell_size(p_cell_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
real_t GdNavigationServer::map_get_cell_size(RID p_map) const {
|
real_t GodotNavigationServer::map_get_cell_size(RID p_map) const {
|
||||||
const NavMap *map = map_owner.getornull(p_map);
|
const NavMap *map = map_owner.getornull(p_map);
|
||||||
ERR_FAIL_COND_V(map == nullptr, 0);
|
ERR_FAIL_COND_V(map == nullptr, 0);
|
||||||
|
|
||||||
@@ -197,50 +197,50 @@ COMMAND_2(map_set_edge_connection_margin, RID, p_map, real_t, p_connection_margi
|
|||||||
map->set_edge_connection_margin(p_connection_margin);
|
map->set_edge_connection_margin(p_connection_margin);
|
||||||
}
|
}
|
||||||
|
|
||||||
real_t GdNavigationServer::map_get_edge_connection_margin(RID p_map) const {
|
real_t GodotNavigationServer::map_get_edge_connection_margin(RID p_map) const {
|
||||||
const NavMap *map = map_owner.getornull(p_map);
|
const NavMap *map = map_owner.getornull(p_map);
|
||||||
ERR_FAIL_COND_V(map == nullptr, 0);
|
ERR_FAIL_COND_V(map == nullptr, 0);
|
||||||
|
|
||||||
return map->get_edge_connection_margin();
|
return map->get_edge_connection_margin();
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<Vector3> GdNavigationServer::map_get_path(RID p_map, Vector3 p_origin, Vector3 p_destination, bool p_optimize, uint32_t p_layers) const {
|
Vector<Vector3> GodotNavigationServer::map_get_path(RID p_map, Vector3 p_origin, Vector3 p_destination, bool p_optimize, uint32_t p_layers) const {
|
||||||
const NavMap *map = map_owner.getornull(p_map);
|
const NavMap *map = map_owner.getornull(p_map);
|
||||||
ERR_FAIL_COND_V(map == nullptr, Vector<Vector3>());
|
ERR_FAIL_COND_V(map == nullptr, Vector<Vector3>());
|
||||||
|
|
||||||
return map->get_path(p_origin, p_destination, p_optimize, p_layers);
|
return map->get_path(p_origin, p_destination, p_optimize, p_layers);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 GdNavigationServer::map_get_closest_point_to_segment(RID p_map, const Vector3 &p_from, const Vector3 &p_to, const bool p_use_collision) const {
|
Vector3 GodotNavigationServer::map_get_closest_point_to_segment(RID p_map, const Vector3 &p_from, const Vector3 &p_to, const bool p_use_collision) const {
|
||||||
const NavMap *map = map_owner.getornull(p_map);
|
const NavMap *map = map_owner.getornull(p_map);
|
||||||
ERR_FAIL_COND_V(map == nullptr, Vector3());
|
ERR_FAIL_COND_V(map == nullptr, Vector3());
|
||||||
|
|
||||||
return map->get_closest_point_to_segment(p_from, p_to, p_use_collision);
|
return map->get_closest_point_to_segment(p_from, p_to, p_use_collision);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 GdNavigationServer::map_get_closest_point(RID p_map, const Vector3 &p_point) const {
|
Vector3 GodotNavigationServer::map_get_closest_point(RID p_map, const Vector3 &p_point) const {
|
||||||
const NavMap *map = map_owner.getornull(p_map);
|
const NavMap *map = map_owner.getornull(p_map);
|
||||||
ERR_FAIL_COND_V(map == nullptr, Vector3());
|
ERR_FAIL_COND_V(map == nullptr, Vector3());
|
||||||
|
|
||||||
return map->get_closest_point(p_point);
|
return map->get_closest_point(p_point);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 GdNavigationServer::map_get_closest_point_normal(RID p_map, const Vector3 &p_point) const {
|
Vector3 GodotNavigationServer::map_get_closest_point_normal(RID p_map, const Vector3 &p_point) const {
|
||||||
const NavMap *map = map_owner.getornull(p_map);
|
const NavMap *map = map_owner.getornull(p_map);
|
||||||
ERR_FAIL_COND_V(map == nullptr, Vector3());
|
ERR_FAIL_COND_V(map == nullptr, Vector3());
|
||||||
|
|
||||||
return map->get_closest_point_normal(p_point);
|
return map->get_closest_point_normal(p_point);
|
||||||
}
|
}
|
||||||
|
|
||||||
RID GdNavigationServer::map_get_closest_point_owner(RID p_map, const Vector3 &p_point) const {
|
RID GodotNavigationServer::map_get_closest_point_owner(RID p_map, const Vector3 &p_point) const {
|
||||||
const NavMap *map = map_owner.getornull(p_map);
|
const NavMap *map = map_owner.getornull(p_map);
|
||||||
ERR_FAIL_COND_V(map == nullptr, RID());
|
ERR_FAIL_COND_V(map == nullptr, RID());
|
||||||
|
|
||||||
return map->get_closest_point_owner(p_point);
|
return map->get_closest_point_owner(p_point);
|
||||||
}
|
}
|
||||||
|
|
||||||
RID GdNavigationServer::region_create() const {
|
RID GodotNavigationServer::region_create() const {
|
||||||
GdNavigationServer *mut_this = const_cast<GdNavigationServer *>(this);
|
GodotNavigationServer *mut_this = const_cast<GodotNavigationServer *>(this);
|
||||||
MutexLock lock(mut_this->operations_mutex);
|
MutexLock lock(mut_this->operations_mutex);
|
||||||
RID rid = region_owner.make_rid();
|
RID rid = region_owner.make_rid();
|
||||||
NavRegion *reg = region_owner.getornull(rid);
|
NavRegion *reg = region_owner.getornull(rid);
|
||||||
@@ -284,7 +284,7 @@ COMMAND_2(region_set_layers, RID, p_region, uint32_t, p_layers) {
|
|||||||
region->set_layers(p_layers);
|
region->set_layers(p_layers);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t GdNavigationServer::region_get_layers(RID p_region) const {
|
uint32_t GodotNavigationServer::region_get_layers(RID p_region) const {
|
||||||
NavRegion *region = region_owner.getornull(p_region);
|
NavRegion *region = region_owner.getornull(p_region);
|
||||||
ERR_FAIL_COND_V(region == nullptr, 0);
|
ERR_FAIL_COND_V(region == nullptr, 0);
|
||||||
|
|
||||||
@@ -298,7 +298,7 @@ COMMAND_2(region_set_navmesh, RID, p_region, Ref<NavigationMesh>, p_nav_mesh) {
|
|||||||
region->set_mesh(p_nav_mesh);
|
region->set_mesh(p_nav_mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdNavigationServer::region_bake_navmesh(Ref<NavigationMesh> r_mesh, Node *p_node) const {
|
void GodotNavigationServer::region_bake_navmesh(Ref<NavigationMesh> r_mesh, Node *p_node) const {
|
||||||
ERR_FAIL_COND(r_mesh.is_null());
|
ERR_FAIL_COND(r_mesh.is_null());
|
||||||
ERR_FAIL_COND(p_node == nullptr);
|
ERR_FAIL_COND(p_node == nullptr);
|
||||||
|
|
||||||
@@ -308,29 +308,29 @@ void GdNavigationServer::region_bake_navmesh(Ref<NavigationMesh> r_mesh, Node *p
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int GdNavigationServer::region_get_connections_count(RID p_region) const {
|
int GodotNavigationServer::region_get_connections_count(RID p_region) const {
|
||||||
NavRegion *region = region_owner.getornull(p_region);
|
NavRegion *region = region_owner.getornull(p_region);
|
||||||
ERR_FAIL_COND_V(!region, 0);
|
ERR_FAIL_COND_V(!region, 0);
|
||||||
|
|
||||||
return region->get_connections_count();
|
return region->get_connections_count();
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 GdNavigationServer::region_get_connection_pathway_start(RID p_region, int p_connection_id) const {
|
Vector3 GodotNavigationServer::region_get_connection_pathway_start(RID p_region, int p_connection_id) const {
|
||||||
NavRegion *region = region_owner.getornull(p_region);
|
NavRegion *region = region_owner.getornull(p_region);
|
||||||
ERR_FAIL_COND_V(!region, Vector3());
|
ERR_FAIL_COND_V(!region, Vector3());
|
||||||
|
|
||||||
return region->get_connection_pathway_start(p_connection_id);
|
return region->get_connection_pathway_start(p_connection_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 GdNavigationServer::region_get_connection_pathway_end(RID p_region, int p_connection_id) const {
|
Vector3 GodotNavigationServer::region_get_connection_pathway_end(RID p_region, int p_connection_id) const {
|
||||||
NavRegion *region = region_owner.getornull(p_region);
|
NavRegion *region = region_owner.getornull(p_region);
|
||||||
ERR_FAIL_COND_V(!region, Vector3());
|
ERR_FAIL_COND_V(!region, Vector3());
|
||||||
|
|
||||||
return region->get_connection_pathway_end(p_connection_id);
|
return region->get_connection_pathway_end(p_connection_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
RID GdNavigationServer::agent_create() const {
|
RID GodotNavigationServer::agent_create() const {
|
||||||
GdNavigationServer *mut_this = const_cast<GdNavigationServer *>(this);
|
GodotNavigationServer *mut_this = const_cast<GodotNavigationServer *>(this);
|
||||||
MutexLock lock(mut_this->operations_mutex);
|
MutexLock lock(mut_this->operations_mutex);
|
||||||
RID rid = agent_owner.make_rid();
|
RID rid = agent_owner.make_rid();
|
||||||
RvoAgent *agent = agent_owner.getornull(rid);
|
RvoAgent *agent = agent_owner.getornull(rid);
|
||||||
@@ -428,7 +428,7 @@ COMMAND_2(agent_set_ignore_y, RID, p_agent, bool, p_ignore) {
|
|||||||
agent->get_agent()->ignore_y_ = p_ignore;
|
agent->get_agent()->ignore_y_ = p_ignore;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GdNavigationServer::agent_is_map_changed(RID p_agent) const {
|
bool GodotNavigationServer::agent_is_map_changed(RID p_agent) const {
|
||||||
RvoAgent *agent = agent_owner.getornull(p_agent);
|
RvoAgent *agent = agent_owner.getornull(p_agent);
|
||||||
ERR_FAIL_COND_V(agent == nullptr, false);
|
ERR_FAIL_COND_V(agent == nullptr, false);
|
||||||
|
|
||||||
@@ -500,13 +500,13 @@ COMMAND_1(free, RID, p_object) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdNavigationServer::set_active(bool p_active) const {
|
void GodotNavigationServer::set_active(bool p_active) const {
|
||||||
GdNavigationServer *mut_this = const_cast<GdNavigationServer *>(this);
|
GodotNavigationServer *mut_this = const_cast<GodotNavigationServer *>(this);
|
||||||
MutexLock lock(mut_this->operations_mutex);
|
MutexLock lock(mut_this->operations_mutex);
|
||||||
mut_this->active = p_active;
|
mut_this->active = p_active;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdNavigationServer::flush_queries() {
|
void GodotNavigationServer::flush_queries() {
|
||||||
// In c++ we can't be sure that this is performed in the main thread
|
// In c++ we can't be sure that this is performed in the main thread
|
||||||
// even with mutable functions.
|
// even with mutable functions.
|
||||||
MutexLock lock(commands_mutex);
|
MutexLock lock(commands_mutex);
|
||||||
@@ -518,7 +518,7 @@ void GdNavigationServer::flush_queries() {
|
|||||||
commands.clear();
|
commands.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdNavigationServer::process(real_t p_delta_time) {
|
void GodotNavigationServer::process(real_t p_delta_time) {
|
||||||
flush_queries();
|
flush_queries();
|
||||||
|
|
||||||
if (!active) {
|
if (!active) {
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* gd_navigation_server.h */
|
/* godot_navigation_server.h */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* This file is part of: */
|
/* This file is part of: */
|
||||||
/* GODOT ENGINE */
|
/* GODOT ENGINE */
|
||||||
@@ -28,8 +28,8 @@
|
|||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
#ifndef GD_NAVIGATION_SERVER_H
|
#ifndef GODOT_NAVIGATION_SERVER_H
|
||||||
#define GD_NAVIGATION_SERVER_H
|
#define GODOT_NAVIGATION_SERVER_H
|
||||||
|
|
||||||
#include "core/templates/local_vector.h"
|
#include "core/templates/local_vector.h"
|
||||||
#include "core/templates/rid.h"
|
#include "core/templates/rid.h"
|
||||||
@@ -61,14 +61,14 @@
|
|||||||
virtual void F_NAME(T_0 D_0, T_1 D_1, T_2 D_2, T_3 D_3 = D_3_DEF) const; \
|
virtual void F_NAME(T_0 D_0, T_1 D_1, T_2 D_2, T_3 D_3 = D_3_DEF) const; \
|
||||||
void MERGE(_cmd_, F_NAME)(T_0 D_0, T_1 D_1, T_2 D_2, T_3 D_3)
|
void MERGE(_cmd_, F_NAME)(T_0 D_0, T_1 D_1, T_2 D_2, T_3 D_3)
|
||||||
|
|
||||||
class GdNavigationServer;
|
class GodotNavigationServer;
|
||||||
|
|
||||||
struct SetCommand {
|
struct SetCommand {
|
||||||
virtual ~SetCommand() {}
|
virtual ~SetCommand() {}
|
||||||
virtual void exec(GdNavigationServer *server) = 0;
|
virtual void exec(GodotNavigationServer *server) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GdNavigationServer : public NavigationServer3D {
|
class GodotNavigationServer : public NavigationServer3D {
|
||||||
Mutex commands_mutex;
|
Mutex commands_mutex;
|
||||||
/// Mutex used to make any operation threadsafe.
|
/// Mutex used to make any operation threadsafe.
|
||||||
Mutex operations_mutex;
|
Mutex operations_mutex;
|
||||||
@@ -84,8 +84,8 @@ class GdNavigationServer : public NavigationServer3D {
|
|||||||
LocalVector<uint32_t> active_maps_update_id;
|
LocalVector<uint32_t> active_maps_update_id;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GdNavigationServer();
|
GodotNavigationServer();
|
||||||
virtual ~GdNavigationServer();
|
virtual ~GodotNavigationServer();
|
||||||
|
|
||||||
void add_command(SetCommand *command) const;
|
void add_command(SetCommand *command) const;
|
||||||
|
|
||||||
@@ -146,4 +146,4 @@ public:
|
|||||||
#undef COMMAND_2
|
#undef COMMAND_2
|
||||||
#undef COMMAND_4_DEF
|
#undef COMMAND_4_DEF
|
||||||
|
|
||||||
#endif // GD_NAVIGATION_SERVER_H
|
#endif // GODOT_NAVIGATION_SERVER_H
|
||||||
@@ -31,9 +31,10 @@
|
|||||||
#include "register_types.h"
|
#include "register_types.h"
|
||||||
|
|
||||||
#include "core/config/engine.h"
|
#include "core/config/engine.h"
|
||||||
#include "gd_navigation_server.h"
|
|
||||||
#include "servers/navigation_server_3d.h"
|
#include "servers/navigation_server_3d.h"
|
||||||
|
|
||||||
|
#include "godot_navigation_server.h"
|
||||||
|
|
||||||
#ifndef _3D_DISABLED
|
#ifndef _3D_DISABLED
|
||||||
#include "navigation_mesh_generator.h"
|
#include "navigation_mesh_generator.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -42,19 +43,15 @@
|
|||||||
#include "navigation_mesh_editor_plugin.h"
|
#include "navigation_mesh_editor_plugin.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
@author AndreaCatania
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _3D_DISABLED
|
#ifndef _3D_DISABLED
|
||||||
NavigationMeshGenerator *_nav_mesh_generator = nullptr;
|
NavigationMeshGenerator *_nav_mesh_generator = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NavigationServer3D *new_server() {
|
NavigationServer3D *new_server() {
|
||||||
return memnew(GdNavigationServer);
|
return memnew(GodotNavigationServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void register_gdnavigation_types() {
|
void register_navigation_types() {
|
||||||
NavigationServer3DManager::set_default_server(new_server);
|
NavigationServer3DManager::set_default_server(new_server);
|
||||||
|
|
||||||
#ifndef _3D_DISABLED
|
#ifndef _3D_DISABLED
|
||||||
@@ -65,15 +62,10 @@ void register_gdnavigation_types() {
|
|||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
EditorPlugins::add_by_type<NavigationMeshEditorPlugin>();
|
EditorPlugins::add_by_type<NavigationMeshEditorPlugin>();
|
||||||
|
|
||||||
ClassDB::APIType prev_api = ClassDB::get_current_api();
|
|
||||||
ClassDB::set_current_api(ClassDB::API_EDITOR);
|
|
||||||
|
|
||||||
ClassDB::set_current_api(prev_api);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void unregister_gdnavigation_types() {
|
void unregister_navigation_types() {
|
||||||
#ifndef _3D_DISABLED
|
#ifndef _3D_DISABLED
|
||||||
if (_nav_mesh_generator) {
|
if (_nav_mesh_generator) {
|
||||||
memdelete(_nav_mesh_generator);
|
memdelete(_nav_mesh_generator);
|
||||||
@@ -28,14 +28,10 @@
|
|||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
/**
|
#ifndef NAVIGATION_REGISTER_TYPES_H
|
||||||
@author AndreaCatania
|
#define NAVIGATION_REGISTER_TYPES_H
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef GDNAVIGATION_REGISTER_TYPES_H
|
void register_navigation_types();
|
||||||
#define GDNAVIGATION_REGISTER_TYPES_H
|
void unregister_navigation_types();
|
||||||
|
|
||||||
void register_gdnavigation_types();
|
#endif // NAVIGATION_REGISTER_TYPES_H
|
||||||
void unregister_gdnavigation_types();
|
|
||||||
|
|
||||||
#endif // GDNAVIGATION_REGISTER_TYPES_H
|
|
||||||
Reference in New Issue
Block a user