@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
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
import { assert } from "../assert.js";
|
|
7
7
|
import Signal from "../events/signal/Signal.js";
|
|
8
8
|
import { clamp } from "../math/clamp.js";
|
|
9
|
+
import { clamp01 } from "../math/clamp01.js";
|
|
9
10
|
import { EPSILON } from "../math/EPSILON.js";
|
|
10
11
|
import { epsilonEquals } from "../math/epsilonEquals.js";
|
|
11
12
|
import { lerp } from "../math/lerp.js";
|
|
12
|
-
import { min2 } from "../math/min2.js";
|
|
13
13
|
import { computeHashFloat } from "../primitives/numbers/computeHashFloat.js";
|
|
14
14
|
import { quat_decode_from_uint32 } from "./3d/quaternion/quat_decode_from_uint32.js";
|
|
15
15
|
import { quat_encode_to_uint32 } from "./3d/quaternion/quat_encode_to_uint32.js";
|
|
@@ -1152,24 +1152,24 @@ class Quaternion {
|
|
|
1152
1152
|
this.set(x, y, z, w);
|
|
1153
1153
|
}
|
|
1154
1154
|
|
|
1155
|
-
|
|
1156
1155
|
/**
|
|
1157
|
-
*
|
|
1158
|
-
* @param {Quaternion}
|
|
1156
|
+
*
|
|
1157
|
+
* @param {Quaternion} from
|
|
1158
|
+
* @param {Quaternion} to
|
|
1159
1159
|
* @param {number} t
|
|
1160
1160
|
*/
|
|
1161
|
-
|
|
1161
|
+
slerpQuaternions(from, to, t) {
|
|
1162
1162
|
assert.isNumber(t, 't');
|
|
1163
1163
|
|
|
1164
|
-
const ax =
|
|
1165
|
-
ay =
|
|
1166
|
-
az =
|
|
1167
|
-
aw =
|
|
1164
|
+
const ax = from.x,
|
|
1165
|
+
ay = from.y,
|
|
1166
|
+
az = from.z,
|
|
1167
|
+
aw = from.w;
|
|
1168
1168
|
|
|
1169
|
-
let bx =
|
|
1170
|
-
by =
|
|
1171
|
-
bz =
|
|
1172
|
-
bw =
|
|
1169
|
+
let bx = to.x,
|
|
1170
|
+
by = to.y,
|
|
1171
|
+
bz = to.z,
|
|
1172
|
+
bw = to.w;
|
|
1173
1173
|
|
|
1174
1174
|
let omega, cosom, sinom, scale0, scale1;
|
|
1175
1175
|
|
|
@@ -1207,6 +1207,16 @@ class Quaternion {
|
|
|
1207
1207
|
this.set(_x, _y, _z, _w);
|
|
1208
1208
|
}
|
|
1209
1209
|
|
|
1210
|
+
|
|
1211
|
+
/**
|
|
1212
|
+
* @see https://github.com/toji/gl-matrix/blob/master/src/gl-matrix/quat.js
|
|
1213
|
+
* @param {Quaternion} other
|
|
1214
|
+
* @param {number} t
|
|
1215
|
+
*/
|
|
1216
|
+
slerp(other, t) {
|
|
1217
|
+
this.slerpQuaternions(this, other, t);
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1210
1220
|
/**
|
|
1211
1221
|
* @see https://github.com/gareth-cross/quat/blob/master/include/quaternion.hpp
|
|
1212
1222
|
* TODO implement
|
|
@@ -1497,9 +1507,9 @@ class Quaternion {
|
|
|
1497
1507
|
|
|
1498
1508
|
/**
|
|
1499
1509
|
*
|
|
1500
|
-
* @param {number} x
|
|
1501
|
-
* @param {number} y
|
|
1502
|
-
* @param {number} z
|
|
1510
|
+
* @param {number} x in radians
|
|
1511
|
+
* @param {number} y in radians
|
|
1512
|
+
* @param {number} z in radians
|
|
1503
1513
|
* @returns {Quaternion}
|
|
1504
1514
|
*/
|
|
1505
1515
|
static fromEulerAngles(x, y, z) {
|
|
@@ -1519,6 +1529,7 @@ class Quaternion {
|
|
|
1519
1529
|
*/
|
|
1520
1530
|
static rotateTowards(result, from, to, max_delta) {
|
|
1521
1531
|
assert.isNumber(max_delta, 'max_delta');
|
|
1532
|
+
assert.notNaN(max_delta, 'max_delta');
|
|
1522
1533
|
|
|
1523
1534
|
const angle = from.angleTo(to);
|
|
1524
1535
|
|
|
@@ -1527,9 +1538,9 @@ class Quaternion {
|
|
|
1527
1538
|
result.copy(to);
|
|
1528
1539
|
} else {
|
|
1529
1540
|
// clamp to 1, to make sure we don't overshoot
|
|
1530
|
-
const t =
|
|
1541
|
+
const t = clamp01(max_delta / angle);
|
|
1531
1542
|
|
|
1532
|
-
|
|
1543
|
+
result.slerpQuaternions(from, to, t);
|
|
1533
1544
|
}
|
|
1534
1545
|
|
|
1535
1546
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { DEG_TO_RAD } from "../math/DEG_TO_RAD.js";
|
|
2
|
+
import { decode_octahedron_to_unit } from "./3d/normal/octahedron/decode_octahedron_to_unit.js";
|
|
1
3
|
import Quaternion from "./Quaternion.js";
|
|
2
4
|
import Vector3 from "./Vector3.js";
|
|
3
|
-
import { decode_octahedron_to_unit } from "./3d/normal/octahedron/decode_octahedron_to_unit.js";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
*
|
|
@@ -401,3 +402,28 @@ test("angleTo between identical quaternions should be 0", () => {
|
|
|
401
402
|
|
|
402
403
|
expect(a.angleTo(b)).toBeCloseTo(0);
|
|
403
404
|
});
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
test("rotateTowards", () => {
|
|
408
|
+
|
|
409
|
+
const a = Quaternion.fromEulerAngles(30 * DEG_TO_RAD, 0, 0);
|
|
410
|
+
const b = Quaternion.fromEulerAngles(60 * DEG_TO_RAD, 0, 0);
|
|
411
|
+
|
|
412
|
+
const result = new Quaternion();
|
|
413
|
+
|
|
414
|
+
Quaternion.rotateTowards(result, a, b, 9 * DEG_TO_RAD);
|
|
415
|
+
|
|
416
|
+
expect(result.angleTo(a)).toBeCloseTo(9 * DEG_TO_RAD);
|
|
417
|
+
|
|
418
|
+
Quaternion.rotateTowards(result, a, b, 0);
|
|
419
|
+
|
|
420
|
+
expect(result.equals(a)).toBe(true);
|
|
421
|
+
|
|
422
|
+
Quaternion.rotateTowards(result, a, b, Infinity);
|
|
423
|
+
|
|
424
|
+
expect(result.equals(b)).toBe(true);
|
|
425
|
+
|
|
426
|
+
Quaternion.rotateTowards(result, a, b, -10);
|
|
427
|
+
|
|
428
|
+
expect(result.roughlyEquals(a)).toBe(true);
|
|
429
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v3_distance_sqr.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_distance_sqr.js"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,oCARW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,
|
|
1
|
+
{"version":3,"file":"v3_distance_sqr.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec3/v3_distance_sqr.js"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,oCARW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CAWlB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
3
|
* @param {object} object
|
|
4
|
-
* @param {string} path
|
|
4
|
+
* @param {string} path separated with forward slash "/"
|
|
5
5
|
* @param {function} [missingPropertyHandler] Allows custom handling of missing properties
|
|
6
6
|
* @returns {*}
|
|
7
7
|
* @throws {Error} if a path can not be resolved
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolvePath.d.ts","sourceRoot":"","sources":["../../../../src/core/json/resolvePath.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolvePath.d.ts","sourceRoot":"","sources":["../../../../src/core/json/resolvePath.js"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,oCANW,MAAM,QACN,MAAM,0CAYhB"}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
import { assert } from "../assert.js";
|
|
1
2
|
import { resolvePathByArray } from "./resolvePathByArray.js";
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
*
|
|
6
7
|
* @param {object} object
|
|
7
|
-
* @param {string} path
|
|
8
|
+
* @param {string} path separated with forward slash "/"
|
|
8
9
|
* @param {function} [missingPropertyHandler] Allows custom handling of missing properties
|
|
9
10
|
* @returns {*}
|
|
10
11
|
* @throws {Error} if a path can not be resolved
|
|
11
12
|
*/
|
|
12
13
|
export function resolvePath(object, path, missingPropertyHandler) {
|
|
14
|
+
assert.isString(path, 'path');
|
|
15
|
+
assert.isObject(object, "object");
|
|
16
|
+
|
|
13
17
|
const parts = path.split("/");
|
|
14
18
|
|
|
15
19
|
return resolvePathByArray(object, parts, missingPropertyHandler);
|
package/src/core/math/clamp.js
CHANGED
|
@@ -6,4 +6,9 @@
|
|
|
6
6
|
* @returns {number}
|
|
7
7
|
*/
|
|
8
8
|
export function clamp01(value: number): number;
|
|
9
|
+
/**
|
|
10
|
+
* Shortcut following GLSL naming, see {@link clamp01}
|
|
11
|
+
* @type {function(number): number}
|
|
12
|
+
*/
|
|
13
|
+
export const saturate: (arg0: number) => number;
|
|
9
14
|
//# sourceMappingURL=clamp01.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clamp01.d.ts","sourceRoot":"","sources":["../../../../src/core/math/clamp01.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,+BAHW,MAAM,GACJ,MAAM,CAUlB"}
|
|
1
|
+
{"version":3,"file":"clamp01.d.ts","sourceRoot":"","sources":["../../../../src/core/math/clamp01.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,+BAHW,MAAM,GACJ,MAAM,CAUlB;AAED;;;GAGG;AACH,8BAFmB,MAAM,KAAG,MAAM,CAEF"}
|
package/src/core/math/clamp01.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Branchless fast integer Absolute value function.
|
|
3
|
+
* Same as Math.abs(x) but for integer values only.
|
|
4
|
+
* Only valid for integers up to and including 32 bit.
|
|
5
|
+
* @param {number} x
|
|
6
|
+
* @return {number}
|
|
7
|
+
*/
|
|
8
|
+
export function iabs(x: number): number;
|
|
9
|
+
//# sourceMappingURL=iabs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iabs.d.ts","sourceRoot":"","sources":["../../../../src/core/math/iabs.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAHW,MAAM,GACL,MAAM,CAOjB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { assert } from "../assert.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Branchless fast integer Absolute value function.
|
|
5
|
+
* Same as Math.abs(x) but for integer values only.
|
|
6
|
+
* Only valid for integers up to and including 32 bit.
|
|
7
|
+
* @param {number} x
|
|
8
|
+
* @return {number}
|
|
9
|
+
*/
|
|
10
|
+
export function iabs(x) {
|
|
11
|
+
// adapted from https://graphics.stanford.edu/~seander/bithacks.html
|
|
12
|
+
assert.isInteger(x, 'x');
|
|
13
|
+
|
|
14
|
+
return (x ^ (x >> 31)) - (x >> 31);
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iabs.spec.d.ts","sourceRoot":"","sources":["../../../../src/core/math/iabs.spec.js"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngineConfiguration.d.ts","sourceRoot":"","sources":["../../../src/engine/EngineConfiguration.js"],"names":[],"mappings":"AAGA;IAEI;;;OAGG;IACH,gBAAa;IAEb;;;OAGG;IACH,gBAAa;IAEb;;;OAGG;IACH,kBAAe;IAEf;;;OAGG;IACH,SAFU,IAAI,MAAM,mBAAkB,CAElB;IAEpB;;;;OAIG;IACH,gBAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;OAIG;IACH,mBAHW,MAAM,mCAWhB;IAED;;;;OAIG;IACH,wBAHW,MAAM,oBAWhB;IAED;;;;OAIG;IACH,wCAFa,OAAO,CAQnB;IAED;;;;OAIG;IACH,2BAFa,OAAO,
|
|
1
|
+
{"version":3,"file":"EngineConfiguration.d.ts","sourceRoot":"","sources":["../../../src/engine/EngineConfiguration.js"],"names":[],"mappings":"AAGA;IAEI;;;OAGG;IACH,gBAAa;IAEb;;;OAGG;IACH,gBAAa;IAEb;;;OAGG;IACH,kBAAe;IAEf;;;OAGG;IACH,SAFU,IAAI,MAAM,mBAAkB,CAElB;IAEpB;;;;OAIG;IACH,gBAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;OAIG;IACH,mBAHW,MAAM,mCAWhB;IAED;;;;OAIG;IACH,wBAHW,MAAM,oBAWhB;IAED;;;;OAIG;IACH,wCAFa,OAAO,CAQnB;IAED;;;;OAIG;IACH,2BAFa,OAAO,CAUnB;IAED;;OAEG;IACH,yCAKC;IAED;;;;OAIG;IACH,yDAFa,OAAO,CAMnB;IAED;;;OAGG;IACH,qCAmDC;CACJ"}
|
|
@@ -85,6 +85,10 @@ export class EngineConfiguration {
|
|
|
85
85
|
* @returns {boolean}
|
|
86
86
|
*/
|
|
87
87
|
addSystem(system) {
|
|
88
|
+
assert.defined(system, 'system');
|
|
89
|
+
assert.notNull(system, 'system');
|
|
90
|
+
assert.equal(system.isSystem, true, "system.isSystem !== true");
|
|
91
|
+
|
|
88
92
|
this.systems.push(system);
|
|
89
93
|
|
|
90
94
|
return true;
|
|
@@ -94,6 +98,9 @@ export class EngineConfiguration {
|
|
|
94
98
|
* @param {System} systems
|
|
95
99
|
*/
|
|
96
100
|
addManySystems(...systems) {
|
|
101
|
+
assert.defined(systems, "systems");
|
|
102
|
+
assert.isArray(systems, "systems");
|
|
103
|
+
|
|
97
104
|
systems.forEach(s => this.addSystem(s));
|
|
98
105
|
}
|
|
99
106
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngineHarness.d.ts","sourceRoot":"","sources":["../../../src/engine/EngineHarness.js"],"names":[],"mappings":"AAsDA;IAmBI;;;OAGG;IACH,6BAFW,MAAM,QAYhB;IAkED;;;;;;;;;;;;;OAaG;IACH;QAZyB,MAAM,EAApB,MAAM;QACyB,GAAG;QAClB,MAAM,GAAtB,OAAO;QACQ,QAAQ,GAAvB,MAAM;QACS,KAAK,GAApB,MAAM;QACS,GAAG,GAAlB,MAAM;QACU,QAAQ,GAAxB,OAAO;QACQ,WAAW,GAA1B,MAAM;QACS,WAAW,GAA1B,MAAM;QACS,WAAW,GAA1B,MAAM;QACJ,MAAM,CA+DlB;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,oQAnBW,MAAM,iBAmFhB;IAGD;;;;;;OAMG;IACH;QALyB,MAAM,EAApB,MAAM;QACyB,GAAG;QACnB,mBAAmB,GAAlC,MAAM;QACU,UAAU,GAA1B,OAAO;sBAqDjB;IAED;;;;;;;OAOG;IACH;QAN0B,YAAY,GAA3B,MAAM;QACQ,MAAM,EAApB,MAAM;QACS,WAAW,GAA1B,MAAM;QACyB,GAAG;QAChC,MAAM,CA2ClB;IAGD;;;;;;;;;;;OAWG;IACH,mGAVW,MAAM,GAQJ,OAAO,
|
|
1
|
+
{"version":3,"file":"EngineHarness.d.ts","sourceRoot":"","sources":["../../../src/engine/EngineHarness.js"],"names":[],"mappings":"AAsDA;IAmBI;;;OAGG;IACH,6BAFW,MAAM,QAYhB;IAkED;;;;;;;;;;;;;OAaG;IACH;QAZyB,MAAM,EAApB,MAAM;QACyB,GAAG;QAClB,MAAM,GAAtB,OAAO;QACQ,QAAQ,GAAvB,MAAM;QACS,KAAK,GAApB,MAAM;QACS,GAAG,GAAlB,MAAM;QACU,QAAQ,GAAxB,OAAO;QACQ,WAAW,GAA1B,MAAM;QACS,WAAW,GAA1B,MAAM;QACS,WAAW,GAA1B,MAAM;QACJ,MAAM,CA+DlB;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,oQAnBW,MAAM,iBAmFhB;IAGD;;;;;;OAMG;IACH;QALyB,MAAM,EAApB,MAAM;QACyB,GAAG;QACnB,mBAAmB,GAAlC,MAAM;QACU,UAAU,GAA1B,OAAO;sBAqDjB;IAED;;;;;;;OAOG;IACH;QAN0B,YAAY,GAA3B,MAAM;QACQ,MAAM,EAApB,MAAM;QACS,WAAW,GAA1B,MAAM;QACyB,GAAG;QAChC,MAAM,CA2ClB;IAGD;;;;;;;;;;;OAWG;IACH,mGAVW,MAAM,GAQJ,OAAO,CAuDnB;IAvbG;;;OAGG;IACH,QAFU,MAAM,CAEiC;IAMjD;;;OAGG;IACH,YAFU,eAAQ,IAAI,CAET;IAmBjB;;;;OAIG;IACH,8DAJmB,mBAAmB,UAAQ,MAAM,WAEvC,QAAQ,MAAM,CAAC,CA2D3B;CAyVJ;;IAID;;;OAGG;IACH,uCAMC;;mBAhfkB,aAAa;oCACI,0BAA0B;oBAX1C,yBAAyB;mBAK1B,iBAAiB;oBAEhB,8BAA8B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimationUtils.d.ts","sourceRoot":"","sources":["../../../../src/engine/animation/AnimationUtils.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AnimationUtils.d.ts","sourceRoot":"","sources":["../../../../src/engine/animation/AnimationUtils.js"],"names":[],"mappings":"AAsBA;;;;;GAKG;AACH,uDAJW,MAAM,6CA2BhB;AAED;;;;;GAKG;AACH,yDAJW,MAAM,6CA6DhB;AAGD;;;;;GAKG;AACH,gDAJW,MAAM,6CAmChB;AAED;;;;;;;;GAQG;AACH;;;;;;iBAoFC"}
|
|
@@ -6,7 +6,8 @@ import { Transform } from "../ecs/transform/Transform.js";
|
|
|
6
6
|
import { removeComponentsExcept } from "../ecs/util/removeComponentsExcept.js";
|
|
7
7
|
import { createSound, createTimer } from "../EntityCreator.js";
|
|
8
8
|
import Mesh from "../graphics/ecs/mesh/Mesh.js";
|
|
9
|
-
import Trail2D
|
|
9
|
+
import Trail2D from "../graphics/ecs/trail2d/Trail2D.js";
|
|
10
|
+
import { Trail2DFlags } from "../graphics/ecs/trail2d/Trail2DFlags.js";
|
|
10
11
|
import { ParticleEmitter } from "../graphics/particles/particular/engine/emitter/ParticleEmitter.js";
|
|
11
12
|
import { ParticleEmitterFlag } from "../graphics/particles/particular/engine/emitter/ParticleEmitterFlag.js";
|
|
12
13
|
import { SequenceBehavior } from "../intelligence/behavior/composite/SequenceBehavior.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"System.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/System.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"System.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/System.js"],"names":[],"mappings":"0BAiKU,MAAM;;;;;;;;AAtJhB;;;GAGG;AACH;IAEI;;;OAGG;IACH,uCAAqB;IAErB;;;OAGG;IACH,gBAFU,cAAe,WAAW,CAAC,CAEU;IAE/C;;;OAGG;IACH,oBAAkB;IAElB;;;;;;;;OAQG;IACH,iBAFU,6BAA6B,CAElB;IAGrB;;OAEG;IACH,mCAcC;IAED;;;;OAIG;IACH,oCAFY,MAAM,CA8BjB;IAED,0EAGC;IAED,2EAEC;IAED,wCAEC;IAED,0CAEC;IAIL;;;OAGG;IACH,mBAFU,OAAO,CAEQ;IAEzB;;;;OAIG;IACH,yBAA4B;IAG5B;;;OAGG;IACH,oBAAuB;CApBtB;;;;AA2DD;;;;GAIG;AACH,wDAFa,MAAM,CAKlB;0BAjLyB,mCAAmC;qBADxC,6BAA6B"}
|
package/src/engine/ecs/System.js
CHANGED
|
@@ -118,6 +118,12 @@ class System {
|
|
|
118
118
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
/**
|
|
122
|
+
* @readonly
|
|
123
|
+
* @type {boolean}
|
|
124
|
+
*/
|
|
125
|
+
System.prototype.isSystem = true;
|
|
126
|
+
|
|
121
127
|
/**
|
|
122
128
|
* Fixed update function, every step happens with the same exact time increment
|
|
123
129
|
* useful for systems that must have a fixed time step to be predictable and stable, such as physics
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transform.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/transform/Transform.js"],"names":[],"mappings":"AA0BA;;;GAGG;AACH;IAwQI;;;;OAIG;IACH,4BAFa,SAAS,CAQrB;
|
|
1
|
+
{"version":3,"file":"Transform.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/transform/Transform.js"],"names":[],"mappings":"AA0BA;;;GAGG;AACH;IAwQI;;;;OAIG;IACH,4BAFa,SAAS,CAQrB;IAqDD;;;;;OAKG;IACH,wCAJW,UAAU,gBACV,OAAO,wBAajB;IAtVD;;;OAGG;IACH,mBAHU,OAAO,CAGe;IAEhC;;;OAGG;IACH,mBAHU,UAAU,CAGkB;IAEtC;;;OAGG;IACH,gBAHU,OAAO,CAGY;IAE7B;;;;OAIG;IACH,iBAFU,YAAY,CAEW;IAEjC;;;;OAIG;IACH,OAFU,MAAM,CAEM;IAOtB;;;;OAIG;IACH,uBAMC;IAED;;;OAGG;IACH,kBAMC;IAED;;;OAGG;IACH,qBAMC;IAED;;;;OAIG;IACH,kDAIC;IAED;;;;OAIG;IACH,oDAIC;IAYD;;;;OAIG;IACH,cAHW,MAAM,GAAC,cAAc,GACnB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,cAAc,GACnB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,cAAc,SACrB,OAAO,QAQjB;IAED;;;;OAIG;IACH,cAHW,MAAM,GAAC,cAAc,GACnB,OAAO,CAInB;IAED;;OAEG;IACH,qBAEC;IAED;;;;OAIG;IACH,eAHW,OAAO,OACP,OAAO,QAmBjB;IAED,0BAwBC;IAED;;;;MAMC;IAED;;;OAGG;IACH,YAFW,SAAS,QAenB;IAED;;;OAGG;IACH,SAFa,SAAS,CAQrB;IAED;;;;OAIG;IACH,cAHW,SAAS,GACP,OAAO,CAMnB;IAED;;;OAGG;IACH,QAFa,MAAM,CAKlB;IAeD;;;;OAIG;IACH,sBAHW,SAAS,KACT,SAAS,QAMnB;IAED;;;OAGG;IACH,eAFW,OAAK,MAAM,EAAE,GAAC,YAAY,QAcpC;IAED;;;OAGG;IACH,kBAFW,MAAM,EAAE,GAAC,YAAY,QAI/B;IAED;;;;;OAKG;IACH,qBAEC;IAED,mBAEC;IA2BL;;;OAGG;IACH,sBAFU,OAAO,CAEc;;CAZ9B;;kBAIS,MAAM;;oBAhXI,+BAA+B;uBAD5B,kCAAkC;+BAE1B,qBAAqB"}
|
|
@@ -355,6 +355,24 @@ export class Transform {
|
|
|
355
355
|
toString() {
|
|
356
356
|
return `{ position: ${this.position}, rotation: ${this.rotation}, scale: ${this.scale} }`;
|
|
357
357
|
}
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* @deprecated use {@link Quaternion.rotateTowards} instead
|
|
361
|
+
* @param {Quaternion} sourceQuaternion
|
|
362
|
+
* @param {Vector3} targetVector
|
|
363
|
+
* @param {Number} limit
|
|
364
|
+
*/
|
|
365
|
+
static adjustRotation(
|
|
366
|
+
sourceQuaternion,
|
|
367
|
+
targetVector,
|
|
368
|
+
limit = Infinity
|
|
369
|
+
) {
|
|
370
|
+
const q = new Quaternion();
|
|
371
|
+
|
|
372
|
+
q.lookRotation(targetVector);
|
|
373
|
+
|
|
374
|
+
sourceQuaternion.rotateTowards(q, limit);
|
|
375
|
+
}
|
|
358
376
|
}
|
|
359
377
|
|
|
360
378
|
/**
|
|
@@ -370,17 +388,4 @@ Transform.typeName = "Transform";
|
|
|
370
388
|
Transform.prototype.isTransform = true;
|
|
371
389
|
|
|
372
390
|
|
|
373
|
-
/**
|
|
374
|
-
* @deprecated use {@link Quaternion.rotateTowards} instead
|
|
375
|
-
* @param {Quaternion} sourceQuaternion
|
|
376
|
-
* @param {Vector3} targetVector
|
|
377
|
-
* @param {Number} limit
|
|
378
|
-
*/
|
|
379
|
-
Transform.adjustRotation = function (sourceQuaternion, targetVector, limit = Infinity) {
|
|
380
|
-
const q = new Quaternion();
|
|
381
|
-
|
|
382
|
-
q.lookRotation(targetVector);
|
|
383
|
-
|
|
384
|
-
sourceQuaternion.rotateTowards(q, limit);
|
|
385
|
-
};
|
|
386
391
|
|
|
@@ -1,9 +1,24 @@
|
|
|
1
|
+
import { jest } from "@jest/globals";
|
|
1
2
|
import { MATRIX_4_IDENTITY } from "../../../core/geom/3d/mat4/MATRIX_4_IDENTITY.js";
|
|
2
3
|
import Quaternion from "../../../core/geom/Quaternion.js";
|
|
3
4
|
import Vector3 from "../../../core/geom/Vector3.js";
|
|
4
5
|
import { Transform } from "./Transform.js";
|
|
5
6
|
import { TransformFlags } from "./TransformFlags.js";
|
|
6
7
|
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @return {Transform}
|
|
11
|
+
*/
|
|
12
|
+
function sample_a() {
|
|
13
|
+
const a = new Transform();
|
|
14
|
+
|
|
15
|
+
a.position.set(1, 2, 3);
|
|
16
|
+
a.rotation.set(5, -7, 11, -13);
|
|
17
|
+
a.scale.set(17, -23, 29);
|
|
18
|
+
|
|
19
|
+
return a;
|
|
20
|
+
}
|
|
21
|
+
|
|
7
22
|
test("constructor does not throw", () => {
|
|
8
23
|
|
|
9
24
|
expect(() => new Transform()).not.toThrow();
|
|
@@ -46,19 +61,43 @@ test("position changes propagate to matrix", () => {
|
|
|
46
61
|
expect(t.matrix[14]).toBe(-7);
|
|
47
62
|
});
|
|
48
63
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
* @return {Transform}
|
|
52
|
-
*/
|
|
53
|
-
function sample_a() {
|
|
54
|
-
const a = new Transform();
|
|
64
|
+
test("subscribe/unsubscribe", () => {
|
|
65
|
+
const mock = jest.fn();
|
|
55
66
|
|
|
56
|
-
|
|
57
|
-
a.rotation.set(5, -7, 11, -13);
|
|
58
|
-
a.scale.set(17, -23, 29);
|
|
67
|
+
const t = sample_a();
|
|
59
68
|
|
|
60
|
-
|
|
61
|
-
|
|
69
|
+
t.subscribe(mock);
|
|
70
|
+
|
|
71
|
+
expect(mock).not.toHaveBeenCalled();
|
|
72
|
+
|
|
73
|
+
t.position._add(1, 0, 0);
|
|
74
|
+
|
|
75
|
+
expect(mock).toHaveBeenCalledTimes(1);
|
|
76
|
+
|
|
77
|
+
t.scale._add(0, 1, 0);
|
|
78
|
+
|
|
79
|
+
expect(mock).toHaveBeenCalledTimes(2);
|
|
80
|
+
|
|
81
|
+
t.rotation.set(-1, 3, -5, -t.rotation.w);
|
|
82
|
+
|
|
83
|
+
expect(mock).toHaveBeenCalledTimes(3);
|
|
84
|
+
|
|
85
|
+
t.unsubscribe(mock);
|
|
86
|
+
|
|
87
|
+
expect(mock).toHaveBeenCalledTimes(3);
|
|
88
|
+
|
|
89
|
+
t.position._add(1, 0, 0);
|
|
90
|
+
|
|
91
|
+
expect(mock).toHaveBeenCalledTimes(3);
|
|
92
|
+
|
|
93
|
+
t.scale._add(0, 1, 0);
|
|
94
|
+
|
|
95
|
+
expect(mock).toHaveBeenCalledTimes(3);
|
|
96
|
+
|
|
97
|
+
t.rotation.set(-1, 3, -5, -t.rotation.w);
|
|
98
|
+
|
|
99
|
+
expect(mock).toHaveBeenCalledTimes(3);
|
|
100
|
+
});
|
|
62
101
|
|
|
63
102
|
test("to/fromJSON consistency", () => {
|
|
64
103
|
const a = sample_a();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hideEntityGracefully.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/util/hideEntityGracefully.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hideEntityGracefully.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/util/hideEntityGracefully.js"],"names":[],"mappings":"AAkKA;;;;;;GAMG;AACH,8GAFY,MAAM,CAmCjB"}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TransitionPropertyVectorXBehavior
|
|
3
|
+
} from "../../../../../model/game/story/behaviors/generic/TransitionPropertyVectorXBehavior.js";
|
|
4
|
+
import { TweenVector1Behavior } from "../../../../../model/game/util/behavior/TweenVector1Behavior.js";
|
|
5
|
+
import { TweenVector3Behavior } from "../../../../../model/game/util/behavior/TweenVector3Behavior.js";
|
|
1
6
|
import { max2 } from "../../../core/math/max2.js";
|
|
2
7
|
import { min2 } from "../../../core/math/min2.js";
|
|
8
|
+
import { Light } from "../../graphics/ecs/light/Light.js";
|
|
9
|
+
import Mesh, { MeshFlags } from "../../graphics/ecs/mesh/Mesh.js";
|
|
10
|
+
import Trail2D from "../../graphics/ecs/trail2d/Trail2D.js";
|
|
11
|
+
import { Trail2DFlags } from "../../graphics/ecs/trail2d/Trail2DFlags.js";
|
|
3
12
|
import { ParticleEmitter } from "../../graphics/particles/particular/engine/emitter/ParticleEmitter.js";
|
|
4
13
|
import { ParticleEmitterFlag } from "../../graphics/particles/particular/engine/emitter/ParticleEmitterFlag.js";
|
|
5
|
-
import Trail2D, { Trail2DFlags } from "../../graphics/ecs/trail2d/Trail2D.js";
|
|
6
|
-
import { Transform } from "../transform/Transform.js";
|
|
7
|
-
import Mesh, { MeshFlags } from "../../graphics/ecs/mesh/Mesh.js";
|
|
8
|
-
import { TweenVector3Behavior } from "../../../../../model/game/util/behavior/TweenVector3Behavior.js";
|
|
9
|
-
import { BehaviorComponent } from "../../intelligence/behavior/ecs/BehaviorComponent.js";
|
|
10
14
|
import { SequenceBehavior } from "../../intelligence/behavior/composite/SequenceBehavior.js";
|
|
15
|
+
import { BehaviorComponent } from "../../intelligence/behavior/ecs/BehaviorComponent.js";
|
|
11
16
|
import { DieBehavior } from "../../intelligence/behavior/ecs/DieBehavior.js";
|
|
12
|
-
import { SoundEmitter } from "../../sound/ecs/emitter/SoundEmitter.js";
|
|
13
|
-
import { TweenVector1Behavior } from "../../../../../model/game/util/behavior/TweenVector1Behavior.js";
|
|
14
17
|
import { DelayBehavior } from "../../intelligence/behavior/util/DelayBehavior.js";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
TransitionPropertyVectorXBehavior
|
|
18
|
-
} from "../../../../../model/game/story/behaviors/generic/TransitionPropertyVectorXBehavior.js";
|
|
18
|
+
import { SoundEmitter } from "../../sound/ecs/emitter/SoundEmitter.js";
|
|
19
|
+
import { Transform } from "../transform/Transform.js";
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* @readonly
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
export type Trail2DFlags = number;
|
|
2
|
-
export namespace Trail2DFlags {
|
|
3
|
-
let Spawning: number;
|
|
4
|
-
let Aging: number;
|
|
5
|
-
let Built: number;
|
|
6
|
-
}
|
|
7
1
|
export default Trail2D;
|
|
8
2
|
declare class Trail2D {
|
|
9
3
|
static fromJSON(json: any): Trail2D;
|
|
@@ -120,6 +114,15 @@ declare class Trail2D {
|
|
|
120
114
|
* @param {Trail2D} other
|
|
121
115
|
*/
|
|
122
116
|
equals(other: Trail2D): boolean;
|
|
117
|
+
/**
|
|
118
|
+
*
|
|
119
|
+
* @param {number} x
|
|
120
|
+
* @param {number} y
|
|
121
|
+
* @param {number} z
|
|
122
|
+
* @param {number} head_age
|
|
123
|
+
* @returns {boolean}
|
|
124
|
+
*/
|
|
125
|
+
updateHead(x: number, y: number, z: number, head_age: number): boolean;
|
|
123
126
|
}
|
|
124
127
|
declare namespace Trail2D {
|
|
125
128
|
export let typeName: string;
|
|
@@ -131,5 +134,6 @@ import Vector3 from "../../../../core/geom/Vector3.js";
|
|
|
131
134
|
import { RibbonX } from "../../trail/x/RibbonX.js";
|
|
132
135
|
import { RibbonXMaterialSpec } from "../../trail/x/RibbonXMaterialSpec.js";
|
|
133
136
|
import { BvhClient } from "../../../../core/bvh2/bvh3/BvhClient.js";
|
|
137
|
+
import { Trail2DFlags } from "./Trail2DFlags.js";
|
|
134
138
|
import { makeGradientTrail } from "./makeGradientTrail.js";
|
|
135
139
|
//# sourceMappingURL=Trail2D.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Trail2D.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/trail2d/Trail2D.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Trail2D.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/trail2d/Trail2D.js"],"names":[],"mappings":";AAwBA;IAkJI,oCAMC;IAtJD;;;OAGG;IACH,QAFU,MAAM,CAES;IAEzB;;;OAGG;IACH,OAFU,MAAM,CAEM;IAEtB;;;OAGG;IACH,MAFU,MAAM,CAEP;IAET;;;OAGG;IACH,eAFU,MAAM,CAEE;IAElB;;;OAGG;IACH,qBAFU,MAAM,CAEQ;IAExB;;;OAGG;IACH,gBAFU,OAAO,CAEe;IAEhC;;;;OAIG;IACH,iBAFU,OAAO,CAEM;IAEvB;;;OAGG;IACH,QAFU,OAAO,GAAC,IAAI,CAER;IAEd;;;OAGG;IACH,UAFU,mBAAmB,CAEQ;IAErC;;;OAGG;IACH,cAFU,SAAS,CAEG;IAEtB;;;OAGG;IACH,cAAsB;IAEtB,gBAQC;IAMD,4BAEC;IAND,yBAEC;IAMD;;;;OAIG;IACH,cAHW,MAAM,GAAC,YAAY,GACjB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,YAAY,GACjB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,YAAY,SACnB,OAAO,QAQjB;IAED;;;;OAIG;IACH,cAHW,MAAM,GAAC,YAAY,GACjB,OAAO,CAInB;IAED;;;OAGG;IACH,qBAFW,MAAM,QAehB;IADG,kHAAgB;IAWpB;;;;;;;;;;;aAcC;IAGD;;;;;;MAQC;IAED;;;OAGG;IACH,cAFW,OAAO,WASjB;IAED;;;;;;;OAOG;IACH,cANW,MAAM,KACN,MAAM,KACN,MAAM,YACN,MAAM,GACJ,OAAO,CA0CnB;CAEJ;;;;;;oBArQmB,kCAAkC;oBADlC,kCAAkC;wBAK9B,0BAA0B;oCACd,sCAAsC;0BAPhD,yCAAyC;6BAStC,mBAAmB;kCADd,wBAAwB"}
|