summaryrefslogtreecommitdiff
path: root/scene/resources/navigation_mesh.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources/navigation_mesh.cpp')
-rw-r--r--scene/resources/navigation_mesh.cpp20
1 files changed, 0 insertions, 20 deletions
diff --git a/scene/resources/navigation_mesh.cpp b/scene/resources/navigation_mesh.cpp
index e0aff2182e..f5d3c7a3fb 100644
--- a/scene/resources/navigation_mesh.cpp
+++ b/scene/resources/navigation_mesh.cpp
@@ -31,12 +31,10 @@
#include "navigation_mesh.h"
void NavigationMesh::create_from_mesh(const Ref<Mesh> &p_mesh) {
-
vertices = Vector<Vector3>();
clear_polygons();
for (int i = 0; i < p_mesh->get_surface_count(); i++) {
-
if (p_mesh->surface_get_primitive_type(i) != Mesh::PRIMITIVE_TRIANGLES)
continue;
Array arr = p_mesh->surface_get_arrays(i);
@@ -82,17 +80,14 @@ int NavigationMesh::get_parsed_geometry_type() const {
}
void NavigationMesh::set_collision_mask(uint32_t p_mask) {
-
collision_mask = p_mask;
}
uint32_t NavigationMesh::get_collision_mask() const {
-
return collision_mask;
}
void NavigationMesh::set_collision_mask_bit(int p_bit, bool p_value) {
-
uint32_t mask = get_collision_mask();
if (p_value)
mask |= 1 << p_bit;
@@ -102,7 +97,6 @@ void NavigationMesh::set_collision_mask_bit(int p_bit, bool p_value) {
}
bool NavigationMesh::get_collision_mask_bit(int p_bit) const {
-
return get_collision_mask() & (1 << p_bit);
}
@@ -253,18 +247,15 @@ bool NavigationMesh::get_filter_walkable_low_height_spans() const {
}
void NavigationMesh::set_vertices(const Vector<Vector3> &p_vertices) {
-
vertices = p_vertices;
_change_notify();
}
Vector<Vector3> NavigationMesh::get_vertices() const {
-
return vertices;
}
void NavigationMesh::_set_polygons(const Array &p_array) {
-
polygons.resize(p_array.size());
for (int i = 0; i < p_array.size(); i++) {
polygons.write[i].indices = p_array[i];
@@ -273,7 +264,6 @@ void NavigationMesh::_set_polygons(const Array &p_array) {
}
Array NavigationMesh::_get_polygons() const {
-
Array ret;
ret.resize(polygons.size());
for (int i = 0; i < ret.size(); i++) {
@@ -284,28 +274,23 @@ Array NavigationMesh::_get_polygons() const {
}
void NavigationMesh::add_polygon(const Vector<int> &p_polygon) {
-
Polygon polygon;
polygon.indices = p_polygon;
polygons.push_back(polygon);
_change_notify();
}
int NavigationMesh::get_polygon_count() const {
-
return polygons.size();
}
Vector<int> NavigationMesh::get_polygon(int p_idx) {
-
ERR_FAIL_INDEX_V(p_idx, polygons.size(), Vector<int>());
return polygons[p_idx].indices;
}
void NavigationMesh::clear_polygons() {
-
polygons.clear();
}
Ref<Mesh> NavigationMesh::get_debug_mesh() {
-
if (debug_mesh.is_valid())
return debug_mesh;
@@ -334,11 +319,9 @@ Ref<Mesh> NavigationMesh::get_debug_mesh() {
int tidx = 0;
for (List<Face3>::Element *E = faces.front(); E; E = E->next()) {
-
const Face3 &f = E->get();
for (int j = 0; j < 3; j++) {
-
tw[tidx++] = f.vertex[j];
_EdgeKey ek;
ek.from = f.vertex[j].snapped(Vector3(CMP_EPSILON, CMP_EPSILON, CMP_EPSILON));
@@ -349,11 +332,9 @@ Ref<Mesh> NavigationMesh::get_debug_mesh() {
Map<_EdgeKey, bool>::Element *F = edge_map.find(ek);
if (F) {
-
F->get() = false;
} else {
-
edge_map[ek] = true;
}
}
@@ -362,7 +343,6 @@ Ref<Mesh> NavigationMesh::get_debug_mesh() {
List<Vector3> lines;
for (Map<_EdgeKey, bool>::Element *E = edge_map.front(); E; E = E->next()) {
-
if (E->get()) {
lines.push_back(E->key().from);
lines.push_back(E->key().to);