-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathpoly_shape_2d.h
48 lines (34 loc) · 1013 Bytes
/
poly_shape_2d.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once
#include "goost/core/math/geometry/2d/poly/poly_node_2d.h"
class PolyShape2D : public Node2D {
GDCLASS(PolyShape2D, Node2D);
public:
enum BuildMode {
BUILD_TRIANGLES,
BUILD_CONVEX,
BUILD_SEGMENTS,
};
private:
Vector<Vector<Point2>> _collect_outlines();
protected:
Vector<Vector<Point2>> shapes;
bool update_queued = false;
BuildMode build_mode = BUILD_TRIANGLES;
Rect2 rect = Rect2(-10, -10, 20, 20);
PolyNode2D *child = nullptr;
virtual Vector<Vector<Point2>> _build_shapes();
virtual void _apply_shapes(){};
void _update_shapes();
void _queue_update();
virtual void add_child_notify(Node *p_child);
virtual void remove_child_notify(Node *p_child);
void _notification(int p_what);
static void _bind_methods();
public:
void set_build_mode(BuildMode p_mode);
BuildMode get_build_mode() const { return build_mode; }
void update_shapes();
Array get_shapes_array();
virtual String get_configuration_warning() const;
};
VARIANT_ENUM_CAST(PolyShape2D::BuildMode);