/
Vector3.hx
686 lines (556 loc) · 19.9 KB
/
Vector3.hx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
// Automatically generated Godot externs: DO NOT EDIT
// MIT licensed, see LICENSE.md
package godot;
import cs.system.*;
/**
3-element structure that can be used to represent positions in 3D space or any other pair of numeric values.
**/
#if doc_gen
@:struct
@:libType
@:csNative
@:native("Godot.Vector3")
@:autoBuild(godot.Godot.buildUserClass())
extern class Vector3 extends cs.system.ValueType implements cs.system.IEquatable_1<godot.Vector3> {
#else
@:forward
@:forwardStatics
extern abstract Vector3(Vector3_) from Vector3_ to Vector3_ {
#end
#if !doc_gen
/**
Constructs a new `godot.Vector3` with the given components.
@param x The vector's X component.
@param y The vector's Y component.
@param z The vector's Z component.
**/
public overload inline function new(x:Single, y:Single, z:Single) {
this = new Vector3_(x, y, z);
}
#end
#if !doc_gen
/**
Constructs a new `godot.Vector3` with the given components.
@param x The vector's X component.
@param y The vector's Y component.
@param z The vector's Z component.
**/
public overload inline function new() {
this = new Vector3_(0, 0, 0);
}
#end
#if !doc_gen
/**
Constructs a new `godot.Vector3` with the given components.
@param x The vector's X component.
@param y The vector's Y component.
@param z The vector's Z component.
**/
public overload inline function new(x:Single) {
this = new Vector3_(x, 0, 0);
}
#end
#if !doc_gen
/**
Constructs a new `godot.Vector3` with the given components.
@param x The vector's X component.
@param y The vector's Y component.
@param z The vector's Z component.
**/
public overload inline function new(x:Single, y:Single) {
this = new Vector3_(x, y, 0);
}
#end
#if !doc_gen
/**
Constructs a new `godot.Vector3` from an existing `godot.Vector3`.
@param v The existing `godot.Vector3`.
**/
public overload inline function new(v:godot.Vector3) {
this = new Vector3_(v);
}
#end
/**
Operator overload for `godot.Vector3` + `godot.Vector3`.
**/
@:op(A + B) static inline function op_Addition(left:godot.Vector3, right:godot.Vector3):godot.Vector3 {
return cs.Syntax.code("{0} + {1}", left, right);
}
/**
Operator overload for `godot.Vector3` - `godot.Vector3`.
**/
@:op(A - B) static inline function op_Subtraction(left:godot.Vector3, right:godot.Vector3):godot.Vector3 {
return cs.Syntax.code("{0} - {1}", left, right);
}
/**
Operator overload for -`godot.Vector3`.
**/
@:op(-A) static inline function op_UnaryNegation(vec:godot.Vector3):godot.Vector3 {
return cs.Syntax.code("-{0}", vec);
}
/**
Operator overload for `godot.Vector3` * ((global::System.Single)(`Float`)).
**/
@:op(A * B) static inline overload function op_Multiply(vec:godot.Vector3, scale:Float):godot.Vector3 {
return cs.Syntax.code("{0} * ((global::System.Single)({1}))", vec, scale);
}
/**
Operator overload for ((global::System.Single)(`Float`)) * `godot.Vector3`.
**/
@:op(A * B) static inline overload function op_Multiply(scale:Float, vec:godot.Vector3):godot.Vector3 {
return cs.Syntax.code("((global::System.Single)({0})) * {1}", scale, vec);
}
/**
Operator overload for `godot.Vector3` * `godot.Vector3`.
**/
@:op(A * B) static inline overload function op_Multiply(left:godot.Vector3, right:godot.Vector3):godot.Vector3 {
return cs.Syntax.code("{0} * {1}", left, right);
}
/**
Operator overload for `godot.Vector3` / ((global::System.Single)(`Float`)).
**/
@:op(A / B) static inline overload function op_Division(vec:godot.Vector3, divisor:Float):godot.Vector3 {
return cs.Syntax.code("{0} / ((global::System.Single)({1}))", vec, divisor);
}
/**
Operator overload for `godot.Vector3` / `godot.Vector3`.
**/
@:op(A / B) static inline overload function op_Division(vec:godot.Vector3, divisorv:godot.Vector3):godot.Vector3 {
return cs.Syntax.code("{0} / {1}", vec, divisorv);
}
/**
Operator overload for `godot.Vector3` % ((global::System.Single)(`Float`)).
**/
@:op(A % B) static inline overload function op_Modulus(vec:godot.Vector3, divisor:Float):godot.Vector3 {
return cs.Syntax.code("{0} % ((global::System.Single)({1}))", vec, divisor);
}
/**
Operator overload for `godot.Vector3` % `godot.Vector3`.
**/
@:op(A % B) static inline overload function op_Modulus(vec:godot.Vector3, divisorv:godot.Vector3):godot.Vector3 {
return cs.Syntax.code("{0} % {1}", vec, divisorv);
}
/**
Operator overload for `godot.Vector3` == `godot.Vector3`.
**/
@:op(A == B) static inline function op_Equality(left:godot.Vector3, right:godot.Vector3):Bool {
return cs.Syntax.code("{0} == {1}", left, right);
}
/**
Operator overload for `godot.Vector3` != `godot.Vector3`.
**/
@:op(A != B) static inline function op_Inequality(left:godot.Vector3, right:godot.Vector3):Bool {
return cs.Syntax.code("{0} != {1}", left, right);
}
/**
Operator overload for `godot.Vector3` < `godot.Vector3`.
**/
@:op(A < B) static inline function op_LessThan(left:godot.Vector3, right:godot.Vector3):Bool {
return cs.Syntax.code("{0} < {1}", left, right);
}
/**
Operator overload for `godot.Vector3` > `godot.Vector3`.
**/
@:op(A > B) static inline function op_GreaterThan(left:godot.Vector3, right:godot.Vector3):Bool {
return cs.Syntax.code("{0} > {1}", left, right);
}
/**
Operator overload for `godot.Vector3` <= `godot.Vector3`.
**/
@:op(A <= B) static inline function op_LessThanOrEqual(left:godot.Vector3, right:godot.Vector3):Bool {
return cs.Syntax.code("{0} <= {1}", left, right);
}
/**
Operator overload for `godot.Vector3` >= `godot.Vector3`.
**/
@:op(A >= B) static inline function op_GreaterThanOrEqual(left:godot.Vector3, right:godot.Vector3):Bool {
return cs.Syntax.code("{0} >= {1}", left, right);
}
#if !doc_gen
}
@:struct
@:libType
@:csNative
@:native("Godot.Vector3")
@:autoBuild(godot.Godot.buildUserClass())
extern class Vector3_ extends cs.system.ValueType implements cs.system.IEquatable_1<godot.Vector3> {
#end
/**
Back unit vector. Represents the local direction of back,
and the global direction of south.
Value: Equivalent to `new Vector3(0, 0, 1)`.
**/
@:native("Back")
public static var BACK(default, never):godot.Vector3;
/**
Forward unit vector. Represents the local direction of forward,
and the global direction of north.
Value: Equivalent to `new Vector3(0, 0, -1)`.
**/
@:native("Forward")
public static var FORWARD(default, never):godot.Vector3;
/**
Left unit vector. Represents the local direction of left,
and the global direction of west.
Value: Equivalent to `new Vector3(-1, 0, 0)`.
**/
@:native("Left")
public static var LEFT(default, never):godot.Vector3;
/**
Right unit vector. Represents the local direction of right,
and the global direction of east.
Value: Equivalent to `new Vector3(1, 0, 0)`.
**/
@:native("Right")
public static var RIGHT(default, never):godot.Vector3;
/**
Down unit vector.
Value: Equivalent to `new Vector3(0, -1, 0)`.
**/
@:native("Down")
public static var DOWN(default, never):godot.Vector3;
/**
Up unit vector.
Value: Equivalent to `new Vector3(0, 1, 0)`.
**/
@:native("Up")
public static var UP(default, never):godot.Vector3;
/**
Infinity vector, a vector with all components set to `godot.Mathf.INF`.
Value: Equivalent to `new Vector3(Mathf.Inf, Mathf.Inf, Mathf.Inf)`.
**/
@:native("Inf")
public static var INF(default, never):godot.Vector3;
/**
Deprecated, please use a negative sign with `godot.Vector3.one` instead.
Value: Equivalent to `new Vector3(-1, -1, -1)`.
**/
@:native("NegOne")
public static var NEG_ONE(default, never):godot.Vector3;
/**
One vector, a vector with all components set to `1`.
Value: Equivalent to `new Vector3(1, 1, 1)`.
**/
@:native("One")
public static var ONE(default, never):godot.Vector3;
/**
Zero vector, a vector with all components set to `0`.
Value: Equivalent to `new Vector3(0, 0, 0)`.
**/
@:native("Zero")
public static var ZERO(default, never):godot.Vector3;
/**
The vector's Z component. Also accessible by using the index position `[2]`.
**/
@:native("z")
public var z:Single;
/**
The vector's Y component. Also accessible by using the index position `[1]`.
**/
@:native("y")
public var y:Single;
/**
The vector's X component. Also accessible by using the index position `[0]`.
**/
@:native("x")
public var x:Single;
/**
Returns a new vector with all components in absolute values (i.e. positive).
@returns A vector with `godot.Mathf.abs` called on each component.
**/
@:native("Abs")
public function abs():godot.Vector3;
/**
Returns the unsigned minimum angle to the given vector, in radians.
@param to The other vector to compare this vector to.
@returns The unsigned angle between the two vectors, in radians.
**/
@:native("AngleTo")
public function angleTo(to:godot.Vector3):Single;
/**
Returns this vector "bounced off" from a plane defined by the given normal.
@param normal The normal vector defining the plane to bounce off. Must be normalized.
@returns The bounced vector.
**/
@:native("Bounce")
public function bounce(normal:godot.Vector3):godot.Vector3;
/**
Returns a new vector with all components rounded up (towards positive infinity).
@returns A vector with `godot.Mathf.ceil` called on each component.
**/
@:native("Ceil")
public function ceil():godot.Vector3;
/**
Returns the cross product of this vector and `b`.
@param b The other vector.
@returns The cross product vector.
**/
@:native("Cross")
public function cross(b:godot.Vector3):godot.Vector3;
/**
Performs a cubic interpolation between vectors `preA`, this vector,
`b`, and `postB`, by the given amount `weight`.
@param b The destination vector.
@param preA A vector before this vector.
@param postB A vector after `b`.
@param weight A value on the range of 0.0 to 1.0, representing the amount of interpolation.
@returns The interpolated vector.
**/
@:native("CubicInterpolate")
public function cubicInterpolate(b:godot.Vector3, preA:godot.Vector3, postB:godot.Vector3, weight:Single):godot.Vector3;
/**
Returns the normalized vector pointing from this vector to `b`.
@param b The other vector to point towards.
@returns The direction from this vector to `b`.
**/
@:native("DirectionTo")
public function directionTo(b:godot.Vector3):godot.Vector3;
/**
Returns the squared distance between this vector and `b`.
This method runs faster than `godot.Vector3.distanceTo`, so prefer it if
you need to compare vectors or need the squared distance for some formula.
@param b The other vector to use.
@returns The squared distance between the two vectors.
**/
@:native("DistanceSquaredTo")
public function distanceSquaredTo(b:godot.Vector3):Single;
/**
Returns the distance between this vector and `b`.
@see `godot.Vector3.distanceSquaredTo`
@param b The other vector to use.
@returns The distance between the two vectors.
**/
@:native("DistanceTo")
public function distanceTo(b:godot.Vector3):Single;
/**
Returns the dot product of this vector and `b`.
@param b The other vector to use.
@returns The dot product of the two vectors.
**/
@:native("Dot")
public function dot(b:godot.Vector3):Single;
/**
Returns a new vector with all components rounded down (towards negative infinity).
@returns A vector with `godot.Mathf.floor` called on each component.
**/
@:native("Floor")
public function floor():godot.Vector3;
/**
Returns the inverse of this vector. This is the same as `new Vector3(1 / v.x, 1 / v.y, 1 / v.z)`.
@returns The inverse of this vector.
**/
@:native("Inverse")
public function inverse():godot.Vector3;
/**
Returns `true` if the vector is normalized, and `false` otherwise.
@returns A `bool` indicating whether or not the vector is normalized.
**/
@:native("IsNormalized")
public function isNormalized():Bool;
/**
Returns the length (magnitude) of this vector.
@see `godot.Vector3.lengthSquared`
@returns The length of this vector.
**/
@:native("Length")
public function length():Single;
/**
Returns the squared length (squared magnitude) of this vector.
This method runs faster than `godot.Vector3.length`, so prefer it if
you need to compare vectors or need the squared length for some formula.
@returns The squared length of this vector.
**/
@:native("LengthSquared")
public function lengthSquared():Single;
/**
Returns the result of the linear interpolation between
this vector and `to` by amount `weight`.
@param to The destination vector for interpolation.
@param weight A value on the range of 0.0 to 1.0, representing the amount of interpolation.
@returns The resulting vector of the interpolation.
**/
@:native("LinearInterpolate")
public overload function linearInterpolate(to:godot.Vector3, weight:Single):godot.Vector3;
/**
Returns the result of the linear interpolation between
this vector and `to` by the vector amount `weight`.
@param to The destination vector for interpolation.
@param weight A vector with components on the range of 0.0 to 1.0, representing the amount of interpolation.
@returns The resulting vector of the interpolation.
**/
@:native("LinearInterpolate")
public overload function linearInterpolate(to:godot.Vector3, weight:godot.Vector3):godot.Vector3;
/**
Returns the axis of the vector's largest value. See `godot.Vector3_Axis`.
If all components are equal, this method returns `godot.Vector3_Axis.x`.
@returns The index of the largest axis.
**/
@:native("MaxAxis")
public function maxAxis():godot.Vector3_Axis;
/**
Returns the axis of the vector's smallest value. See `godot.Vector3_Axis`.
If all components are equal, this method returns `godot.Vector3_Axis.z`.
@returns The index of the smallest axis.
**/
@:native("MinAxis")
public function minAxis():godot.Vector3_Axis;
/**
Moves this vector toward `to` by the fixed `delta` amount.
@param to The vector to move towards.
@param delta The amount to move towards by.
@returns The resulting vector.
**/
@:native("MoveToward")
public function moveToward(to:godot.Vector3, delta:Single):godot.Vector3;
/**
Returns the vector scaled to unit length. Equivalent to `v / v.Length()`.
@returns A normalized version of the vector.
**/
@:native("Normalized")
public function normalized():godot.Vector3;
/**
Returns the outer product with `b`.
@param b The other vector.
@returns A `godot.Basis` representing the outer product matrix.
**/
@:native("Outer")
public function outer(b:godot.Vector3):godot.Basis;
/**
Returns a vector composed of the `godot.Mathf.posMod` of this vector's components
and `mod`.
@param mod A value representing the divisor of the operation.
@returns
A vector with each component `godot.Mathf.posMod` by `mod`.
**/
@:native("PosMod")
public overload function posMod(mod:Single):godot.Vector3;
/**
Returns a vector composed of the `godot.Mathf.posMod` of this vector's components
and `modv`'s components.
@param modv A vector representing the divisors of the operation.
@returns
A vector with each component `godot.Mathf.posMod` by `modv`'s components.
**/
@:native("PosMod")
public overload function posMod(modv:godot.Vector3):godot.Vector3;
/**
Returns this vector projected onto another vector `onNormal`.
@param onNormal The vector to project onto.
@returns The projected vector.
**/
@:native("Project")
public function project(onNormal:godot.Vector3):godot.Vector3;
/**
Returns this vector reflected from a plane defined by the given `normal`.
@param normal The normal vector defining the plane to reflect from. Must be normalized.
@returns The reflected vector.
**/
@:native("Reflect")
public function reflect(normal:godot.Vector3):godot.Vector3;
/**
Rotates this vector around a given `axis` vector by `phi` radians.
The `axis` vector must be a normalized vector.
@param axis The vector to rotate around. Must be normalized.
@param phi The angle to rotate by, in radians.
@returns The rotated vector.
**/
@:native("Rotated")
public function rotated(axis:godot.Vector3, phi:Single):godot.Vector3;
/**
Returns this vector with all components rounded to the nearest integer,
with halfway cases rounded towards the nearest multiple of two.
@returns The rounded vector.
**/
@:native("Round")
public function round():godot.Vector3;
@:native("Set")
public overload function set(x:Single, y:Single, z:Single):Void;
@:native("Set")
public overload function set(v:godot.Vector3):Void;
/**
Returns a vector with each component set to one or negative one, depending
on the signs of this vector's components, or zero if the component is zero,
by calling `godot.Mathf.sign` on each component.
@returns A vector with all components as either `1`, `-1`, or `0`.
**/
@:native("Sign")
public function sign():godot.Vector3;
/**
Returns the signed angle to the given vector, in radians.
The sign of the angle is positive in a counter-clockwise
direction and negative in a clockwise direction when viewed
from the side specified by the `axis`.
@param to The other vector to compare this vector to.
@param axis The reference axis to use for the angle sign.
@returns The signed angle between the two vectors, in radians.
**/
@:native("SignedAngleTo")
public function signedAngleTo(to:godot.Vector3, axis:godot.Vector3):Single;
/**
Returns the result of the spherical linear interpolation between
this vector and `to` by amount `weight`.
Note: Both vectors must be normalized.
@param to The destination vector for interpolation. Must be normalized.
@param weight A value on the range of 0.0 to 1.0, representing the amount of interpolation.
@returns The resulting vector of the interpolation.
**/
@:native("Slerp")
public function slerp(to:godot.Vector3, weight:Single):godot.Vector3;
/**
Returns this vector slid along a plane defined by the given `normal`.
@param normal The normal vector defining the plane to slide on.
@returns The slid vector.
**/
@:native("Slide")
public function slide(normal:godot.Vector3):godot.Vector3;
/**
Returns this vector with each component snapped to the nearest multiple of `step`.
This can also be used to round to an arbitrary number of decimals.
@param step A vector value representing the step size to snap to.
@returns The snapped vector.
**/
@:native("Snapped")
public function snapped(step:godot.Vector3):godot.Vector3;
/**
Returns a diagonal matrix with the vector as main diagonal.
This is equivalent to a `godot.Basis` with no rotation or shearing and
this vector's components set as the scale.
@returns A `godot.Basis` with the vector as its main diagonal.
**/
@:native("ToDiagonalMatrix")
public function toDiagonalMatrix():godot.Basis;
/**
Constructs a new `godot.Vector3` with the given components.
@param x The vector's X component.
@param y The vector's Y component.
@param z The vector's Z component.
**/
@:native("new")
public overload function new(x:Single#if doc_gen = 0 #end, y:Single#if doc_gen = 0 #end, z:Single#if doc_gen = 0 #end):Void;
/**
Constructs a new `godot.Vector3` from an existing `godot.Vector3`.
@param v The existing `godot.Vector3`.
**/
@:native("new")
public overload function new(v:godot.Vector3):Void;
/**
Returns `true` if this vector and `other` are approximately equal,
by running `godot.Mathf.isEqualApprox` on each component.
@param other The other vector to compare.
@returns Whether or not the vectors are approximately equal.
**/
@:native("IsEqualApprox")
public function isEqualApprox(other:godot.Vector3):Bool;
/**
Converts this `godot.Vector3` to a string.
@returns A string representation of this vector.
**/
@:native("ToString")
public overload function toString():std.String;
/**
Converts this `godot.Vector3` to a string with the given `format`.
@returns A string representation of this vector.
**/
@:native("ToString")
public overload function toString(format:std.String):std.String;
}