1 /**
2 A spotlight, such as a reflector spotlight or a lantern.
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.spotlight;
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.light;
25 import godot.visualinstance;
26 /**
27 A spotlight, such as a reflector spotlight or a lantern.
28 
29 A Spotlight is a type of $(D Light) node that emits lights in a specific direction, in the shape of a cone. The light is attenuated through the distance. This attenuation can be configured by changing the energy, radius and attenuation parameters of $(D Light).
30 $(B Note:) By default, only 32 SpotLights may affect a single mesh $(I resource) at once. Consider splitting your level into several meshes to decrease the likelihood that more than 32 lights will affect the same mesh resource. Splitting the level mesh will also improve frustum culling effectiveness, leading to greater performance. If you need to use more lights per mesh, you can increase $(D ProjectSettings.rendering/limits/rendering/maxLightsPerObject) at the cost of shader compilation times.
31 */
32 @GodotBaseClass struct SpotLight
33 {
34 	package(godot) enum string _GODOT_internal_name = "SpotLight";
35 public:
36 @nogc nothrow:
37 	union { /** */ godot_object _godot_object; /** */ Light _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 GDNativeClassBinding
42 	{
43 		__gshared:
44 	}
45 	/// 
46 	pragma(inline, true) bool opEquals(in SpotLight other) const
47 	{ return _godot_object.ptr is other._godot_object.ptr; }
48 	/// 
49 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
50 	{ _godot_object.ptr = n; return null; }
51 	/// 
52 	pragma(inline, true) bool opEquals(typeof(null) n) const
53 	{ return _godot_object.ptr is n; }
54 	/// 
55 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
56 	mixin baseCasts;
57 	/// Construct a new instance of SpotLight.
58 	/// Note: use `memnew!SpotLight` instead.
59 	static SpotLight _new()
60 	{
61 		static godot_class_constructor constructor;
62 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("SpotLight");
63 		if(constructor is null) return typeof(this).init;
64 		return cast(SpotLight)(constructor());
65 	}
66 	@disable new(size_t s);
67 	/**
68 	The spotlight's angle in degrees.
69 	*/
70 	@property double spotAngle()
71 	{
72 		return getParam(5);
73 	}
74 	/// ditto
75 	@property void spotAngle(double v)
76 	{
77 		setParam(5, v);
78 	}
79 	/**
80 	The spotlight's angular attenuation curve.
81 	*/
82 	@property double spotAngleAttenuation()
83 	{
84 		return getParam(6);
85 	}
86 	/// ditto
87 	@property void spotAngleAttenuation(double v)
88 	{
89 		setParam(6, v);
90 	}
91 	/**
92 	The spotlight's light energy attenuation curve.
93 	*/
94 	@property double spotAttenuation()
95 	{
96 		return getParam(4);
97 	}
98 	/// ditto
99 	@property void spotAttenuation(double v)
100 	{
101 		setParam(4, v);
102 	}
103 	/**
104 	The maximal range that can be reached by the spotlight. Note that the effectively lit area may appear to be smaller depending on the $(D spotAttenuation) in use. No matter the $(D spotAttenuation) in use, the light will never reach anything outside this range.
105 	*/
106 	@property double spotRange()
107 	{
108 		return getParam(3);
109 	}
110 	/// ditto
111 	@property void spotRange(double v)
112 	{
113 		setParam(3, v);
114 	}
115 }