Allow to compile templates without navigation features
This commit is contained in:
+110
-29
@@ -35,8 +35,12 @@
|
||||
#include "scene/main/node.h"
|
||||
#include "scene/main/scene_tree.h"
|
||||
#include "servers/audio_server.h"
|
||||
#ifndef NAVIGATION_2D_DISABLED
|
||||
#include "servers/navigation_server_2d.h"
|
||||
#endif // NAVIGATION_2D_DISABLED
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
#include "servers/navigation_server_3d.h"
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
#ifndef PHYSICS_2D_DISABLED
|
||||
@@ -84,6 +88,7 @@ void Performance::_bind_methods() {
|
||||
BIND_ENUM_CONSTANT(PHYSICS_3D_ISLAND_COUNT);
|
||||
#endif // _3D_DISABLED
|
||||
BIND_ENUM_CONSTANT(AUDIO_OUTPUT_LATENCY);
|
||||
#if !defined(NAVIGATION_2D_DISABLED) || !defined(NAVIGATION_3D_DISABLED)
|
||||
BIND_ENUM_CONSTANT(NAVIGATION_ACTIVE_MAPS);
|
||||
BIND_ENUM_CONSTANT(NAVIGATION_REGION_COUNT);
|
||||
BIND_ENUM_CONSTANT(NAVIGATION_AGENT_COUNT);
|
||||
@@ -94,11 +99,13 @@ void Performance::_bind_methods() {
|
||||
BIND_ENUM_CONSTANT(NAVIGATION_EDGE_CONNECTION_COUNT);
|
||||
BIND_ENUM_CONSTANT(NAVIGATION_EDGE_FREE_COUNT);
|
||||
BIND_ENUM_CONSTANT(NAVIGATION_OBSTACLE_COUNT);
|
||||
#endif // !defined(NAVIGATION_2D_DISABLED) || !defined(NAVIGATION_3D_DISABLED)
|
||||
BIND_ENUM_CONSTANT(PIPELINE_COMPILATIONS_CANVAS);
|
||||
BIND_ENUM_CONSTANT(PIPELINE_COMPILATIONS_MESH);
|
||||
BIND_ENUM_CONSTANT(PIPELINE_COMPILATIONS_SURFACE);
|
||||
BIND_ENUM_CONSTANT(PIPELINE_COMPILATIONS_DRAW);
|
||||
BIND_ENUM_CONSTANT(PIPELINE_COMPILATIONS_SPECIALIZATION);
|
||||
#ifndef NAVIGATION_2D_DISABLED
|
||||
BIND_ENUM_CONSTANT(NAVIGATION_2D_ACTIVE_MAPS);
|
||||
BIND_ENUM_CONSTANT(NAVIGATION_2D_REGION_COUNT);
|
||||
BIND_ENUM_CONSTANT(NAVIGATION_2D_AGENT_COUNT);
|
||||
@@ -109,6 +116,8 @@ void Performance::_bind_methods() {
|
||||
BIND_ENUM_CONSTANT(NAVIGATION_2D_EDGE_CONNECTION_COUNT);
|
||||
BIND_ENUM_CONSTANT(NAVIGATION_2D_EDGE_FREE_COUNT);
|
||||
BIND_ENUM_CONSTANT(NAVIGATION_2D_OBSTACLE_COUNT);
|
||||
#endif // NAVIGATION_2D_DISABLED
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
BIND_ENUM_CONSTANT(NAVIGATION_3D_ACTIVE_MAPS);
|
||||
BIND_ENUM_CONSTANT(NAVIGATION_3D_REGION_COUNT);
|
||||
BIND_ENUM_CONSTANT(NAVIGATION_3D_AGENT_COUNT);
|
||||
@@ -119,6 +128,7 @@ void Performance::_bind_methods() {
|
||||
BIND_ENUM_CONSTANT(NAVIGATION_3D_EDGE_CONNECTION_COUNT);
|
||||
BIND_ENUM_CONSTANT(NAVIGATION_3D_EDGE_FREE_COUNT);
|
||||
BIND_ENUM_CONSTANT(NAVIGATION_3D_OBSTACLE_COUNT);
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
BIND_ENUM_CONSTANT(MONITOR_MAX);
|
||||
}
|
||||
|
||||
@@ -158,6 +168,7 @@ String Performance::get_monitor_name(Monitor p_monitor) const {
|
||||
PNAME("physics_3d/collision_pairs"),
|
||||
PNAME("physics_3d/islands"),
|
||||
PNAME("audio/driver/output_latency"),
|
||||
#if !defined(NAVIGATION_2D_DISABLED) || !defined(NAVIGATION_3D_DISABLED)
|
||||
PNAME("navigation/active_maps"),
|
||||
PNAME("navigation/regions"),
|
||||
PNAME("navigation/agents"),
|
||||
@@ -168,11 +179,13 @@ String Performance::get_monitor_name(Monitor p_monitor) const {
|
||||
PNAME("navigation/edges_connected"),
|
||||
PNAME("navigation/edges_free"),
|
||||
PNAME("navigation/obstacles"),
|
||||
#endif // !defined(NAVIGATION_2D_DISABLED) || !defined(NAVIGATION_3D_DISABLED)
|
||||
PNAME("pipeline/compilations_canvas"),
|
||||
PNAME("pipeline/compilations_mesh"),
|
||||
PNAME("pipeline/compilations_surface"),
|
||||
PNAME("pipeline/compilations_draw"),
|
||||
PNAME("pipeline/compilations_specialization"),
|
||||
#ifndef NAVIGATION_2D_DISABLED
|
||||
PNAME("navigation_2d/active_maps"),
|
||||
PNAME("navigation_2d/regions"),
|
||||
PNAME("navigation_2d/agents"),
|
||||
@@ -183,6 +196,8 @@ String Performance::get_monitor_name(Monitor p_monitor) const {
|
||||
PNAME("navigation_2d/edges_connected"),
|
||||
PNAME("navigation_2d/edges_free"),
|
||||
PNAME("navigation_2d/obstacles"),
|
||||
#endif // NAVIGATION_2D_DISABLED
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
PNAME("navigation_3d/active_maps"),
|
||||
PNAME("navigation_3d/regions"),
|
||||
PNAME("navigation_3d/agents"),
|
||||
@@ -193,6 +208,7 @@ String Performance::get_monitor_name(Monitor p_monitor) const {
|
||||
PNAME("navigation_3d/edges_connected"),
|
||||
PNAME("navigation_3d/edges_free"),
|
||||
PNAME("navigation_3d/obstacles"),
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
};
|
||||
static_assert(std::size(names) == MONITOR_MAX);
|
||||
|
||||
@@ -200,6 +216,8 @@ String Performance::get_monitor_name(Monitor p_monitor) const {
|
||||
}
|
||||
|
||||
double Performance::get_monitor(Monitor p_monitor) const {
|
||||
int info = 0;
|
||||
|
||||
switch (p_monitor) {
|
||||
case TIME_FPS:
|
||||
return Engine::get_singleton()->get_frames_per_second();
|
||||
@@ -280,36 +298,96 @@ double Performance::get_monitor(Monitor p_monitor) const {
|
||||
return AudioServer::get_singleton()->get_output_latency();
|
||||
|
||||
case NAVIGATION_ACTIVE_MAPS:
|
||||
return NavigationServer2D::get_singleton()->get_process_info(NavigationServer2D::INFO_ACTIVE_MAPS) +
|
||||
NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_ACTIVE_MAPS);
|
||||
case NAVIGATION_REGION_COUNT:
|
||||
return NavigationServer2D::get_singleton()->get_process_info(NavigationServer2D::INFO_REGION_COUNT) +
|
||||
NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_REGION_COUNT);
|
||||
case NAVIGATION_AGENT_COUNT:
|
||||
return NavigationServer2D::get_singleton()->get_process_info(NavigationServer2D::INFO_AGENT_COUNT) +
|
||||
NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_AGENT_COUNT);
|
||||
case NAVIGATION_LINK_COUNT:
|
||||
return NavigationServer2D::get_singleton()->get_process_info(NavigationServer2D::INFO_LINK_COUNT) +
|
||||
NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_LINK_COUNT);
|
||||
case NAVIGATION_POLYGON_COUNT:
|
||||
return NavigationServer2D::get_singleton()->get_process_info(NavigationServer2D::INFO_POLYGON_COUNT) +
|
||||
NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_POLYGON_COUNT);
|
||||
case NAVIGATION_EDGE_COUNT:
|
||||
return NavigationServer2D::get_singleton()->get_process_info(NavigationServer2D::INFO_EDGE_COUNT) +
|
||||
NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_EDGE_COUNT);
|
||||
case NAVIGATION_EDGE_MERGE_COUNT:
|
||||
return NavigationServer2D::get_singleton()->get_process_info(NavigationServer2D::INFO_EDGE_MERGE_COUNT) +
|
||||
NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_EDGE_MERGE_COUNT);
|
||||
case NAVIGATION_EDGE_CONNECTION_COUNT:
|
||||
return NavigationServer2D::get_singleton()->get_process_info(NavigationServer2D::INFO_EDGE_CONNECTION_COUNT) +
|
||||
NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_EDGE_CONNECTION_COUNT);
|
||||
case NAVIGATION_EDGE_FREE_COUNT:
|
||||
return NavigationServer2D::get_singleton()->get_process_info(NavigationServer2D::INFO_EDGE_FREE_COUNT) +
|
||||
NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_EDGE_FREE_COUNT);
|
||||
case NAVIGATION_OBSTACLE_COUNT:
|
||||
return NavigationServer2D::get_singleton()->get_process_info(NavigationServer2D::INFO_OBSTACLE_COUNT) +
|
||||
NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_OBSTACLE_COUNT);
|
||||
#ifndef NAVIGATION_2D_DISABLED
|
||||
info = NavigationServer2D::get_singleton()->get_process_info(NavigationServer2D::INFO_ACTIVE_MAPS);
|
||||
#endif // NAVIGATION_2D_DISABLED
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
info += NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_ACTIVE_MAPS);
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
return info;
|
||||
|
||||
case NAVIGATION_REGION_COUNT:
|
||||
#ifndef NAVIGATION_2D_DISABLED
|
||||
info = NavigationServer2D::get_singleton()->get_process_info(NavigationServer2D::INFO_REGION_COUNT);
|
||||
#endif // NAVIGATION_2D_DISABLED
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
info += NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_REGION_COUNT);
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
return info;
|
||||
|
||||
case NAVIGATION_AGENT_COUNT:
|
||||
#ifndef NAVIGATION_2D_DISABLED
|
||||
info = NavigationServer2D::get_singleton()->get_process_info(NavigationServer2D::INFO_AGENT_COUNT);
|
||||
#endif // NAVIGATION_2D_DISABLED
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
info += NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_AGENT_COUNT);
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
return info;
|
||||
|
||||
case NAVIGATION_LINK_COUNT:
|
||||
#ifndef NAVIGATION_2D_DISABLED
|
||||
info = NavigationServer2D::get_singleton()->get_process_info(NavigationServer2D::INFO_LINK_COUNT);
|
||||
#endif // NAVIGATION_2D_DISABLED
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
info += NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_LINK_COUNT);
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
return info;
|
||||
|
||||
case NAVIGATION_POLYGON_COUNT:
|
||||
#ifndef NAVIGATION_2D_DISABLED
|
||||
info = NavigationServer2D::get_singleton()->get_process_info(NavigationServer2D::INFO_POLYGON_COUNT);
|
||||
#endif // NAVIGATION_2D_DISABLED
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
info += NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_POLYGON_COUNT);
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
return info;
|
||||
|
||||
case NAVIGATION_EDGE_COUNT:
|
||||
#ifndef NAVIGATION_2D_DISABLED
|
||||
info = NavigationServer2D::get_singleton()->get_process_info(NavigationServer2D::INFO_EDGE_COUNT);
|
||||
#endif // NAVIGATION_2D_DISABLED
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
info += NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_EDGE_COUNT);
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
return info;
|
||||
|
||||
case NAVIGATION_EDGE_MERGE_COUNT:
|
||||
#ifndef NAVIGATION_2D_DISABLED
|
||||
info = NavigationServer2D::get_singleton()->get_process_info(NavigationServer2D::INFO_EDGE_MERGE_COUNT);
|
||||
#endif // NAVIGATION_2D_DISABLED
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
info += NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_EDGE_MERGE_COUNT);
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
return info;
|
||||
|
||||
case NAVIGATION_EDGE_CONNECTION_COUNT:
|
||||
#ifndef NAVIGATION_2D_DISABLED
|
||||
info = NavigationServer2D::get_singleton()->get_process_info(NavigationServer2D::INFO_EDGE_CONNECTION_COUNT);
|
||||
#endif // NAVIGATION_2D_DISABLED
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
info += NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_EDGE_CONNECTION_COUNT);
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
return info;
|
||||
|
||||
case NAVIGATION_EDGE_FREE_COUNT:
|
||||
#ifndef NAVIGATION_2D_DISABLED
|
||||
info = NavigationServer2D::get_singleton()->get_process_info(NavigationServer2D::INFO_EDGE_FREE_COUNT);
|
||||
#endif // NAVIGATION_2D_DISABLED
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
info += NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_EDGE_FREE_COUNT);
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
return info;
|
||||
|
||||
case NAVIGATION_OBSTACLE_COUNT:
|
||||
#ifndef NAVIGATION_2D_DISABLED
|
||||
info = NavigationServer2D::get_singleton()->get_process_info(NavigationServer2D::INFO_OBSTACLE_COUNT);
|
||||
#endif // NAVIGATION_2D_DISABLED
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
info += NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_OBSTACLE_COUNT);
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
return info;
|
||||
|
||||
#ifndef NAVIGATION_2D_DISABLED
|
||||
case NAVIGATION_2D_ACTIVE_MAPS:
|
||||
return NavigationServer2D::get_singleton()->get_process_info(NavigationServer2D::INFO_ACTIVE_MAPS);
|
||||
case NAVIGATION_2D_REGION_COUNT:
|
||||
@@ -330,7 +408,9 @@ double Performance::get_monitor(Monitor p_monitor) const {
|
||||
return NavigationServer2D::get_singleton()->get_process_info(NavigationServer2D::INFO_EDGE_FREE_COUNT);
|
||||
case NAVIGATION_2D_OBSTACLE_COUNT:
|
||||
return NavigationServer2D::get_singleton()->get_process_info(NavigationServer2D::INFO_OBSTACLE_COUNT);
|
||||
#endif // NAVIGATION_2D_DISABLED
|
||||
|
||||
#ifndef NAVIGATION_3D_DISABLED
|
||||
case NAVIGATION_3D_ACTIVE_MAPS:
|
||||
return NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_ACTIVE_MAPS);
|
||||
case NAVIGATION_3D_REGION_COUNT:
|
||||
@@ -351,6 +431,7 @@ double Performance::get_monitor(Monitor p_monitor) const {
|
||||
return NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_EDGE_FREE_COUNT);
|
||||
case NAVIGATION_3D_OBSTACLE_COUNT:
|
||||
return NavigationServer3D::get_singleton()->get_process_info(NavigationServer3D::INFO_OBSTACLE_COUNT);
|
||||
#endif // NAVIGATION_3D_DISABLED
|
||||
|
||||
default: {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user