diff options
author | Andrea Catania <info@andreacatania.com> | 2020-01-10 12:22:34 +0100 |
---|---|---|
committer | Andrea Catania <info@andreacatania.com> | 2020-02-10 14:38:52 +0100 |
commit | e6be3f68da4b88cb0c7d8c7464916235c73e1f92 (patch) | |
tree | 2e65162fd1937df8b4dcd80900dd5b9b4aac58d1 /main/main.cpp | |
parent | 8cd5102c65269f1ec4968627ca71df550954d914 (diff) |
- Integrated NavigationServer and Navigation2DServer.
- Added Navigation Agents and Obstacles.
- Integrated Collision Avoidance.
This work has been kindly sponsored by IMVU.
Diffstat (limited to 'main/main.cpp')
-rw-r--r-- | main/main.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/main/main.cpp b/main/main.cpp index 650a680d87..162d5568d4 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -66,6 +66,8 @@ #include "servers/arvr_server.h" #include "servers/audio_server.h" #include "servers/camera_server.h" +#include "servers/navigation_2d_server.h" +#include "servers/navigation_server.h" #include "servers/physics_2d_server.h" #include "servers/physics_server.h" #include "servers/register_server_types.h" @@ -103,6 +105,8 @@ static CameraServer *camera_server = NULL; static ARVRServer *arvr_server = NULL; static PhysicsServer *physics_server = NULL; static Physics2DServer *physics_2d_server = NULL; +static NavigationServer *navigation_server = NULL; +static Navigation2DServer *navigation_2d_server = NULL; // We error out if setup2() doesn't turn this true static bool _start_success = false; @@ -197,6 +201,19 @@ void finalize_physics() { memdelete(physics_2d_server); } +void initialize_navigation_server() { + ERR_FAIL_COND(navigation_server != NULL); + navigation_server = NavigationServerManager::new_default_server(); + navigation_2d_server = memnew(Navigation2DServer); +} + +void finalize_navigation_server() { + memdelete(navigation_server); + navigation_server = NULL; + memdelete(navigation_2d_server); + navigation_2d_server = NULL; +} + //#define DEBUG_INIT #ifdef DEBUG_INIT #define MAIN_PRINT(m_txt) print_line(m_txt) @@ -1356,6 +1373,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) { camera_server = CameraServer::create(); initialize_physics(); + initialize_navigation_server(); register_server_singletons(); register_driver_types(); @@ -2011,6 +2029,8 @@ bool Main::iteration() { message_queue->flush(); + NavigationServer::get_singleton_mut()->step(frame_slice * time_scale); + PhysicsServer::get_singleton()->step(frame_slice * time_scale); Physics2DServer::get_singleton()->end_sync(); @@ -2202,6 +2222,7 @@ void Main::cleanup() { OS::get_singleton()->finalize(); finalize_physics(); + finalize_navigation_server(); if (packed_data) memdelete(packed_data); |