1 /**
2 Concave polygon 2D shape resource for physics.
3 
4 Copyright:
5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.  
6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)  
7 Copyright (c) 2017-2018 Godot-D contributors  
8 
9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License)
10 
11 
12 */
13 module godot.concavepolygonshape2d;
14 import std.meta : AliasSeq, staticIndexOf;
15 import std.traits : Unqual;
16 import godot.d.meta;
17 import godot.core;
18 import godot.c;
19 import godot.d.bind;
20 import godot.d.reference;
21 import godot.object;
22 import godot.classdb;
23 import godot.shape2d;
24 import godot.resource;
25 import godot.reference;
26 /**
27 Concave polygon 2D shape resource for physics.
28 
29 It is made out of segments and is very optimal for complex polygonal concave collisions. It is really not advised to use for $(D RigidBody2D) nodes. A CollisionPolygon2D in convex decomposition mode (solids) or several convex objects are advised for that instead. Otherwise, a concave polygon 2D shape is better for static collisions.
30 The main difference between a $(D ConvexPolygonShape2D) and a `ConcavePolygonShape2D` is that a concave polygon assumes it is concave and uses a more complex method of collision detection, and a convex one forces itself to be convex in order to speed up collision detection.
31 */
32 @GodotBaseClass struct ConcavePolygonShape2D
33 {
34 	enum string _GODOT_internal_name = "ConcavePolygonShape2D";
35 public:
36 @nogc nothrow:
37 	union { godot_object _godot_object; Shape2D _GODOT_base; }
38 	alias _GODOT_base this;
39 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
40 	package(godot) __gshared bool _classBindingInitialized = false;
41 	package(godot) static struct _classBinding
42 	{
43 		__gshared:
44 		@GodotName("set_segments") GodotMethod!(void, PoolVector2Array) setSegments;
45 		@GodotName("get_segments") GodotMethod!(PoolVector2Array) getSegments;
46 	}
47 	bool opEquals(in ConcavePolygonShape2D other) const { return _godot_object.ptr is other._godot_object.ptr; }
48 	ConcavePolygonShape2D opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
49 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
50 	mixin baseCasts;
51 	static ConcavePolygonShape2D _new()
52 	{
53 		static godot_class_constructor constructor;
54 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("ConcavePolygonShape2D");
55 		if(constructor is null) return typeof(this).init;
56 		return cast(ConcavePolygonShape2D)(constructor());
57 	}
58 	@disable new(size_t s);
59 	/**
60 	
61 	*/
62 	void setSegments(in PoolVector2Array segments)
63 	{
64 		checkClassBinding!(typeof(this))();
65 		ptrcall!(void)(_classBinding.setSegments, _godot_object, segments);
66 	}
67 	/**
68 	
69 	*/
70 	PoolVector2Array getSegments() const
71 	{
72 		checkClassBinding!(typeof(this))();
73 		return ptrcall!(PoolVector2Array)(_classBinding.getSegments, _godot_object);
74 	}
75 	/**
76 	The array of points that make up the `ConcavePolygonShape2D`'s line segments.
77 	*/
78 	@property PoolVector2Array segments()
79 	{
80 		return getSegments();
81 	}
82 	/// ditto
83 	@property void segments(PoolVector2Array v)
84 	{
85 		setSegments(v);
86 	}
87 }