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