summaryrefslogtreecommitdiff
path: root/servers/navigation_server_3d.h
diff options
context:
space:
mode:
Diffstat (limited to 'servers/navigation_server_3d.h')
-rw-r--r--servers/navigation_server_3d.h103
1 files changed, 90 insertions, 13 deletions
diff --git a/servers/navigation_server_3d.h b/servers/navigation_server_3d.h
index 3aef693ac8..f24c0117d1 100644
--- a/servers/navigation_server_3d.h
+++ b/servers/navigation_server_3d.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -28,12 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-/**
- @author AndreaCatania
-*/
-
-#ifndef NAVIGATION_SERVER_H
-#define NAVIGATION_SERVER_H
+#ifndef NAVIGATION_SERVER_3D_H
+#define NAVIGATION_SERVER_3D_H
#include "core/object/class_db.h"
#include "core/templates/rid.h"
@@ -55,11 +51,13 @@ protected:
public:
/// Thread safe, can be used across many threads.
- static NavigationServer3D *get_singleton();
+ static const NavigationServer3D *get_singleton();
/// MUST be used in single thread!
static NavigationServer3D *get_singleton_mut();
+ virtual Array get_maps() const = 0;
+
/// Create a new map.
virtual RID map_create() const = 0;
@@ -88,22 +86,38 @@ public:
virtual real_t map_get_edge_connection_margin(RID p_map) const = 0;
/// Returns the navigation path to reach the destination from the origin.
- virtual Vector<Vector3> map_get_path(RID p_map, Vector3 p_origin, Vector3 p_destination, bool p_optimize, uint32_t p_navigable_layers = 1) const = 0;
+ virtual Vector<Vector3> map_get_path(RID p_map, Vector3 p_origin, Vector3 p_destination, bool p_optimize, uint32_t p_navigation_layers = 1) const = 0;
virtual Vector3 map_get_closest_point_to_segment(RID p_map, const Vector3 &p_from, const Vector3 &p_to, const bool p_use_collision = false) const = 0;
virtual Vector3 map_get_closest_point(RID p_map, const Vector3 &p_point) const = 0;
virtual Vector3 map_get_closest_point_normal(RID p_map, const Vector3 &p_point) const = 0;
virtual RID map_get_closest_point_owner(RID p_map, const Vector3 &p_point) const = 0;
+ virtual Array map_get_regions(RID p_map) const = 0;
+ virtual Array map_get_agents(RID p_map) const = 0;
+
+ virtual void map_force_update(RID p_map) = 0;
+
/// Creates a new region.
virtual RID region_create() const = 0;
+ /// Set the enter_cost of a region
+ virtual void region_set_enter_cost(RID p_region, real_t p_enter_cost) const = 0;
+ virtual real_t region_get_enter_cost(RID p_region) const = 0;
+
+ /// Set the travel_cost of a region
+ virtual void region_set_travel_cost(RID p_region, real_t p_travel_cost) const = 0;
+ virtual real_t region_get_travel_cost(RID p_region) const = 0;
+
+ virtual bool region_owns_point(RID p_region, const Vector3 &p_point) const = 0;
+
/// Set the map of this region.
virtual void region_set_map(RID p_region, RID p_map) const = 0;
+ virtual RID region_get_map(RID p_region) const = 0;
/// Set the region's layers
- virtual void region_set_layers(RID p_region, uint32_t p_layers) const = 0;
- virtual uint32_t region_get_layers(RID p_region) const = 0;
+ virtual void region_set_navigation_layers(RID p_region, uint32_t p_navigation_layers) const = 0;
+ virtual uint32_t region_get_navigation_layers(RID p_region) const = 0;
/// Set the global transformation of this region.
virtual void region_set_transform(RID p_region, Transform3D p_transform) const = 0;
@@ -124,6 +138,7 @@ public:
/// Put the agent in the map.
virtual void agent_set_map(RID p_agent, RID p_map) const = 0;
+ virtual RID agent_get_map(RID p_agent) const = 0;
/// The maximum distance (center point to
/// center point) to other agents this agent
@@ -192,6 +207,68 @@ public:
NavigationServer3D();
virtual ~NavigationServer3D();
+
+#ifdef DEBUG_ENABLED
+ bool debug_enabled = false;
+ bool debug_dirty = true;
+ void _emit_navigation_debug_changed_signal();
+
+ void set_debug_enabled(bool p_enabled);
+ bool get_debug_enabled() const;
+
+ Color debug_navigation_edge_connection_color = Color(1.0, 0.0, 1.0, 1.0);
+ Color debug_navigation_geometry_edge_color = Color(0.5, 1.0, 1.0, 1.0);
+ Color debug_navigation_geometry_face_color = Color(0.5, 1.0, 1.0, 0.4);
+ Color debug_navigation_geometry_edge_disabled_color = Color(0.5, 0.5, 0.5, 1.0);
+ Color debug_navigation_geometry_face_disabled_color = Color(0.5, 0.5, 0.5, 0.4);
+ bool debug_navigation_enable_edge_connections = true;
+ bool debug_navigation_enable_edge_connections_xray = true;
+ bool debug_navigation_enable_edge_lines = true;
+ bool debug_navigation_enable_edge_lines_xray = true;
+ bool debug_navigation_enable_geometry_face_random_color = true;
+
+ Ref<StandardMaterial3D> debug_navigation_geometry_edge_material;
+ Ref<StandardMaterial3D> debug_navigation_geometry_face_material;
+ Ref<StandardMaterial3D> debug_navigation_geometry_edge_disabled_material;
+ Ref<StandardMaterial3D> debug_navigation_geometry_face_disabled_material;
+ Ref<StandardMaterial3D> debug_navigation_edge_connections_material;
+
+ void set_debug_navigation_edge_connection_color(const Color &p_color);
+ Color get_debug_navigation_edge_connection_color() const;
+
+ void set_debug_navigation_geometry_edge_color(const Color &p_color);
+ Color get_debug_navigation_geometry_edge_color() const;
+
+ void set_debug_navigation_geometry_face_color(const Color &p_color);
+ Color get_debug_navigation_geometry_face_color() const;
+
+ void set_debug_navigation_geometry_edge_disabled_color(const Color &p_color);
+ Color get_debug_navigation_geometry_edge_disabled_color() const;
+
+ void set_debug_navigation_geometry_face_disabled_color(const Color &p_color);
+ Color get_debug_navigation_geometry_face_disabled_color() const;
+
+ void set_debug_navigation_enable_edge_connections(const bool p_value);
+ bool get_debug_navigation_enable_edge_connections() const;
+
+ void set_debug_navigation_enable_edge_connections_xray(const bool p_value);
+ bool get_debug_navigation_enable_edge_connections_xray() const;
+
+ void set_debug_navigation_enable_edge_lines(const bool p_value);
+ bool get_debug_navigation_enable_edge_lines() const;
+
+ void set_debug_navigation_enable_edge_lines_xray(const bool p_value);
+ bool get_debug_navigation_enable_edge_lines_xray() const;
+
+ void set_debug_navigation_enable_geometry_face_random_color(const bool p_value);
+ bool get_debug_navigation_enable_geometry_face_random_color() const;
+
+ Ref<StandardMaterial3D> get_debug_navigation_geometry_face_material();
+ Ref<StandardMaterial3D> get_debug_navigation_geometry_edge_material();
+ Ref<StandardMaterial3D> get_debug_navigation_geometry_face_disabled_material();
+ Ref<StandardMaterial3D> get_debug_navigation_geometry_edge_disabled_material();
+ Ref<StandardMaterial3D> get_debug_navigation_edge_connections_material();
+#endif // DEBUG_ENABLED
};
typedef NavigationServer3D *(*NavigationServer3DCallback)();
@@ -205,4 +282,4 @@ public:
static NavigationServer3D *new_default_server();
};
-#endif
+#endif // NAVIGATION_SERVER_3D_H