@woosh/meep-engine 2.94.2 → 2.94.4
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 +91 -64
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +91 -64
- 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/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/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/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/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
|
@@ -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();
|