MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / NavMap2D

Method NavMap2D

modules/navigation_2d/nav_map_2d.cpp:761–793  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

759}
760
761NavMap2D::NavMap2D() {
762 avoidance_use_multiple_threads = GLOBAL_GET("navigation/avoidance/thread_model/avoidance_use_multiple_threads");
763 avoidance_use_high_priority_threads = GLOBAL_GET("navigation/avoidance/thread_model/avoidance_use_high_priority_threads");
764
765 path_query_slots_max = GLOBAL_GET("navigation/pathfinding/max_threads");
766
767 int processor_count = OS::get_singleton()->get_processor_count();
768 if (path_query_slots_max < 0) {
769 path_query_slots_max = processor_count;
770 }
771 if (processor_count < path_query_slots_max) {
772 path_query_slots_max = processor_count;
773 }
774 if (path_query_slots_max < 1) {
775 path_query_slots_max = 1;
776 }
777
778 iteration_slots.resize(2);
779
780 for (NavMapIteration2D &iteration_slot : iteration_slots) {
781 iteration_slot.path_query_slots.resize(path_query_slots_max);
782 for (uint32_t i = 0; i < iteration_slot.path_query_slots.size(); i++) {
783 iteration_slot.path_query_slots[i].slot_index = i;
784 }
785 iteration_slot.path_query_slots_semaphore.post(path_query_slots_max);
786 }
787
788#ifdef THREADS_ENABLED
789 use_async_iterations = GLOBAL_GET("navigation/world/map_use_async_iterations");
790#else
791 use_async_iterations = false;
792#endif
793}
794
795NavMap2D::~NavMap2D() {
796 if (iteration_build_thread_task_id != WorkerThreadPool::INVALID_TASK_ID) {

Callers

nothing calls this directly

Calls 4

sizeMethod · 0.65
get_processor_countMethod · 0.45
resizeMethod · 0.45
postMethod · 0.45

Tested by

no test coverage detected