summaryrefslogtreecommitdiff
path: root/scene/2d/navigation_polygon.h
diff options
context:
space:
mode:
Diffstat (limited to 'scene/2d/navigation_polygon.h')
-rw-r--r--scene/2d/navigation_polygon.h33
1 files changed, 21 insertions, 12 deletions
diff --git a/scene/2d/navigation_polygon.h b/scene/2d/navigation_polygon.h
index cbc1711a32..579d6b0e0e 100644
--- a/scene/2d/navigation_polygon.h
+++ b/scene/2d/navigation_polygon.h
@@ -32,21 +32,26 @@
#define NAVIGATION_POLYGON_H
#include "scene/2d/node_2d.h"
+#include "scene/resources/navigation_mesh.h"
class NavigationPolygon : public Resource {
GDCLASS(NavigationPolygon, Resource);
- PoolVector<Vector2> vertices;
+ Vector<Vector2> vertices;
struct Polygon {
Vector<int> indices;
};
Vector<Polygon> polygons;
- Vector<PoolVector<Vector2> > outlines;
+ Vector<Vector<Vector2> > outlines;
mutable Rect2 item_rect;
mutable bool rect_cache_dirty;
+ Mutex navmesh_generation;
+ // Navigation mesh
+ Ref<NavigationMesh> navmesh;
+
protected:
static void _bind_methods();
@@ -62,16 +67,16 @@ public:
bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const;
#endif
- void set_vertices(const PoolVector<Vector2> &p_vertices);
- PoolVector<Vector2> get_vertices() const;
+ void set_vertices(const Vector<Vector2> &p_vertices);
+ Vector<Vector2> get_vertices() const;
void add_polygon(const Vector<int> &p_polygon);
int get_polygon_count() const;
- void add_outline(const PoolVector<Vector2> &p_outline);
- void add_outline_at_index(const PoolVector<Vector2> &p_outline, int p_index);
- void set_outline(int p_idx, const PoolVector<Vector2> &p_outline);
- PoolVector<Vector2> get_outline(int p_idx) const;
+ void add_outline(const Vector<Vector2> &p_outline);
+ void add_outline_at_index(const Vector<Vector2> &p_outline, int p_index);
+ void set_outline(int p_idx, const Vector<Vector2> &p_outline);
+ Vector<Vector2> get_outline(int p_idx) const;
void remove_outline(int p_idx);
int get_outline_count() const;
@@ -81,17 +86,20 @@ public:
Vector<int> get_polygon(int p_idx);
void clear_polygons();
+ Ref<NavigationMesh> get_mesh();
+
NavigationPolygon();
+ ~NavigationPolygon();
};
class Navigation2D;
-class NavigationPolygonInstance : public Node2D {
+class NavigationRegion2D : public Node2D {
- GDCLASS(NavigationPolygonInstance, Node2D);
+ GDCLASS(NavigationRegion2D, Node2D);
bool enabled;
- int nav_id;
+ RID region;
Navigation2D *navigation;
Ref<NavigationPolygon> navpoly;
@@ -115,7 +123,8 @@ public:
String get_configuration_warning() const;
- NavigationPolygonInstance();
+ NavigationRegion2D();
+ ~NavigationRegion2D();
};
#endif // NAVIGATIONPOLYGON_H