1 /** 2 Occludes light cast by a Light2D, casting shadows. 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.lightoccluder2d; 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.node2d; 24 import godot.occluderpolygon2d; 25 import godot.canvasitem; 26 import godot.node; 27 /** 28 Occludes light cast by a Light2D, casting shadows. 29 30 The LightOccluder2D must be provided with an $(D OccluderPolygon2D) in order for the shadow to be computed. 31 */ 32 @GodotBaseClass struct LightOccluder2D 33 { 34 enum string _GODOT_internal_name = "LightOccluder2D"; 35 public: 36 @nogc nothrow: 37 union { godot_object _godot_object; Node2D _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_occluder_polygon") GodotMethod!(void, OccluderPolygon2D) setOccluderPolygon; 45 @GodotName("get_occluder_polygon") GodotMethod!(OccluderPolygon2D) getOccluderPolygon; 46 @GodotName("set_occluder_light_mask") GodotMethod!(void, long) setOccluderLightMask; 47 @GodotName("get_occluder_light_mask") GodotMethod!(long) getOccluderLightMask; 48 @GodotName("_poly_changed") GodotMethod!(void) _polyChanged; 49 } 50 bool opEquals(in LightOccluder2D other) const { return _godot_object.ptr is other._godot_object.ptr; } 51 LightOccluder2D 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 LightOccluder2D _new() 55 { 56 static godot_class_constructor constructor; 57 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("LightOccluder2D"); 58 if(constructor is null) return typeof(this).init; 59 return cast(LightOccluder2D)(constructor()); 60 } 61 @disable new(size_t s); 62 /** 63 64 */ 65 void setOccluderPolygon(OccluderPolygon2D polygon) 66 { 67 checkClassBinding!(typeof(this))(); 68 ptrcall!(void)(_classBinding.setOccluderPolygon, _godot_object, polygon); 69 } 70 /** 71 72 */ 73 Ref!OccluderPolygon2D getOccluderPolygon() const 74 { 75 checkClassBinding!(typeof(this))(); 76 return ptrcall!(OccluderPolygon2D)(_classBinding.getOccluderPolygon, _godot_object); 77 } 78 /** 79 80 */ 81 void setOccluderLightMask(in long mask) 82 { 83 checkClassBinding!(typeof(this))(); 84 ptrcall!(void)(_classBinding.setOccluderLightMask, _godot_object, mask); 85 } 86 /** 87 88 */ 89 long getOccluderLightMask() const 90 { 91 checkClassBinding!(typeof(this))(); 92 return ptrcall!(long)(_classBinding.getOccluderLightMask, _godot_object); 93 } 94 /** 95 96 */ 97 void _polyChanged() 98 { 99 Array _GODOT_args = Array.empty_array; 100 String _GODOT_method_name = String("_poly_changed"); 101 this.callv(_GODOT_method_name, _GODOT_args); 102 } 103 /** 104 The $(D OccluderPolygon2D) used to compute the shadow. 105 */ 106 @property OccluderPolygon2D occluder() 107 { 108 return getOccluderPolygon(); 109 } 110 /// ditto 111 @property void occluder(OccluderPolygon2D v) 112 { 113 setOccluderPolygon(v); 114 } 115 /** 116 The LightOccluder2D's light mask. The LightOccluder2D will cast shadows only from Light2D(s) that have the same light mask(s). 117 */ 118 @property long lightMask() 119 { 120 return getOccluderLightMask(); 121 } 122 /// ditto 123 @property void lightMask(long v) 124 { 125 setOccluderLightMask(v); 126 } 127 }