@woosh/meep-engine 2.43.38 → 2.43.40

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 (60) hide show
  1. package/core/bvh2/aabb3/AABB3.js +72 -85
  2. package/core/bvh2/aabb3/serializeAABB3Encoded_v0.js +75 -0
  3. package/core/bvh2/serialization/serializeBinaryNodeToBinaryBuffer.js +1 -1
  4. package/core/collection/HashMap.js +16 -8
  5. package/core/color/Color.js +1 -1
  6. package/core/geom/3d/aabb/aabb3_matrix4_project.js +4 -0
  7. package/core/geom/ConicRay.js +1 -1
  8. package/core/geom/Quaternion.d.ts +7 -2
  9. package/core/geom/Quaternion.js +19 -3
  10. package/core/geom/Vector1.d.ts +19 -1
  11. package/core/geom/Vector1.js +11 -3
  12. package/core/geom/Vector2.d.ts +7 -0
  13. package/core/geom/Vector2.js +21 -4
  14. package/core/geom/Vector3.d.ts +4 -4
  15. package/core/geom/Vector3.js +29 -4
  16. package/core/geom/Vector4.d.ts +7 -2
  17. package/core/geom/Vector4.js +8 -8
  18. package/core/math/hash/computeHashFloatArray.js +1 -1
  19. package/core/math/hash/computeObjectHash.js +22 -22
  20. package/core/math/hash/computeObjectHash.spec.js +42 -0
  21. package/core/math/interval/NumericInterval.js +1 -1
  22. package/core/model/BoundedValue.js +1 -1
  23. package/core/model/node-graph/Connection.js +6 -6
  24. package/core/model/node-graph/DataType.js +13 -12
  25. package/core/model/node-graph/NodeGraph.js +30 -5
  26. package/core/model/node-graph/node/NodeDescription.js +14 -11
  27. package/core/model/node-graph/node/NodeDescription.spec.js +14 -0
  28. package/core/model/node-graph/node/NodeInstance.js +2 -2
  29. package/core/model/node-graph/node/parameter/NodeParameterDescription.js +1 -1
  30. package/core/model/reactive/model/terminal/ReactiveLiteralNumber.js +1 -1
  31. package/core/model/stat/LinearModifier.js +1 -1
  32. package/core/{math/hash → primitives/numbers}/computeHashFloat.js +0 -0
  33. package/core/{math/hash → primitives/numbers}/computeHashFloat.spec.js +0 -0
  34. package/engine/Engine.d.ts +1 -1
  35. package/engine/asset/loaders/material/computeMaterialHash.js +1 -1
  36. package/engine/asset/loaders/material/computeTextureHash.js +1 -1
  37. package/engine/ecs/animation/Animation.js +1 -1
  38. package/engine/ecs/animation/InverseKinematics.js +1 -1
  39. package/engine/ecs/dynamic_actions/actions/definition/WeightedRandomActionDescription.js +1 -1
  40. package/engine/ecs/gui/position/ViewportPosition.js +1 -1
  41. package/engine/ecs/transform/Transform.js +20 -8
  42. package/engine/graphics/ecs/animation/animator/AnimationClip.js +1 -1
  43. package/engine/graphics/ecs/animation/animator/AnimationNotification.js +1 -1
  44. package/engine/graphics/ecs/animation/animator/graph/AnimationGraph.js +1 -1
  45. package/engine/graphics/ecs/animation/animator/graph/definition/AnimationTransitionDefinition.js +1 -1
  46. package/engine/graphics/ecs/highlight/HighlightDefinition.js +1 -1
  47. package/engine/graphics/ecs/mesh/Mesh.js +1 -1
  48. package/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +2 -2
  49. package/engine/graphics/ecs/mesh-v2/render/adapters/InstancedRendererAdapter.js +4 -1
  50. package/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.js +1 -1
  51. package/engine/graphics/micron/render/PatchCacheKey.js +1 -1
  52. package/engine/graphics/particles/particular/engine/emitter/ParticleLayer.js +1 -1
  53. package/engine/graphics/render/buffer/slot/parameter/ProgramValueSlotParameter.js +1 -1
  54. package/engine/intelligence/behavior/Behavior.js +2 -35
  55. package/engine/intelligence/behavior/selector/WeightedElement.js +1 -1
  56. package/engine/plugin/EnginePlugin.js +6 -0
  57. package/engine/sound/ecs/emitter/SoundEmitter.js +1 -1
  58. package/engine/sound/ecs/emitter/SoundTrack.js +1 -1
  59. package/engine/ui/bindings/{DomElementManager.js → DomElementProcessorManager.js} +43 -18
  60. package/package.json +1 -1
@@ -39,6 +39,69 @@ export class AABB3 {
39
39
  this.setBounds(x0, y0, z0, x1, y1, z1);
40
40
  }
41
41
 
42
+ * [Symbol.iterator]() {
43
+
44
+ yield this.x0;
45
+ yield this.y0;
46
+ yield this.z0;
47
+
48
+ yield this.x1;
49
+ yield this.y1;
50
+ yield this.z1;
51
+
52
+ }
53
+
54
+ get 0() {
55
+ return this.x0;
56
+ }
57
+
58
+
59
+ get 1() {
60
+ return this.y0;
61
+ }
62
+
63
+ get 2() {
64
+ return this.z0;
65
+ }
66
+
67
+
68
+ get 3() {
69
+ return this.x1;
70
+ }
71
+
72
+
73
+ get 4() {
74
+ return this.y1;
75
+ }
76
+
77
+ get 5() {
78
+ return this.z1;
79
+ }
80
+
81
+ set 0(v) {
82
+ this.x0 = v;
83
+ }
84
+
85
+ set 1(v) {
86
+ this.y0 = v;
87
+ }
88
+
89
+ set 2(v) {
90
+ this.z0 = v;
91
+ }
92
+
93
+ set 3(v) {
94
+ this.x1 = v;
95
+ }
96
+
97
+ set 4(v) {
98
+ this.y1 = v;
99
+ }
100
+
101
+ set 5(v) {
102
+ this.z1 = v;
103
+ }
104
+
42
105
  /**
43
106
  *
44
107
  * @param {number} x
@@ -816,17 +879,17 @@ export class AABB3 {
816
879
  }
817
880
 
818
881
  /**
819
- *
820
- * @param {number} v
882
+ * Expands the box in all directions by the given amount
883
+ * @param {number} extra
821
884
  */
822
- grow(v) {
823
- this.x0 -= v;
824
- this.y0 -= v;
825
- this.z0 -= v;
885
+ grow(extra) {
886
+ this.x0 -= extra;
887
+ this.y0 -= extra;
888
+ this.z0 -= extra;
826
889
 
827
- this.x1 += v;
828
- this.y1 += v;
829
- this.z1 += v;
890
+ this.x1 += extra;
891
+ this.y1 += extra;
892
+ this.z1 += extra;
830
893
  }
831
894
 
832
895
  /**
@@ -847,82 +910,6 @@ export class AABB3 {
847
910
  }
848
911
 
849
912
 
850
- /**
851
- *
852
- * @param {BinaryBuffer} buffer
853
- * @param {AABB3} box
854
- * @param {number} x0
855
- * @param {number} y0
856
- * @param {number} z0
857
- * @param {number} x1
858
- * @param {number} y1
859
- * @param {number} z1
860
- */
861
- export function serializeAABB3Encoded_v0(buffer, box, x0, y0, z0, x1, y1, z1) {
862
- let header = 0;
863
-
864
- if (box.x0 === x0) {
865
- header |= 1;
866
- }
867
-
868
- if (box.x1 === x1) {
869
- header |= 2;
870
- }
871
-
872
- if (box.y0 === y0) {
873
- header |= 4;
874
- }
875
-
876
- if (box.y1 === y1) {
877
- header |= 8;
878
- }
879
-
880
- if (box.z0 === z0) {
881
- header |= 16;
882
- }
883
-
884
- if (box.z1 === z1) {
885
- header |= 32;
886
- }
887
-
888
- buffer.writeUint8(header);
889
-
890
- //compute value ranges
891
- const xD = x1 - x0;
892
- const yD = y1 - y0;
893
- const zD = z1 - z0;
894
-
895
- if ((header & 1) === 0) {
896
- const _x0 = (((box.x0 - x0) / xD) * 65535) | 0;
897
- buffer.writeUint16(_x0);
898
- }
899
-
900
- if ((header & 2) === 0) {
901
- const _x1 = (((box.x1 - x0) / xD) * 65535) | 0;
902
- buffer.writeUint16(_x1);
903
- }
904
-
905
- if ((header & 4) === 0) {
906
- const _y0 = (((box.y0 - y0) / yD) * 65535) | 0;
907
- buffer.writeUint16(_y0);
908
- }
909
-
910
- if ((header & 8) === 0) {
911
- const _y1 = (((box.y1 - y0) / yD) * 65535) | 0;
912
- buffer.writeUint16(_y1);
913
- }
914
-
915
- if ((header & 16) === 0) {
916
- const _z0 = (((box.z0 - z0) / zD) * 65535) | 0;
917
- buffer.writeUint16(_z0);
918
- }
919
-
920
- if ((header & 32) === 0) {
921
- const _z1 = (((box.z1 - z0) / zD) * 65535) | 0;
922
- buffer.writeUint16(_z1);
923
- }
924
- }
925
-
926
913
  /**
927
914
  * @readonly
928
915
  * @type {boolean}
@@ -0,0 +1,75 @@
1
+ /**
2
+ *
3
+ * @param {BinaryBuffer} buffer
4
+ * @param {AABB3} box
5
+ * @param {number} x0
6
+ * @param {number} y0
7
+ * @param {number} z0
8
+ * @param {number} x1
9
+ * @param {number} y1
10
+ * @param {number} z1
11
+ */
12
+ export function serializeAABB3Encoded_v0(buffer, box, x0, y0, z0, x1, y1, z1) {
13
+ let header = 0;
14
+
15
+ if (box.x0 === x0) {
16
+ header |= 1;
17
+ }
18
+
19
+ if (box.x1 === x1) {
20
+ header |= 2;
21
+ }
22
+
23
+ if (box.y0 === y0) {
24
+ header |= 4;
25
+ }
26
+
27
+ if (box.y1 === y1) {
28
+ header |= 8;
29
+ }
30
+
31
+ if (box.z0 === z0) {
32
+ header |= 16;
33
+ }
34
+
35
+ if (box.z1 === z1) {
36
+ header |= 32;
37
+ }
38
+
39
+ buffer.writeUint8(header);
40
+
41
+ //compute value ranges
42
+ const xD = x1 - x0;
43
+ const yD = y1 - y0;
44
+ const zD = z1 - z0;
45
+
46
+ if ((header & 1) === 0) {
47
+ const _x0 = (((box.x0 - x0) / xD) * 65535) | 0;
48
+ buffer.writeUint16(_x0);
49
+ }
50
+
51
+ if ((header & 2) === 0) {
52
+ const _x1 = (((box.x1 - x0) / xD) * 65535) | 0;
53
+ buffer.writeUint16(_x1);
54
+ }
55
+
56
+ if ((header & 4) === 0) {
57
+ const _y0 = (((box.y0 - y0) / yD) * 65535) | 0;
58
+ buffer.writeUint16(_y0);
59
+ }
60
+
61
+ if ((header & 8) === 0) {
62
+ const _y1 = (((box.y1 - y0) / yD) * 65535) | 0;
63
+ buffer.writeUint16(_y1);
64
+ }
65
+
66
+ if ((header & 16) === 0) {
67
+ const _z0 = (((box.z0 - z0) / zD) * 65535) | 0;
68
+ buffer.writeUint16(_z0);
69
+ }
70
+
71
+ if ((header & 32) === 0) {
72
+ const _z1 = (((box.z1 - z0) / zD) * 65535) | 0;
73
+ buffer.writeUint16(_z1);
74
+ }
75
+ }
@@ -1,5 +1,5 @@
1
- import { serializeAABB3Encoded_v0 } from "../aabb3/AABB3.js";
2
1
  import { serializeAABB3 } from "../aabb3/serializeAABB3.js";
2
+ import { serializeAABB3Encoded_v0 } from "../aabb3/serializeAABB3Encoded_v0.js";
3
3
 
4
4
  /**
5
5
  *
@@ -177,7 +177,7 @@ export class HashMap {
177
177
  // mix the input hash to minimize potential impact of poor hash function spread
178
178
  const mixed_hash = (hash >>> 16) ^ hash;
179
179
 
180
- // ensure index is non-negative
180
+ // force index to unsigned integer
181
181
  const index = mixed_hash >>> 0;
182
182
 
183
183
  return index % this.__bucket_count;
@@ -194,7 +194,9 @@ export class HashMap {
194
194
 
195
195
  assert.isFiniteNumber(bucket_index, 'hash');
196
196
 
197
- let bucket = this.records[bucket_index];
197
+ const records = this.records;
198
+
199
+ let bucket = records[bucket_index];
198
200
 
199
201
  if (bucket === undefined) {
200
202
 
@@ -202,7 +204,7 @@ export class HashMap {
202
204
 
203
205
  bucket = [];
204
206
 
205
- this.records[bucket_index] = bucket;
207
+ records[bucket_index] = bucket;
206
208
 
207
209
  } else {
208
210
 
@@ -218,7 +220,11 @@ export class HashMap {
218
220
 
219
221
  if (entryKey === key || this.keyEqualityFunction(entryKey, key)) {
220
222
 
223
+ // found record with matching key, replace the value
224
+
221
225
  entry.value = value;
226
+
227
+ // done, return
222
228
  return;
223
229
 
224
230
  }
@@ -237,7 +243,7 @@ export class HashMap {
237
243
  const load = new_size / this.__bucket_count;
238
244
 
239
245
  if (load > this.__load_factor) {
240
- // increase table size
246
+ // current load is too high, increase table size
241
247
  this.setBucketCount(this.__bucket_count * 2);
242
248
  }
243
249
  }
@@ -276,7 +282,9 @@ export class HashMap {
276
282
  }
277
283
 
278
284
  /**
285
+ * If key exists in the map - returns stored value, if it doesn't - invokes `compute` function and stores produced value in the map; then returns that value
279
286
  *
287
+ * Inspired by Java's implementation
280
288
  * @param {K} key
281
289
  * @param {function(K):V} compute
282
290
  * @param {*} [compute_context]
@@ -402,14 +410,14 @@ export class HashMap {
402
410
  */
403
411
  rebuild() {
404
412
 
405
- let h, i, l;
413
+ let string_bucket_index, i, l;
406
414
 
407
415
  const records = this.records;
408
416
 
409
- for (h in records) {
410
- const stored_bucket_index = parseInt(h);
417
+ for (string_bucket_index in records) {
418
+ const stored_bucket_index = parseInt(string_bucket_index);
411
419
 
412
- if (!records.hasOwnProperty(h)) {
420
+ if (!records.hasOwnProperty(string_bucket_index)) {
413
421
  continue;
414
422
  }
415
423
 
@@ -5,7 +5,7 @@ import { min2 } from "../math/min2.js";
5
5
  import { max2 } from "../math/max2.js";
6
6
  import { min3 } from "../math/min3.js";
7
7
  import { computeHashIntegerArray } from "../collection/array/computeHashIntegerArray.js";
8
- import { computeHashFloat } from "../math/hash/computeHashFloat.js";
8
+ import { computeHashFloat } from "../primitives/numbers/computeHashFloat.js";
9
9
  import { rgb2hsv } from "./rgb2hsv.js";
10
10
  import { rgb2uint24 } from "./rgb2uint24.js";
11
11
  import { clamp01 } from "../math/clamp01.js";
@@ -1,3 +1,5 @@
1
+ import { assert } from "../../../assert.js";
2
+
1
3
  /**
2
4
  * NOTE: Based on Transforming Axis-Aligned Bounding Boxes by Jim Arvo from "Graphics Gems", Academic Press, 1990
3
5
  * NOTE: {@link result} and {@link aabb} must be different objects
@@ -6,6 +8,8 @@
6
8
  * @param {number[]} matrix 4x4 matrix
7
9
  */
8
10
  export function aabb3_matrix4_project(result, aabb, matrix) {
11
+ assert.notEqual(result, aabb, 'input and output must not be the same for algorithm to work correctly');
12
+
9
13
  // extract translation from matrix
10
14
  result[0] = result[3] = matrix[12];
11
15
  result[1] = result[4] = matrix[13];
@@ -1,7 +1,7 @@
1
1
  import { assert } from "../assert.js";
2
2
  import Vector3 from "./Vector3.js";
3
3
  import { computeHashIntegerArray } from "../collection/array/computeHashIntegerArray.js";
4
- import { computeHashFloat } from "../math/hash/computeHashFloat.js";
4
+ import { computeHashFloat } from "../primitives/numbers/computeHashFloat.js";
5
5
  import { epsilonEquals } from "../math/epsilonEquals.js";
6
6
  import { EPSILON } from "../math/EPSILON.js";
7
7
 
@@ -13,6 +13,11 @@ export default class Quaternion {
13
13
  public z: number
14
14
  public w: number
15
15
 
16
+ 0: number
17
+ 1: number
18
+ 2: number
19
+ 3: number
20
+
16
21
  readonly onChanged: Signal<number, number, number, number, number, number, number, number>;
17
22
 
18
23
  set(x: number, y: number, z: number, w: number): void
@@ -61,9 +66,9 @@ export default class Quaternion {
61
66
 
62
67
  fromJSON(j: any): void
63
68
 
64
- readFromArray(array: ArrayLike<number>, offset: number): void
69
+ readFromArray(array: ArrayLike<number>, offset?: number): void
65
70
 
66
- writeToArray(array: ArrayLike<number>, offset: number): void
71
+ writeToArray(array: ArrayLike<number>, offset?: number): void
67
72
 
68
73
  asArray(): number[]
69
74
  }
@@ -11,7 +11,7 @@ import { lerp } from "../math/lerp.js";
11
11
  import Vector3 from "./Vector3.js";
12
12
  import { v3_dot } from "./v3_dot.js";
13
13
  import { min2 } from "../math/min2.js";
14
- import { computeHashFloat } from "../math/hash/computeHashFloat.js";
14
+ import { computeHashFloat } from "../primitives/numbers/computeHashFloat.js";
15
15
  import { epsilonEquals } from "../math/epsilonEquals.js";
16
16
  import { EPSILON } from "../math/EPSILON.js";
17
17
 
@@ -154,6 +154,22 @@ class Quaternion {
154
154
  return this.w;
155
155
  }
156
156
 
157
+ set 0(v) {
158
+ this.x = v;
159
+ }
160
+
161
+ set 1(v) {
162
+ this.y = v;
163
+ }
164
+
165
+ set 2(v) {
166
+ this.z = v;
167
+ }
168
+
169
+ set 3(v) {
170
+ this.w = v;
171
+ }
172
+
157
173
  /**
158
174
  *
159
175
  * @param {number} fx forward vector
@@ -1655,7 +1671,7 @@ class Quaternion {
1655
1671
  * @param {number[]} array
1656
1672
  * @param {number} offset
1657
1673
  */
1658
- readFromArray(array, offset) {
1674
+ readFromArray(array, offset=0) {
1659
1675
  this.set(
1660
1676
  array[offset],
1661
1677
  array[offset + 1],
@@ -1669,7 +1685,7 @@ class Quaternion {
1669
1685
  * @param {number[]} array
1670
1686
  * @param {number} offset
1671
1687
  */
1672
- writeToArray(array, offset) {
1688
+ writeToArray(array, offset=0) {
1673
1689
  array[offset] = this.x;
1674
1690
  array[offset + 1] = this.y;
1675
1691
  array[offset + 2] = this.z;
@@ -1,7 +1,17 @@
1
+ import Signal from "../events/signal/Signal";
2
+
1
3
  export default class Vector1 {
2
4
  x: number
3
5
 
4
- set(v: number)
6
+ 0: number
7
+
8
+ readonly onChanged: Signal<number,number>
9
+
10
+ constructor()
11
+
12
+ constructor(x: number)
13
+
14
+ set(v: number) : void
5
15
 
6
16
  getValue(): number
7
17
 
@@ -13,5 +23,13 @@ export default class Vector1 {
13
23
 
14
24
  process(callback: (x) => any): void
15
25
 
26
+ toJSON(): any
27
+
28
+ fromJSON(j: any): void
29
+
30
+ readFromArray(array: ArrayLike<number>, offset?: number): void
31
+
32
+ writeToArray(array: ArrayLike<number>, offset?: number): void
33
+
16
34
  asArray(): number[]
17
35
  }
@@ -6,7 +6,7 @@
6
6
  import { assert } from "../assert.js";
7
7
  import Signal from "../events/signal/Signal.js";
8
8
  import { clamp } from "../math/clamp.js";
9
- import { computeHashFloat } from "../math/hash/computeHashFloat.js";
9
+ import { computeHashFloat } from "../primitives/numbers/computeHashFloat.js";
10
10
 
11
11
 
12
12
  class Vector1 extends Number {
@@ -223,7 +223,7 @@ class Vector1 extends Number {
223
223
  * @param {number[]} array
224
224
  * @param {number} offset
225
225
  */
226
- readFromArray(array, offset) {
226
+ readFromArray(array, offset=0) {
227
227
  this.set(array[offset]);
228
228
  }
229
229
 
@@ -232,7 +232,7 @@ class Vector1 extends Number {
232
232
  * @param {number[]} array
233
233
  * @param {number} offset
234
234
  */
235
- writeToArray(array, offset) {
235
+ writeToArray(array, offset=0) {
236
236
  array[offset] = this.x;
237
237
  }
238
238
 
@@ -268,6 +268,14 @@ class Vector1 extends Number {
268
268
  return a.x - b.x;
269
269
  }
270
270
 
271
+ get 0() {
272
+ return this.x;
273
+ }
274
+
275
+ set 0(v) {
276
+ this.x = v;
277
+ }
278
+
271
279
  * [Symbol.iterator]() {
272
280
 
273
281
  yield this.x;
@@ -4,6 +4,9 @@ export default class Vector2 {
4
4
  x: number
5
5
  y: number
6
6
 
7
+ 0: number
8
+ 1: number
9
+
7
10
  public readonly onChanged: Signal<number, number, number, number>
8
11
 
9
12
  constructor(x: number, y: number)
@@ -36,5 +39,9 @@ export default class Vector2 {
36
39
 
37
40
  isZero(): boolean
38
41
 
42
+ readFromArray(array: ArrayLike<number>, offset?: number): void
43
+
44
+ writeToArray(array: ArrayLike<number>, offset?: number): void
45
+
39
46
  asArray():number[]
40
47
  }
@@ -46,7 +46,7 @@ class Vector2 {
46
46
  * @param {number[]} array
47
47
  * @param {number} offset
48
48
  */
49
- readFromArray(array, offset) {
49
+ readFromArray(array, offset = 0) {
50
50
  this.set(
51
51
  array[offset],
52
52
  array[offset + 1]
@@ -58,15 +58,15 @@ class Vector2 {
58
58
  * @param {number[]} array
59
59
  * @param {number} offset
60
60
  */
61
- writeToArray(array, offset) {
61
+ writeToArray(array, offset = 0) {
62
62
  array[offset] = this.x;
63
63
  array[offset + 1] = this.y;
64
64
  }
65
65
 
66
- asArray(){
66
+ asArray() {
67
67
  const r = [];
68
68
 
69
- this.writeToArray(r,0);
69
+ this.writeToArray(r, 0);
70
70
 
71
71
  return r;
72
72
  }
@@ -588,6 +588,23 @@ class Vector2 {
588
588
  return this.x === other.x && this.y === other.y;
589
589
  }
590
590
 
591
+ get 0() {
592
+ return this.x;
593
+ }
594
+
595
+ get 1() {
596
+ return this.y;
597
+ }
598
+
599
+ set 0(v) {
600
+ this.x = v;
601
+ }
602
+
603
+ set 1(v) {
604
+ this.y = v;
605
+ }
606
+
607
+
591
608
  * [Symbol.iterator]() {
592
609
 
593
610
  yield this.x;
@@ -47,7 +47,7 @@ export default class Vector3 implements Vector3Like {
47
47
 
48
48
  ceil(): void
49
49
 
50
- multiplyVectors(a:Vector3Like,b:Vector3Like):void
50
+ multiplyVectors(a: Vector3Like, b: Vector3Like): void
51
51
 
52
52
  _multiply(x: number, y: number, z: number): void
53
53
 
@@ -91,11 +91,11 @@ export default class Vector3 implements Vector3Like {
91
91
 
92
92
  toJSON(): any
93
93
 
94
- fromJSON(json: { x?: number, y?: number, z?: number })
94
+ fromJSON(json: { x?: number, y?: number, z?: number } | number): void
95
95
 
96
- readFromArray(array: number[] | ArrayLike<number>, offset: number): void
96
+ readFromArray(array: number[] | ArrayLike<number>, offset?: number): void
97
97
 
98
- writeToArray(array: number[] | ArrayLike<number>, offset: number): void
98
+ writeToArray(array: number[] | ArrayLike<number>, offset?: number): void
99
99
 
100
100
  asArray(): number[]
101
101
 
@@ -13,7 +13,7 @@ import { v3_length } from "./v3_length.js";
13
13
  import { v3_angle_between } from "./v3_angle_between.js";
14
14
  import { v3_lerp } from "./v3_lerp.js";
15
15
  import { v3_slerp } from "./v3_slerp.js";
16
- import { computeHashFloat } from "../math/hash/computeHashFloat.js";
16
+ import { computeHashFloat } from "../primitives/numbers/computeHashFloat.js";
17
17
  import { epsilonEquals } from "../math/epsilonEquals.js";
18
18
  import { EPSILON } from "../math/EPSILON.js";
19
19
 
@@ -38,7 +38,7 @@ class Vector3 {
38
38
  * @param {number[]} array
39
39
  * @param {number} offset
40
40
  */
41
- readFromArray(array, offset) {
41
+ readFromArray(array, offset=0) {
42
42
  this.set(
43
43
  array[offset],
44
44
  array[offset + 1],
@@ -51,7 +51,7 @@ class Vector3 {
51
51
  * @param {number[]} array
52
52
  * @param {number} offset
53
53
  */
54
- writeToArray(array, offset) {
54
+ writeToArray(array, offset=0) {
55
55
  array[offset] = this.x;
56
56
  array[offset + 1] = this.y;
57
57
  array[offset + 2] = this.z;
@@ -806,7 +806,7 @@ class Vector3 {
806
806
  }
807
807
 
808
808
  toString() {
809
- return `[x:${this.x},y:${this.y},z:${this.z}]`;
809
+ return `[x:${this.x}, y:${this.y}, z:${this.z}]`;
810
810
  }
811
811
 
812
812
  /**
@@ -952,6 +952,31 @@ class Vector3 {
952
952
  return hash;
953
953
  }
954
954
 
955
+
956
+ get 0() {
957
+ return this.x;
958
+ }
959
+
960
+ get 1() {
961
+ return this.y;
962
+ }
963
+
964
+ get 2() {
965
+ return this.z;
966
+ }
967
+
968
+ set 0(v) {
969
+ this.x = v;
970
+ }
971
+
972
+ set 1(v) {
973
+ this.y = v;
974
+ }
975
+
976
+ set 2(v) {
977
+ this.z = v;
978
+ }
979
+
955
980
  * [Symbol.iterator]() {
956
981
 
957
982
  yield this.x;