1 /**
2 Generic mobile VR implementation.
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.mobilevrinterface;
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.arvrinterface;
25 import godot.reference;
26 /**
27 Generic mobile VR implementation.
28 
29 This is a generic mobile VR implementation where you need to provide details about the phone and HMD used. It does not rely on any existing framework. This is the most basic interface we have. For the best effect, you need a mobile phone with a gyroscope and accelerometer.
30 Note that even though there is no positional tracking, the camera will assume the headset is at a height of 1.85 meters. You can change this by setting $(D eyeHeight).
31 You can initialise this interface as follows:
32 
33 
34 var interface = ARVRServer.find_interface("Native mobile")
35 if interface and interface.initialize():
36     get_viewport().arvr = true
37 
38 
39 */
40 @GodotBaseClass struct MobileVRInterface
41 {
42 	package(godot) enum string _GODOT_internal_name = "MobileVRInterface";
43 public:
44 @nogc nothrow:
45 	union { /** */ godot_object _godot_object; /** */ ARVRInterface _GODOT_base; }
46 	alias _GODOT_base this;
47 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
48 	package(godot) __gshared bool _classBindingInitialized = false;
49 	package(godot) static struct GDNativeClassBinding
50 	{
51 		__gshared:
52 		@GodotName("get_display_to_lens") GodotMethod!(double) getDisplayToLens;
53 		@GodotName("get_display_width") GodotMethod!(double) getDisplayWidth;
54 		@GodotName("get_eye_height") GodotMethod!(double) getEyeHeight;
55 		@GodotName("get_iod") GodotMethod!(double) getIod;
56 		@GodotName("get_k1") GodotMethod!(double) getK1;
57 		@GodotName("get_k2") GodotMethod!(double) getK2;
58 		@GodotName("get_oversample") GodotMethod!(double) getOversample;
59 		@GodotName("set_display_to_lens") GodotMethod!(void, double) setDisplayToLens;
60 		@GodotName("set_display_width") GodotMethod!(void, double) setDisplayWidth;
61 		@GodotName("set_eye_height") GodotMethod!(void, double) setEyeHeight;
62 		@GodotName("set_iod") GodotMethod!(void, double) setIod;
63 		@GodotName("set_k1") GodotMethod!(void, double) setK1;
64 		@GodotName("set_k2") GodotMethod!(void, double) setK2;
65 		@GodotName("set_oversample") GodotMethod!(void, double) setOversample;
66 	}
67 	/// 
68 	pragma(inline, true) bool opEquals(in MobileVRInterface other) const
69 	{ return _godot_object.ptr is other._godot_object.ptr; }
70 	/// 
71 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
72 	{ _godot_object.ptr = n; return null; }
73 	/// 
74 	pragma(inline, true) bool opEquals(typeof(null) n) const
75 	{ return _godot_object.ptr is n; }
76 	/// 
77 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
78 	mixin baseCasts;
79 	/// Construct a new instance of MobileVRInterface.
80 	/// Note: use `memnew!MobileVRInterface` instead.
81 	static MobileVRInterface _new()
82 	{
83 		static godot_class_constructor constructor;
84 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("MobileVRInterface");
85 		if(constructor is null) return typeof(this).init;
86 		return cast(MobileVRInterface)(constructor());
87 	}
88 	@disable new(size_t s);
89 	/**
90 	
91 	*/
92 	double getDisplayToLens() const
93 	{
94 		checkClassBinding!(typeof(this))();
95 		return ptrcall!(double)(GDNativeClassBinding.getDisplayToLens, _godot_object);
96 	}
97 	/**
98 	
99 	*/
100 	double getDisplayWidth() const
101 	{
102 		checkClassBinding!(typeof(this))();
103 		return ptrcall!(double)(GDNativeClassBinding.getDisplayWidth, _godot_object);
104 	}
105 	/**
106 	
107 	*/
108 	double getEyeHeight() const
109 	{
110 		checkClassBinding!(typeof(this))();
111 		return ptrcall!(double)(GDNativeClassBinding.getEyeHeight, _godot_object);
112 	}
113 	/**
114 	
115 	*/
116 	double getIod() const
117 	{
118 		checkClassBinding!(typeof(this))();
119 		return ptrcall!(double)(GDNativeClassBinding.getIod, _godot_object);
120 	}
121 	/**
122 	
123 	*/
124 	double getK1() const
125 	{
126 		checkClassBinding!(typeof(this))();
127 		return ptrcall!(double)(GDNativeClassBinding.getK1, _godot_object);
128 	}
129 	/**
130 	
131 	*/
132 	double getK2() const
133 	{
134 		checkClassBinding!(typeof(this))();
135 		return ptrcall!(double)(GDNativeClassBinding.getK2, _godot_object);
136 	}
137 	/**
138 	
139 	*/
140 	double getOversample() const
141 	{
142 		checkClassBinding!(typeof(this))();
143 		return ptrcall!(double)(GDNativeClassBinding.getOversample, _godot_object);
144 	}
145 	/**
146 	
147 	*/
148 	void setDisplayToLens(in double display_to_lens)
149 	{
150 		checkClassBinding!(typeof(this))();
151 		ptrcall!(void)(GDNativeClassBinding.setDisplayToLens, _godot_object, display_to_lens);
152 	}
153 	/**
154 	
155 	*/
156 	void setDisplayWidth(in double display_width)
157 	{
158 		checkClassBinding!(typeof(this))();
159 		ptrcall!(void)(GDNativeClassBinding.setDisplayWidth, _godot_object, display_width);
160 	}
161 	/**
162 	
163 	*/
164 	void setEyeHeight(in double eye_height)
165 	{
166 		checkClassBinding!(typeof(this))();
167 		ptrcall!(void)(GDNativeClassBinding.setEyeHeight, _godot_object, eye_height);
168 	}
169 	/**
170 	
171 	*/
172 	void setIod(in double iod)
173 	{
174 		checkClassBinding!(typeof(this))();
175 		ptrcall!(void)(GDNativeClassBinding.setIod, _godot_object, iod);
176 	}
177 	/**
178 	
179 	*/
180 	void setK1(in double k)
181 	{
182 		checkClassBinding!(typeof(this))();
183 		ptrcall!(void)(GDNativeClassBinding.setK1, _godot_object, k);
184 	}
185 	/**
186 	
187 	*/
188 	void setK2(in double k)
189 	{
190 		checkClassBinding!(typeof(this))();
191 		ptrcall!(void)(GDNativeClassBinding.setK2, _godot_object, k);
192 	}
193 	/**
194 	
195 	*/
196 	void setOversample(in double oversample)
197 	{
198 		checkClassBinding!(typeof(this))();
199 		ptrcall!(void)(GDNativeClassBinding.setOversample, _godot_object, oversample);
200 	}
201 	/**
202 	The distance between the display and the lenses inside of the device in centimeters.
203 	*/
204 	@property double displayToLens()
205 	{
206 		return getDisplayToLens();
207 	}
208 	/// ditto
209 	@property void displayToLens(double v)
210 	{
211 		setDisplayToLens(v);
212 	}
213 	/**
214 	The width of the display in centimeters.
215 	*/
216 	@property double displayWidth()
217 	{
218 		return getDisplayWidth();
219 	}
220 	/// ditto
221 	@property void displayWidth(double v)
222 	{
223 		setDisplayWidth(v);
224 	}
225 	/**
226 	The height at which the camera is placed in relation to the ground (i.e. $(D ARVROrigin) node).
227 	*/
228 	@property double eyeHeight()
229 	{
230 		return getEyeHeight();
231 	}
232 	/// ditto
233 	@property void eyeHeight(double v)
234 	{
235 		setEyeHeight(v);
236 	}
237 	/**
238 	The interocular distance, also known as the interpupillary distance. The distance between the pupils of the left and right eye.
239 	*/
240 	@property double iod()
241 	{
242 		return getIod();
243 	}
244 	/// ditto
245 	@property void iod(double v)
246 	{
247 		setIod(v);
248 	}
249 	/**
250 	The k1 lens factor is one of the two constants that define the strength of the lens used and directly influences the lens distortion effect.
251 	*/
252 	@property double k1()
253 	{
254 		return getK1();
255 	}
256 	/// ditto
257 	@property void k1(double v)
258 	{
259 		setK1(v);
260 	}
261 	/**
262 	The k2 lens factor, see k1.
263 	*/
264 	@property double k2()
265 	{
266 		return getK2();
267 	}
268 	/// ditto
269 	@property void k2(double v)
270 	{
271 		setK2(v);
272 	}
273 	/**
274 	The oversample setting. Because of the lens distortion we have to render our buffers at a higher resolution then the screen can natively handle. A value between 1.5 and 2.0 often provides good results but at the cost of performance.
275 	*/
276 	@property double oversample()
277 	{
278 		return getOversample();
279 	}
280 	/// ditto
281 	@property void oversample(double v)
282 	{
283 		setOversample(v);
284 	}
285 }