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.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.arvrinterface; 24 import godot.reference; 25 /** 26 Generic mobile VR implementation 27 28 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 do need a mobile phone with a gyroscope and accelerometer. 29 Note that even though there is no positional tracking the camera will assume the headset is at a height of 1.85 meters. 30 */ 31 @GodotBaseClass struct MobileVRInterface 32 { 33 enum string _GODOT_internal_name = "MobileVRInterface"; 34 public: 35 @nogc nothrow: 36 union { godot_object _godot_object; ARVRInterface _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 _classBinding 41 { 42 __gshared: 43 @GodotName("set_iod") GodotMethod!(void, double) setIod; 44 @GodotName("get_iod") GodotMethod!(double) getIod; 45 @GodotName("set_display_width") GodotMethod!(void, double) setDisplayWidth; 46 @GodotName("get_display_width") GodotMethod!(double) getDisplayWidth; 47 @GodotName("set_display_to_lens") GodotMethod!(void, double) setDisplayToLens; 48 @GodotName("get_display_to_lens") GodotMethod!(double) getDisplayToLens; 49 @GodotName("set_oversample") GodotMethod!(void, double) setOversample; 50 @GodotName("get_oversample") GodotMethod!(double) getOversample; 51 @GodotName("set_k1") GodotMethod!(void, double) setK1; 52 @GodotName("get_k1") GodotMethod!(double) getK1; 53 @GodotName("set_k2") GodotMethod!(void, double) setK2; 54 @GodotName("get_k2") GodotMethod!(double) getK2; 55 } 56 bool opEquals(in MobileVRInterface other) const { return _godot_object.ptr is other._godot_object.ptr; } 57 MobileVRInterface opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 58 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 59 mixin baseCasts; 60 static MobileVRInterface _new() 61 { 62 static godot_class_constructor constructor; 63 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("MobileVRInterface"); 64 if(constructor is null) return typeof(this).init; 65 return cast(MobileVRInterface)(constructor()); 66 } 67 @disable new(size_t s); 68 /** 69 70 */ 71 void setIod(in double iod) 72 { 73 checkClassBinding!(typeof(this))(); 74 ptrcall!(void)(_classBinding.setIod, _godot_object, iod); 75 } 76 /** 77 78 */ 79 double getIod() const 80 { 81 checkClassBinding!(typeof(this))(); 82 return ptrcall!(double)(_classBinding.getIod, _godot_object); 83 } 84 /** 85 86 */ 87 void setDisplayWidth(in double display_width) 88 { 89 checkClassBinding!(typeof(this))(); 90 ptrcall!(void)(_classBinding.setDisplayWidth, _godot_object, display_width); 91 } 92 /** 93 94 */ 95 double getDisplayWidth() const 96 { 97 checkClassBinding!(typeof(this))(); 98 return ptrcall!(double)(_classBinding.getDisplayWidth, _godot_object); 99 } 100 /** 101 102 */ 103 void setDisplayToLens(in double display_to_lens) 104 { 105 checkClassBinding!(typeof(this))(); 106 ptrcall!(void)(_classBinding.setDisplayToLens, _godot_object, display_to_lens); 107 } 108 /** 109 110 */ 111 double getDisplayToLens() const 112 { 113 checkClassBinding!(typeof(this))(); 114 return ptrcall!(double)(_classBinding.getDisplayToLens, _godot_object); 115 } 116 /** 117 118 */ 119 void setOversample(in double oversample) 120 { 121 checkClassBinding!(typeof(this))(); 122 ptrcall!(void)(_classBinding.setOversample, _godot_object, oversample); 123 } 124 /** 125 126 */ 127 double getOversample() const 128 { 129 checkClassBinding!(typeof(this))(); 130 return ptrcall!(double)(_classBinding.getOversample, _godot_object); 131 } 132 /** 133 134 */ 135 void setK1(in double k) 136 { 137 checkClassBinding!(typeof(this))(); 138 ptrcall!(void)(_classBinding.setK1, _godot_object, k); 139 } 140 /** 141 142 */ 143 double getK1() const 144 { 145 checkClassBinding!(typeof(this))(); 146 return ptrcall!(double)(_classBinding.getK1, _godot_object); 147 } 148 /** 149 150 */ 151 void setK2(in double k) 152 { 153 checkClassBinding!(typeof(this))(); 154 ptrcall!(void)(_classBinding.setK2, _godot_object, k); 155 } 156 /** 157 158 */ 159 double getK2() const 160 { 161 checkClassBinding!(typeof(this))(); 162 return ptrcall!(double)(_classBinding.getK2, _godot_object); 163 } 164 /** 165 The interocular distance, also known as the interpupillary distance. The distance between the pupils of the left and right eye. 166 */ 167 @property double iod() 168 { 169 return getIod(); 170 } 171 /// ditto 172 @property void iod(double v) 173 { 174 setIod(v); 175 } 176 /** 177 The width of the display in centimeters. 178 */ 179 @property double displayWidth() 180 { 181 return getDisplayWidth(); 182 } 183 /// ditto 184 @property void displayWidth(double v) 185 { 186 setDisplayWidth(v); 187 } 188 /** 189 The distance between the display and the lenses inside of the device in centimeters. 190 */ 191 @property double displayToLens() 192 { 193 return getDisplayToLens(); 194 } 195 /// ditto 196 @property void displayToLens(double v) 197 { 198 setDisplayToLens(v); 199 } 200 /** 201 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. 202 */ 203 @property double oversample() 204 { 205 return getOversample(); 206 } 207 /// ditto 208 @property void oversample(double v) 209 { 210 setOversample(v); 211 } 212 /** 213 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. 214 */ 215 @property double k1() 216 { 217 return getK1(); 218 } 219 /// ditto 220 @property void k1(double v) 221 { 222 setK1(v); 223 } 224 /** 225 The k2 lens factor, see k1. 226 */ 227 @property double k2() 228 { 229 return getK2(); 230 } 231 /// ditto 232 @property void k2(double v) 233 { 234 setK2(v); 235 } 236 }