@woosh/meep-engine 2.113.16 → 2.115.0

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 (138) hide show
  1. package/build/meep.cjs +96 -55
  2. package/build/meep.min.js +1 -1
  3. package/build/meep.module.js +96 -55
  4. package/editor/ecs/component/editors/Sampler2DEditor.js +3 -3
  5. package/package.json +1 -1
  6. package/src/core/binary/clz32.d.ts +7 -0
  7. package/src/core/binary/clz32.d.ts.map +1 -0
  8. package/src/core/binary/clz32.js +37 -0
  9. package/src/core/binary/is_data_url.d.ts.map +1 -1
  10. package/src/core/binary/is_data_url.js +1 -0
  11. package/src/core/binary/makeArrayBuffer.d.ts.map +1 -1
  12. package/src/core/binary/makeArrayBuffer.js +1 -0
  13. package/src/core/binary/msb_32.d.ts +7 -1
  14. package/src/core/binary/msb_32.d.ts.map +1 -1
  15. package/src/core/binary/msb_32.js +3 -12
  16. package/src/core/collection/RingBuffer.d.ts +1 -1
  17. package/src/core/collection/RingBuffer.js +1 -1
  18. package/src/core/collection/array/array_filter_by_multiple.d.ts +2 -0
  19. package/src/core/collection/array/array_filter_by_multiple.d.ts.map +1 -1
  20. package/src/core/collection/array/array_filter_by_multiple.js +11 -4
  21. package/src/core/collection/array/array_group_by.d.ts +10 -0
  22. package/src/core/collection/array/array_group_by.d.ts.map +1 -0
  23. package/src/core/collection/array/{groupArrayBy.js → array_group_by.js} +3 -3
  24. package/src/core/collection/array/array_sort_quick.d.ts +13 -0
  25. package/src/core/collection/array/array_sort_quick.d.ts.map +1 -0
  26. package/src/core/collection/array/{arrayQuickSort.js → array_sort_quick.js} +5 -1
  27. package/src/core/collection/array/combine_hash.js +1 -1
  28. package/src/core/{primitives → collection}/array/compareArrays.d.ts.map +1 -1
  29. package/src/core/{primitives → collection}/array/computeIntegerArrayHash.d.ts.map +1 -1
  30. package/src/core/{primitives → collection}/array/computeStridedArrayHash.d.ts.map +1 -1
  31. package/src/core/{primitives → collection}/array/computeStridedIntegerArrayHash.d.ts.map +1 -1
  32. package/src/core/collection/array/randomMultipleFromArray.d.ts +6 -6
  33. package/src/core/collection/array/randomMultipleFromArray.d.ts.map +1 -1
  34. package/src/core/collection/array/randomMultipleFromArray.js +5 -5
  35. package/src/core/collection/array/typed/sparse_typed_array_hash.js +1 -1
  36. package/src/core/collection/array/typed/typedArrayConstructorByInstance.d.ts.map +1 -0
  37. package/src/core/geom/2d/Rectangle.d.ts.map +1 -1
  38. package/src/core/geom/2d/Rectangle.js +18 -5
  39. package/src/core/geom/2d/aabb/aabb2_overlap_exists.d.ts.map +1 -1
  40. package/src/core/geom/2d/aabb/aabb2_overlap_exists.js +4 -1
  41. package/src/core/geom/2d/convex-hull/fixed_convex_hull_humus.d.ts +3 -3
  42. package/src/core/geom/2d/convex-hull/fixed_convex_hull_humus.d.ts.map +1 -1
  43. package/src/core/geom/2d/convex-hull/fixed_convex_hull_humus.js +11 -4
  44. package/src/core/geom/2d/convex-hull/fixed_convex_hull_relaxation.js +2 -2
  45. package/src/core/geom/2d/convex-hull/orientation3_array.js +2 -2
  46. package/src/core/geom/2d/intersect_ray_2d.d.ts.map +1 -1
  47. package/src/core/geom/2d/intersect_ray_2d.js +5 -5
  48. package/src/core/geom/2d/{compute_triangle_area_2d.d.ts → triangle2d_compute_area.d.ts} +2 -2
  49. package/src/core/geom/2d/triangle2d_compute_area.d.ts.map +1 -0
  50. package/src/core/geom/2d/{compute_triangle_area_2d.js → triangle2d_compute_area.js} +1 -1
  51. package/src/core/geom/2d/triangle2d_contains_point.d.ts +14 -0
  52. package/src/core/geom/2d/triangle2d_contains_point.d.ts.map +1 -0
  53. package/src/core/geom/2d/triangle2d_contains_point.js +39 -0
  54. package/src/core/geom/2d/triangle2d_get_barycentric.d.ts +2 -2
  55. package/src/core/geom/2d/triangle2d_get_barycentric.d.ts.map +1 -1
  56. package/src/core/geom/2d/triangle2d_get_barycentric.js +1 -1
  57. package/src/core/geom/Vector2.d.ts.map +1 -1
  58. package/src/core/geom/Vector2.js +2 -2
  59. package/src/core/math/bessel_3.d.ts +1 -1
  60. package/src/core/math/bessel_3.js +1 -1
  61. package/src/core/math/computeWholeDivisorLow.d.ts +1 -1
  62. package/src/core/math/computeWholeDivisorLow.d.ts.map +1 -1
  63. package/src/core/math/computeWholeDivisorLow.js +8 -5
  64. package/src/core/math/interval/separation1D.d.ts.map +1 -0
  65. package/src/core/math/{separation1D.js → interval/separation1D.js} +3 -3
  66. package/src/core/math/solveQuadratic.d.ts.map +1 -1
  67. package/src/core/math/solveQuadratic.js +10 -0
  68. package/src/core/model/object/compareValues.js +3 -3
  69. package/src/engine/EntityCreator.d.ts +11 -11
  70. package/src/engine/EntityCreator.d.ts.map +1 -1
  71. package/src/engine/EntityCreator.js +2 -4
  72. package/src/engine/ecs/grid/HeightMap2NormalMap.js +2 -2
  73. package/src/engine/ecs/grid/NormalMap2AOMap.js +3 -3
  74. package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.d.ts +2 -2
  75. package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.d.ts.map +1 -1
  76. package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.js +5 -55
  77. package/src/engine/graphics/impostors/octahedral/util/sampler2d_build_cutout.d.ts +9 -0
  78. package/src/engine/graphics/impostors/octahedral/util/sampler2d_build_cutout.d.ts.map +1 -0
  79. package/src/engine/graphics/impostors/octahedral/util/sampler2d_build_cutout.js +64 -0
  80. package/src/engine/graphics/render/forward_plus/LightManager.js +2 -2
  81. package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.js +2 -2
  82. package/src/engine/graphics/sh3/path_tracer/sorting/sort_bvh_nodes_by_distance_to_point.js +2 -2
  83. package/src/engine/graphics/texture/sampler/Sampler2D.d.ts.map +1 -1
  84. package/src/engine/graphics/texture/sampler/Sampler2D.js +4 -2
  85. package/src/engine/graphics/texture/sampler/filter/kaiser_bessel_window.js +1 -1
  86. package/src/engine/graphics/texture/sampler/filter/sampler2d_scale_down_generic.js +1 -1
  87. package/src/engine/graphics/texture/sampler/sampler2d_multiply_vector.d.ts +8 -0
  88. package/src/engine/graphics/texture/sampler/sampler2d_multiply_vector.d.ts.map +1 -0
  89. package/src/engine/graphics/texture/sampler/{sampler_multiply_vector.js → sampler2d_multiply_vector.js} +1 -1
  90. package/src/engine/graphics/texture/sampler/sampler2d_to_float32_texture.d.ts +8 -0
  91. package/src/engine/graphics/texture/sampler/sampler2d_to_float32_texture.d.ts.map +1 -0
  92. package/src/engine/graphics/texture/sampler/{sampler2DToFloat32Texture.js → sampler2d_to_float32_texture.js} +2 -2
  93. package/src/engine/graphics/texture/sampler/util/drawSamplerHTML.d.ts.map +1 -1
  94. package/src/engine/graphics/texture/sampler/util/drawSamplerHTML.js +3 -1
  95. package/src/engine/graphics/texture/virtual/VirtualTextureTileLoader.js +2 -2
  96. package/src/engine/grid/obstacle/GridObstacle.d.ts.map +1 -1
  97. package/src/engine/grid/obstacle/GridObstacle.js +1 -1
  98. package/src/engine/physics/computeInterceptPoint.js +20 -6
  99. package/src/engine/physics/mls-mpm/MLS_MPM.d.ts.map +1 -1
  100. package/src/engine/physics/mls-mpm/MLS_MPM.js +14 -17
  101. package/src/generation/grid/generation/road/GridTaskGenerateRoads.js +2 -2
  102. package/src/core/UUID.d.ts +0 -6
  103. package/src/core/UUID.d.ts.map +0 -1
  104. package/src/core/UUID.js +0 -21
  105. package/src/core/collection/array/arrayQuickSort.d.ts +0 -12
  106. package/src/core/collection/array/arrayQuickSort.d.ts.map +0 -1
  107. package/src/core/collection/array/array_remove_element.d.ts +0 -11
  108. package/src/core/collection/array/array_remove_element.d.ts.map +0 -1
  109. package/src/core/collection/array/array_remove_element.js +0 -16
  110. package/src/core/collection/array/groupArrayBy.d.ts +0 -10
  111. package/src/core/collection/array/groupArrayBy.d.ts.map +0 -1
  112. package/src/core/geom/2d/compute_triangle_area_2d.d.ts.map +0 -1
  113. package/src/core/geom/2d/convex-hull/orientation3.d.ts +0 -12
  114. package/src/core/geom/2d/convex-hull/orientation3.d.ts.map +0 -1
  115. package/src/core/geom/2d/convex-hull/orientation3.js +0 -489
  116. package/src/core/geom/2d/convex-hull/orientation3_v2.d.ts +0 -9
  117. package/src/core/geom/2d/convex-hull/orientation3_v2.d.ts.map +0 -1
  118. package/src/core/geom/2d/convex-hull/orientation3_v2.js +0 -12
  119. package/src/core/math/separation1D.d.ts.map +0 -1
  120. package/src/engine/graphics/texture/sampler/sampler2DToFloat32Texture.d.ts +0 -8
  121. package/src/engine/graphics/texture/sampler/sampler2DToFloat32Texture.d.ts.map +0 -1
  122. package/src/engine/graphics/texture/sampler/sampler_multiply_vector.d.ts +0 -8
  123. package/src/engine/graphics/texture/sampler/sampler_multiply_vector.d.ts.map +0 -1
  124. package/src/engine/graphics/texture/sampler/typedArrayConstructorByInstance.d.ts.map +0 -1
  125. package/src/engine/save/storage/InMemoryLocalStorage.d.ts +0 -6
  126. package/src/engine/save/storage/InMemoryLocalStorage.d.ts.map +0 -1
  127. package/src/engine/save/storage/InMemoryLocalStorage.js +0 -13
  128. /package/src/core/{primitives → collection}/array/compareArrays.d.ts +0 -0
  129. /package/src/core/{primitives → collection}/array/compareArrays.js +0 -0
  130. /package/src/core/{primitives → collection}/array/computeIntegerArrayHash.d.ts +0 -0
  131. /package/src/core/{primitives → collection}/array/computeIntegerArrayHash.js +0 -0
  132. /package/src/core/{primitives → collection}/array/computeStridedArrayHash.d.ts +0 -0
  133. /package/src/core/{primitives → collection}/array/computeStridedArrayHash.js +0 -0
  134. /package/src/core/{primitives → collection}/array/computeStridedIntegerArrayHash.d.ts +0 -0
  135. /package/src/core/{primitives → collection}/array/computeStridedIntegerArrayHash.js +0 -0
  136. /package/src/{engine/graphics/texture/sampler → core/collection/array/typed}/typedArrayConstructorByInstance.d.ts +0 -0
  137. /package/src/{engine/graphics/texture/sampler → core/collection/array/typed}/typedArrayConstructorByInstance.js +0 -0
  138. /package/src/core/math/{separation1D.d.ts → interval/separation1D.d.ts} +0 -0
@@ -1,17 +1,10 @@
1
1
  //
2
2
 
3
3
  import { assert } from "../../../../../core/assert.js";
4
- import { array_copy } from "../../../../../core/collection/array/array_copy.js";
5
- import { compute_polygon_area_2d } from "../../../../../core/geom/2d/compute_polygon_area_2d.js";
6
- import { convex_hull_jarvis_2d } from "../../../../../core/geom/2d/convex-hull/convex_hull_jarvis_2d.js";
7
- import { fixed_convex_hull_relaxation } from "../../../../../core/geom/2d/convex-hull/fixed_convex_hull_relaxation.js";
8
4
  import { max2 } from "../../../../../core/math/max2.js";
9
5
  import { renderSamplerFromTexture } from "../../../render/visibility/hiz/buildCanvasViewFromTexture.js";
10
6
  import { Sampler2D } from "../../../texture/sampler/Sampler2D.js";
11
- import {
12
- make_edge_condition_channel_threshold
13
- } from "../../../texture/sampler/search/make_edge_condition_channel_threshold.js";
14
- import { sampler2d_find_pixels } from "../../../texture/sampler/search/sampler2d_find_pixels.js";
7
+ import { sampler2d_build_cutout } from "./sampler2d_build_cutout.js";
15
8
 
16
9
  /**
17
10
  * TODO For this specific use-case with octahedral impostors we can get away tracing a circular shape in general.
@@ -19,7 +12,7 @@ import { sampler2d_find_pixels } from "../../../texture/sampler/search/sampler2d
19
12
  * @param {ImpostorDescription} impostor
20
13
  * @param {THREE.WebGLRenderer} renderer
21
14
  * @param {number} vertex_limit how many vertices to use for the billboard, more vertices will provide better fit and lower area reducing overdraw at the cost of extra triangles. Prefer values between 4 and 16
22
- * @returns {number[]}
15
+ * @returns {Float32Array}
23
16
  */
24
17
  export function build_cutout_from_atlas_by_alpha({
25
18
 
@@ -50,7 +43,7 @@ export function build_cutout_from_atlas_by_alpha({
50
43
  const frame_size = impostor.resolution / impostor.frame_count;
51
44
  const frame_size_i = Math.ceil(frame_size);
52
45
 
53
- const accummulator = Sampler2D.uint8(1, frame_size_i, frame_size_i);
46
+ const accumulator = Sampler2D.uint8(1, frame_size_i, frame_size_i);
54
47
 
55
48
  for (let i = 0; i < impostor.frame_count; i++) {
56
49
 
@@ -76,44 +69,14 @@ export function build_cutout_from_atlas_by_alpha({
76
69
 
77
70
  const local_index = y * frame_size_i + x;
78
71
 
79
- accummulator.data[local_index] = max2(v, accummulator.data[local_index]);
72
+ accumulator.data[local_index] = max2(v, accumulator.data[local_index]);
80
73
  }
81
74
  }
82
75
  }
83
76
  }
84
77
  }
85
78
 
86
-
87
- const edge_pixels = sampler2d_find_pixels(accummulator, make_edge_condition_channel_threshold(0, 5));
88
-
89
- // filtered pixels
90
- const filtered_edge_pixels = [];
91
-
92
- const half_pixel = 0.5;
93
-
94
- for (let i = 0; i < edge_pixels.length; i += 2) {
95
- const x = edge_pixels[i];
96
- const y = edge_pixels[i + 1];
97
-
98
- filtered_edge_pixels.push(x - half_pixel, y - half_pixel);
99
- filtered_edge_pixels.push(x + half_pixel, y - half_pixel);
100
- filtered_edge_pixels.push(x + half_pixel, y + half_pixel);
101
- filtered_edge_pixels.push(x - half_pixel, y + half_pixel);
102
- }
103
-
104
- const hull_point_indices = convex_hull_jarvis_2d(filtered_edge_pixels, filtered_edge_pixels.length / 2);
105
-
106
- const hull_points = [];
107
-
108
- for (let i = 0; i < hull_point_indices.length; i++) {
109
- const hpi = hull_point_indices[i];
110
-
111
- array_copy(filtered_edge_pixels, hpi * 2, hull_points, i * 2, 2);
112
- }
113
-
114
- const cutout_points = new Float32Array(vertex_limit * 2);
115
-
116
- fixed_convex_hull_relaxation(cutout_points, 0, vertex_limit, hull_points, hull_point_indices.length);
79
+ const cutout_points = sampler2d_build_cutout(accumulator, vertex_limit, frame_size);
117
80
 
118
81
  // normalize points
119
82
  for (let i = 0; i < vertex_limit; i++) {
@@ -121,19 +84,6 @@ export function build_cutout_from_atlas_by_alpha({
121
84
  cutout_points[i * 2 + 1] /= frame_size;
122
85
  }
123
86
 
124
- const area = compute_polygon_area_2d(cutout_points, vertex_limit);
125
-
126
- console.log(`Cutout area: ${area}`);
127
-
128
- if (area >= 0.99 && vertex_limit >= 4) {
129
- // default back to aligned quad, produced result is a degradation
130
- return new Float32Array([
131
- 0, 0,
132
- 1, 0,
133
- 1, 1,
134
- 0, 1
135
- ]);
136
- }
137
87
 
138
88
  return cutout_points;
139
89
  }
@@ -0,0 +1,9 @@
1
+ /**
2
+ *
3
+ * @param {Sampler2D} accumulator
4
+ * @param {number} vertex_limit
5
+ * @param {number} frame_size
6
+ * @returns {Float32Array}
7
+ */
8
+ export function sampler2d_build_cutout(accumulator: Sampler2D, vertex_limit: number, frame_size: number): Float32Array;
9
+ //# sourceMappingURL=sampler2d_build_cutout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sampler2d_build_cutout.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/impostors/octahedral/util/sampler2d_build_cutout.js"],"names":[],"mappings":"AASA;;;;;;GAMG;AACH,6EAJW,MAAM,cACN,MAAM,GACJ,YAAY,CAiDxB"}
@@ -0,0 +1,64 @@
1
+ import { array_copy } from "../../../../../core/collection/array/array_copy.js";
2
+ import { compute_polygon_area_2d } from "../../../../../core/geom/2d/compute_polygon_area_2d.js";
3
+ import { convex_hull_jarvis_2d } from "../../../../../core/geom/2d/convex-hull/convex_hull_jarvis_2d.js";
4
+ import { fixed_convex_hull_relaxation } from "../../../../../core/geom/2d/convex-hull/fixed_convex_hull_relaxation.js";
5
+ import {
6
+ make_edge_condition_channel_threshold
7
+ } from "../../../texture/sampler/search/make_edge_condition_channel_threshold.js";
8
+ import { sampler2d_find_pixels } from "../../../texture/sampler/search/sampler2d_find_pixels.js";
9
+
10
+ /**
11
+ *
12
+ * @param {Sampler2D} accumulator
13
+ * @param {number} vertex_limit
14
+ * @param {number} frame_size
15
+ * @returns {Float32Array}
16
+ */
17
+ export function sampler2d_build_cutout(accumulator, vertex_limit, frame_size) {
18
+ const edge_pixels = sampler2d_find_pixels(accumulator, make_edge_condition_channel_threshold(0, 5));
19
+
20
+ // filtered pixels
21
+ const filtered_edge_pixels = [];
22
+
23
+ const half_pixel = 0.5;
24
+
25
+ for (let i = 0; i < edge_pixels.length; i += 2) {
26
+ const x = edge_pixels[i];
27
+ const y = edge_pixels[i + 1];
28
+
29
+ filtered_edge_pixels.push(x - half_pixel, y - half_pixel);
30
+ filtered_edge_pixels.push(x + half_pixel, y - half_pixel);
31
+ filtered_edge_pixels.push(x + half_pixel, y + half_pixel);
32
+ filtered_edge_pixels.push(x - half_pixel, y + half_pixel);
33
+ }
34
+
35
+ const hull_point_indices = convex_hull_jarvis_2d(filtered_edge_pixels, filtered_edge_pixels.length / 2);
36
+
37
+ const hull_points = [];
38
+
39
+ for (let i = 0; i < hull_point_indices.length; i++) {
40
+ const hpi = hull_point_indices[i];
41
+
42
+ array_copy(filtered_edge_pixels, hpi * 2, hull_points, i * 2, 2);
43
+ }
44
+
45
+ const cutout_points = new Float32Array(vertex_limit * 2);
46
+
47
+ fixed_convex_hull_relaxation(cutout_points, 0, vertex_limit, hull_points, hull_point_indices.length);
48
+
49
+ const area = compute_polygon_area_2d(cutout_points, vertex_limit);
50
+
51
+ console.log(`Cutout area: ${area}`);
52
+
53
+ if (area >= 0.99 && vertex_limit >= 4) {
54
+ // default back to aligned quad, produced result is a degradation
55
+ return new Float32Array([
56
+ 0, 0,
57
+ accumulator.width, 0,
58
+ accumulator.width, accumulator.height,
59
+ 0, accumulator.height
60
+ ]);
61
+ }
62
+
63
+ return cutout_points;
64
+ }
@@ -23,8 +23,8 @@ import {
23
23
  bvh_query_user_data_overlaps_frustum
24
24
  } from "../../../../core/bvh2/bvh3/query/bvh_query_user_data_overlaps_frustum.js";
25
25
  import { array_copy } from "../../../../core/collection/array/array_copy.js";
26
+ import { array_sort_quick } from "../../../../core/collection/array/array_sort_quick.js";
26
27
  import { array_swap_one } from "../../../../core/collection/array/array_swap_one.js";
27
- import { arrayQuickSort } from "../../../../core/collection/array/arrayQuickSort.js";
28
28
  import { read_cluster_frustum_corners } from "../../../../core/geom/3d/frustum/read_cluster_frustum_corners.js";
29
29
  import { read_three_planes_to_array } from "../../../../core/geom/3d/frustum/read_three_planes_to_array.js";
30
30
  import { slice_frustum_linear_to_points } from "../../../../core/geom/3d/frustum/slice_frustum_linear_to_points.js";
@@ -680,7 +680,7 @@ export class LightManager {
680
680
  array_copy(visible_light_set.elements, 0, sorted_lights, 0, visible_light_count);
681
681
  array_copy(visible_decal_set.elements, 0, sorted_lights, visible_light_count, visible_decal_count);
682
682
 
683
- arrayQuickSort(sorted_lights, this.__sort_visible_light_score, this, 0, expected_sorted_size - 1);
683
+ array_sort_quick(sorted_lights, this.__sort_visible_light_score, this, 0, expected_sorted_size - 1);
684
684
  }
685
685
 
686
686
  __update_visible_bvh() {
@@ -1,6 +1,6 @@
1
1
  import { Color } from "three";
2
2
  import { convertTexture2Sampler2D } from "../../../texture/sampler/convertTexture2Sampler2D.js";
3
- import { sampler_multiply_vector } from "../../../texture/sampler/sampler_multiply_vector.js";
3
+ import { sampler2d_multiply_vector } from "../../../texture/sampler/sampler2d_multiply_vector.js";
4
4
  import { iterate_three_material_textures } from "../../../three/material/iterate_three_material_textures.js";
5
5
  import { StandardMaterial } from "./StandardMaterial.js";
6
6
  import { StandardTexture } from "./StandardTexture.js";
@@ -94,7 +94,7 @@ export class MaterialConverter {
94
94
 
95
95
  tinted_diffuse.sampler = tinted_diffuse.sampler.clone();
96
96
 
97
- sampler_multiply_vector(tinted_diffuse.sampler, result.diffuse.sampler, material.color.toArray());
97
+ sampler2d_multiply_vector(tinted_diffuse.sampler, result.diffuse.sampler, material.color.toArray());
98
98
 
99
99
  result.diffuse = tinted_diffuse;
100
100
  }
@@ -1,5 +1,5 @@
1
1
  import { ELEMENT_WORD_COUNT } from "../../../../../core/bvh2/bvh3/BVH.js";
2
- import { arrayQuickSort } from "../../../../../core/collection/array/arrayQuickSort.js";
2
+ import { array_sort_quick } from "../../../../../core/collection/array/array_sort_quick.js";
3
3
  import {
4
4
  aabb3_unsigned_distance_sqr_to_point
5
5
  } from "../../../../../core/geom/3d/aabb/aabb3_unsigned_distance_sqr_to_point.js";
@@ -28,7 +28,7 @@ export function sort_bvh_nodes_by_distance_to_point(
28
28
  For performance, we bind data directly to avoid extra copies required to read out AABB
29
29
  */
30
30
  const float32 = bvh.__data_float32;
31
- arrayQuickSort(node_list, (node) => {
31
+ array_sort_quick(node_list, (node) => {
32
32
  const address = node * ELEMENT_WORD_COUNT;
33
33
 
34
34
  const aabb_distance_sqr = aabb3_unsigned_distance_sqr_to_point(
@@ -1 +1 @@
1
- {"version":3,"file":"Sampler2D.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/sampler/Sampler2D.js"],"names":[],"mappings":"AAiBA;;;;GAIG;AACH;IAk8BI;;;;;;OAMG;IACH,6DAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,sDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,uDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,uDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,qDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,sDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,sDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,wDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,wDAFY,SAAS,CAKpB;IA3iCD;;;;;;;OAOG;IACH,mBANW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,iBAAiB,GAAC,UAAU,GAAC,WAAW,GAAC,WAAW,GAAC,SAAS,GAAC,UAAU,GAAC,UAAU,GAAC,YAAY,GAAC,YAAY,aACzI,MAAM,UACN,MAAM,WACN,MAAM,EAmDhB;IA7BG;;;OAGG;IACH,cAAkB;IAElB;;;OAGG;IACH,eAAoB;IAEpB;;;OAGG;IACH,iBAAwB;IAExB;;;OAGG;IACH,MAFU,MAAM,EAAE,GAAC,iBAAiB,GAAC,UAAU,GAAC,WAAW,GAAC,WAAW,GAAC,SAAS,GAAC,UAAU,GAAC,UAAU,GAAC,YAAY,GAAC,YAAY,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N,MAAM,EAAE,QAalB;IAED;;;;;OAKG;IACH,SAJW,MAAM,KACN,MAAM,QACN,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,QAapC;IAED;;;;;;OAMG;IACH,UALW,MAAM,KACN,MAAM,WACN,2BAAuB,OAajC;IAED;;;;;OAKG;IACH,eAJW,MAAM,KACN,MAAM,GACJ,MAAM,CAIlB;IAED;;;;OAIG;IACH,mBAHW,MAAM,yBAUhB;IAED;;;;;;;;;OASG;IACH,aARW,SAAS,qHAoDnB;IAGD;;;;;;;OAOG;IACH,oEA8BC;IAED;;;;OAIG;IACH,2BAHW,MAAM,SACN,MAAM,QAYhB;IAED;;;;;;;OAOG;IACH,iEAFW,aAAc,QAqCxB;IAED;;;;;;OAMG;IACH,gBALW,MAAM,KACN,MAAM,WACN,MAAM,SACN,MAAM,QAqBhB;IAED;;;;;OAKG;IACH,OAJW,MAAM,KACN,MAAM,SACN,MAAM,EAAE,GAAC,YAAY,QAe/B;IAED;;;;;;;OAOG;IACH,wBALW,MAAM,WACN,MAAM,UACN,MAAM,sBAyBhB;IAED;;;;;OAKG;IACH,UAJW,MAAM,KACN,MAAM,iBACN,OAAO,QAyDjB;IAED;;;OAGG;IACH,mBAFY,MAAM,CAYjB;IAED;;;;OAIG;IACH,cAHW,SAAS,GACR,OAAO,CAYlB;IAED;;;OAGG;IACH,QAFY,MAAM,CAYjB;IAGD;;OAEG;IACH,SAFa,SAAS,CAerB;IAED;;;;;;MAUC;IAED;;;;;;aAwBC;IAgHL;;;OAGG;IACH,sBAFU,OAAO,CAEc;CAN9B;;kBAUS,MAAM"}
1
+ {"version":3,"file":"Sampler2D.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/sampler/Sampler2D.js"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH;IAk8BI;;;;;;OAMG;IACH,6DAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,sDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,uDAFY,SA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AqBhB;IAED;;;;;OAKG;IACH,OAJW,MAAM,KACN,MAAM,SACN,MAAM,EAAE,GAAC,YAAY,QAe/B;IAED;;;;;;;OAOG;IACH,wBALW,MAAM,WACN,MAAM,UACN,MAAM,sBAyBhB;IAED;;;;;OAKG;IACH,UAJW,MAAM,KACN,MAAM,iBACN,OAAO,QAyDjB;IAED;;;OAGG;IACH,mBAFY,MAAM,CAYjB;IAED;;;;OAIG;IACH,cAHW,SAAS,GACR,OAAO,CAYlB;IAED;;;OAGG;IACH,QAFY,MAAM,CAYjB;IAGD;;OAEG;IACH,SAFa,SAAS,CAerB;IAED;;;;;;MAUC;IAED;;;;;;aAwBC;IAgHL;;;OAGG;IACH,sBAFU,OAAO,CAEc;CAN9B;;kBAUS,MAAM"}
@@ -3,17 +3,19 @@ import { Base64 } from "../../../../core/binary/Base64.js";
3
3
  import {
4
4
  compute_typed_array_constructor_from_data_type
5
5
  } from "../../../../core/binary/type/DataType2TypedArrayConstructorMapping.js";
6
+ import { computeStridedIntegerArrayHash } from "../../../../core/collection/array/computeStridedIntegerArrayHash.js";
6
7
  import {
7
8
  compute_binary_data_type_from_typed_array
8
9
  } from "../../../../core/collection/array/typed/compute_binary_data_type_from_typed_array.js";
9
10
  import { is_typed_array_equals } from "../../../../core/collection/array/typed/is_typed_array_equals.js";
11
+ import {
12
+ typedArrayConstructorByInstance
13
+ } from "../../../../core/collection/array/typed/typedArrayConstructorByInstance.js";
10
14
  import { clamp } from "../../../../core/math/clamp.js";
11
15
  import { lerp } from "../../../../core/math/lerp.js";
12
16
  import { max2 } from "../../../../core/math/max2.js";
13
17
  import { min2 } from "../../../../core/math/min2.js";
14
18
  import { interpolate_bicubic } from "../../../../core/math/spline/interpolate_bicubic.js";
15
- import { computeStridedIntegerArrayHash } from "../../../../core/primitives/array/computeStridedIntegerArrayHash.js";
16
- import { typedArrayConstructorByInstance } from "./typedArrayConstructorByInstance.js";
17
19
 
18
20
  /**
19
21
  * Data Texture class, providing an abstraction around 2d numerical arrays, mostly for sampling purposes
@@ -19,4 +19,4 @@ export function kaiser_bessel_window(x) {
19
19
  return bessel_3(PI3 * t) * INV_BESSEL_3_PI_3;
20
20
  }
21
21
 
22
- kaiser_bessel_window.support = 2;
22
+ kaiser_bessel_window.support = 1;
@@ -31,7 +31,7 @@ export function sampler2d_scale_down_generic(
31
31
  const ratio_x = source_width / d_w;
32
32
  const ratio_y = source_height / d_h;
33
33
 
34
- const rcp_ratio_y = 2 / ratio_x;
34
+ const rcp_ratio_y = 2 / ratio_y;
35
35
  const rcp_ratio_x = 2 / ratio_x;
36
36
 
37
37
 
@@ -0,0 +1,8 @@
1
+ /**
2
+ *
3
+ * @param {Sampler2D} output
4
+ * @param {Sampler2D} input
5
+ * @param {number[]} vector
6
+ */
7
+ export function sampler2d_multiply_vector(output: Sampler2D, input: Sampler2D, vector: number[]): void;
8
+ //# sourceMappingURL=sampler2d_multiply_vector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sampler2d_multiply_vector.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/sampler/sampler2d_multiply_vector.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,uFAFW,MAAM,EAAE,QAkBlB"}
@@ -4,7 +4,7 @@
4
4
  * @param {Sampler2D} input
5
5
  * @param {number[]} vector
6
6
  */
7
- export function sampler_multiply_vector(output, input, vector) {
7
+ export function sampler2d_multiply_vector(output, input, vector) {
8
8
 
9
9
  const pixel_count = input.width * input.height;
10
10
  const item_size = input.itemSize;
@@ -0,0 +1,8 @@
1
+ /**
2
+ *
3
+ * @param {Sampler2D} sampler
4
+ * @returns {DataTexture}
5
+ */
6
+ export function sampler2d_to_float32_texture(sampler: Sampler2D): DataTexture;
7
+ import { DataTexture } from "three";
8
+ //# sourceMappingURL=sampler2d_to_float32_texture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sampler2d_to_float32_texture.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/sampler/sampler2d_to_float32_texture.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,kEAFa,WAAW,CA2BvB;4BApCwF,OAAO"}
@@ -1,15 +1,15 @@
1
1
  import { ClampToEdgeWrapping, DataTexture, FloatType, LinearFilter, NearestFilter } from "three";
2
2
  import { assert } from "../../../../core/assert.js";
3
+ import { BinaryDataType } from "../../../../core/binary/type/BinaryDataType.js";
3
4
  import { channelCountToThreeTextureFormat } from "../channelCountToThreeTextureFormat.js";
4
5
  import { computeThreeTextureInternalFormatFromDataType } from "../computeThreeTextureInternalFormatFromDataType.js";
5
- import { BinaryDataType } from "../../../../core/binary/type/BinaryDataType.js";
6
6
 
7
7
  /**
8
8
  *
9
9
  * @param {Sampler2D} sampler
10
10
  * @returns {DataTexture}
11
11
  */
12
- export function sampler2DtoFloat32Texture(sampler) {
12
+ export function sampler2d_to_float32_texture(sampler) {
13
13
  assert.ok(sampler.data instanceof Float32Array);
14
14
 
15
15
  const width = sampler.width;
@@ -1 +1 @@
1
- {"version":3,"file":"drawSamplerHTML.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/texture/sampler/util/drawSamplerHTML.js"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,4CARW,WAAW,WACX,SAAS,KACT,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,QACN,MAAM,QA6BhB;0BAzCyB,iBAAiB"}
1
+ {"version":3,"file":"drawSamplerHTML.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/texture/sampler/util/drawSamplerHTML.js"],"names":[],"mappings":"AAOA;;;;;;;;;GASG;AACH,4CARW,WAAW,WACX,SAAS,KACT,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,QACN,MAAM,QA6BhB;0BAxCyB,iBAAiB"}
@@ -1,7 +1,9 @@
1
+ import {
2
+ typedArrayConstructorByInstance
3
+ } from "../../../../../core/collection/array/typed/typedArrayConstructorByInstance.js";
1
4
  import { sampler2d_scale } from "../resize/sampler2d_scale.js";
2
5
  import { Sampler2D } from "../Sampler2D.js";
3
6
  import sampler2d_to_html_canvas from "../sampler2d_to_html_canvas.js";
4
- import { typedArrayConstructorByInstance } from "../typedArrayConstructorByInstance.js";
5
7
 
6
8
  /**
7
9
  *
@@ -1,5 +1,5 @@
1
1
  import { assert } from "../../../../core/assert.js";
2
- import { arrayQuickSort } from "../../../../core/collection/array/arrayQuickSort.js";
2
+ import { array_sort_quick } from "../../../../core/collection/array/array_sort_quick.js";
3
3
  import Signal from "../../../../core/events/signal/Signal.js";
4
4
  import { AssetManager } from "../../../asset/AssetManager.js";
5
5
  import { GameAssetType } from "../../../asset/GameAssetType.js";
@@ -142,7 +142,7 @@ export class VirtualTextureTileLoader {
142
142
  */
143
143
  const score = (fingerprint) => -usage.getCountByFingerprint(fingerprint);
144
144
 
145
- arrayQuickSort(
145
+ array_sort_quick(
146
146
  this.#queue,
147
147
  score, null,
148
148
  0, this.#queue.length - 1
@@ -1 +1 @@
1
- {"version":3,"file":"GridObstacle.d.ts","sourceRoot":"","sources":["../../../../../src/engine/grid/obstacle/GridObstacle.js"],"names":[],"mappings":";AAMA;IA0NI,sCAMC;IA/ND,eAAW;IAEX;;;OAGG;IACH,eAFU,OAAO,CAEQ;IAEzB;;;;OAIG;IACH,UAHW,MAAM,KACN,MAAM,QAiChB;IAED;;;;;;OAMG;IACH,sBALW,MAAM,WACN,MAAM,qCAmChB;IAED;;;;;OAKG;IACH,aAJW,MAAM,KACN,MAAM,GACJ,MAAM,CAWlB;IAED;;;;;OAKG;IACH,cAJW,MAAM,KACN,MAAM,SACN,MAAM,QAShB;IAED;;;;;OAKG;IACH,iBAJW,MAAM,KACN,MAAM,GACJ,OAAO,CAYnB;IAED;;;;;;OAMG;IACH,mBALW,MAAM,KACN,MAAM,iBACN,MAAM,EAAE,GACN,OAAO,CAoDnB;IAED;;;MAKC;IAED;;;aAaC;IAUD;;;OAGG;IACH,QAFa,MAAM,CAOlB;IAED;;;;OAIG;IACH,cAHW,YAAY,GACV,OAAO,CAQnB;CACJ;;;;oBA5PmB,+BAA+B"}
1
+ {"version":3,"file":"GridObstacle.d.ts","sourceRoot":"","sources":["../../../../../src/engine/grid/obstacle/GridObstacle.js"],"names":[],"mappings":";AAMA;IA0NI,sCAMC;IA/ND,eAAW;IAEX;;;OAGG;IACH,eAFU,OAAO,CAEQ;IAEzB;;;;OAIG;IACH,UAHW,MAAM,KACN,MAAM,QAiChB;IAED;;;;;;OAMG;IACH,sBALW,MAAM,WACN,MAAM,qCAmChB;IAED;;;;;OAKG;IACH,aAJW,MAAM,KACN,MAAM,GACJ,MAAM,CAWlB;IAED;;;;;OAKG;IACH,cAJW,MAAM,KACN,MAAM,SACN,MAAM,QAShB;IAED;;;;;OAKG;IACH,iBAJW,MAAM,KACN,MAAM,GACJ,OAAO,CAYnB;IAED;;;;;;OAMG;IACH,mBALW,MAAM,KACN,MAAM,iBACN,MAAM,EAAE,GACN,OAAO,CAoDnB;IAED;;;MAKC;IAED;;;aAaC;IAUD;;;OAGG;IACH,QAFa,MAAM,CAOlB;IAED;;;;OAIG;IACH,cAHW,YAAY,GACV,OAAO,CAQnB;CACJ;;;;oBA3PmB,+BAA+B"}
@@ -1,8 +1,8 @@
1
1
  import { assert } from "../../../core/assert.js";
2
2
  import { combine_hash } from "../../../core/collection/array/combine_hash.js";
3
+ import { computeIntegerArrayHash } from "../../../core/collection/array/computeIntegerArrayHash.js";
3
4
  import { isArrayEqualStrict } from "../../../core/collection/array/isArrayEqualStrict.js";
4
5
  import Vector2 from '../../../core/geom/Vector2.js';
5
- import { computeIntegerArrayHash } from "../../../core/primitives/array/computeIntegerArrayHash.js";
6
6
 
7
7
  class GridObstacle {
8
8
  data = [1];
@@ -2,13 +2,14 @@ import { v3_dot } from "../../core/geom/vec3/v3_dot.js";
2
2
  import { solveQuadratic } from "../../core/math/solveQuadratic.js";
3
3
 
4
4
  /**
5
- *
5
+ * Given position of the source point, and target moving at a constant velocity, compute intercept.
6
+ * Simple example would be {@link target} being enemy running, and {@link source} being position of our archer, given that the arrow speed is {@link sourceSpeed}, where should the archer aim at in order to hit the moving target?
6
7
  * @param {Vector3} result
7
8
  * @param {Vector3} source
8
9
  * @param {Vector3} target
9
10
  * @param {Vector3} targetVelocity
10
11
  * @param {number} sourceSpeed
11
- * @return {boolean}
12
+ * @return {boolean} true iff there is at least oen real solution
12
13
  */
13
14
  function computeInterceptPoint(result, source, target, targetVelocity, sourceSpeed) {
14
15
  const d_ts_x = target.x - source.x;
@@ -30,15 +31,28 @@ function computeInterceptPoint(result, source, target, targetVelocity, sourceSpe
30
31
 
31
32
  // Find smallest positive solution
32
33
  if (root_count > 0) {
33
- const t0 = ts[0], t1 = ts[1];
34
- let t = Math.min(t0, t1);
35
- if (t < 0) t = Math.max(t0, t1);
34
+ const root_0 = ts[0];
35
+ const root_1 = ts[1];
36
+
37
+ let t = Math.min(root_0, root_1);
38
+
39
+ if (t < 0) {
40
+ // one of the roots is negative, which would produce imaginary solution, so let's try to pick the other one
41
+ t = Math.max(root_0, root_1);
42
+ }
36
43
 
37
44
  if (t > 0) {
38
- result.copy(targetVelocity).multiplyScalar(t).add(target);
45
+
46
+ result.copy(targetVelocity);
47
+ result.multiplyScalar(t);
48
+ result.add(target);
49
+
39
50
  return true;
51
+
40
52
  }
41
53
 
54
+ // if we got to this point, that means that both roots are imaginary, so there is no real solution
55
+
42
56
  }
43
57
  return false;
44
58
  }
@@ -1 +1 @@
1
- {"version":3,"file":"MLS_MPM.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/mls-mpm/MLS_MPM.js"],"names":[],"mappings":"AA2HA;IAGQ,iBAAmB;IAGnB;;;;;OAKG;IACH,MAFU,YAAY,CAEiB;IAI3C;;;OAGG;IACH,YAFW,MAAM,QAwVhB;IAED,0CAeC;CACJ"}
1
+ {"version":3,"file":"MLS_MPM.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/mls-mpm/MLS_MPM.js"],"names":[],"mappings":"AAwHA;IAGQ,iBAAmB;IAGnB;;;;;OAKG;IACH,MAFU,YAAY,CAEiB;IAI3C;;;OAGG;IACH,YAFW,MAAM,QAwVhB;IAED,0CAeC;CACJ"}
@@ -1,10 +1,10 @@
1
- import { clamp } from "../../../core/math/clamp.js";
2
- import { m2_multiply } from "../../../core/geom/mat2/m2_multiply.js";
3
- import { m2_multiply_transposed } from "../../../core/geom/mat2/m2_multiply_transposed.js";
1
+ import { m2_add } from "../../../core/geom/mat2/m2_add.js";
4
2
  import { m2_determinant } from "../../../core/geom/mat2/m2_determinant.js";
3
+ import { m2_multiply } from "../../../core/geom/mat2/m2_multiply.js";
5
4
  import { m2_multiply_scalar } from "../../../core/geom/mat2/m2_multiply_scalar.js";
6
- import { m2_add } from "../../../core/geom/mat2/m2_add.js";
5
+ import { m2_multiply_transposed } from "../../../core/geom/mat2/m2_multiply_transposed.js";
7
6
  import { m2_sub_transposed } from "../../../core/geom/mat2/m2_sub_transposed.js";
7
+ import { clamp } from "../../../core/math/clamp.js";
8
8
 
9
9
 
10
10
  /**
@@ -14,22 +14,16 @@ import { m2_sub_transposed } from "../../../core/geom/mat2/m2_sub_transposed.js"
14
14
  * @param {number[]} m
15
15
  */
16
16
  function polar_decomp(R, S, m) {
17
- const x = m[0] + m[3];
18
- const y = m[2] - m[1];
19
-
20
- const scale = 1.0 / Math.sqrt(x * x + y * y);
21
-
22
- const c = x * scale;
23
- const s = y * scale;
24
-
25
- R[0] = c;
26
- R[1] = s;
27
- R[2] = -s;
28
- R[3] = c;
17
+ polar_decomp_noS(R, m);
29
18
 
30
19
  m2_multiply(S, m, R);
31
20
  }
32
21
 
22
+ /**
23
+ *
24
+ * @param {number[]} R
25
+ * @param {number[]} m
26
+ */
33
27
  function polar_decomp_noS(R, m) { // transposed as in taichi
34
28
  const x = m[0] + m[3];
35
29
  const y = m[2] - m[1];
@@ -119,7 +113,10 @@ function svd(U, S, V, sig, m) { // transposed as in taichi
119
113
 
120
114
  const dimensions = 2;
121
115
 
122
- const m2_indentity = [1, 0, 0, 1];
116
+ const m2_indentity = [
117
+ 1, 0,
118
+ 0, 1
119
+ ];
123
120
 
124
121
  export class MLS_MPMSolver {
125
122
  constructor() {
@@ -2,7 +2,7 @@ import { GridTags } from "../../../../../samples/generation/grid/GridTags.js";
2
2
  import { MirGridLayers } from "../../../../../samples/generation/grid/MirGridLayers.js";
3
3
  import { matcher_tag_traversable } from "../../../../../samples/generation/rules/matcher_tag_traversable.js";
4
4
  import { BitSet } from "../../../../core/binary/BitSet.js";
5
- import { groupArrayBy } from "../../../../core/collection/array/groupArrayBy.js";
5
+ import { array_group_by } from "../../../../core/collection/array/array_group_by.js";
6
6
  import { collectIteratorValueToArray } from "../../../../core/collection/collectIteratorValueToArray.js";
7
7
  import BinaryHeap from "../../../../core/collection/heap/BinaryHeap.js";
8
8
  import { QuadTreeNode } from "../../../../core/geom/2d/quad-tree/QuadTreeNode.js";
@@ -169,7 +169,7 @@ function buildPaths(
169
169
  const tBuildNodeGroups = actionTask(() => {
170
170
 
171
171
  //group nodes
172
- const groupMap = groupArrayBy(nodes, readMarkerNodeGroupId);
172
+ const groupMap = array_group_by(nodes, readMarkerNodeGroupId);
173
173
 
174
174
  /**
175
175
  *
@@ -1,6 +0,0 @@
1
- /**
2
- * @deprecated
3
- */
4
- export default class UUID {
5
- static generate(): string
6
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"UUID.d.ts","sourceRoot":"","sources":["../../../src/core/UUID.js"],"names":[],"mappings":";;;;AAEA;;;;;GAKG;AACH,yBAFa,MAAM,CAIlB"}
package/src/core/UUID.js DELETED
@@ -1,21 +0,0 @@
1
- import { UUID } from "../engine/ecs/guid/UUID.js";
2
-
3
- /**
4
- * Generates a variant 4 fully random UUID in string format
5
- * @deprecated
6
- * NOTE: Prefer to use UUID component class instead as that implementation is more robust and has better entropy when it comes to randomness
7
- * @returns {string}
8
- */
9
- function uuid() {
10
- return UUID.string();
11
- }
12
-
13
- /**
14
- * @deprecated
15
- */
16
- export default {
17
- /**
18
- * @deprecated
19
- */
20
- generate: uuid
21
- };
@@ -1,12 +0,0 @@
1
- /**
2
- * @template T
3
- * @param {T[]|ArrayLike<number>|Uint32Array} data
4
- * @param {function(T):number} score_function
5
- * @param {*} [score_function_context]
6
- * @param {number} [start]
7
- * @param {number} [end]
8
- * @param {function(T[],number, number):*} [swap_operator]
9
- * @param {*} [swap_context]
10
- */
11
- export function arrayQuickSort<T>(data: ArrayLike<number> | Uint32Array | T[], score_function: (arg0: T) => number, score_function_context?: any, start?: number, end?: number, swap_operator?: (arg0: T[], arg1: number, arg2: number) => any, swap_context?: any): void;
12
- //# sourceMappingURL=arrayQuickSort.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"arrayQuickSort.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/arrayQuickSort.js"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,4GAPuB,MAAM,wCAElB,MAAM,QACN,MAAM,oCACO,MAAM,QAAE,MAAM,oCAiErC"}
@@ -1,11 +0,0 @@
1
- /**
2
- * @deprecated
3
- * @template T
4
- * @param {T[]} array
5
- * @param {number} start_index
6
- * @param {number} end_index
7
- * @param {T} element
8
- * @return {boolean}
9
- */
10
- export function array_remove_element<T>(array: T[], start_index: number, end_index: number, element: T): boolean;
11
- //# sourceMappingURL=array_remove_element.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"array_remove_element.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/array_remove_element.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,iEALW,MAAM,aACN,MAAM,eAEL,OAAO,CAMlB"}
@@ -1,16 +0,0 @@
1
- import { array_remove_first } from "./array_remove_first.js";
2
-
3
- /**
4
- * @deprecated
5
- * @template T
6
- * @param {T[]} array
7
- * @param {number} start_index
8
- * @param {number} end_index
9
- * @param {T} element
10
- * @return {boolean}
11
- */
12
- export function array_remove_element(array, start_index, end_index, element) {
13
- console.warn('deprecated, use array_remove_first instead');
14
-
15
- array_remove_first(array, element, start_index, end_index - start_index);
16
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * @template T,K
3
- * @param {T[]} array
4
- * @param {function(T):K} groupingFunction
5
- * @param keyHashFunction
6
- * @returns {Map<K,T[]>}
7
- */
8
- export function groupArrayBy<T, K>(array: T[], groupingFunction: (arg0: T) => K, keyHashFunction?: typeof returnZero): Map<K, T[]>;
9
- import { returnZero } from "../../function/returnZero.js";
10
- //# sourceMappingURL=groupArrayBy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"groupArrayBy.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/groupArrayBy.js"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,mIA+BC;2BAzC0B,8BAA8B"}