0.2.0-dev Download ZIP
130 lines ·5.7 KB Raw
| 1 | /**************************************************************************/ |
| 2 | /* navigation_path_query_parameters_3d.h */ |
| 3 | /**************************************************************************/ |
| 4 | /* This file is part of: */ |
| 5 | /* GODOT ENGINE */ |
| 6 | /* https://godotengine.org */ |
| 7 | /**************************************************************************/ |
| 8 | /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ |
| 9 | /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ |
| 10 | /* */ |
| 11 | /* Permission is hereby granted, free of charge, to any person obtaining */ |
| 12 | /* a copy of this software and associated documentation files (the */ |
| 13 | /* "Software"), to deal in the Software without restriction, including */ |
| 14 | /* without limitation the rights to use, copy, modify, merge, publish, */ |
| 15 | /* distribute, sublicense, and/or sell copies of the Software, and to */ |
| 16 | /* permit persons to whom the Software is furnished to do so, subject to */ |
| 17 | /* the following conditions: */ |
| 18 | /* */ |
| 19 | /* The above copyright notice and this permission notice shall be */ |
| 20 | /* included in all copies or substantial portions of the Software. */ |
| 21 | /* */ |
| 22 | /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ |
| 23 | /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ |
| 24 | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ |
| 25 | /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ |
| 26 | /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ |
| 27 | /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ |
| 28 | /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ |
| 29 | /**************************************************************************/ |
| 30 | |
| 31 | #pragma once |
| 32 | |
| 33 | #include "core/object/ref_counted.h" |
| 34 | #include "core/variant/type_info.h" |
| 35 | #include "servers/navigation_3d/navigation_constants_3d.h" |
| 36 | |
| 37 | class NavigationPathQueryParameters3D : public RefCounted { |
| 38 | GDCLASS(NavigationPathQueryParameters3D, RefCounted); |
| 39 | |
| 40 | protected: |
| 41 | static void _bind_methods(); |
| 42 | |
| 43 | public: |
| 44 | enum PathfindingAlgorithm { |
| 45 | PATHFINDING_ALGORITHM_ASTAR = NavigationEnums3D::PATHFINDING_ALGORITHM_ASTAR, |
| 46 | }; |
| 47 | |
| 48 | enum PathPostProcessing { |
| 49 | PATH_POSTPROCESSING_CORRIDORFUNNEL = NavigationEnums3D::PATH_POSTPROCESSING_CORRIDORFUNNEL, |
| 50 | PATH_POSTPROCESSING_EDGECENTERED = NavigationEnums3D::PATH_POSTPROCESSING_EDGECENTERED, |
| 51 | PATH_POSTPROCESSING_NONE = NavigationEnums3D::PATH_POSTPROCESSING_NONE, |
| 52 | }; |
| 53 | |
| 54 | enum PathMetadataFlags { |
| 55 | PATH_METADATA_INCLUDE_NONE = NavigationEnums3D::PathMetadataFlags::PATH_INCLUDE_NONE, |
| 56 | PATH_METADATA_INCLUDE_TYPES = NavigationEnums3D::PathMetadataFlags::PATH_INCLUDE_TYPES, |
| 57 | PATH_METADATA_INCLUDE_RIDS = NavigationEnums3D::PathMetadataFlags::PATH_INCLUDE_RIDS, |
| 58 | PATH_METADATA_INCLUDE_OWNERS = NavigationEnums3D::PathMetadataFlags::PATH_INCLUDE_OWNERS, |
| 59 | PATH_METADATA_INCLUDE_ALL = NavigationEnums3D::PathMetadataFlags::PATH_INCLUDE_ALL |
| 60 | }; |
| 61 | |
| 62 | private: |
| 63 | PathfindingAlgorithm pathfinding_algorithm = PATHFINDING_ALGORITHM_ASTAR; |
| 64 | PathPostProcessing path_postprocessing = PATH_POSTPROCESSING_CORRIDORFUNNEL; |
| 65 | RID map; |
| 66 | Vector3 start_position; |
| 67 | Vector3 target_position; |
| 68 | uint32_t navigation_layers = 1; |
| 69 | BitField<PathMetadataFlags> metadata_flags = PATH_METADATA_INCLUDE_ALL; |
| 70 | bool simplify_path = false; |
| 71 | real_t simplify_epsilon = 0.0; |
| 72 | |
| 73 | LocalVector<RID> _excluded_regions; |
| 74 | LocalVector<RID> _included_regions; |
| 75 | |
| 76 | float path_return_max_length = 0.0; |
| 77 | float path_return_max_radius = 0.0; |
| 78 | int path_search_max_polygons = NavigationDefaults3D::path_search_max_polygons; |
| 79 | float path_search_max_distance = 0.0; |
| 80 | |
| 81 | public: |
| 82 | void set_pathfinding_algorithm(const PathfindingAlgorithm p_pathfinding_algorithm); |
| 83 | PathfindingAlgorithm get_pathfinding_algorithm() const; |
| 84 | |
| 85 | void set_path_postprocessing(const PathPostProcessing p_path_postprocessing); |
| 86 | PathPostProcessing get_path_postprocessing() const; |
| 87 | |
| 88 | void set_map(RID p_map); |
| 89 | RID get_map() const; |
| 90 | |
| 91 | void set_start_position(Vector3 p_start_position); |
| 92 | Vector3 get_start_position() const; |
| 93 | |
| 94 | void set_target_position(Vector3 p_target_position); |
| 95 | Vector3 get_target_position() const; |
| 96 | |
| 97 | void set_navigation_layers(uint32_t p_navigation_layers); |
| 98 | uint32_t get_navigation_layers() const; |
| 99 | |
| 100 | void set_metadata_flags(BitField<NavigationPathQueryParameters3D::PathMetadataFlags> p_flags); |
| 101 | BitField<NavigationPathQueryParameters3D::PathMetadataFlags> get_metadata_flags() const; |
| 102 | |
| 103 | void set_simplify_path(bool p_enabled); |
| 104 | bool get_simplify_path() const; |
| 105 | |
| 106 | void set_simplify_epsilon(real_t p_epsilon); |
| 107 | real_t get_simplify_epsilon() const; |
| 108 | |
| 109 | void set_excluded_regions(const TypedArray<RID> &p_regions); |
| 110 | TypedArray<RID> get_excluded_regions() const; |
| 111 | |
| 112 | void set_included_regions(const TypedArray<RID> &p_regions); |
| 113 | TypedArray<RID> get_included_regions() const; |
| 114 | |
| 115 | void set_path_return_max_length(float p_length); |
| 116 | float get_path_return_max_length() const; |
| 117 | |
| 118 | void set_path_return_max_radius(float p_radius); |
| 119 | float get_path_return_max_radius() const; |
| 120 | |
| 121 | void set_path_search_max_polygons(int p_max_polygons); |
| 122 | int get_path_search_max_polygons() const; |
| 123 | |
| 124 | void set_path_search_max_distance(float p_distance); |
| 125 | float get_path_search_max_distance() const; |
| 126 | }; |
| 127 | |
| 128 | VARIANT_ENUM_CAST(NavigationPathQueryParameters3D::PathfindingAlgorithm); |
| 129 | VARIANT_ENUM_CAST(NavigationPathQueryParameters3D::PathPostProcessing); |
| 130 | VARIANT_BITFIELD_CAST(NavigationPathQueryParameters3D::PathMetadataFlags); |