@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.cjs
CHANGED
|
@@ -47415,7 +47415,7 @@ class Vector2 {
|
|
|
47415
47415
|
|
|
47416
47416
|
/**
|
|
47417
47417
|
*
|
|
47418
|
-
* @param {number[]} array
|
|
47418
|
+
* @param {number[]|Float32Array} array
|
|
47419
47419
|
* @param {number} offset
|
|
47420
47420
|
*/
|
|
47421
47421
|
fromArray(array, offset = 0) {
|
|
@@ -47427,7 +47427,7 @@ class Vector2 {
|
|
|
47427
47427
|
|
|
47428
47428
|
/**
|
|
47429
47429
|
*
|
|
47430
|
-
* @param {number[]} array
|
|
47430
|
+
* @param {number[]|Float32Array} array
|
|
47431
47431
|
* @param {number} offset
|
|
47432
47432
|
*/
|
|
47433
47433
|
toArray(array, offset = 0) {
|
|
@@ -49003,6 +49003,34 @@ function compute_typed_array_constructor_from_data_type(dt) {
|
|
|
49003
49003
|
return r;
|
|
49004
49004
|
}
|
|
49005
49005
|
|
|
49006
|
+
/**
|
|
49007
|
+
* 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
|
|
49008
|
+
* @param {number[]|Uint32Array|Uint16Array|Uint8Array} array
|
|
49009
|
+
* @param {number} offset
|
|
49010
|
+
* @param {number} length
|
|
49011
|
+
* @param {number} stride
|
|
49012
|
+
* @return {number}
|
|
49013
|
+
*/
|
|
49014
|
+
function computeStridedIntegerArrayHash(
|
|
49015
|
+
array, offset, length, stride
|
|
49016
|
+
) {
|
|
49017
|
+
let hash = length;
|
|
49018
|
+
|
|
49019
|
+
for (let i = offset; i < length; i += stride) {
|
|
49020
|
+
const value = array[i] >>> 0; //force uint32
|
|
49021
|
+
|
|
49022
|
+
/**
|
|
49023
|
+
* Simple hashing scheme, multiplying existing hash by a prime and adding next value
|
|
49024
|
+
* (h<<5) - h === h*31
|
|
49025
|
+
* @type {number}
|
|
49026
|
+
*/
|
|
49027
|
+
hash = ((hash << 5) - hash) + value;
|
|
49028
|
+
}
|
|
49029
|
+
|
|
49030
|
+
// force uint32
|
|
49031
|
+
return hash >>> 0;
|
|
49032
|
+
}
|
|
49033
|
+
|
|
49006
49034
|
/**
|
|
49007
49035
|
*
|
|
49008
49036
|
* @param {*} array
|
|
@@ -49128,47 +49156,6 @@ function is_typed_array_equals(a, b) {
|
|
|
49128
49156
|
return isArrayEqualStrict(a_proxy, b_proxy);
|
|
49129
49157
|
}
|
|
49130
49158
|
|
|
49131
|
-
/**
|
|
49132
|
-
* Based on code from reddit https://www.reddit.com/r/javascript/comments/jxa8x/bicubic_interpolation/
|
|
49133
|
-
* @param {number} t ratio
|
|
49134
|
-
* @param {number} a position -2
|
|
49135
|
-
* @param {number} b position -1
|
|
49136
|
-
* @param {number} c position +1
|
|
49137
|
-
* @param {number} d position +2
|
|
49138
|
-
* @returns {number}
|
|
49139
|
-
*/
|
|
49140
|
-
function interpolate_bicubic(t, a, b, c, d) {
|
|
49141
|
-
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;
|
|
49142
|
-
}
|
|
49143
|
-
|
|
49144
|
-
/**
|
|
49145
|
-
* 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
|
|
49146
|
-
* @param {number[]|Uint32Array|Uint16Array|Uint8Array} array
|
|
49147
|
-
* @param {number} offset
|
|
49148
|
-
* @param {number} length
|
|
49149
|
-
* @param {number} stride
|
|
49150
|
-
* @return {number}
|
|
49151
|
-
*/
|
|
49152
|
-
function computeStridedIntegerArrayHash(
|
|
49153
|
-
array, offset, length, stride
|
|
49154
|
-
) {
|
|
49155
|
-
let hash = length;
|
|
49156
|
-
|
|
49157
|
-
for (let i = offset; i < length; i += stride) {
|
|
49158
|
-
const value = array[i] >>> 0; //force uint32
|
|
49159
|
-
|
|
49160
|
-
/**
|
|
49161
|
-
* Simple hashing scheme, multiplying existing hash by a prime and adding next value
|
|
49162
|
-
* (h<<5) - h === h*31
|
|
49163
|
-
* @type {number}
|
|
49164
|
-
*/
|
|
49165
|
-
hash = ((hash << 5) - hash) + value;
|
|
49166
|
-
}
|
|
49167
|
-
|
|
49168
|
-
// force uint32
|
|
49169
|
-
return hash >>> 0;
|
|
49170
|
-
}
|
|
49171
|
-
|
|
49172
49159
|
function typedArrayConstructorByInstance(a) {
|
|
49173
49160
|
if (a instanceof Int8Array) {
|
|
49174
49161
|
return Int8Array;
|
|
@@ -49195,6 +49182,19 @@ function typedArrayConstructorByInstance(a) {
|
|
|
49195
49182
|
}
|
|
49196
49183
|
}
|
|
49197
49184
|
|
|
49185
|
+
/**
|
|
49186
|
+
* Based on code from reddit https://www.reddit.com/r/javascript/comments/jxa8x/bicubic_interpolation/
|
|
49187
|
+
* @param {number} t ratio
|
|
49188
|
+
* @param {number} a position -2
|
|
49189
|
+
* @param {number} b position -1
|
|
49190
|
+
* @param {number} c position +1
|
|
49191
|
+
* @param {number} d position +2
|
|
49192
|
+
* @returns {number}
|
|
49193
|
+
*/
|
|
49194
|
+
function interpolate_bicubic(t, a, b, c, d) {
|
|
49195
|
+
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;
|
|
49196
|
+
}
|
|
49197
|
+
|
|
49198
49198
|
/**
|
|
49199
49199
|
* Data Texture class, providing an abstraction around 2d numerical arrays, mostly for sampling purposes
|
|
49200
49200
|
* Inspired by OpenGL's glsl sampler2d API
|
|
@@ -54444,7 +54444,10 @@ function overlap1D(a0, a1, b0, b1) {
|
|
|
54444
54444
|
* @param {number} by1
|
|
54445
54445
|
* @returns {boolean} true if overlap exists, false if no overlap
|
|
54446
54446
|
*/
|
|
54447
|
-
function aabb2_overlap_exists(
|
|
54447
|
+
function aabb2_overlap_exists(
|
|
54448
|
+
ax0, ay0, ax1, ay1,
|
|
54449
|
+
bx0, by0, bx1, by1
|
|
54450
|
+
) {
|
|
54448
54451
|
return overlap1D(ax0, ax1, bx0, bx1)
|
|
54449
54452
|
&& overlap1D(ay0, ay1, by0, by1);
|
|
54450
54453
|
}
|
|
@@ -59312,7 +59315,7 @@ function computeThreeTextureInternalFormatFromDataType(dt, channel_count) {
|
|
|
59312
59315
|
* @param {Sampler2D} sampler
|
|
59313
59316
|
* @returns {DataTexture}
|
|
59314
59317
|
*/
|
|
59315
|
-
function
|
|
59318
|
+
function sampler2d_to_float32_texture(sampler) {
|
|
59316
59319
|
|
|
59317
59320
|
const width = sampler.width;
|
|
59318
59321
|
const height = sampler.height;
|
|
@@ -59385,7 +59388,7 @@ function heightMap2NormalMap(renderer, sampler) {
|
|
|
59385
59388
|
const width = sampler.width;
|
|
59386
59389
|
const height = sampler.height;
|
|
59387
59390
|
|
|
59388
|
-
const texture =
|
|
59391
|
+
const texture = sampler2d_to_float32_texture(sampler);
|
|
59389
59392
|
|
|
59390
59393
|
//construct shader
|
|
59391
59394
|
const shader = new NormalMapShader();
|
|
@@ -59688,9 +59691,9 @@ function normalMap2OcclusionMap(
|
|
|
59688
59691
|
const width = resultSize.x;
|
|
59689
59692
|
const height = resultSize.y;
|
|
59690
59693
|
//
|
|
59691
|
-
const normalTexture =
|
|
59694
|
+
const normalTexture = sampler2d_to_float32_texture(normalMap);
|
|
59692
59695
|
|
|
59693
|
-
const heightTexture =
|
|
59696
|
+
const heightTexture = sampler2d_to_float32_texture(heightMap);
|
|
59694
59697
|
|
|
59695
59698
|
|
|
59696
59699
|
//construct shader
|
|
@@ -61406,7 +61409,7 @@ function objectsEqual(a, b) {
|
|
|
61406
61409
|
* @param {function(a:T,b:T):boolean} equals
|
|
61407
61410
|
* @returns {number} index of first match or -1 if no matches found
|
|
61408
61411
|
*/
|
|
61409
|
-
function
|
|
61412
|
+
function array_index_by_equality(array, element, equals) {
|
|
61410
61413
|
const n = array.length;
|
|
61411
61414
|
|
|
61412
61415
|
for (let i = 0; i < n; i++) {
|
|
@@ -61422,14 +61425,14 @@ function arrayIndexByEquality(array, element, equals) {
|
|
|
61422
61425
|
|
|
61423
61426
|
/**
|
|
61424
61427
|
* 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
|
|
61425
|
-
* @see prefer to use {@link
|
|
61428
|
+
* @see prefer to use {@link array_set_diff_sorting}, as it's much faster, especially for large sets
|
|
61426
61429
|
* @template T
|
|
61427
61430
|
* @param {T[]} a
|
|
61428
61431
|
* @param {T[]} b
|
|
61429
61432
|
* @param {function(a:T,b:T):boolean} [equals] method to determine equality between two elements
|
|
61430
61433
|
* @returns {{uniqueA:T[], uniqueB:T[], common:T[]}}
|
|
61431
61434
|
*/
|
|
61432
|
-
function
|
|
61435
|
+
function array_set_diff(a, b, equals = strictEquals) {
|
|
61433
61436
|
|
|
61434
61437
|
const uniqueA = a.slice();
|
|
61435
61438
|
const uniqueB = b.slice();
|
|
@@ -61441,7 +61444,7 @@ function arraySetDiff(a, b, equals = strictEquals) {
|
|
|
61441
61444
|
for (let i = 0; i < a_length; i++) {
|
|
61442
61445
|
const elA = uniqueA[i];
|
|
61443
61446
|
|
|
61444
|
-
const j =
|
|
61447
|
+
const j = array_index_by_equality(uniqueB, elA, equals);
|
|
61445
61448
|
|
|
61446
61449
|
if (j !== -1) {
|
|
61447
61450
|
// common element found
|
|
@@ -61666,7 +61669,7 @@ class List {
|
|
|
61666
61669
|
|
|
61667
61670
|
const data = this.data;
|
|
61668
61671
|
|
|
61669
|
-
const diff =
|
|
61672
|
+
const diff = array_set_diff(data, new_data, objectsEqual);
|
|
61670
61673
|
|
|
61671
61674
|
//resolve diff
|
|
61672
61675
|
const removals = diff.uniqueA;
|
|
@@ -62185,7 +62188,7 @@ class List {
|
|
|
62185
62188
|
for (let i = 0; i < nThisItems; i++) {
|
|
62186
62189
|
const a = thisItems[i];
|
|
62187
62190
|
|
|
62188
|
-
const index =
|
|
62191
|
+
const index = array_index_by_equality(otherItems, a, invokeObjectEquals);
|
|
62189
62192
|
|
|
62190
62193
|
if (index !== -1) {
|
|
62191
62194
|
newData[index] = a;
|
|
@@ -87420,7 +87423,7 @@ class RingBuffer {
|
|
|
87420
87423
|
}
|
|
87421
87424
|
|
|
87422
87425
|
/**
|
|
87423
|
-
*
|
|
87426
|
+
* Removed first element that fulfills the criteria
|
|
87424
87427
|
* @param {function(V):boolean} condition
|
|
87425
87428
|
* @param {*} [thisArg]
|
|
87426
87429
|
* @returns {V|undefined}
|
|
@@ -94306,7 +94309,7 @@ class EntityComponentDataset {
|
|
|
94306
94309
|
|
|
94307
94310
|
const newComponentTypeCount = map.length;
|
|
94308
94311
|
|
|
94309
|
-
const diff =
|
|
94312
|
+
const diff = array_set_diff(map, this.componentTypeMap);
|
|
94310
94313
|
|
|
94311
94314
|
const typesToAdd = diff.uniqueA;
|
|
94312
94315
|
const typesToRemove = diff.uniqueB;
|
|
@@ -94524,7 +94527,7 @@ class EntityComponentDataset {
|
|
|
94524
94527
|
* @returns {boolean} false if no new classes were added, true if at least one new class was added
|
|
94525
94528
|
*/
|
|
94526
94529
|
registerManyComponentTypes(types) {
|
|
94527
|
-
const diff =
|
|
94530
|
+
const diff = array_set_diff(types, this.componentTypeMap);
|
|
94528
94531
|
|
|
94529
94532
|
if (diff.uniqueA.length === 0) {
|
|
94530
94533
|
// all classes area already registered
|
|
@@ -99189,6 +99192,30 @@ function intersects1D(a0, a1, b0, b1) {
|
|
|
99189
99192
|
return a1 >= b0 && b1 >= a0;
|
|
99190
99193
|
}
|
|
99191
99194
|
|
|
99195
|
+
/**
|
|
99196
|
+
*
|
|
99197
|
+
* @param {number} bounds_x0
|
|
99198
|
+
* @param {number} bounds_y0
|
|
99199
|
+
* @param {number} bounds_x1
|
|
99200
|
+
* @param {number} bounds_y1
|
|
99201
|
+
* @param {number} x0
|
|
99202
|
+
* @param {number} y0
|
|
99203
|
+
* @param {number} x1
|
|
99204
|
+
* @param {number} y1
|
|
99205
|
+
* @return {boolean}
|
|
99206
|
+
*/
|
|
99207
|
+
function aabb2_contains(
|
|
99208
|
+
bounds_x0, bounds_y0, bounds_x1, bounds_y1,
|
|
99209
|
+
x0, y0, x1, y1
|
|
99210
|
+
) {
|
|
99211
|
+
|
|
99212
|
+
return x0 >= bounds_x0
|
|
99213
|
+
&& x1 <= bounds_x1
|
|
99214
|
+
&& y0 >= bounds_y0
|
|
99215
|
+
&& y1 <= bounds_y1
|
|
99216
|
+
;
|
|
99217
|
+
}
|
|
99218
|
+
|
|
99192
99219
|
class Rectangle {
|
|
99193
99220
|
/**
|
|
99194
99221
|
*
|
|
@@ -99325,8 +99352,13 @@ class Rectangle {
|
|
|
99325
99352
|
|
|
99326
99353
|
const _x0 = p.x;
|
|
99327
99354
|
const _y0 = p.y;
|
|
99355
|
+
const _x1 = s.x + _x0;
|
|
99356
|
+
const _y1 = _y0 + s.y;
|
|
99328
99357
|
|
|
99329
|
-
return
|
|
99358
|
+
return aabb2_overlap_exists(
|
|
99359
|
+
_x0, _y0, _x1, _y1,
|
|
99360
|
+
x0, y0, x1, y1
|
|
99361
|
+
);
|
|
99330
99362
|
}
|
|
99331
99363
|
|
|
99332
99364
|
/**
|
|
@@ -99339,6 +99371,7 @@ class Rectangle {
|
|
|
99339
99371
|
const y0 = other.position.y;
|
|
99340
99372
|
const y1 = other.size.y + y0;
|
|
99341
99373
|
const x1 = other.size.x + x0;
|
|
99374
|
+
|
|
99342
99375
|
return this._overlaps(x0, y0, x1, y1);
|
|
99343
99376
|
}
|
|
99344
99377
|
|
|
@@ -99398,13 +99431,18 @@ class Rectangle {
|
|
|
99398
99431
|
_contains(x0, y0, x1, y1) {
|
|
99399
99432
|
const size = this.size;
|
|
99400
99433
|
|
|
99401
|
-
const
|
|
99402
|
-
|
|
99434
|
+
const position = this.position;
|
|
99435
|
+
|
|
99436
|
+
const _x0 = position.x;
|
|
99437
|
+
const _y0 = position.y;
|
|
99403
99438
|
|
|
99404
99439
|
const _y1 = size.y + _y0;
|
|
99405
99440
|
const _x1 = size.x + _x0;
|
|
99406
99441
|
|
|
99407
|
-
return
|
|
99442
|
+
return aabb2_contains(
|
|
99443
|
+
_x0, _y0, _x1, _y1,
|
|
99444
|
+
x0, y0, x1, y1
|
|
99445
|
+
);
|
|
99408
99446
|
}
|
|
99409
99447
|
|
|
99410
99448
|
/**
|
|
@@ -99415,6 +99453,7 @@ class Rectangle {
|
|
|
99415
99453
|
contains(other) {
|
|
99416
99454
|
const x0 = other.position.x;
|
|
99417
99455
|
const y0 = other.position.y;
|
|
99456
|
+
|
|
99418
99457
|
const y1 = other.size.y + y0;
|
|
99419
99458
|
const x1 = other.size.x + x0;
|
|
99420
99459
|
|
|
@@ -115450,43 +115489,138 @@ function getURLHash() {
|
|
|
115450
115489
|
return result;
|
|
115451
115490
|
}
|
|
115452
115491
|
|
|
115453
|
-
|
|
115454
|
-
|
|
115455
|
-
|
|
115456
|
-
|
|
115457
|
-
|
|
115458
|
-
|
|
115492
|
+
/**
|
|
115493
|
+
* Picks element with highest score from the array using supplied scoring function.
|
|
115494
|
+
* If multiple elements with the same highest score exist, the result will be first such encountered element
|
|
115495
|
+
* @template T
|
|
115496
|
+
* @param {T[]} array
|
|
115497
|
+
* @param {function(el:T, index:number):number} scoreFunction
|
|
115498
|
+
* @returns {T|undefined}
|
|
115499
|
+
*/
|
|
115500
|
+
function array_pick_best_element(array, scoreFunction) {
|
|
115501
|
+
|
|
115502
|
+
let bestElement;
|
|
115503
|
+
let bestScore;
|
|
115504
|
+
|
|
115505
|
+
const size = array.length;
|
|
115506
|
+
|
|
115507
|
+
if (size === 0) {
|
|
115508
|
+
return undefined;
|
|
115459
115509
|
}
|
|
115460
115510
|
|
|
115461
|
-
|
|
115462
|
-
|
|
115463
|
-
|
|
115464
|
-
|
|
115465
|
-
|
|
115511
|
+
bestElement = array[0];
|
|
115512
|
+
|
|
115513
|
+
bestScore = scoreFunction(bestElement, 0);
|
|
115514
|
+
|
|
115515
|
+
for (let i = 1; i < size; i++) {
|
|
115516
|
+
const el = array[i];
|
|
115517
|
+
|
|
115518
|
+
// compute score
|
|
115519
|
+
const score = scoreFunction(el, i);
|
|
115520
|
+
|
|
115521
|
+
if (score > bestScore) {
|
|
115522
|
+
bestScore = score;
|
|
115523
|
+
bestElement = el;
|
|
115524
|
+
}
|
|
115525
|
+
}
|
|
115526
|
+
|
|
115527
|
+
return bestElement;
|
|
115528
|
+
}
|
|
115529
|
+
|
|
115530
|
+
/**
|
|
115531
|
+
* Base class for implementing achievement system API connectors
|
|
115532
|
+
*/
|
|
115533
|
+
class AchievementGateway {
|
|
115534
|
+
constructor() {
|
|
115535
|
+
|
|
115466
115536
|
}
|
|
115467
115537
|
|
|
115468
115538
|
/**
|
|
115469
|
-
*
|
|
115470
|
-
* @returns {
|
|
115539
|
+
* Retrieve list of unlocked achievements
|
|
115540
|
+
* @returns {Promise<String[]>} IDs of unlocked achievements
|
|
115471
115541
|
*/
|
|
115472
|
-
|
|
115542
|
+
getUnlocked() {
|
|
115543
|
+
//needs to be overridden in subclass
|
|
115473
115544
|
throw new Error('Not implemented');
|
|
115474
115545
|
}
|
|
115475
115546
|
|
|
115476
115547
|
/**
|
|
115548
|
+
* Unlock an achievements by ID
|
|
115549
|
+
* @param {String} id
|
|
115477
115550
|
* @returns {Promise}
|
|
115478
115551
|
*/
|
|
115479
|
-
|
|
115480
|
-
|
|
115552
|
+
unlock(id) {
|
|
115553
|
+
//needs to be overridden in subclass
|
|
115554
|
+
throw new Error('Not implemented');
|
|
115481
115555
|
}
|
|
115482
|
-
|
|
115556
|
+
}
|
|
115557
|
+
|
|
115558
|
+
class StorageAchievementGateway extends AchievementGateway {
|
|
115483
115559
|
/**
|
|
115484
|
-
*
|
|
115560
|
+
*
|
|
115561
|
+
* @param {Storage} storage
|
|
115562
|
+
* @param {String} [key]
|
|
115485
115563
|
*/
|
|
115486
|
-
|
|
115487
|
-
|
|
115564
|
+
constructor(storage, key = "achievements") {
|
|
115565
|
+
super();
|
|
115566
|
+
|
|
115567
|
+
this.storage = storage;
|
|
115568
|
+
|
|
115569
|
+
this.key = key;
|
|
115570
|
+
|
|
115571
|
+
this.last = Promise.resolve();
|
|
115572
|
+
}
|
|
115573
|
+
|
|
115574
|
+
getUnlocked() {
|
|
115575
|
+
return new Promise((resolve, reject) => {
|
|
115576
|
+
this.storage.load(this.key, (list) => {
|
|
115577
|
+
|
|
115578
|
+
if (list === undefined) {
|
|
115579
|
+
resolve([]);
|
|
115580
|
+
} else {
|
|
115581
|
+
resolve(list);
|
|
115582
|
+
}
|
|
115583
|
+
|
|
115584
|
+
}, reject, noop);
|
|
115585
|
+
});
|
|
115488
115586
|
}
|
|
115489
115587
|
|
|
115588
|
+
unlock(id) {
|
|
115589
|
+
const storage = this.storage;
|
|
115590
|
+
|
|
115591
|
+
const promise = this.last.finally(() => {
|
|
115592
|
+
return new Promise((resolve, reject) => {
|
|
115593
|
+
//read list of unlocked achievements
|
|
115594
|
+
storage.load(this.key, list => {
|
|
115595
|
+
|
|
115596
|
+
let unlocked;
|
|
115597
|
+
if (list !== undefined) {
|
|
115598
|
+
if (list.includes(id)) {
|
|
115599
|
+
//achievement is already unlocked
|
|
115600
|
+
resolve();
|
|
115601
|
+
return;
|
|
115602
|
+
}
|
|
115603
|
+
|
|
115604
|
+
unlocked = list.slice();
|
|
115605
|
+
|
|
115606
|
+
} else {
|
|
115607
|
+
unlocked = [];
|
|
115608
|
+
}
|
|
115609
|
+
|
|
115610
|
+
//modify unlocked achievements
|
|
115611
|
+
unlocked.push(id);
|
|
115612
|
+
|
|
115613
|
+
//write back
|
|
115614
|
+
storage.store(this.key, unlocked, resolve, reject, noop);
|
|
115615
|
+
}, reject, noop);
|
|
115616
|
+
});
|
|
115617
|
+
}
|
|
115618
|
+
);
|
|
115619
|
+
|
|
115620
|
+
this.last = promise;
|
|
115621
|
+
|
|
115622
|
+
return promise;
|
|
115623
|
+
}
|
|
115490
115624
|
}
|
|
115491
115625
|
|
|
115492
115626
|
class Storage {
|
|
@@ -115760,138 +115894,43 @@ class IndexedDBStorage extends Storage {
|
|
|
115760
115894
|
}
|
|
115761
115895
|
}
|
|
115762
115896
|
|
|
115763
|
-
|
|
115764
|
-
* Base class for implementing achievement system API connectors
|
|
115765
|
-
*/
|
|
115766
|
-
class AchievementGateway {
|
|
115767
|
-
constructor() {
|
|
115768
|
-
|
|
115769
|
-
}
|
|
115770
|
-
|
|
115897
|
+
class EnginePlatform {
|
|
115771
115898
|
/**
|
|
115772
|
-
*
|
|
115773
|
-
* @returns {Promise<String[]>} IDs of unlocked achievements
|
|
115899
|
+
* @returns {Storage}
|
|
115774
115900
|
*/
|
|
115775
|
-
|
|
115776
|
-
//needs to be overridden in subclass
|
|
115901
|
+
getStorage() {
|
|
115777
115902
|
throw new Error('Not implemented');
|
|
115778
115903
|
}
|
|
115779
115904
|
|
|
115780
115905
|
/**
|
|
115781
|
-
*
|
|
115782
|
-
* @param {String} id
|
|
115783
|
-
* @returns {Promise}
|
|
115906
|
+
* @returns {AchievementGateway}
|
|
115784
115907
|
*/
|
|
115785
|
-
|
|
115786
|
-
//needs to be overridden in subclass
|
|
115908
|
+
getAchievementGateway() {
|
|
115787
115909
|
throw new Error('Not implemented');
|
|
115788
115910
|
}
|
|
115789
|
-
|
|
115790
|
-
|
|
115791
|
-
class StorageAchievementGateway extends AchievementGateway {
|
|
115911
|
+
|
|
115792
115912
|
/**
|
|
115793
|
-
*
|
|
115794
|
-
* @
|
|
115795
|
-
* @param {String} [key]
|
|
115913
|
+
* @param {string[]} options
|
|
115914
|
+
* @returns {string}
|
|
115796
115915
|
*/
|
|
115797
|
-
|
|
115798
|
-
|
|
115799
|
-
|
|
115800
|
-
this.storage = storage;
|
|
115801
|
-
|
|
115802
|
-
this.key = key;
|
|
115803
|
-
|
|
115804
|
-
this.last = Promise.resolve();
|
|
115805
|
-
}
|
|
115806
|
-
|
|
115807
|
-
getUnlocked() {
|
|
115808
|
-
return new Promise((resolve, reject) => {
|
|
115809
|
-
this.storage.load(this.key, (list) => {
|
|
115810
|
-
|
|
115811
|
-
if (list === undefined) {
|
|
115812
|
-
resolve([]);
|
|
115813
|
-
} else {
|
|
115814
|
-
resolve(list);
|
|
115815
|
-
}
|
|
115816
|
-
|
|
115817
|
-
}, reject, noop);
|
|
115818
|
-
});
|
|
115819
|
-
}
|
|
115820
|
-
|
|
115821
|
-
unlock(id) {
|
|
115822
|
-
const storage = this.storage;
|
|
115823
|
-
|
|
115824
|
-
const promise = this.last.finally(() => {
|
|
115825
|
-
return new Promise((resolve, reject) => {
|
|
115826
|
-
//read list of unlocked achievements
|
|
115827
|
-
storage.load(this.key, list => {
|
|
115828
|
-
|
|
115829
|
-
let unlocked;
|
|
115830
|
-
if (list !== undefined) {
|
|
115831
|
-
if (list.includes(id)) {
|
|
115832
|
-
//achievement is already unlocked
|
|
115833
|
-
resolve();
|
|
115834
|
-
return;
|
|
115835
|
-
}
|
|
115836
|
-
|
|
115837
|
-
unlocked = list.slice();
|
|
115838
|
-
|
|
115839
|
-
} else {
|
|
115840
|
-
unlocked = [];
|
|
115841
|
-
}
|
|
115842
|
-
|
|
115843
|
-
//modify unlocked achievements
|
|
115844
|
-
unlocked.push(id);
|
|
115845
|
-
|
|
115846
|
-
//write back
|
|
115847
|
-
storage.store(this.key, unlocked, resolve, reject, noop);
|
|
115848
|
-
}, reject, noop);
|
|
115849
|
-
});
|
|
115850
|
-
}
|
|
115851
|
-
);
|
|
115852
|
-
|
|
115853
|
-
this.last = promise;
|
|
115854
|
-
|
|
115855
|
-
return promise;
|
|
115916
|
+
pickDefaultLocale(options) {
|
|
115917
|
+
throw new Error('Not implemented');
|
|
115856
115918
|
}
|
|
115857
|
-
}
|
|
115858
|
-
|
|
115859
|
-
/**
|
|
115860
|
-
* Picks element with highest score from the array using supplied scoring function.
|
|
115861
|
-
* If multiple elements with the same highest score exist, the result will be first such encountered element
|
|
115862
|
-
* @template T
|
|
115863
|
-
* @param {T[]} array
|
|
115864
|
-
* @param {function(el:T, index:number):number} scoreFunction
|
|
115865
|
-
* @returns {T|undefined}
|
|
115866
|
-
*/
|
|
115867
|
-
function arrayPickBestElement(array, scoreFunction) {
|
|
115868
|
-
|
|
115869
|
-
let bestElement;
|
|
115870
|
-
let bestScore;
|
|
115871
115919
|
|
|
115872
|
-
|
|
115873
|
-
|
|
115874
|
-
|
|
115875
|
-
|
|
115920
|
+
/**
|
|
115921
|
+
* @returns {Promise}
|
|
115922
|
+
*/
|
|
115923
|
+
startup() {
|
|
115924
|
+
return Promise.resolve();
|
|
115876
115925
|
}
|
|
115877
115926
|
|
|
115878
|
-
|
|
115879
|
-
|
|
115880
|
-
|
|
115881
|
-
|
|
115882
|
-
|
|
115883
|
-
const el = array[i];
|
|
115884
|
-
|
|
115885
|
-
// compute score
|
|
115886
|
-
const score = scoreFunction(el, i);
|
|
115887
|
-
|
|
115888
|
-
if (score > bestScore) {
|
|
115889
|
-
bestScore = score;
|
|
115890
|
-
bestElement = el;
|
|
115891
|
-
}
|
|
115927
|
+
/**
|
|
115928
|
+
* @returns {Promise}
|
|
115929
|
+
*/
|
|
115930
|
+
shutdown() {
|
|
115931
|
+
return Promise.resolve();
|
|
115892
115932
|
}
|
|
115893
115933
|
|
|
115894
|
-
return bestElement;
|
|
115895
115934
|
}
|
|
115896
115935
|
|
|
115897
115936
|
class WebEnginePlatform extends EnginePlatform {
|
|
@@ -115966,7 +116005,7 @@ class WebEnginePlatform extends EnginePlatform {
|
|
|
115966
116005
|
};
|
|
115967
116006
|
});
|
|
115968
116007
|
|
|
115969
|
-
const best =
|
|
116008
|
+
const best = array_pick_best_element(scoredKeys, o => o.score);
|
|
115970
116009
|
|
|
115971
116010
|
if (best.score === 0) {
|
|
115972
116011
|
return 'en-gb';
|