1 /**
2 A Visual Script node used to call built-in functions.
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.visualscriptbuiltinfunc;
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.visualscriptnode;
24 import godot.resource;
25 import godot.reference;
26 /**
27 A Visual Script node used to call built-in functions.
28 
29 A built-in function used inside a $(D VisualScript). It is usually a math function or an utility function.
30 See also $(D @GDScript), for the same functions in the GDScript language.
31 */
32 @GodotBaseClass struct VisualScriptBuiltinFunc
33 {
34 	enum string _GODOT_internal_name = "VisualScriptBuiltinFunc";
35 public:
36 @nogc nothrow:
37 	union { godot_object _godot_object; VisualScriptNode _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 _classBinding
42 	{
43 		__gshared:
44 		@GodotName("set_func") GodotMethod!(void, long) setFunc;
45 		@GodotName("get_func") GodotMethod!(VisualScriptBuiltinFunc.BuiltinFunc) getFunc;
46 	}
47 	bool opEquals(in VisualScriptBuiltinFunc other) const { return _godot_object.ptr is other._godot_object.ptr; }
48 	VisualScriptBuiltinFunc opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
49 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
50 	mixin baseCasts;
51 	static VisualScriptBuiltinFunc _new()
52 	{
53 		static godot_class_constructor constructor;
54 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("VisualScriptBuiltinFunc");
55 		if(constructor is null) return typeof(this).init;
56 		return cast(VisualScriptBuiltinFunc)(constructor());
57 	}
58 	@disable new(size_t s);
59 	/// 
60 	enum BuiltinFunc : int
61 	{
62 		/**
63 		Return the sine of the input.
64 		*/
65 		mathSin = 0,
66 		/**
67 		Return the cosine of the input.
68 		*/
69 		mathCos = 1,
70 		/**
71 		Return the tangent of the input.
72 		*/
73 		mathTan = 2,
74 		/**
75 		Return the hyperbolic sine of the input.
76 		*/
77 		mathSinh = 3,
78 		/**
79 		Return the hyperbolic cosine of the input.
80 		*/
81 		mathCosh = 4,
82 		/**
83 		Return the hyperbolic tangent of the input.
84 		*/
85 		mathTanh = 5,
86 		/**
87 		Return the arc sine of the input.
88 		*/
89 		mathAsin = 6,
90 		/**
91 		Return the arc cosine of the input.
92 		*/
93 		mathAcos = 7,
94 		/**
95 		Return the arc tangent of the input.
96 		*/
97 		mathAtan = 8,
98 		/**
99 		Return the arc tangent of the input, using the signs of both parameters to determine the exact angle.
100 		*/
101 		mathAtan2 = 9,
102 		/**
103 		Return the square root of the input.
104 		*/
105 		mathSqrt = 10,
106 		/**
107 		Return the remainder of one input divided by the other, using floating-point numbers.
108 		*/
109 		mathFmod = 11,
110 		/**
111 		Return the positive remainder of one input divided by the other, using floating-point numbers.
112 		*/
113 		mathFposmod = 12,
114 		/**
115 		Return the input rounded down.
116 		*/
117 		mathFloor = 13,
118 		/**
119 		Return the input rounded up.
120 		*/
121 		mathCeil = 14,
122 		/**
123 		Return the input rounded to the nearest integer.
124 		*/
125 		mathRound = 15,
126 		/**
127 		Return the absolute value of the input.
128 		*/
129 		mathAbs = 16,
130 		/**
131 		Return the sign of the input, turning it into 1, -1, or 0. Useful to determine if the input is positive or negative.
132 		*/
133 		mathSign = 17,
134 		/**
135 		Return the input raised to a given power.
136 		*/
137 		mathPow = 18,
138 		/**
139 		Return the natural logarithm of the input. Note that this is not the typical base-10 logarithm function calculators use.
140 		*/
141 		mathLog = 19,
142 		/**
143 		Return the mathematical constant $(B e) raised to the specified power of the input. $(B e) has an approximate value of 2.71828.
144 		*/
145 		mathExp = 20,
146 		/**
147 		Return whether the input is NaN (Not a Number) or not. NaN is usually produced by dividing 0 by 0, though other ways exist.
148 		*/
149 		mathIsnan = 21,
150 		/**
151 		Return whether the input is an infinite floating-point number or not. Infinity is usually produced by dividing a number by 0, though other ways exist.
152 		*/
153 		mathIsinf = 22,
154 		/**
155 		Easing function, based on exponent. 0 is constant, 1 is linear, 0 to 1 is ease-in, 1+ is ease out. Negative values are in-out/out in.
156 		*/
157 		mathEase = 23,
158 		/**
159 		Return the number of digit places after the decimal that the first non-zero digit occurs.
160 		*/
161 		mathDecimals = 24,
162 		/**
163 		Return the input snapped to a given step.
164 		*/
165 		mathStepify = 25,
166 		/**
167 		Return a number linearly interpolated between the first two inputs, based on the third input. Uses the formula `a + (a - b) * t`.
168 		*/
169 		mathLerp = 26,
170 		/**
171 		
172 		*/
173 		mathInverseLerp = 27,
174 		/**
175 		
176 		*/
177 		mathRangeLerp = 28,
178 		/**
179 		Return the result of 'value' decreased by 'step' * 'amount'.
180 		*/
181 		mathDectime = 29,
182 		/**
183 		Randomize the seed (or the internal state) of the random number generator. Current implementation reseeds using a number based on time.
184 		*/
185 		mathRandomize = 30,
186 		/**
187 		Return a random 32 bits integer value. To obtain a random value between 0 to N (where N is smaller than 2^32 - 1), you can use it with the remainder function.
188 		*/
189 		mathRand = 31,
190 		/**
191 		Return a random floating-point value between 0 and 1. To obtain a random value between 0 to N, you can use it with multiplication.
192 		*/
193 		mathRandf = 32,
194 		/**
195 		Return a random floating-point value between the two inputs.
196 		*/
197 		mathRandom = 33,
198 		/**
199 		Set the seed for the random number generator.
200 		*/
201 		mathSeed = 34,
202 		/**
203 		Return a random value from the given seed, along with the new seed.
204 		*/
205 		mathRandseed = 35,
206 		/**
207 		Convert the input from degrees to radians.
208 		*/
209 		mathDeg2rad = 36,
210 		/**
211 		Convert the input from radians to degrees.
212 		*/
213 		mathRad2deg = 37,
214 		/**
215 		Convert the input from linear volume to decibel volume.
216 		*/
217 		mathLinear2db = 38,
218 		/**
219 		Convert the input from decibel volume to linear volume.
220 		*/
221 		mathDb2linear = 39,
222 		/**
223 		Converts a 2D point expressed in the polar coordinate system (a distance from the origin `r` and an angle `th`) to the cartesian coordinate system (x and y axis).
224 		*/
225 		mathPolar2cartesian = 40,
226 		/**
227 		Converts a 2D point expressed in the cartesian coordinate system (x and y axis) to the polar coordinate system (a distance from the origin and an angle).
228 		*/
229 		mathCartesian2polar = 41,
230 		/**
231 		
232 		*/
233 		mathWrap = 42,
234 		/**
235 		
236 		*/
237 		mathWrapf = 43,
238 		/**
239 		Return the greater of the two numbers, also known as their maximum.
240 		*/
241 		logicMax = 44,
242 		/**
243 		Return the lesser of the two numbers, also known as their minimum.
244 		*/
245 		logicMin = 45,
246 		/**
247 		Return the input clamped inside the given range, ensuring the result is never outside it. Equivalent to `min(max(input, range_low), range_high)`
248 		*/
249 		logicClamp = 46,
250 		/**
251 		Return the nearest power of 2 to the input.
252 		*/
253 		logicNearestPo2 = 47,
254 		/**
255 		Create a $(D WeakRef) from the input.
256 		*/
257 		objWeakref = 48,
258 		/**
259 		Create a $(D FuncRef) from the input.
260 		*/
261 		funcFuncref = 49,
262 		/**
263 		Convert between types.
264 		*/
265 		typeConvert = 50,
266 		/**
267 		Return the type of the input as an integer. Check $(D Variant.type) for the integers that might be returned.
268 		*/
269 		typeOf = 51,
270 		/**
271 		Checks if a type is registered in the $(D ClassDB).
272 		*/
273 		typeExists = 52,
274 		/**
275 		Return a character with the given ascii value.
276 		*/
277 		textChar = 53,
278 		/**
279 		Convert the input to a string.
280 		*/
281 		textStr = 54,
282 		/**
283 		Print the given string to the output window.
284 		*/
285 		textPrint = 55,
286 		/**
287 		Print the given string to the standard error output.
288 		*/
289 		textPrinterr = 56,
290 		/**
291 		Print the given string to the standard output, without adding a newline.
292 		*/
293 		textPrintraw = 57,
294 		/**
295 		Serialize a $(D Variant) to a string.
296 		*/
297 		varToStr = 58,
298 		/**
299 		Deserialize a $(D Variant) from a string serialized using $(D VAR_TO_STR).
300 		*/
301 		strToVar = 59,
302 		/**
303 		Serialize a $(D Variant) to a $(D PoolByteArray).
304 		*/
305 		varToBytes = 60,
306 		/**
307 		Deserialize a $(D Variant) from a $(D PoolByteArray) serialized using $(D VAR_TO_BYTES).
308 		*/
309 		bytesToVar = 61,
310 		/**
311 		Return the $(D Color) with the given name and alpha ranging from 0 to 1. Note: names are defined in color_names.inc.
312 		*/
313 		colorn = 62,
314 		/**
315 		The maximum value the $(D _function) property can have.
316 		*/
317 		funcMax = 63,
318 	}
319 	/// 
320 	enum Constants : int
321 	{
322 		mathSin = 0,
323 		mathCos = 1,
324 		mathTan = 2,
325 		mathSinh = 3,
326 		mathCosh = 4,
327 		mathTanh = 5,
328 		mathAsin = 6,
329 		mathAcos = 7,
330 		mathAtan = 8,
331 		mathAtan2 = 9,
332 		mathSqrt = 10,
333 		mathFmod = 11,
334 		mathFposmod = 12,
335 		mathFloor = 13,
336 		mathCeil = 14,
337 		mathRound = 15,
338 		mathAbs = 16,
339 		mathSign = 17,
340 		mathPow = 18,
341 		mathLog = 19,
342 		mathExp = 20,
343 		mathIsnan = 21,
344 		mathIsinf = 22,
345 		mathEase = 23,
346 		mathDecimals = 24,
347 		mathStepify = 25,
348 		mathLerp = 26,
349 		mathInverseLerp = 27,
350 		mathRangeLerp = 28,
351 		mathDectime = 29,
352 		mathRandomize = 30,
353 		mathRand = 31,
354 		mathRandf = 32,
355 		mathRandom = 33,
356 		mathSeed = 34,
357 		mathRandseed = 35,
358 		mathDeg2rad = 36,
359 		mathRad2deg = 37,
360 		mathLinear2db = 38,
361 		mathDb2linear = 39,
362 		mathPolar2cartesian = 40,
363 		mathCartesian2polar = 41,
364 		mathWrap = 42,
365 		mathWrapf = 43,
366 		logicMax = 44,
367 		logicMin = 45,
368 		logicClamp = 46,
369 		logicNearestPo2 = 47,
370 		objWeakref = 48,
371 		funcFuncref = 49,
372 		typeConvert = 50,
373 		typeOf = 51,
374 		typeExists = 52,
375 		textChar = 53,
376 		textStr = 54,
377 		textPrint = 55,
378 		textPrinterr = 56,
379 		textPrintraw = 57,
380 		varToStr = 58,
381 		strToVar = 59,
382 		varToBytes = 60,
383 		bytesToVar = 61,
384 		colorn = 62,
385 		funcMax = 63,
386 	}
387 	/**
388 	
389 	*/
390 	void setFunc(in long which)
391 	{
392 		checkClassBinding!(typeof(this))();
393 		ptrcall!(void)(_classBinding.setFunc, _godot_object, which);
394 	}
395 	/**
396 	
397 	*/
398 	VisualScriptBuiltinFunc.BuiltinFunc getFunc()
399 	{
400 		checkClassBinding!(typeof(this))();
401 		return ptrcall!(VisualScriptBuiltinFunc.BuiltinFunc)(_classBinding.getFunc, _godot_object);
402 	}
403 	/**
404 	The function to be executed.
405 	*/
406 	@property VisualScriptBuiltinFunc.BuiltinFunc _function()
407 	{
408 		return getFunc();
409 	}
410 	/// ditto
411 	@property void _function(long v)
412 	{
413 		setFunc(v);
414 	}
415 }