1 /**
2 Oriented point sampler for a $(D Path).
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.orientedpathfollow;
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.spatial;
24 import godot.node;
25 /**
26 Oriented point sampler for a $(D Path).
27 
28 This node behaves like $(D PathFollow), except it uses its parent $(D Path) up vector information to enforce orientation. 
29 Make sure to check if the curve of this node's parent $(D Path) has up vectors enabled. See $(D PathFollow) and $(D Curve3D) for further information.
30 */
31 @GodotBaseClass struct OrientedPathFollow
32 {
33 	enum string _GODOT_internal_name = "OrientedPathFollow";
34 public:
35 @nogc nothrow:
36 	union { godot_object _godot_object; Spatial _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_offset") GodotMethod!(void, double) setOffset;
44 		@GodotName("get_offset") GodotMethod!(double) getOffset;
45 		@GodotName("set_h_offset") GodotMethod!(void, double) setHOffset;
46 		@GodotName("get_h_offset") GodotMethod!(double) getHOffset;
47 		@GodotName("set_v_offset") GodotMethod!(void, double) setVOffset;
48 		@GodotName("get_v_offset") GodotMethod!(double) getVOffset;
49 		@GodotName("set_unit_offset") GodotMethod!(void, double) setUnitOffset;
50 		@GodotName("get_unit_offset") GodotMethod!(double) getUnitOffset;
51 		@GodotName("set_cubic_interpolation") GodotMethod!(void, bool) setCubicInterpolation;
52 		@GodotName("get_cubic_interpolation") GodotMethod!(bool) getCubicInterpolation;
53 		@GodotName("set_loop") GodotMethod!(void, bool) setLoop;
54 		@GodotName("has_loop") GodotMethod!(bool) hasLoop;
55 	}
56 	bool opEquals(in OrientedPathFollow other) const { return _godot_object.ptr is other._godot_object.ptr; }
57 	OrientedPathFollow 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 OrientedPathFollow _new()
61 	{
62 		static godot_class_constructor constructor;
63 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("OrientedPathFollow");
64 		if(constructor is null) return typeof(this).init;
65 		return cast(OrientedPathFollow)(constructor());
66 	}
67 	@disable new(size_t s);
68 	/**
69 	
70 	*/
71 	void setOffset(in double offset)
72 	{
73 		checkClassBinding!(typeof(this))();
74 		ptrcall!(void)(_classBinding.setOffset, _godot_object, offset);
75 	}
76 	/**
77 	
78 	*/
79 	double getOffset() const
80 	{
81 		checkClassBinding!(typeof(this))();
82 		return ptrcall!(double)(_classBinding.getOffset, _godot_object);
83 	}
84 	/**
85 	
86 	*/
87 	void setHOffset(in double h_offset)
88 	{
89 		checkClassBinding!(typeof(this))();
90 		ptrcall!(void)(_classBinding.setHOffset, _godot_object, h_offset);
91 	}
92 	/**
93 	
94 	*/
95 	double getHOffset() const
96 	{
97 		checkClassBinding!(typeof(this))();
98 		return ptrcall!(double)(_classBinding.getHOffset, _godot_object);
99 	}
100 	/**
101 	
102 	*/
103 	void setVOffset(in double v_offset)
104 	{
105 		checkClassBinding!(typeof(this))();
106 		ptrcall!(void)(_classBinding.setVOffset, _godot_object, v_offset);
107 	}
108 	/**
109 	
110 	*/
111 	double getVOffset() const
112 	{
113 		checkClassBinding!(typeof(this))();
114 		return ptrcall!(double)(_classBinding.getVOffset, _godot_object);
115 	}
116 	/**
117 	
118 	*/
119 	void setUnitOffset(in double unit_offset)
120 	{
121 		checkClassBinding!(typeof(this))();
122 		ptrcall!(void)(_classBinding.setUnitOffset, _godot_object, unit_offset);
123 	}
124 	/**
125 	
126 	*/
127 	double getUnitOffset() const
128 	{
129 		checkClassBinding!(typeof(this))();
130 		return ptrcall!(double)(_classBinding.getUnitOffset, _godot_object);
131 	}
132 	/**
133 	
134 	*/
135 	void setCubicInterpolation(in bool enable)
136 	{
137 		checkClassBinding!(typeof(this))();
138 		ptrcall!(void)(_classBinding.setCubicInterpolation, _godot_object, enable);
139 	}
140 	/**
141 	
142 	*/
143 	bool getCubicInterpolation() const
144 	{
145 		checkClassBinding!(typeof(this))();
146 		return ptrcall!(bool)(_classBinding.getCubicInterpolation, _godot_object);
147 	}
148 	/**
149 	
150 	*/
151 	void setLoop(in bool loop)
152 	{
153 		checkClassBinding!(typeof(this))();
154 		ptrcall!(void)(_classBinding.setLoop, _godot_object, loop);
155 	}
156 	/**
157 	
158 	*/
159 	bool hasLoop() const
160 	{
161 		checkClassBinding!(typeof(this))();
162 		return ptrcall!(bool)(_classBinding.hasLoop, _godot_object);
163 	}
164 	/**
165 	The distance from the first vertex, measured in 3D units along the path. This sets this node's position to a point within the path.
166 	*/
167 	@property double offset()
168 	{
169 		return getOffset();
170 	}
171 	/// ditto
172 	@property void offset(double v)
173 	{
174 		setOffset(v);
175 	}
176 	/**
177 	The distance from the first vertex, considering 0.0 as the first vertex and 1.0 as the last. This is just another way of expressing the offset within the path, as the offset supplied is multiplied internally by the path's length.
178 	*/
179 	@property double unitOffset()
180 	{
181 		return getUnitOffset();
182 	}
183 	/// ditto
184 	@property void unitOffset(double v)
185 	{
186 		setUnitOffset(v);
187 	}
188 	/**
189 	The node's offset along the curve.
190 	*/
191 	@property double hOffset()
192 	{
193 		return getHOffset();
194 	}
195 	/// ditto
196 	@property void hOffset(double v)
197 	{
198 		setHOffset(v);
199 	}
200 	/**
201 	The node's offset perpendicular to the curve.
202 	*/
203 	@property double vOffset()
204 	{
205 		return getVOffset();
206 	}
207 	/// ditto
208 	@property void vOffset(double v)
209 	{
210 		setVOffset(v);
211 	}
212 	/**
213 	If `true` the position between two cached points is interpolated cubically, and linearly otherwise.
214 	The points along the $(D Curve3D) of the $(D Path) are precomputed before use, for faster calculations. The point at the requested offset is then calculated interpolating between two adjacent cached points. This may present a problem if the curve makes sharp turns, as the cached points may not follow the curve closely enough.
215 	There are two answers to this problem: Either increase the number of cached points and increase memory consumption, or make a cubic interpolation between two points at the cost of (slightly) slower calculations.
216 	*/
217 	@property bool cubicInterp()
218 	{
219 		return getCubicInterpolation();
220 	}
221 	/// ditto
222 	@property void cubicInterp(bool v)
223 	{
224 		setCubicInterpolation(v);
225 	}
226 	/**
227 	If `true`, any offset outside the path's length will wrap around, instead of stopping at the ends. Use it for cyclic paths.
228 	*/
229 	@property bool loop()
230 	{
231 		return hasLoop();
232 	}
233 	/// ditto
234 	@property void loop(bool v)
235 	{
236 		setLoop(v);
237 	}
238 }