| 1 | /**************************************************************************/ |
| 2 | /* navigation_server_3d.h */ |
| 3 | /**************************************************************************/ |
| 4 | /* This file is part of: */ |
| 5 | /* GODOT ENGINE */ |
| 6 | /* https://godotengine.org */ |
| 7 | /**************************************************************************/ |
| 8 | /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ |
| 9 | /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ |
| 10 | /* */ |
| 11 | /* Permission is hereby granted, free of charge, to any person obtaining */ |
| 12 | /* a copy of this software and associated documentation files (the */ |
| 13 | /* "Software"), to deal in the Software without restriction, including */ |
| 14 | /* without limitation the rights to use, copy, modify, merge, publish, */ |
| 15 | /* distribute, sublicense, and/or sell copies of the Software, and to */ |
| 16 | /* permit persons to whom the Software is furnished to do so, subject to */ |
| 17 | /* the following conditions: */ |
| 18 | /* */ |
| 19 | /* The above copyright notice and this permission notice shall be */ |
| 20 | /* included in all copies or substantial portions of the Software. */ |
| 21 | /* */ |
| 22 | /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ |
| 23 | /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ |
| 24 | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ |
| 25 | /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ |
| 26 | /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ |
| 27 | /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ |
| 28 | /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ |
| 29 | /**************************************************************************/ |
| 30 | |
| 31 | #ifndef NAVIGATION_SERVER_3D_H |
| 32 | #define NAVIGATION_SERVER_3D_H |
| 33 | |
| 34 | #include "core/object/class_db.h" |
| 35 | #include "core/templates/rid.h" |
| 36 | |
| 37 | #include "scene/resources/navigation_mesh.h" |
| 38 | #include "scene/resources/navigation_mesh_source_geometry_data_3d.h" |
| 39 | #include "servers/navigation/navigation_path_query_parameters_3d.h" |
| 40 | #include "servers/navigation/navigation_path_query_result_3d.h" |
| 41 | |
| 42 | /// This server uses the concept of internal mutability. |
| 43 | /// All the constant functions can be called in multithread because internally |
| 44 | /// the server takes care to schedule the functions access. |
| 45 | /// |
| 46 | /// Note: All the `set` functions are commands executed during the `sync` phase, |
| 47 | /// don't expect that a change is immediately propagated. |
| 48 | |
| 49 | class NavigationServer3D : public Object { |
| 50 | GDCLASS(NavigationServer3D, Object); |
| 51 | |
| 52 | static NavigationServer3D *singleton; |
| 53 | |
| 54 | protected: |
| 55 | static void _bind_methods(); |
| 56 | |
| 57 | public: |
| 58 | /// Thread safe, can be used across many threads. |
| 59 | static NavigationServer3D *get_singleton(); |
| 60 | |
| 61 | virtual TypedArray<RID> get_maps() const = 0; |
| 62 | |
| 63 | /// Create a new map. |
| 64 | virtual RID map_create() = 0; |
| 65 | |
| 66 | /// Set map active. |
| 67 | virtual void map_set_active(RID p_map, bool p_active) = 0; |
| 68 | |
| 69 | /// Returns true if the map is active. |
| 70 | virtual bool map_is_active(RID p_map) const = 0; |
| 71 | |
| 72 | /// Set the map UP direction. |
| 73 | virtual void map_set_up(RID p_map, Vector3 p_up) = 0; |
| 74 | |
| 75 | /// Returns the map UP direction. |
| 76 | virtual Vector3 map_get_up(RID p_map) const = 0; |
| 77 | |
| 78 | /// Set the map cell size used to weld the navigation mesh polygons. |
| 79 | virtual void map_set_cell_size(RID p_map, real_t p_cell_size) = 0; |
| 80 | |
| 81 | /// Returns the map cell size. |
| 82 | virtual real_t map_get_cell_size(RID p_map) const = 0; |
| 83 | |
| 84 | virtual void map_set_cell_height(RID p_map, real_t p_height) = 0; |
| 85 | virtual real_t map_get_cell_height(RID p_map) const = 0; |
| 86 | |
| 87 | virtual void map_set_use_edge_connections(RID p_map, bool p_enabled) = 0; |
| 88 | virtual bool map_get_use_edge_connections(RID p_map) const = 0; |
| 89 | |
| 90 | /// Set the map edge connection margin used to weld the compatible region edges. |
| 91 | virtual void map_set_edge_connection_margin(RID p_map, real_t p_connection_margin) = 0; |
| 92 | |
| 93 | /// Returns the edge connection margin of this map. |
| 94 | virtual real_t map_get_edge_connection_margin(RID p_map) const = 0; |
| 95 | |
| 96 | /// Set the map link connection radius used to attach links to the nav mesh. |
| 97 | virtual void map_set_link_connection_radius(RID p_map, real_t p_connection_radius) = 0; |
| 98 | |
| 99 | /// Returns the link connection radius of this map. |
| 100 | virtual real_t map_get_link_connection_radius(RID p_map) const = 0; |
| 101 | |
| 102 | /// Returns the navigation path to reach the destination from the origin. |
| 103 | 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; |
| 104 | |
| 105 | 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; |
| 106 | virtual Vector3 map_get_closest_point(RID p_map, const Vector3 &p_point) const = 0; |
| 107 | virtual Vector3 map_get_closest_point_normal(RID p_map, const Vector3 &p_point) const = 0; |
| 108 | virtual RID map_get_closest_point_owner(RID p_map, const Vector3 &p_point) const = 0; |
| 109 | |
| 110 | virtual TypedArray<RID> map_get_links(RID p_map) const = 0; |
| 111 | virtual TypedArray<RID> map_get_regions(RID p_map) const = 0; |
| 112 | virtual TypedArray<RID> map_get_agents(RID p_map) const = 0; |
| 113 | virtual TypedArray<RID> map_get_obstacles(RID p_map) const = 0; |
| 114 | |
| 115 | virtual void map_force_update(RID p_map) = 0; |
| 116 | |
| 117 | /// Creates a new region. |
| 118 | virtual RID region_create() = 0; |
| 119 | |
| 120 | virtual void region_set_enabled(RID p_region, bool p_enabled) = 0; |
| 121 | virtual bool region_get_enabled(RID p_region) const = 0; |
| 122 | |
| 123 | virtual void region_set_use_edge_connections(RID p_region, bool p_enabled) = 0; |
| 124 | virtual bool region_get_use_edge_connections(RID p_region) const = 0; |
| 125 | |
| 126 | /// Set the enter_cost of a region |
| 127 | virtual void region_set_enter_cost(RID p_region, real_t p_enter_cost) = 0; |
| 128 | virtual real_t region_get_enter_cost(RID p_region) const = 0; |
| 129 | |
| 130 | /// Set the travel_cost of a region |
| 131 | virtual void region_set_travel_cost(RID p_region, real_t p_travel_cost) = 0; |
| 132 | virtual real_t region_get_travel_cost(RID p_region) const = 0; |
| 133 | |
| 134 | /// Set the node which manages this region. |
| 135 | virtual void region_set_owner_id(RID p_region, ObjectID p_owner_id) = 0; |
| 136 | virtual ObjectID region_get_owner_id(RID p_region) const = 0; |
| 137 | |
| 138 | virtual bool region_owns_point(RID p_region, const Vector3 &p_point) const = 0; |
| 139 | |
| 140 | /// Set the map of this region. |
| 141 | virtual void region_set_map(RID p_region, RID p_map) = 0; |
| 142 | virtual RID region_get_map(RID p_region) const = 0; |
| 143 | |
| 144 | /// Set the region's layers |
| 145 | virtual void region_set_navigation_layers(RID p_region, uint32_t p_navigation_layers) = 0; |
| 146 | virtual uint32_t region_get_navigation_layers(RID p_region) const = 0; |
| 147 | |
| 148 | /// Set the global transformation of this region. |
| 149 | virtual void region_set_transform(RID p_region, Transform3D p_transform) = 0; |
| 150 | |
| 151 | /// Set the navigation mesh of this region. |
| 152 | virtual void region_set_navigation_mesh(RID p_region, Ref<NavigationMesh> p_navigation_mesh) = 0; |
| 153 | |
| 154 | #ifndef DISABLE_DEPRECATED |
| 155 | /// Bake the navigation mesh. |
| 156 | virtual void region_bake_navigation_mesh(Ref<NavigationMesh> p_navigation_mesh, Node *p_root_node) = 0; |
| 157 | #endif // DISABLE_DEPRECATED |
| 158 | |
| 159 | /// Get a list of a region's connection to other regions. |
| 160 | virtual int region_get_connections_count(RID p_region) const = 0; |
| 161 | virtual Vector3 region_get_connection_pathway_start(RID p_region, int p_connection_id) const = 0; |
| 162 | virtual Vector3 region_get_connection_pathway_end(RID p_region, int p_connection_id) const = 0; |
| 163 | |
| 164 | /// Creates a new link between positions in the nav map. |
| 165 | virtual RID link_create() = 0; |
| 166 | |
| 167 | /// Set the map of this link. |
| 168 | virtual void link_set_map(RID p_link, RID p_map) = 0; |
| 169 | virtual RID link_get_map(RID p_link) const = 0; |
| 170 | |
| 171 | virtual void link_set_enabled(RID p_link, bool p_enabled) = 0; |
| 172 | virtual bool link_get_enabled(RID p_link) const = 0; |
| 173 | |
| 174 | /// Set whether this link travels in both directions. |
| 175 | virtual void link_set_bidirectional(RID p_link, bool p_bidirectional) = 0; |
| 176 | virtual bool link_is_bidirectional(RID p_link) const = 0; |
| 177 | |
| 178 | /// Set the link's layers. |
| 179 | virtual void link_set_navigation_layers(RID p_link, uint32_t p_navigation_layers) = 0; |
| 180 | virtual uint32_t link_get_navigation_layers(RID p_link) const = 0; |
| 181 | |
| 182 | /// Set the start position of the link. |
| 183 | virtual void link_set_start_position(RID p_link, Vector3 p_position) = 0; |
| 184 | virtual Vector3 link_get_start_position(RID p_link) const = 0; |
| 185 | |
| 186 | /// Set the end position of the link. |
| 187 | virtual void link_set_end_position(RID p_link, Vector3 p_position) = 0; |
| 188 | virtual Vector3 link_get_end_position(RID p_link) const = 0; |
| 189 | |
| 190 | /// Set the enter cost of the link. |
| 191 | virtual void link_set_enter_cost(RID p_link, real_t p_enter_cost) = 0; |
| 192 | virtual real_t link_get_enter_cost(RID p_link) const = 0; |
| 193 | |
| 194 | /// Set the travel cost of the link. |
| 195 | virtual void link_set_travel_cost(RID p_link, real_t p_travel_cost) = 0; |
| 196 | virtual real_t link_get_travel_cost(RID p_link) const = 0; |
| 197 | |
| 198 | /// Set the node which manages this link. |
| 199 | virtual void link_set_owner_id(RID p_link, ObjectID p_owner_id) = 0; |
| 200 | virtual ObjectID link_get_owner_id(RID p_link) const = 0; |
| 201 | |
| 202 | /// Creates the agent. |
| 203 | virtual RID agent_create() = 0; |
| 204 | |
| 205 | /// Put the agent in the map. |
| 206 | virtual void agent_set_map(RID p_agent, RID p_map) = 0; |
| 207 | virtual RID agent_get_map(RID p_agent) const = 0; |
| 208 | |
| 209 | virtual void agent_set_paused(RID p_agent, bool p_paused) = 0; |
| 210 | virtual bool agent_get_paused(RID p_agent) const = 0; |
| 211 | |
| 212 | virtual void agent_set_avoidance_enabled(RID p_agent, bool p_enabled) = 0; |
| 213 | virtual bool agent_get_avoidance_enabled(RID p_agent) const = 0; |
| 214 | |
| 215 | virtual void agent_set_use_3d_avoidance(RID p_agent, bool p_enabled) = 0; |
| 216 | virtual bool agent_get_use_3d_avoidance(RID p_agent) const = 0; |
| 217 | |
| 218 | /// The maximum distance (center point to |
| 219 | /// center point) to other agents this agent |
| 220 | /// takes into account in the navigation. The |
| 221 | /// larger this number, the longer the running |
| 222 | /// time of the simulation. If the number is too |
| 223 | /// low, the simulation will not be safe. |
| 224 | /// Must be non-negative. |
| 225 | virtual void agent_set_neighbor_distance(RID p_agent, real_t p_distance) = 0; |
| 226 | |
| 227 | /// The maximum number of other agents this |
| 228 | /// agent takes into account in the navigation. |
| 229 | /// The larger this number, the longer the |
| 230 | /// running time of the simulation. If the |
| 231 | /// number is too low, the simulation will not |
| 232 | /// be safe. |
| 233 | virtual void agent_set_max_neighbors(RID p_agent, int p_count) = 0; |
| 234 | |
| 235 | // Sets the minimum amount of time in seconds that an agent's |
| 236 | // must be able to stay on the calculated velocity while still avoiding collisions with agent's |
| 237 | // if this value is set to high an agent will often fall back to using a very low velocity just to be safe |
| 238 | virtual void agent_set_time_horizon_agents(RID p_agent, real_t p_time_horizon) = 0; |
| 239 | |
| 240 | /// Sets the minimum amount of time in seconds that an agent's |
| 241 | // must be able to stay on the calculated velocity while still avoiding collisions with obstacle's |
| 242 | // if this value is set to high an agent will often fall back to using a very low velocity just to be safe |
| 243 | virtual void agent_set_time_horizon_obstacles(RID p_agent, real_t p_time_horizon) = 0; |
| 244 | |
| 245 | /// The radius of this agent. |
| 246 | /// Must be non-negative. |
| 247 | virtual void agent_set_radius(RID p_agent, real_t p_radius) = 0; |
| 248 | virtual void agent_set_height(RID p_agent, real_t p_height) = 0; |
| 249 | |
| 250 | /// The maximum speed of this agent. |
| 251 | /// Must be non-negative. |
| 252 | virtual void agent_set_max_speed(RID p_agent, real_t p_max_speed) = 0; |
| 253 | |
| 254 | /// forces and agent velocity change in the avoidance simulation, adds simulation instability if done recklessly |
| 255 | virtual void agent_set_velocity_forced(RID p_agent, Vector3 p_velocity) = 0; |
| 256 | |
| 257 | /// The wanted velocity for the agent as a "suggestion" to the avoidance simulation. |
| 258 | /// The simulation will try to fulfill this velocity wish if possible but may change the velocity depending on other agent's and obstacles'. |
| 259 | virtual void agent_set_velocity(RID p_agent, Vector3 p_velocity) = 0; |
| 260 | |
| 261 | /// Position of the agent in world space. |
| 262 | virtual void agent_set_position(RID p_agent, Vector3 p_position) = 0; |
| 263 | |
| 264 | /// Returns true if the map got changed the previous frame. |
| 265 | virtual bool agent_is_map_changed(RID p_agent) const = 0; |
| 266 | |
| 267 | /// Callback called at the end of the RVO process |
| 268 | virtual void agent_set_avoidance_callback(RID p_agent, Callable p_callback) = 0; |
| 269 | |
| 270 | virtual void agent_set_avoidance_layers(RID p_agent, uint32_t p_layers) = 0; |
| 271 | virtual void agent_set_avoidance_mask(RID p_agent, uint32_t p_mask) = 0; |
| 272 | virtual void agent_set_avoidance_priority(RID p_agent, real_t p_priority) = 0; |
| 273 | |
| 274 | /// Creates the obstacle. |
| 275 | virtual RID obstacle_create() = 0; |
| 276 | virtual void obstacle_set_map(RID p_obstacle, RID p_map) = 0; |
| 277 | virtual RID obstacle_get_map(RID p_obstacle) const = 0; |
| 278 | |
| 279 | virtual void obstacle_set_paused(RID p_obstacle, bool p_paused) = 0; |
| 280 | virtual bool obstacle_get_paused(RID p_obstacle) const = 0; |
| 281 | |
| 282 | virtual void obstacle_set_avoidance_enabled(RID p_obstacle, bool p_enabled) = 0; |
| 283 | virtual bool obstacle_get_avoidance_enabled(RID p_obstacle) const = 0; |
| 284 | virtual void obstacle_set_use_3d_avoidance(RID p_obstacle, bool p_enabled) = 0; |
| 285 | virtual bool obstacle_get_use_3d_avoidance(RID p_obstacle) const = 0; |
| 286 | virtual void obstacle_set_radius(RID p_obstacle, real_t p_radius) = 0; |
| 287 | virtual void obstacle_set_height(RID p_obstacle, real_t p_height) = 0; |
| 288 | virtual void obstacle_set_velocity(RID p_obstacle, Vector3 p_velocity) = 0; |
| 289 | virtual void obstacle_set_position(RID p_obstacle, Vector3 p_position) = 0; |
| 290 | virtual void obstacle_set_vertices(RID p_obstacle, const Vector<Vector3> &p_vertices) = 0; |
| 291 | virtual void obstacle_set_avoidance_layers(RID p_obstacle, uint32_t p_layers) = 0; |
| 292 | |
| 293 | /// Destroy the `RID` |
| 294 | virtual void free(RID p_object) = 0; |
| 295 | |
| 296 | /// Control activation of this server. |
| 297 | virtual void set_active(bool p_active) = 0; |
| 298 | |
| 299 | /// Process the collision avoidance agents. |
| 300 | /// The result of this process is needed by the physics server, |
| 301 | /// so this must be called in the main thread. |
| 302 | /// Note: This function is not thread safe. |
| 303 | virtual void process(real_t delta_time) = 0; |
| 304 | virtual void init() = 0; |
| 305 | virtual void finish() = 0; |
| 306 | |
| 307 | /// Returns a customized navigation path using a query parameters object |
| 308 | virtual void query_path(const Ref<NavigationPathQueryParameters3D> &p_query_parameters, Ref<NavigationPathQueryResult3D> p_query_result) const; |
| 309 | |
| 310 | virtual NavigationUtilities::PathQueryResult _query_path(const NavigationUtilities::PathQueryParameters &p_parameters) const = 0; |
| 311 | |
| 312 | virtual void parse_source_geometry_data(const Ref<NavigationMesh> &p_navigation_mesh, const Ref<NavigationMeshSourceGeometryData3D> &p_source_geometry_data, Node *p_root_node, const Callable &p_callback = Callable()) = 0; |
| 313 | virtual void bake_from_source_geometry_data(const Ref<NavigationMesh> &p_navigation_mesh, const Ref<NavigationMeshSourceGeometryData3D> &p_source_geometry_data, const Callable &p_callback = Callable()) = 0; |
| 314 | virtual void bake_from_source_geometry_data_async(const Ref<NavigationMesh> &p_navigation_mesh, const Ref<NavigationMeshSourceGeometryData3D> &p_source_geometry_data, const Callable &p_callback = Callable()) = 0; |
| 315 | |
| 316 | NavigationServer3D(); |
| 317 | ~NavigationServer3D() override; |
| 318 | |
| 319 | enum ProcessInfo { |
| 320 | INFO_ACTIVE_MAPS, |
| 321 | INFO_REGION_COUNT, |
| 322 | INFO_AGENT_COUNT, |
| 323 | INFO_LINK_COUNT, |
| 324 | INFO_POLYGON_COUNT, |
| 325 | INFO_EDGE_COUNT, |
| 326 | INFO_EDGE_MERGE_COUNT, |
| 327 | INFO_EDGE_CONNECTION_COUNT, |
| 328 | INFO_EDGE_FREE_COUNT, |
| 329 | }; |
| 330 | |
| 331 | virtual int get_process_info(ProcessInfo p_info) const = 0; |
| 332 | |
| 333 | void set_debug_enabled(bool p_enabled); |
| 334 | bool get_debug_enabled() const; |
| 335 | |
| 336 | private: |
| 337 | bool debug_enabled = false; |
| 338 | |
| 339 | #ifdef DEBUG_ENABLED |
| 340 | bool debug_dirty = true; |
| 341 | |
| 342 | bool debug_navigation_enabled = false; |
| 343 | bool navigation_debug_dirty = true; |
| 344 | void _emit_navigation_debug_changed_signal(); |
| 345 | |
| 346 | bool debug_avoidance_enabled = false; |
| 347 | bool avoidance_debug_dirty = true; |
| 348 | void _emit_avoidance_debug_changed_signal(); |
| 349 | |
| 350 | Color debug_navigation_edge_connection_color = Color(1.0, 0.0, 1.0, 1.0); |
| 351 | Color debug_navigation_geometry_edge_color = Color(0.5, 1.0, 1.0, 1.0); |
| 352 | Color debug_navigation_geometry_face_color = Color(0.5, 1.0, 1.0, 0.4); |
| 353 | Color debug_navigation_geometry_edge_disabled_color = Color(0.5, 0.5, 0.5, 1.0); |
| 354 | Color debug_navigation_geometry_face_disabled_color = Color(0.5, 0.5, 0.5, 0.4); |
| 355 | Color debug_navigation_link_connection_color = Color(1.0, 0.5, 1.0, 1.0); |
| 356 | Color debug_navigation_link_connection_disabled_color = Color(0.5, 0.5, 0.5, 1.0); |
| 357 | Color debug_navigation_agent_path_color = Color(1.0, 0.0, 0.0, 1.0); |
| 358 | |
| 359 | real_t debug_navigation_agent_path_point_size = 4.0; |
| 360 | |
| 361 | Color debug_navigation_avoidance_agents_radius_color = Color(1.0, 1.0, 0.0, 0.25); |
| 362 | Color debug_navigation_avoidance_obstacles_radius_color = Color(1.0, 0.5, 0.0, 0.25); |
| 363 | |
| 364 | Color debug_navigation_avoidance_static_obstacle_pushin_face_color = Color(1.0, 0.0, 0.0, 0.0); |
| 365 | Color debug_navigation_avoidance_static_obstacle_pushout_face_color = Color(1.0, 1.0, 0.0, 0.5); |
| 366 | Color debug_navigation_avoidance_static_obstacle_pushin_edge_color = Color(1.0, 0.0, 0.0, 1.0); |
| 367 | Color debug_navigation_avoidance_static_obstacle_pushout_edge_color = Color(1.0, 1.0, 0.0, 1.0); |
| 368 | |
| 369 | bool debug_navigation_enable_edge_connections = true; |
| 370 | bool debug_navigation_enable_edge_connections_xray = true; |
| 371 | bool debug_navigation_enable_edge_lines = true; |
| 372 | bool debug_navigation_enable_edge_lines_xray = true; |
| 373 | bool debug_navigation_enable_geometry_face_random_color = true; |
| 374 | bool debug_navigation_enable_link_connections = true; |
| 375 | bool debug_navigation_enable_link_connections_xray = true; |
| 376 | bool debug_navigation_enable_agent_paths = true; |
| 377 | bool debug_navigation_enable_agent_paths_xray = true; |
| 378 | |
| 379 | bool debug_navigation_avoidance_enable_agents_radius = true; |
| 380 | bool debug_navigation_avoidance_enable_obstacles_radius = true; |
| 381 | bool debug_navigation_avoidance_enable_obstacles_static = true; |
| 382 | |
| 383 | Ref<StandardMaterial3D> debug_navigation_geometry_edge_material; |
| 384 | Ref<StandardMaterial3D> debug_navigation_geometry_face_material; |
| 385 | Ref<StandardMaterial3D> debug_navigation_geometry_edge_disabled_material; |
| 386 | Ref<StandardMaterial3D> debug_navigation_geometry_face_disabled_material; |
| 387 | Ref<StandardMaterial3D> debug_navigation_edge_connections_material; |
| 388 | Ref<StandardMaterial3D> debug_navigation_link_connections_material; |
| 389 | Ref<StandardMaterial3D> debug_navigation_link_connections_disabled_material; |
| 390 | Ref<StandardMaterial3D> debug_navigation_avoidance_agents_radius_material; |
| 391 | Ref<StandardMaterial3D> debug_navigation_avoidance_obstacles_radius_material; |
| 392 | |
| 393 | Ref<StandardMaterial3D> debug_navigation_avoidance_static_obstacle_pushin_face_material; |
| 394 | Ref<StandardMaterial3D> debug_navigation_avoidance_static_obstacle_pushout_face_material; |
| 395 | Ref<StandardMaterial3D> debug_navigation_avoidance_static_obstacle_pushin_edge_material; |
| 396 | Ref<StandardMaterial3D> debug_navigation_avoidance_static_obstacle_pushout_edge_material; |
| 397 | |
| 398 | Ref<StandardMaterial3D> debug_navigation_agent_path_line_material; |
| 399 | Ref<StandardMaterial3D> debug_navigation_agent_path_point_material; |
| 400 | |
| 401 | public: |
| 402 | void set_debug_navigation_enabled(bool p_enabled); |
| 403 | bool get_debug_navigation_enabled() const; |
| 404 | |
| 405 | void set_debug_avoidance_enabled(bool p_enabled); |
| 406 | bool get_debug_avoidance_enabled() const; |
| 407 | |
| 408 | void set_debug_navigation_edge_connection_color(const Color &p_color); |
| 409 | Color get_debug_navigation_edge_connection_color() const; |
| 410 | |
| 411 | void set_debug_navigation_geometry_edge_color(const Color &p_color); |
| 412 | Color get_debug_navigation_geometry_edge_color() const; |
| 413 | |
| 414 | void set_debug_navigation_geometry_face_color(const Color &p_color); |
| 415 | Color get_debug_navigation_geometry_face_color() const; |
| 416 | |
| 417 | void set_debug_navigation_geometry_edge_disabled_color(const Color &p_color); |
| 418 | Color get_debug_navigation_geometry_edge_disabled_color() const; |
| 419 | |
| 420 | void set_debug_navigation_geometry_face_disabled_color(const Color &p_color); |
| 421 | Color get_debug_navigation_geometry_face_disabled_color() const; |
| 422 | |
| 423 | void set_debug_navigation_link_connection_color(const Color &p_color); |
| 424 | Color get_debug_navigation_link_connection_color() const; |
| 425 | |
| 426 | void set_debug_navigation_link_connection_disabled_color(const Color &p_color); |
| 427 | Color get_debug_navigation_link_connection_disabled_color() const; |
| 428 | |
| 429 | void set_debug_navigation_agent_path_color(const Color &p_color); |
| 430 | Color get_debug_navigation_agent_path_color() const; |
| 431 | |
| 432 | void set_debug_navigation_avoidance_agents_radius_color(const Color &p_color); |
| 433 | Color get_debug_navigation_avoidance_agents_radius_color() const; |
| 434 | |
| 435 | void set_debug_navigation_avoidance_obstacles_radius_color(const Color &p_color); |
| 436 | Color get_debug_navigation_avoidance_obstacles_radius_color() const; |
| 437 | |
| 438 | void set_debug_navigation_avoidance_static_obstacle_pushin_face_color(const Color &p_color); |
| 439 | Color get_debug_navigation_avoidance_static_obstacle_pushin_face_color() const; |
| 440 | |
| 441 | void set_debug_navigation_avoidance_static_obstacle_pushout_face_color(const Color &p_color); |
| 442 | Color get_debug_navigation_avoidance_static_obstacle_pushout_face_color() const; |
| 443 | |
| 444 | void set_debug_navigation_avoidance_static_obstacle_pushin_edge_color(const Color &p_color); |
| 445 | Color get_debug_navigation_avoidance_static_obstacle_pushin_edge_color() const; |
| 446 | |
| 447 | void set_debug_navigation_avoidance_static_obstacle_pushout_edge_color(const Color &p_color); |
| 448 | Color get_debug_navigation_avoidance_static_obstacle_pushout_edge_color() const; |
| 449 | |
| 450 | void set_debug_navigation_enable_edge_connections(const bool p_value); |
| 451 | bool get_debug_navigation_enable_edge_connections() const; |
| 452 | |
| 453 | void set_debug_navigation_enable_edge_connections_xray(const bool p_value); |
| 454 | bool get_debug_navigation_enable_edge_connections_xray() const; |
| 455 | |
| 456 | void set_debug_navigation_enable_edge_lines(const bool p_value); |
| 457 | bool get_debug_navigation_enable_edge_lines() const; |
| 458 | |
| 459 | void set_debug_navigation_enable_edge_lines_xray(const bool p_value); |
| 460 | bool get_debug_navigation_enable_edge_lines_xray() const; |
| 461 | |
| 462 | void set_debug_navigation_enable_geometry_face_random_color(const bool p_value); |
| 463 | bool get_debug_navigation_enable_geometry_face_random_color() const; |
| 464 | |
| 465 | void set_debug_navigation_enable_link_connections(const bool p_value); |
| 466 | bool get_debug_navigation_enable_link_connections() const; |
| 467 | |
| 468 | void set_debug_navigation_enable_link_connections_xray(const bool p_value); |
| 469 | bool get_debug_navigation_enable_link_connections_xray() const; |
| 470 | |
| 471 | void set_debug_navigation_enable_agent_paths(const bool p_value); |
| 472 | bool get_debug_navigation_enable_agent_paths() const; |
| 473 | |
| 474 | void set_debug_navigation_enable_agent_paths_xray(const bool p_value); |
| 475 | bool get_debug_navigation_enable_agent_paths_xray() const; |
| 476 | |
| 477 | void set_debug_navigation_agent_path_point_size(real_t p_point_size); |
| 478 | real_t get_debug_navigation_agent_path_point_size() const; |
| 479 | |
| 480 | void set_debug_navigation_avoidance_enable_agents_radius(const bool p_value); |
| 481 | bool get_debug_navigation_avoidance_enable_agents_radius() const; |
| 482 | |
| 483 | void set_debug_navigation_avoidance_enable_obstacles_radius(const bool p_value); |
| 484 | bool get_debug_navigation_avoidance_enable_obstacles_radius() const; |
| 485 | |
| 486 | void set_debug_navigation_avoidance_enable_obstacles_static(const bool p_value); |
| 487 | bool get_debug_navigation_avoidance_enable_obstacles_static() const; |
| 488 | |
| 489 | Ref<StandardMaterial3D> get_debug_navigation_geometry_face_material(); |
| 490 | Ref<StandardMaterial3D> get_debug_navigation_geometry_edge_material(); |
| 491 | Ref<StandardMaterial3D> get_debug_navigation_geometry_face_disabled_material(); |
| 492 | Ref<StandardMaterial3D> get_debug_navigation_geometry_edge_disabled_material(); |
| 493 | Ref<StandardMaterial3D> get_debug_navigation_edge_connections_material(); |
| 494 | Ref<StandardMaterial3D> get_debug_navigation_link_connections_material(); |
| 495 | Ref<StandardMaterial3D> get_debug_navigation_link_connections_disabled_material(); |
| 496 | |
| 497 | Ref<StandardMaterial3D> get_debug_navigation_agent_path_line_material(); |
| 498 | Ref<StandardMaterial3D> get_debug_navigation_agent_path_point_material(); |
| 499 | |
| 500 | Ref<StandardMaterial3D> get_debug_navigation_avoidance_agents_radius_material(); |
| 501 | Ref<StandardMaterial3D> get_debug_navigation_avoidance_obstacles_radius_material(); |
| 502 | |
| 503 | Ref<StandardMaterial3D> get_debug_navigation_avoidance_static_obstacle_pushin_face_material(); |
| 504 | Ref<StandardMaterial3D> get_debug_navigation_avoidance_static_obstacle_pushout_face_material(); |
| 505 | Ref<StandardMaterial3D> get_debug_navigation_avoidance_static_obstacle_pushin_edge_material(); |
| 506 | Ref<StandardMaterial3D> get_debug_navigation_avoidance_static_obstacle_pushout_edge_material(); |
| 507 | #endif // DEBUG_ENABLED |
| 508 | }; |
| 509 | |
| 510 | typedef NavigationServer3D *(*NavigationServer3DCallback)(); |
| 511 | |
| 512 | /// Manager used for the server singleton registration |
| 513 | class NavigationServer3DManager { |
| 514 | static NavigationServer3DCallback create_callback; |
| 515 | |
| 516 | public: |
| 517 | static void set_default_server(NavigationServer3DCallback p_callback); |
| 518 | static NavigationServer3D *new_default_server(); |
| 519 | }; |
| 520 | |
| 521 | VARIANT_ENUM_CAST(NavigationServer3D::ProcessInfo); |
| 522 | |
| 523 | #endif // NAVIGATION_SERVER_3D_H |
| 524 | |