@ringozz/godot 4.7.2-583 → 4.7.2-592

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +19 -1
  2. package/gen/classes/ArrayOccluder3D.ts +1 -1
  3. package/gen/classes/CPUParticles2D.ts +3 -3
  4. package/gen/classes/CPUParticles3D.ts +3 -3
  5. package/gen/classes/CSGPolygon3D.ts +1 -1
  6. package/gen/classes/CollisionPolygon2D.ts +1 -1
  7. package/gen/classes/CollisionPolygon3D.ts +1 -1
  8. package/gen/classes/ColorPalette.ts +1 -1
  9. package/gen/classes/ConcavePolygonShape2D.ts +1 -1
  10. package/gen/classes/ConcavePolygonShape3D.ts +1 -1
  11. package/gen/classes/ConvexPolygonShape2D.ts +1 -1
  12. package/gen/classes/ConvexPolygonShape3D.ts +1 -1
  13. package/gen/classes/FontVariation.ts +1 -1
  14. package/gen/classes/Gradient.ts +1 -1
  15. package/gen/classes/Line2D.ts +1 -1
  16. package/gen/classes/MultiMesh.ts +4 -4
  17. package/gen/classes/NavigationMesh.ts +1 -1
  18. package/gen/classes/NavigationObstacle2D.ts +1 -1
  19. package/gen/classes/NavigationObstacle3D.ts +1 -1
  20. package/gen/classes/NavigationPathQueryResult2D.ts +1 -1
  21. package/gen/classes/NavigationPathQueryResult3D.ts +1 -1
  22. package/gen/classes/NavigationPolygon.ts +1 -1
  23. package/gen/classes/OccluderPolygon2D.ts +1 -1
  24. package/gen/classes/Polygon2D.ts +3 -3
  25. package/gen/classes/PolygonOccluder3D.ts +1 -1
  26. package/gen/classes/Window.ts +1 -1
  27. package/gen/index.ts +0 -3
  28. package/gen/utility-functions.ts +114 -114
  29. package/gen/value-types/AABB.ts +267 -277
  30. package/gen/value-types/Basis.ts +313 -264
  31. package/gen/value-types/Color.ts +398 -268
  32. package/gen/value-types/Plane.ts +121 -125
  33. package/gen/value-types/Projection.ts +178 -126
  34. package/gen/value-types/Quaternion.ts +180 -179
  35. package/gen/value-types/Rect2.ts +169 -171
  36. package/gen/value-types/Rect2i.ts +148 -150
  37. package/gen/value-types/Transform2D.ts +192 -194
  38. package/gen/value-types/Transform3D.ts +133 -126
  39. package/gen/value-types/Vector2.ts +370 -354
  40. package/gen/value-types/Vector2i.ts +192 -191
  41. package/gen/value-types/Vector3.ts +354 -354
  42. package/gen/value-types/Vector3i.ts +187 -192
  43. package/gen/value-types/Vector4.ts +263 -274
  44. package/gen/value-types/Vector4i.ts +187 -198
  45. package/gen/value-types/index.ts +16 -16
  46. package/package.json +20 -4
  47. package/src/debug.ts +30 -27
  48. package/src/index.ts +0 -2
  49. package/src/runtime.ts +16 -7
@@ -1,208 +1,197 @@
1
1
  // Auto-generated from extension_api.json - DO NOT EDIT
2
2
  // Generated by dev/codegen.ts
3
3
 
4
- import { GodotVar, _C, _R, _get, _set } from '../../src/runtime.ts';
4
+ import { _V } from '../../src/runtime.ts';
5
5
  import type { GodotArray, GodotDictionary, Variant } from '../heap-types/index.ts';
6
- import type { Vector4 } from '../value-types/index.ts';
6
+ import type { Vector4 } from './index.ts';
7
7
 
8
8
  /**
9
9
  * A 4-element structure that can be used to represent 4D grid coordinates or any other quadruplet of integers.
10
10
  * It uses integer coordinates and is therefore preferable to {@link Vector4} when exact precision is required. Note that the values are limited to 32 bits, and unlike {@link Vector4} this cannot be configured with an engine build option. Use {@link int} or {@link PackedInt64Array} if 64-bit values are needed.
11
11
  * **Note:** In a boolean context, a Vector4i will evaluate to `false` if it's equal to `Vector4i(0, 0, 0, 0)`. Otherwise, a Vector4i will always evaluate to `true`.
12
12
  */
13
- export class Vector4i extends GodotVar {
14
- /**
15
- * The vector's X component. Also accessible by using the index position `[0]`.
16
- */
17
- get x(): number { return _get(this, 14941) as number; }
18
- set x(v: number) { _set(this, 14941, v); }
19
-
20
- /**
21
- * The vector's Y component. Also accessible by using the index position `[1]`.
22
- */
23
- get y(): number { return _get(this, 14952) as number; }
24
- set y(v: number) { _set(this, 14952, v); }
25
-
26
- /**
27
- * The vector's Z component. Also accessible by using the index position `[2]`.
28
- */
29
- get z(): number { return _get(this, 14956) as number; }
30
- set z(v: number) { _set(this, 14956, v); }
31
-
32
- /**
33
- * The vector's W component. Also accessible by using the index position `[3]`.
34
- */
35
- get w(): number { return _get(this, 14833) as number; }
36
- set w(v: number) { _set(this, 14833, v); }
37
-
38
- constructor();
39
- constructor(from: Vector4i);
40
- constructor(from: Vector4);
41
- constructor(x: number, y: number, z: number, w: number);
42
- constructor(...args: any[]) { super(13, ...args); }
43
-
44
- /**
45
- * Returns the axis of the vector's lowest value. See `AXIS_*` constants. If all components are equal, this method returns {@link AXIS_W}.
46
- */
47
- minAxisIndex(): number { return _C(this, 8911) as number; }
48
-
49
- /**
50
- * Returns the axis of the vector's highest value. See `AXIS_*` constants. If all components are equal, this method returns {@link AXIS_X}.
51
- */
52
- maxAxisIndex(): number { return _C(this, 8806) as number; }
53
-
54
- /**
55
- * Returns the length (magnitude) of this vector.
56
- */
57
- length(): number { return _C(this, 8546) as number; }
58
-
59
- /**
60
- * Returns the squared length (squared magnitude) of this vector.
61
- * This method runs faster than {@link length}, so prefer it if you need to compare vectors or need the squared distance for some formula.
62
- */
63
- lengthSquared(): number { return _C(this, 8547) as number; }
64
-
65
- /**
66
- * Returns a new vector with each component set to `1` if it's positive, `-1` if it's negative, and `0` if it's zero. The result is identical to calling {@link sign} on each component.
67
- */
68
- sign(): Vector4i { return _C(this, 13597) as Vector4i; }
69
-
70
- /**
71
- * Returns a new vector with all components in absolute values (i.e. positive).
72
- */
73
- abs(): Vector4i { return _C(this, 1053) as Vector4i; }
74
-
75
- /**
76
- * Returns a new vector with all components clamped between the components of `min` and `max`, by running {@link clamp} on each component.
77
- */
78
- clamp(min: Vector4i, max: Vector4i): Vector4i { return _C(this, 2202, min, max) as Vector4i; }
79
-
80
- /**
81
- * Returns a new vector with all components clamped between `min` and `max`, by running {@link clamp} on each component.
82
- */
83
- clampi(min: number, max: number): Vector4i { return _C(this, 2206, min, max) as Vector4i; }
84
-
85
- /**
86
- * Returns a new vector with each component snapped to the closest multiple of the corresponding component in `step`.
87
- */
88
- snapped(step: Vector4i): Vector4i { return _C(this, 13674, step) as Vector4i; }
89
-
90
- /**
91
- * Returns a new vector with each component snapped to the closest multiple of `step`.
92
- */
93
- snappedi(step: number): Vector4i { return _C(this, 13676, step) as Vector4i; }
94
-
95
- /**
96
- * Returns the component-wise minimum of this and `with`, equivalent to `Vector4i(mini(x, with.x), mini(y, with.y), mini(z, with.z), mini(w, with.w))`.
97
- */
98
- min(_with: Vector4i): Vector4i { return _C(this, 8910, _with) as Vector4i; }
99
-
100
- /**
101
- * Returns the component-wise minimum of this and `with`, equivalent to `Vector4i(mini(x, with), mini(y, with), mini(z, with), mini(w, with))`.
102
- */
103
- mini(_with: number): Vector4i { return _C(this, 8922, _with) as Vector4i; }
104
-
105
- /**
106
- * Returns the component-wise maximum of this and `with`, equivalent to `Vector4i(maxi(x, with.x), maxi(y, with.y), maxi(z, with.z), maxi(w, with.w))`.
107
- */
108
- max(_with: Vector4i): Vector4i { return _C(this, 8804, _with) as Vector4i; }
109
-
110
- /**
111
- * Returns the component-wise maximum of this and `with`, equivalent to `Vector4i(maxi(x, with), maxi(y, with), maxi(z, with), maxi(w, with))`.
112
- */
113
- maxi(_with: number): Vector4i { return _C(this, 8840, _with) as Vector4i; }
114
-
115
- /**
116
- * Returns the [Euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance) between this vector and `to`.
117
- */
118
- distanceTo(to: Vector4i): number { return _C(this, 2850, to) as number; }
119
-
120
- /**
121
- * Returns the squared [Euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance) between this vector and `to`.
122
- * This method runs faster than {@link distanceTo}, so prefer it if you need to compare vectors or need the squared distance for some formula.
123
- */
124
- distanceSquaredTo(to: Vector4i): number { return _C(this, 2849, to) as number; }
125
-
126
- equals(other: Variant | Vector4i): boolean { return _C(this, -1, other) as boolean; }
127
-
128
- notEquals(other: Variant | Vector4i): boolean { return _C(this, -2, other) as boolean; }
129
-
130
- /**
131
- * Returns the negative value of the {@link Vector4i}. This is the same as writing `Vector4i(-v.x, -v.y, -v.z, -v.w)`. This operation flips the direction of the vector while keeping the same magnitude.
132
- */
133
- neg(): Vector4i { return _C(this, -11, undefined) as Vector4i; }
134
-
135
- /**
136
- * Returns the same value as if the `+` was not there. Unary `+` does nothing, but sometimes it can make your code more readable.
137
- */
138
- pos(): Vector4i { return _C(this, -12, undefined) as Vector4i; }
139
-
140
- not(): boolean { return _C(this, -24, undefined) as boolean; }
141
-
142
- /**
143
- * Multiplies each component of the {@link Vector4i} by the given {@link int}.
144
- */
145
- mul(other: number | Vector4i): Vector4i { return _C(this, -9, other) as Vector4i; }
146
-
147
- /**
148
- * Divides each component of the {@link Vector4i} by the given {@link int}.
149
- */
150
- div(other: number | Vector4i): Vector4i { return _C(this, -10, other) as Vector4i; }
151
-
152
- /**
153
- * Gets the remainder of each component of the {@link Vector4i} with the given {@link int}. This operation uses truncated division, which is often not desired as it does not work well with negative numbers. Consider using {@link posmod} instead if you want to handle negative numbers.
154
- *
155
- * ```text
156
- *
157
- * print(Vector4i(10, -20, 30, -40) % 7) # Prints (3, -6, 2, -5)
158
- *
159
- * ```
160
- */
161
- mod(other: number | Vector4i): Vector4i { return _C(this, -13, other) as Vector4i; }
162
-
163
- /**
164
- * Compares two {@link Vector4i} vectors by first checking if the X value of the left vector is less than the X value of the `right` vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, Z values of the two vectors, and then with the W values. This operator is useful for sorting vectors.
165
- */
166
- lessThan(other: Vector4i): boolean { return _C(this, -3, other) as boolean; }
167
-
168
- /**
169
- * Compares two {@link Vector4i} vectors by first checking if the X value of the left vector is less than or equal to the X value of the `right` vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, Z values of the two vectors, and then with the W values. This operator is useful for sorting vectors.
170
- */
171
- lessThanOrEqual(other: Vector4i): boolean { return _C(this, -4, other) as boolean; }
172
-
173
- /**
174
- * Compares two {@link Vector4i} vectors by first checking if the X value of the left vector is greater than the X value of the `right` vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, Z values of the two vectors, and then with the W values. This operator is useful for sorting vectors.
175
- */
176
- greaterThan(other: Vector4i): boolean { return _C(this, -5, other) as boolean; }
177
-
178
- /**
179
- * Compares two {@link Vector4i} vectors by first checking if the X value of the left vector is greater than or equal to the X value of the `right` vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, Z values of the two vectors, and then with the W values. This operator is useful for sorting vectors.
180
- */
181
- greaterThanOrEqual(other: Vector4i): boolean { return _C(this, -6, other) as boolean; }
182
-
183
- /**
184
- * Adds each component of the {@link Vector4i} by the components of the given {@link Vector4i}.
185
- *
186
- * ```text
187
- *
188
- * print(Vector4i(10, 20, 30, 40) + Vector4i(3, 4, 5, 6)) # Prints (13, 24, 35, 46)
189
- *
190
- * ```
191
- */
192
- add(other: Vector4i): Vector4i { return _C(this, -7, other) as Vector4i; }
193
-
194
- /**
195
- * Subtracts each component of the {@link Vector4i} by the components of the given {@link Vector4i}.
196
- *
197
- * ```text
198
- *
199
- * print(Vector4i(10, 20, 30, 40) - Vector4i(3, 4, 5, 6)) # Prints (7, 16, 25, 34)
200
- *
201
- * ```
202
- */
203
- sub(other: Vector4i): Vector4i { return _C(this, -8, other) as Vector4i; }
204
-
205
- contains(other: GodotDictionary | GodotArray): boolean { return _C(this, -25, other) as boolean; }
206
-
207
- static readonly name = _R(13, Vector4i);
208
- }
13
+ export type Vector4i = [x: number, y: number, z: number, w: number];
14
+
15
+ /**
16
+ * Returns the axis of the vector's lowest value. See `AXIS_*` constants. If all components are equal, this method returns {@link AXIS_W}.
17
+ */
18
+ export function minAxisIndex(self: Vector4i): number { return _V(13, 8911, self) as number; }
19
+
20
+ /**
21
+ * Returns the axis of the vector's highest value. See `AXIS_*` constants. If all components are equal, this method returns {@link AXIS_X}.
22
+ */
23
+ export function maxAxisIndex(self: Vector4i): number { return _V(13, 8806, self) as number; }
24
+
25
+ /**
26
+ * Returns the length (magnitude) of this vector.
27
+ */
28
+ export function length(self: Vector4i): number { return _V(13, 8546, self) as number; }
29
+
30
+ /**
31
+ * Returns the squared length (squared magnitude) of this vector.
32
+ * This method runs faster than {@link length}, so prefer it if you need to compare vectors or need the squared distance for some formula.
33
+ */
34
+ export function lengthSquared(self: Vector4i): number { return _V(13, 8547, self) as number; }
35
+
36
+ /**
37
+ * Returns a new vector with each component set to `1` if it's positive, `-1` if it's negative, and `0` if it's zero. The result is identical to calling {@link sign} on each component.
38
+ */
39
+ export function sign(self: Vector4i): Vector4i { return _V(13, 13597, self) as Vector4i; }
40
+
41
+ /**
42
+ * Returns a new vector with all components in absolute values (i.e. positive).
43
+ */
44
+ export function abs(self: Vector4i): Vector4i { return _V(13, 1053, self) as Vector4i; }
45
+
46
+ /**
47
+ * Returns a new vector with all components clamped between the components of `min` and `max`, by running {@link clamp} on each component.
48
+ */
49
+ export function clamp(self: Vector4i, min: Vector4i, max: Vector4i): Vector4i { return _V(13, 2202, self, min, max) as Vector4i; }
50
+
51
+ /**
52
+ * Returns a new vector with all components clamped between `min` and `max`, by running {@link clamp} on each component.
53
+ */
54
+ export function clampi(self: Vector4i, min: number, max: number): Vector4i { return _V(13, 2206, self, min, max) as Vector4i; }
55
+
56
+ /**
57
+ * Returns a new vector with each component snapped to the closest multiple of the corresponding component in `step`.
58
+ */
59
+ export function snapped(self: Vector4i, step: Vector4i): Vector4i { return _V(13, 13674, self, step) as Vector4i; }
60
+
61
+ /**
62
+ * Returns a new vector with each component snapped to the closest multiple of `step`.
63
+ */
64
+ export function snappedi(self: Vector4i, step: number): Vector4i { return _V(13, 13676, self, step) as Vector4i; }
65
+
66
+ /**
67
+ * Returns the component-wise minimum of this and `with`, equivalent to `Vector4i(mini(x, with.x), mini(y, with.y), mini(z, with.z), mini(w, with.w))`.
68
+ */
69
+ export function min(self: Vector4i, _with: Vector4i): Vector4i { return _V(13, 8910, self, _with) as Vector4i; }
70
+
71
+ /**
72
+ * Returns the component-wise minimum of this and `with`, equivalent to `Vector4i(mini(x, with), mini(y, with), mini(z, with), mini(w, with))`.
73
+ */
74
+ export function mini(self: Vector4i, _with: number): Vector4i { return _V(13, 8922, self, _with) as Vector4i; }
75
+
76
+ /**
77
+ * Returns the component-wise maximum of this and `with`, equivalent to `Vector4i(maxi(x, with.x), maxi(y, with.y), maxi(z, with.z), maxi(w, with.w))`.
78
+ */
79
+ export function max(self: Vector4i, _with: Vector4i): Vector4i { return _V(13, 8804, self, _with) as Vector4i; }
80
+
81
+ /**
82
+ * Returns the component-wise maximum of this and `with`, equivalent to `Vector4i(maxi(x, with), maxi(y, with), maxi(z, with), maxi(w, with))`.
83
+ */
84
+ export function maxi(self: Vector4i, _with: number): Vector4i { return _V(13, 8840, self, _with) as Vector4i; }
85
+
86
+ /**
87
+ * Returns the [Euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance) between this vector and `to`.
88
+ */
89
+ export function distanceTo(self: Vector4i, to: Vector4i): number { return _V(13, 2850, self, to) as number; }
90
+
91
+ /**
92
+ * Returns the squared [Euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance) between this vector and `to`.
93
+ * This method runs faster than {@link distanceTo}, so prefer it if you need to compare vectors or need the squared distance for some formula.
94
+ */
95
+ export function distanceSquaredTo(self: Vector4i, to: Vector4i): number { return _V(13, 2849, self, to) as number; }
96
+
97
+ export function equals(a: Vector4i, b: Variant | Vector4i): boolean { return _V(13, -1, a, b) as boolean; }
98
+
99
+ export function notEquals(a: Vector4i, b: Variant | Vector4i): boolean { return _V(13, -2, a, b) as boolean; }
100
+
101
+ /**
102
+ * Returns the negative value of the {@link Vector4i}. This is the same as writing `Vector4i(-v.x, -v.y, -v.z, -v.w)`. This operation flips the direction of the vector while keeping the same magnitude.
103
+ */
104
+ export function neg(self: Vector4i): Vector4i { return _V(13, -11, self, undefined) as Vector4i; }
105
+
106
+ /**
107
+ * Returns the same value as if the `+` was not there. Unary `+` does nothing, but sometimes it can make your code more readable.
108
+ */
109
+ export function pos(self: Vector4i): Vector4i { return _V(13, -12, self, undefined) as Vector4i; }
110
+
111
+ export function not(self: Vector4i): boolean { return _V(13, -24, self, undefined) as boolean; }
112
+
113
+ /**
114
+ * Multiplies each component of the {@link Vector4i} by the given {@link int}.
115
+ */
116
+ export function mul(a: Vector4i, b: number | Vector4i): Vector4i { return _V(13, -9, a, b) as Vector4i; }
117
+
118
+ /**
119
+ * Divides each component of the {@link Vector4i} by the given {@link int}.
120
+ */
121
+ export function div(a: Vector4i, b: number | Vector4i): Vector4i { return _V(13, -10, a, b) as Vector4i; }
122
+
123
+ /**
124
+ * Gets the remainder of each component of the {@link Vector4i} with the given {@link int}. This operation uses truncated division, which is often not desired as it does not work well with negative numbers. Consider using {@link posmod} instead if you want to handle negative numbers.
125
+ *
126
+ * ```text
127
+ *
128
+ * print(Vector4i(10, -20, 30, -40) % 7) # Prints (3, -6, 2, -5)
129
+ *
130
+ * ```
131
+ */
132
+ export function mod(a: Vector4i, b: number | Vector4i): Vector4i { return _V(13, -13, a, b) as Vector4i; }
133
+
134
+ /**
135
+ * Compares two {@link Vector4i} vectors by first checking if the X value of the left vector is less than the X value of the `right` vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, Z values of the two vectors, and then with the W values. This operator is useful for sorting vectors.
136
+ */
137
+ export function lessThan(a: Vector4i, b: Vector4i): boolean { return _V(13, -3, a, b) as boolean; }
138
+
139
+ /**
140
+ * Compares two {@link Vector4i} vectors by first checking if the X value of the left vector is less than or equal to the X value of the `right` vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, Z values of the two vectors, and then with the W values. This operator is useful for sorting vectors.
141
+ */
142
+ export function lessThanOrEqual(a: Vector4i, b: Vector4i): boolean { return _V(13, -4, a, b) as boolean; }
143
+
144
+ /**
145
+ * Compares two {@link Vector4i} vectors by first checking if the X value of the left vector is greater than the X value of the `right` vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, Z values of the two vectors, and then with the W values. This operator is useful for sorting vectors.
146
+ */
147
+ export function greaterThan(a: Vector4i, b: Vector4i): boolean { return _V(13, -5, a, b) as boolean; }
148
+
149
+ /**
150
+ * Compares two {@link Vector4i} vectors by first checking if the X value of the left vector is greater than or equal to the X value of the `right` vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, Z values of the two vectors, and then with the W values. This operator is useful for sorting vectors.
151
+ */
152
+ export function greaterThanOrEqual(a: Vector4i, b: Vector4i): boolean { return _V(13, -6, a, b) as boolean; }
153
+
154
+ /**
155
+ * Adds each component of the {@link Vector4i} by the components of the given {@link Vector4i}.
156
+ *
157
+ * ```text
158
+ *
159
+ * print(Vector4i(10, 20, 30, 40) + Vector4i(3, 4, 5, 6)) # Prints (13, 24, 35, 46)
160
+ *
161
+ * ```
162
+ */
163
+ export function add(a: Vector4i, b: Vector4i): Vector4i { return _V(13, -7, a, b) as Vector4i; }
164
+
165
+ /**
166
+ * Subtracts each component of the {@link Vector4i} by the components of the given {@link Vector4i}.
167
+ *
168
+ * ```text
169
+ *
170
+ * print(Vector4i(10, 20, 30, 40) - Vector4i(3, 4, 5, 6)) # Prints (7, 16, 25, 34)
171
+ *
172
+ * ```
173
+ */
174
+ export function sub(a: Vector4i, b: Vector4i): Vector4i { return _V(13, -8, a, b) as Vector4i; }
175
+
176
+ export function contains(a: Vector4i, b: GodotDictionary | GodotArray): boolean { return _V(13, -25, a, b) as boolean; }
177
+
178
+ /**
179
+ * Constructs a default-initialized {@link Vector4i} with all components set to `0`.
180
+ */
181
+ export function create(): Vector4i { return _V(13, -4096, 0) as Vector4i; }
182
+
183
+ /**
184
+ * Constructs a {@link Vector4i} as a copy of the given {@link Vector4i}.
185
+ */
186
+ export function fromVector4i(from: Vector4i): Vector4i { return _V(13, -4096, 1, from) as Vector4i; }
187
+
188
+ /**
189
+ * Constructs a new {@link Vector4i} from the given {@link Vector4} by truncating components' fractional parts (rounding towards zero). For a different behavior consider passing the result of {@link Vector4.ceil}, {@link Vector4.floor} or {@link Vector4.round} to this constructor instead.
190
+ */
191
+ export function fromVector4(from: Vector4): Vector4i { return _V(13, -4096, 2, from) as Vector4i; }
192
+
193
+ /**
194
+ * Returns a {@link Vector4i} with the given components.
195
+ */
196
+ export function fromXYZW(x: number, y: number, z: number, w: number): Vector4i { return _V(13, -4096, 3, x, y, z, w) as Vector4i; }
197
+
@@ -1,19 +1,19 @@
1
1
  // Auto-generated from extension_api.json - DO NOT EDIT
2
2
  // Generated by dev/codegen.ts
3
3
 
4
- export * from './Vector2.ts';
5
- export * from './Vector2i.ts';
6
- export * from './Rect2.ts';
7
- export * from './Rect2i.ts';
8
- export * from './Vector3.ts';
9
- export * from './Vector3i.ts';
10
- export * from './Transform2D.ts';
11
- export * from './Vector4.ts';
12
- export * from './Vector4i.ts';
13
- export * from './Plane.ts';
14
- export * from './Quaternion.ts';
15
- export * from './AABB.ts';
16
- export * from './Basis.ts';
17
- export * from './Transform3D.ts';
18
- export * from './Projection.ts';
19
- export * from './Color.ts';
4
+ export type { Vector2 } from './Vector2.ts';
5
+ export type { Vector2i } from './Vector2i.ts';
6
+ export type { Rect2 } from './Rect2.ts';
7
+ export type { Rect2i } from './Rect2i.ts';
8
+ export type { Vector3 } from './Vector3.ts';
9
+ export type { Vector3i } from './Vector3i.ts';
10
+ export type { Transform2D } from './Transform2D.ts';
11
+ export type { Vector4 } from './Vector4.ts';
12
+ export type { Vector4i } from './Vector4i.ts';
13
+ export type { Plane } from './Plane.ts';
14
+ export type { Quaternion } from './Quaternion.ts';
15
+ export type { AABB } from './AABB.ts';
16
+ export type { Basis } from './Basis.ts';
17
+ export type { Transform3D } from './Transform3D.ts';
18
+ export type { Projection } from './Projection.ts';
19
+ export type { Color } from './Color.ts';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ringozz/godot",
3
3
  "author": "Vladimir Davidovich",
4
- "version": "4.7.2-583",
4
+ "version": "4.7.2-592",
5
5
  "description": "Node-API bindings for Godot Engine — call Godot classes from JavaScript",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -25,6 +25,22 @@
25
25
  "./load": "./src/load.ts",
26
26
  "./debug": "./src/debug.ts",
27
27
  "./preload": "./src/preload.ts",
28
+ "./AABB": "./gen/value-types/AABB.ts",
29
+ "./Basis": "./gen/value-types/Basis.ts",
30
+ "./Color": "./gen/value-types/Color.ts",
31
+ "./Plane": "./gen/value-types/Plane.ts",
32
+ "./Projection": "./gen/value-types/Projection.ts",
33
+ "./Quaternion": "./gen/value-types/Quaternion.ts",
34
+ "./Rect2": "./gen/value-types/Rect2.ts",
35
+ "./Rect2i": "./gen/value-types/Rect2i.ts",
36
+ "./Transform2D": "./gen/value-types/Transform2D.ts",
37
+ "./Transform3D": "./gen/value-types/Transform3D.ts",
38
+ "./Vector2": "./gen/value-types/Vector2.ts",
39
+ "./Vector2i": "./gen/value-types/Vector2i.ts",
40
+ "./Vector3": "./gen/value-types/Vector3.ts",
41
+ "./Vector3i": "./gen/value-types/Vector3i.ts",
42
+ "./Vector4": "./gen/value-types/Vector4.ts",
43
+ "./Vector4i": "./gen/value-types/Vector4i.ts",
28
44
  "./*": "./gen/classes/*.ts"
29
45
  },
30
46
  "files": [
@@ -42,9 +58,9 @@
42
58
  "precision": "single"
43
59
  },
44
60
  "optionalDependencies": {
45
- "@ringozz/godot-macos-arm64": "^4.7.2-583",
46
- "@ringozz/godot-windows-x86_64": "^4.7.2-583",
47
- "@ringozz/godot-web-wasm32": "^4.7.2-583"
61
+ "@ringozz/godot-macos-arm64": "^4.7.2-592",
62
+ "@ringozz/godot-windows-x86_64": "^4.7.2-592",
63
+ "@ringozz/godot-web-wasm32": "^4.7.2-592"
48
64
  },
49
65
  "peerDependencies": {
50
66
  "@types/bun": "*"
package/src/debug.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  Copyright (c) Vladimir Davidovich. All rights reserved.
3
3
  ***********************************************************************/
4
4
 
5
- import { MouseButton, Rect2, str, varToStr, Vector2, Vector3 } from './index.ts';
5
+ import { MouseButton, str, varToStr } from './index.ts';
6
6
  import { CanvasItem } from '../gen/classes/CanvasItem.ts';
7
7
  import { ClassDB } from '../gen/classes/ClassDB.ts';
8
8
  import { Control } from '../gen/classes/Control.ts';
@@ -14,6 +14,7 @@ import { Node3D } from '../gen/classes/Node3D.ts';
14
14
  import { OS } from '../gen/classes/OS.ts';
15
15
  import { SceneTree } from '../gen/classes/SceneTree.ts';
16
16
  import { Time } from '../gen/classes/Time.ts';
17
+ import type { Vector2 } from '../gen/value-types/Vector2.ts';
17
18
  import type { Viewport } from '../gen/classes/Viewport.ts';
18
19
  import type { Window } from '../gen/classes/Window.ts';
19
20
 
@@ -108,10 +109,10 @@ export function click(path: string): string | null {
108
109
  if (!(node instanceof Control)) return null;
109
110
  const rect = node.getGlobalRect();
110
111
  const scale = root.contentScaleFactor;
111
- const position = new Vector2(
112
- (rect.position.x + rect.size.x / 2) * scale,
113
- (rect.position.y + rect.size.y / 2) * scale,
114
- );
112
+ const position: Vector2 = [
113
+ (rect[0] + rect[2] / 2) * scale,
114
+ (rect[1] + rect[3] / 2) * scale,
115
+ ];
115
116
  const press = (down: boolean) => {
116
117
  const event = new InputEventMouseButton();
117
118
  event.position = position;
@@ -186,9 +187,10 @@ type BoundsCollect = (node: any, push: Push, viewport: Viewport) => void;
186
187
 
187
188
  /** Affine 2D point mapper from a transform's basis/origin, optionally scaled. */
188
189
  function makeAffine(t: any, scale = 1): (x: number, y: number) => [number, number] {
189
- const tox = t.origin.x, toy = t.origin.y;
190
- const txx = t.x.x, txy = t.x.y;
191
- const tyx = t.y.x, tyy = t.y.y;
190
+ const [tx, ty, to] = t;
191
+ const tox = to[0], toy = to[1];
192
+ const txx = tx[0], txy = tx[1];
193
+ const tyx = ty[0], tyy = ty[1];
192
194
  return (x, y) => [(tox + txx * x + tyx * y) * scale, (toy + txy * x + tyy * y) * scale];
193
195
  }
194
196
 
@@ -215,18 +217,19 @@ function cssBounds(): { add(x: number, y: number): void; rect(): [number, number
215
217
 
216
218
  /** World-space AABB (min, max) of a local AABB under its global transform, or `null` when degenerate. */
217
219
  function worldAabb(aabb: any, gt: any): [number, number, number, number, number, number] | null {
218
- if (aabb.size.x === 0 && aabb.size.y === 0 && aabb.size.z === 0) return null;
219
- const bx = gt.basis.x, by = gt.basis.y, bz = gt.basis.z;
220
- const cx = aabb.position.x + aabb.size.x / 2;
221
- const cy = aabb.position.y + aabb.size.y / 2;
222
- const cz = aabb.position.z + aabb.size.z / 2;
223
- const ex = Math.hypot(bx.x, bx.y, bx.z) * aabb.size.x / 2;
224
- const ey = Math.hypot(by.x, by.y, by.z) * aabb.size.y / 2;
225
- const ez = Math.hypot(bz.x, bz.y, bz.z) * aabb.size.z / 2;
226
- const ox = gt.origin.x, oy = gt.origin.y, oz = gt.origin.z;
227
- const wx = ox + bx.x * cx + by.x * cy + bz.x * cz;
228
- const wy = oy + bx.y * cx + by.y * cy + bz.y * cz;
229
- const wz = oz + bx.z * cx + by.z * cy + bz.z * cz;
220
+ const [position, size] = aabb;
221
+ const [bx, by, bz, origin] = gt;
222
+ if (size[0] === 0 && size[1] === 0 && size[2] === 0) return null;
223
+ const cx = position[0] + size[0] / 2;
224
+ const cy = position[1] + size[1] / 2;
225
+ const cz = position[2] + size[2] / 2;
226
+ const ex = Math.hypot(bx[0], bx[1], bx[2]) * size[0] / 2;
227
+ const ey = Math.hypot(by[0], by[1], by[2]) * size[1] / 2;
228
+ const ez = Math.hypot(bz[0], bz[1], bz[2]) * size[2] / 2;
229
+ const ox = origin[0], oy = origin[1], oz = origin[2];
230
+ const wx = ox + bx[0] * cx + by[0] * cy + bz[0] * cz;
231
+ const wy = oy + bx[1] * cx + by[1] * cy + bz[1] * cz;
232
+ const wz = oz + bx[2] * cx + by[2] * cy + bz[2] * cz;
230
233
  return [wx - ex, wy - ey, wz - ez, wx + ex, wy + ey, wz + ez];
231
234
  }
232
235
 
@@ -299,14 +302,14 @@ function pushRect(emit: (x: number, y: number) => void, x0: number, y0: number,
299
302
 
300
303
  const canvasItemBounds: BoundsCollect = (node, push) => {
301
304
  if (node instanceof Control) {
302
- const rc = node.getGlobalRect();
303
- pushRect(push, rc.position.x, rc.position.y, rc.position.x + rc.size.x, rc.position.y + rc.size.y);
305
+ const [x, y, w, h] = node.getGlobalRect();
306
+ pushRect(push, x, y, x + w, y + h);
304
307
  return;
305
308
  }
306
309
  if (typeof node.getRect !== 'function') return;
307
- const rect = node.getRect() as Rect2;
310
+ const [x, y, w, h] = node.getRect() as [number, number, number, number];
308
311
  const xform = makeAffine(node.getScreenTransform());
309
- pushRect((px, py) => push(...xform(px, py)), rect.position.x, rect.position.y, rect.position.x + rect.size.x, rect.position.y + rect.size.y);
312
+ pushRect((px, py) => push(...xform(px, py)), x, y, x + w, y + h);
310
313
  };
311
314
 
312
315
  const node3dBounds: BoundsCollect = (node, push, viewport) => {
@@ -316,12 +319,12 @@ const node3dBounds: BoundsCollect = (node, push, viewport) => {
316
319
  if (!box) return;
317
320
  const [minX, minY, minZ, maxX, maxY, maxZ] = box;
318
321
  for (let i = 0; i < 8; i++) {
319
- const s = camera.unprojectPosition(new Vector3(
322
+ const s = camera.unprojectPosition([
320
323
  i & 1 ? maxX : minX,
321
324
  i & 2 ? maxY : minY,
322
325
  i & 4 ? maxZ : minZ,
323
- ));
324
- push(s.x, s.y);
326
+ ]);
327
+ push(s[0], s[1]);
325
328
  }
326
329
  };
327
330
 
package/src/index.ts CHANGED
@@ -3,7 +3,6 @@
3
3
  ***********************************************************************/
4
4
 
5
5
  export * from '../gen/index.ts';
6
- import * as ValueTypes from '../gen/value-types/index.ts';
7
6
  import * as HeapTypes from '../gen/heap-types/index.ts';
8
7
  import { Engine } from '../gen/classes/Engine.ts';
9
8
  import { GodotInstance } from '../gen/classes/GodotInstance.ts';
@@ -13,7 +12,6 @@ import { gc } from './debug.ts';
13
12
  import { cancelAnimationFrame, cleanupHooks, getGodot, requestAnimationFrame } from './runtime.ts';
14
13
 
15
14
  // ---- make sure these classes are not tree-shaked ----
16
- void ValueTypes;
17
15
  void HeapTypes;
18
16
  void GodotInstance;
19
17
  void SceneTree;