mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-25 05:07:12 +01:00
Turn PoolVectors in NavigationPathQueryResults into Vectors.
This commit is contained in:
parent
b2d8199a7b
commit
19fac49904
@ -320,7 +320,7 @@ NavigationUtilities::PathQueryResult2D PandemoniumNavigation2DServer::_query_pat
|
|||||||
NavigationUtilities::PathQueryResult res = NavigationServer::get_singleton()->_query_path(params);
|
NavigationUtilities::PathQueryResult res = NavigationServer::get_singleton()->_query_path(params);
|
||||||
|
|
||||||
NavigationUtilities::PathQueryResult2D resf;
|
NavigationUtilities::PathQueryResult2D resf;
|
||||||
resf.path = poolvector_v3_to_v2(res.path);
|
resf.path = vector_v3_to_v2(res.path);
|
||||||
resf.path_types = res.path_types;
|
resf.path_types = res.path_types;
|
||||||
resf.path_rids = res.path_rids;
|
resf.path_rids = res.path_rids;
|
||||||
resf.path_owner_ids = res.path_owner_ids;
|
resf.path_owner_ids = res.path_owner_ids;
|
||||||
|
@ -881,8 +881,7 @@ NavigationUtilities::PathQueryResult PandemoniumNavigationServer::_query_path(co
|
|||||||
|
|
||||||
r_query_result.path.resize(path.size());
|
r_query_result.path.resize(path.size());
|
||||||
|
|
||||||
PoolVector3Array::Write w = r_query_result.path.write();
|
Vector3 *wptr = r_query_result.path.ptrw();
|
||||||
Vector3 *wptr = w.ptr();
|
|
||||||
const Vector3 *pptr = path.ptr();
|
const Vector3 *pptr = path.ptr();
|
||||||
|
|
||||||
for (int i = 0; i < path.size(); ++i) {
|
for (int i = 0; i < path.size(); ++i) {
|
||||||
|
@ -440,7 +440,7 @@ Vector2 NavigationAgent2D::get_target_position() const {
|
|||||||
Vector2 NavigationAgent2D::get_next_position() {
|
Vector2 NavigationAgent2D::get_next_position() {
|
||||||
update_navigation();
|
update_navigation();
|
||||||
|
|
||||||
const PoolVector<Vector2> &navigation_path = navigation_result->get_path();
|
const Vector<Vector2> &navigation_path = navigation_result->get_path();
|
||||||
if (navigation_path.size() == 0) {
|
if (navigation_path.size() == 0) {
|
||||||
ERR_FAIL_COND_V(agent_parent == nullptr, Vector2());
|
ERR_FAIL_COND_V(agent_parent == nullptr, Vector2());
|
||||||
return agent_parent->get_global_transform().get_origin();
|
return agent_parent->get_global_transform().get_origin();
|
||||||
@ -449,7 +449,7 @@ Vector2 NavigationAgent2D::get_next_position() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const PoolVector<Vector2> &NavigationAgent2D::get_nav_path() const {
|
const Vector<Vector2> &NavigationAgent2D::get_nav_path() const {
|
||||||
return navigation_result->get_path();
|
return navigation_result->get_path();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -474,7 +474,7 @@ bool NavigationAgent2D::is_navigation_finished() {
|
|||||||
Vector2 NavigationAgent2D::get_final_position() {
|
Vector2 NavigationAgent2D::get_final_position() {
|
||||||
update_navigation();
|
update_navigation();
|
||||||
|
|
||||||
const PoolVector<Vector2> &navigation_path = navigation_result->get_path();
|
const Vector<Vector2> &navigation_path = navigation_result->get_path();
|
||||||
if (navigation_path.size() == 0) {
|
if (navigation_path.size() == 0) {
|
||||||
return Vector2();
|
return Vector2();
|
||||||
}
|
}
|
||||||
@ -533,7 +533,7 @@ void NavigationAgent2D::update_navigation() {
|
|||||||
} else {
|
} else {
|
||||||
// Check if too far from the navigation path
|
// Check if too far from the navigation path
|
||||||
if (nav_path_index > 0) {
|
if (nav_path_index > 0) {
|
||||||
const PoolVector<Vector2> &navigation_path = navigation_result->get_path();
|
const Vector<Vector2> &navigation_path = navigation_result->get_path();
|
||||||
|
|
||||||
Vector2 segment[2];
|
Vector2 segment[2];
|
||||||
segment[0] = navigation_path[nav_path_index - 1];
|
segment[0] = navigation_path[nav_path_index - 1];
|
||||||
@ -577,7 +577,7 @@ void NavigationAgent2D::update_navigation() {
|
|||||||
// Check if we can advance the navigation path
|
// Check if we can advance the navigation path
|
||||||
if (navigation_finished == false) {
|
if (navigation_finished == false) {
|
||||||
// Advances to the next far away position.
|
// Advances to the next far away position.
|
||||||
const PoolVector<Vector2> &navigation_path = navigation_result->get_path();
|
const Vector<Vector2> &navigation_path = navigation_result->get_path();
|
||||||
while (origin.distance_to(navigation_path[nav_path_index]) < path_desired_distance) {
|
while (origin.distance_to(navigation_path[nav_path_index]) < path_desired_distance) {
|
||||||
nav_path_index += 1;
|
nav_path_index += 1;
|
||||||
if (nav_path_index == navigation_path.size()) {
|
if (nav_path_index == navigation_path.size()) {
|
||||||
@ -682,7 +682,7 @@ void NavigationAgent2D::_update_debug_path() {
|
|||||||
RenderingServer::get_singleton()->canvas_item_set_parent(debug_path_instance, agent_parent->get_canvas());
|
RenderingServer::get_singleton()->canvas_item_set_parent(debug_path_instance, agent_parent->get_canvas());
|
||||||
RenderingServer::get_singleton()->canvas_item_set_visible(debug_path_instance, agent_parent->is_visible_in_tree());
|
RenderingServer::get_singleton()->canvas_item_set_visible(debug_path_instance, agent_parent->is_visible_in_tree());
|
||||||
|
|
||||||
const PoolVector<Vector2> &navigation_path = navigation_result->get_path();
|
const Vector<Vector2> &navigation_path = navigation_result->get_path();
|
||||||
|
|
||||||
if (navigation_path.size() <= 1) {
|
if (navigation_path.size() <= 1) {
|
||||||
return;
|
return;
|
||||||
@ -697,8 +697,7 @@ void NavigationAgent2D::_update_debug_path() {
|
|||||||
debug_path_colors.resize(navigation_path.size());
|
debug_path_colors.resize(navigation_path.size());
|
||||||
debug_path_colors.fill(debug_path_color);
|
debug_path_colors.fill(debug_path_color);
|
||||||
|
|
||||||
//TODO
|
RenderingServer::get_singleton()->canvas_item_add_polyline(debug_path_instance, navigation_path, debug_path_colors, debug_path_custom_line_width, false);
|
||||||
//RenderingServer::get_singleton()->canvas_item_add_polyline(debug_path_instance, navigation_path, debug_path_colors, debug_path_custom_line_width, false);
|
|
||||||
|
|
||||||
float point_size = Navigation2DServer::get_singleton()->get_debug_navigation_agent_path_point_size();
|
float point_size = Navigation2DServer::get_singleton()->get_debug_navigation_agent_path_point_size();
|
||||||
float half_point_size = point_size * 0.5;
|
float half_point_size = point_size * 0.5;
|
||||||
|
@ -164,7 +164,7 @@ public:
|
|||||||
|
|
||||||
Vector2 get_next_position();
|
Vector2 get_next_position();
|
||||||
|
|
||||||
const PoolVector<Vector2> &get_nav_path() const;
|
const Vector<Vector2> &get_nav_path() const;
|
||||||
|
|
||||||
int get_nav_path_index() const {
|
int get_nav_path_index() const {
|
||||||
return nav_path_index;
|
return nav_path_index;
|
||||||
|
@ -457,7 +457,7 @@ Vector3 NavigationAgent::get_target_position() const {
|
|||||||
Vector3 NavigationAgent::get_next_position() {
|
Vector3 NavigationAgent::get_next_position() {
|
||||||
update_navigation();
|
update_navigation();
|
||||||
|
|
||||||
const PoolVector<Vector3> &navigation_path = navigation_result->get_path();
|
const Vector<Vector3> &navigation_path = navigation_result->get_path();
|
||||||
if (navigation_path.size() == 0) {
|
if (navigation_path.size() == 0) {
|
||||||
ERR_FAIL_COND_V_MSG(agent_parent == nullptr, Vector3(), "The agent has no parent.");
|
ERR_FAIL_COND_V_MSG(agent_parent == nullptr, Vector3(), "The agent has no parent.");
|
||||||
return agent_parent->get_global_transform().origin;
|
return agent_parent->get_global_transform().origin;
|
||||||
@ -466,7 +466,7 @@ Vector3 NavigationAgent::get_next_position() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const PoolVector<Vector3> &NavigationAgent::get_nav_path() const {
|
const Vector<Vector3> &NavigationAgent::get_nav_path() const {
|
||||||
return navigation_result->get_path();
|
return navigation_result->get_path();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -491,7 +491,7 @@ bool NavigationAgent::is_navigation_finished() {
|
|||||||
Vector3 NavigationAgent::get_final_position() {
|
Vector3 NavigationAgent::get_final_position() {
|
||||||
update_navigation();
|
update_navigation();
|
||||||
|
|
||||||
const PoolVector<Vector3> &navigation_path = navigation_result->get_path();
|
const Vector<Vector3> &navigation_path = navigation_result->get_path();
|
||||||
|
|
||||||
if (navigation_path.size() == 0) {
|
if (navigation_path.size() == 0) {
|
||||||
return Vector3();
|
return Vector3();
|
||||||
@ -553,7 +553,7 @@ void NavigationAgent::update_navigation() {
|
|||||||
} else {
|
} else {
|
||||||
// Check if too far from the navigation path
|
// Check if too far from the navigation path
|
||||||
if (nav_path_index > 0) {
|
if (nav_path_index > 0) {
|
||||||
const PoolVector<Vector3> &navigation_path = navigation_result->get_path();
|
const Vector<Vector3> &navigation_path = navigation_result->get_path();
|
||||||
|
|
||||||
Vector3 segment[2];
|
Vector3 segment[2];
|
||||||
segment[0] = navigation_path[nav_path_index - 1];
|
segment[0] = navigation_path[nav_path_index - 1];
|
||||||
@ -601,7 +601,7 @@ void NavigationAgent::update_navigation() {
|
|||||||
// Check if we can advance the navigation path
|
// Check if we can advance the navigation path
|
||||||
if (navigation_finished == false) {
|
if (navigation_finished == false) {
|
||||||
// Advances to the next far away position.
|
// Advances to the next far away position.
|
||||||
const PoolVector<Vector3> &navigation_path = navigation_result->get_path();
|
const Vector<Vector3> &navigation_path = navigation_result->get_path();
|
||||||
while (origin.distance_to(navigation_path[nav_path_index] - Vector3(0, navigation_height_offset, 0)) < path_desired_distance) {
|
while (origin.distance_to(navigation_path[nav_path_index] - Vector3(0, navigation_height_offset, 0)) < path_desired_distance) {
|
||||||
nav_path_index += 1;
|
nav_path_index += 1;
|
||||||
if (nav_path_index == navigation_path.size()) {
|
if (nav_path_index == navigation_path.size()) {
|
||||||
@ -698,7 +698,7 @@ void NavigationAgent::_update_debug_path() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PoolVector<Vector3> &navigation_path = navigation_result->get_path();
|
const Vector<Vector3> &navigation_path = navigation_result->get_path();
|
||||||
|
|
||||||
if (navigation_path.size() <= 1) {
|
if (navigation_path.size() <= 1) {
|
||||||
return;
|
return;
|
||||||
|
@ -180,7 +180,7 @@ public:
|
|||||||
|
|
||||||
Vector3 get_next_position();
|
Vector3 get_next_position();
|
||||||
|
|
||||||
const PoolVector<Vector3> &get_nav_path() const;
|
const Vector<Vector3> &get_nav_path() const;
|
||||||
|
|
||||||
int get_nav_path_index() const {
|
int get_nav_path_index() const {
|
||||||
return nav_path_index;
|
return nav_path_index;
|
||||||
|
@ -30,19 +30,19 @@
|
|||||||
|
|
||||||
#include "navigation_path_query_result_2d.h"
|
#include "navigation_path_query_result_2d.h"
|
||||||
|
|
||||||
void NavigationPathQueryResult2D::set_path(const PoolVector<Vector2> &p_path) {
|
void NavigationPathQueryResult2D::set_path(const Vector<Vector2> &p_path) {
|
||||||
path = p_path;
|
path = p_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PoolVector<Vector2> &NavigationPathQueryResult2D::get_path() const {
|
const Vector<Vector2> &NavigationPathQueryResult2D::get_path() const {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigationPathQueryResult2D::set_path_types(const PoolVector<int32_t> &p_path_types) {
|
void NavigationPathQueryResult2D::set_path_types(const Vector<int32_t> &p_path_types) {
|
||||||
path_types = p_path_types;
|
path_types = p_path_types;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PoolVector<int32_t> &NavigationPathQueryResult2D::get_path_types() const {
|
const Vector<int32_t> &NavigationPathQueryResult2D::get_path_types() const {
|
||||||
return path_types;
|
return path_types;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,11 +54,11 @@ Array NavigationPathQueryResult2D::get_path_rids() const {
|
|||||||
return path_rids;
|
return path_rids;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigationPathQueryResult2D::set_path_owner_ids(const PoolVector<int> &p_path_owner_ids) {
|
void NavigationPathQueryResult2D::set_path_owner_ids(const Vector<int> &p_path_owner_ids) {
|
||||||
path_owner_ids = p_path_owner_ids;
|
path_owner_ids = p_path_owner_ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PoolVector<int> &NavigationPathQueryResult2D::get_path_owner_ids() const {
|
const Vector<int> &NavigationPathQueryResult2D::get_path_owner_ids() const {
|
||||||
return path_owner_ids;
|
return path_owner_ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,10 +37,10 @@
|
|||||||
class NavigationPathQueryResult2D : public Reference {
|
class NavigationPathQueryResult2D : public Reference {
|
||||||
GDCLASS(NavigationPathQueryResult2D, Reference);
|
GDCLASS(NavigationPathQueryResult2D, Reference);
|
||||||
|
|
||||||
PoolVector<Vector2> path;
|
Vector<Vector2> path;
|
||||||
PoolVector<int> path_types;
|
Vector<int> path_types;
|
||||||
Array path_rids;
|
Array path_rids;
|
||||||
PoolVector<int> path_owner_ids;
|
Vector<int> path_owner_ids;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
@ -51,17 +51,17 @@ public:
|
|||||||
PATH_SEGMENT_TYPE_LINK = 1,
|
PATH_SEGMENT_TYPE_LINK = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
void set_path(const PoolVector<Vector2> &p_path);
|
void set_path(const Vector<Vector2> &p_path);
|
||||||
const PoolVector<Vector2> &get_path() const;
|
const Vector<Vector2> &get_path() const;
|
||||||
|
|
||||||
void set_path_types(const PoolVector<int> &p_path_types);
|
void set_path_types(const Vector<int> &p_path_types);
|
||||||
const PoolVector<int> &get_path_types() const;
|
const Vector<int> &get_path_types() const;
|
||||||
|
|
||||||
void set_path_rids(const Array &p_path_rids);
|
void set_path_rids(const Array &p_path_rids);
|
||||||
Array get_path_rids() const;
|
Array get_path_rids() const;
|
||||||
|
|
||||||
void set_path_owner_ids(const PoolVector<int> &p_path_owner_ids);
|
void set_path_owner_ids(const Vector<int> &p_path_owner_ids);
|
||||||
const PoolVector<int> &get_path_owner_ids() const;
|
const Vector<int> &get_path_owner_ids() const;
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
};
|
};
|
||||||
|
@ -30,19 +30,19 @@
|
|||||||
|
|
||||||
#include "navigation_path_query_result_3d.h"
|
#include "navigation_path_query_result_3d.h"
|
||||||
|
|
||||||
void NavigationPathQueryResult3D::set_path(const PoolVector<Vector3> &p_path) {
|
void NavigationPathQueryResult3D::set_path(const Vector<Vector3> &p_path) {
|
||||||
path = p_path;
|
path = p_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PoolVector<Vector3> &NavigationPathQueryResult3D::get_path() const {
|
const Vector<Vector3> &NavigationPathQueryResult3D::get_path() const {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigationPathQueryResult3D::set_path_types(const PoolVector<int> &p_path_types) {
|
void NavigationPathQueryResult3D::set_path_types(const Vector<int> &p_path_types) {
|
||||||
path_types = p_path_types;
|
path_types = p_path_types;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PoolVector<int> &NavigationPathQueryResult3D::get_path_types() const {
|
const Vector<int> &NavigationPathQueryResult3D::get_path_types() const {
|
||||||
return path_types;
|
return path_types;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,11 +54,11 @@ Array NavigationPathQueryResult3D::get_path_rids() const {
|
|||||||
return path_rids;
|
return path_rids;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigationPathQueryResult3D::set_path_owner_ids(const PoolVector<int> &p_path_owner_ids) {
|
void NavigationPathQueryResult3D::set_path_owner_ids(const Vector<int> &p_path_owner_ids) {
|
||||||
path_owner_ids = p_path_owner_ids;
|
path_owner_ids = p_path_owner_ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PoolVector<int> &NavigationPathQueryResult3D::get_path_owner_ids() const {
|
const Vector<int> &NavigationPathQueryResult3D::get_path_owner_ids() const {
|
||||||
return path_owner_ids;
|
return path_owner_ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,10 +38,10 @@
|
|||||||
class NavigationPathQueryResult3D : public Reference {
|
class NavigationPathQueryResult3D : public Reference {
|
||||||
GDCLASS(NavigationPathQueryResult3D, Reference);
|
GDCLASS(NavigationPathQueryResult3D, Reference);
|
||||||
|
|
||||||
PoolVector<Vector3> path;
|
Vector<Vector3> path;
|
||||||
PoolVector<int> path_types;
|
Vector<int> path_types;
|
||||||
Array path_rids;
|
Array path_rids;
|
||||||
PoolVector<int> path_owner_ids;
|
Vector<int> path_owner_ids;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
@ -52,17 +52,17 @@ public:
|
|||||||
PATH_SEGMENT_TYPE_LINK = 1,
|
PATH_SEGMENT_TYPE_LINK = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
void set_path(const PoolVector<Vector3> &p_path);
|
void set_path(const Vector<Vector3> &p_path);
|
||||||
const PoolVector<Vector3> &get_path() const;
|
const Vector<Vector3> &get_path() const;
|
||||||
|
|
||||||
void set_path_types(const PoolVector<int> &p_path_types);
|
void set_path_types(const Vector<int> &p_path_types);
|
||||||
const PoolVector<int> &get_path_types() const;
|
const Vector<int> &get_path_types() const;
|
||||||
|
|
||||||
void set_path_rids(const Array &p_path_rids);
|
void set_path_rids(const Array &p_path_rids);
|
||||||
Array get_path_rids() const;
|
Array get_path_rids() const;
|
||||||
|
|
||||||
void set_path_owner_ids(const PoolVector<int> &p_path_owner_ids);
|
void set_path_owner_ids(const Vector<int> &p_path_owner_ids);
|
||||||
const PoolVector<int> &get_path_owner_ids() const;
|
const Vector<int> &get_path_owner_ids() const;
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
};
|
};
|
||||||
|
@ -32,9 +32,9 @@
|
|||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
||||||
|
#include "core/containers/rid.h"
|
||||||
#include "core/math/vector3.h"
|
#include "core/math/vector3.h"
|
||||||
#include "core/variant/array.h"
|
#include "core/variant/array.h"
|
||||||
#include "core/containers/rid.h"
|
|
||||||
#include "core/variant/variant.h"
|
#include "core/variant/variant.h"
|
||||||
|
|
||||||
namespace NavigationUtilities {
|
namespace NavigationUtilities {
|
||||||
@ -82,17 +82,17 @@ struct PathQueryParameters2D {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct PathQueryResult {
|
struct PathQueryResult {
|
||||||
PoolVector3Array path;
|
Vector<Vector3> path;
|
||||||
PoolIntArray path_types;
|
Vector<int> path_types;
|
||||||
Array path_rids;
|
Array path_rids;
|
||||||
PoolIntArray path_owner_ids;
|
Vector<int> path_owner_ids;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PathQueryResult2D {
|
struct PathQueryResult2D {
|
||||||
PoolVector2Array path;
|
Vector<Vector2> path;
|
||||||
PoolIntArray path_types;
|
Vector<int> path_types;
|
||||||
Array path_rids;
|
Array path_rids;
|
||||||
PoolIntArray path_owner_ids;
|
Vector<int> path_owner_ids;
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace NavigationUtilities
|
} //namespace NavigationUtilities
|
||||||
|
Loading…
Reference in New Issue
Block a user