1 /** 2 Defines a 2D polygon for LightOccluder2D. 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.occluderpolygon2d; 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.resource; 24 import godot.reference; 25 /** 26 Defines a 2D polygon for LightOccluder2D. 27 28 Editor facility that helps you draw a 2D polygon used as resource for $(D LightOccluder2D). 29 */ 30 @GodotBaseClass struct OccluderPolygon2D 31 { 32 enum string _GODOT_internal_name = "OccluderPolygon2D"; 33 public: 34 @nogc nothrow: 35 union { godot_object _godot_object; Resource _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_closed") GodotMethod!(void, bool) setClosed; 43 @GodotName("is_closed") GodotMethod!(bool) isClosed; 44 @GodotName("set_cull_mode") GodotMethod!(void, long) setCullMode; 45 @GodotName("get_cull_mode") GodotMethod!(OccluderPolygon2D.CullMode) getCullMode; 46 @GodotName("set_polygon") GodotMethod!(void, PoolVector2Array) setPolygon; 47 @GodotName("get_polygon") GodotMethod!(PoolVector2Array) getPolygon; 48 } 49 bool opEquals(in OccluderPolygon2D other) const { return _godot_object.ptr is other._godot_object.ptr; } 50 OccluderPolygon2D opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 51 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 52 mixin baseCasts; 53 static OccluderPolygon2D _new() 54 { 55 static godot_class_constructor constructor; 56 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("OccluderPolygon2D"); 57 if(constructor is null) return typeof(this).init; 58 return cast(OccluderPolygon2D)(constructor()); 59 } 60 @disable new(size_t s); 61 /// 62 enum CullMode : int 63 { 64 /** 65 Culling mode for the occlusion. Disabled means no culling. See $(D cullMode). 66 */ 67 cullDisabled = 0, 68 /** 69 Culling mode for the occlusion. Sets the culling to be in clockwise direction. See $(D cullMode). 70 */ 71 cullClockwise = 1, 72 /** 73 Culling mode for the occlusion. Sets the culling to be in counter clockwise direction. See $(D cullMode). 74 */ 75 cullCounterClockwise = 2, 76 } 77 /// 78 enum Constants : int 79 { 80 cullDisabled = 0, 81 cullClockwise = 1, 82 cullCounterClockwise = 2, 83 } 84 /** 85 86 */ 87 void setClosed(in bool closed) 88 { 89 checkClassBinding!(typeof(this))(); 90 ptrcall!(void)(_classBinding.setClosed, _godot_object, closed); 91 } 92 /** 93 94 */ 95 bool isClosed() const 96 { 97 checkClassBinding!(typeof(this))(); 98 return ptrcall!(bool)(_classBinding.isClosed, _godot_object); 99 } 100 /** 101 102 */ 103 void setCullMode(in long cull_mode) 104 { 105 checkClassBinding!(typeof(this))(); 106 ptrcall!(void)(_classBinding.setCullMode, _godot_object, cull_mode); 107 } 108 /** 109 110 */ 111 OccluderPolygon2D.CullMode getCullMode() const 112 { 113 checkClassBinding!(typeof(this))(); 114 return ptrcall!(OccluderPolygon2D.CullMode)(_classBinding.getCullMode, _godot_object); 115 } 116 /** 117 118 */ 119 void setPolygon(in PoolVector2Array polygon) 120 { 121 checkClassBinding!(typeof(this))(); 122 ptrcall!(void)(_classBinding.setPolygon, _godot_object, polygon); 123 } 124 /** 125 126 */ 127 PoolVector2Array getPolygon() const 128 { 129 checkClassBinding!(typeof(this))(); 130 return ptrcall!(PoolVector2Array)(_classBinding.getPolygon, _godot_object); 131 } 132 /** 133 If `true` closes the polygon. A closed OccluderPolygon2D occludes the light coming from any direction. An opened OccluderPolygon2D occludes the light only at its outline's direction. Default value `true`. 134 */ 135 @property bool closed() 136 { 137 return isClosed(); 138 } 139 /// ditto 140 @property void closed(bool v) 141 { 142 setClosed(v); 143 } 144 /** 145 Set the direction of the occlusion culling when not `CULL_DISABLED`. Default value `DISABLED`. 146 */ 147 @property OccluderPolygon2D.CullMode cullMode() 148 { 149 return getCullMode(); 150 } 151 /// ditto 152 @property void cullMode(long v) 153 { 154 setCullMode(v); 155 } 156 /** 157 A $(D Vector2) array with the index for polygon's vertices positions. 158 */ 159 @property PoolVector2Array polygon() 160 { 161 return getPolygon(); 162 } 163 /// ditto 164 @property void polygon(PoolVector2Array v) 165 { 166 setPolygon(v); 167 } 168 }