1 /** 2 Editor-only class for defining a collision polygon in 3D space. 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.collisionpolygon; 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.spatial; 24 import godot.node; 25 /** 26 Editor-only class for defining a collision polygon in 3D space. 27 28 Allows editing a collision polygon's vertices on a selected plane. Can also set a depth perpendicular to that plane. This class is only available in the editor. It will not appear in the scene tree at runtime. Creates a $(D Shape) for gameplay. Properties modified during gameplay will have no effect. 29 */ 30 @GodotBaseClass struct CollisionPolygon 31 { 32 enum string _GODOT_internal_name = "CollisionPolygon"; 33 public: 34 @nogc nothrow: 35 union { godot_object _godot_object; Spatial _GODOT_base; } 36 alias _GODOT_base this; 37 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 38 package(godot) __gshared bool _classBindingInitialized = false; 39 package(godot) static struct _classBinding 40 { 41 __gshared: 42 @GodotName("set_depth") GodotMethod!(void, double) setDepth; 43 @GodotName("get_depth") GodotMethod!(double) getDepth; 44 @GodotName("set_polygon") GodotMethod!(void, PoolVector2Array) setPolygon; 45 @GodotName("get_polygon") GodotMethod!(PoolVector2Array) getPolygon; 46 @GodotName("set_disabled") GodotMethod!(void, bool) setDisabled; 47 @GodotName("is_disabled") GodotMethod!(bool) isDisabled; 48 @GodotName("_is_editable_3d_polygon") GodotMethod!(bool) _isEditable3dPolygon; 49 } 50 bool opEquals(in CollisionPolygon other) const { return _godot_object.ptr is other._godot_object.ptr; } 51 CollisionPolygon opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 52 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 53 mixin baseCasts; 54 static CollisionPolygon _new() 55 { 56 static godot_class_constructor constructor; 57 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("CollisionPolygon"); 58 if(constructor is null) return typeof(this).init; 59 return cast(CollisionPolygon)(constructor()); 60 } 61 @disable new(size_t s); 62 /** 63 64 */ 65 void setDepth(in double depth) 66 { 67 checkClassBinding!(typeof(this))(); 68 ptrcall!(void)(_classBinding.setDepth, _godot_object, depth); 69 } 70 /** 71 72 */ 73 double getDepth() const 74 { 75 checkClassBinding!(typeof(this))(); 76 return ptrcall!(double)(_classBinding.getDepth, _godot_object); 77 } 78 /** 79 80 */ 81 void setPolygon(in PoolVector2Array polygon) 82 { 83 checkClassBinding!(typeof(this))(); 84 ptrcall!(void)(_classBinding.setPolygon, _godot_object, polygon); 85 } 86 /** 87 88 */ 89 PoolVector2Array getPolygon() const 90 { 91 checkClassBinding!(typeof(this))(); 92 return ptrcall!(PoolVector2Array)(_classBinding.getPolygon, _godot_object); 93 } 94 /** 95 96 */ 97 void setDisabled(in bool disabled) 98 { 99 checkClassBinding!(typeof(this))(); 100 ptrcall!(void)(_classBinding.setDisabled, _godot_object, disabled); 101 } 102 /** 103 104 */ 105 bool isDisabled() const 106 { 107 checkClassBinding!(typeof(this))(); 108 return ptrcall!(bool)(_classBinding.isDisabled, _godot_object); 109 } 110 /** 111 112 */ 113 bool _isEditable3dPolygon() const 114 { 115 Array _GODOT_args = Array.empty_array; 116 String _GODOT_method_name = String("_is_editable_3d_polygon"); 117 return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!bool); 118 } 119 /** 120 Length that the resulting collision extends in either direction perpendicular to its polygon. 121 */ 122 @property double depth() 123 { 124 return getDepth(); 125 } 126 /// ditto 127 @property void depth(double v) 128 { 129 setDepth(v); 130 } 131 /** 132 If true, no collision will be produced. 133 */ 134 @property bool disabled() 135 { 136 return isDisabled(); 137 } 138 /// ditto 139 @property void disabled(bool v) 140 { 141 setDisabled(v); 142 } 143 /** 144 Array of vertices which define the polygon. 145 */ 146 @property PoolVector2Array polygon() 147 { 148 return getPolygon(); 149 } 150 /// ditto 151 @property void polygon(PoolVector2Array v) 152 { 153 setPolygon(v); 154 } 155 }