@woosh/meep-engine 2.114.0 → 2.116.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.
- package/build/meep.cjs +236 -197
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +236 -197
- package/editor/ecs/component/editors/Sampler2DEditor.js +3 -3
- package/editor/view/ecs/HierarchicalEntityListView.js +2 -2
- package/package.json +1 -1
- package/src/core/binary/clz32.d.ts +7 -0
- package/src/core/binary/clz32.d.ts.map +1 -0
- package/src/core/binary/clz32.js +37 -0
- package/src/core/binary/is_data_url.d.ts.map +1 -1
- package/src/core/binary/is_data_url.js +1 -0
- package/src/core/binary/makeArrayBuffer.d.ts.map +1 -1
- package/src/core/binary/makeArrayBuffer.js +1 -0
- package/src/core/binary/msb_32.d.ts +7 -1
- package/src/core/binary/msb_32.d.ts.map +1 -1
- package/src/core/binary/msb_32.js +3 -12
- package/src/core/collection/RingBuffer.d.ts +1 -1
- package/src/core/collection/RingBuffer.js +1 -1
- package/src/core/{primitives/array/compareArrays.d.ts → collection/array/array_compare.d.ts} +2 -2
- package/src/core/collection/array/array_compare.d.ts.map +1 -0
- package/src/core/{primitives/array/compareArrays.js → collection/array/array_compare.js} +5 -1
- package/src/core/collection/array/{arrayIndexByEquality.d.ts → array_index_by_equality.d.ts} +2 -2
- package/src/core/collection/array/array_index_by_equality.d.ts.map +1 -0
- package/src/core/collection/array/{arrayIndexByEquality.js → array_index_by_equality.js} +1 -1
- package/src/core/collection/array/array_pick_best_element.d.ts.map +1 -0
- package/src/core/collection/array/{arrayPickBestElement.js → array_pick_best_element.js} +2 -2
- package/src/core/collection/array/array_pick_best_elements.d.ts +8 -0
- package/src/core/collection/array/array_pick_best_elements.d.ts.map +1 -0
- package/src/core/collection/array/{arrayPickBestElements.js → array_pick_best_elements.js} +1 -1
- package/src/core/collection/array/{arraySetDiff.d.ts → array_set_diff.d.ts} +3 -3
- package/src/core/collection/array/array_set_diff.d.ts.map +1 -0
- package/src/core/collection/array/{arraySetDiff.js → array_set_diff.js} +4 -4
- package/src/core/collection/array/{arraySetSortingDiff.d.ts → array_set_diff_sorting.d.ts} +2 -2
- package/src/core/collection/array/array_set_diff_sorting.d.ts.map +1 -0
- package/src/core/collection/array/{arraySetSortingDiff.js → array_set_diff_sorting.js} +1 -1
- package/src/core/collection/array/combine_hash.js +1 -1
- package/src/core/{primitives → collection}/array/computeIntegerArrayHash.d.ts.map +1 -1
- package/src/core/{primitives → collection}/array/computeStridedArrayHash.d.ts.map +1 -1
- package/src/core/{primitives → collection}/array/computeStridedIntegerArrayHash.d.ts.map +1 -1
- package/src/core/collection/array/randomMultipleFromArray.d.ts +6 -6
- package/src/core/collection/array/randomMultipleFromArray.d.ts.map +1 -1
- package/src/core/collection/array/randomMultipleFromArray.js +5 -5
- package/src/core/collection/array/typed/sparse_typed_array_hash.js +1 -1
- package/src/core/collection/array/typed/typedArrayConstructorByInstance.d.ts.map +1 -0
- package/src/core/collection/list/FilteredListProjection.d.ts.map +1 -1
- package/src/core/collection/list/FilteredListProjection.js +2 -2
- package/src/core/collection/list/List.js +4 -4
- package/src/core/geom/2d/Rectangle.d.ts.map +1 -1
- package/src/core/geom/2d/Rectangle.js +18 -5
- package/src/core/geom/2d/aabb/aabb2_overlap_exists.d.ts.map +1 -1
- package/src/core/geom/2d/aabb/aabb2_overlap_exists.js +4 -1
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_humus.d.ts +3 -3
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_humus.d.ts.map +1 -1
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_humus.js +11 -4
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_relaxation.js +2 -2
- package/src/core/geom/2d/convex-hull/orientation3_array.js +2 -2
- package/src/core/geom/2d/intersect_ray_2d.d.ts.map +1 -1
- package/src/core/geom/2d/intersect_ray_2d.js +5 -5
- package/src/core/geom/2d/{compute_triangle_area_2d.d.ts → triangle2d_compute_area.d.ts} +2 -2
- package/src/core/geom/2d/triangle2d_compute_area.d.ts.map +1 -0
- package/src/core/geom/2d/{compute_triangle_area_2d.js → triangle2d_compute_area.js} +1 -1
- package/src/core/geom/2d/triangle2d_contains_point.d.ts +14 -0
- package/src/core/geom/2d/triangle2d_contains_point.d.ts.map +1 -0
- package/src/core/geom/2d/triangle2d_contains_point.js +39 -0
- package/src/core/geom/2d/triangle2d_get_barycentric.d.ts +2 -2
- package/src/core/geom/2d/triangle2d_get_barycentric.d.ts.map +1 -1
- package/src/core/geom/2d/triangle2d_get_barycentric.js +1 -1
- package/src/core/geom/3d/topology/expandConnectivityByLocality.js +2 -2
- package/src/core/geom/Vector2.d.ts.map +1 -1
- package/src/core/geom/Vector2.js +2 -2
- package/src/core/math/bessel_3.d.ts +1 -1
- package/src/core/math/bessel_3.js +1 -1
- package/src/core/math/computeWholeDivisorLow.d.ts +1 -1
- package/src/core/math/computeWholeDivisorLow.d.ts.map +1 -1
- package/src/core/math/computeWholeDivisorLow.js +8 -5
- package/src/core/math/interval/separation1D.d.ts.map +1 -0
- package/src/core/math/{separation1D.js → interval/separation1D.js} +3 -3
- package/src/core/math/solveQuadratic.d.ts.map +1 -1
- package/src/core/math/solveQuadratic.js +10 -0
- package/src/core/model/object/compareValues.js +5 -5
- package/src/engine/EntityCreator.d.ts +11 -11
- package/src/engine/EntityCreator.d.ts.map +1 -1
- package/src/engine/EntityCreator.js +2 -4
- package/src/engine/ecs/EntityComponentDataset.js +3 -3
- package/src/engine/ecs/grid/HeightMap2NormalMap.js +2 -2
- package/src/engine/ecs/grid/NormalMap2AOMap.js +3 -3
- package/src/engine/graphics/ecs/mesh/SkeletonUtils.js +2 -2
- package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.d.ts +2 -2
- package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.d.ts.map +1 -1
- package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.js +5 -55
- package/src/engine/graphics/impostors/octahedral/util/sampler2d_build_cutout.d.ts +9 -0
- package/src/engine/graphics/impostors/octahedral/util/sampler2d_build_cutout.d.ts.map +1 -0
- package/src/engine/graphics/impostors/octahedral/util/sampler2d_build_cutout.js +64 -0
- package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.js +2 -2
- package/src/engine/graphics/texture/sampler/Sampler2D.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/Sampler2D.js +4 -2
- package/src/engine/graphics/texture/sampler/filter/kaiser_bessel_window.js +1 -1
- package/src/engine/graphics/texture/sampler/filter/sampler2d_scale_down_generic.js +1 -1
- package/src/engine/graphics/texture/sampler/sampler2d_multiply_vector.d.ts +8 -0
- package/src/engine/graphics/texture/sampler/sampler2d_multiply_vector.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/{sampler_multiply_vector.js → sampler2d_multiply_vector.js} +1 -1
- package/src/engine/graphics/texture/sampler/sampler2d_to_float32_texture.d.ts +8 -0
- package/src/engine/graphics/texture/sampler/sampler2d_to_float32_texture.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/{sampler2DToFloat32Texture.js → sampler2d_to_float32_texture.js} +2 -2
- package/src/engine/graphics/texture/sampler/util/drawSamplerHTML.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/util/drawSamplerHTML.js +3 -1
- package/src/engine/grid/obstacle/GridObstacle.d.ts.map +1 -1
- package/src/engine/grid/obstacle/GridObstacle.js +1 -1
- package/src/engine/physics/computeInterceptPoint.js +20 -6
- package/src/engine/physics/mls-mpm/MLS_MPM.d.ts.map +1 -1
- package/src/engine/physics/mls-mpm/MLS_MPM.js +14 -17
- package/src/engine/platform/WebEnginePlatform.d.ts.map +1 -1
- package/src/engine/platform/WebEnginePlatform.js +4 -4
- package/src/engine/save/GameStateLoader.js +2 -2
- package/src/engine/ui/cursor/CursorCoalescence.d.ts.map +1 -1
- package/src/engine/ui/cursor/CursorCoalescence.js +2 -2
- package/src/view/elements/radial/RadialMenu.js +2 -2
- package/src/core/UUID.d.ts +0 -6
- package/src/core/UUID.d.ts.map +0 -1
- package/src/core/UUID.js +0 -21
- package/src/core/collection/array/arrayIndexByEquality.d.ts.map +0 -1
- package/src/core/collection/array/arrayPickBestElement.d.ts.map +0 -1
- package/src/core/collection/array/arrayPickBestElements.d.ts +0 -8
- package/src/core/collection/array/arrayPickBestElements.d.ts.map +0 -1
- package/src/core/collection/array/arraySetDiff.d.ts.map +0 -1
- package/src/core/collection/array/arraySetSortingDiff.d.ts.map +0 -1
- package/src/core/geom/2d/compute_triangle_area_2d.d.ts.map +0 -1
- package/src/core/geom/2d/convex-hull/orientation3.d.ts +0 -12
- package/src/core/geom/2d/convex-hull/orientation3.d.ts.map +0 -1
- package/src/core/geom/2d/convex-hull/orientation3.js +0 -489
- package/src/core/geom/2d/convex-hull/orientation3_v2.d.ts +0 -9
- package/src/core/geom/2d/convex-hull/orientation3_v2.d.ts.map +0 -1
- package/src/core/geom/2d/convex-hull/orientation3_v2.js +0 -12
- package/src/core/math/separation1D.d.ts.map +0 -1
- package/src/core/primitives/array/compareArrays.d.ts.map +0 -1
- package/src/engine/graphics/texture/sampler/sampler2DToFloat32Texture.d.ts +0 -8
- package/src/engine/graphics/texture/sampler/sampler2DToFloat32Texture.d.ts.map +0 -1
- package/src/engine/graphics/texture/sampler/sampler_multiply_vector.d.ts +0 -8
- package/src/engine/graphics/texture/sampler/sampler_multiply_vector.d.ts.map +0 -1
- package/src/engine/graphics/texture/sampler/typedArrayConstructorByInstance.d.ts.map +0 -1
- package/src/engine/save/storage/InMemoryLocalStorage.d.ts +0 -6
- package/src/engine/save/storage/InMemoryLocalStorage.d.ts.map +0 -1
- package/src/engine/save/storage/InMemoryLocalStorage.js +0 -13
- /package/src/core/collection/array/{arrayPickBestElement.d.ts → array_pick_best_element.d.ts} +0 -0
- /package/src/core/{primitives → collection}/array/computeIntegerArrayHash.d.ts +0 -0
- /package/src/core/{primitives → collection}/array/computeIntegerArrayHash.js +0 -0
- /package/src/core/{primitives → collection}/array/computeStridedArrayHash.d.ts +0 -0
- /package/src/core/{primitives → collection}/array/computeStridedArrayHash.js +0 -0
- /package/src/core/{primitives → collection}/array/computeStridedIntegerArrayHash.d.ts +0 -0
- /package/src/core/{primitives → collection}/array/computeStridedIntegerArrayHash.js +0 -0
- /package/src/{engine/graphics/texture/sampler → core/collection/array/typed}/typedArrayConstructorByInstance.d.ts +0 -0
- /package/src/{engine/graphics/texture/sampler → core/collection/array/typed}/typedArrayConstructorByInstance.js +0 -0
- /package/src/core/math/{separation1D.d.ts → interval/separation1D.d.ts} +0 -0
package/build/meep.module.js
CHANGED
|
@@ -47413,7 +47413,7 @@ class Vector2 {
|
|
|
47413
47413
|
|
|
47414
47414
|
/**
|
|
47415
47415
|
*
|
|
47416
|
-
* @param {number[]} array
|
|
47416
|
+
* @param {number[]|Float32Array} array
|
|
47417
47417
|
* @param {number} offset
|
|
47418
47418
|
*/
|
|
47419
47419
|
fromArray(array, offset = 0) {
|
|
@@ -47425,7 +47425,7 @@ class Vector2 {
|
|
|
47425
47425
|
|
|
47426
47426
|
/**
|
|
47427
47427
|
*
|
|
47428
|
-
* @param {number[]} array
|
|
47428
|
+
* @param {number[]|Float32Array} array
|
|
47429
47429
|
* @param {number} offset
|
|
47430
47430
|
*/
|
|
47431
47431
|
toArray(array, offset = 0) {
|
|
@@ -49001,6 +49001,34 @@ function compute_typed_array_constructor_from_data_type(dt) {
|
|
|
49001
49001
|
return r;
|
|
49002
49002
|
}
|
|
49003
49003
|
|
|
49004
|
+
/**
|
|
49005
|
+
* Useful for computing hashes of large arrays, can pick a relevant stride and skip large chunks of memory while still capturing good amount of unique information from evenly-spaced areas of the array
|
|
49006
|
+
* @param {number[]|Uint32Array|Uint16Array|Uint8Array} array
|
|
49007
|
+
* @param {number} offset
|
|
49008
|
+
* @param {number} length
|
|
49009
|
+
* @param {number} stride
|
|
49010
|
+
* @return {number}
|
|
49011
|
+
*/
|
|
49012
|
+
function computeStridedIntegerArrayHash(
|
|
49013
|
+
array, offset, length, stride
|
|
49014
|
+
) {
|
|
49015
|
+
let hash = length;
|
|
49016
|
+
|
|
49017
|
+
for (let i = offset; i < length; i += stride) {
|
|
49018
|
+
const value = array[i] >>> 0; //force uint32
|
|
49019
|
+
|
|
49020
|
+
/**
|
|
49021
|
+
* Simple hashing scheme, multiplying existing hash by a prime and adding next value
|
|
49022
|
+
* (h<<5) - h === h*31
|
|
49023
|
+
* @type {number}
|
|
49024
|
+
*/
|
|
49025
|
+
hash = ((hash << 5) - hash) + value;
|
|
49026
|
+
}
|
|
49027
|
+
|
|
49028
|
+
// force uint32
|
|
49029
|
+
return hash >>> 0;
|
|
49030
|
+
}
|
|
49031
|
+
|
|
49004
49032
|
/**
|
|
49005
49033
|
*
|
|
49006
49034
|
* @param {*} array
|
|
@@ -49126,47 +49154,6 @@ function is_typed_array_equals(a, b) {
|
|
|
49126
49154
|
return isArrayEqualStrict(a_proxy, b_proxy);
|
|
49127
49155
|
}
|
|
49128
49156
|
|
|
49129
|
-
/**
|
|
49130
|
-
* Based on code from reddit https://www.reddit.com/r/javascript/comments/jxa8x/bicubic_interpolation/
|
|
49131
|
-
* @param {number} t ratio
|
|
49132
|
-
* @param {number} a position -2
|
|
49133
|
-
* @param {number} b position -1
|
|
49134
|
-
* @param {number} c position +1
|
|
49135
|
-
* @param {number} d position +2
|
|
49136
|
-
* @returns {number}
|
|
49137
|
-
*/
|
|
49138
|
-
function interpolate_bicubic(t, a, b, c, d) {
|
|
49139
|
-
return 0.5 * (c - a + (2.0 * a - 5.0 * b + 4.0 * c - d + (3.0 * (b - c) + d - a) * t) * t) * t + b;
|
|
49140
|
-
}
|
|
49141
|
-
|
|
49142
|
-
/**
|
|
49143
|
-
* Useful for computing hashes of large arrays, can pick a relevant stride and skip large chunks of memory while still capturing good amount of unique information from evenly-spaced areas of the array
|
|
49144
|
-
* @param {number[]|Uint32Array|Uint16Array|Uint8Array} array
|
|
49145
|
-
* @param {number} offset
|
|
49146
|
-
* @param {number} length
|
|
49147
|
-
* @param {number} stride
|
|
49148
|
-
* @return {number}
|
|
49149
|
-
*/
|
|
49150
|
-
function computeStridedIntegerArrayHash(
|
|
49151
|
-
array, offset, length, stride
|
|
49152
|
-
) {
|
|
49153
|
-
let hash = length;
|
|
49154
|
-
|
|
49155
|
-
for (let i = offset; i < length; i += stride) {
|
|
49156
|
-
const value = array[i] >>> 0; //force uint32
|
|
49157
|
-
|
|
49158
|
-
/**
|
|
49159
|
-
* Simple hashing scheme, multiplying existing hash by a prime and adding next value
|
|
49160
|
-
* (h<<5) - h === h*31
|
|
49161
|
-
* @type {number}
|
|
49162
|
-
*/
|
|
49163
|
-
hash = ((hash << 5) - hash) + value;
|
|
49164
|
-
}
|
|
49165
|
-
|
|
49166
|
-
// force uint32
|
|
49167
|
-
return hash >>> 0;
|
|
49168
|
-
}
|
|
49169
|
-
|
|
49170
49157
|
function typedArrayConstructorByInstance(a) {
|
|
49171
49158
|
if (a instanceof Int8Array) {
|
|
49172
49159
|
return Int8Array;
|
|
@@ -49193,6 +49180,19 @@ function typedArrayConstructorByInstance(a) {
|
|
|
49193
49180
|
}
|
|
49194
49181
|
}
|
|
49195
49182
|
|
|
49183
|
+
/**
|
|
49184
|
+
* Based on code from reddit https://www.reddit.com/r/javascript/comments/jxa8x/bicubic_interpolation/
|
|
49185
|
+
* @param {number} t ratio
|
|
49186
|
+
* @param {number} a position -2
|
|
49187
|
+
* @param {number} b position -1
|
|
49188
|
+
* @param {number} c position +1
|
|
49189
|
+
* @param {number} d position +2
|
|
49190
|
+
* @returns {number}
|
|
49191
|
+
*/
|
|
49192
|
+
function interpolate_bicubic(t, a, b, c, d) {
|
|
49193
|
+
return 0.5 * (c - a + (2.0 * a - 5.0 * b + 4.0 * c - d + (3.0 * (b - c) + d - a) * t) * t) * t + b;
|
|
49194
|
+
}
|
|
49195
|
+
|
|
49196
49196
|
/**
|
|
49197
49197
|
* Data Texture class, providing an abstraction around 2d numerical arrays, mostly for sampling purposes
|
|
49198
49198
|
* Inspired by OpenGL's glsl sampler2d API
|
|
@@ -54442,7 +54442,10 @@ function overlap1D(a0, a1, b0, b1) {
|
|
|
54442
54442
|
* @param {number} by1
|
|
54443
54443
|
* @returns {boolean} true if overlap exists, false if no overlap
|
|
54444
54444
|
*/
|
|
54445
|
-
function aabb2_overlap_exists(
|
|
54445
|
+
function aabb2_overlap_exists(
|
|
54446
|
+
ax0, ay0, ax1, ay1,
|
|
54447
|
+
bx0, by0, bx1, by1
|
|
54448
|
+
) {
|
|
54446
54449
|
return overlap1D(ax0, ax1, bx0, bx1)
|
|
54447
54450
|
&& overlap1D(ay0, ay1, by0, by1);
|
|
54448
54451
|
}
|
|
@@ -59310,7 +59313,7 @@ function computeThreeTextureInternalFormatFromDataType(dt, channel_count) {
|
|
|
59310
59313
|
* @param {Sampler2D} sampler
|
|
59311
59314
|
* @returns {DataTexture}
|
|
59312
59315
|
*/
|
|
59313
|
-
function
|
|
59316
|
+
function sampler2d_to_float32_texture(sampler) {
|
|
59314
59317
|
|
|
59315
59318
|
const width = sampler.width;
|
|
59316
59319
|
const height = sampler.height;
|
|
@@ -59383,7 +59386,7 @@ function heightMap2NormalMap(renderer, sampler) {
|
|
|
59383
59386
|
const width = sampler.width;
|
|
59384
59387
|
const height = sampler.height;
|
|
59385
59388
|
|
|
59386
|
-
const texture =
|
|
59389
|
+
const texture = sampler2d_to_float32_texture(sampler);
|
|
59387
59390
|
|
|
59388
59391
|
//construct shader
|
|
59389
59392
|
const shader = new NormalMapShader();
|
|
@@ -59686,9 +59689,9 @@ function normalMap2OcclusionMap(
|
|
|
59686
59689
|
const width = resultSize.x;
|
|
59687
59690
|
const height = resultSize.y;
|
|
59688
59691
|
//
|
|
59689
|
-
const normalTexture =
|
|
59692
|
+
const normalTexture = sampler2d_to_float32_texture(normalMap);
|
|
59690
59693
|
|
|
59691
|
-
const heightTexture =
|
|
59694
|
+
const heightTexture = sampler2d_to_float32_texture(heightMap);
|
|
59692
59695
|
|
|
59693
59696
|
|
|
59694
59697
|
//construct shader
|
|
@@ -61404,7 +61407,7 @@ function objectsEqual(a, b) {
|
|
|
61404
61407
|
* @param {function(a:T,b:T):boolean} equals
|
|
61405
61408
|
* @returns {number} index of first match or -1 if no matches found
|
|
61406
61409
|
*/
|
|
61407
|
-
function
|
|
61410
|
+
function array_index_by_equality(array, element, equals) {
|
|
61408
61411
|
const n = array.length;
|
|
61409
61412
|
|
|
61410
61413
|
for (let i = 0; i < n; i++) {
|
|
@@ -61420,14 +61423,14 @@ function arrayIndexByEquality(array, element, equals) {
|
|
|
61420
61423
|
|
|
61421
61424
|
/**
|
|
61422
61425
|
* Compute a diff between two arrays, result is a 3 way split between common items, unique items in `a` array and unique items in `b` array
|
|
61423
|
-
* @see prefer to use {@link
|
|
61426
|
+
* @see prefer to use {@link array_set_diff_sorting}, as it's much faster, especially for large sets
|
|
61424
61427
|
* @template T
|
|
61425
61428
|
* @param {T[]} a
|
|
61426
61429
|
* @param {T[]} b
|
|
61427
61430
|
* @param {function(a:T,b:T):boolean} [equals] method to determine equality between two elements
|
|
61428
61431
|
* @returns {{uniqueA:T[], uniqueB:T[], common:T[]}}
|
|
61429
61432
|
*/
|
|
61430
|
-
function
|
|
61433
|
+
function array_set_diff(a, b, equals = strictEquals) {
|
|
61431
61434
|
|
|
61432
61435
|
const uniqueA = a.slice();
|
|
61433
61436
|
const uniqueB = b.slice();
|
|
@@ -61439,7 +61442,7 @@ function arraySetDiff(a, b, equals = strictEquals) {
|
|
|
61439
61442
|
for (let i = 0; i < a_length; i++) {
|
|
61440
61443
|
const elA = uniqueA[i];
|
|
61441
61444
|
|
|
61442
|
-
const j =
|
|
61445
|
+
const j = array_index_by_equality(uniqueB, elA, equals);
|
|
61443
61446
|
|
|
61444
61447
|
if (j !== -1) {
|
|
61445
61448
|
// common element found
|
|
@@ -61664,7 +61667,7 @@ class List {
|
|
|
61664
61667
|
|
|
61665
61668
|
const data = this.data;
|
|
61666
61669
|
|
|
61667
|
-
const diff =
|
|
61670
|
+
const diff = array_set_diff(data, new_data, objectsEqual);
|
|
61668
61671
|
|
|
61669
61672
|
//resolve diff
|
|
61670
61673
|
const removals = diff.uniqueA;
|
|
@@ -62183,7 +62186,7 @@ class List {
|
|
|
62183
62186
|
for (let i = 0; i < nThisItems; i++) {
|
|
62184
62187
|
const a = thisItems[i];
|
|
62185
62188
|
|
|
62186
|
-
const index =
|
|
62189
|
+
const index = array_index_by_equality(otherItems, a, invokeObjectEquals);
|
|
62187
62190
|
|
|
62188
62191
|
if (index !== -1) {
|
|
62189
62192
|
newData[index] = a;
|
|
@@ -87418,7 +87421,7 @@ class RingBuffer {
|
|
|
87418
87421
|
}
|
|
87419
87422
|
|
|
87420
87423
|
/**
|
|
87421
|
-
*
|
|
87424
|
+
* Removed first element that fulfills the criteria
|
|
87422
87425
|
* @param {function(V):boolean} condition
|
|
87423
87426
|
* @param {*} [thisArg]
|
|
87424
87427
|
* @returns {V|undefined}
|
|
@@ -94304,7 +94307,7 @@ class EntityComponentDataset {
|
|
|
94304
94307
|
|
|
94305
94308
|
const newComponentTypeCount = map.length;
|
|
94306
94309
|
|
|
94307
|
-
const diff =
|
|
94310
|
+
const diff = array_set_diff(map, this.componentTypeMap);
|
|
94308
94311
|
|
|
94309
94312
|
const typesToAdd = diff.uniqueA;
|
|
94310
94313
|
const typesToRemove = diff.uniqueB;
|
|
@@ -94522,7 +94525,7 @@ class EntityComponentDataset {
|
|
|
94522
94525
|
* @returns {boolean} false if no new classes were added, true if at least one new class was added
|
|
94523
94526
|
*/
|
|
94524
94527
|
registerManyComponentTypes(types) {
|
|
94525
|
-
const diff =
|
|
94528
|
+
const diff = array_set_diff(types, this.componentTypeMap);
|
|
94526
94529
|
|
|
94527
94530
|
if (diff.uniqueA.length === 0) {
|
|
94528
94531
|
// all classes area already registered
|
|
@@ -99187,6 +99190,30 @@ function intersects1D(a0, a1, b0, b1) {
|
|
|
99187
99190
|
return a1 >= b0 && b1 >= a0;
|
|
99188
99191
|
}
|
|
99189
99192
|
|
|
99193
|
+
/**
|
|
99194
|
+
*
|
|
99195
|
+
* @param {number} bounds_x0
|
|
99196
|
+
* @param {number} bounds_y0
|
|
99197
|
+
* @param {number} bounds_x1
|
|
99198
|
+
* @param {number} bounds_y1
|
|
99199
|
+
* @param {number} x0
|
|
99200
|
+
* @param {number} y0
|
|
99201
|
+
* @param {number} x1
|
|
99202
|
+
* @param {number} y1
|
|
99203
|
+
* @return {boolean}
|
|
99204
|
+
*/
|
|
99205
|
+
function aabb2_contains(
|
|
99206
|
+
bounds_x0, bounds_y0, bounds_x1, bounds_y1,
|
|
99207
|
+
x0, y0, x1, y1
|
|
99208
|
+
) {
|
|
99209
|
+
|
|
99210
|
+
return x0 >= bounds_x0
|
|
99211
|
+
&& x1 <= bounds_x1
|
|
99212
|
+
&& y0 >= bounds_y0
|
|
99213
|
+
&& y1 <= bounds_y1
|
|
99214
|
+
;
|
|
99215
|
+
}
|
|
99216
|
+
|
|
99190
99217
|
class Rectangle {
|
|
99191
99218
|
/**
|
|
99192
99219
|
*
|
|
@@ -99323,8 +99350,13 @@ class Rectangle {
|
|
|
99323
99350
|
|
|
99324
99351
|
const _x0 = p.x;
|
|
99325
99352
|
const _y0 = p.y;
|
|
99353
|
+
const _x1 = s.x + _x0;
|
|
99354
|
+
const _y1 = _y0 + s.y;
|
|
99326
99355
|
|
|
99327
|
-
return
|
|
99356
|
+
return aabb2_overlap_exists(
|
|
99357
|
+
_x0, _y0, _x1, _y1,
|
|
99358
|
+
x0, y0, x1, y1
|
|
99359
|
+
);
|
|
99328
99360
|
}
|
|
99329
99361
|
|
|
99330
99362
|
/**
|
|
@@ -99337,6 +99369,7 @@ class Rectangle {
|
|
|
99337
99369
|
const y0 = other.position.y;
|
|
99338
99370
|
const y1 = other.size.y + y0;
|
|
99339
99371
|
const x1 = other.size.x + x0;
|
|
99372
|
+
|
|
99340
99373
|
return this._overlaps(x0, y0, x1, y1);
|
|
99341
99374
|
}
|
|
99342
99375
|
|
|
@@ -99396,13 +99429,18 @@ class Rectangle {
|
|
|
99396
99429
|
_contains(x0, y0, x1, y1) {
|
|
99397
99430
|
const size = this.size;
|
|
99398
99431
|
|
|
99399
|
-
const
|
|
99400
|
-
|
|
99432
|
+
const position = this.position;
|
|
99433
|
+
|
|
99434
|
+
const _x0 = position.x;
|
|
99435
|
+
const _y0 = position.y;
|
|
99401
99436
|
|
|
99402
99437
|
const _y1 = size.y + _y0;
|
|
99403
99438
|
const _x1 = size.x + _x0;
|
|
99404
99439
|
|
|
99405
|
-
return
|
|
99440
|
+
return aabb2_contains(
|
|
99441
|
+
_x0, _y0, _x1, _y1,
|
|
99442
|
+
x0, y0, x1, y1
|
|
99443
|
+
);
|
|
99406
99444
|
}
|
|
99407
99445
|
|
|
99408
99446
|
/**
|
|
@@ -99413,6 +99451,7 @@ class Rectangle {
|
|
|
99413
99451
|
contains(other) {
|
|
99414
99452
|
const x0 = other.position.x;
|
|
99415
99453
|
const y0 = other.position.y;
|
|
99454
|
+
|
|
99416
99455
|
const y1 = other.size.y + y0;
|
|
99417
99456
|
const x1 = other.size.x + x0;
|
|
99418
99457
|
|
|
@@ -115448,43 +115487,138 @@ function getURLHash() {
|
|
|
115448
115487
|
return result;
|
|
115449
115488
|
}
|
|
115450
115489
|
|
|
115451
|
-
|
|
115452
|
-
|
|
115453
|
-
|
|
115454
|
-
|
|
115455
|
-
|
|
115456
|
-
|
|
115490
|
+
/**
|
|
115491
|
+
* Picks element with highest score from the array using supplied scoring function.
|
|
115492
|
+
* If multiple elements with the same highest score exist, the result will be first such encountered element
|
|
115493
|
+
* @template T
|
|
115494
|
+
* @param {T[]} array
|
|
115495
|
+
* @param {function(el:T, index:number):number} scoreFunction
|
|
115496
|
+
* @returns {T|undefined}
|
|
115497
|
+
*/
|
|
115498
|
+
function array_pick_best_element(array, scoreFunction) {
|
|
115499
|
+
|
|
115500
|
+
let bestElement;
|
|
115501
|
+
let bestScore;
|
|
115502
|
+
|
|
115503
|
+
const size = array.length;
|
|
115504
|
+
|
|
115505
|
+
if (size === 0) {
|
|
115506
|
+
return undefined;
|
|
115457
115507
|
}
|
|
115458
115508
|
|
|
115459
|
-
|
|
115460
|
-
|
|
115461
|
-
|
|
115462
|
-
|
|
115463
|
-
|
|
115509
|
+
bestElement = array[0];
|
|
115510
|
+
|
|
115511
|
+
bestScore = scoreFunction(bestElement, 0);
|
|
115512
|
+
|
|
115513
|
+
for (let i = 1; i < size; i++) {
|
|
115514
|
+
const el = array[i];
|
|
115515
|
+
|
|
115516
|
+
// compute score
|
|
115517
|
+
const score = scoreFunction(el, i);
|
|
115518
|
+
|
|
115519
|
+
if (score > bestScore) {
|
|
115520
|
+
bestScore = score;
|
|
115521
|
+
bestElement = el;
|
|
115522
|
+
}
|
|
115523
|
+
}
|
|
115524
|
+
|
|
115525
|
+
return bestElement;
|
|
115526
|
+
}
|
|
115527
|
+
|
|
115528
|
+
/**
|
|
115529
|
+
* Base class for implementing achievement system API connectors
|
|
115530
|
+
*/
|
|
115531
|
+
class AchievementGateway {
|
|
115532
|
+
constructor() {
|
|
115533
|
+
|
|
115464
115534
|
}
|
|
115465
115535
|
|
|
115466
115536
|
/**
|
|
115467
|
-
*
|
|
115468
|
-
* @returns {
|
|
115537
|
+
* Retrieve list of unlocked achievements
|
|
115538
|
+
* @returns {Promise<String[]>} IDs of unlocked achievements
|
|
115469
115539
|
*/
|
|
115470
|
-
|
|
115540
|
+
getUnlocked() {
|
|
115541
|
+
//needs to be overridden in subclass
|
|
115471
115542
|
throw new Error('Not implemented');
|
|
115472
115543
|
}
|
|
115473
115544
|
|
|
115474
115545
|
/**
|
|
115546
|
+
* Unlock an achievements by ID
|
|
115547
|
+
* @param {String} id
|
|
115475
115548
|
* @returns {Promise}
|
|
115476
115549
|
*/
|
|
115477
|
-
|
|
115478
|
-
|
|
115550
|
+
unlock(id) {
|
|
115551
|
+
//needs to be overridden in subclass
|
|
115552
|
+
throw new Error('Not implemented');
|
|
115479
115553
|
}
|
|
115480
|
-
|
|
115554
|
+
}
|
|
115555
|
+
|
|
115556
|
+
class StorageAchievementGateway extends AchievementGateway {
|
|
115481
115557
|
/**
|
|
115482
|
-
*
|
|
115558
|
+
*
|
|
115559
|
+
* @param {Storage} storage
|
|
115560
|
+
* @param {String} [key]
|
|
115483
115561
|
*/
|
|
115484
|
-
|
|
115485
|
-
|
|
115562
|
+
constructor(storage, key = "achievements") {
|
|
115563
|
+
super();
|
|
115564
|
+
|
|
115565
|
+
this.storage = storage;
|
|
115566
|
+
|
|
115567
|
+
this.key = key;
|
|
115568
|
+
|
|
115569
|
+
this.last = Promise.resolve();
|
|
115570
|
+
}
|
|
115571
|
+
|
|
115572
|
+
getUnlocked() {
|
|
115573
|
+
return new Promise((resolve, reject) => {
|
|
115574
|
+
this.storage.load(this.key, (list) => {
|
|
115575
|
+
|
|
115576
|
+
if (list === undefined) {
|
|
115577
|
+
resolve([]);
|
|
115578
|
+
} else {
|
|
115579
|
+
resolve(list);
|
|
115580
|
+
}
|
|
115581
|
+
|
|
115582
|
+
}, reject, noop);
|
|
115583
|
+
});
|
|
115486
115584
|
}
|
|
115487
115585
|
|
|
115586
|
+
unlock(id) {
|
|
115587
|
+
const storage = this.storage;
|
|
115588
|
+
|
|
115589
|
+
const promise = this.last.finally(() => {
|
|
115590
|
+
return new Promise((resolve, reject) => {
|
|
115591
|
+
//read list of unlocked achievements
|
|
115592
|
+
storage.load(this.key, list => {
|
|
115593
|
+
|
|
115594
|
+
let unlocked;
|
|
115595
|
+
if (list !== undefined) {
|
|
115596
|
+
if (list.includes(id)) {
|
|
115597
|
+
//achievement is already unlocked
|
|
115598
|
+
resolve();
|
|
115599
|
+
return;
|
|
115600
|
+
}
|
|
115601
|
+
|
|
115602
|
+
unlocked = list.slice();
|
|
115603
|
+
|
|
115604
|
+
} else {
|
|
115605
|
+
unlocked = [];
|
|
115606
|
+
}
|
|
115607
|
+
|
|
115608
|
+
//modify unlocked achievements
|
|
115609
|
+
unlocked.push(id);
|
|
115610
|
+
|
|
115611
|
+
//write back
|
|
115612
|
+
storage.store(this.key, unlocked, resolve, reject, noop);
|
|
115613
|
+
}, reject, noop);
|
|
115614
|
+
});
|
|
115615
|
+
}
|
|
115616
|
+
);
|
|
115617
|
+
|
|
115618
|
+
this.last = promise;
|
|
115619
|
+
|
|
115620
|
+
return promise;
|
|
115621
|
+
}
|
|
115488
115622
|
}
|
|
115489
115623
|
|
|
115490
115624
|
class Storage {
|
|
@@ -115758,138 +115892,43 @@ class IndexedDBStorage extends Storage {
|
|
|
115758
115892
|
}
|
|
115759
115893
|
}
|
|
115760
115894
|
|
|
115761
|
-
|
|
115762
|
-
* Base class for implementing achievement system API connectors
|
|
115763
|
-
*/
|
|
115764
|
-
class AchievementGateway {
|
|
115765
|
-
constructor() {
|
|
115766
|
-
|
|
115767
|
-
}
|
|
115768
|
-
|
|
115895
|
+
class EnginePlatform {
|
|
115769
115896
|
/**
|
|
115770
|
-
*
|
|
115771
|
-
* @returns {Promise<String[]>} IDs of unlocked achievements
|
|
115897
|
+
* @returns {Storage}
|
|
115772
115898
|
*/
|
|
115773
|
-
|
|
115774
|
-
//needs to be overridden in subclass
|
|
115899
|
+
getStorage() {
|
|
115775
115900
|
throw new Error('Not implemented');
|
|
115776
115901
|
}
|
|
115777
115902
|
|
|
115778
115903
|
/**
|
|
115779
|
-
*
|
|
115780
|
-
* @param {String} id
|
|
115781
|
-
* @returns {Promise}
|
|
115904
|
+
* @returns {AchievementGateway}
|
|
115782
115905
|
*/
|
|
115783
|
-
|
|
115784
|
-
//needs to be overridden in subclass
|
|
115906
|
+
getAchievementGateway() {
|
|
115785
115907
|
throw new Error('Not implemented');
|
|
115786
115908
|
}
|
|
115787
|
-
|
|
115788
|
-
|
|
115789
|
-
class StorageAchievementGateway extends AchievementGateway {
|
|
115909
|
+
|
|
115790
115910
|
/**
|
|
115791
|
-
*
|
|
115792
|
-
* @
|
|
115793
|
-
* @param {String} [key]
|
|
115911
|
+
* @param {string[]} options
|
|
115912
|
+
* @returns {string}
|
|
115794
115913
|
*/
|
|
115795
|
-
|
|
115796
|
-
|
|
115797
|
-
|
|
115798
|
-
this.storage = storage;
|
|
115799
|
-
|
|
115800
|
-
this.key = key;
|
|
115801
|
-
|
|
115802
|
-
this.last = Promise.resolve();
|
|
115803
|
-
}
|
|
115804
|
-
|
|
115805
|
-
getUnlocked() {
|
|
115806
|
-
return new Promise((resolve, reject) => {
|
|
115807
|
-
this.storage.load(this.key, (list) => {
|
|
115808
|
-
|
|
115809
|
-
if (list === undefined) {
|
|
115810
|
-
resolve([]);
|
|
115811
|
-
} else {
|
|
115812
|
-
resolve(list);
|
|
115813
|
-
}
|
|
115814
|
-
|
|
115815
|
-
}, reject, noop);
|
|
115816
|
-
});
|
|
115817
|
-
}
|
|
115818
|
-
|
|
115819
|
-
unlock(id) {
|
|
115820
|
-
const storage = this.storage;
|
|
115821
|
-
|
|
115822
|
-
const promise = this.last.finally(() => {
|
|
115823
|
-
return new Promise((resolve, reject) => {
|
|
115824
|
-
//read list of unlocked achievements
|
|
115825
|
-
storage.load(this.key, list => {
|
|
115826
|
-
|
|
115827
|
-
let unlocked;
|
|
115828
|
-
if (list !== undefined) {
|
|
115829
|
-
if (list.includes(id)) {
|
|
115830
|
-
//achievement is already unlocked
|
|
115831
|
-
resolve();
|
|
115832
|
-
return;
|
|
115833
|
-
}
|
|
115834
|
-
|
|
115835
|
-
unlocked = list.slice();
|
|
115836
|
-
|
|
115837
|
-
} else {
|
|
115838
|
-
unlocked = [];
|
|
115839
|
-
}
|
|
115840
|
-
|
|
115841
|
-
//modify unlocked achievements
|
|
115842
|
-
unlocked.push(id);
|
|
115843
|
-
|
|
115844
|
-
//write back
|
|
115845
|
-
storage.store(this.key, unlocked, resolve, reject, noop);
|
|
115846
|
-
}, reject, noop);
|
|
115847
|
-
});
|
|
115848
|
-
}
|
|
115849
|
-
);
|
|
115850
|
-
|
|
115851
|
-
this.last = promise;
|
|
115852
|
-
|
|
115853
|
-
return promise;
|
|
115914
|
+
pickDefaultLocale(options) {
|
|
115915
|
+
throw new Error('Not implemented');
|
|
115854
115916
|
}
|
|
115855
|
-
}
|
|
115856
|
-
|
|
115857
|
-
/**
|
|
115858
|
-
* Picks element with highest score from the array using supplied scoring function.
|
|
115859
|
-
* If multiple elements with the same highest score exist, the result will be first such encountered element
|
|
115860
|
-
* @template T
|
|
115861
|
-
* @param {T[]} array
|
|
115862
|
-
* @param {function(el:T, index:number):number} scoreFunction
|
|
115863
|
-
* @returns {T|undefined}
|
|
115864
|
-
*/
|
|
115865
|
-
function arrayPickBestElement(array, scoreFunction) {
|
|
115866
|
-
|
|
115867
|
-
let bestElement;
|
|
115868
|
-
let bestScore;
|
|
115869
115917
|
|
|
115870
|
-
|
|
115871
|
-
|
|
115872
|
-
|
|
115873
|
-
|
|
115918
|
+
/**
|
|
115919
|
+
* @returns {Promise}
|
|
115920
|
+
*/
|
|
115921
|
+
startup() {
|
|
115922
|
+
return Promise.resolve();
|
|
115874
115923
|
}
|
|
115875
115924
|
|
|
115876
|
-
|
|
115877
|
-
|
|
115878
|
-
|
|
115879
|
-
|
|
115880
|
-
|
|
115881
|
-
const el = array[i];
|
|
115882
|
-
|
|
115883
|
-
// compute score
|
|
115884
|
-
const score = scoreFunction(el, i);
|
|
115885
|
-
|
|
115886
|
-
if (score > bestScore) {
|
|
115887
|
-
bestScore = score;
|
|
115888
|
-
bestElement = el;
|
|
115889
|
-
}
|
|
115925
|
+
/**
|
|
115926
|
+
* @returns {Promise}
|
|
115927
|
+
*/
|
|
115928
|
+
shutdown() {
|
|
115929
|
+
return Promise.resolve();
|
|
115890
115930
|
}
|
|
115891
115931
|
|
|
115892
|
-
return bestElement;
|
|
115893
115932
|
}
|
|
115894
115933
|
|
|
115895
115934
|
class WebEnginePlatform extends EnginePlatform {
|
|
@@ -115964,7 +116003,7 @@ class WebEnginePlatform extends EnginePlatform {
|
|
|
115964
116003
|
};
|
|
115965
116004
|
});
|
|
115966
116005
|
|
|
115967
|
-
const best =
|
|
116006
|
+
const best = array_pick_best_element(scoredKeys, o => o.score);
|
|
115968
116007
|
|
|
115969
116008
|
if (best.score === 0) {
|
|
115970
116009
|
return 'en-gb';
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
typedArrayConstructorByInstance
|
|
3
|
+
} from "../../../../src/core/collection/array/typed/typedArrayConstructorByInstance.js";
|
|
1
4
|
import { FrameRunner } from "../../../../src/engine/graphics/FrameRunner.js";
|
|
2
5
|
import canvas2Sampler2D from "../../../../src/engine/graphics/texture/Canvas2Sampler2D.js";
|
|
3
6
|
import {
|
|
@@ -10,9 +13,6 @@ import {
|
|
|
10
13
|
sampler2d_compute_texel_value_conversion_scale_to_uint8
|
|
11
14
|
} from "../../../../src/engine/graphics/texture/sampler/sampler2d_compute_texel_value_conversion_scale_to_uint8.js";
|
|
12
15
|
import sampler2D2Canvas from "../../../../src/engine/graphics/texture/sampler/sampler2d_to_html_canvas.js";
|
|
13
|
-
import {
|
|
14
|
-
typedArrayConstructorByInstance
|
|
15
|
-
} from "../../../../src/engine/graphics/texture/sampler/typedArrayConstructorByInstance.js";
|
|
16
16
|
import { MouseEvents } from "../../../../src/engine/input/devices/events/MouseEvents.js";
|
|
17
17
|
import { CanvasView } from "../../../../src/view/elements/CanvasView.js";
|
|
18
18
|
import EmptyView from "../../../../src/view/elements/EmptyView.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { array_set_diff_sorting } from "../../../src/core/collection/array/array_set_diff_sorting.js";
|
|
2
2
|
import List from "../../../src/core/collection/list/List.js";
|
|
3
3
|
import Signal from "../../../src/core/events/signal/Signal.js";
|
|
4
4
|
import { number_compare_ascending } from "../../../src/core/primitives/numbers/number_compare_ascending.js";
|
|
@@ -50,7 +50,7 @@ export class HierarchicalEntityListView extends EmptyView {
|
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
// perform patch
|
|
53
|
-
const diff =
|
|
53
|
+
const diff = array_set_diff_sorting(new_roots, this.#roots.asArray(), number_compare_ascending);
|
|
54
54
|
|
|
55
55
|
for (let i = 0; i < diff.uniqueB.length; i++) {
|
|
56
56
|
const removal_id = diff.uniqueB[i];
|
package/package.json
CHANGED