[Navigation] Create a dedicated 2D navigation server
* Add a dedicated 2D server * Create dedicated tests * Split performance metrics between 2D and 3D * Rename the 3D only server module
This commit is contained in:
@@ -163,17 +163,20 @@
|
||||
#include "tests/scene/test_tree.h"
|
||||
#endif // ADVANCED_GUI_DISABLED
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
#ifdef MODULE_NAVIGATION_ENABLED
|
||||
#ifdef MODULE_NAVIGATION_2D_ENABLED
|
||||
#include "tests/scene/test_navigation_agent_2d.h"
|
||||
#include "tests/scene/test_navigation_agent_3d.h"
|
||||
#include "tests/scene/test_navigation_obstacle_2d.h"
|
||||
#include "tests/scene/test_navigation_obstacle_3d.h"
|
||||
#include "tests/scene/test_navigation_region_2d.h"
|
||||
#include "tests/scene/test_navigation_region_3d.h"
|
||||
#include "tests/servers/test_navigation_server_2d.h"
|
||||
#endif // MODULE_NAVIGATION_2D_ENABLED
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
#ifdef MODULE_NAVIGATION_3D_ENABLED
|
||||
#include "tests/scene/test_navigation_agent_3d.h"
|
||||
#include "tests/scene/test_navigation_obstacle_3d.h"
|
||||
#include "tests/scene/test_navigation_region_3d.h"
|
||||
#include "tests/servers/test_navigation_server_3d.h"
|
||||
#endif // MODULE_NAVIGATION_ENABLED
|
||||
#endif // MODULE_NAVIGATION_3D_ENABLED
|
||||
|
||||
#include "tests/scene/test_arraymesh.h"
|
||||
#include "tests/scene/test_camera_3d.h"
|
||||
@@ -194,8 +197,8 @@
|
||||
#include "tests/test_macros.h"
|
||||
|
||||
#include "scene/theme/theme_db.h"
|
||||
#ifndef _3D_DISABLED
|
||||
#include "servers/navigation_server_2d.h"
|
||||
#ifndef _3D_DISABLED
|
||||
#include "servers/navigation_server_3d.h"
|
||||
#endif // _3D_DISABLED
|
||||
#ifndef PHYSICS_2D_DISABLED
|
||||
@@ -288,8 +291,8 @@ struct GodotTestCaseListener : public doctest::IReporter {
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
#ifndef _3D_DISABLED
|
||||
NavigationServer3D *navigation_server_3d = nullptr;
|
||||
NavigationServer2D *navigation_server_2d = nullptr;
|
||||
#endif // _3D_DISABLED
|
||||
NavigationServer2D *navigation_server_2d = nullptr;
|
||||
|
||||
void test_case_start(const doctest::TestCaseData &p_in) override {
|
||||
reinitialize();
|
||||
@@ -337,12 +340,12 @@ struct GodotTestCaseListener : public doctest::IReporter {
|
||||
physics_server_2d->init();
|
||||
#endif // PHYSICS_2D_DISABLED
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
ERR_PRINT_OFF;
|
||||
#ifndef _3D_DISABLED
|
||||
navigation_server_3d = NavigationServer3DManager::new_default_server();
|
||||
#endif // _3D_DISABLED
|
||||
navigation_server_2d = NavigationServer2DManager::new_default_server();
|
||||
ERR_PRINT_ON;
|
||||
#endif // _3D_DISABLED
|
||||
|
||||
memnew(InputMap);
|
||||
InputMap::get_singleton()->load_default();
|
||||
@@ -374,14 +377,20 @@ struct GodotTestCaseListener : public doctest::IReporter {
|
||||
}
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
if (suite_name.contains("[Navigation]") && navigation_server_2d == nullptr && navigation_server_3d == nullptr) {
|
||||
if (suite_name.contains("[Navigation3D]") && navigation_server_3d == nullptr) {
|
||||
ERR_PRINT_OFF;
|
||||
navigation_server_3d = NavigationServer3DManager::new_default_server();
|
||||
navigation_server_2d = NavigationServer2DManager::new_default_server();
|
||||
ERR_PRINT_ON;
|
||||
return;
|
||||
}
|
||||
#endif // _3D_DISABLED
|
||||
|
||||
if (suite_name.contains("[Navigation2D]") && navigation_server_2d == nullptr) {
|
||||
ERR_PRINT_OFF;
|
||||
navigation_server_2d = NavigationServer2DManager::new_default_server();
|
||||
ERR_PRINT_ON;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void test_case_end(const doctest::CurrentTestCaseStats &) override {
|
||||
@@ -416,12 +425,12 @@ struct GodotTestCaseListener : public doctest::IReporter {
|
||||
memdelete(navigation_server_3d);
|
||||
navigation_server_3d = nullptr;
|
||||
}
|
||||
#endif // _3D_DISABLED
|
||||
|
||||
if (navigation_server_2d) {
|
||||
memdelete(navigation_server_2d);
|
||||
navigation_server_2d = nullptr;
|
||||
}
|
||||
#endif // _3D_DISABLED
|
||||
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
if (physics_server_3d) {
|
||||
|
||||
Reference in New Issue
Block a user