@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.module.js
CHANGED
|
@@ -1765,6 +1765,12 @@ function lerp$1(a, b, fraction) {
|
|
|
1765
1765
|
return (b - a) * fraction + a;
|
|
1766
1766
|
}
|
|
1767
1767
|
|
|
1768
|
+
/**
|
|
1769
|
+
* equal to `Math.pow(2,32) - 1`
|
|
1770
|
+
* @type {number}
|
|
1771
|
+
*/
|
|
1772
|
+
const UINT32_MAX = 4294967295;
|
|
1773
|
+
|
|
1768
1774
|
/**
|
|
1769
1775
|
*
|
|
1770
1776
|
* @param {number} v
|
|
@@ -1772,12 +1778,12 @@ function lerp$1(a, b, fraction) {
|
|
|
1772
1778
|
*/
|
|
1773
1779
|
function computeHashFloat(v) {
|
|
1774
1780
|
//we break the number up into fractional and whole parts
|
|
1775
|
-
const whole = v
|
|
1781
|
+
const whole = v >> 0;
|
|
1776
1782
|
|
|
1777
1783
|
const fraction = v - whole;
|
|
1778
1784
|
|
|
1779
1785
|
//fractional part is scaled up into int32 range, this inexact method, as it will produce 0 hash for values below a certain threshold
|
|
1780
|
-
const fractionHash = fraction *
|
|
1786
|
+
const fractionHash = fraction * UINT32_MAX;
|
|
1781
1787
|
|
|
1782
1788
|
//take XOR of both parts
|
|
1783
1789
|
return fractionHash ^ whole;
|
|
@@ -2122,10 +2128,8 @@ function v3_slerp(
|
|
|
2122
2128
|
|
|
2123
2129
|
/**
|
|
2124
2130
|
* @author Alex Goldring
|
|
2125
|
-
* @copyright Alex Goldring 2015
|
|
2131
|
+
* @copyright Alex Goldring 2015-2024
|
|
2126
2132
|
*/
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
2133
|
let Vector3$1 = class Vector3 {
|
|
2130
2134
|
/**
|
|
2131
2135
|
*
|
|
@@ -3015,7 +3019,7 @@ let Vector3$1 = class Vector3 {
|
|
|
3015
3019
|
* @deprecated use dedicated method directly instead
|
|
3016
3020
|
*/
|
|
3017
3021
|
fromBinaryBufferFloat32_EqualityEncoded(buffer) {
|
|
3018
|
-
throw
|
|
3022
|
+
throw new Error('deprecated, use v3_binary_equality_decode')
|
|
3019
3023
|
}
|
|
3020
3024
|
|
|
3021
3025
|
hash() {
|
|
@@ -3176,19 +3180,7 @@ Vector3$1.prototype.isVector3 = true;
|
|
|
3176
3180
|
* @readonly
|
|
3177
3181
|
* @type {string}
|
|
3178
3182
|
*/
|
|
3179
|
-
Vector3$1.typeName = "Vector3";
|
|
3180
|
-
|
|
3181
|
-
/**
|
|
3182
|
-
* @deprecated use {@link v3_dot} directly instead
|
|
3183
|
-
* @param {number} x0
|
|
3184
|
-
* @param {number} y0
|
|
3185
|
-
* @param {number} z0
|
|
3186
|
-
* @param {number} x1
|
|
3187
|
-
* @param {number} y1
|
|
3188
|
-
* @param {number} z1
|
|
3189
|
-
* @returns {number}
|
|
3190
|
-
*/
|
|
3191
|
-
Vector3$1._dot = v3_dot;
|
|
3183
|
+
Vector3$1.typeName = "Vector3";
|
|
3192
3184
|
|
|
3193
3185
|
const scratch_v3_a = new Vector3$1();
|
|
3194
3186
|
const scratch_v3_b = new Vector3$1();
|
|
@@ -50299,6 +50291,7 @@ function float_to_uint8(v) {
|
|
|
50299
50291
|
* @returns {number}
|
|
50300
50292
|
*/
|
|
50301
50293
|
function uint8_to_float(v) {
|
|
50294
|
+
|
|
50302
50295
|
return v / 255;
|
|
50303
50296
|
}
|
|
50304
50297
|
|
|
@@ -52067,12 +52060,6 @@ class TerrainPreview {
|
|
|
52067
52060
|
}
|
|
52068
52061
|
}
|
|
52069
52062
|
|
|
52070
|
-
/**
|
|
52071
|
-
* equal to `Math.pow(2,32) - 1`
|
|
52072
|
-
* @type {number}
|
|
52073
|
-
*/
|
|
52074
|
-
const UINT32_MAX = 4294967295;
|
|
52075
|
-
|
|
52076
52063
|
/**
|
|
52077
52064
|
* This is essentially a {@link memcopy} implementation for ArrayBuffers
|
|
52078
52065
|
* 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
|
|
@@ -53929,9 +53916,9 @@ class Color {
|
|
|
53929
53916
|
|
|
53930
53917
|
/**
|
|
53931
53918
|
*
|
|
53932
|
-
* @param {number} r
|
|
53933
|
-
* @param {number} g
|
|
53934
|
-
* @param {number} b
|
|
53919
|
+
* @param {number} r [0..255]
|
|
53920
|
+
* @param {number} g [0..255]
|
|
53921
|
+
* @param {number} b [0..255]
|
|
53935
53922
|
*/
|
|
53936
53923
|
setRGBUint8(r, g, b) {
|
|
53937
53924
|
this.setRGB(
|
|
@@ -55318,13 +55305,17 @@ function v3_morton_encode_bounded(x, y, z, bounds) {
|
|
|
55318
55305
|
function max3(a, b, c) {
|
|
55319
55306
|
|
|
55320
55307
|
let v = a;
|
|
55308
|
+
|
|
55321
55309
|
if (v < b) {
|
|
55322
55310
|
v = b;
|
|
55323
55311
|
}
|
|
55312
|
+
|
|
55324
55313
|
if (v < c) {
|
|
55325
55314
|
v = c;
|
|
55326
55315
|
}
|
|
55316
|
+
|
|
55327
55317
|
return v;
|
|
55318
|
+
|
|
55328
55319
|
}
|
|
55329
55320
|
|
|
55330
55321
|
/**
|
|
@@ -85316,6 +85307,13 @@ const STATUS_FULL = 0;
|
|
|
85316
85307
|
const STATUS_EMPTY = 1;
|
|
85317
85308
|
const STATUS_NORMAL = 2;
|
|
85318
85309
|
|
|
85310
|
+
/**
|
|
85311
|
+
* When growing underlying array, how much to grow by. This is a multiplier.
|
|
85312
|
+
* Must be greater than 1
|
|
85313
|
+
* @type {number}
|
|
85314
|
+
*/
|
|
85315
|
+
const GROWTH_FACTOR = 2;
|
|
85316
|
+
|
|
85319
85317
|
const EMPTY_ARRAY = new Array(0);
|
|
85320
85318
|
|
|
85321
85319
|
/**
|
|
@@ -85332,14 +85330,16 @@ class Deque {
|
|
|
85332
85330
|
* @private
|
|
85333
85331
|
*/
|
|
85334
85332
|
#data = EMPTY_ARRAY;
|
|
85333
|
+
|
|
85335
85334
|
/**
|
|
85336
|
-
*
|
|
85335
|
+
* Index of the front of the queue inside the internal data array
|
|
85337
85336
|
* @type {number}
|
|
85338
85337
|
* @private
|
|
85339
85338
|
*/
|
|
85340
85339
|
#head = 0;
|
|
85340
|
+
|
|
85341
85341
|
/**
|
|
85342
|
-
*
|
|
85342
|
+
* Index of the back of the queue inside the internal data array
|
|
85343
85343
|
* @type {number}
|
|
85344
85344
|
* @private
|
|
85345
85345
|
*/
|
|
@@ -85421,7 +85421,7 @@ class Deque {
|
|
|
85421
85421
|
}
|
|
85422
85422
|
|
|
85423
85423
|
// double existing length
|
|
85424
|
-
let new_length = length *
|
|
85424
|
+
let new_length = length * GROWTH_FACTOR;
|
|
85425
85425
|
|
|
85426
85426
|
if (new_length > UINT32_MAX) {
|
|
85427
85427
|
// clamp to max uint32 value
|
|
@@ -85494,41 +85494,23 @@ class Deque {
|
|
|
85494
85494
|
/**
|
|
85495
85495
|
*
|
|
85496
85496
|
* @param {number} current
|
|
85497
|
-
* @param {boolean} shift_front should we shift elements before the removed element or after?
|
|
85498
85497
|
* @private
|
|
85499
85498
|
*/
|
|
85500
|
-
#
|
|
85499
|
+
#remove_internal_shift_backward(current) {
|
|
85501
85500
|
let cursor = current;
|
|
85502
85501
|
|
|
85503
|
-
|
|
85504
|
-
|
|
85505
|
-
// shift towards tail
|
|
85506
|
-
|
|
85507
|
-
const head = this.#head;
|
|
85502
|
+
// 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
|
|
85508
85503
|
|
|
85509
|
-
|
|
85510
|
-
const next = this.#circular_previous_position(cursor);
|
|
85511
|
-
this.#data[cursor] = this.#data[next];
|
|
85512
|
-
cursor = next;
|
|
85513
|
-
}
|
|
85514
|
-
|
|
85515
|
-
this.#head = this.#circular_next_position(head);
|
|
85516
|
-
|
|
85517
|
-
} else {
|
|
85518
|
-
|
|
85519
|
-
// shift towards head
|
|
85520
|
-
|
|
85521
|
-
const tail = this.#tail;
|
|
85504
|
+
const tail = this.#tail;
|
|
85522
85505
|
|
|
85523
|
-
|
|
85524
|
-
|
|
85525
|
-
|
|
85526
|
-
|
|
85527
|
-
|
|
85506
|
+
while (cursor !== tail) {
|
|
85507
|
+
const next = this.#circular_next_position(cursor);
|
|
85508
|
+
this.#data[cursor] = this.#data[next];
|
|
85509
|
+
cursor = next;
|
|
85510
|
+
}
|
|
85528
85511
|
|
|
85529
|
-
|
|
85512
|
+
this.#tail = this.#circular_previous_position(tail);
|
|
85530
85513
|
|
|
85531
|
-
}
|
|
85532
85514
|
|
|
85533
85515
|
// fill in slot of last moved element
|
|
85534
85516
|
this.#data[cursor] = undefined;
|
|
@@ -85548,7 +85530,7 @@ class Deque {
|
|
|
85548
85530
|
return false;
|
|
85549
85531
|
}
|
|
85550
85532
|
|
|
85551
|
-
this.#
|
|
85533
|
+
this.#remove_internal_shift_backward(i);
|
|
85552
85534
|
|
|
85553
85535
|
return true;
|
|
85554
85536
|
}
|
|
@@ -85710,12 +85692,21 @@ class Deque {
|
|
|
85710
85692
|
Stack methods
|
|
85711
85693
|
*/
|
|
85712
85694
|
|
|
85695
|
+
/**
|
|
85696
|
+
* Stack operation. Alias of {@link Deque.prototype.getFirst}
|
|
85697
|
+
*/
|
|
85713
85698
|
Deque.prototype.peek = Deque.prototype.getFirst;
|
|
85699
|
+
/**
|
|
85700
|
+
* Stack operation. Alias of {@link Deque.prototype.addFirst}
|
|
85701
|
+
*/
|
|
85714
85702
|
Deque.prototype.push = Deque.prototype.addFirst;
|
|
85703
|
+
/**
|
|
85704
|
+
* Stack operation. Alias of {@link Deque.prototype.removeFirst}
|
|
85705
|
+
*/
|
|
85715
85706
|
Deque.prototype.pop = Deque.prototype.removeFirst;
|
|
85716
85707
|
|
|
85717
85708
|
/**
|
|
85718
|
-
*
|
|
85709
|
+
* Alias of {@link Deque.prototype.addLast}
|
|
85719
85710
|
*/
|
|
85720
85711
|
Deque.prototype.add = Deque.prototype.addLast;
|
|
85721
85712
|
|
|
@@ -103235,59 +103226,49 @@ GUIElement.serializable = true;
|
|
|
103235
103226
|
|
|
103236
103227
|
class ViewportPosition {
|
|
103237
103228
|
/**
|
|
103238
|
-
*
|
|
103239
|
-
* @
|
|
103229
|
+
* Clip-scale position, on-screen values are in range of 0 to 1
|
|
103230
|
+
* @type {Vector2}
|
|
103240
103231
|
*/
|
|
103241
|
-
|
|
103242
|
-
/**
|
|
103243
|
-
* Clip-scale position, on-screen values are in range of 0 to 1
|
|
103244
|
-
* @type {Vector2}
|
|
103245
|
-
*/
|
|
103246
|
-
this.position = new Vector2();
|
|
103232
|
+
position = new Vector2();
|
|
103247
103233
|
|
|
103248
|
-
|
|
103249
|
-
|
|
103250
|
-
|
|
103251
|
-
|
|
103252
|
-
|
|
103253
|
-
|
|
103254
|
-
|
|
103255
|
-
|
|
103256
|
-
|
|
103257
|
-
|
|
103234
|
+
/**
|
|
103235
|
+
* Fixed offset in pixels
|
|
103236
|
+
* @type {Vector2}
|
|
103237
|
+
*/
|
|
103238
|
+
offset = new Vector2();
|
|
103239
|
+
/**
|
|
103240
|
+
* ranges from 0..1 in both X and Y, controls anchor point of element positioning
|
|
103241
|
+
* @type {Vector2}
|
|
103242
|
+
*/
|
|
103243
|
+
anchor = new Vector2(0, 0);
|
|
103258
103244
|
|
|
103259
103245
|
|
|
103260
|
-
|
|
103261
|
-
|
|
103262
|
-
|
|
103263
|
-
|
|
103264
|
-
|
|
103265
|
-
|
|
103266
|
-
|
|
103267
|
-
/**
|
|
103268
|
-
* How far should the HUD stay away from the edge if it's sticky
|
|
103269
|
-
* @see stickToScreenEdge
|
|
103270
|
-
* @type {number}
|
|
103271
|
-
*/
|
|
103272
|
-
this.screenEdgeWidth = 10;
|
|
103246
|
+
/**
|
|
103247
|
+
* Makes display element avoid overlap with GUI elements
|
|
103248
|
+
* @see GUIElement
|
|
103249
|
+
* @type {boolean}
|
|
103250
|
+
*/
|
|
103251
|
+
resolveGuiCollisions = false;
|
|
103273
103252
|
|
|
103253
|
+
/**
|
|
103254
|
+
* How far should the HUD stay away from the edge if it's sticky
|
|
103255
|
+
* @see stickToScreenEdge
|
|
103256
|
+
* @type {number}
|
|
103257
|
+
*/
|
|
103258
|
+
screenEdgeWidth = 10;
|
|
103274
103259
|
|
|
103275
|
-
/**
|
|
103276
|
-
* Controls whenever or not HUD should remain on the screen when it gets to the edge
|
|
103277
|
-
* @type {boolean}
|
|
103278
|
-
*/
|
|
103279
|
-
this.stickToScreenEdge = false;
|
|
103280
103260
|
|
|
103281
|
-
|
|
103282
|
-
|
|
103283
|
-
|
|
103284
|
-
|
|
103285
|
-
|
|
103261
|
+
/**
|
|
103262
|
+
* Controls whenever or not HUD should remain on the screen when it gets to the edge
|
|
103263
|
+
* @type {boolean}
|
|
103264
|
+
*/
|
|
103265
|
+
stickToScreenEdge = false;
|
|
103286
103266
|
|
|
103287
|
-
|
|
103288
|
-
|
|
103289
|
-
|
|
103290
|
-
|
|
103267
|
+
/**
|
|
103268
|
+
* Can be used to enable and disable positioning
|
|
103269
|
+
* @type {ObservedBoolean}
|
|
103270
|
+
*/
|
|
103271
|
+
enabled = new ObservedBoolean(true);
|
|
103291
103272
|
|
|
103292
103273
|
/**
|
|
103293
103274
|
*
|
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.118.
|
|
8
|
+
"version": "2.118.5",
|
|
9
9
|
"main": "build/meep.module.js",
|
|
10
10
|
"module": "build/meep.module.js",
|
|
11
11
|
"exports": {
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"gl-matrix": "3.4.3",
|
|
44
44
|
"opentype.js": "1.3.3",
|
|
45
|
-
"
|
|
46
|
-
"
|
|
45
|
+
"pako": "2.0.3",
|
|
46
|
+
"robust-predicates": "3.0.2"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"three": ">=0.135.0"
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
"@babel/preset-env": "7.22.15",
|
|
59
59
|
"@rollup/plugin-commonjs": "25.0.2",
|
|
60
60
|
"@rollup/plugin-node-resolve": "15.1.0",
|
|
61
|
-
"@rollup/plugin-terser": "0.4.3",
|
|
62
61
|
"@rollup/plugin-strip": "3.0.2",
|
|
63
|
-
"@
|
|
62
|
+
"@rollup/plugin-terser": "0.4.3",
|
|
64
63
|
"@types/jest": "29.5.12",
|
|
64
|
+
"@types/three": "^0.135.0",
|
|
65
65
|
"babel-jest": "29.5.0",
|
|
66
66
|
"jest": "29.6.4",
|
|
67
67
|
"jest-environment-jsdom": "29.6.4",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EndianType.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/EndianType.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EndianType.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/EndianType.js"],"names":[],"mappings":";;;yBAGU,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uint8_to_float.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/uint8_to_float.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"uint8_to_float.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/uint8_to_float.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,kCAHW,MAAM,GACJ,MAAM,CAOlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Deque.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/queue/Deque.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Deque.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/queue/Deque.js"],"names":[],"mappings":"AAqBA;;;GAGG;AACH;IAgCI;;;OAGG;IACH,uBAFW,MAAM,EAUhB;IAuFD;;;OAGG;IACH,WAFY,OAAO,CAIlB;IAED,cAeC;IAED;;;OAGG;IACH,QAFa,MAAM,CAalB;IA6BD;;;;OAIG;IACH,UAHW,CAAC,GACC,OAAO,CAYnB;IA4BD;;;;OAIG;IACH,WAFa,OAAO,CAInB;IAED;;;OAGG;IACH,YAFW,CAAC,QAOX;IAED;;;OAGG;IACH,eAFa,CAAC,GAAC,SAAS,CAQvB;IAED;;;OAGG;IACH,YAFa,CAAC,GAAC,SAAS,CAIvB;IAED;;;OAGG;IACH,WAFW,CAAC,QAOX;IAED;;;OAGG;IACH,cAFa,CAAC,CASb;IAGD;;;OAGG;IACH,WAFa,CAAC,GAAC,SAAS,CAKvB;IAED;;;;OAIG;IACH,yBAHW,MAAM,GACJ,CAAC,GAAC,SAAS,CAmBvB;IAED;;;;;OAKG;IACH,iBAJW,CAAC,EAAE,kBACH,MAAM,GACJ,CAAC,EAAE,CAUf;IAoBL;;OAEG;IACH,gBAAoB;IACpB;;OAEG;IACH,uBAAoB;IACpB;;OAEG;IACH,eAAmB;IAEnB;;OAEG;IACH,sBAAmB;IAlCf;;;OAGG;IACH,qBAFa,UAAU,CAAC,EAAC,IAAI,CAAC,CAS7B;;CACJ"}
|
|
@@ -10,6 +10,13 @@ const STATUS_FULL = 0;
|
|
|
10
10
|
const STATUS_EMPTY = 1;
|
|
11
11
|
const STATUS_NORMAL = 2;
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* When growing underlying array, how much to grow by. This is a multiplier.
|
|
15
|
+
* Must be greater than 1
|
|
16
|
+
* @type {number}
|
|
17
|
+
*/
|
|
18
|
+
const GROWTH_FACTOR = 2;
|
|
19
|
+
|
|
13
20
|
const EMPTY_ARRAY = new Array(0);
|
|
14
21
|
|
|
15
22
|
/**
|
|
@@ -26,14 +33,16 @@ export class Deque {
|
|
|
26
33
|
* @private
|
|
27
34
|
*/
|
|
28
35
|
#data = EMPTY_ARRAY;
|
|
36
|
+
|
|
29
37
|
/**
|
|
30
|
-
*
|
|
38
|
+
* Index of the front of the queue inside the internal data array
|
|
31
39
|
* @type {number}
|
|
32
40
|
* @private
|
|
33
41
|
*/
|
|
34
42
|
#head = 0;
|
|
43
|
+
|
|
35
44
|
/**
|
|
36
|
-
*
|
|
45
|
+
* Index of the back of the queue inside the internal data array
|
|
37
46
|
* @type {number}
|
|
38
47
|
* @private
|
|
39
48
|
*/
|
|
@@ -117,7 +126,7 @@ export class Deque {
|
|
|
117
126
|
}
|
|
118
127
|
|
|
119
128
|
// double existing length
|
|
120
|
-
let new_length = length *
|
|
129
|
+
let new_length = length * GROWTH_FACTOR;
|
|
121
130
|
|
|
122
131
|
if (new_length > UINT32_MAX) {
|
|
123
132
|
// clamp to max uint32 value
|
|
@@ -190,41 +199,23 @@ export class Deque {
|
|
|
190
199
|
/**
|
|
191
200
|
*
|
|
192
201
|
* @param {number} current
|
|
193
|
-
* @param {boolean} shift_front should we shift elements before the removed element or after?
|
|
194
202
|
* @private
|
|
195
203
|
*/
|
|
196
|
-
#
|
|
204
|
+
#remove_internal_shift_backward(current) {
|
|
197
205
|
let cursor = current;
|
|
198
206
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
// shift towards tail
|
|
202
|
-
|
|
203
|
-
const head = this.#head;
|
|
204
|
-
|
|
205
|
-
while (cursor !== head) {
|
|
206
|
-
const next = this.#circular_previous_position(cursor);
|
|
207
|
-
this.#data[cursor] = this.#data[next];
|
|
208
|
-
cursor = next;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
this.#head = this.#circular_next_position(head);
|
|
212
|
-
|
|
213
|
-
} else {
|
|
214
|
-
|
|
215
|
-
// shift towards head
|
|
207
|
+
// 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
|
|
216
208
|
|
|
217
|
-
|
|
209
|
+
const tail = this.#tail;
|
|
218
210
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
211
|
+
while (cursor !== tail) {
|
|
212
|
+
const next = this.#circular_next_position(cursor);
|
|
213
|
+
this.#data[cursor] = this.#data[next];
|
|
214
|
+
cursor = next;
|
|
215
|
+
}
|
|
224
216
|
|
|
225
|
-
|
|
217
|
+
this.#tail = this.#circular_previous_position(tail);
|
|
226
218
|
|
|
227
|
-
}
|
|
228
219
|
|
|
229
220
|
// fill in slot of last moved element
|
|
230
221
|
this.#data[cursor] = undefined;
|
|
@@ -244,7 +235,7 @@ export class Deque {
|
|
|
244
235
|
return false;
|
|
245
236
|
}
|
|
246
237
|
|
|
247
|
-
this.#
|
|
238
|
+
this.#remove_internal_shift_backward(i);
|
|
248
239
|
|
|
249
240
|
return true;
|
|
250
241
|
}
|
|
@@ -407,11 +398,20 @@ export class Deque {
|
|
|
407
398
|
Stack methods
|
|
408
399
|
*/
|
|
409
400
|
|
|
401
|
+
/**
|
|
402
|
+
* Stack operation. Alias of {@link Deque.prototype.getFirst}
|
|
403
|
+
*/
|
|
410
404
|
Deque.prototype.peek = Deque.prototype.getFirst;
|
|
405
|
+
/**
|
|
406
|
+
* Stack operation. Alias of {@link Deque.prototype.addFirst}
|
|
407
|
+
*/
|
|
411
408
|
Deque.prototype.push = Deque.prototype.addFirst;
|
|
409
|
+
/**
|
|
410
|
+
* Stack operation. Alias of {@link Deque.prototype.removeFirst}
|
|
411
|
+
*/
|
|
412
412
|
Deque.prototype.pop = Deque.prototype.removeFirst;
|
|
413
413
|
|
|
414
414
|
/**
|
|
415
|
-
*
|
|
415
|
+
* Alias of {@link Deque.prototype.addLast}
|
|
416
416
|
*/
|
|
417
417
|
Deque.prototype.add = Deque.prototype.addLast;
|
package/src/core/color/Color.js
CHANGED
|
@@ -152,9 +152,9 @@ export class Color {
|
|
|
152
152
|
|
|
153
153
|
/**
|
|
154
154
|
*
|
|
155
|
-
* @param {number} r
|
|
156
|
-
* @param {number} g
|
|
157
|
-
* @param {number} b
|
|
155
|
+
* @param {number} r [0..255]
|
|
156
|
+
* @param {number} g [0..255]
|
|
157
|
+
* @param {number} b [0..255]
|
|
158
158
|
*/
|
|
159
159
|
setRGBUint8(r, g, b) {
|
|
160
160
|
this.setRGB(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rgb_to_kelvin.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/kelvin/rgb_to_kelvin.js"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,qCAHW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC;IAAC,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAA;CAAC,iBACvD,MAAM,
|
|
1
|
+
{"version":3,"file":"rgb_to_kelvin.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/kelvin/rgb_to_kelvin.js"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,qCAHW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC;IAAC,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAA;CAAC,iBACvD,MAAM,UAkChB"}
|
|
@@ -13,16 +13,25 @@ export function rgb_to_kelvin(input, input_offset = 0) {
|
|
|
13
13
|
const g = input[input_offset + 1];
|
|
14
14
|
const b = input[input_offset + 2];
|
|
15
15
|
|
|
16
|
+
const blue_red_ratio = b / r;
|
|
17
|
+
|
|
16
18
|
// use solver to reverse function, slow but hey - it works
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
let temperature;
|
|
20
|
+
|
|
21
|
+
const epsilon = 0.4;
|
|
22
|
+
|
|
23
|
+
let minTemperature = 1000;
|
|
24
|
+
let maxTemperature = 40000;
|
|
21
25
|
|
|
22
26
|
while (maxTemperature - minTemperature > epsilon) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
|
|
28
|
+
temperature = (maxTemperature + minTemperature) * 0.5;
|
|
29
|
+
|
|
30
|
+
kelvin_to_rgb(scratch_rgb, 0, temperature);
|
|
31
|
+
|
|
32
|
+
const br = scratch_rgb[2] / scratch_rgb[0];
|
|
33
|
+
|
|
34
|
+
if (br >= blue_red_ratio) {
|
|
26
35
|
maxTemperature = temperature;
|
|
27
36
|
} else {
|
|
28
37
|
minTemperature = temperature;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tetrahedral_mesh_find_tets_attached_to_vertex.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/tetrahedra/tetrahedral_mesh_find_tets_attached_to_vertex.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,sEANW,MAAM,EAAE,iBACR,MAAM,uCAEN,MAAM,GACJ,MAAM,CAyBlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Vector3.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Vector3.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Vector3.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Vector3.js"],"names":[],"mappings":";AAcA;;;GAGG;AACH;IAstBI;;;;;;;OAOG;IACH,iFAeC;IAyMD;;;;;OAKG;IACH,cAJW,OAAO,UAAQ,KACf,OAAO,UAAQ,GACb,MAAM,CAIlB;IAED;;;;;OAKG;IACH,mBAJW,OAAO,KACP,OAAO,GACL,MAAM,CAIlB;IAED;;;;;OAKG;IACH,wBAJW,MAAM,EAAE,WACR,MAAM,GACJ,OAAO,CAQnB;IAED;;;;OAIG;IACH,yBAHW,MAAM,GACJ,OAAO,CAInB;IA99BD;;;;;;OAMG;IACH,gBALW,MAAM,MACN,MAAM,MACN,MAAM,EAsBhB;IAlBG;;OAEG;IACH,GAFU,MAAM,CAEN;IACV;;OAEG;IACH,GAFU,MAAM,CAEN;IACV;;OAEG;IACH,GAFU,MAAM,CAEN;IAEV;;;OAGG;IACH,oBAFU,OAAO,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,CAAC,CAE9B;IAGjC;;;;OAIG;IACH,qBAHW,MAAM,EAAE,GAAC,YAAY,WACrB,MAAM,QAQhB;IAED;;;;OAIG;IACH,oBAHW,MAAM,EAAE,GAAC,YAAY,WACrB,MAAM,QAMhB;IAED,iBAMC;IAED;;;;;;OAMG;IACH,sCAFa,OAAO,CA6BnB;IAED;;;OAGG;IACH,aAFW,MAAM,QAIhB;IAED;;;;OAIG;IACH,QAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;OAIG;IACH,QA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O;cAMP,OAAO;eAMP,OAAO;iBAMP,OAAO;cAMP,OAAO;kBAYP,MAAM;;mBA1jCG,4BAA4B"}
|
package/src/core/geom/Vector3.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Alex Goldring
|
|
3
|
-
* @copyright Alex Goldring 2015
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
1
|
import { assert } from "../assert.js";
|
|
7
2
|
import Signal from "../events/signal/Signal.js";
|
|
8
3
|
import { EPSILON } from "../math/EPSILON.js";
|
|
@@ -17,6 +12,10 @@ import { v3_length_sqr } from "./vec3/v3_length_sqr.js";
|
|
|
17
12
|
import { v3_lerp } from "./vec3/v3_lerp.js";
|
|
18
13
|
import { v3_slerp } from "./vec3/v3_slerp.js";
|
|
19
14
|
|
|
15
|
+
/**
|
|
16
|
+
* @author Alex Goldring
|
|
17
|
+
* @copyright Alex Goldring 2015-2024
|
|
18
|
+
*/
|
|
20
19
|
class Vector3 {
|
|
21
20
|
/**
|
|
22
21
|
*
|
|
@@ -923,7 +922,7 @@ class Vector3 {
|
|
|
923
922
|
* @deprecated use dedicated method directly instead
|
|
924
923
|
*/
|
|
925
924
|
fromBinaryBufferFloat32_EqualityEncoded(buffer) {
|
|
926
|
-
throw
|
|
925
|
+
throw new Error('deprecated, use v3_binary_equality_decode')
|
|
927
926
|
}
|
|
928
927
|
|
|
929
928
|
hash() {
|
|
@@ -1086,17 +1085,4 @@ Vector3.prototype.isVector3 = true;
|
|
|
1086
1085
|
*/
|
|
1087
1086
|
Vector3.typeName = "Vector3";
|
|
1088
1087
|
|
|
1089
|
-
/**
|
|
1090
|
-
* @deprecated use {@link v3_dot} directly instead
|
|
1091
|
-
* @param {number} x0
|
|
1092
|
-
* @param {number} y0
|
|
1093
|
-
* @param {number} z0
|
|
1094
|
-
* @param {number} x1
|
|
1095
|
-
* @param {number} y1
|
|
1096
|
-
* @param {number} z1
|
|
1097
|
-
* @returns {number}
|
|
1098
|
-
*/
|
|
1099
|
-
Vector3._dot = v3_dot;
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
1088
|
export default Vector3;
|
|
@@ -4,7 +4,7 @@ import { assert } from "../../assert.js";
|
|
|
4
4
|
*
|
|
5
5
|
* @param {number[]|Float32Array|Float64Array} a
|
|
6
6
|
* @param {number[]|Float32Array|Float64Array} b
|
|
7
|
-
* @param {number} d
|
|
7
|
+
* @param {number} d number of dimensions
|
|
8
8
|
* @returns {number}
|
|
9
9
|
*/
|
|
10
10
|
function compute_point_distance(a, b, d) {
|