@woosh/meep-engine 2.110.7 → 2.110.9
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/bundle-worker-terrain.js +1 -1
- package/build/meep.cjs +115 -119
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +115 -119
- package/editor/tools/v2/TransformControls.js +11 -6
- package/package.json +2 -1
- package/src/core/UUID.d.ts +3 -0
- package/src/core/UUID.d.ts.map +1 -1
- package/src/core/UUID.js +9 -7
- package/src/core/collection/array/arraySetDiff.d.ts.map +1 -1
- package/src/core/collection/array/arraySetDiff.js +0 -1
- package/src/core/collection/array/binarySearchHighIndex.d.ts.map +1 -1
- package/src/core/collection/array/binarySearchHighIndex.js +7 -1
- package/src/core/collection/array/computeHashArray.d.ts.map +1 -1
- package/src/core/collection/array/computeHashArray.js +3 -2
- package/src/core/collection/array/fastArrayEquals.d.ts +1 -0
- package/src/core/collection/array/fastArrayEquals.d.ts.map +1 -1
- package/src/core/collection/array/fastArrayEquals.js +1 -0
- package/src/core/collection/array/isArrayEqual.d.ts.map +1 -1
- package/src/core/collection/array/isArrayEqual.js +9 -12
- package/src/core/collection/array/isArrayEqual.spec.d.ts +2 -0
- package/src/core/collection/array/isArrayEqual.spec.d.ts.map +1 -0
- package/src/core/collection/array/isArrayEqual.spec.js +25 -0
- package/src/core/collection/array/typed/is_typed_array_equals.d.ts.map +1 -1
- package/src/core/collection/array/typed/is_typed_array_equals.js +1 -0
- package/src/core/function/makeSequenceLoop.d.ts.map +1 -0
- package/src/core/geom/3d/shape/AbstractShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/AbstractShape3D.js +14 -0
- package/src/core/geom/3d/shape/PointShape3D.d.ts +9 -0
- package/src/core/geom/3d/shape/PointShape3D.d.ts.map +1 -0
- package/src/core/geom/3d/shape/PointShape3D.js +14 -0
- package/src/core/geom/3d/shape/TransformedShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/TransformedShape3D.js +26 -8
- package/src/core/geom/3d/shape/UnionShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/UnionShape3D.js +33 -4
- package/src/core/geom/3d/shape/UnitCubeShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/UnitCubeShape3D.js +13 -6
- package/src/core/geom/3d/shape/UnitSphereShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/UnitSphereShape3D.js +10 -0
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.d.ts +15 -8
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.js +33 -9
- package/src/core/geom/3d/tetrahedra/delaunay/compute_delaunay_tetrahedral_mesh.d.ts +1 -1
- package/src/core/geom/3d/tetrahedra/delaunay/compute_delaunay_tetrahedral_mesh.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/delaunay/compute_delaunay_tetrahedral_mesh.js +7 -7
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.spec.d.ts +2 -0
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.spec.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.spec.js +38 -0
- package/src/core/geom/3d/tetrahedra/prototypeTetrahedraBuilder.js +42 -39
- package/src/core/geom/3d/v3_compute_triangle_normal.js +1 -1
- package/src/core/geom/3d/v3_negate_array.d.ts +9 -0
- package/src/core/geom/3d/v3_negate_array.d.ts.map +1 -0
- package/src/core/geom/3d/v3_negate_array.js +16 -0
- package/src/core/geom/Quaternion.d.ts.map +1 -1
- package/src/core/geom/Quaternion.js +30 -77
- package/src/core/geom/Vector3.d.ts +4 -0
- package/src/core/geom/Vector3.js +4 -4
- package/src/core/geom/vec3/v3_cross_array.d.ts +11 -0
- package/src/core/geom/vec3/v3_cross_array.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_cross_array.js +31 -0
- package/src/core/geom/vec3/v3_displace_in_direction.js +3 -2
- package/src/core/geom/vec3/v3_displace_in_direction_array.d.ts +12 -0
- package/src/core/geom/vec3/v3_displace_in_direction_array.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_displace_in_direction_array.js +22 -0
- package/src/core/geom/vec3/v3_dot_array_array.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_dot_array_array.js +4 -1
- package/src/core/geom/vec3/v3_normalize_array.d.ts +3 -3
- package/src/core/geom/vec3/v3_normalize_array.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_normalize_array.js +3 -3
- package/src/core/math/copysign.d.ts +1 -1
- package/src/core/math/copysign.js +1 -1
- package/src/core/math/epsilonEquals.d.ts.map +1 -1
- package/src/core/math/epsilonEquals.js +3 -2
- package/src/core/math/linalg/README.md +1 -1
- package/src/core/math/random/randomGaussian.spec.js +1 -1
- package/src/core/math/spline/spline_hermite3.d.ts +1 -1
- package/src/core/math/spline/spline_hermite3.js +1 -1
- package/src/core/process/delay.d.ts +6 -1
- package/src/core/process/delay.d.ts.map +1 -1
- package/src/core/process/delay.js +6 -1
- package/src/core/process/undo/Mark.d.ts +5 -5
- package/src/core/process/undo/Mark.d.ts.map +1 -1
- package/src/core/process/undo/Mark.js +6 -5
- package/src/core/process/worker/WorkerBuilder.d.ts +13 -2
- package/src/core/process/worker/WorkerBuilder.d.ts.map +1 -1
- package/src/core/process/worker/WorkerBuilder.js +9 -1
- package/src/core/process/worker/WorkerProxy.d.ts +16 -6
- package/src/core/process/worker/WorkerProxy.d.ts.map +1 -1
- package/src/core/process/worker/WorkerProxy.js +24 -5
- package/src/core/process/worker/extractTransferables.d.ts.map +1 -1
- package/src/core/process/worker/extractTransferables.js +3 -1
- package/src/engine/EngineHarness.d.ts +7 -1
- package/src/engine/EngineHarness.d.ts.map +1 -1
- package/src/engine/EngineHarness.js +12 -1
- package/src/engine/animation/clip/AnimationTrack.d.ts.map +1 -1
- package/src/engine/animation/clip/AnimationTrack.js +3 -0
- package/src/engine/animation/clip/bind_property_writer.d.ts +2 -2
- package/src/engine/animation/clip/bind_property_writer.d.ts.map +1 -1
- package/src/engine/animation/clip/bind_property_writer.js +22 -13
- package/src/engine/animation/clip/curve_from_track_data.d.ts.map +1 -1
- package/src/engine/animation/clip/curve_from_track_data.js +9 -1
- package/src/engine/animation/clip/ecd_bind_animation_curve.d.ts.map +1 -1
- package/src/engine/animation/clip/ecd_bind_animation_curve.js +6 -5
- package/src/engine/animation/curve/AnimationCurve.d.ts +21 -0
- package/src/engine/animation/curve/AnimationCurve.d.ts.map +1 -1
- package/src/engine/animation/curve/AnimationCurve.js +43 -15
- package/src/engine/animation/curve/AnimationCurve.spec.js +67 -0
- package/src/engine/animation/curve/Keyframe.d.ts +24 -3
- package/src/engine/animation/curve/Keyframe.d.ts.map +1 -1
- package/src/engine/animation/curve/Keyframe.js +49 -3
- package/src/engine/animation/curve/Keyframe.spec.js +11 -0
- package/src/engine/animation/curve/animation_curve_compute_aabb.d.ts +7 -0
- package/src/engine/animation/curve/animation_curve_compute_aabb.d.ts.map +1 -0
- package/src/engine/animation/curve/{compute_curve_aabb.js → animation_curve_compute_aabb.js} +1 -1
- package/src/engine/animation/curve/animation_curve_optimize.d.ts +8 -0
- package/src/engine/animation/curve/animation_curve_optimize.d.ts.map +1 -0
- package/src/engine/animation/curve/animation_curve_optimize.js +89 -0
- package/src/engine/animation/curve/animation_curve_optimize.spec.d.ts +2 -0
- package/src/engine/animation/curve/animation_curve_optimize.spec.d.ts.map +1 -0
- package/src/engine/animation/curve/animation_curve_optimize.spec.js +50 -0
- package/src/engine/animation/curve/draw/build_curve_editor.js +2 -2
- package/src/engine/animation/curve/evaluate_two_key_curve.d.ts +9 -0
- package/src/engine/animation/curve/evaluate_two_key_curve.d.ts.map +1 -0
- package/src/engine/animation/curve/evaluate_two_key_curve.js +23 -0
- package/src/engine/animation/curve/prototypeGLTF.js +14 -14
- package/src/engine/asset/loaders/material/computeTextureEquality.d.ts.map +1 -1
- package/src/engine/asset/loaders/material/computeTextureEquality.js +4 -6
- package/src/engine/asset/loaders/material/computeTextureHash.d.ts.map +1 -1
- package/src/engine/asset/loaders/material/computeTextureHash.js +6 -6
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescription.d.ts +6 -1
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescription.d.ts.map +1 -1
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescription.js +11 -6
- package/src/engine/ecs/guid/GUIDSerializationAdapter.spec.js +5 -5
- package/src/engine/ecs/guid/{GUID.d.ts → UUID.d.ts} +17 -12
- package/src/engine/ecs/guid/UUID.d.ts.map +1 -0
- package/src/engine/ecs/guid/{GUID.js → UUID.js} +35 -12
- package/src/engine/ecs/guid/UUID.spec.d.ts +2 -0
- package/src/engine/ecs/guid/UUID.spec.d.ts.map +1 -0
- package/src/engine/ecs/guid/{GUID.spec.js → UUID.spec.js} +18 -12
- package/src/engine/ecs/guid/UUIDSerializationAdapter.d.ts +18 -0
- package/src/engine/ecs/guid/UUIDSerializationAdapter.d.ts.map +1 -0
- package/src/engine/ecs/guid/{GUIDSerializationAdapter.js → UUIDSerializationAdapter.js} +5 -5
- package/src/engine/ecs/ik/InverseKinematics.js +3 -3
- package/src/engine/ecs/ik/TwoBoneInverseKinematicsSolver.d.ts.map +1 -1
- package/src/engine/ecs/ik/TwoBoneInverseKinematicsSolver.js +1 -140
- package/src/engine/graphics/ecs/trail2d/Trail2DSystem.js +1 -1
- package/src/engine/graphics/material/manager/MaterialManager.d.ts.map +1 -1
- package/src/engine/graphics/texture/isImageBitmap.d.ts +7 -0
- package/src/engine/graphics/texture/isImageBitmap.d.ts.map +1 -0
- package/src/engine/graphics/texture/isImageBitmap.js +12 -0
- package/src/engine/graphics/trail/x/RibbonXPlugin.d.ts.map +1 -1
- package/src/engine/graphics/trail/x/RibbonXPlugin.js +9 -1
- package/src/engine/input/ecs/systems/InputControllerSystem.js +1 -1
- package/src/engine/intelligence/blackboard/BlackboardDynamicStorageAdapter.d.ts +1 -1
- package/src/engine/intelligence/blackboard/BlackboardDynamicStorageAdapter.js +4 -4
- package/src/engine/physics/gjk/expanding_polytope_algorithm.d.ts +13 -0
- package/src/engine/physics/gjk/expanding_polytope_algorithm.d.ts.map +1 -0
- package/src/engine/physics/gjk/expanding_polytope_algorithm.js +395 -0
- package/src/engine/physics/gjk/expanding_polytope_algorithm.spec.d.ts +2 -0
- package/src/engine/physics/gjk/expanding_polytope_algorithm.spec.d.ts.map +1 -0
- package/src/engine/physics/gjk/expanding_polytope_algorithm.spec.js +46 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik3d_solve_primitive.d.ts +18 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik3d_solve_primitive.d.ts.map +1 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik3d_solve_primitive.js +277 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik3d_solve_primitive.spec.d.ts +2 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik3d_solve_primitive.spec.d.ts.map +1 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik3d_solve_primitive.spec.js +43 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik_solve.d.ts +12 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik_solve.d.ts.map +1 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik_solve.js +100 -0
- package/src/engine/physics/inverse_kinematics/fabrik/prototype.d.ts +2 -0
- package/src/engine/physics/inverse_kinematics/fabrik/prototype.d.ts.map +1 -0
- package/src/engine/physics/inverse_kinematics/fabrik/prototype.js +112 -0
- package/src/engine/physics/inverse_kinematics/two_joint_ik.d.ts +16 -0
- package/src/engine/physics/inverse_kinematics/two_joint_ik.d.ts.map +1 -0
- package/src/engine/physics/inverse_kinematics/two_joint_ik.js +127 -0
- package/src/view/elements/DropDownSelectionView.js +2 -2
- package/src/view/elements/tiles2d/Tile.d.ts.map +1 -1
- package/src/view/elements/tiles2d/Tile.js +2 -3
- package/src/core/math/makeSequenceLoop.d.ts.map +0 -1
- package/src/engine/animation/curve/compute_curve_aabb.d.ts +0 -7
- package/src/engine/animation/curve/compute_curve_aabb.d.ts.map +0 -1
- package/src/engine/ecs/guid/GUID.d.ts.map +0 -1
- package/src/engine/ecs/guid/GUID.spec.d.ts +0 -2
- package/src/engine/ecs/guid/GUID.spec.d.ts.map +0 -1
- package/src/engine/ecs/guid/GUIDSerializationAdapter.d.ts +0 -18
- package/src/engine/ecs/guid/GUIDSerializationAdapter.d.ts.map +0 -1
- /package/src/core/{math → function}/makeSequenceLoop.d.ts +0 -0
- /package/src/core/{math → function}/makeSequenceLoop.js +0 -0
package/build/meep.module.js
CHANGED
|
@@ -1746,10 +1746,10 @@ const EPSILON = 0.000001;
|
|
|
1746
1746
|
* Comparison of two numbers with a given tolerance
|
|
1747
1747
|
* @param {number} a
|
|
1748
1748
|
* @param {number} b
|
|
1749
|
-
* @param {number} tolerance
|
|
1749
|
+
* @param {number} [tolerance]
|
|
1750
1750
|
* @returns {boolean}
|
|
1751
1751
|
*/
|
|
1752
|
-
function epsilonEquals(a, b, tolerance) {
|
|
1752
|
+
function epsilonEquals(a, b, tolerance = EPSILON) {
|
|
1753
1753
|
|
|
1754
1754
|
return Math.abs(a - b) <= tolerance;
|
|
1755
1755
|
}
|
|
@@ -2605,10 +2605,10 @@ let Vector3$1 = class Vector3 {
|
|
|
2605
2605
|
|
|
2606
2606
|
// calculate quat * vector
|
|
2607
2607
|
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2608
|
+
const ix = qw * x + qy * z - qz * y;
|
|
2609
|
+
const iy = qw * y + qz * x - qx * z;
|
|
2610
|
+
const iz = qw * z + qx * y - qy * x;
|
|
2611
|
+
const iw = -qx * x - qy * y - qz * z;
|
|
2612
2612
|
|
|
2613
2613
|
// calculate result * inverse quat
|
|
2614
2614
|
|
|
@@ -3190,9 +3190,9 @@ Vector3$1.typeName = "Vector3";
|
|
|
3190
3190
|
*/
|
|
3191
3191
|
Vector3$1._dot = v3_dot;
|
|
3192
3192
|
|
|
3193
|
-
const
|
|
3194
|
-
const
|
|
3195
|
-
const
|
|
3193
|
+
const scratch_v3_a = new Vector3$1();
|
|
3194
|
+
const scratch_v3_b = new Vector3$1();
|
|
3195
|
+
const scratch_v3_c = new Vector3$1();
|
|
3196
3196
|
|
|
3197
3197
|
const sin$1 = Math.sin;
|
|
3198
3198
|
const cos$1 = Math.cos;
|
|
@@ -3293,12 +3293,12 @@ let Quaternion$1 = class Quaternion {
|
|
|
3293
3293
|
* @param {number} uz up vector
|
|
3294
3294
|
*/
|
|
3295
3295
|
_lookRotation(fx, fy, fz, ux, uy, uz) {
|
|
3296
|
-
|
|
3297
|
-
|
|
3296
|
+
scratch_v3_a.set(fx, fy, fz);
|
|
3297
|
+
scratch_v3_a.normalize();
|
|
3298
3298
|
|
|
3299
|
-
|
|
3299
|
+
scratch_v3_c._crossVectors(ux, uy, uz, scratch_v3_a.x, scratch_v3_a.y, scratch_v3_a.z);
|
|
3300
3300
|
|
|
3301
|
-
if (
|
|
3301
|
+
if (scratch_v3_c.lengthSq() === 0) {
|
|
3302
3302
|
// up and forward are parallel
|
|
3303
3303
|
|
|
3304
3304
|
/*
|
|
@@ -3307,32 +3307,32 @@ let Quaternion$1 = class Quaternion {
|
|
|
3307
3307
|
*/
|
|
3308
3308
|
|
|
3309
3309
|
if (Math.abs(uz) === 1) {
|
|
3310
|
-
|
|
3310
|
+
scratch_v3_a.x += 0.001;
|
|
3311
3311
|
} else {
|
|
3312
|
-
|
|
3312
|
+
scratch_v3_a.z += 0.001;
|
|
3313
3313
|
}
|
|
3314
3314
|
|
|
3315
|
-
|
|
3316
|
-
|
|
3315
|
+
scratch_v3_a.normalize();
|
|
3316
|
+
scratch_v3_c._crossVectors(ux, uy, uz, scratch_v3_a.x, scratch_v3_a.y, scratch_v3_a.z);
|
|
3317
3317
|
|
|
3318
3318
|
}
|
|
3319
3319
|
|
|
3320
|
-
|
|
3320
|
+
scratch_v3_c.normalize();
|
|
3321
3321
|
|
|
3322
|
-
|
|
3322
|
+
scratch_v3_b.crossVectors(scratch_v3_a, scratch_v3_c);
|
|
3323
3323
|
|
|
3324
3324
|
// construct partial transform matrix
|
|
3325
|
-
const m00 =
|
|
3326
|
-
const m10 =
|
|
3327
|
-
const m20 =
|
|
3325
|
+
const m00 = scratch_v3_c.x;
|
|
3326
|
+
const m10 = scratch_v3_c.y;
|
|
3327
|
+
const m20 = scratch_v3_c.z;
|
|
3328
3328
|
|
|
3329
|
-
const m01 =
|
|
3330
|
-
const m11 =
|
|
3331
|
-
const m21 =
|
|
3329
|
+
const m01 = scratch_v3_b.x;
|
|
3330
|
+
const m11 = scratch_v3_b.y;
|
|
3331
|
+
const m21 = scratch_v3_b.z;
|
|
3332
3332
|
|
|
3333
|
-
const m02 =
|
|
3334
|
-
const m12 =
|
|
3335
|
-
const m22 =
|
|
3333
|
+
const m02 = scratch_v3_a.x;
|
|
3334
|
+
const m12 = scratch_v3_a.y;
|
|
3335
|
+
const m22 = scratch_v3_a.z;
|
|
3336
3336
|
|
|
3337
3337
|
this.__setFromRotationMatrix(
|
|
3338
3338
|
m00, m01, m02,
|
|
@@ -3366,7 +3366,7 @@ let Quaternion$1 = class Quaternion {
|
|
|
3366
3366
|
}
|
|
3367
3367
|
|
|
3368
3368
|
/**
|
|
3369
|
-
*
|
|
3369
|
+
* Makes this quaternion into an inverse of the other
|
|
3370
3370
|
* @param {Quaternion} other
|
|
3371
3371
|
*/
|
|
3372
3372
|
copyInverse(other) {
|
|
@@ -3386,7 +3386,7 @@ let Quaternion$1 = class Quaternion {
|
|
|
3386
3386
|
const length_sqr = x * x + y * y + z * z + w * w;
|
|
3387
3387
|
|
|
3388
3388
|
if (length_sqr === 0) {
|
|
3389
|
-
this.set(0, 0, 0,
|
|
3389
|
+
this.set(0, 0, 0, 1);
|
|
3390
3390
|
return;
|
|
3391
3391
|
}
|
|
3392
3392
|
|
|
@@ -3442,6 +3442,7 @@ let Quaternion$1 = class Quaternion {
|
|
|
3442
3442
|
* @param {number} angle
|
|
3443
3443
|
*/
|
|
3444
3444
|
_fromAxisAngle(ax, ay, az, angle) {
|
|
3445
|
+
|
|
3445
3446
|
const halfAngle = angle * 0.5;
|
|
3446
3447
|
|
|
3447
3448
|
const sinA2 = sin$1(halfAngle);
|
|
@@ -3480,7 +3481,7 @@ let Quaternion$1 = class Quaternion {
|
|
|
3480
3481
|
// perform projection of rotation onto axis
|
|
3481
3482
|
const d = v3_dot(x, y, z, axis.x, axis.y, axis.z);
|
|
3482
3483
|
|
|
3483
|
-
const mag2 =
|
|
3484
|
+
const mag2 = axis.x * axis.x + axis.y * axis.y + axis.z * axis.z;
|
|
3484
3485
|
|
|
3485
3486
|
const m = d / mag2;
|
|
3486
3487
|
|
|
@@ -3994,58 +3995,6 @@ let Quaternion$1 = class Quaternion {
|
|
|
3994
3995
|
this.set(_x, _y, _z, _w);
|
|
3995
3996
|
}
|
|
3996
3997
|
|
|
3997
|
-
/**
|
|
3998
|
-
* Based on blog post: http://lolengine.net/blog/2013/09/18/beautiful-maths-quaternion-from-vectors
|
|
3999
|
-
* @param {Vector3} from
|
|
4000
|
-
* @param {Vector3} to
|
|
4001
|
-
*/
|
|
4002
|
-
fromNonUnitVectors(from, to) {
|
|
4003
|
-
//quat quat::fromtwovectors(vec3 u, vec3 v)
|
|
4004
|
-
// {
|
|
4005
|
-
// vec3 w = cross(u, v);
|
|
4006
|
-
// quat q = quat(dot(u, v), w.x, w.y, w.z);
|
|
4007
|
-
// q.w += length(q);
|
|
4008
|
-
// return normalize(q);
|
|
4009
|
-
// }
|
|
4010
|
-
|
|
4011
|
-
const ax = from.x;
|
|
4012
|
-
const ay = from.y;
|
|
4013
|
-
const az = from.z;
|
|
4014
|
-
|
|
4015
|
-
const bx = to.x;
|
|
4016
|
-
const by = to.y;
|
|
4017
|
-
const bz = to.z;
|
|
4018
|
-
|
|
4019
|
-
//compute cross product
|
|
4020
|
-
const crossX = ay * bz - az * by;
|
|
4021
|
-
const crossY = az * bx - ax * bz;
|
|
4022
|
-
const crossZ = ax * by - ay * bx;
|
|
4023
|
-
|
|
4024
|
-
const uv_dot = v3_dot(ax, ay, az, bx, by, bz);
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
const qX = crossX;
|
|
4028
|
-
const qY = crossY;
|
|
4029
|
-
const qZ = crossZ;
|
|
4030
|
-
const qW = uv_dot;
|
|
4031
|
-
|
|
4032
|
-
const p0 = qX * qX + qY * qY + qZ * qZ;
|
|
4033
|
-
|
|
4034
|
-
const l0 = Math.sqrt(p0 + qW * qW);
|
|
4035
|
-
|
|
4036
|
-
const qW_1 = qW + l0;
|
|
4037
|
-
|
|
4038
|
-
//normalize result
|
|
4039
|
-
const l1 = 1 / Math.sqrt(p0 + qW_1 * qW_1);
|
|
4040
|
-
|
|
4041
|
-
const x = qX * l1;
|
|
4042
|
-
const y = qY * l1;
|
|
4043
|
-
const z = qZ * l1;
|
|
4044
|
-
const w = qW * l1;
|
|
4045
|
-
|
|
4046
|
-
this.set(x, y, z, w);
|
|
4047
|
-
}
|
|
4048
|
-
|
|
4049
3998
|
/**
|
|
4050
3999
|
* NOTE: Vectors need to be normalized
|
|
4051
4000
|
* Based on blog post: http://lolengine.net/blog/2013/09/18/beautiful-maths-quaternion-from-vectors
|
|
@@ -49026,6 +48975,7 @@ function compute_typed_array_constructor_from_data_type(dt) {
|
|
|
49026
48975
|
* @returns {boolean}
|
|
49027
48976
|
*/
|
|
49028
48977
|
function is_typed_array_equals(a, b) {
|
|
48978
|
+
|
|
49029
48979
|
if (a === b) {
|
|
49030
48980
|
// quick shortcut
|
|
49031
48981
|
return true;
|
|
@@ -61405,7 +61355,6 @@ function arrayIndexByEquality(array, element, equals) {
|
|
|
61405
61355
|
*/
|
|
61406
61356
|
function arraySetDiff(a, b, equals = strictEquals) {
|
|
61407
61357
|
|
|
61408
|
-
// TODO we can do this faster if we use a comparator instead of equality and pre-sort the data
|
|
61409
61358
|
const uniqueA = a.slice();
|
|
61410
61359
|
const uniqueB = b.slice();
|
|
61411
61360
|
|
|
@@ -63456,7 +63405,13 @@ function needsSerialization(value) {
|
|
|
63456
63405
|
|
|
63457
63406
|
class WorkerProxy {
|
|
63458
63407
|
|
|
63408
|
+
/**
|
|
63409
|
+
*
|
|
63410
|
+
* @type {{}}
|
|
63411
|
+
* @private
|
|
63412
|
+
*/
|
|
63459
63413
|
__pending = {};
|
|
63414
|
+
|
|
63460
63415
|
__isRunning = false;
|
|
63461
63416
|
|
|
63462
63417
|
/**
|
|
@@ -63484,11 +63439,12 @@ class WorkerProxy {
|
|
|
63484
63439
|
/**
|
|
63485
63440
|
* Invoke a given method on the worker, as defined by the `WorkerBuilder`
|
|
63486
63441
|
* @template T
|
|
63487
|
-
* @param {
|
|
63442
|
+
* @param {string} name Method's name
|
|
63488
63443
|
* @param {Array} args
|
|
63489
63444
|
* @return {Promise<T>} eventual result of the invoked method
|
|
63490
63445
|
*/
|
|
63491
63446
|
$submitRequest(name, args) {
|
|
63447
|
+
|
|
63492
63448
|
const pending = this.__pending[name];
|
|
63493
63449
|
|
|
63494
63450
|
const argumentCount = args.length;
|
|
@@ -63535,7 +63491,13 @@ class WorkerProxy {
|
|
|
63535
63491
|
});
|
|
63536
63492
|
}
|
|
63537
63493
|
|
|
63494
|
+
/**
|
|
63495
|
+
*
|
|
63496
|
+
* @param {string} name
|
|
63497
|
+
* @private
|
|
63498
|
+
*/
|
|
63538
63499
|
__makeMethod(name) {
|
|
63500
|
+
|
|
63539
63501
|
if (this.__pending.hasOwnProperty(name)) {
|
|
63540
63502
|
throw new Error(`Method '${name}' already defined`);
|
|
63541
63503
|
}
|
|
@@ -63620,15 +63582,16 @@ class WorkerProxy {
|
|
|
63620
63582
|
/**
|
|
63621
63583
|
*
|
|
63622
63584
|
* @param {number} id
|
|
63623
|
-
* @param {string}
|
|
63585
|
+
* @param {string} method_name
|
|
63624
63586
|
* @returns {boolean}
|
|
63625
63587
|
*/
|
|
63626
|
-
cancelRequest(id,
|
|
63588
|
+
cancelRequest(id, method_name) {
|
|
63589
|
+
|
|
63627
63590
|
//find request
|
|
63628
|
-
const requestQueue = this.__pending[
|
|
63591
|
+
const requestQueue = this.__pending[method_name];
|
|
63629
63592
|
|
|
63630
63593
|
if (requestQueue === undefined) {
|
|
63631
|
-
throw new Error(`No request queue for method name '${
|
|
63594
|
+
throw new Error(`No request queue for method name '${method_name}'`);
|
|
63632
63595
|
}
|
|
63633
63596
|
|
|
63634
63597
|
const n = requestQueue.length;
|
|
@@ -63700,8 +63663,16 @@ const RxMatchFunctionName = /(function\s*)([a-zA-Z0-9_]+)?(\s*\([^\]]*\)\s*\{.*)
|
|
|
63700
63663
|
|
|
63701
63664
|
class WorkerBuilder {
|
|
63702
63665
|
|
|
63666
|
+
/**
|
|
63667
|
+
*
|
|
63668
|
+
* @type {string[]}
|
|
63669
|
+
*/
|
|
63703
63670
|
imports = [];
|
|
63704
63671
|
methods = {};
|
|
63672
|
+
/**
|
|
63673
|
+
*
|
|
63674
|
+
* @type {{f:function, name:string}[]}
|
|
63675
|
+
*/
|
|
63705
63676
|
functions = [];
|
|
63706
63677
|
preamble = new LineBuilder();
|
|
63707
63678
|
|
|
@@ -63807,7 +63778,7 @@ class WorkerBuilder {
|
|
|
63807
63778
|
result.push(obj);
|
|
63808
63779
|
} else if (obj.buffer instanceof ArrayBuffer) {
|
|
63809
63780
|
result.push(obj.buffer);
|
|
63810
|
-
} else if (obj instanceof ImageBitmap) {
|
|
63781
|
+
} else if (typeof ImageBitmap !== "undefined" && obj instanceof ImageBitmap) {
|
|
63811
63782
|
result.push(obj);
|
|
63812
63783
|
} else {
|
|
63813
63784
|
for (var i in obj) {
|
|
@@ -75918,9 +75889,10 @@ function planeHash(plane) {
|
|
|
75918
75889
|
* @template T
|
|
75919
75890
|
* @param {T[]} array
|
|
75920
75891
|
* @param {function(T):number} elementHashFunction
|
|
75892
|
+
* @param {*} [thisArg]
|
|
75921
75893
|
* @returns {number}
|
|
75922
75894
|
*/
|
|
75923
|
-
function computeHashArray(array, elementHashFunction) {
|
|
75895
|
+
function computeHashArray(array, elementHashFunction, thisArg) {
|
|
75924
75896
|
|
|
75925
75897
|
const numArguments = array.length;
|
|
75926
75898
|
let hash = numArguments;
|
|
@@ -75929,7 +75901,7 @@ function computeHashArray(array, elementHashFunction) {
|
|
|
75929
75901
|
|
|
75930
75902
|
const singleValue = array[i];
|
|
75931
75903
|
|
|
75932
|
-
const elementHash = elementHashFunction(singleValue);
|
|
75904
|
+
const elementHash = elementHashFunction.call(thisArg, singleValue);
|
|
75933
75905
|
|
|
75934
75906
|
hash = ((hash << 5) - hash) + elementHash;
|
|
75935
75907
|
hash |= 0; // Convert to 32bit integer
|
|
@@ -76225,6 +76197,19 @@ function murmur3_32(key, seed) {
|
|
|
76225
76197
|
return h1 >>> 0;
|
|
76226
76198
|
}
|
|
76227
76199
|
|
|
76200
|
+
/**
|
|
76201
|
+
* Guards against cases where ImageBitmap doesn't exist
|
|
76202
|
+
* @param {*} image
|
|
76203
|
+
* @return {boolean}
|
|
76204
|
+
*/
|
|
76205
|
+
function isImageBitmap(image) {
|
|
76206
|
+
/**
|
|
76207
|
+
* check that browser/environment has the class at all to avoid potential exceptions
|
|
76208
|
+
* Required for Safari below version 15.6
|
|
76209
|
+
*/
|
|
76210
|
+
return typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap;
|
|
76211
|
+
}
|
|
76212
|
+
|
|
76228
76213
|
/**
|
|
76229
76214
|
* Transfer bitmap contents to Sampler2D, effectively moving data to CPU, making it readable
|
|
76230
76215
|
* @param {WebGL2RenderingContext} gl
|
|
@@ -76255,6 +76240,7 @@ function bitmap2sampler_gl(gl, sampler, bitmap) {
|
|
|
76255
76240
|
*
|
|
76256
76241
|
* @param {number[]|Uint8Array} a
|
|
76257
76242
|
* @param {number[]|Uint8Array} b
|
|
76243
|
+
* @returns {boolean}
|
|
76258
76244
|
*/
|
|
76259
76245
|
function fastArrayEquals(a, b) {
|
|
76260
76246
|
if (Array.isArray(a) || Array.isArray(b)) {
|
|
@@ -76447,15 +76433,14 @@ function computeImageDataHash(image) {
|
|
|
76447
76433
|
|
|
76448
76434
|
let result = 0;
|
|
76449
76435
|
|
|
76450
|
-
if (
|
|
76451
|
-
|
|
76452
|
-
// Required for Safari below version 15.6
|
|
76453
|
-
ImageBitmap !== undefined
|
|
76454
|
-
&& (image instanceof ImageBitmap)
|
|
76455
|
-
) {
|
|
76436
|
+
if (isImageBitmap(image)) {
|
|
76437
|
+
|
|
76456
76438
|
result = computeImageBitmapHash(image);
|
|
76439
|
+
|
|
76457
76440
|
} else if (image instanceof HTMLImageElement) {
|
|
76441
|
+
|
|
76458
76442
|
result = computeStringHash(image.src);
|
|
76443
|
+
|
|
76459
76444
|
}
|
|
76460
76445
|
|
|
76461
76446
|
let width = 0;
|
|
@@ -76652,13 +76637,10 @@ function textureImagesEqual(a, b) {
|
|
|
76652
76637
|
return false;
|
|
76653
76638
|
}
|
|
76654
76639
|
|
|
76655
|
-
if (
|
|
76656
|
-
|
|
76657
|
-
// Required for Safari below version 15.6
|
|
76658
|
-
ImageBitmap !== undefined
|
|
76659
|
-
&& (a instanceof ImageBitmap && b instanceof ImageBitmap)
|
|
76660
|
-
) {
|
|
76640
|
+
if (isImageBitmap(a) && isImageBitmap(b)) {
|
|
76641
|
+
|
|
76661
76642
|
return computeImageBitmapEquality(a, b);
|
|
76643
|
+
|
|
76662
76644
|
}
|
|
76663
76645
|
|
|
76664
76646
|
if (Array.isArray(a) && Array.isArray(b)) {
|
|
@@ -89099,7 +89081,13 @@ function compare_three_objects(a, b) {
|
|
|
89099
89081
|
* @param {number} [maxIndex]
|
|
89100
89082
|
* @return {number} Index
|
|
89101
89083
|
*/
|
|
89102
|
-
function binarySearchHighIndex(
|
|
89084
|
+
function binarySearchHighIndex(
|
|
89085
|
+
array,
|
|
89086
|
+
el,
|
|
89087
|
+
compareFunction,
|
|
89088
|
+
minIndex = 0,
|
|
89089
|
+
maxIndex = array.length - 1
|
|
89090
|
+
) {
|
|
89103
89091
|
let min = minIndex;
|
|
89104
89092
|
let max = maxIndex;
|
|
89105
89093
|
|
|
@@ -98063,16 +98051,16 @@ ObjectPoolFactory.prototype.create = ObjectPoolFactory.prototype.get;
|
|
|
98063
98051
|
*/
|
|
98064
98052
|
function isArrayEqual(first, second) {
|
|
98065
98053
|
|
|
98066
|
-
const
|
|
98054
|
+
const element_count = first.length;
|
|
98067
98055
|
|
|
98068
|
-
if (
|
|
98056
|
+
if (element_count !== second.length) {
|
|
98069
98057
|
// arrays are of different size
|
|
98070
98058
|
return false;
|
|
98071
98059
|
}
|
|
98072
98060
|
|
|
98073
98061
|
let i = 0;
|
|
98074
98062
|
|
|
98075
|
-
for (; i <
|
|
98063
|
+
for (; i < element_count; i++) {
|
|
98076
98064
|
|
|
98077
98065
|
const a = first[i];
|
|
98078
98066
|
const b = second[i];
|
|
@@ -98081,19 +98069,16 @@ function isArrayEqual(first, second) {
|
|
|
98081
98069
|
continue;
|
|
98082
98070
|
}
|
|
98083
98071
|
|
|
98084
|
-
|
|
98085
|
-
|
|
98086
|
-
|
|
98087
|
-
|
|
98088
|
-
|
|
98089
|
-
|
|
98090
|
-
if (a === null) {
|
|
98091
|
-
// A is null and B is something else
|
|
98072
|
+
if (
|
|
98073
|
+
a === undefined || a === null
|
|
98074
|
+
|| b === undefined || b === null
|
|
98075
|
+
) {
|
|
98076
|
+
// shortcut to avoid working with nulls and undefined values
|
|
98092
98077
|
return false;
|
|
98093
98078
|
}
|
|
98094
98079
|
|
|
98095
98080
|
// try "equals" method
|
|
98096
|
-
if (typeof a.equals === "function") {
|
|
98081
|
+
if (typeof a === "object" && typeof a.equals === "function") {
|
|
98097
98082
|
|
|
98098
98083
|
if (!a.equals(b)) {
|
|
98099
98084
|
return false;
|
|
@@ -115028,7 +115013,7 @@ function removeBindings(mapping, devices, proxies) {
|
|
|
115028
115013
|
}
|
|
115029
115014
|
|
|
115030
115015
|
/**
|
|
115031
|
-
*
|
|
115016
|
+
* Prefer to use {@link InputSystem} instead
|
|
115032
115017
|
*/
|
|
115033
115018
|
class InputControllerSystem extends System {
|
|
115034
115019
|
constructor(devices) {
|
|
@@ -116095,6 +116080,17 @@ class EngineHarness {
|
|
|
116095
116080
|
this.p = null;
|
|
116096
116081
|
}
|
|
116097
116082
|
|
|
116083
|
+
/**
|
|
116084
|
+
* Quick initialization of the engine in a sensible default configuration
|
|
116085
|
+
* @param {(config:EngineConfiguration,engine:Engine)=>*} [configuration]
|
|
116086
|
+
* @return {Promise<Engine>}
|
|
116087
|
+
*/
|
|
116088
|
+
static async bootstrap({ configuration } = {}) {
|
|
116089
|
+
const harness = new EngineHarness();
|
|
116090
|
+
|
|
116091
|
+
return harness.initialize({ configuration });
|
|
116092
|
+
}
|
|
116093
|
+
|
|
116098
116094
|
/**
|
|
116099
116095
|
*
|
|
116100
116096
|
* @param {Engine} engine
|
|
@@ -116112,7 +116108,7 @@ class EngineHarness {
|
|
|
116112
116108
|
}
|
|
116113
116109
|
|
|
116114
116110
|
/**
|
|
116115
|
-
* @param {(config:EngineConfiguration,engine:Engine)=>*} configuration
|
|
116111
|
+
* @param {(config:EngineConfiguration,engine:Engine)=>*} [configuration]
|
|
116116
116112
|
* @param {boolean} [enable_localization] Whether or not to load localization data
|
|
116117
116113
|
* @returns {Promise<Engine>}
|
|
116118
116114
|
*/
|
|
@@ -36,6 +36,11 @@ const _tempQuaternion = new Quaternion();
|
|
|
36
36
|
const _tempTransform = new Transform();
|
|
37
37
|
|
|
38
38
|
class TransformControls extends GizmoNode {
|
|
39
|
+
/**
|
|
40
|
+
* Entity ID that we are controlling. -1 indicates no entity
|
|
41
|
+
* @type {number}
|
|
42
|
+
*/
|
|
43
|
+
object = -1;
|
|
39
44
|
|
|
40
45
|
/**
|
|
41
46
|
*
|
|
@@ -49,7 +54,7 @@ class TransformControls extends GizmoNode {
|
|
|
49
54
|
|
|
50
55
|
if (domElement === undefined) {
|
|
51
56
|
|
|
52
|
-
console.warn('
|
|
57
|
+
console.warn('TransformControls: The second parameter "domElement" is now mandatory.');
|
|
53
58
|
domElement = document;
|
|
54
59
|
|
|
55
60
|
}
|
|
@@ -197,7 +202,7 @@ class TransformControls extends GizmoNode {
|
|
|
197
202
|
// updateMatrixWorld updates key transformation variables
|
|
198
203
|
update() {
|
|
199
204
|
|
|
200
|
-
if (this.object !==
|
|
205
|
+
if (this.object !== -1) {
|
|
201
206
|
|
|
202
207
|
this._parentPosition.set(0, 0, 0);
|
|
203
208
|
this._parentScale.set(1, 1, 1);
|
|
@@ -222,7 +227,7 @@ class TransformControls extends GizmoNode {
|
|
|
222
227
|
|
|
223
228
|
pointerHover(pointer) {
|
|
224
229
|
|
|
225
|
-
if (this.object ===
|
|
230
|
+
if (this.object === -1 || this.dragging === true) return;
|
|
226
231
|
|
|
227
232
|
_raycaster.setFromCamera(pointer, this.camera);
|
|
228
233
|
|
|
@@ -242,7 +247,7 @@ class TransformControls extends GizmoNode {
|
|
|
242
247
|
|
|
243
248
|
pointerDown(pointer) {
|
|
244
249
|
|
|
245
|
-
if (this.object ===
|
|
250
|
+
if (this.object === -1 || this.dragging === true || pointer.button !== 0) return;
|
|
246
251
|
|
|
247
252
|
const ot = this.object_transform;
|
|
248
253
|
|
|
@@ -301,7 +306,7 @@ class TransformControls extends GizmoNode {
|
|
|
301
306
|
|
|
302
307
|
}
|
|
303
308
|
|
|
304
|
-
if (object ===
|
|
309
|
+
if (object === -1 || axis === null || this.dragging === false || pointer.button !== -1) return;
|
|
305
310
|
|
|
306
311
|
const object_transform = this.object_transform;
|
|
307
312
|
|
|
@@ -601,7 +606,7 @@ class TransformControls extends GizmoNode {
|
|
|
601
606
|
// Detatch from object
|
|
602
607
|
detach() {
|
|
603
608
|
|
|
604
|
-
this.object =
|
|
609
|
+
this.object = -1;
|
|
605
610
|
|
|
606
611
|
this.visible = false;
|
|
607
612
|
this.axis = null;
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"description": "Fully featured ECS game engine written in JavaScript",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": "Alexander Goldring",
|
|
8
|
-
"version": "2.110.
|
|
8
|
+
"version": "2.110.9",
|
|
9
9
|
"main": "build/meep.module.js",
|
|
10
10
|
"module": "build/meep.module.js",
|
|
11
11
|
"exports": {
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"@rollup/plugin-terser": "0.4.3",
|
|
61
61
|
"@rollup/plugin-strip": "3.0.2",
|
|
62
62
|
"@types/three": "^0.135.0",
|
|
63
|
+
"@types/jest": "29.5.12",
|
|
63
64
|
"babel-jest": "29.5.0",
|
|
64
65
|
"jest": "29.6.4",
|
|
65
66
|
"jest-environment-jsdom": "29.6.4",
|
package/src/core/UUID.d.ts
CHANGED
package/src/core/UUID.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UUID.d.ts","sourceRoot":"","sources":["../../../src/core/UUID.js"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"UUID.d.ts","sourceRoot":"","sources":["../../../src/core/UUID.js"],"names":[],"mappings":";;;;AAEA;;;;;GAKG;AACH,yBAFa,MAAM,CAIlB"}
|
package/src/core/UUID.js
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
const r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);
|
|
3
|
-
return v.toString(16);
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
const rx = /[xy]/g;
|
|
1
|
+
import { UUID } from "../engine/ecs/guid/UUID.js";
|
|
7
2
|
|
|
8
3
|
/**
|
|
9
4
|
* Generates a variant 4 fully random UUID in string format
|
|
5
|
+
* @deprecated
|
|
10
6
|
* NOTE: Prefer to use UUID component class instead as that implementation is more robust and has better entropy when it comes to randomness
|
|
11
7
|
* @returns {string}
|
|
12
8
|
*/
|
|
13
9
|
function uuid() {
|
|
14
|
-
return
|
|
10
|
+
return UUID.v4().toString();
|
|
15
11
|
}
|
|
16
12
|
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated
|
|
15
|
+
*/
|
|
17
16
|
export default {
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated
|
|
19
|
+
*/
|
|
18
20
|
generate: uuid
|
|
19
21
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arraySetDiff.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/arraySetDiff.js"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH;;;;
|
|
1
|
+
{"version":3,"file":"arraySetDiff.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/arraySetDiff.js"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH;;;;EAoCC;6BAhD4B,gCAAgC"}
|
|
@@ -17,7 +17,6 @@ export function arraySetDiff(a, b, equals = strictEquals) {
|
|
|
17
17
|
assert.isArray(b, 'b');
|
|
18
18
|
assert.isFunction(equals, 'equals');
|
|
19
19
|
|
|
20
|
-
// TODO we can do this faster if we use a comparator instead of equality and pre-sort the data
|
|
21
20
|
const uniqueA = a.slice();
|
|
22
21
|
const uniqueB = b.slice();
|
|
23
22
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binarySearchHighIndex.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/binarySearchHighIndex.js"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,oIALyB,MAAM,aACpB,MAAM,aACN,MAAM,GACL,MAAM,
|
|
1
|
+
{"version":3,"file":"binarySearchHighIndex.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/binarySearchHighIndex.js"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,oIALyB,MAAM,aACpB,MAAM,aACN,MAAM,GACL,MAAM,CA8BjB"}
|
|
@@ -7,7 +7,13 @@
|
|
|
7
7
|
* @param {number} [maxIndex]
|
|
8
8
|
* @return {number} Index
|
|
9
9
|
*/
|
|
10
|
-
export function binarySearchHighIndex(
|
|
10
|
+
export function binarySearchHighIndex(
|
|
11
|
+
array,
|
|
12
|
+
el,
|
|
13
|
+
compareFunction,
|
|
14
|
+
minIndex = 0,
|
|
15
|
+
maxIndex = array.length - 1
|
|
16
|
+
) {
|
|
11
17
|
let min = minIndex;
|
|
12
18
|
let max = maxIndex;
|
|
13
19
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeHashArray.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/computeHashArray.js"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"computeHashArray.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/computeHashArray.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,kFAJuB,MAAM,kBAEhB,MAAM,CAoBlB"}
|
|
@@ -4,9 +4,10 @@ import { assert } from "../../assert.js";
|
|
|
4
4
|
* @template T
|
|
5
5
|
* @param {T[]} array
|
|
6
6
|
* @param {function(T):number} elementHashFunction
|
|
7
|
+
* @param {*} [thisArg]
|
|
7
8
|
* @returns {number}
|
|
8
9
|
*/
|
|
9
|
-
export function computeHashArray(array, elementHashFunction) {
|
|
10
|
+
export function computeHashArray(array, elementHashFunction, thisArg) {
|
|
10
11
|
assert.isArrayLike(array, 'array');
|
|
11
12
|
assert.isFunction(elementHashFunction, 'elementHashFunction');
|
|
12
13
|
|
|
@@ -17,7 +18,7 @@ export function computeHashArray(array, elementHashFunction) {
|
|
|
17
18
|
|
|
18
19
|
const singleValue = array[i];
|
|
19
20
|
|
|
20
|
-
const elementHash = elementHashFunction(singleValue);
|
|
21
|
+
const elementHash = elementHashFunction.call(thisArg, singleValue);
|
|
21
22
|
|
|
22
23
|
hash = ((hash << 5) - hash) + elementHash;
|
|
23
24
|
hash |= 0; // Convert to 32bit integer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fastArrayEquals.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/fastArrayEquals.js"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"fastArrayEquals.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/fastArrayEquals.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,mCAJW,MAAM,EAAE,GAAC,UAAU,KACnB,MAAM,EAAE,GAAC,UAAU,GACjB,OAAO,CAUnB"}
|