feat: updated engine version to 4.4-rc1

This commit is contained in:
Sara 2025-02-23 14:38:14 +01:00
parent ee00efde1f
commit 21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions

View file

@ -1,4 +1,5 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
Import("env")

View file

@ -0,0 +1,67 @@
/**************************************************************************/
/* navigation_globals.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_GLOBALS_H
#define NAVIGATION_GLOBALS_H
namespace NavigationDefaults3D {
// Rasterization.
// To find the polygons edges the vertices are displaced in a grid where
// each cell has the following cell_size and cell_height.
constexpr float navmesh_cell_size{ 0.25f }; // Must match ProjectSettings default 3D cell_size and NavigationMesh cell_size.
constexpr float navmesh_cell_height{ 0.25f }; // Must match ProjectSettings default 3D cell_height and NavigationMesh cell_height.
constexpr float navmesh_cell_size_min{ 0.01f };
constexpr auto navmesh_cell_size_hint{ "0.001,100,0.001,or_greater" };
// Map.
constexpr float edge_connection_margin{ 0.25f };
constexpr float link_connection_radius{ 1.0f };
} //namespace NavigationDefaults3D
namespace NavigationDefaults2D {
// Rasterization.
// Same as in 3D but larger since 1px is treated as 1m.
constexpr float navmesh_cell_size{ 1.0f }; // Must match ProjectSettings default 2D cell_size.
constexpr auto navmesh_cell_size_hint{ "0.001,100,0.001,or_greater" };
// Map.
constexpr float edge_connection_margin{ 1.0f };
constexpr float link_connection_radius{ 4.0f };
} //namespace NavigationDefaults2D
#endif // NAVIGATION_GLOBALS_H

View file

@ -31,108 +31,75 @@
#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;
}
pathfinding_algorithm = p_pathfinding_algorithm;
}
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;
}
return pathfinding_algorithm;
}
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;
}
path_postprocessing = p_path_postprocessing;
}
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;
}
return path_postprocessing;
}
void NavigationPathQueryParameters2D::set_map(const RID &p_map) {
parameters.map = p_map;
void NavigationPathQueryParameters2D::set_map(RID p_map) {
map = p_map;
}
const RID &NavigationPathQueryParameters2D::get_map() const {
return parameters.map;
RID NavigationPathQueryParameters2D::get_map() const {
return 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);
void NavigationPathQueryParameters2D::set_start_position(Vector2 p_start_position) {
start_position = p_start_position;
}
Vector2 NavigationPathQueryParameters2D::get_start_position() const {
return Vector2(parameters.start_position.x, parameters.start_position.z);
return start_position;
}
void NavigationPathQueryParameters2D::set_target_position(const Vector2 p_target_position) {
parameters.target_position = Vector3(p_target_position.x, 0.0, p_target_position.y);
void NavigationPathQueryParameters2D::set_target_position(Vector2 p_target_position) {
target_position = p_target_position;
}
Vector2 NavigationPathQueryParameters2D::get_target_position() const {
return Vector2(parameters.target_position.x, parameters.target_position.z);
return target_position;
}
void NavigationPathQueryParameters2D::set_navigation_layers(uint32_t p_navigation_layers) {
parameters.navigation_layers = p_navigation_layers;
navigation_layers = p_navigation_layers;
}
uint32_t NavigationPathQueryParameters2D::get_navigation_layers() const {
return parameters.navigation_layers;
return navigation_layers;
}
void NavigationPathQueryParameters2D::set_metadata_flags(BitField<NavigationPathQueryParameters2D::PathMetadataFlags> p_flags) {
parameters.metadata_flags = (int64_t)p_flags;
metadata_flags = (int64_t)p_flags;
}
BitField<NavigationPathQueryParameters2D::PathMetadataFlags> NavigationPathQueryParameters2D::get_metadata_flags() const {
return (int64_t)parameters.metadata_flags;
return (int64_t)metadata_flags;
}
void NavigationPathQueryParameters2D::set_simplify_path(bool p_enabled) {
parameters.simplify_path = p_enabled;
simplify_path = p_enabled;
}
bool NavigationPathQueryParameters2D::get_simplify_path() const {
return parameters.simplify_path;
return simplify_path;
}
void NavigationPathQueryParameters2D::set_simplify_epsilon(real_t p_epsilon) {
parameters.simplify_epsilon = MAX(0.0, p_epsilon);
simplify_epsilon = MAX(0.0, p_epsilon);
}
real_t NavigationPathQueryParameters2D::get_simplify_epsilon() const {
return parameters.simplify_epsilon;
return simplify_epsilon;
}
void NavigationPathQueryParameters2D::_bind_methods() {
@ -168,7 +135,7 @@ void NavigationPathQueryParameters2D::_bind_methods() {
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, "path_postprocessing", PROPERTY_HINT_ENUM, "Corridorfunnel,Edgecentered,None"), "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");
@ -177,6 +144,7 @@ void NavigationPathQueryParameters2D::_bind_methods() {
BIND_ENUM_CONSTANT(PATH_POSTPROCESSING_CORRIDORFUNNEL);
BIND_ENUM_CONSTANT(PATH_POSTPROCESSING_EDGECENTERED);
BIND_ENUM_CONSTANT(PATH_POSTPROCESSING_NONE);
BIND_BITFIELD_FLAG(PATH_METADATA_INCLUDE_NONE);
BIND_BITFIELD_FLAG(PATH_METADATA_INCLUDE_TYPES);

View file

@ -37,19 +37,18 @@
class NavigationPathQueryParameters2D : public RefCounted {
GDCLASS(NavigationPathQueryParameters2D, RefCounted);
NavigationUtilities::PathQueryParameters parameters;
protected:
static void _bind_methods();
public:
enum PathfindingAlgorithm {
PATHFINDING_ALGORITHM_ASTAR = 0,
PATHFINDING_ALGORITHM_ASTAR = NavigationUtilities::PATHFINDING_ALGORITHM_ASTAR,
};
enum PathPostProcessing {
PATH_POSTPROCESSING_CORRIDORFUNNEL = 0,
PATH_POSTPROCESSING_EDGECENTERED,
PATH_POSTPROCESSING_CORRIDORFUNNEL = NavigationUtilities::PATH_POSTPROCESSING_CORRIDORFUNNEL,
PATH_POSTPROCESSING_EDGECENTERED = NavigationUtilities::PATH_POSTPROCESSING_EDGECENTERED,
PATH_POSTPROCESSING_NONE = NavigationUtilities::PATH_POSTPROCESSING_NONE,
};
enum PathMetadataFlags {
@ -60,16 +59,26 @@ public:
PATH_METADATA_INCLUDE_ALL = NavigationUtilities::PathMetadataFlags::PATH_INCLUDE_ALL
};
const NavigationUtilities::PathQueryParameters &get_parameters() const { return parameters; }
private:
PathfindingAlgorithm pathfinding_algorithm = PATHFINDING_ALGORITHM_ASTAR;
PathPostProcessing path_postprocessing = PATH_POSTPROCESSING_CORRIDORFUNNEL;
RID map;
Vector2 start_position;
Vector2 target_position;
uint32_t navigation_layers = 1;
BitField<PathMetadataFlags> metadata_flags = PATH_METADATA_INCLUDE_ALL;
bool simplify_path = false;
real_t simplify_epsilon = 0.0;
public:
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_map(RID p_map);
RID get_map() const;
void set_start_position(const Vector2 p_start_position);
Vector2 get_start_position() const;

View file

@ -31,108 +31,75 @@
#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;
}
pathfinding_algorithm = p_pathfinding_algorithm;
}
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;
}
return pathfinding_algorithm;
}
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;
}
path_postprocessing = p_path_postprocessing;
}
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;
}
return path_postprocessing;
}
void NavigationPathQueryParameters3D::set_map(const RID &p_map) {
parameters.map = p_map;
void NavigationPathQueryParameters3D::set_map(RID p_map) {
map = p_map;
}
const RID &NavigationPathQueryParameters3D::get_map() const {
return parameters.map;
RID NavigationPathQueryParameters3D::get_map() const {
return map;
}
void NavigationPathQueryParameters3D::set_start_position(const Vector3 &p_start_position) {
parameters.start_position = p_start_position;
void NavigationPathQueryParameters3D::set_start_position(Vector3 p_start_position) {
start_position = p_start_position;
}
const Vector3 &NavigationPathQueryParameters3D::get_start_position() const {
return parameters.start_position;
Vector3 NavigationPathQueryParameters3D::get_start_position() const {
return start_position;
}
void NavigationPathQueryParameters3D::set_target_position(const Vector3 &p_target_position) {
parameters.target_position = p_target_position;
void NavigationPathQueryParameters3D::set_target_position(Vector3 p_target_position) {
target_position = p_target_position;
}
const Vector3 &NavigationPathQueryParameters3D::get_target_position() const {
return parameters.target_position;
Vector3 NavigationPathQueryParameters3D::get_target_position() const {
return target_position;
}
void NavigationPathQueryParameters3D::set_navigation_layers(uint32_t p_navigation_layers) {
parameters.navigation_layers = p_navigation_layers;
navigation_layers = p_navigation_layers;
}
uint32_t NavigationPathQueryParameters3D::get_navigation_layers() const {
return parameters.navigation_layers;
return navigation_layers;
}
void NavigationPathQueryParameters3D::set_metadata_flags(BitField<NavigationPathQueryParameters3D::PathMetadataFlags> p_flags) {
parameters.metadata_flags = (int64_t)p_flags;
metadata_flags = (int64_t)p_flags;
}
BitField<NavigationPathQueryParameters3D::PathMetadataFlags> NavigationPathQueryParameters3D::get_metadata_flags() const {
return (int64_t)parameters.metadata_flags;
return (int64_t)metadata_flags;
}
void NavigationPathQueryParameters3D::set_simplify_path(bool p_enabled) {
parameters.simplify_path = p_enabled;
simplify_path = p_enabled;
}
bool NavigationPathQueryParameters3D::get_simplify_path() const {
return parameters.simplify_path;
return simplify_path;
}
void NavigationPathQueryParameters3D::set_simplify_epsilon(real_t p_epsilon) {
parameters.simplify_epsilon = MAX(0.0, p_epsilon);
simplify_epsilon = MAX(0.0, p_epsilon);
}
real_t NavigationPathQueryParameters3D::get_simplify_epsilon() const {
return parameters.simplify_epsilon;
return simplify_epsilon;
}
void NavigationPathQueryParameters3D::_bind_methods() {
@ -168,7 +135,7 @@ void NavigationPathQueryParameters3D::_bind_methods() {
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, "path_postprocessing", PROPERTY_HINT_ENUM, "Corridorfunnel,Edgecentered,None"), "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");
@ -177,6 +144,7 @@ void NavigationPathQueryParameters3D::_bind_methods() {
BIND_ENUM_CONSTANT(PATH_POSTPROCESSING_CORRIDORFUNNEL);
BIND_ENUM_CONSTANT(PATH_POSTPROCESSING_EDGECENTERED);
BIND_ENUM_CONSTANT(PATH_POSTPROCESSING_NONE);
BIND_BITFIELD_FLAG(PATH_METADATA_INCLUDE_NONE);
BIND_BITFIELD_FLAG(PATH_METADATA_INCLUDE_TYPES);

View file

@ -37,19 +37,18 @@
class NavigationPathQueryParameters3D : public RefCounted {
GDCLASS(NavigationPathQueryParameters3D, RefCounted);
NavigationUtilities::PathQueryParameters parameters;
protected:
static void _bind_methods();
public:
enum PathfindingAlgorithm {
PATHFINDING_ALGORITHM_ASTAR = 0,
PATHFINDING_ALGORITHM_ASTAR = NavigationUtilities::PATHFINDING_ALGORITHM_ASTAR,
};
enum PathPostProcessing {
PATH_POSTPROCESSING_CORRIDORFUNNEL = 0,
PATH_POSTPROCESSING_EDGECENTERED,
PATH_POSTPROCESSING_CORRIDORFUNNEL = NavigationUtilities::PATH_POSTPROCESSING_CORRIDORFUNNEL,
PATH_POSTPROCESSING_EDGECENTERED = NavigationUtilities::PATH_POSTPROCESSING_EDGECENTERED,
PATH_POSTPROCESSING_NONE = NavigationUtilities::PATH_POSTPROCESSING_NONE,
};
enum PathMetadataFlags {
@ -60,22 +59,32 @@ public:
PATH_METADATA_INCLUDE_ALL = NavigationUtilities::PathMetadataFlags::PATH_INCLUDE_ALL
};
const NavigationUtilities::PathQueryParameters &get_parameters() const { return parameters; }
private:
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_METADATA_INCLUDE_ALL;
bool simplify_path = false;
real_t simplify_epsilon = 0.0;
public:
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_map(RID p_map);
RID get_map() const;
void set_start_position(const Vector3 &p_start_position);
const Vector3 &get_start_position() const;
void set_start_position(Vector3 p_start_position);
Vector3 get_start_position() const;
void set_target_position(const Vector3 &p_target_position);
const Vector3 &get_target_position() const;
void set_target_position(Vector3 p_target_position);
Vector3 get_target_position() const;
void set_navigation_layers(uint32_t p_navigation_layers);
uint32_t get_navigation_layers() const;

View file

@ -47,8 +47,8 @@ protected:
public:
enum PathSegmentType {
PATH_SEGMENT_TYPE_REGION = 0,
PATH_SEGMENT_TYPE_LINK = 1,
PATH_SEGMENT_TYPE_REGION = NavigationUtilities::PathSegmentType::PATH_SEGMENT_TYPE_REGION,
PATH_SEGMENT_TYPE_LINK = NavigationUtilities::PathSegmentType::PATH_SEGMENT_TYPE_LINK,
};
void set_path(const Vector<Vector2> &p_path);

View file

@ -69,6 +69,47 @@ void NavigationPathQueryResult3D::reset() {
path_owner_ids.clear();
}
void NavigationPathQueryResult3D::set_data(const LocalVector<Vector3> &p_path, const LocalVector<int32_t> &p_path_types, const LocalVector<RID> &p_path_rids, const LocalVector<int64_t> &p_path_owner_ids) {
path.clear();
path_types.clear();
path_rids.clear();
path_owner_ids.clear();
{
path.resize(p_path.size());
Vector3 *w = path.ptrw();
const Vector3 *r = p_path.ptr();
for (uint32_t i = 0; i < p_path.size(); i++) {
w[i] = r[i];
}
}
{
path_types.resize(p_path_types.size());
int32_t *w = path_types.ptrw();
const int32_t *r = p_path_types.ptr();
for (uint32_t i = 0; i < p_path_types.size(); i++) {
w[i] = r[i];
}
}
{
path_rids.resize(p_path_rids.size());
for (uint32_t i = 0; i < p_path_rids.size(); i++) {
path_rids[i] = p_path_rids[i];
}
}
{
path_owner_ids.resize(p_path_owner_ids.size());
int64_t *w = path_owner_ids.ptrw();
const int64_t *r = p_path_owner_ids.ptr();
for (uint32_t i = 0; i < p_path_owner_ids.size(); i++) {
w[i] = r[i];
}
}
}
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);

View file

@ -48,8 +48,8 @@ protected:
public:
enum PathSegmentType {
PATH_SEGMENT_TYPE_REGION = 0,
PATH_SEGMENT_TYPE_LINK = 1,
PATH_SEGMENT_TYPE_REGION = NavigationUtilities::PathSegmentType::PATH_SEGMENT_TYPE_REGION,
PATH_SEGMENT_TYPE_LINK = NavigationUtilities::PathSegmentType::PATH_SEGMENT_TYPE_LINK,
};
void set_path(const Vector<Vector3> &p_path);
@ -65,6 +65,8 @@ public:
const Vector<int64_t> &get_path_owner_ids() const;
void reset();
void set_data(const LocalVector<Vector3> &p_path, const LocalVector<int32_t> &p_path_types, const LocalVector<RID> &p_path_rids, const LocalVector<int64_t> &p_path_owner_ids);
};
VARIANT_ENUM_CAST(NavigationPathQueryResult3D::PathSegmentType);

View file

@ -43,6 +43,7 @@ enum PathfindingAlgorithm {
enum PathPostProcessing {
PATH_POSTPROCESSING_CORRIDORFUNNEL = 0,
PATH_POSTPROCESSING_EDGECENTERED,
PATH_POSTPROCESSING_NONE,
};
enum PathSegmentType {
@ -58,25 +59,6 @@ enum PathMetadataFlags {
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