@woosh/meep-engine 2.94.2 → 2.94.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/bundle-worker-image-decoder.js +1 -1
- package/build/bundle-worker-terrain.js +1 -1
- package/build/meep.cjs +138 -73
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +138 -73
- package/editor/ecs/component/editors/ecs/Trail2DEditor.js +1 -1
- package/package.json +1 -1
- package/src/core/assert.d.ts +6 -0
- package/src/core/assert.d.ts.map +1 -1
- package/src/core/assert.js +13 -0
- package/src/core/binary/BitSet.js +3 -3
- package/src/core/binary/BitSet.spec.js +14 -12
- package/src/core/geom/2d/aabb/AABB2.d.ts.map +1 -1
- package/src/core/geom/2d/aabb/AABB2.js +34 -4
- package/src/core/geom/3d/util/make_justified_point_grid.d.ts +2 -1
- package/src/core/geom/3d/util/make_justified_point_grid.d.ts.map +1 -1
- package/src/core/geom/3d/util/make_justified_point_grid.js +6 -3
- package/src/core/geom/Quaternion.d.ts.map +1 -1
- package/src/core/geom/Quaternion.js +29 -18
- package/src/core/geom/Quaternion.spec.js +27 -1
- package/src/core/geom/vec3/v3_distance_sqr.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_distance_sqr.js +4 -1
- package/src/core/json/resolvePath.d.ts +1 -1
- package/src/core/json/resolvePath.d.ts.map +1 -1
- package/src/core/json/resolvePath.js +5 -1
- package/src/core/math/clamp.js +1 -1
- package/src/core/math/clamp01.d.ts +5 -0
- package/src/core/math/clamp01.d.ts.map +1 -1
- package/src/core/math/clamp01.js +6 -0
- package/src/core/math/iabs.d.ts +9 -0
- package/src/core/math/iabs.d.ts.map +1 -0
- package/src/core/math/iabs.js +15 -0
- package/src/core/math/iabs.spec.d.ts +2 -0
- package/src/core/math/iabs.spec.d.ts.map +1 -0
- package/src/core/math/iabs.spec.js +9 -0
- package/src/engine/EngineConfiguration.d.ts.map +1 -1
- package/src/engine/EngineConfiguration.js +7 -0
- package/src/engine/EngineHarness.d.ts.map +1 -1
- package/src/engine/EngineHarness.js +0 -3
- package/src/engine/animation/AnimationUtils.d.ts.map +1 -1
- package/src/engine/animation/AnimationUtils.js +2 -1
- package/src/engine/ecs/System.d.ts.map +1 -1
- package/src/engine/ecs/System.js +6 -0
- package/src/engine/ecs/transform/Transform.d.ts.map +1 -1
- package/src/engine/ecs/transform/Transform.js +18 -13
- package/src/engine/ecs/transform/Transform.spec.js +50 -11
- package/src/engine/ecs/util/hideEntityGracefully.d.ts.map +1 -1
- package/src/engine/ecs/util/hideEntityGracefully.js +12 -11
- package/src/engine/graphics/ecs/trail2d/Trail2D.d.ts +10 -6
- package/src/engine/graphics/ecs/trail2d/Trail2D.d.ts.map +1 -1
- package/src/engine/graphics/ecs/trail2d/Trail2D.js +61 -13
- package/src/engine/graphics/ecs/trail2d/Trail2DFlags.d.ts +8 -0
- package/src/engine/graphics/ecs/trail2d/Trail2DFlags.d.ts.map +1 -0
- package/src/engine/graphics/ecs/trail2d/Trail2DFlags.js +10 -0
- package/src/engine/graphics/ecs/trail2d/Trail2DSystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/trail2d/Trail2DSystem.js +14 -33
- package/src/engine/graphics/ecs/trail2d/makeGradientTrail.d.ts.map +1 -1
- package/src/engine/graphics/ecs/trail2d/makeGradientTrail.js +2 -1
- package/src/engine/graphics/ecs/trail2d/prototypeTrail2D.d.ts +2 -0
- package/src/engine/graphics/ecs/trail2d/prototypeTrail2D.d.ts.map +1 -0
- package/src/engine/graphics/ecs/trail2d/prototypeTrail2D.js +65 -0
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +1 -1
- package/src/engine/graphics/trail/x/RibbonX.d.ts +2 -2
- package/src/engine/graphics/trail/x/RibbonX.d.ts.map +1 -1
- package/src/engine/graphics/trail/x/RibbonX.js +16 -8
- package/src/engine/graphics/trail/x/simulator/RibbonXFixedPhysicsSimulator.d.ts.map +1 -1
- package/src/engine/graphics/trail/x/simulator/RibbonXFixedPhysicsSimulator.js +2 -1
package/build/meep.cjs
CHANGED
|
@@ -504,6 +504,19 @@ assert.isFunction = function (value, name = 'value') {
|
|
|
504
504
|
}
|
|
505
505
|
};
|
|
506
506
|
|
|
507
|
+
/**
|
|
508
|
+
*
|
|
509
|
+
* @param {Object|*} value
|
|
510
|
+
* @param {string} [name]
|
|
511
|
+
*/
|
|
512
|
+
assert.isObject = function (value, name = 'value') {
|
|
513
|
+
const typeofValue = typeof value;
|
|
514
|
+
|
|
515
|
+
if (typeofValue !== 'object') {
|
|
516
|
+
throw new Error(`expected ${name} to be an object, instead was '${typeofValue}'(=${value})`);
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
|
|
507
520
|
/**
|
|
508
521
|
*
|
|
509
522
|
* @param {number|*} value
|
|
@@ -1709,7 +1722,7 @@ function dispatchViaProxy(handlers, args) {
|
|
|
1709
1722
|
}
|
|
1710
1723
|
|
|
1711
1724
|
/**
|
|
1712
|
-
*
|
|
1725
|
+
* Constrain a value to lie between specified min/max values
|
|
1713
1726
|
* @param {number} value
|
|
1714
1727
|
* @param {number} min
|
|
1715
1728
|
* @param {number} max
|
|
@@ -1725,6 +1738,23 @@ function clamp$1(value, min, max) {
|
|
|
1725
1738
|
}
|
|
1726
1739
|
}
|
|
1727
1740
|
|
|
1741
|
+
/**
|
|
1742
|
+
* Clamps a value to 0..1 range
|
|
1743
|
+
* Same as `clamp(value, 0, 1)`
|
|
1744
|
+
* Works the same as `saturate` function in GLSL
|
|
1745
|
+
* @param {number} value
|
|
1746
|
+
* @returns {number}
|
|
1747
|
+
*/
|
|
1748
|
+
function clamp01(value) {
|
|
1749
|
+
if (value < 0) {
|
|
1750
|
+
return 0;
|
|
1751
|
+
} else if (value > 1) {
|
|
1752
|
+
return 1;
|
|
1753
|
+
} else {
|
|
1754
|
+
return value;
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1728
1758
|
/**
|
|
1729
1759
|
* Very small value, used for comparison when compensation for rounding error is required
|
|
1730
1760
|
* @type {number}
|
|
@@ -1754,16 +1784,6 @@ function lerp$1(a, b, fraction) {
|
|
|
1754
1784
|
return (b - a) * fraction + a;
|
|
1755
1785
|
}
|
|
1756
1786
|
|
|
1757
|
-
/**
|
|
1758
|
-
* Returns lowest value out of 2 supplied
|
|
1759
|
-
* @param {number} a
|
|
1760
|
-
* @param {number} b
|
|
1761
|
-
* @returns {number}
|
|
1762
|
-
*/
|
|
1763
|
-
function min2(a, b) {
|
|
1764
|
-
return a < b ? a : b;
|
|
1765
|
-
}
|
|
1766
|
-
|
|
1767
1787
|
/**
|
|
1768
1788
|
*
|
|
1769
1789
|
* @param {number} v
|
|
@@ -4254,23 +4274,23 @@ let Quaternion$1 = class Quaternion {
|
|
|
4254
4274
|
this.set(x, y, z, w);
|
|
4255
4275
|
}
|
|
4256
4276
|
|
|
4257
|
-
|
|
4258
4277
|
/**
|
|
4259
|
-
*
|
|
4260
|
-
* @param {Quaternion}
|
|
4278
|
+
*
|
|
4279
|
+
* @param {Quaternion} from
|
|
4280
|
+
* @param {Quaternion} to
|
|
4261
4281
|
* @param {number} t
|
|
4262
4282
|
*/
|
|
4263
|
-
|
|
4283
|
+
slerpQuaternions(from, to, t) {
|
|
4264
4284
|
|
|
4265
|
-
const ax =
|
|
4266
|
-
ay =
|
|
4267
|
-
az =
|
|
4268
|
-
aw =
|
|
4285
|
+
const ax = from.x,
|
|
4286
|
+
ay = from.y,
|
|
4287
|
+
az = from.z,
|
|
4288
|
+
aw = from.w;
|
|
4269
4289
|
|
|
4270
|
-
let bx =
|
|
4271
|
-
by =
|
|
4272
|
-
bz =
|
|
4273
|
-
bw =
|
|
4290
|
+
let bx = to.x,
|
|
4291
|
+
by = to.y,
|
|
4292
|
+
bz = to.z,
|
|
4293
|
+
bw = to.w;
|
|
4274
4294
|
|
|
4275
4295
|
let omega, cosom, sinom, scale0, scale1;
|
|
4276
4296
|
|
|
@@ -4308,6 +4328,16 @@ let Quaternion$1 = class Quaternion {
|
|
|
4308
4328
|
this.set(_x, _y, _z, _w);
|
|
4309
4329
|
}
|
|
4310
4330
|
|
|
4331
|
+
|
|
4332
|
+
/**
|
|
4333
|
+
* @see https://github.com/toji/gl-matrix/blob/master/src/gl-matrix/quat.js
|
|
4334
|
+
* @param {Quaternion} other
|
|
4335
|
+
* @param {number} t
|
|
4336
|
+
*/
|
|
4337
|
+
slerp(other, t) {
|
|
4338
|
+
this.slerpQuaternions(this, other, t);
|
|
4339
|
+
}
|
|
4340
|
+
|
|
4311
4341
|
/**
|
|
4312
4342
|
* @see https://github.com/gareth-cross/quat/blob/master/include/quaternion.hpp
|
|
4313
4343
|
* TODO implement
|
|
@@ -4589,9 +4619,9 @@ let Quaternion$1 = class Quaternion {
|
|
|
4589
4619
|
|
|
4590
4620
|
/**
|
|
4591
4621
|
*
|
|
4592
|
-
* @param {number} x
|
|
4593
|
-
* @param {number} y
|
|
4594
|
-
* @param {number} z
|
|
4622
|
+
* @param {number} x in radians
|
|
4623
|
+
* @param {number} y in radians
|
|
4624
|
+
* @param {number} z in radians
|
|
4595
4625
|
* @returns {Quaternion}
|
|
4596
4626
|
*/
|
|
4597
4627
|
static fromEulerAngles(x, y, z) {
|
|
@@ -4618,9 +4648,9 @@ let Quaternion$1 = class Quaternion {
|
|
|
4618
4648
|
result.copy(to);
|
|
4619
4649
|
} else {
|
|
4620
4650
|
// clamp to 1, to make sure we don't overshoot
|
|
4621
|
-
const t =
|
|
4651
|
+
const t = clamp01(max_delta / angle);
|
|
4622
4652
|
|
|
4623
|
-
|
|
4653
|
+
result.slerpQuaternions(from, to, t);
|
|
4624
4654
|
}
|
|
4625
4655
|
|
|
4626
4656
|
}
|
|
@@ -5003,6 +5033,24 @@ class Transform {
|
|
|
5003
5033
|
toString() {
|
|
5004
5034
|
return `{ position: ${this.position}, rotation: ${this.rotation}, scale: ${this.scale} }`;
|
|
5005
5035
|
}
|
|
5036
|
+
|
|
5037
|
+
/**
|
|
5038
|
+
* @deprecated use {@link Quaternion.rotateTowards} instead
|
|
5039
|
+
* @param {Quaternion} sourceQuaternion
|
|
5040
|
+
* @param {Vector3} targetVector
|
|
5041
|
+
* @param {Number} limit
|
|
5042
|
+
*/
|
|
5043
|
+
static adjustRotation(
|
|
5044
|
+
sourceQuaternion,
|
|
5045
|
+
targetVector,
|
|
5046
|
+
limit = Infinity
|
|
5047
|
+
) {
|
|
5048
|
+
const q = new Quaternion$1();
|
|
5049
|
+
|
|
5050
|
+
q.lookRotation(targetVector);
|
|
5051
|
+
|
|
5052
|
+
sourceQuaternion.rotateTowards(q, limit);
|
|
5053
|
+
}
|
|
5006
5054
|
}
|
|
5007
5055
|
|
|
5008
5056
|
/**
|
|
@@ -5015,22 +5063,7 @@ Transform.typeName = "Transform";
|
|
|
5015
5063
|
* @readonly
|
|
5016
5064
|
* @type {boolean}
|
|
5017
5065
|
*/
|
|
5018
|
-
Transform.prototype.isTransform = true;
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
/**
|
|
5022
|
-
* @deprecated use {@link Quaternion.rotateTowards} instead
|
|
5023
|
-
* @param {Quaternion} sourceQuaternion
|
|
5024
|
-
* @param {Vector3} targetVector
|
|
5025
|
-
* @param {Number} limit
|
|
5026
|
-
*/
|
|
5027
|
-
Transform.adjustRotation = function (sourceQuaternion, targetVector, limit = Infinity) {
|
|
5028
|
-
const q = new Quaternion$1();
|
|
5029
|
-
|
|
5030
|
-
q.lookRotation(targetVector);
|
|
5031
|
-
|
|
5032
|
-
sourceQuaternion.rotateTowards(q, limit);
|
|
5033
|
-
};
|
|
5066
|
+
Transform.prototype.isTransform = true;
|
|
5034
5067
|
|
|
5035
5068
|
/**
|
|
5036
5069
|
* Common utilities
|
|
@@ -47277,6 +47310,16 @@ function max2(a, b) {
|
|
|
47277
47310
|
return a < b ? b : a;
|
|
47278
47311
|
}
|
|
47279
47312
|
|
|
47313
|
+
/**
|
|
47314
|
+
* Returns lowest value out of 2 supplied
|
|
47315
|
+
* @param {number} a
|
|
47316
|
+
* @param {number} b
|
|
47317
|
+
* @returns {number}
|
|
47318
|
+
*/
|
|
47319
|
+
function min2(a, b) {
|
|
47320
|
+
return a < b ? a : b;
|
|
47321
|
+
}
|
|
47322
|
+
|
|
47280
47323
|
/**
|
|
47281
47324
|
*
|
|
47282
47325
|
* @param {number} x
|
|
@@ -53302,23 +53345,6 @@ function bvh_query_leaves_ray(
|
|
|
53302
53345
|
return result_cursor - result_offset;
|
|
53303
53346
|
}
|
|
53304
53347
|
|
|
53305
|
-
/**
|
|
53306
|
-
* Clamps a value to 0..1 range
|
|
53307
|
-
* Same as `clamp(value, 0, 1)`
|
|
53308
|
-
* Works the same as `saturate` function in GLSL
|
|
53309
|
-
* @param {number} value
|
|
53310
|
-
* @returns {number}
|
|
53311
|
-
*/
|
|
53312
|
-
function clamp01(value) {
|
|
53313
|
-
if (value < 0) {
|
|
53314
|
-
return 0;
|
|
53315
|
-
} else if (value > 1) {
|
|
53316
|
-
return 1;
|
|
53317
|
-
} else {
|
|
53318
|
-
return value;
|
|
53319
|
-
}
|
|
53320
|
-
}
|
|
53321
|
-
|
|
53322
53348
|
/**
|
|
53323
53349
|
* Returns lowest value out of 3 supplied
|
|
53324
53350
|
* @param {number} a
|
|
@@ -68353,6 +68379,12 @@ class System {
|
|
|
68353
68379
|
|
|
68354
68380
|
}
|
|
68355
68381
|
|
|
68382
|
+
/**
|
|
68383
|
+
* @readonly
|
|
68384
|
+
* @type {boolean}
|
|
68385
|
+
*/
|
|
68386
|
+
System.prototype.isSystem = true;
|
|
68387
|
+
|
|
68356
68388
|
/**
|
|
68357
68389
|
* Fixed update function, every step happens with the same exact time increment
|
|
68358
68390
|
* useful for systems that must have a fixed time step to be predictable and stable, such as physics
|
|
@@ -70088,7 +70120,7 @@ BitSet.prototype.nextSetBit = function (fromIndex) {
|
|
|
70088
70120
|
|
|
70089
70121
|
|
|
70090
70122
|
//scan the rest of the words
|
|
70091
|
-
const word_count = bit_length /
|
|
70123
|
+
const word_count = (bit_length + 31) >> 5; // Math.ceil(x /32)
|
|
70092
70124
|
for (; word_index < word_count; word_index++) {
|
|
70093
70125
|
word = data[word_index];
|
|
70094
70126
|
|
|
@@ -70124,8 +70156,6 @@ BitSet.prototype.nextClearBit = function (fromIndex) {
|
|
|
70124
70156
|
// treat first word specially, as we may need to mask out portion of a word to skip certain number of bits
|
|
70125
70157
|
let bit_index = fromIndex & 31;
|
|
70126
70158
|
|
|
70127
|
-
const set_length = this.__length;
|
|
70128
|
-
const word_count = set_length / 32;
|
|
70129
70159
|
const data = this.__data_uint32;
|
|
70130
70160
|
|
|
70131
70161
|
if (bit_index !== 0) {
|
|
@@ -70145,6 +70175,8 @@ BitSet.prototype.nextClearBit = function (fromIndex) {
|
|
|
70145
70175
|
|
|
70146
70176
|
word_index++;
|
|
70147
70177
|
}
|
|
70178
|
+
const set_length = this.__length;
|
|
70179
|
+
const word_count = (set_length + 31) >> 5; // Math.ceil(x /32)
|
|
70148
70180
|
|
|
70149
70181
|
//scan the rest
|
|
70150
70182
|
for (; word_index < word_count; word_index++) {
|
|
@@ -74283,7 +74315,10 @@ function returnTrue() {
|
|
|
74283
74315
|
* @param {number} z1
|
|
74284
74316
|
* @returns {number}
|
|
74285
74317
|
*/
|
|
74286
|
-
function v3_distance_sqr(
|
|
74318
|
+
function v3_distance_sqr(
|
|
74319
|
+
x0, y0, z0,
|
|
74320
|
+
x1, y1, z1
|
|
74321
|
+
) {
|
|
74287
74322
|
const x = x0 - x1;
|
|
74288
74323
|
const y = y0 - y1;
|
|
74289
74324
|
const z = z0 - z1;
|
|
@@ -79699,10 +79734,24 @@ class AABB2 {
|
|
|
79699
79734
|
* @param {Vector2} result
|
|
79700
79735
|
*/
|
|
79701
79736
|
getCenter(result) {
|
|
79702
|
-
result.set(
|
|
79703
|
-
|
|
79704
|
-
|
|
79705
|
-
|
|
79737
|
+
result.set(this.centerX, this.centerY);
|
|
79738
|
+
}
|
|
79739
|
+
|
|
79740
|
+
/**
|
|
79741
|
+
*
|
|
79742
|
+
* @return {number}
|
|
79743
|
+
*/
|
|
79744
|
+
get centerX() {
|
|
79745
|
+
return (this.x0 + this.x1) * 0.5;
|
|
79746
|
+
}
|
|
79747
|
+
|
|
79748
|
+
/**
|
|
79749
|
+
*
|
|
79750
|
+
* @return {number}
|
|
79751
|
+
*/
|
|
79752
|
+
get centerY() {
|
|
79753
|
+
|
|
79754
|
+
return (this.y0 + this.y1) * 0.5
|
|
79706
79755
|
}
|
|
79707
79756
|
|
|
79708
79757
|
/**
|
|
@@ -79713,6 +79762,14 @@ class AABB2 {
|
|
|
79713
79762
|
return this.x1 - this.x0;
|
|
79714
79763
|
}
|
|
79715
79764
|
|
|
79765
|
+
/**
|
|
79766
|
+
*
|
|
79767
|
+
* @return {number}
|
|
79768
|
+
*/
|
|
79769
|
+
get width() {
|
|
79770
|
+
return this.getWidth();
|
|
79771
|
+
}
|
|
79772
|
+
|
|
79716
79773
|
/**
|
|
79717
79774
|
*
|
|
79718
79775
|
* @returns {number}
|
|
@@ -79721,6 +79778,14 @@ class AABB2 {
|
|
|
79721
79778
|
return this.y1 - this.y0;
|
|
79722
79779
|
}
|
|
79723
79780
|
|
|
79781
|
+
/**
|
|
79782
|
+
*
|
|
79783
|
+
* @return {number}
|
|
79784
|
+
*/
|
|
79785
|
+
get height() {
|
|
79786
|
+
return this.getHeight();
|
|
79787
|
+
}
|
|
79788
|
+
|
|
79724
79789
|
/**
|
|
79725
79790
|
*
|
|
79726
79791
|
* @param {Number} x0
|
|
@@ -103911,6 +103976,7 @@ class EngineConfiguration {
|
|
|
103911
103976
|
* @returns {boolean}
|
|
103912
103977
|
*/
|
|
103913
103978
|
addSystem(system) {
|
|
103979
|
+
|
|
103914
103980
|
this.systems.push(system);
|
|
103915
103981
|
|
|
103916
103982
|
return true;
|
|
@@ -103920,6 +103986,7 @@ class EngineConfiguration {
|
|
|
103920
103986
|
* @param {System} systems
|
|
103921
103987
|
*/
|
|
103922
103988
|
addManySystems(...systems) {
|
|
103989
|
+
|
|
103923
103990
|
systems.forEach(s => this.addSystem(s));
|
|
103924
103991
|
}
|
|
103925
103992
|
|
|
@@ -113613,12 +113680,13 @@ function resolvePathByArray(object, parts, missingPropertyHandler) {
|
|
|
113613
113680
|
/**
|
|
113614
113681
|
*
|
|
113615
113682
|
* @param {object} object
|
|
113616
|
-
* @param {string} path
|
|
113683
|
+
* @param {string} path separated with forward slash "/"
|
|
113617
113684
|
* @param {function} [missingPropertyHandler] Allows custom handling of missing properties
|
|
113618
113685
|
* @returns {*}
|
|
113619
113686
|
* @throws {Error} if a path can not be resolved
|
|
113620
113687
|
*/
|
|
113621
113688
|
function resolvePath(object, path, missingPropertyHandler) {
|
|
113689
|
+
|
|
113622
113690
|
const parts = path.split("/");
|
|
113623
113691
|
|
|
113624
113692
|
return resolvePathByArray(object, parts, missingPropertyHandler);
|
|
@@ -115278,9 +115346,6 @@ class EngineHarness {
|
|
|
115278
115346
|
terrain.splat.resize(1, 1, 1);
|
|
115279
115347
|
terrain.splat.fillLayerWeights(0, 255);
|
|
115280
115348
|
|
|
115281
|
-
terrain.build(engine.assetManager);
|
|
115282
|
-
|
|
115283
|
-
|
|
115284
115349
|
const eb = new Entity();
|
|
115285
115350
|
|
|
115286
115351
|
eb.add(new Transform());
|