mirror of
https://github.com/godotengine/godot
synced 2024-10-03 03:21:39 +00:00
Merge pull request #93485 from smix8/leftover_from_hangover
Remove unused navigation polygon properties
This commit is contained in:
commit
d7855a00b0
|
@ -1127,13 +1127,6 @@ void NavMap::sync() {
|
||||||
new_polygon.points.push_back({ closest_end_point, get_point_key(closest_end_point) });
|
new_polygon.points.push_back({ closest_end_point, get_point_key(closest_end_point) });
|
||||||
new_polygon.points.push_back({ closest_end_point, get_point_key(closest_end_point) });
|
new_polygon.points.push_back({ closest_end_point, get_point_key(closest_end_point) });
|
||||||
|
|
||||||
Vector3 center;
|
|
||||||
for (int p = 0; p < 4; ++p) {
|
|
||||||
center += new_polygon.points[p].pos;
|
|
||||||
}
|
|
||||||
new_polygon.center = center / real_t(new_polygon.points.size());
|
|
||||||
new_polygon.clockwise = true;
|
|
||||||
|
|
||||||
// Setup connections to go forward in the link.
|
// Setup connections to go forward in the link.
|
||||||
{
|
{
|
||||||
gd::Edge::Connection entry_connection;
|
gd::Edge::Connection entry_connection;
|
||||||
|
|
|
@ -277,9 +277,6 @@ void NavRegion::update_polygons() {
|
||||||
polygon.surface_area = _new_polygon_surface_area;
|
polygon.surface_area = _new_polygon_surface_area;
|
||||||
_new_region_surface_area += _new_polygon_surface_area;
|
_new_region_surface_area += _new_polygon_surface_area;
|
||||||
|
|
||||||
Vector3 polygon_center;
|
|
||||||
real_t sum(0);
|
|
||||||
|
|
||||||
for (int j(0); j < navigation_mesh_polygon_size; j++) {
|
for (int j(0); j < navigation_mesh_polygon_size; j++) {
|
||||||
int idx = indices[j];
|
int idx = indices[j];
|
||||||
if (idx < 0 || idx >= len) {
|
if (idx < 0 || idx >= len) {
|
||||||
|
@ -290,25 +287,11 @@ void NavRegion::update_polygons() {
|
||||||
Vector3 point_position = transform.xform(vertices_r[idx]);
|
Vector3 point_position = transform.xform(vertices_r[idx]);
|
||||||
polygon.points[j].pos = point_position;
|
polygon.points[j].pos = point_position;
|
||||||
polygon.points[j].key = map->get_point_key(point_position);
|
polygon.points[j].key = map->get_point_key(point_position);
|
||||||
|
|
||||||
polygon_center += point_position; // Composing the center of the polygon
|
|
||||||
|
|
||||||
if (j >= 2) {
|
|
||||||
Vector3 epa = transform.xform(vertices_r[indices[j - 2]]);
|
|
||||||
Vector3 epb = transform.xform(vertices_r[indices[j - 1]]);
|
|
||||||
|
|
||||||
sum += map->get_up().dot((epb - epa).cross(point_position - epa));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
ERR_BREAK_MSG(!valid, "The navigation mesh set in this region is not valid!");
|
ERR_BREAK_MSG(!valid, "The navigation mesh set in this region is not valid!");
|
||||||
}
|
}
|
||||||
|
|
||||||
polygon.clockwise = sum > 0;
|
|
||||||
if (!navigation_mesh_polygon.is_empty()) {
|
|
||||||
polygon.center = polygon_center / real_t(navigation_mesh_polygon.size());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
surface_area = _new_region_surface_area;
|
surface_area = _new_region_surface_area;
|
||||||
|
|
|
@ -104,15 +104,9 @@ struct Polygon {
|
||||||
/// The points of this `Polygon`
|
/// The points of this `Polygon`
|
||||||
LocalVector<Point> points;
|
LocalVector<Point> points;
|
||||||
|
|
||||||
/// Are the points clockwise?
|
|
||||||
bool clockwise;
|
|
||||||
|
|
||||||
/// The edges of this `Polygon`
|
/// The edges of this `Polygon`
|
||||||
LocalVector<Edge> edges;
|
LocalVector<Edge> edges;
|
||||||
|
|
||||||
/// The center of this `Polygon`
|
|
||||||
Vector3 center;
|
|
||||||
|
|
||||||
real_t surface_area = 0.0;
|
real_t surface_area = 0.0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue