Path: blob/master/servers/navigation/navigation_path_query_parameters_2d.h
10277 views
/**************************************************************************/1/* navigation_path_query_parameters_2d.h */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#pragma once3132#include "core/object/ref_counted.h"33#include "servers/navigation/navigation_globals.h"34#include "servers/navigation/navigation_utilities.h"3536class NavigationPathQueryParameters2D : public RefCounted {37GDCLASS(NavigationPathQueryParameters2D, RefCounted);3839protected:40static void _bind_methods();4142public:43enum PathfindingAlgorithm {44PATHFINDING_ALGORITHM_ASTAR = NavigationUtilities::PATHFINDING_ALGORITHM_ASTAR,45};4647enum PathPostProcessing {48PATH_POSTPROCESSING_CORRIDORFUNNEL = NavigationUtilities::PATH_POSTPROCESSING_CORRIDORFUNNEL,49PATH_POSTPROCESSING_EDGECENTERED = NavigationUtilities::PATH_POSTPROCESSING_EDGECENTERED,50PATH_POSTPROCESSING_NONE = NavigationUtilities::PATH_POSTPROCESSING_NONE,51};5253enum PathMetadataFlags {54PATH_METADATA_INCLUDE_NONE = NavigationUtilities::PathMetadataFlags::PATH_INCLUDE_NONE,55PATH_METADATA_INCLUDE_TYPES = NavigationUtilities::PathMetadataFlags::PATH_INCLUDE_TYPES,56PATH_METADATA_INCLUDE_RIDS = NavigationUtilities::PathMetadataFlags::PATH_INCLUDE_RIDS,57PATH_METADATA_INCLUDE_OWNERS = NavigationUtilities::PathMetadataFlags::PATH_INCLUDE_OWNERS,58PATH_METADATA_INCLUDE_ALL = NavigationUtilities::PathMetadataFlags::PATH_INCLUDE_ALL59};6061private:62PathfindingAlgorithm pathfinding_algorithm = PATHFINDING_ALGORITHM_ASTAR;63PathPostProcessing path_postprocessing = PATH_POSTPROCESSING_CORRIDORFUNNEL;64RID map;65Vector2 start_position;66Vector2 target_position;67uint32_t navigation_layers = 1;68BitField<PathMetadataFlags> metadata_flags = PATH_METADATA_INCLUDE_ALL;69bool simplify_path = false;70real_t simplify_epsilon = 0.0;7172LocalVector<RID> _excluded_regions;73LocalVector<RID> _included_regions;7475float path_return_max_length = 0.0;76float path_return_max_radius = 0.0;77int path_search_max_polygons = NavigationDefaults2D::path_search_max_polygons;78float path_search_max_distance = 0.0;7980public:81void set_pathfinding_algorithm(const PathfindingAlgorithm p_pathfinding_algorithm);82PathfindingAlgorithm get_pathfinding_algorithm() const;8384void set_path_postprocessing(const PathPostProcessing p_path_postprocessing);85PathPostProcessing get_path_postprocessing() const;8687void set_map(RID p_map);88RID get_map() const;8990void set_start_position(const Vector2 p_start_position);91Vector2 get_start_position() const;9293void set_target_position(const Vector2 p_target_position);94Vector2 get_target_position() const;9596void set_navigation_layers(uint32_t p_navigation_layers);97uint32_t get_navigation_layers() const;9899void set_metadata_flags(BitField<NavigationPathQueryParameters2D::PathMetadataFlags> p_flags);100BitField<NavigationPathQueryParameters2D::PathMetadataFlags> get_metadata_flags() const;101102void set_simplify_path(bool p_enabled);103bool get_simplify_path() const;104105void set_simplify_epsilon(real_t p_epsilon);106real_t get_simplify_epsilon() const;107108void set_excluded_regions(const TypedArray<RID> &p_regions);109TypedArray<RID> get_excluded_regions() const;110111void set_included_regions(const TypedArray<RID> &p_regions);112TypedArray<RID> get_included_regions() const;113114void set_path_return_max_length(float p_length);115float get_path_return_max_length() const;116117void set_path_return_max_radius(float p_radius);118float get_path_return_max_radius() const;119120void set_path_search_max_polygons(int p_max_polygons);121int get_path_search_max_polygons() const;122123void set_path_search_max_distance(float p_distance);124float get_path_search_max_distance() const;125};126127VARIANT_ENUM_CAST(NavigationPathQueryParameters2D::PathfindingAlgorithm);128VARIANT_ENUM_CAST(NavigationPathQueryParameters2D::PathPostProcessing);129VARIANT_BITFIELD_CAST(NavigationPathQueryParameters2D::PathMetadataFlags);130131132