1 /**
2 A tracked object
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.arvrpositionaltracker;
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.arvrserver;
24 /**
25 A tracked object
26 
27 An instance of this object represents a device that is tracked such as a controller or anchor point. HMDs aren't represented here as they are fully handled internally.
28 As controllers are turned on and the AR/VR interface detects them instances of this object are automatically added to this list of active tracking objects accessible through the ARVRServer
29 The ARVRController and ARVRAnchor both consume objects of this type and should be the objects you use in game. The positional trackers are just the under the hood objects that make this all work and are mostly exposed so GDNative based interfaces can interact with them.
30 */
31 @GodotBaseClass struct ARVRPositionalTracker
32 {
33 	enum string _GODOT_internal_name = "ARVRPositionalTracker";
34 public:
35 @nogc nothrow:
36 	union { godot_object _godot_object; GodotObject _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("get_type") GodotMethod!(ARVRServer.TrackerType) getType;
44 		@GodotName("get_name") GodotMethod!(String) getName;
45 		@GodotName("get_joy_id") GodotMethod!(long) getJoyId;
46 		@GodotName("get_tracks_orientation") GodotMethod!(bool) getTracksOrientation;
47 		@GodotName("get_orientation") GodotMethod!(Basis) getOrientation;
48 		@GodotName("get_tracks_position") GodotMethod!(bool) getTracksPosition;
49 		@GodotName("get_position") GodotMethod!(Vector3) getPosition;
50 		@GodotName("get_hand") GodotMethod!(ARVRPositionalTracker.TrackerHand) getHand;
51 		@GodotName("get_transform") GodotMethod!(Transform, bool) getTransform;
52 		@GodotName("_set_type") GodotMethod!(void, long) _setType;
53 		@GodotName("_set_name") GodotMethod!(void, String) _setName;
54 		@GodotName("_set_joy_id") GodotMethod!(void, long) _setJoyId;
55 		@GodotName("_set_orientation") GodotMethod!(void, Basis) _setOrientation;
56 		@GodotName("_set_rw_position") GodotMethod!(void, Vector3) _setRwPosition;
57 		@GodotName("get_rumble") GodotMethod!(double) getRumble;
58 		@GodotName("set_rumble") GodotMethod!(void, double) setRumble;
59 	}
60 	bool opEquals(in ARVRPositionalTracker other) const { return _godot_object.ptr is other._godot_object.ptr; }
61 	ARVRPositionalTracker opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
62 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
63 	mixin baseCasts;
64 	static ARVRPositionalTracker _new()
65 	{
66 		static godot_class_constructor constructor;
67 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("ARVRPositionalTracker");
68 		if(constructor is null) return typeof(this).init;
69 		return cast(ARVRPositionalTracker)(constructor());
70 	}
71 	@disable new(size_t s);
72 	/// 
73 	enum TrackerHand : int
74 	{
75 		/**
76 		The hand this tracker is held in is unknown or not applicable.
77 		*/
78 		trackerHandUnknown = 0,
79 		/**
80 		This tracker is the left hand controller.
81 		*/
82 		trackerLeftHand = 1,
83 		/**
84 		This tracker is the right hand controller.
85 		*/
86 		trackerRightHand = 2,
87 	}
88 	/// 
89 	enum Constants : int
90 	{
91 		trackerHandUnknown = 0,
92 		trackerLeftHand = 1,
93 		trackerRightHand = 2,
94 	}
95 	/**
96 	Returns the tracker's type.
97 	*/
98 	ARVRServer.TrackerType getType() const
99 	{
100 		checkClassBinding!(typeof(this))();
101 		return ptrcall!(ARVRServer.TrackerType)(_classBinding.getType, _godot_object);
102 	}
103 	/**
104 	Returns the controller or anchor point's name if available.
105 	*/
106 	String getName() const
107 	{
108 		checkClassBinding!(typeof(this))();
109 		return ptrcall!(String)(_classBinding.getName, _godot_object);
110 	}
111 	/**
112 	If this is a controller that is being tracked the controller will also be represented by a joystick entry with this id.
113 	*/
114 	long getJoyId() const
115 	{
116 		checkClassBinding!(typeof(this))();
117 		return ptrcall!(long)(_classBinding.getJoyId, _godot_object);
118 	}
119 	/**
120 	Returns `true` if this device tracks orientation.
121 	*/
122 	bool getTracksOrientation() const
123 	{
124 		checkClassBinding!(typeof(this))();
125 		return ptrcall!(bool)(_classBinding.getTracksOrientation, _godot_object);
126 	}
127 	/**
128 	Returns the controller's orientation matrix.
129 	*/
130 	Basis getOrientation() const
131 	{
132 		checkClassBinding!(typeof(this))();
133 		return ptrcall!(Basis)(_classBinding.getOrientation, _godot_object);
134 	}
135 	/**
136 	Returns `true` if this device tracks position.
137 	*/
138 	bool getTracksPosition() const
139 	{
140 		checkClassBinding!(typeof(this))();
141 		return ptrcall!(bool)(_classBinding.getTracksPosition, _godot_object);
142 	}
143 	/**
144 	Returns the world-space controller position.
145 	*/
146 	Vector3 getPosition() const
147 	{
148 		checkClassBinding!(typeof(this))();
149 		return ptrcall!(Vector3)(_classBinding.getPosition, _godot_object);
150 	}
151 	/**
152 	Returns the hand holding this tracker, if known. See TRACKER_* constants.
153 	*/
154 	ARVRPositionalTracker.TrackerHand getHand() const
155 	{
156 		checkClassBinding!(typeof(this))();
157 		return ptrcall!(ARVRPositionalTracker.TrackerHand)(_classBinding.getHand, _godot_object);
158 	}
159 	/**
160 	Returns the transform combining this device's orientation and position.
161 	*/
162 	Transform getTransform(in bool adjust_by_reference_frame) const
163 	{
164 		checkClassBinding!(typeof(this))();
165 		return ptrcall!(Transform)(_classBinding.getTransform, _godot_object, adjust_by_reference_frame);
166 	}
167 	/**
168 	
169 	*/
170 	void _setType(in long type)
171 	{
172 		Array _GODOT_args = Array.empty_array;
173 		_GODOT_args.append(type);
174 		String _GODOT_method_name = String("_set_type");
175 		this.callv(_GODOT_method_name, _GODOT_args);
176 	}
177 	/**
178 	
179 	*/
180 	void _setName(StringArg0)(in StringArg0 name)
181 	{
182 		Array _GODOT_args = Array.empty_array;
183 		_GODOT_args.append(name);
184 		String _GODOT_method_name = String("_set_name");
185 		this.callv(_GODOT_method_name, _GODOT_args);
186 	}
187 	/**
188 	
189 	*/
190 	void _setJoyId(in long joy_id)
191 	{
192 		Array _GODOT_args = Array.empty_array;
193 		_GODOT_args.append(joy_id);
194 		String _GODOT_method_name = String("_set_joy_id");
195 		this.callv(_GODOT_method_name, _GODOT_args);
196 	}
197 	/**
198 	
199 	*/
200 	void _setOrientation(in Basis orientation)
201 	{
202 		Array _GODOT_args = Array.empty_array;
203 		_GODOT_args.append(orientation);
204 		String _GODOT_method_name = String("_set_orientation");
205 		this.callv(_GODOT_method_name, _GODOT_args);
206 	}
207 	/**
208 	
209 	*/
210 	void _setRwPosition(in Vector3 rw_position)
211 	{
212 		Array _GODOT_args = Array.empty_array;
213 		_GODOT_args.append(rw_position);
214 		String _GODOT_method_name = String("_set_rw_position");
215 		this.callv(_GODOT_method_name, _GODOT_args);
216 	}
217 	/**
218 	
219 	*/
220 	double getRumble() const
221 	{
222 		checkClassBinding!(typeof(this))();
223 		return ptrcall!(double)(_classBinding.getRumble, _godot_object);
224 	}
225 	/**
226 	
227 	*/
228 	void setRumble(in double rumble)
229 	{
230 		checkClassBinding!(typeof(this))();
231 		ptrcall!(void)(_classBinding.setRumble, _godot_object, rumble);
232 	}
233 	/**
234 	The degree to which the tracker rumbles. Ranges from `0.0` to `1.0` with precision `.01`.
235 	*/
236 	@property double rumble()
237 	{
238 		return getRumble();
239 	}
240 	/// ditto
241 	@property void rumble(double v)
242 	{
243 		setRumble(v);
244 	}
245 }