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.traits;
17 import godot.core;
18 import godot.c;
19 import godot.d.bind;
20 import godot.d.reference;
21 import godot.globalenums;
22 import godot.object;
23 import godot.classdb;
24 import godot.shape2d;
25 /**
26 Concave polygon 2D shape resource for physics.
27 
28 It is made out of segments and is optimal for complex polygonal concave collisions. However, it is 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.
29 The main difference between a $(D ConvexPolygonShape2D) and a $(D 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.
30 */
31 @GodotBaseClass struct ConcavePolygonShape2D
32 {
33 	package(godot) enum string _GODOT_internal_name = "ConcavePolygonShape2D";
34 public:
35 @nogc nothrow:
36 	union { /** */ godot_object _godot_object; /** */ Shape2D _GODOT_base; }
37 	alias _GODOT_base this;
38 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
39 	package(godot) __gshared bool _classBindingInitialized = false;
40 	package(godot) static struct GDNativeClassBinding
41 	{
42 		__gshared:
43 		@GodotName("get_segments") GodotMethod!(PoolVector2Array) getSegments;
44 		@GodotName("set_segments") GodotMethod!(void, PoolVector2Array) setSegments;
45 	}
46 	/// 
47 	pragma(inline, true) bool opEquals(in ConcavePolygonShape2D other) const
48 	{ return _godot_object.ptr is other._godot_object.ptr; }
49 	/// 
50 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
51 	{ _godot_object.ptr = n; return null; }
52 	/// 
53 	pragma(inline, true) bool opEquals(typeof(null) n) const
54 	{ return _godot_object.ptr is n; }
55 	/// 
56 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
57 	mixin baseCasts;
58 	/// Construct a new instance of ConcavePolygonShape2D.
59 	/// Note: use `memnew!ConcavePolygonShape2D` instead.
60 	static ConcavePolygonShape2D _new()
61 	{
62 		static godot_class_constructor constructor;
63 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("ConcavePolygonShape2D");
64 		if(constructor is null) return typeof(this).init;
65 		return cast(ConcavePolygonShape2D)(constructor());
66 	}
67 	@disable new(size_t s);
68 	/**
69 	
70 	*/
71 	PoolVector2Array getSegments() const
72 	{
73 		checkClassBinding!(typeof(this))();
74 		return ptrcall!(PoolVector2Array)(GDNativeClassBinding.getSegments, _godot_object);
75 	}
76 	/**
77 	
78 	*/
79 	void setSegments(in PoolVector2Array segments)
80 	{
81 		checkClassBinding!(typeof(this))();
82 		ptrcall!(void)(GDNativeClassBinding.setSegments, _godot_object, segments);
83 	}
84 	/**
85 	The array of points that make up the $(D ConcavePolygonShape2D)'s line segments.
86 	*/
87 	@property PoolVector2Array segments()
88 	{
89 		return getSegments();
90 	}
91 	/// ditto
92 	@property void segments(PoolVector2Array v)
93 	{
94 		setSegments(v);
95 	}
96 }