| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#include "core/object/ref_counted.h" |
| 34 |
#include "servers/navigation_2d/navigation_constants_2d.h" |
| 35 |
|
| 36 |
class NavigationPathQueryParameters2D : public RefCounted { |
| 37 |
GDCLASS(NavigationPathQueryParameters2D, RefCounted); |
| 38 |
|
| 39 |
protected: |
| 40 |
static void _bind_methods(); |
| 41 |
|
| 42 |
public: |
| 43 |
enum PathfindingAlgorithm { |
| 44 |
PATHFINDING_ALGORITHM_ASTAR = NavigationEnums2D::PATHFINDING_ALGORITHM_ASTAR, |
| 45 |
}; |
| 46 |
|
| 47 |
enum PathPostProcessing { |
| 48 |
PATH_POSTPROCESSING_CORRIDORFUNNEL = NavigationEnums2D::PATH_POSTPROCESSING_CORRIDORFUNNEL, |
| 49 |
PATH_POSTPROCESSING_EDGECENTERED = NavigationEnums2D::PATH_POSTPROCESSING_EDGECENTERED, |
| 50 |
PATH_POSTPROCESSING_NONE = NavigationEnums2D::PATH_POSTPROCESSING_NONE, |
| 51 |
}; |
| 52 |
|
| 53 |
enum PathMetadataFlags { |
| 54 |
PATH_METADATA_INCLUDE_NONE = NavigationEnums2D::PathMetadataFlags::PATH_INCLUDE_NONE, |
| 55 |
PATH_METADATA_INCLUDE_TYPES = NavigationEnums2D::PathMetadataFlags::PATH_INCLUDE_TYPES, |
| 56 |
PATH_METADATA_INCLUDE_RIDS = NavigationEnums2D::PathMetadataFlags::PATH_INCLUDE_RIDS, |
| 57 |
PATH_METADATA_INCLUDE_OWNERS = NavigationEnums2D::PathMetadataFlags::PATH_INCLUDE_OWNERS, |
| 58 |
PATH_METADATA_INCLUDE_ALL = NavigationEnums2D::PathMetadataFlags::PATH_INCLUDE_ALL |
| 59 |
}; |
| 60 |
|
| 61 |
private: |
| 62 |
PathfindingAlgorithm pathfinding_algorithm = PATHFINDING_ALGORITHM_ASTAR; |
| 63 |
PathPostProcessing path_postprocessing = PATH_POSTPROCESSING_CORRIDORFUNNEL; |
| 64 |
RID map; |
| 65 |
Vector2 start_position; |
| 66 |
Vector2 target_position; |
| 67 |
uint32_t navigation_layers = 1; |
| 68 |
BitField<PathMetadataFlags> metadata_flags = PATH_METADATA_INCLUDE_ALL; |
| 69 |
bool simplify_path = false; |
| 70 |
real_t simplify_epsilon = 0.0; |
| 71 |
|
| 72 |
LocalVector<RID> _excluded_regions; |
| 73 |
LocalVector<RID> _included_regions; |
| 74 |
|
| 75 |
float path_return_max_length = 0.0; |
| 76 |
float path_return_max_radius = 0.0; |
| 77 |
int path_search_max_polygons = NavigationDefaults2D::path_search_max_polygons; |
| 78 |
float path_search_max_distance = 0.0; |
| 79 |
|
| 80 |
public: |
| 81 |
void set_pathfinding_algorithm(const PathfindingAlgorithm p_pathfinding_algorithm); |
| 82 |
PathfindingAlgorithm get_pathfinding_algorithm() const; |
| 83 |
|
| 84 |
void set_path_postprocessing(const PathPostProcessing p_path_postprocessing); |
| 85 |
PathPostProcessing get_path_postprocessing() const; |
| 86 |
|
| 87 |
void set_map(RID p_map); |
| 88 |
RID get_map() const; |
| 89 |
|
| 90 |
void set_start_position(const Vector2 p_start_position); |
| 91 |
Vector2 get_start_position() const; |
| 92 |
|
| 93 |
void set_target_position(const Vector2 p_target_position); |
| 94 |
Vector2 get_target_position() const; |
| 95 |
|
| 96 |
void set_navigation_layers(uint32_t p_navigation_layers); |
| 97 |
uint32_t get_navigation_layers() const; |
| 98 |
|
| 99 |
void set_metadata_flags(BitField<NavigationPathQueryParameters2D::PathMetadataFlags> p_flags); |
| 100 |
BitField<NavigationPathQueryParameters2D::PathMetadataFlags> get_metadata_flags() const; |
| 101 |
|
| 102 |
void set_simplify_path(bool p_enabled); |
| 103 |
bool get_simplify_path() const; |
| 104 |
|
| 105 |
void set_simplify_epsilon(real_t p_epsilon); |
| 106 |
real_t get_simplify_epsilon() const; |
| 107 |
|
| 108 |
void set_excluded_regions(const TypedArray<RID> &p_regions); |
| 109 |
TypedArray<RID> get_excluded_regions() const; |
| 110 |
|
| 111 |
void set_included_regions(const TypedArray<RID> &p_regions); |
| 112 |
TypedArray<RID> get_included_regions() const; |
| 113 |
|
| 114 |
void set_path_return_max_length(float p_length); |
| 115 |
float get_path_return_max_length() const; |
| 116 |
|
| 117 |
void set_path_return_max_radius(float p_radius); |
| 118 |
float get_path_return_max_radius() const; |
| 119 |
|
| 120 |
void set_path_search_max_polygons(int p_max_polygons); |
| 121 |
int get_path_search_max_polygons() const; |
| 122 |
|
| 123 |
void set_path_search_max_distance(float p_distance); |
| 124 |
float get_path_search_max_distance() const; |
| 125 |
}; |
| 126 |
|
| 127 |
VARIANT_ENUM_CAST(NavigationPathQueryParameters2D::PathfindingAlgorithm); |
| 128 |
VARIANT_ENUM_CAST(NavigationPathQueryParameters2D::PathPostProcessing); |
| 129 |
VARIANT_BITFIELD_CAST(NavigationPathQueryParameters2D::PathMetadataFlags); |