feat: godot-engine-source-4.3-stable
This commit is contained in:
parent
c59a7dcade
commit
7125d019b5
11149 changed files with 5070401 additions and 0 deletions
5
engine/servers/navigation/SCsub
Normal file
5
engine/servers/navigation/SCsub
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
Import("env")
|
||||
|
||||
env.add_source_files(env.servers_sources, "*.cpp")
|
||||
|
|
@ -0,0 +1,186 @@
|
|||
/**************************************************************************/
|
||||
/* navigation_path_query_parameters_2d.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "navigation_path_query_parameters_2d.h"
|
||||
|
||||
void NavigationPathQueryParameters2D::set_pathfinding_algorithm(const NavigationPathQueryParameters2D::PathfindingAlgorithm p_pathfinding_algorithm) {
|
||||
switch (p_pathfinding_algorithm) {
|
||||
case PATHFINDING_ALGORITHM_ASTAR: {
|
||||
parameters.pathfinding_algorithm = NavigationUtilities::PathfindingAlgorithm::PATHFINDING_ALGORITHM_ASTAR;
|
||||
} break;
|
||||
default: {
|
||||
WARN_PRINT_ONCE("No match for used PathfindingAlgorithm - fallback to default");
|
||||
parameters.pathfinding_algorithm = NavigationUtilities::PathfindingAlgorithm::PATHFINDING_ALGORITHM_ASTAR;
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
NavigationPathQueryParameters2D::PathfindingAlgorithm NavigationPathQueryParameters2D::get_pathfinding_algorithm() const {
|
||||
switch (parameters.pathfinding_algorithm) {
|
||||
case NavigationUtilities::PathfindingAlgorithm::PATHFINDING_ALGORITHM_ASTAR:
|
||||
return PATHFINDING_ALGORITHM_ASTAR;
|
||||
default:
|
||||
WARN_PRINT_ONCE("No match for used PathfindingAlgorithm - fallback to default");
|
||||
return PATHFINDING_ALGORITHM_ASTAR;
|
||||
}
|
||||
}
|
||||
|
||||
void NavigationPathQueryParameters2D::set_path_postprocessing(const NavigationPathQueryParameters2D::PathPostProcessing p_path_postprocessing) {
|
||||
switch (p_path_postprocessing) {
|
||||
case PATH_POSTPROCESSING_CORRIDORFUNNEL: {
|
||||
parameters.path_postprocessing = NavigationUtilities::PathPostProcessing::PATH_POSTPROCESSING_CORRIDORFUNNEL;
|
||||
} break;
|
||||
case PATH_POSTPROCESSING_EDGECENTERED: {
|
||||
parameters.path_postprocessing = NavigationUtilities::PathPostProcessing::PATH_POSTPROCESSING_EDGECENTERED;
|
||||
} break;
|
||||
default: {
|
||||
WARN_PRINT_ONCE("No match for used PathPostProcessing - fallback to default");
|
||||
parameters.path_postprocessing = NavigationUtilities::PathPostProcessing::PATH_POSTPROCESSING_CORRIDORFUNNEL;
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
NavigationPathQueryParameters2D::PathPostProcessing NavigationPathQueryParameters2D::get_path_postprocessing() const {
|
||||
switch (parameters.path_postprocessing) {
|
||||
case NavigationUtilities::PathPostProcessing::PATH_POSTPROCESSING_CORRIDORFUNNEL:
|
||||
return PATH_POSTPROCESSING_CORRIDORFUNNEL;
|
||||
case NavigationUtilities::PathPostProcessing::PATH_POSTPROCESSING_EDGECENTERED:
|
||||
return PATH_POSTPROCESSING_EDGECENTERED;
|
||||
default:
|
||||
WARN_PRINT_ONCE("No match for used PathPostProcessing - fallback to default");
|
||||
return PATH_POSTPROCESSING_CORRIDORFUNNEL;
|
||||
}
|
||||
}
|
||||
|
||||
void NavigationPathQueryParameters2D::set_map(const RID &p_map) {
|
||||
parameters.map = p_map;
|
||||
}
|
||||
|
||||
const RID &NavigationPathQueryParameters2D::get_map() const {
|
||||
return parameters.map;
|
||||
}
|
||||
|
||||
void NavigationPathQueryParameters2D::set_start_position(const Vector2 p_start_position) {
|
||||
parameters.start_position = Vector3(p_start_position.x, 0.0, p_start_position.y);
|
||||
}
|
||||
|
||||
Vector2 NavigationPathQueryParameters2D::get_start_position() const {
|
||||
return Vector2(parameters.start_position.x, parameters.start_position.z);
|
||||
}
|
||||
|
||||
void NavigationPathQueryParameters2D::set_target_position(const Vector2 p_target_position) {
|
||||
parameters.target_position = Vector3(p_target_position.x, 0.0, p_target_position.y);
|
||||
}
|
||||
|
||||
Vector2 NavigationPathQueryParameters2D::get_target_position() const {
|
||||
return Vector2(parameters.target_position.x, parameters.target_position.z);
|
||||
}
|
||||
|
||||
void NavigationPathQueryParameters2D::set_navigation_layers(uint32_t p_navigation_layers) {
|
||||
parameters.navigation_layers = p_navigation_layers;
|
||||
}
|
||||
|
||||
uint32_t NavigationPathQueryParameters2D::get_navigation_layers() const {
|
||||
return parameters.navigation_layers;
|
||||
}
|
||||
|
||||
void NavigationPathQueryParameters2D::set_metadata_flags(BitField<NavigationPathQueryParameters2D::PathMetadataFlags> p_flags) {
|
||||
parameters.metadata_flags = (int64_t)p_flags;
|
||||
}
|
||||
|
||||
BitField<NavigationPathQueryParameters2D::PathMetadataFlags> NavigationPathQueryParameters2D::get_metadata_flags() const {
|
||||
return (int64_t)parameters.metadata_flags;
|
||||
}
|
||||
|
||||
void NavigationPathQueryParameters2D::set_simplify_path(bool p_enabled) {
|
||||
parameters.simplify_path = p_enabled;
|
||||
}
|
||||
|
||||
bool NavigationPathQueryParameters2D::get_simplify_path() const {
|
||||
return parameters.simplify_path;
|
||||
}
|
||||
|
||||
void NavigationPathQueryParameters2D::set_simplify_epsilon(real_t p_epsilon) {
|
||||
parameters.simplify_epsilon = MAX(0.0, p_epsilon);
|
||||
}
|
||||
|
||||
real_t NavigationPathQueryParameters2D::get_simplify_epsilon() const {
|
||||
return parameters.simplify_epsilon;
|
||||
}
|
||||
|
||||
void NavigationPathQueryParameters2D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_pathfinding_algorithm", "pathfinding_algorithm"), &NavigationPathQueryParameters2D::set_pathfinding_algorithm);
|
||||
ClassDB::bind_method(D_METHOD("get_pathfinding_algorithm"), &NavigationPathQueryParameters2D::get_pathfinding_algorithm);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_path_postprocessing", "path_postprocessing"), &NavigationPathQueryParameters2D::set_path_postprocessing);
|
||||
ClassDB::bind_method(D_METHOD("get_path_postprocessing"), &NavigationPathQueryParameters2D::get_path_postprocessing);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_map", "map"), &NavigationPathQueryParameters2D::set_map);
|
||||
ClassDB::bind_method(D_METHOD("get_map"), &NavigationPathQueryParameters2D::get_map);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_start_position", "start_position"), &NavigationPathQueryParameters2D::set_start_position);
|
||||
ClassDB::bind_method(D_METHOD("get_start_position"), &NavigationPathQueryParameters2D::get_start_position);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_target_position", "target_position"), &NavigationPathQueryParameters2D::set_target_position);
|
||||
ClassDB::bind_method(D_METHOD("get_target_position"), &NavigationPathQueryParameters2D::get_target_position);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_navigation_layers", "navigation_layers"), &NavigationPathQueryParameters2D::set_navigation_layers);
|
||||
ClassDB::bind_method(D_METHOD("get_navigation_layers"), &NavigationPathQueryParameters2D::get_navigation_layers);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_metadata_flags", "flags"), &NavigationPathQueryParameters2D::set_metadata_flags);
|
||||
ClassDB::bind_method(D_METHOD("get_metadata_flags"), &NavigationPathQueryParameters2D::get_metadata_flags);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_simplify_path", "enabled"), &NavigationPathQueryParameters2D::set_simplify_path);
|
||||
ClassDB::bind_method(D_METHOD("get_simplify_path"), &NavigationPathQueryParameters2D::get_simplify_path);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_simplify_epsilon", "epsilon"), &NavigationPathQueryParameters2D::set_simplify_epsilon);
|
||||
ClassDB::bind_method(D_METHOD("get_simplify_epsilon"), &NavigationPathQueryParameters2D::get_simplify_epsilon);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::RID, "map"), "set_map", "get_map");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "start_position"), "set_start_position", "get_start_position");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "target_position"), "set_target_position", "get_target_position");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "navigation_layers", PROPERTY_HINT_LAYERS_2D_NAVIGATION), "set_navigation_layers", "get_navigation_layers");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "pathfinding_algorithm", PROPERTY_HINT_ENUM, "AStar"), "set_pathfinding_algorithm", "get_pathfinding_algorithm");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "path_postprocessing", PROPERTY_HINT_ENUM, "Corridorfunnel,Edgecentered"), "set_path_postprocessing", "get_path_postprocessing");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "metadata_flags", PROPERTY_HINT_FLAGS, "Include Types,Include RIDs,Include Owners"), "set_metadata_flags", "get_metadata_flags");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "simplify_path"), "set_simplify_path", "get_simplify_path");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "simplify_epsilon"), "set_simplify_epsilon", "get_simplify_epsilon");
|
||||
|
||||
BIND_ENUM_CONSTANT(PATHFINDING_ALGORITHM_ASTAR);
|
||||
|
||||
BIND_ENUM_CONSTANT(PATH_POSTPROCESSING_CORRIDORFUNNEL);
|
||||
BIND_ENUM_CONSTANT(PATH_POSTPROCESSING_EDGECENTERED);
|
||||
|
||||
BIND_BITFIELD_FLAG(PATH_METADATA_INCLUDE_NONE);
|
||||
BIND_BITFIELD_FLAG(PATH_METADATA_INCLUDE_TYPES);
|
||||
BIND_BITFIELD_FLAG(PATH_METADATA_INCLUDE_RIDS);
|
||||
BIND_BITFIELD_FLAG(PATH_METADATA_INCLUDE_OWNERS);
|
||||
BIND_BITFIELD_FLAG(PATH_METADATA_INCLUDE_ALL);
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
/**************************************************************************/
|
||||
/* navigation_path_query_parameters_2d.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef NAVIGATION_PATH_QUERY_PARAMETERS_2D_H
|
||||
#define NAVIGATION_PATH_QUERY_PARAMETERS_2D_H
|
||||
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "servers/navigation/navigation_utilities.h"
|
||||
|
||||
class NavigationPathQueryParameters2D : public RefCounted {
|
||||
GDCLASS(NavigationPathQueryParameters2D, RefCounted);
|
||||
|
||||
NavigationUtilities::PathQueryParameters parameters;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
enum PathfindingAlgorithm {
|
||||
PATHFINDING_ALGORITHM_ASTAR = 0,
|
||||
};
|
||||
|
||||
enum PathPostProcessing {
|
||||
PATH_POSTPROCESSING_CORRIDORFUNNEL = 0,
|
||||
PATH_POSTPROCESSING_EDGECENTERED,
|
||||
};
|
||||
|
||||
enum PathMetadataFlags {
|
||||
PATH_METADATA_INCLUDE_NONE = NavigationUtilities::PathMetadataFlags::PATH_INCLUDE_NONE,
|
||||
PATH_METADATA_INCLUDE_TYPES = NavigationUtilities::PathMetadataFlags::PATH_INCLUDE_TYPES,
|
||||
PATH_METADATA_INCLUDE_RIDS = NavigationUtilities::PathMetadataFlags::PATH_INCLUDE_RIDS,
|
||||
PATH_METADATA_INCLUDE_OWNERS = NavigationUtilities::PathMetadataFlags::PATH_INCLUDE_OWNERS,
|
||||
PATH_METADATA_INCLUDE_ALL = NavigationUtilities::PathMetadataFlags::PATH_INCLUDE_ALL
|
||||
};
|
||||
|
||||
const NavigationUtilities::PathQueryParameters &get_parameters() const { return parameters; }
|
||||
|
||||
void set_pathfinding_algorithm(const PathfindingAlgorithm p_pathfinding_algorithm);
|
||||
PathfindingAlgorithm get_pathfinding_algorithm() const;
|
||||
|
||||
void set_path_postprocessing(const PathPostProcessing p_path_postprocessing);
|
||||
PathPostProcessing get_path_postprocessing() const;
|
||||
|
||||
void set_map(const RID &p_map);
|
||||
const RID &get_map() const;
|
||||
|
||||
void set_start_position(const Vector2 p_start_position);
|
||||
Vector2 get_start_position() const;
|
||||
|
||||
void set_target_position(const Vector2 p_target_position);
|
||||
Vector2 get_target_position() const;
|
||||
|
||||
void set_navigation_layers(uint32_t p_navigation_layers);
|
||||
uint32_t get_navigation_layers() const;
|
||||
|
||||
void set_metadata_flags(BitField<NavigationPathQueryParameters2D::PathMetadataFlags> p_flags);
|
||||
BitField<NavigationPathQueryParameters2D::PathMetadataFlags> get_metadata_flags() const;
|
||||
|
||||
void set_simplify_path(bool p_enabled);
|
||||
bool get_simplify_path() const;
|
||||
|
||||
void set_simplify_epsilon(real_t p_epsilon);
|
||||
real_t get_simplify_epsilon() const;
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(NavigationPathQueryParameters2D::PathfindingAlgorithm);
|
||||
VARIANT_ENUM_CAST(NavigationPathQueryParameters2D::PathPostProcessing);
|
||||
VARIANT_BITFIELD_CAST(NavigationPathQueryParameters2D::PathMetadataFlags);
|
||||
|
||||
#endif // NAVIGATION_PATH_QUERY_PARAMETERS_2D_H
|
||||
|
|
@ -0,0 +1,186 @@
|
|||
/**************************************************************************/
|
||||
/* navigation_path_query_parameters_3d.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "navigation_path_query_parameters_3d.h"
|
||||
|
||||
void NavigationPathQueryParameters3D::set_pathfinding_algorithm(const NavigationPathQueryParameters3D::PathfindingAlgorithm p_pathfinding_algorithm) {
|
||||
switch (p_pathfinding_algorithm) {
|
||||
case PATHFINDING_ALGORITHM_ASTAR: {
|
||||
parameters.pathfinding_algorithm = NavigationUtilities::PathfindingAlgorithm::PATHFINDING_ALGORITHM_ASTAR;
|
||||
} break;
|
||||
default: {
|
||||
WARN_PRINT_ONCE("No match for used PathfindingAlgorithm - fallback to default");
|
||||
parameters.pathfinding_algorithm = NavigationUtilities::PathfindingAlgorithm::PATHFINDING_ALGORITHM_ASTAR;
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
NavigationPathQueryParameters3D::PathfindingAlgorithm NavigationPathQueryParameters3D::get_pathfinding_algorithm() const {
|
||||
switch (parameters.pathfinding_algorithm) {
|
||||
case NavigationUtilities::PathfindingAlgorithm::PATHFINDING_ALGORITHM_ASTAR:
|
||||
return PATHFINDING_ALGORITHM_ASTAR;
|
||||
default:
|
||||
WARN_PRINT_ONCE("No match for used PathfindingAlgorithm - fallback to default");
|
||||
return PATHFINDING_ALGORITHM_ASTAR;
|
||||
}
|
||||
}
|
||||
|
||||
void NavigationPathQueryParameters3D::set_path_postprocessing(const NavigationPathQueryParameters3D::PathPostProcessing p_path_postprocessing) {
|
||||
switch (p_path_postprocessing) {
|
||||
case PATH_POSTPROCESSING_CORRIDORFUNNEL: {
|
||||
parameters.path_postprocessing = NavigationUtilities::PathPostProcessing::PATH_POSTPROCESSING_CORRIDORFUNNEL;
|
||||
} break;
|
||||
case PATH_POSTPROCESSING_EDGECENTERED: {
|
||||
parameters.path_postprocessing = NavigationUtilities::PathPostProcessing::PATH_POSTPROCESSING_EDGECENTERED;
|
||||
} break;
|
||||
default: {
|
||||
WARN_PRINT_ONCE("No match for used PathPostProcessing - fallback to default");
|
||||
parameters.path_postprocessing = NavigationUtilities::PathPostProcessing::PATH_POSTPROCESSING_CORRIDORFUNNEL;
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
NavigationPathQueryParameters3D::PathPostProcessing NavigationPathQueryParameters3D::get_path_postprocessing() const {
|
||||
switch (parameters.path_postprocessing) {
|
||||
case NavigationUtilities::PathPostProcessing::PATH_POSTPROCESSING_CORRIDORFUNNEL:
|
||||
return PATH_POSTPROCESSING_CORRIDORFUNNEL;
|
||||
case NavigationUtilities::PathPostProcessing::PATH_POSTPROCESSING_EDGECENTERED:
|
||||
return PATH_POSTPROCESSING_EDGECENTERED;
|
||||
default:
|
||||
WARN_PRINT_ONCE("No match for used PathPostProcessing - fallback to default");
|
||||
return PATH_POSTPROCESSING_CORRIDORFUNNEL;
|
||||
}
|
||||
}
|
||||
|
||||
void NavigationPathQueryParameters3D::set_map(const RID &p_map) {
|
||||
parameters.map = p_map;
|
||||
}
|
||||
|
||||
const RID &NavigationPathQueryParameters3D::get_map() const {
|
||||
return parameters.map;
|
||||
}
|
||||
|
||||
void NavigationPathQueryParameters3D::set_start_position(const Vector3 &p_start_position) {
|
||||
parameters.start_position = p_start_position;
|
||||
}
|
||||
|
||||
const Vector3 &NavigationPathQueryParameters3D::get_start_position() const {
|
||||
return parameters.start_position;
|
||||
}
|
||||
|
||||
void NavigationPathQueryParameters3D::set_target_position(const Vector3 &p_target_position) {
|
||||
parameters.target_position = p_target_position;
|
||||
}
|
||||
|
||||
const Vector3 &NavigationPathQueryParameters3D::get_target_position() const {
|
||||
return parameters.target_position;
|
||||
}
|
||||
|
||||
void NavigationPathQueryParameters3D::set_navigation_layers(uint32_t p_navigation_layers) {
|
||||
parameters.navigation_layers = p_navigation_layers;
|
||||
}
|
||||
|
||||
uint32_t NavigationPathQueryParameters3D::get_navigation_layers() const {
|
||||
return parameters.navigation_layers;
|
||||
}
|
||||
|
||||
void NavigationPathQueryParameters3D::set_metadata_flags(BitField<NavigationPathQueryParameters3D::PathMetadataFlags> p_flags) {
|
||||
parameters.metadata_flags = (int64_t)p_flags;
|
||||
}
|
||||
|
||||
BitField<NavigationPathQueryParameters3D::PathMetadataFlags> NavigationPathQueryParameters3D::get_metadata_flags() const {
|
||||
return (int64_t)parameters.metadata_flags;
|
||||
}
|
||||
|
||||
void NavigationPathQueryParameters3D::set_simplify_path(bool p_enabled) {
|
||||
parameters.simplify_path = p_enabled;
|
||||
}
|
||||
|
||||
bool NavigationPathQueryParameters3D::get_simplify_path() const {
|
||||
return parameters.simplify_path;
|
||||
}
|
||||
|
||||
void NavigationPathQueryParameters3D::set_simplify_epsilon(real_t p_epsilon) {
|
||||
parameters.simplify_epsilon = MAX(0.0, p_epsilon);
|
||||
}
|
||||
|
||||
real_t NavigationPathQueryParameters3D::get_simplify_epsilon() const {
|
||||
return parameters.simplify_epsilon;
|
||||
}
|
||||
|
||||
void NavigationPathQueryParameters3D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_pathfinding_algorithm", "pathfinding_algorithm"), &NavigationPathQueryParameters3D::set_pathfinding_algorithm);
|
||||
ClassDB::bind_method(D_METHOD("get_pathfinding_algorithm"), &NavigationPathQueryParameters3D::get_pathfinding_algorithm);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_path_postprocessing", "path_postprocessing"), &NavigationPathQueryParameters3D::set_path_postprocessing);
|
||||
ClassDB::bind_method(D_METHOD("get_path_postprocessing"), &NavigationPathQueryParameters3D::get_path_postprocessing);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_map", "map"), &NavigationPathQueryParameters3D::set_map);
|
||||
ClassDB::bind_method(D_METHOD("get_map"), &NavigationPathQueryParameters3D::get_map);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_start_position", "start_position"), &NavigationPathQueryParameters3D::set_start_position);
|
||||
ClassDB::bind_method(D_METHOD("get_start_position"), &NavigationPathQueryParameters3D::get_start_position);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_target_position", "target_position"), &NavigationPathQueryParameters3D::set_target_position);
|
||||
ClassDB::bind_method(D_METHOD("get_target_position"), &NavigationPathQueryParameters3D::get_target_position);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_navigation_layers", "navigation_layers"), &NavigationPathQueryParameters3D::set_navigation_layers);
|
||||
ClassDB::bind_method(D_METHOD("get_navigation_layers"), &NavigationPathQueryParameters3D::get_navigation_layers);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_metadata_flags", "flags"), &NavigationPathQueryParameters3D::set_metadata_flags);
|
||||
ClassDB::bind_method(D_METHOD("get_metadata_flags"), &NavigationPathQueryParameters3D::get_metadata_flags);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_simplify_path", "enabled"), &NavigationPathQueryParameters3D::set_simplify_path);
|
||||
ClassDB::bind_method(D_METHOD("get_simplify_path"), &NavigationPathQueryParameters3D::get_simplify_path);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_simplify_epsilon", "epsilon"), &NavigationPathQueryParameters3D::set_simplify_epsilon);
|
||||
ClassDB::bind_method(D_METHOD("get_simplify_epsilon"), &NavigationPathQueryParameters3D::get_simplify_epsilon);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::RID, "map"), "set_map", "get_map");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "start_position"), "set_start_position", "get_start_position");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "target_position"), "set_target_position", "get_target_position");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "navigation_layers", PROPERTY_HINT_LAYERS_3D_NAVIGATION), "set_navigation_layers", "get_navigation_layers");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "pathfinding_algorithm", PROPERTY_HINT_ENUM, "AStar"), "set_pathfinding_algorithm", "get_pathfinding_algorithm");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "path_postprocessing", PROPERTY_HINT_ENUM, "Corridorfunnel,Edgecentered"), "set_path_postprocessing", "get_path_postprocessing");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "metadata_flags", PROPERTY_HINT_FLAGS, "Include Types,Include RIDs,Include Owners"), "set_metadata_flags", "get_metadata_flags");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "simplify_path"), "set_simplify_path", "get_simplify_path");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "simplify_epsilon"), "set_simplify_epsilon", "get_simplify_epsilon");
|
||||
|
||||
BIND_ENUM_CONSTANT(PATHFINDING_ALGORITHM_ASTAR);
|
||||
|
||||
BIND_ENUM_CONSTANT(PATH_POSTPROCESSING_CORRIDORFUNNEL);
|
||||
BIND_ENUM_CONSTANT(PATH_POSTPROCESSING_EDGECENTERED);
|
||||
|
||||
BIND_BITFIELD_FLAG(PATH_METADATA_INCLUDE_NONE);
|
||||
BIND_BITFIELD_FLAG(PATH_METADATA_INCLUDE_TYPES);
|
||||
BIND_BITFIELD_FLAG(PATH_METADATA_INCLUDE_RIDS);
|
||||
BIND_BITFIELD_FLAG(PATH_METADATA_INCLUDE_OWNERS);
|
||||
BIND_BITFIELD_FLAG(PATH_METADATA_INCLUDE_ALL);
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
/**************************************************************************/
|
||||
/* navigation_path_query_parameters_3d.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef NAVIGATION_PATH_QUERY_PARAMETERS_3D_H
|
||||
#define NAVIGATION_PATH_QUERY_PARAMETERS_3D_H
|
||||
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "servers/navigation/navigation_utilities.h"
|
||||
|
||||
class NavigationPathQueryParameters3D : public RefCounted {
|
||||
GDCLASS(NavigationPathQueryParameters3D, RefCounted);
|
||||
|
||||
NavigationUtilities::PathQueryParameters parameters;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
enum PathfindingAlgorithm {
|
||||
PATHFINDING_ALGORITHM_ASTAR = 0,
|
||||
};
|
||||
|
||||
enum PathPostProcessing {
|
||||
PATH_POSTPROCESSING_CORRIDORFUNNEL = 0,
|
||||
PATH_POSTPROCESSING_EDGECENTERED,
|
||||
};
|
||||
|
||||
enum PathMetadataFlags {
|
||||
PATH_METADATA_INCLUDE_NONE = NavigationUtilities::PathMetadataFlags::PATH_INCLUDE_NONE,
|
||||
PATH_METADATA_INCLUDE_TYPES = NavigationUtilities::PathMetadataFlags::PATH_INCLUDE_TYPES,
|
||||
PATH_METADATA_INCLUDE_RIDS = NavigationUtilities::PathMetadataFlags::PATH_INCLUDE_RIDS,
|
||||
PATH_METADATA_INCLUDE_OWNERS = NavigationUtilities::PathMetadataFlags::PATH_INCLUDE_OWNERS,
|
||||
PATH_METADATA_INCLUDE_ALL = NavigationUtilities::PathMetadataFlags::PATH_INCLUDE_ALL
|
||||
};
|
||||
|
||||
const NavigationUtilities::PathQueryParameters &get_parameters() const { return parameters; }
|
||||
|
||||
void set_pathfinding_algorithm(const PathfindingAlgorithm p_pathfinding_algorithm);
|
||||
PathfindingAlgorithm get_pathfinding_algorithm() const;
|
||||
|
||||
void set_path_postprocessing(const PathPostProcessing p_path_postprocessing);
|
||||
PathPostProcessing get_path_postprocessing() const;
|
||||
|
||||
void set_map(const RID &p_map);
|
||||
const RID &get_map() const;
|
||||
|
||||
void set_start_position(const Vector3 &p_start_position);
|
||||
const Vector3 &get_start_position() const;
|
||||
|
||||
void set_target_position(const Vector3 &p_target_position);
|
||||
const Vector3 &get_target_position() const;
|
||||
|
||||
void set_navigation_layers(uint32_t p_navigation_layers);
|
||||
uint32_t get_navigation_layers() const;
|
||||
|
||||
void set_metadata_flags(BitField<NavigationPathQueryParameters3D::PathMetadataFlags> p_flags);
|
||||
BitField<NavigationPathQueryParameters3D::PathMetadataFlags> get_metadata_flags() const;
|
||||
|
||||
void set_simplify_path(bool p_enabled);
|
||||
bool get_simplify_path() const;
|
||||
|
||||
void set_simplify_epsilon(real_t p_epsilon);
|
||||
real_t get_simplify_epsilon() const;
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(NavigationPathQueryParameters3D::PathfindingAlgorithm);
|
||||
VARIANT_ENUM_CAST(NavigationPathQueryParameters3D::PathPostProcessing);
|
||||
VARIANT_BITFIELD_CAST(NavigationPathQueryParameters3D::PathMetadataFlags);
|
||||
|
||||
#endif // NAVIGATION_PATH_QUERY_PARAMETERS_3D_H
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
/**************************************************************************/
|
||||
/* navigation_path_query_result_2d.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "navigation_path_query_result_2d.h"
|
||||
|
||||
void NavigationPathQueryResult2D::set_path(const Vector<Vector2> &p_path) {
|
||||
path = p_path;
|
||||
}
|
||||
|
||||
const Vector<Vector2> &NavigationPathQueryResult2D::get_path() const {
|
||||
return path;
|
||||
}
|
||||
|
||||
void NavigationPathQueryResult2D::set_path_types(const Vector<int32_t> &p_path_types) {
|
||||
path_types = p_path_types;
|
||||
}
|
||||
|
||||
const Vector<int32_t> &NavigationPathQueryResult2D::get_path_types() const {
|
||||
return path_types;
|
||||
}
|
||||
|
||||
void NavigationPathQueryResult2D::set_path_rids(const TypedArray<RID> &p_path_rids) {
|
||||
path_rids = p_path_rids;
|
||||
}
|
||||
|
||||
TypedArray<RID> NavigationPathQueryResult2D::get_path_rids() const {
|
||||
return path_rids;
|
||||
}
|
||||
|
||||
void NavigationPathQueryResult2D::set_path_owner_ids(const Vector<int64_t> &p_path_owner_ids) {
|
||||
path_owner_ids = p_path_owner_ids;
|
||||
}
|
||||
|
||||
const Vector<int64_t> &NavigationPathQueryResult2D::get_path_owner_ids() const {
|
||||
return path_owner_ids;
|
||||
}
|
||||
|
||||
void NavigationPathQueryResult2D::reset() {
|
||||
path.clear();
|
||||
path_types.clear();
|
||||
path_rids.clear();
|
||||
path_owner_ids.clear();
|
||||
}
|
||||
|
||||
void NavigationPathQueryResult2D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_path", "path"), &NavigationPathQueryResult2D::set_path);
|
||||
ClassDB::bind_method(D_METHOD("get_path"), &NavigationPathQueryResult2D::get_path);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_path_types", "path_types"), &NavigationPathQueryResult2D::set_path_types);
|
||||
ClassDB::bind_method(D_METHOD("get_path_types"), &NavigationPathQueryResult2D::get_path_types);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_path_rids", "path_rids"), &NavigationPathQueryResult2D::set_path_rids);
|
||||
ClassDB::bind_method(D_METHOD("get_path_rids"), &NavigationPathQueryResult2D::get_path_rids);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_path_owner_ids", "path_owner_ids"), &NavigationPathQueryResult2D::set_path_owner_ids);
|
||||
ClassDB::bind_method(D_METHOD("get_path_owner_ids"), &NavigationPathQueryResult2D::get_path_owner_ids);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("reset"), &NavigationPathQueryResult2D::reset);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "path"), "set_path", "get_path");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::PACKED_INT32_ARRAY, "path_types"), "set_path_types", "get_path_types");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "path_rids", PROPERTY_HINT_ARRAY_TYPE, "RID"), "set_path_rids", "get_path_rids");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::PACKED_INT64_ARRAY, "path_owner_ids"), "set_path_owner_ids", "get_path_owner_ids");
|
||||
|
||||
BIND_ENUM_CONSTANT(PATH_SEGMENT_TYPE_REGION);
|
||||
BIND_ENUM_CONSTANT(PATH_SEGMENT_TYPE_LINK);
|
||||
}
|
||||
71
engine/servers/navigation/navigation_path_query_result_2d.h
Normal file
71
engine/servers/navigation/navigation_path_query_result_2d.h
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
/**************************************************************************/
|
||||
/* navigation_path_query_result_2d.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef NAVIGATION_PATH_QUERY_RESULT_2D_H
|
||||
#define NAVIGATION_PATH_QUERY_RESULT_2D_H
|
||||
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "servers/navigation/navigation_utilities.h"
|
||||
|
||||
class NavigationPathQueryResult2D : public RefCounted {
|
||||
GDCLASS(NavigationPathQueryResult2D, RefCounted);
|
||||
|
||||
Vector<Vector2> path;
|
||||
Vector<int32_t> path_types;
|
||||
TypedArray<RID> path_rids;
|
||||
Vector<int64_t> path_owner_ids;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
enum PathSegmentType {
|
||||
PATH_SEGMENT_TYPE_REGION = 0,
|
||||
PATH_SEGMENT_TYPE_LINK = 1,
|
||||
};
|
||||
|
||||
void set_path(const Vector<Vector2> &p_path);
|
||||
const Vector<Vector2> &get_path() const;
|
||||
|
||||
void set_path_types(const Vector<int32_t> &p_path_types);
|
||||
const Vector<int32_t> &get_path_types() const;
|
||||
|
||||
void set_path_rids(const TypedArray<RID> &p_path_rids);
|
||||
TypedArray<RID> get_path_rids() const;
|
||||
|
||||
void set_path_owner_ids(const Vector<int64_t> &p_path_owner_ids);
|
||||
const Vector<int64_t> &get_path_owner_ids() const;
|
||||
|
||||
void reset();
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(NavigationPathQueryResult2D::PathSegmentType);
|
||||
|
||||
#endif // NAVIGATION_PATH_QUERY_RESULT_2D_H
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
/**************************************************************************/
|
||||
/* navigation_path_query_result_3d.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "navigation_path_query_result_3d.h"
|
||||
|
||||
void NavigationPathQueryResult3D::set_path(const Vector<Vector3> &p_path) {
|
||||
path = p_path;
|
||||
}
|
||||
|
||||
const Vector<Vector3> &NavigationPathQueryResult3D::get_path() const {
|
||||
return path;
|
||||
}
|
||||
|
||||
void NavigationPathQueryResult3D::set_path_types(const Vector<int32_t> &p_path_types) {
|
||||
path_types = p_path_types;
|
||||
}
|
||||
|
||||
const Vector<int32_t> &NavigationPathQueryResult3D::get_path_types() const {
|
||||
return path_types;
|
||||
}
|
||||
|
||||
void NavigationPathQueryResult3D::set_path_rids(const TypedArray<RID> &p_path_rids) {
|
||||
path_rids = p_path_rids;
|
||||
}
|
||||
|
||||
TypedArray<RID> NavigationPathQueryResult3D::get_path_rids() const {
|
||||
return path_rids;
|
||||
}
|
||||
|
||||
void NavigationPathQueryResult3D::set_path_owner_ids(const Vector<int64_t> &p_path_owner_ids) {
|
||||
path_owner_ids = p_path_owner_ids;
|
||||
}
|
||||
|
||||
const Vector<int64_t> &NavigationPathQueryResult3D::get_path_owner_ids() const {
|
||||
return path_owner_ids;
|
||||
}
|
||||
|
||||
void NavigationPathQueryResult3D::reset() {
|
||||
path.clear();
|
||||
path_types.clear();
|
||||
path_rids.clear();
|
||||
path_owner_ids.clear();
|
||||
}
|
||||
|
||||
void NavigationPathQueryResult3D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_path", "path"), &NavigationPathQueryResult3D::set_path);
|
||||
ClassDB::bind_method(D_METHOD("get_path"), &NavigationPathQueryResult3D::get_path);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_path_types", "path_types"), &NavigationPathQueryResult3D::set_path_types);
|
||||
ClassDB::bind_method(D_METHOD("get_path_types"), &NavigationPathQueryResult3D::get_path_types);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_path_rids", "path_rids"), &NavigationPathQueryResult3D::set_path_rids);
|
||||
ClassDB::bind_method(D_METHOD("get_path_rids"), &NavigationPathQueryResult3D::get_path_rids);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_path_owner_ids", "path_owner_ids"), &NavigationPathQueryResult3D::set_path_owner_ids);
|
||||
ClassDB::bind_method(D_METHOD("get_path_owner_ids"), &NavigationPathQueryResult3D::get_path_owner_ids);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("reset"), &NavigationPathQueryResult3D::reset);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR3_ARRAY, "path"), "set_path", "get_path");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::PACKED_INT32_ARRAY, "path_types"), "set_path_types", "get_path_types");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "path_rids", PROPERTY_HINT_ARRAY_TYPE, "RID"), "set_path_rids", "get_path_rids");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::PACKED_INT64_ARRAY, "path_owner_ids"), "set_path_owner_ids", "get_path_owner_ids");
|
||||
|
||||
BIND_ENUM_CONSTANT(PATH_SEGMENT_TYPE_REGION);
|
||||
BIND_ENUM_CONSTANT(PATH_SEGMENT_TYPE_LINK);
|
||||
}
|
||||
72
engine/servers/navigation/navigation_path_query_result_3d.h
Normal file
72
engine/servers/navigation/navigation_path_query_result_3d.h
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/**************************************************************************/
|
||||
/* navigation_path_query_result_3d.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef NAVIGATION_PATH_QUERY_RESULT_3D_H
|
||||
#define NAVIGATION_PATH_QUERY_RESULT_3D_H
|
||||
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "core/variant/typed_array.h"
|
||||
#include "servers/navigation/navigation_utilities.h"
|
||||
|
||||
class NavigationPathQueryResult3D : public RefCounted {
|
||||
GDCLASS(NavigationPathQueryResult3D, RefCounted);
|
||||
|
||||
Vector<Vector3> path;
|
||||
Vector<int32_t> path_types;
|
||||
TypedArray<RID> path_rids;
|
||||
Vector<int64_t> path_owner_ids;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
enum PathSegmentType {
|
||||
PATH_SEGMENT_TYPE_REGION = 0,
|
||||
PATH_SEGMENT_TYPE_LINK = 1,
|
||||
};
|
||||
|
||||
void set_path(const Vector<Vector3> &p_path);
|
||||
const Vector<Vector3> &get_path() const;
|
||||
|
||||
void set_path_types(const Vector<int32_t> &p_path_types);
|
||||
const Vector<int32_t> &get_path_types() const;
|
||||
|
||||
void set_path_rids(const TypedArray<RID> &p_path_rids);
|
||||
TypedArray<RID> get_path_rids() const;
|
||||
|
||||
void set_path_owner_ids(const Vector<int64_t> &p_path_owner_ids);
|
||||
const Vector<int64_t> &get_path_owner_ids() const;
|
||||
|
||||
void reset();
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(NavigationPathQueryResult3D::PathSegmentType);
|
||||
|
||||
#endif // NAVIGATION_PATH_QUERY_RESULT_3D_H
|
||||
82
engine/servers/navigation/navigation_utilities.h
Normal file
82
engine/servers/navigation/navigation_utilities.h
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
/**************************************************************************/
|
||||
/* navigation_utilities.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef NAVIGATION_UTILITIES_H
|
||||
#define NAVIGATION_UTILITIES_H
|
||||
|
||||
#include "core/math/vector3.h"
|
||||
#include "core/variant/typed_array.h"
|
||||
|
||||
namespace NavigationUtilities {
|
||||
|
||||
enum PathfindingAlgorithm {
|
||||
PATHFINDING_ALGORITHM_ASTAR = 0,
|
||||
};
|
||||
|
||||
enum PathPostProcessing {
|
||||
PATH_POSTPROCESSING_CORRIDORFUNNEL = 0,
|
||||
PATH_POSTPROCESSING_EDGECENTERED,
|
||||
};
|
||||
|
||||
enum PathSegmentType {
|
||||
PATH_SEGMENT_TYPE_REGION = 0,
|
||||
PATH_SEGMENT_TYPE_LINK
|
||||
};
|
||||
|
||||
enum PathMetadataFlags {
|
||||
PATH_INCLUDE_NONE = 0,
|
||||
PATH_INCLUDE_TYPES = 1,
|
||||
PATH_INCLUDE_RIDS = 2,
|
||||
PATH_INCLUDE_OWNERS = 4,
|
||||
PATH_INCLUDE_ALL = PATH_INCLUDE_TYPES | PATH_INCLUDE_RIDS | PATH_INCLUDE_OWNERS
|
||||
};
|
||||
|
||||
struct PathQueryParameters {
|
||||
PathfindingAlgorithm pathfinding_algorithm = PATHFINDING_ALGORITHM_ASTAR;
|
||||
PathPostProcessing path_postprocessing = PATH_POSTPROCESSING_CORRIDORFUNNEL;
|
||||
RID map;
|
||||
Vector3 start_position;
|
||||
Vector3 target_position;
|
||||
uint32_t navigation_layers = 1;
|
||||
BitField<PathMetadataFlags> metadata_flags = PATH_INCLUDE_ALL;
|
||||
bool simplify_path = false;
|
||||
real_t simplify_epsilon = 0.0;
|
||||
};
|
||||
|
||||
struct PathQueryResult {
|
||||
PackedVector3Array path;
|
||||
PackedInt32Array path_types;
|
||||
TypedArray<RID> path_rids;
|
||||
PackedInt64Array path_owner_ids;
|
||||
};
|
||||
|
||||
} //namespace NavigationUtilities
|
||||
|
||||
#endif // NAVIGATION_UTILITIES_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue