@woosh/meep-engine 2.118.3 → 2.118.5
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 +86 -105
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +86 -105
- package/package.json +5 -5
- package/src/core/binary/EndianType.d.ts +3 -0
- package/src/core/binary/EndianType.d.ts.map +1 -1
- package/src/core/binary/EndianType.js +2 -1
- package/src/core/binary/uint8_to_float.d.ts.map +1 -1
- package/src/core/binary/uint8_to_float.js +5 -0
- package/src/core/collection/queue/Deque.d.ts.map +1 -1
- package/src/core/collection/queue/Deque.js +32 -32
- package/src/core/color/Color.js +3 -3
- package/src/core/color/kelvin/rgb_to_kelvin.d.ts.map +1 -1
- package/src/core/color/kelvin/rgb_to_kelvin.js +16 -7
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_find_tets_attached_to_vertex.d.ts.map +1 -0
- package/src/core/geom/Vector3.d.ts.map +1 -1
- package/src/core/geom/Vector3.js +5 -19
- package/src/core/geom/packing/computeBoundingSphereOfSpheres.js +1 -1
- package/src/core/math/compute_legendre_polynomial.d.ts +1 -1
- package/src/core/math/compute_legendre_polynomial.d.ts.map +1 -1
- package/src/core/math/compute_legendre_polynomial.js +6 -1
- package/src/core/math/hash/squirrel3.d.ts +1 -0
- package/src/core/math/hash/squirrel3.d.ts.map +1 -1
- package/src/core/math/hash/squirrel3.js +1 -0
- package/src/core/math/max3.d.ts.map +1 -1
- package/src/core/math/max3.js +4 -0
- package/src/core/math/random/seededRandom_MersenneTwister.d.ts +7 -0
- package/src/core/math/random/seededRandom_MersenneTwister.d.ts.map +1 -0
- package/src/core/math/random/{seededRandomMersenneTwister.js → seededRandom_MersenneTwister.js} +4 -2
- package/src/core/math/solveQuadratic.d.ts.map +1 -1
- package/src/core/math/solveQuadratic.js +5 -1
- package/src/core/primitives/boolean/compareBooleans.js +2 -0
- package/src/core/primitives/boolean/computeBooleanHash.d.ts +7 -0
- package/src/core/primitives/boolean/computeBooleanHash.d.ts.map +1 -0
- package/src/core/primitives/boolean/computeBooleanHash.js +8 -0
- package/src/core/primitives/numbers/computeHashFloat.d.ts.map +1 -1
- package/src/core/primitives/numbers/computeHashFloat.js +4 -2
- package/src/engine/ecs/gui/position/ViewportPosition.d.ts +0 -5
- package/src/engine/ecs/gui/position/ViewportPosition.d.ts.map +1 -1
- package/src/engine/ecs/gui/position/ViewportPosition.js +42 -53
- package/src/engine/ecs/speaker/VoiceSystem.d.ts +2 -3
- package/src/engine/ecs/speaker/VoiceSystem.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/find_max_depth_radius_for_point.js +2 -2
- package/src/engine/intelligence/optimization/optimize_cyclic_sequence_pairwise.d.ts +12 -0
- package/src/engine/intelligence/optimization/optimize_cyclic_sequence_pairwise.d.ts.map +1 -0
- package/src/engine/intelligence/optimization/optimize_cyclic_sequence_pairwise.js +90 -0
- package/src/core/geometry/3d/tetrahedra/tetrahedral_mesh_find_tets_attached_to_vertex.d.ts.map +0 -1
- package/src/core/math/random/MersenneTwister.d.ts +0 -19
- package/src/core/math/random/MersenneTwister.d.ts.map +0 -1
- package/src/core/math/random/MersenneTwister.js +0 -212
- package/src/core/math/random/seededRandomMersenneTwister.d.ts +0 -7
- package/src/core/math/random/seededRandomMersenneTwister.d.ts.map +0 -1
- /package/src/core/{geometry → geom}/3d/tetrahedra/tetrahedral_mesh_find_tets_attached_to_vertex.d.ts +0 -0
- /package/src/core/{geometry → geom}/3d/tetrahedra/tetrahedral_mesh_find_tets_attached_to_vertex.js +0 -0
package/build/meep.cjs
CHANGED
|
@@ -1767,6 +1767,12 @@ function lerp$1(a, b, fraction) {
|
|
|
1767
1767
|
return (b - a) * fraction + a;
|
|
1768
1768
|
}
|
|
1769
1769
|
|
|
1770
|
+
/**
|
|
1771
|
+
* equal to `Math.pow(2,32) - 1`
|
|
1772
|
+
* @type {number}
|
|
1773
|
+
*/
|
|
1774
|
+
const UINT32_MAX = 4294967295;
|
|
1775
|
+
|
|
1770
1776
|
/**
|
|
1771
1777
|
*
|
|
1772
1778
|
* @param {number} v
|
|
@@ -1774,12 +1780,12 @@ function lerp$1(a, b, fraction) {
|
|
|
1774
1780
|
*/
|
|
1775
1781
|
function computeHashFloat(v) {
|
|
1776
1782
|
//we break the number up into fractional and whole parts
|
|
1777
|
-
const whole = v
|
|
1783
|
+
const whole = v >> 0;
|
|
1778
1784
|
|
|
1779
1785
|
const fraction = v - whole;
|
|
1780
1786
|
|
|
1781
1787
|
//fractional part is scaled up into int32 range, this inexact method, as it will produce 0 hash for values below a certain threshold
|
|
1782
|
-
const fractionHash = fraction *
|
|
1788
|
+
const fractionHash = fraction * UINT32_MAX;
|
|
1783
1789
|
|
|
1784
1790
|
//take XOR of both parts
|
|
1785
1791
|
return fractionHash ^ whole;
|
|
@@ -2124,10 +2130,8 @@ function v3_slerp(
|
|
|
2124
2130
|
|
|
2125
2131
|
/**
|
|
2126
2132
|
* @author Alex Goldring
|
|
2127
|
-
* @copyright Alex Goldring 2015
|
|
2133
|
+
* @copyright Alex Goldring 2015-2024
|
|
2128
2134
|
*/
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
2135
|
let Vector3$1 = class Vector3 {
|
|
2132
2136
|
/**
|
|
2133
2137
|
*
|
|
@@ -3017,7 +3021,7 @@ let Vector3$1 = class Vector3 {
|
|
|
3017
3021
|
* @deprecated use dedicated method directly instead
|
|
3018
3022
|
*/
|
|
3019
3023
|
fromBinaryBufferFloat32_EqualityEncoded(buffer) {
|
|
3020
|
-
throw
|
|
3024
|
+
throw new Error('deprecated, use v3_binary_equality_decode')
|
|
3021
3025
|
}
|
|
3022
3026
|
|
|
3023
3027
|
hash() {
|
|
@@ -3178,19 +3182,7 @@ Vector3$1.prototype.isVector3 = true;
|
|
|
3178
3182
|
* @readonly
|
|
3179
3183
|
* @type {string}
|
|
3180
3184
|
*/
|
|
3181
|
-
Vector3$1.typeName = "Vector3";
|
|
3182
|
-
|
|
3183
|
-
/**
|
|
3184
|
-
* @deprecated use {@link v3_dot} directly instead
|
|
3185
|
-
* @param {number} x0
|
|
3186
|
-
* @param {number} y0
|
|
3187
|
-
* @param {number} z0
|
|
3188
|
-
* @param {number} x1
|
|
3189
|
-
* @param {number} y1
|
|
3190
|
-
* @param {number} z1
|
|
3191
|
-
* @returns {number}
|
|
3192
|
-
*/
|
|
3193
|
-
Vector3$1._dot = v3_dot;
|
|
3185
|
+
Vector3$1.typeName = "Vector3";
|
|
3194
3186
|
|
|
3195
3187
|
const scratch_v3_a = new Vector3$1();
|
|
3196
3188
|
const scratch_v3_b = new Vector3$1();
|
|
@@ -50301,6 +50293,7 @@ function float_to_uint8(v) {
|
|
|
50301
50293
|
* @returns {number}
|
|
50302
50294
|
*/
|
|
50303
50295
|
function uint8_to_float(v) {
|
|
50296
|
+
|
|
50304
50297
|
return v / 255;
|
|
50305
50298
|
}
|
|
50306
50299
|
|
|
@@ -52069,12 +52062,6 @@ class TerrainPreview {
|
|
|
52069
52062
|
}
|
|
52070
52063
|
}
|
|
52071
52064
|
|
|
52072
|
-
/**
|
|
52073
|
-
* equal to `Math.pow(2,32) - 1`
|
|
52074
|
-
* @type {number}
|
|
52075
|
-
*/
|
|
52076
|
-
const UINT32_MAX = 4294967295;
|
|
52077
|
-
|
|
52078
52065
|
/**
|
|
52079
52066
|
* This is essentially a {@link memcopy} implementation for ArrayBuffers
|
|
52080
52067
|
* NOTE: allocates light-weight typed arrays under the hood, so beware of potential GC implications. Generally not an issue, unless you're copying very large number of very small arrays, consider alternatives such as {@link array_copy} instead
|
|
@@ -53931,9 +53918,9 @@ class Color {
|
|
|
53931
53918
|
|
|
53932
53919
|
/**
|
|
53933
53920
|
*
|
|
53934
|
-
* @param {number} r
|
|
53935
|
-
* @param {number} g
|
|
53936
|
-
* @param {number} b
|
|
53921
|
+
* @param {number} r [0..255]
|
|
53922
|
+
* @param {number} g [0..255]
|
|
53923
|
+
* @param {number} b [0..255]
|
|
53937
53924
|
*/
|
|
53938
53925
|
setRGBUint8(r, g, b) {
|
|
53939
53926
|
this.setRGB(
|
|
@@ -55320,13 +55307,17 @@ function v3_morton_encode_bounded(x, y, z, bounds) {
|
|
|
55320
55307
|
function max3(a, b, c) {
|
|
55321
55308
|
|
|
55322
55309
|
let v = a;
|
|
55310
|
+
|
|
55323
55311
|
if (v < b) {
|
|
55324
55312
|
v = b;
|
|
55325
55313
|
}
|
|
55314
|
+
|
|
55326
55315
|
if (v < c) {
|
|
55327
55316
|
v = c;
|
|
55328
55317
|
}
|
|
55318
|
+
|
|
55329
55319
|
return v;
|
|
55320
|
+
|
|
55330
55321
|
}
|
|
55331
55322
|
|
|
55332
55323
|
/**
|
|
@@ -85318,6 +85309,13 @@ const STATUS_FULL = 0;
|
|
|
85318
85309
|
const STATUS_EMPTY = 1;
|
|
85319
85310
|
const STATUS_NORMAL = 2;
|
|
85320
85311
|
|
|
85312
|
+
/**
|
|
85313
|
+
* When growing underlying array, how much to grow by. This is a multiplier.
|
|
85314
|
+
* Must be greater than 1
|
|
85315
|
+
* @type {number}
|
|
85316
|
+
*/
|
|
85317
|
+
const GROWTH_FACTOR = 2;
|
|
85318
|
+
|
|
85321
85319
|
const EMPTY_ARRAY = new Array(0);
|
|
85322
85320
|
|
|
85323
85321
|
/**
|
|
@@ -85334,14 +85332,16 @@ class Deque {
|
|
|
85334
85332
|
* @private
|
|
85335
85333
|
*/
|
|
85336
85334
|
#data = EMPTY_ARRAY;
|
|
85335
|
+
|
|
85337
85336
|
/**
|
|
85338
|
-
*
|
|
85337
|
+
* Index of the front of the queue inside the internal data array
|
|
85339
85338
|
* @type {number}
|
|
85340
85339
|
* @private
|
|
85341
85340
|
*/
|
|
85342
85341
|
#head = 0;
|
|
85342
|
+
|
|
85343
85343
|
/**
|
|
85344
|
-
*
|
|
85344
|
+
* Index of the back of the queue inside the internal data array
|
|
85345
85345
|
* @type {number}
|
|
85346
85346
|
* @private
|
|
85347
85347
|
*/
|
|
@@ -85423,7 +85423,7 @@ class Deque {
|
|
|
85423
85423
|
}
|
|
85424
85424
|
|
|
85425
85425
|
// double existing length
|
|
85426
|
-
let new_length = length *
|
|
85426
|
+
let new_length = length * GROWTH_FACTOR;
|
|
85427
85427
|
|
|
85428
85428
|
if (new_length > UINT32_MAX) {
|
|
85429
85429
|
// clamp to max uint32 value
|
|
@@ -85496,41 +85496,23 @@ class Deque {
|
|
|
85496
85496
|
/**
|
|
85497
85497
|
*
|
|
85498
85498
|
* @param {number} current
|
|
85499
|
-
* @param {boolean} shift_front should we shift elements before the removed element or after?
|
|
85500
85499
|
* @private
|
|
85501
85500
|
*/
|
|
85502
|
-
#
|
|
85501
|
+
#remove_internal_shift_backward(current) {
|
|
85503
85502
|
let cursor = current;
|
|
85504
85503
|
|
|
85505
|
-
|
|
85506
|
-
|
|
85507
|
-
// shift towards tail
|
|
85508
|
-
|
|
85509
|
-
const head = this.#head;
|
|
85504
|
+
// shift towards head, this has a better data access pattern than shifting the other way as we're going through the data in forward sequence
|
|
85510
85505
|
|
|
85511
|
-
|
|
85512
|
-
const next = this.#circular_previous_position(cursor);
|
|
85513
|
-
this.#data[cursor] = this.#data[next];
|
|
85514
|
-
cursor = next;
|
|
85515
|
-
}
|
|
85516
|
-
|
|
85517
|
-
this.#head = this.#circular_next_position(head);
|
|
85518
|
-
|
|
85519
|
-
} else {
|
|
85520
|
-
|
|
85521
|
-
// shift towards head
|
|
85522
|
-
|
|
85523
|
-
const tail = this.#tail;
|
|
85506
|
+
const tail = this.#tail;
|
|
85524
85507
|
|
|
85525
|
-
|
|
85526
|
-
|
|
85527
|
-
|
|
85528
|
-
|
|
85529
|
-
|
|
85508
|
+
while (cursor !== tail) {
|
|
85509
|
+
const next = this.#circular_next_position(cursor);
|
|
85510
|
+
this.#data[cursor] = this.#data[next];
|
|
85511
|
+
cursor = next;
|
|
85512
|
+
}
|
|
85530
85513
|
|
|
85531
|
-
|
|
85514
|
+
this.#tail = this.#circular_previous_position(tail);
|
|
85532
85515
|
|
|
85533
|
-
}
|
|
85534
85516
|
|
|
85535
85517
|
// fill in slot of last moved element
|
|
85536
85518
|
this.#data[cursor] = undefined;
|
|
@@ -85550,7 +85532,7 @@ class Deque {
|
|
|
85550
85532
|
return false;
|
|
85551
85533
|
}
|
|
85552
85534
|
|
|
85553
|
-
this.#
|
|
85535
|
+
this.#remove_internal_shift_backward(i);
|
|
85554
85536
|
|
|
85555
85537
|
return true;
|
|
85556
85538
|
}
|
|
@@ -85712,12 +85694,21 @@ class Deque {
|
|
|
85712
85694
|
Stack methods
|
|
85713
85695
|
*/
|
|
85714
85696
|
|
|
85697
|
+
/**
|
|
85698
|
+
* Stack operation. Alias of {@link Deque.prototype.getFirst}
|
|
85699
|
+
*/
|
|
85715
85700
|
Deque.prototype.peek = Deque.prototype.getFirst;
|
|
85701
|
+
/**
|
|
85702
|
+
* Stack operation. Alias of {@link Deque.prototype.addFirst}
|
|
85703
|
+
*/
|
|
85716
85704
|
Deque.prototype.push = Deque.prototype.addFirst;
|
|
85705
|
+
/**
|
|
85706
|
+
* Stack operation. Alias of {@link Deque.prototype.removeFirst}
|
|
85707
|
+
*/
|
|
85717
85708
|
Deque.prototype.pop = Deque.prototype.removeFirst;
|
|
85718
85709
|
|
|
85719
85710
|
/**
|
|
85720
|
-
*
|
|
85711
|
+
* Alias of {@link Deque.prototype.addLast}
|
|
85721
85712
|
*/
|
|
85722
85713
|
Deque.prototype.add = Deque.prototype.addLast;
|
|
85723
85714
|
|
|
@@ -103237,59 +103228,49 @@ GUIElement.serializable = true;
|
|
|
103237
103228
|
|
|
103238
103229
|
class ViewportPosition {
|
|
103239
103230
|
/**
|
|
103240
|
-
*
|
|
103241
|
-
* @
|
|
103231
|
+
* Clip-scale position, on-screen values are in range of 0 to 1
|
|
103232
|
+
* @type {Vector2}
|
|
103242
103233
|
*/
|
|
103243
|
-
|
|
103244
|
-
/**
|
|
103245
|
-
* Clip-scale position, on-screen values are in range of 0 to 1
|
|
103246
|
-
* @type {Vector2}
|
|
103247
|
-
*/
|
|
103248
|
-
this.position = new Vector2();
|
|
103234
|
+
position = new Vector2();
|
|
103249
103235
|
|
|
103250
|
-
|
|
103251
|
-
|
|
103252
|
-
|
|
103253
|
-
|
|
103254
|
-
|
|
103255
|
-
|
|
103256
|
-
|
|
103257
|
-
|
|
103258
|
-
|
|
103259
|
-
|
|
103236
|
+
/**
|
|
103237
|
+
* Fixed offset in pixels
|
|
103238
|
+
* @type {Vector2}
|
|
103239
|
+
*/
|
|
103240
|
+
offset = new Vector2();
|
|
103241
|
+
/**
|
|
103242
|
+
* ranges from 0..1 in both X and Y, controls anchor point of element positioning
|
|
103243
|
+
* @type {Vector2}
|
|
103244
|
+
*/
|
|
103245
|
+
anchor = new Vector2(0, 0);
|
|
103260
103246
|
|
|
103261
103247
|
|
|
103262
|
-
|
|
103263
|
-
|
|
103264
|
-
|
|
103265
|
-
|
|
103266
|
-
|
|
103267
|
-
|
|
103268
|
-
|
|
103269
|
-
/**
|
|
103270
|
-
* How far should the HUD stay away from the edge if it's sticky
|
|
103271
|
-
* @see stickToScreenEdge
|
|
103272
|
-
* @type {number}
|
|
103273
|
-
*/
|
|
103274
|
-
this.screenEdgeWidth = 10;
|
|
103248
|
+
/**
|
|
103249
|
+
* Makes display element avoid overlap with GUI elements
|
|
103250
|
+
* @see GUIElement
|
|
103251
|
+
* @type {boolean}
|
|
103252
|
+
*/
|
|
103253
|
+
resolveGuiCollisions = false;
|
|
103275
103254
|
|
|
103255
|
+
/**
|
|
103256
|
+
* How far should the HUD stay away from the edge if it's sticky
|
|
103257
|
+
* @see stickToScreenEdge
|
|
103258
|
+
* @type {number}
|
|
103259
|
+
*/
|
|
103260
|
+
screenEdgeWidth = 10;
|
|
103276
103261
|
|
|
103277
|
-
/**
|
|
103278
|
-
* Controls whenever or not HUD should remain on the screen when it gets to the edge
|
|
103279
|
-
* @type {boolean}
|
|
103280
|
-
*/
|
|
103281
|
-
this.stickToScreenEdge = false;
|
|
103282
103262
|
|
|
103283
|
-
|
|
103284
|
-
|
|
103285
|
-
|
|
103286
|
-
|
|
103287
|
-
|
|
103263
|
+
/**
|
|
103264
|
+
* Controls whenever or not HUD should remain on the screen when it gets to the edge
|
|
103265
|
+
* @type {boolean}
|
|
103266
|
+
*/
|
|
103267
|
+
stickToScreenEdge = false;
|
|
103288
103268
|
|
|
103289
|
-
|
|
103290
|
-
|
|
103291
|
-
|
|
103292
|
-
|
|
103269
|
+
/**
|
|
103270
|
+
* Can be used to enable and disable positioning
|
|
103271
|
+
* @type {ObservedBoolean}
|
|
103272
|
+
*/
|
|
103273
|
+
enabled = new ObservedBoolean(true);
|
|
103293
103274
|
|
|
103294
103275
|
/**
|
|
103295
103276
|
*
|