@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.
- package/build/meep.cjs +96 -55
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +96 -55
- package/editor/ecs/component/editors/Sampler2DEditor.js +3 -3
- 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/collection/array/array_filter_by_multiple.d.ts +2 -0
- package/src/core/collection/array/array_filter_by_multiple.d.ts.map +1 -1
- package/src/core/collection/array/array_filter_by_multiple.js +11 -4
- package/src/core/collection/array/array_group_by.d.ts +10 -0
- package/src/core/collection/array/array_group_by.d.ts.map +1 -0
- package/src/core/collection/array/{groupArrayBy.js → array_group_by.js} +3 -3
- package/src/core/collection/array/array_sort_quick.d.ts +13 -0
- package/src/core/collection/array/array_sort_quick.d.ts.map +1 -0
- package/src/core/collection/array/{arrayQuickSort.js → array_sort_quick.js} +5 -1
- package/src/core/collection/array/combine_hash.js +1 -1
- package/src/core/{primitives → collection}/array/compareArrays.d.ts.map +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/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/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 +3 -3
- 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/grid/HeightMap2NormalMap.js +2 -2
- package/src/engine/ecs/grid/NormalMap2AOMap.js +3 -3
- 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/render/forward_plus/LightManager.js +2 -2
- package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.js +2 -2
- package/src/engine/graphics/sh3/path_tracer/sorting/sort_bvh_nodes_by_distance_to_point.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/graphics/texture/virtual/VirtualTextureTileLoader.js +2 -2
- 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/generation/grid/generation/road/GridTaskGenerateRoads.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/arrayQuickSort.d.ts +0 -12
- package/src/core/collection/array/arrayQuickSort.d.ts.map +0 -1
- package/src/core/collection/array/array_remove_element.d.ts +0 -11
- package/src/core/collection/array/array_remove_element.d.ts.map +0 -1
- package/src/core/collection/array/array_remove_element.js +0 -16
- package/src/core/collection/array/groupArrayBy.d.ts +0 -10
- package/src/core/collection/array/groupArrayBy.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/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/{primitives → collection}/array/compareArrays.d.ts +0 -0
- /package/src/core/{primitives → collection}/array/compareArrays.js +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
|
|
@@ -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}
|
|
@@ -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
|
|
|
@@ -106396,6 +106435,7 @@ function computeBinaryDataTypeByPrecision(type, precision) {
|
|
|
106396
106435
|
const stack$1 = [];
|
|
106397
106436
|
|
|
106398
106437
|
/**
|
|
106438
|
+
* Quicksort implementation, instead of compare operator, uses scoring function
|
|
106399
106439
|
* @template T
|
|
106400
106440
|
* @param {T[]|ArrayLike<number>|Uint32Array} data
|
|
106401
106441
|
* @param {function(T):number} score_function
|
|
@@ -106405,12 +106445,13 @@ const stack$1 = [];
|
|
|
106405
106445
|
* @param {function(T[],number, number):*} [swap_operator]
|
|
106406
106446
|
* @param {*} [swap_context]
|
|
106407
106447
|
*/
|
|
106408
|
-
function
|
|
106448
|
+
function array_sort_quick(
|
|
106409
106449
|
data,
|
|
106410
106450
|
score_function, score_function_context,
|
|
106411
106451
|
start = 0, end = data.length - 1,
|
|
106412
106452
|
swap_operator = array_swap_one, swap_context = undefined
|
|
106413
106453
|
) {
|
|
106454
|
+
|
|
106414
106455
|
if (start >= end) {
|
|
106415
106456
|
// section of 0 size, nothing to sort
|
|
106416
106457
|
return;
|
|
@@ -111351,7 +111392,7 @@ class LightManager {
|
|
|
111351
111392
|
array_copy(visible_light_set.elements, 0, sorted_lights, 0, visible_light_count);
|
|
111352
111393
|
array_copy(visible_decal_set.elements, 0, sorted_lights, visible_light_count, visible_decal_count);
|
|
111353
111394
|
|
|
111354
|
-
|
|
111395
|
+
array_sort_quick(sorted_lights, this.__sort_visible_light_score, this, 0, expected_sorted_size - 1);
|
|
111355
111396
|
}
|
|
111356
111397
|
|
|
111357
111398
|
__update_visible_bvh() {
|
|
@@ -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";
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clz32.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/clz32.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,yBAHW,MAAM,GACJ,MAAM,CAiClB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Count leading zeroes in a 32bit integer
|
|
3
|
+
* @param {number} x
|
|
4
|
+
* @returns {number}
|
|
5
|
+
*/
|
|
6
|
+
export function clz32(x) {
|
|
7
|
+
if (x === 0) {
|
|
8
|
+
return 32;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let v = x >>> 0;
|
|
12
|
+
let result = 0;
|
|
13
|
+
|
|
14
|
+
// Binary search.
|
|
15
|
+
if ((v & 0xFFFF0000) === 0) {
|
|
16
|
+
v <<= 16;
|
|
17
|
+
result += 16;
|
|
18
|
+
}
|
|
19
|
+
if ((v & 0xFF000000) === 0) {
|
|
20
|
+
v <<= 8;
|
|
21
|
+
result += 8;
|
|
22
|
+
}
|
|
23
|
+
if ((v & 0xF0000000) === 0) {
|
|
24
|
+
v <<= 4;
|
|
25
|
+
result += 4;
|
|
26
|
+
}
|
|
27
|
+
if ((v & 0xC0000000) === 0) {
|
|
28
|
+
v <<= 2;
|
|
29
|
+
result += 2;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if ((v & 0x80000000) === 0) {
|
|
33
|
+
result += 1;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is_data_url.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/is_data_url.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"is_data_url.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/is_data_url.js"],"names":[],"mappings":"AACA;;;;GAIG;AACH,iCAHW,MAAM,GACL,OAAO,CAQlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeArrayBuffer.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/makeArrayBuffer.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,2CAJW,MAAM,WACN,OAAO,GACN,WAAW,GAAC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"makeArrayBuffer.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/makeArrayBuffer.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,2CAJW,MAAM,WACN,OAAO,GACN,WAAW,GAAC,iBAAiB,CAexC"}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* get most significant set bit
|
|
3
|
+
* @see https://graphics.stanford.edu/~seander/bithacks.html
|
|
4
|
+
* @param {number} x 32 bit integer
|
|
5
|
+
* @returns {number} integer position of most significant bit
|
|
6
|
+
*/
|
|
7
|
+
export function msb_32(x: number): number;
|
|
2
8
|
//# sourceMappingURL=msb_32.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"msb_32.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/msb_32.js"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"msb_32.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/msb_32.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,0BAHW,MAAM,GACJ,MAAM,CAIlB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { clz32 } from "./clz32.js";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* get most significant set bit
|
|
@@ -6,15 +6,6 @@ import { msb_lut_de_bruijn } from "./msb_lut_de_bruijn.js";
|
|
|
6
6
|
* @param {number} x 32 bit integer
|
|
7
7
|
* @returns {number} integer position of most significant bit
|
|
8
8
|
*/
|
|
9
|
-
function msb_32(x) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
v |= v >>> 1;
|
|
13
|
-
v |= v >>> 2;
|
|
14
|
-
v |= v >>> 4;
|
|
15
|
-
v |= v >>> 8;
|
|
16
|
-
v |= v >>> 16;
|
|
17
|
-
v = (v >>> 1) + 1;
|
|
18
|
-
|
|
19
|
-
return msb_lut_de_bruijn[(v * 0x077CB531) >>> 27];
|
|
9
|
+
export function msb_32(x) {
|
|
10
|
+
return 31 - clz32(x);
|
|
20
11
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* Similar to standard {@link Array.prototype.filter}, but allows multiple filters. They work as an "AND".
|
|
3
|
+
* Useful to save allocations when multiple filters need to be applied, as the {@link Array.prototype.filter} allocates a new array for each call
|
|
2
4
|
* @template T
|
|
3
5
|
* @param {T[]} input_items
|
|
4
6
|
* @param {((T)=>boolean)[]} filters
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array_filter_by_multiple.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/array_filter_by_multiple.js"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"array_filter_by_multiple.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/array_filter_by_multiple.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,oFAHiB,OAAO,UAqCvB"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* Similar to standard {@link Array.prototype.filter}, but allows multiple filters. They work as an "AND".
|
|
3
|
+
* Useful to save allocations when multiple filters need to be applied, as the {@link Array.prototype.filter} allocates a new array for each call
|
|
2
4
|
* @template T
|
|
3
5
|
* @param {T[]} input_items
|
|
4
6
|
* @param {((T)=>boolean)[]} filters
|
|
@@ -13,23 +15,28 @@ export function array_filter_by_multiple(input_items, filters) {
|
|
|
13
15
|
return input_items;
|
|
14
16
|
}
|
|
15
17
|
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @type {T[]}
|
|
21
|
+
*/
|
|
16
22
|
const filtered = [];
|
|
17
23
|
|
|
18
24
|
const input_item_count = input_items.length;
|
|
19
25
|
|
|
20
|
-
|
|
21
26
|
main_loop:for (let i = 0; i < input_item_count; i++) {
|
|
22
|
-
const
|
|
27
|
+
const datum = input_items[i];
|
|
28
|
+
|
|
23
29
|
for (let j = 0; j < filter_count; j++) {
|
|
24
30
|
const filter = filters[j];
|
|
25
31
|
|
|
26
|
-
if (filter(
|
|
32
|
+
if (filter(datum) === false) {
|
|
33
|
+
// filter rejected, let's move onto next element
|
|
27
34
|
continue main_loop;
|
|
28
35
|
}
|
|
29
36
|
}
|
|
30
37
|
|
|
31
38
|
// filters passed
|
|
32
|
-
filtered.push(
|
|
39
|
+
filtered.push(datum);
|
|
33
40
|
}
|
|
34
41
|
|
|
35
42
|
return filtered;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @template T,K
|
|
3
|
+
* @param {T[]} array
|
|
4
|
+
* @param {function(T):K} grouping_key_producer given an element from input array, returns a grouping key. Can be an object, if it implements .equals method keys can be compared that way as well
|
|
5
|
+
* @param keyHashFunction
|
|
6
|
+
* @returns {Map<K,T[]>}
|
|
7
|
+
*/
|
|
8
|
+
export function array_group_by<T, K>(array: T[], grouping_key_producer: (arg0: T) => K, keyHashFunction?: typeof returnZero): Map<K, T[]>;
|
|
9
|
+
import { returnZero } from "../../function/returnZero.js";
|
|
10
|
+
//# sourceMappingURL=array_group_by.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array_group_by.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/array_group_by.js"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,0IA+BC;2BAzC0B,8BAA8B"}
|
|
@@ -4,11 +4,11 @@ import { HashMap } from "../map/HashMap.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* @template T,K
|
|
6
6
|
* @param {T[]} array
|
|
7
|
-
* @param {function(T):K}
|
|
7
|
+
* @param {function(T):K} grouping_key_producer given an element from input array, returns a grouping key. Can be an object, if it implements .equals method keys can be compared that way as well
|
|
8
8
|
* @param keyHashFunction
|
|
9
9
|
* @returns {Map<K,T[]>}
|
|
10
10
|
*/
|
|
11
|
-
export function
|
|
11
|
+
export function array_group_by(array, grouping_key_producer, keyHashFunction = returnZero) {
|
|
12
12
|
const result = new HashMap({
|
|
13
13
|
keyHashFunction,
|
|
14
14
|
keyEqualityFunction(a, b) {
|
|
@@ -27,7 +27,7 @@ export function groupArrayBy(array, groupingFunction, keyHashFunction = returnZe
|
|
|
27
27
|
for (let i = 0; i < array.length; i++) {
|
|
28
28
|
const element = array[i];
|
|
29
29
|
|
|
30
|
-
const groupKey =
|
|
30
|
+
const groupKey = grouping_key_producer(element);
|
|
31
31
|
|
|
32
32
|
const group = result.get(groupKey);
|
|
33
33
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Quicksort implementation, instead of compare operator, uses scoring function
|
|
3
|
+
* @template T
|
|
4
|
+
* @param {T[]|ArrayLike<number>|Uint32Array} data
|
|
5
|
+
* @param {function(T):number} score_function
|
|
6
|
+
* @param {*} [score_function_context]
|
|
7
|
+
* @param {number} [start]
|
|
8
|
+
* @param {number} [end]
|
|
9
|
+
* @param {function(T[],number, number):*} [swap_operator]
|
|
10
|
+
* @param {*} [swap_context]
|
|
11
|
+
*/
|
|
12
|
+
export function array_sort_quick<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;
|
|
13
|
+
//# sourceMappingURL=array_sort_quick.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array_sort_quick.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/array_sort_quick.js"],"names":[],"mappings":"AAKA;;;;;;;;;;GAUG;AACH,8GAPuB,MAAM,wCAElB,MAAM,QACN,MAAM,oCACO,MAAM,QAAE,MAAM,oCAmErC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { assert } from "../../assert.js";
|
|
1
2
|
import { array_swap_one } from "./array_swap_one.js";
|
|
2
3
|
|
|
3
4
|
const stack = [];
|
|
4
5
|
|
|
5
6
|
/**
|
|
7
|
+
* Quicksort implementation, instead of compare operator, uses scoring function
|
|
6
8
|
* @template T
|
|
7
9
|
* @param {T[]|ArrayLike<number>|Uint32Array} data
|
|
8
10
|
* @param {function(T):number} score_function
|
|
@@ -12,12 +14,14 @@ const stack = [];
|
|
|
12
14
|
* @param {function(T[],number, number):*} [swap_operator]
|
|
13
15
|
* @param {*} [swap_context]
|
|
14
16
|
*/
|
|
15
|
-
export function
|
|
17
|
+
export function array_sort_quick(
|
|
16
18
|
data,
|
|
17
19
|
score_function, score_function_context,
|
|
18
20
|
start = 0, end = data.length - 1,
|
|
19
21
|
swap_operator = array_swap_one, swap_context = undefined
|
|
20
22
|
) {
|
|
23
|
+
assert.isFunction(score_function, 'score_function');
|
|
24
|
+
|
|
21
25
|
if (start >= end) {
|
|
22
26
|
// section of 0 size, nothing to sort
|
|
23
27
|
return;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { assert } from "../../assert.js";
|
|
2
|
-
import { computeIntegerArrayHash } from "
|
|
2
|
+
import { computeIntegerArrayHash } from "./computeIntegerArrayHash.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Computes hash on integer values, useful for building composite hashes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compareArrays.d.ts","sourceRoot":"","sources":["../../../../../src/core/
|
|
1
|
+
{"version":3,"file":"compareArrays.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/compareArrays.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,qFAHyB,MAAM,GACnB,MAAM,CAwBjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeIntegerArrayHash.d.ts","sourceRoot":"","sources":["../../../../../src/core/
|
|
1
|
+
{"version":3,"file":"computeIntegerArrayHash.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/computeIntegerArrayHash.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,8CAJW,UAAU,GAAC,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,UAAU,UAChD,MAAM,UACN,MAAM,UAIhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeStridedArrayHash.d.ts","sourceRoot":"","sources":["../../../../../src/core/
|
|
1
|
+
{"version":3,"file":"computeStridedArrayHash.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/computeStridedArrayHash.js"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,wGAPW,MAAM,UACN,MAAM,UACN,MAAM,4BACM,MAAM,6BAEjB,MAAM,CAwBjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeStridedIntegerArrayHash.d.ts","sourceRoot":"","sources":["../../../../../src/core/
|
|
1
|
+
{"version":3,"file":"computeStridedIntegerArrayHash.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/computeStridedIntegerArrayHash.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,sDANW,MAAM,EAAE,GAAC,WAAW,GAAC,WAAW,GAAC,UAAU,UAC3C,MAAM,UACN,MAAM,UACN,MAAM,GACL,MAAM,CAoBjB"}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Pick multiple random items from an array
|
|
3
3
|
*
|
|
4
4
|
* @template T
|
|
5
|
-
* @param {function} random
|
|
6
|
-
* @param {T[]} source
|
|
7
|
-
* @param {T[]} target
|
|
8
|
-
* @param {number} count how many items to pick
|
|
9
|
-
* @returns {
|
|
5
|
+
* @param {function} random random function, must return a value between 0 and 1
|
|
6
|
+
* @param {T[]} source Where to pick elements from
|
|
7
|
+
* @param {T[]} target Where to place picked elements
|
|
8
|
+
* @param {number} count how many items to pick, if this number is greater than the length of {@link source}, it will be limited to length of {@link source} instead
|
|
9
|
+
* @returns {number} number of picked elements
|
|
10
10
|
*/
|
|
11
|
-
export function randomMultipleFromArray<T>(random: Function, source: T[], target: T[], count: number):
|
|
11
|
+
export function randomMultipleFromArray<T>(random: Function, source: T[], target: T[], count: number): number;
|
|
12
12
|
//# sourceMappingURL=randomMultipleFromArray.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"randomMultipleFromArray.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/randomMultipleFromArray.js"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,8FAHW,MAAM,
|
|
1
|
+
{"version":3,"file":"randomMultipleFromArray.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/randomMultipleFromArray.js"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,8FAHW,MAAM,GACJ,MAAM,CAsBlB"}
|
|
@@ -5,11 +5,11 @@ import { array_shuffle } from "./array_shuffle.js";
|
|
|
5
5
|
* Pick multiple random items from an array
|
|
6
6
|
*
|
|
7
7
|
* @template T
|
|
8
|
-
* @param {function} random
|
|
9
|
-
* @param {T[]} source
|
|
10
|
-
* @param {T[]} target
|
|
11
|
-
* @param {number} count how many items to pick
|
|
12
|
-
* @returns {
|
|
8
|
+
* @param {function} random random function, must return a value between 0 and 1
|
|
9
|
+
* @param {T[]} source Where to pick elements from
|
|
10
|
+
* @param {T[]} target Where to place picked elements
|
|
11
|
+
* @param {number} count how many items to pick, if this number is greater than the length of {@link source}, it will be limited to length of {@link source} instead
|
|
12
|
+
* @returns {number} number of picked elements
|
|
13
13
|
*/
|
|
14
14
|
export function randomMultipleFromArray(random, source, target, count) {
|
|
15
15
|
|