mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-24 04:46:48 +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::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_rids = res.path_rids;
|
||||
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());
|
||||
|
||||
PoolVector3Array::Write w = r_query_result.path.write();
|
||||
Vector3 *wptr = w.ptr();
|
||||
Vector3 *wptr = r_query_result.path.ptrw();
|
||||
const Vector3 *pptr = path.ptr();
|
||||
|
||||
for (int i = 0; i < path.size(); ++i) {
|
||||
|
@ -440,7 +440,7 @@ Vector2 NavigationAgent2D::get_target_position() const {
|
||||
Vector2 NavigationAgent2D::get_next_position() {
|
||||
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) {
|
||||
ERR_FAIL_COND_V(agent_parent == nullptr, Vector2());
|
||||
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();
|
||||
}
|
||||
|
||||
@ -474,7 +474,7 @@ bool NavigationAgent2D::is_navigation_finished() {
|
||||
Vector2 NavigationAgent2D::get_final_position() {
|
||||
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) {
|
||||
return Vector2();
|
||||
}
|
||||
@ -533,7 +533,7 @@ void NavigationAgent2D::update_navigation() {
|
||||
} else {
|
||||
// Check if too far from the navigation path
|
||||
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];
|
||||
segment[0] = navigation_path[nav_path_index - 1];
|
||||
@ -577,7 +577,7 @@ void NavigationAgent2D::update_navigation() {
|
||||
// Check if we can advance the navigation path
|
||||
if (navigation_finished == false) {
|
||||
// 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) {
|
||||
nav_path_index += 1;
|
||||
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_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) {
|
||||
return;
|
||||
@ -697,8 +697,7 @@ void NavigationAgent2D::_update_debug_path() {
|
||||
debug_path_colors.resize(navigation_path.size());
|
||||
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 half_point_size = point_size * 0.5;
|
||||
|
@ -164,7 +164,7 @@ public:
|
||||
|
||||
Vector2 get_next_position();
|
||||
|
||||
const PoolVector<Vector2> &get_nav_path() const;
|
||||
const Vector<Vector2> &get_nav_path() const;
|
||||
|
||||
int get_nav_path_index() const {
|
||||
return nav_path_index;
|
||||
|
@ -457,7 +457,7 @@ Vector3 NavigationAgent::get_target_position() const {
|
||||
Vector3 NavigationAgent::get_next_position() {
|
||||
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) {
|
||||
ERR_FAIL_COND_V_MSG(agent_parent == nullptr, Vector3(), "The agent has no parent.");
|
||||
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();
|
||||
}
|
||||
|
||||
@ -491,7 +491,7 @@ bool NavigationAgent::is_navigation_finished() {
|
||||
Vector3 NavigationAgent::get_final_position() {
|
||||
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) {
|
||||
return Vector3();
|
||||
@ -553,7 +553,7 @@ void NavigationAgent::update_navigation() {
|
||||
} else {
|
||||
// Check if too far from the navigation path
|
||||
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];
|
||||
segment[0] = navigation_path[nav_path_index - 1];
|
||||
@ -601,7 +601,7 @@ void NavigationAgent::update_navigation() {
|
||||
// Check if we can advance the navigation path
|
||||
if (navigation_finished == false) {
|
||||
// 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) {
|
||||
nav_path_index += 1;
|
||||
if (nav_path_index == navigation_path.size()) {
|
||||
@ -698,7 +698,7 @@ void NavigationAgent::_update_debug_path() {
|
||||
return;
|
||||
}
|
||||
|
||||
const PoolVector<Vector3> &navigation_path = navigation_result->get_path();
|
||||
const Vector<Vector3> &navigation_path = navigation_result->get_path();
|
||||
|
||||
if (navigation_path.size() <= 1) {
|
||||
return;
|
||||
|
@ -180,7 +180,7 @@ public:
|
||||
|
||||
Vector3 get_next_position();
|
||||
|
||||
const PoolVector<Vector3> &get_nav_path() const;
|
||||
const Vector<Vector3> &get_nav_path() const;
|
||||
|
||||
int get_nav_path_index() const {
|
||||
return nav_path_index;
|
||||
|
@ -30,19 +30,19 @@
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
const PoolVector<Vector2> &NavigationPathQueryResult2D::get_path() const {
|
||||
const Vector<Vector2> &NavigationPathQueryResult2D::get_path() const {
|
||||
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;
|
||||
}
|
||||
|
||||
const PoolVector<int32_t> &NavigationPathQueryResult2D::get_path_types() const {
|
||||
const Vector<int32_t> &NavigationPathQueryResult2D::get_path_types() const {
|
||||
return path_types;
|
||||
}
|
||||
|
||||
@ -54,11 +54,11 @@ Array NavigationPathQueryResult2D::get_path_rids() const {
|
||||
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;
|
||||
}
|
||||
|
||||
const PoolVector<int> &NavigationPathQueryResult2D::get_path_owner_ids() const {
|
||||
const Vector<int> &NavigationPathQueryResult2D::get_path_owner_ids() const {
|
||||
return path_owner_ids;
|
||||
}
|
||||
|
||||
|
@ -37,10 +37,10 @@
|
||||
class NavigationPathQueryResult2D : public Reference {
|
||||
GDCLASS(NavigationPathQueryResult2D, Reference);
|
||||
|
||||
PoolVector<Vector2> path;
|
||||
PoolVector<int> path_types;
|
||||
Vector<Vector2> path;
|
||||
Vector<int> path_types;
|
||||
Array path_rids;
|
||||
PoolVector<int> path_owner_ids;
|
||||
Vector<int> path_owner_ids;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
@ -51,17 +51,17 @@ public:
|
||||
PATH_SEGMENT_TYPE_LINK = 1,
|
||||
};
|
||||
|
||||
void set_path(const PoolVector<Vector2> &p_path);
|
||||
const PoolVector<Vector2> &get_path() const;
|
||||
void set_path(const Vector<Vector2> &p_path);
|
||||
const Vector<Vector2> &get_path() const;
|
||||
|
||||
void set_path_types(const PoolVector<int> &p_path_types);
|
||||
const PoolVector<int> &get_path_types() const;
|
||||
void set_path_types(const Vector<int> &p_path_types);
|
||||
const Vector<int> &get_path_types() const;
|
||||
|
||||
void set_path_rids(const Array &p_path_rids);
|
||||
Array get_path_rids() const;
|
||||
|
||||
void set_path_owner_ids(const PoolVector<int> &p_path_owner_ids);
|
||||
const PoolVector<int> &get_path_owner_ids() const;
|
||||
void set_path_owner_ids(const Vector<int> &p_path_owner_ids);
|
||||
const Vector<int> &get_path_owner_ids() const;
|
||||
|
||||
void reset();
|
||||
};
|
||||
|
@ -30,19 +30,19 @@
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
const PoolVector<Vector3> &NavigationPathQueryResult3D::get_path() const {
|
||||
const Vector<Vector3> &NavigationPathQueryResult3D::get_path() const {
|
||||
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;
|
||||
}
|
||||
|
||||
const PoolVector<int> &NavigationPathQueryResult3D::get_path_types() const {
|
||||
const Vector<int> &NavigationPathQueryResult3D::get_path_types() const {
|
||||
return path_types;
|
||||
}
|
||||
|
||||
@ -54,11 +54,11 @@ Array NavigationPathQueryResult3D::get_path_rids() const {
|
||||
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;
|
||||
}
|
||||
|
||||
const PoolVector<int> &NavigationPathQueryResult3D::get_path_owner_ids() const {
|
||||
const Vector<int> &NavigationPathQueryResult3D::get_path_owner_ids() const {
|
||||
return path_owner_ids;
|
||||
}
|
||||
|
||||
|
@ -38,10 +38,10 @@
|
||||
class NavigationPathQueryResult3D : public Reference {
|
||||
GDCLASS(NavigationPathQueryResult3D, Reference);
|
||||
|
||||
PoolVector<Vector3> path;
|
||||
PoolVector<int> path_types;
|
||||
Vector<Vector3> path;
|
||||
Vector<int> path_types;
|
||||
Array path_rids;
|
||||
PoolVector<int> path_owner_ids;
|
||||
Vector<int> path_owner_ids;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
@ -52,17 +52,17 @@ public:
|
||||
PATH_SEGMENT_TYPE_LINK = 1,
|
||||
};
|
||||
|
||||
void set_path(const PoolVector<Vector3> &p_path);
|
||||
const PoolVector<Vector3> &get_path() const;
|
||||
void set_path(const Vector<Vector3> &p_path);
|
||||
const Vector<Vector3> &get_path() const;
|
||||
|
||||
void set_path_types(const PoolVector<int> &p_path_types);
|
||||
const PoolVector<int> &get_path_types() const;
|
||||
void set_path_types(const Vector<int> &p_path_types);
|
||||
const Vector<int> &get_path_types() const;
|
||||
|
||||
void set_path_rids(const Array &p_path_rids);
|
||||
Array get_path_rids() const;
|
||||
|
||||
void set_path_owner_ids(const PoolVector<int> &p_path_owner_ids);
|
||||
const PoolVector<int> &get_path_owner_ids() const;
|
||||
void set_path_owner_ids(const Vector<int> &p_path_owner_ids);
|
||||
const Vector<int> &get_path_owner_ids() const;
|
||||
|
||||
void reset();
|
||||
};
|
||||
|
@ -32,9 +32,9 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "core/containers/rid.h"
|
||||
#include "core/math/vector3.h"
|
||||
#include "core/variant/array.h"
|
||||
#include "core/containers/rid.h"
|
||||
#include "core/variant/variant.h"
|
||||
|
||||
namespace NavigationUtilities {
|
||||
@ -82,17 +82,17 @@ struct PathQueryParameters2D {
|
||||
};
|
||||
|
||||
struct PathQueryResult {
|
||||
PoolVector3Array path;
|
||||
PoolIntArray path_types;
|
||||
Vector<Vector3> path;
|
||||
Vector<int> path_types;
|
||||
Array path_rids;
|
||||
PoolIntArray path_owner_ids;
|
||||
Vector<int> path_owner_ids;
|
||||
};
|
||||
|
||||
struct PathQueryResult2D {
|
||||
PoolVector2Array path;
|
||||
PoolIntArray path_types;
|
||||
Vector<Vector2> path;
|
||||
Vector<int> path_types;
|
||||
Array path_rids;
|
||||
PoolIntArray path_owner_ids;
|
||||
Vector<int> path_owner_ids;
|
||||
};
|
||||
|
||||
} //namespace NavigationUtilities
|
||||
|
Loading…
Reference in New Issue
Block a user