@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.
- package/README.md +19 -1
- package/gen/classes/ArrayOccluder3D.ts +1 -1
- package/gen/classes/CPUParticles2D.ts +3 -3
- package/gen/classes/CPUParticles3D.ts +3 -3
- package/gen/classes/CSGPolygon3D.ts +1 -1
- package/gen/classes/CollisionPolygon2D.ts +1 -1
- package/gen/classes/CollisionPolygon3D.ts +1 -1
- package/gen/classes/ColorPalette.ts +1 -1
- package/gen/classes/ConcavePolygonShape2D.ts +1 -1
- package/gen/classes/ConcavePolygonShape3D.ts +1 -1
- package/gen/classes/ConvexPolygonShape2D.ts +1 -1
- package/gen/classes/ConvexPolygonShape3D.ts +1 -1
- package/gen/classes/FontVariation.ts +1 -1
- package/gen/classes/Gradient.ts +1 -1
- package/gen/classes/Line2D.ts +1 -1
- package/gen/classes/MultiMesh.ts +4 -4
- package/gen/classes/NavigationMesh.ts +1 -1
- package/gen/classes/NavigationObstacle2D.ts +1 -1
- package/gen/classes/NavigationObstacle3D.ts +1 -1
- package/gen/classes/NavigationPathQueryResult2D.ts +1 -1
- package/gen/classes/NavigationPathQueryResult3D.ts +1 -1
- package/gen/classes/NavigationPolygon.ts +1 -1
- package/gen/classes/OccluderPolygon2D.ts +1 -1
- package/gen/classes/Polygon2D.ts +3 -3
- package/gen/classes/PolygonOccluder3D.ts +1 -1
- package/gen/classes/Window.ts +1 -1
- package/gen/index.ts +0 -3
- package/gen/utility-functions.ts +114 -114
- package/gen/value-types/AABB.ts +267 -277
- package/gen/value-types/Basis.ts +313 -264
- package/gen/value-types/Color.ts +398 -268
- package/gen/value-types/Plane.ts +121 -125
- package/gen/value-types/Projection.ts +178 -126
- package/gen/value-types/Quaternion.ts +180 -179
- package/gen/value-types/Rect2.ts +169 -171
- package/gen/value-types/Rect2i.ts +148 -150
- package/gen/value-types/Transform2D.ts +192 -194
- package/gen/value-types/Transform3D.ts +133 -126
- package/gen/value-types/Vector2.ts +370 -354
- package/gen/value-types/Vector2i.ts +192 -191
- package/gen/value-types/Vector3.ts +354 -354
- package/gen/value-types/Vector3i.ts +187 -192
- package/gen/value-types/Vector4.ts +263 -274
- package/gen/value-types/Vector4i.ts +187 -198
- package/gen/value-types/index.ts +16 -16
- package/package.json +20 -4
- package/src/debug.ts +30 -27
- package/src/index.ts +0 -2
- 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 {
|
|
4
|
+
import { _V } from '../../src/runtime.ts';
|
|
5
5
|
import type { GodotArray, GodotDictionary, Variant } from '../heap-types/index.ts';
|
|
6
|
-
import type { Vector4 } from '
|
|
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
|
|
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
|
-
* 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
|
+
|
package/gen/value-types/index.ts
CHANGED
|
@@ -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
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
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-
|
|
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-
|
|
46
|
-
"@ringozz/godot-windows-x86_64": "^4.7.2-
|
|
47
|
-
"@ringozz/godot-web-wasm32": "^4.7.2-
|
|
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,
|
|
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 =
|
|
112
|
-
(rect
|
|
113
|
-
(rect
|
|
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
|
|
190
|
-
const
|
|
191
|
-
const
|
|
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
|
-
|
|
219
|
-
const bx
|
|
220
|
-
|
|
221
|
-
const
|
|
222
|
-
const
|
|
223
|
-
const
|
|
224
|
-
const
|
|
225
|
-
const
|
|
226
|
-
const
|
|
227
|
-
const
|
|
228
|
-
const
|
|
229
|
-
const
|
|
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
|
|
303
|
-
pushRect(push,
|
|
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
|
|
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)),
|
|
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(
|
|
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
|
|
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;
|