@woosh/meep-engine 2.110.7 → 2.110.9
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-terrain.js +1 -1
- package/build/meep.cjs +115 -119
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +115 -119
- package/editor/tools/v2/TransformControls.js +11 -6
- package/package.json +2 -1
- package/src/core/UUID.d.ts +3 -0
- package/src/core/UUID.d.ts.map +1 -1
- package/src/core/UUID.js +9 -7
- package/src/core/collection/array/arraySetDiff.d.ts.map +1 -1
- package/src/core/collection/array/arraySetDiff.js +0 -1
- package/src/core/collection/array/binarySearchHighIndex.d.ts.map +1 -1
- package/src/core/collection/array/binarySearchHighIndex.js +7 -1
- package/src/core/collection/array/computeHashArray.d.ts.map +1 -1
- package/src/core/collection/array/computeHashArray.js +3 -2
- package/src/core/collection/array/fastArrayEquals.d.ts +1 -0
- package/src/core/collection/array/fastArrayEquals.d.ts.map +1 -1
- package/src/core/collection/array/fastArrayEquals.js +1 -0
- package/src/core/collection/array/isArrayEqual.d.ts.map +1 -1
- package/src/core/collection/array/isArrayEqual.js +9 -12
- package/src/core/collection/array/isArrayEqual.spec.d.ts +2 -0
- package/src/core/collection/array/isArrayEqual.spec.d.ts.map +1 -0
- package/src/core/collection/array/isArrayEqual.spec.js +25 -0
- package/src/core/collection/array/typed/is_typed_array_equals.d.ts.map +1 -1
- package/src/core/collection/array/typed/is_typed_array_equals.js +1 -0
- package/src/core/function/makeSequenceLoop.d.ts.map +1 -0
- package/src/core/geom/3d/shape/AbstractShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/AbstractShape3D.js +14 -0
- package/src/core/geom/3d/shape/PointShape3D.d.ts +9 -0
- package/src/core/geom/3d/shape/PointShape3D.d.ts.map +1 -0
- package/src/core/geom/3d/shape/PointShape3D.js +14 -0
- package/src/core/geom/3d/shape/TransformedShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/TransformedShape3D.js +26 -8
- package/src/core/geom/3d/shape/UnionShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/UnionShape3D.js +33 -4
- package/src/core/geom/3d/shape/UnitCubeShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/UnitCubeShape3D.js +13 -6
- package/src/core/geom/3d/shape/UnitSphereShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/UnitSphereShape3D.js +10 -0
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.d.ts +15 -8
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.js +33 -9
- package/src/core/geom/3d/tetrahedra/delaunay/compute_delaunay_tetrahedral_mesh.d.ts +1 -1
- package/src/core/geom/3d/tetrahedra/delaunay/compute_delaunay_tetrahedral_mesh.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/delaunay/compute_delaunay_tetrahedral_mesh.js +7 -7
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.spec.d.ts +2 -0
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.spec.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.spec.js +38 -0
- package/src/core/geom/3d/tetrahedra/prototypeTetrahedraBuilder.js +42 -39
- package/src/core/geom/3d/v3_compute_triangle_normal.js +1 -1
- package/src/core/geom/3d/v3_negate_array.d.ts +9 -0
- package/src/core/geom/3d/v3_negate_array.d.ts.map +1 -0
- package/src/core/geom/3d/v3_negate_array.js +16 -0
- package/src/core/geom/Quaternion.d.ts.map +1 -1
- package/src/core/geom/Quaternion.js +30 -77
- package/src/core/geom/Vector3.d.ts +4 -0
- package/src/core/geom/Vector3.js +4 -4
- package/src/core/geom/vec3/v3_cross_array.d.ts +11 -0
- package/src/core/geom/vec3/v3_cross_array.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_cross_array.js +31 -0
- package/src/core/geom/vec3/v3_displace_in_direction.js +3 -2
- package/src/core/geom/vec3/v3_displace_in_direction_array.d.ts +12 -0
- package/src/core/geom/vec3/v3_displace_in_direction_array.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_displace_in_direction_array.js +22 -0
- package/src/core/geom/vec3/v3_dot_array_array.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_dot_array_array.js +4 -1
- package/src/core/geom/vec3/v3_normalize_array.d.ts +3 -3
- package/src/core/geom/vec3/v3_normalize_array.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_normalize_array.js +3 -3
- package/src/core/math/copysign.d.ts +1 -1
- package/src/core/math/copysign.js +1 -1
- package/src/core/math/epsilonEquals.d.ts.map +1 -1
- package/src/core/math/epsilonEquals.js +3 -2
- package/src/core/math/linalg/README.md +1 -1
- package/src/core/math/random/randomGaussian.spec.js +1 -1
- package/src/core/math/spline/spline_hermite3.d.ts +1 -1
- package/src/core/math/spline/spline_hermite3.js +1 -1
- package/src/core/process/delay.d.ts +6 -1
- package/src/core/process/delay.d.ts.map +1 -1
- package/src/core/process/delay.js +6 -1
- package/src/core/process/undo/Mark.d.ts +5 -5
- package/src/core/process/undo/Mark.d.ts.map +1 -1
- package/src/core/process/undo/Mark.js +6 -5
- package/src/core/process/worker/WorkerBuilder.d.ts +13 -2
- package/src/core/process/worker/WorkerBuilder.d.ts.map +1 -1
- package/src/core/process/worker/WorkerBuilder.js +9 -1
- package/src/core/process/worker/WorkerProxy.d.ts +16 -6
- package/src/core/process/worker/WorkerProxy.d.ts.map +1 -1
- package/src/core/process/worker/WorkerProxy.js +24 -5
- package/src/core/process/worker/extractTransferables.d.ts.map +1 -1
- package/src/core/process/worker/extractTransferables.js +3 -1
- package/src/engine/EngineHarness.d.ts +7 -1
- package/src/engine/EngineHarness.d.ts.map +1 -1
- package/src/engine/EngineHarness.js +12 -1
- package/src/engine/animation/clip/AnimationTrack.d.ts.map +1 -1
- package/src/engine/animation/clip/AnimationTrack.js +3 -0
- package/src/engine/animation/clip/bind_property_writer.d.ts +2 -2
- package/src/engine/animation/clip/bind_property_writer.d.ts.map +1 -1
- package/src/engine/animation/clip/bind_property_writer.js +22 -13
- package/src/engine/animation/clip/curve_from_track_data.d.ts.map +1 -1
- package/src/engine/animation/clip/curve_from_track_data.js +9 -1
- package/src/engine/animation/clip/ecd_bind_animation_curve.d.ts.map +1 -1
- package/src/engine/animation/clip/ecd_bind_animation_curve.js +6 -5
- package/src/engine/animation/curve/AnimationCurve.d.ts +21 -0
- package/src/engine/animation/curve/AnimationCurve.d.ts.map +1 -1
- package/src/engine/animation/curve/AnimationCurve.js +43 -15
- package/src/engine/animation/curve/AnimationCurve.spec.js +67 -0
- package/src/engine/animation/curve/Keyframe.d.ts +24 -3
- package/src/engine/animation/curve/Keyframe.d.ts.map +1 -1
- package/src/engine/animation/curve/Keyframe.js +49 -3
- package/src/engine/animation/curve/Keyframe.spec.js +11 -0
- package/src/engine/animation/curve/animation_curve_compute_aabb.d.ts +7 -0
- package/src/engine/animation/curve/animation_curve_compute_aabb.d.ts.map +1 -0
- package/src/engine/animation/curve/{compute_curve_aabb.js → animation_curve_compute_aabb.js} +1 -1
- package/src/engine/animation/curve/animation_curve_optimize.d.ts +8 -0
- package/src/engine/animation/curve/animation_curve_optimize.d.ts.map +1 -0
- package/src/engine/animation/curve/animation_curve_optimize.js +89 -0
- package/src/engine/animation/curve/animation_curve_optimize.spec.d.ts +2 -0
- package/src/engine/animation/curve/animation_curve_optimize.spec.d.ts.map +1 -0
- package/src/engine/animation/curve/animation_curve_optimize.spec.js +50 -0
- package/src/engine/animation/curve/draw/build_curve_editor.js +2 -2
- package/src/engine/animation/curve/evaluate_two_key_curve.d.ts +9 -0
- package/src/engine/animation/curve/evaluate_two_key_curve.d.ts.map +1 -0
- package/src/engine/animation/curve/evaluate_two_key_curve.js +23 -0
- package/src/engine/animation/curve/prototypeGLTF.js +14 -14
- package/src/engine/asset/loaders/material/computeTextureEquality.d.ts.map +1 -1
- package/src/engine/asset/loaders/material/computeTextureEquality.js +4 -6
- package/src/engine/asset/loaders/material/computeTextureHash.d.ts.map +1 -1
- package/src/engine/asset/loaders/material/computeTextureHash.js +6 -6
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescription.d.ts +6 -1
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescription.d.ts.map +1 -1
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescription.js +11 -6
- package/src/engine/ecs/guid/GUIDSerializationAdapter.spec.js +5 -5
- package/src/engine/ecs/guid/{GUID.d.ts → UUID.d.ts} +17 -12
- package/src/engine/ecs/guid/UUID.d.ts.map +1 -0
- package/src/engine/ecs/guid/{GUID.js → UUID.js} +35 -12
- package/src/engine/ecs/guid/UUID.spec.d.ts +2 -0
- package/src/engine/ecs/guid/UUID.spec.d.ts.map +1 -0
- package/src/engine/ecs/guid/{GUID.spec.js → UUID.spec.js} +18 -12
- package/src/engine/ecs/guid/UUIDSerializationAdapter.d.ts +18 -0
- package/src/engine/ecs/guid/UUIDSerializationAdapter.d.ts.map +1 -0
- package/src/engine/ecs/guid/{GUIDSerializationAdapter.js → UUIDSerializationAdapter.js} +5 -5
- package/src/engine/ecs/ik/InverseKinematics.js +3 -3
- package/src/engine/ecs/ik/TwoBoneInverseKinematicsSolver.d.ts.map +1 -1
- package/src/engine/ecs/ik/TwoBoneInverseKinematicsSolver.js +1 -140
- package/src/engine/graphics/ecs/trail2d/Trail2DSystem.js +1 -1
- package/src/engine/graphics/material/manager/MaterialManager.d.ts.map +1 -1
- package/src/engine/graphics/texture/isImageBitmap.d.ts +7 -0
- package/src/engine/graphics/texture/isImageBitmap.d.ts.map +1 -0
- package/src/engine/graphics/texture/isImageBitmap.js +12 -0
- package/src/engine/graphics/trail/x/RibbonXPlugin.d.ts.map +1 -1
- package/src/engine/graphics/trail/x/RibbonXPlugin.js +9 -1
- package/src/engine/input/ecs/systems/InputControllerSystem.js +1 -1
- package/src/engine/intelligence/blackboard/BlackboardDynamicStorageAdapter.d.ts +1 -1
- package/src/engine/intelligence/blackboard/BlackboardDynamicStorageAdapter.js +4 -4
- package/src/engine/physics/gjk/expanding_polytope_algorithm.d.ts +13 -0
- package/src/engine/physics/gjk/expanding_polytope_algorithm.d.ts.map +1 -0
- package/src/engine/physics/gjk/expanding_polytope_algorithm.js +395 -0
- package/src/engine/physics/gjk/expanding_polytope_algorithm.spec.d.ts +2 -0
- package/src/engine/physics/gjk/expanding_polytope_algorithm.spec.d.ts.map +1 -0
- package/src/engine/physics/gjk/expanding_polytope_algorithm.spec.js +46 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik3d_solve_primitive.d.ts +18 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik3d_solve_primitive.d.ts.map +1 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik3d_solve_primitive.js +277 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik3d_solve_primitive.spec.d.ts +2 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik3d_solve_primitive.spec.d.ts.map +1 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik3d_solve_primitive.spec.js +43 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik_solve.d.ts +12 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik_solve.d.ts.map +1 -0
- package/src/engine/physics/inverse_kinematics/fabrik/fabrik_solve.js +100 -0
- package/src/engine/physics/inverse_kinematics/fabrik/prototype.d.ts +2 -0
- package/src/engine/physics/inverse_kinematics/fabrik/prototype.d.ts.map +1 -0
- package/src/engine/physics/inverse_kinematics/fabrik/prototype.js +112 -0
- package/src/engine/physics/inverse_kinematics/two_joint_ik.d.ts +16 -0
- package/src/engine/physics/inverse_kinematics/two_joint_ik.d.ts.map +1 -0
- package/src/engine/physics/inverse_kinematics/two_joint_ik.js +127 -0
- package/src/view/elements/DropDownSelectionView.js +2 -2
- package/src/view/elements/tiles2d/Tile.d.ts.map +1 -1
- package/src/view/elements/tiles2d/Tile.js +2 -3
- package/src/core/math/makeSequenceLoop.d.ts.map +0 -1
- package/src/engine/animation/curve/compute_curve_aabb.d.ts +0 -7
- package/src/engine/animation/curve/compute_curve_aabb.d.ts.map +0 -1
- package/src/engine/ecs/guid/GUID.d.ts.map +0 -1
- package/src/engine/ecs/guid/GUID.spec.d.ts +0 -2
- package/src/engine/ecs/guid/GUID.spec.d.ts.map +0 -1
- package/src/engine/ecs/guid/GUIDSerializationAdapter.d.ts +0 -18
- package/src/engine/ecs/guid/GUIDSerializationAdapter.d.ts.map +0 -1
- /package/src/core/{math → function}/makeSequenceLoop.d.ts +0 -0
- /package/src/core/{math → function}/makeSequenceLoop.js +0 -0
|
@@ -178,4 +178,71 @@ test("static constant constructor", () => {
|
|
|
178
178
|
expect(curve.evaluate(4.9)).toBe(7);
|
|
179
179
|
|
|
180
180
|
expect(curve.evaluate(3)).toBe(7);
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
test("equals method", () => {
|
|
184
|
+
|
|
185
|
+
expect(new AnimationCurve().equals(new AnimationCurve())).toBe(true);
|
|
186
|
+
|
|
187
|
+
// one frame
|
|
188
|
+
expect(
|
|
189
|
+
AnimationCurve.from([Keyframe.from(0, 0)])
|
|
190
|
+
.equals(AnimationCurve.from([Keyframe.from(0, 0)]))
|
|
191
|
+
).toBe(true);
|
|
192
|
+
|
|
193
|
+
expect(
|
|
194
|
+
AnimationCurve.from([Keyframe.from(0, 1)])
|
|
195
|
+
.equals(AnimationCurve.from([Keyframe.from(0, 0)]))
|
|
196
|
+
).toBe(false);
|
|
197
|
+
|
|
198
|
+
expect(
|
|
199
|
+
AnimationCurve.from([Keyframe.from(1, 0)])
|
|
200
|
+
.equals(AnimationCurve.from([Keyframe.from(0, 0)]))
|
|
201
|
+
).toBe(false);
|
|
202
|
+
|
|
203
|
+
expect(
|
|
204
|
+
AnimationCurve.from([Keyframe.from(0, 0)])
|
|
205
|
+
.equals(AnimationCurve.from([Keyframe.from(0, 1)]))
|
|
206
|
+
).toBe(false);
|
|
207
|
+
|
|
208
|
+
expect(
|
|
209
|
+
AnimationCurve.from([Keyframe.from(0, 0)])
|
|
210
|
+
.equals(AnimationCurve.from([Keyframe.from(0, 1)]))
|
|
211
|
+
).toBe(false);
|
|
212
|
+
|
|
213
|
+
// different frame count
|
|
214
|
+
|
|
215
|
+
expect(
|
|
216
|
+
AnimationCurve.from([])
|
|
217
|
+
.equals(AnimationCurve.from([Keyframe.from(0, 0)]))
|
|
218
|
+
).toBe(false);
|
|
219
|
+
|
|
220
|
+
expect(
|
|
221
|
+
AnimationCurve.from([Keyframe.from(0, 0)])
|
|
222
|
+
.equals(AnimationCurve.from([]))
|
|
223
|
+
).toBe(false);
|
|
224
|
+
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
test("hash", () => {
|
|
228
|
+
|
|
229
|
+
expect(typeof AnimationCurve.from([Keyframe.from(0, 0)]).hash()).toBe("number")
|
|
230
|
+
|
|
231
|
+
expect(AnimationCurve.from([]).hash())
|
|
232
|
+
.toEqual(AnimationCurve.from([]).hash())
|
|
233
|
+
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
test("copy", () => {
|
|
237
|
+
|
|
238
|
+
const r = new AnimationCurve();
|
|
239
|
+
|
|
240
|
+
r.copy(AnimationCurve.from([Keyframe.from(1, -3, 5, -7)]))
|
|
241
|
+
|
|
242
|
+
expect(r.keys.length).toBe(1);
|
|
243
|
+
expect(r.keys[0].value).toBe(-3);
|
|
244
|
+
expect(r.keys[0].time).toBe(1);
|
|
245
|
+
expect(r.keys[0].inTangent).toBe(5);
|
|
246
|
+
expect(r.keys[0].outTangent).toBe(-7);
|
|
247
|
+
|
|
181
248
|
});
|
|
@@ -14,17 +14,17 @@ export class Keyframe {
|
|
|
14
14
|
*/
|
|
15
15
|
value: number;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Timestamp
|
|
18
18
|
* @type {number}
|
|
19
19
|
*/
|
|
20
20
|
time: number;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Incoming tangent
|
|
23
23
|
* @type {number}
|
|
24
24
|
*/
|
|
25
25
|
inTangent: number;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* Outgoing tangent
|
|
28
28
|
* @type {number}
|
|
29
29
|
*/
|
|
30
30
|
outTangent: number;
|
|
@@ -36,6 +36,27 @@ export class Keyframe {
|
|
|
36
36
|
* @param {number} outTangent
|
|
37
37
|
*/
|
|
38
38
|
set(time: number, value: number, inTangent: number, outTangent: number): void;
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @param {Keyframe} other
|
|
42
|
+
* @returns {boolean}
|
|
43
|
+
*/
|
|
44
|
+
equals(other: Keyframe): boolean;
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* @param {Keyframe} other
|
|
48
|
+
*/
|
|
49
|
+
copy(other: Keyframe): void;
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
* @return {Keyframe}
|
|
53
|
+
*/
|
|
54
|
+
clone(): Keyframe;
|
|
55
|
+
/**
|
|
56
|
+
*
|
|
57
|
+
* @return {number}
|
|
58
|
+
*/
|
|
59
|
+
hash(): number;
|
|
39
60
|
toJSON(): {
|
|
40
61
|
value: number;
|
|
41
62
|
time: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Keyframe.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/Keyframe.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Keyframe.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/Keyframe.js"],"names":[],"mappings":"AAGA;IAyBI;;;;;;;OAOG;IACH,kBANW,MAAM,SACN,MAAM,cACN,MAAM,eACN,MAAM,GACL,QAAQ,CAQnB;IAtCD;;;OAGG;IACH,OAFU,MAAM,CAEN;IAEV;;;OAGG;IACH,MAFU,MAAM,CAEP;IAET;;;OAGG;IACH,WAFU,MAAM,CAEF;IAEd;;;OAGG;IACH,YAFU,MAAM,CAED;IAkBf;;;;;;OAMG;IACH,UALW,MAAM,SACN,MAAM,aACN,MAAM,cACN,MAAM,QAmBhB;IAED;;;;OAIG;IACH,cAHW,QAAQ,GACN,OAAO,CAQnB;IAED;;;OAGG;IACH,YAFW,QAAQ,QAOlB;IAED;;;OAGG;IACH,SAFY,QAAQ,CAQnB;IAED;;;OAGG;IACH,QAFY,MAAM,CAKjB;IAED;;;;;MAOC;IAED;;;;;aAQC;IAIL;;;OAGG;IACH,qBAFU,OAAO,CAEY;CAN5B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { assert } from "../../../core/assert.js";
|
|
2
|
+
import { computeHashFloat } from "../../../core/primitives/numbers/computeHashFloat.js";
|
|
2
3
|
|
|
3
4
|
export class Keyframe {
|
|
4
5
|
/**
|
|
@@ -8,19 +9,19 @@ export class Keyframe {
|
|
|
8
9
|
value = 0;
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
+
* Timestamp
|
|
12
13
|
* @type {number}
|
|
13
14
|
*/
|
|
14
15
|
time = 0;
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
|
-
*
|
|
18
|
+
* Incoming tangent
|
|
18
19
|
* @type {number}
|
|
19
20
|
*/
|
|
20
21
|
inTangent = 0;
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
|
-
*
|
|
24
|
+
* Outgoing tangent
|
|
24
25
|
* @type {number}
|
|
25
26
|
*/
|
|
26
27
|
outTangent = 0;
|
|
@@ -67,6 +68,51 @@ export class Keyframe {
|
|
|
67
68
|
this.outTangent = outTangent;
|
|
68
69
|
}
|
|
69
70
|
|
|
71
|
+
/**
|
|
72
|
+
*
|
|
73
|
+
* @param {Keyframe} other
|
|
74
|
+
* @returns {boolean}
|
|
75
|
+
*/
|
|
76
|
+
equals(other) {
|
|
77
|
+
return this.time === other.time
|
|
78
|
+
&& this.value === other.value
|
|
79
|
+
&& this.inTangent === other.inTangent
|
|
80
|
+
&& this.outTangent === other.outTangent;
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
*
|
|
86
|
+
* @param {Keyframe} other
|
|
87
|
+
*/
|
|
88
|
+
copy(other) {
|
|
89
|
+
this.time = other.time;
|
|
90
|
+
this.value = other.value;
|
|
91
|
+
this.inTangent = other.inTangent;
|
|
92
|
+
this.outTangent = other.outTangent;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
*
|
|
97
|
+
* @return {Keyframe}
|
|
98
|
+
*/
|
|
99
|
+
clone() {
|
|
100
|
+
const r = new Keyframe();
|
|
101
|
+
|
|
102
|
+
r.copy(this);
|
|
103
|
+
|
|
104
|
+
return r;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
*
|
|
109
|
+
* @return {number}
|
|
110
|
+
*/
|
|
111
|
+
hash() {
|
|
112
|
+
return computeHashFloat(this.time)
|
|
113
|
+
^ computeHashFloat(this.value);
|
|
114
|
+
}
|
|
115
|
+
|
|
70
116
|
toJSON() {
|
|
71
117
|
return {
|
|
72
118
|
value: this.value,
|
|
@@ -28,4 +28,15 @@ test("fromJSON", () => {
|
|
|
28
28
|
expect(keyframe.inTangent).toEqual(5);
|
|
29
29
|
expect(keyframe.outTangent).toEqual(7);
|
|
30
30
|
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test("copy",()=>{
|
|
34
|
+
const keyframe = new Keyframe();
|
|
35
|
+
|
|
36
|
+
keyframe.copy(Keyframe.from(1, -3, 5, -7));
|
|
37
|
+
|
|
38
|
+
expect(keyframe.value).toBe(-3);
|
|
39
|
+
expect(keyframe.time).toBe(1);
|
|
40
|
+
expect(keyframe.inTangent).toBe(5);
|
|
41
|
+
expect(keyframe.outTangent).toBe(-7);
|
|
31
42
|
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compute bounding box for a given curve. X-axis is time, Y-axis is value.
|
|
3
|
+
* @param {AABB2} out
|
|
4
|
+
* @param {AnimationCurve} curve
|
|
5
|
+
*/
|
|
6
|
+
export function animation_curve_compute_aabb(out: AABB2, curve: AnimationCurve): void;
|
|
7
|
+
//# sourceMappingURL=animation_curve_compute_aabb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animation_curve_compute_aabb.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/animation_curve_compute_aabb.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,sFAsCC"}
|
package/src/engine/animation/curve/{compute_curve_aabb.js → animation_curve_compute_aabb.js}
RENAMED
|
@@ -9,7 +9,7 @@ const temp_bounds = new Float32Array(4);
|
|
|
9
9
|
* @param {AABB2} out
|
|
10
10
|
* @param {AnimationCurve} curve
|
|
11
11
|
*/
|
|
12
|
-
export function
|
|
12
|
+
export function animation_curve_compute_aabb(out, curve) {
|
|
13
13
|
let x0 = Number.POSITIVE_INFINITY;
|
|
14
14
|
let x1 = Number.NEGATIVE_INFINITY;
|
|
15
15
|
let y0 = Number.POSITIVE_INFINITY;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Will remove keyframes that do not affect shape of the curve significantly. The significance degree is determined by the error tolerance
|
|
3
|
+
* Intended to reduce complexity of a curve to improve performance and lower memory usage
|
|
4
|
+
* @param {AnimationCurve} curve
|
|
5
|
+
* @param {number} [error_tolerance] how much of a loss to accept, this is relative to normalized value bounds of the curve
|
|
6
|
+
*/
|
|
7
|
+
export function animation_curve_optimize(curve: AnimationCurve, error_tolerance?: number): void;
|
|
8
|
+
//# sourceMappingURL=animation_curve_optimize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animation_curve_optimize.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/animation_curve_optimize.js"],"names":[],"mappings":"AA0CA;;;;;GAKG;AACH,kFAFW,MAAM,QA0ChB"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { assert } from "../../../core/assert.js";
|
|
2
|
+
import AABB2 from "../../../core/geom/2d/aabb/AABB2.js";
|
|
3
|
+
import { animation_curve_compute_aabb } from "./animation_curve_compute_aabb.js";
|
|
4
|
+
import { evaluate_two_key_curve } from "./evaluate_two_key_curve.js";
|
|
5
|
+
|
|
6
|
+
const bounds = new AABB2();
|
|
7
|
+
|
|
8
|
+
const NORMALIZED_CHECK_DISTANCE = 0.07;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Compute value difference in the curve if the `middle` key between `previous` and `next` is removed
|
|
12
|
+
* @param {Keyframe} key_middle
|
|
13
|
+
* @param {Keyframe} key_previous
|
|
14
|
+
* @param {Keyframe} key_next
|
|
15
|
+
* @return {number} value delta if the middle frame is removed
|
|
16
|
+
*/
|
|
17
|
+
function compute_keyframe_value_effect(key_middle, key_previous, key_next) {
|
|
18
|
+
// check if this key contributes to the shape
|
|
19
|
+
const v1_actual = evaluate_two_key_curve(key_middle.time, key_previous, key_next);
|
|
20
|
+
const v1_expected = key_middle.value;
|
|
21
|
+
|
|
22
|
+
const v1_error = Math.abs(v1_actual - v1_expected);
|
|
23
|
+
|
|
24
|
+
// sample just before the current frame
|
|
25
|
+
const v0_time = key_middle.time - (key_middle.time - key_previous.time) * NORMALIZED_CHECK_DISTANCE;
|
|
26
|
+
|
|
27
|
+
const v0_actual = evaluate_two_key_curve(v0_time, key_previous, key_next);
|
|
28
|
+
const v0_expected = evaluate_two_key_curve(v0_time, key_previous, key_middle);
|
|
29
|
+
|
|
30
|
+
const v0_error = Math.abs(v0_actual - v0_expected);
|
|
31
|
+
|
|
32
|
+
// sample just after the current frame
|
|
33
|
+
const v2_time = key_middle.time + (key_next.time - key_middle.time) * NORMALIZED_CHECK_DISTANCE;
|
|
34
|
+
|
|
35
|
+
const v2_actual = evaluate_two_key_curve(v2_time, key_previous, key_next);
|
|
36
|
+
const v2_expected = evaluate_two_key_curve(v2_time, key_middle, key_next);
|
|
37
|
+
|
|
38
|
+
const v2_error = Math.abs(v2_actual - v2_expected);
|
|
39
|
+
|
|
40
|
+
return Math.max(v0_error, v1_error, v2_error);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Will remove keyframes that do not affect shape of the curve significantly. The significance degree is determined by the error tolerance
|
|
45
|
+
* Intended to reduce complexity of a curve to improve performance and lower memory usage
|
|
46
|
+
* @param {AnimationCurve} curve
|
|
47
|
+
* @param {number} [error_tolerance] how much of a loss to accept, this is relative to normalized value bounds of the curve
|
|
48
|
+
*/
|
|
49
|
+
export function animation_curve_optimize(curve, error_tolerance = 1e-3) {
|
|
50
|
+
assert.lessThan(error_tolerance, 1, 'error_tolerance must be less than 1');
|
|
51
|
+
|
|
52
|
+
animation_curve_compute_aabb(bounds, curve);
|
|
53
|
+
|
|
54
|
+
const absolute_error_tolerance = bounds.height * error_tolerance;
|
|
55
|
+
|
|
56
|
+
let key_count = curve.length;
|
|
57
|
+
|
|
58
|
+
const keyframes = curve.keys;
|
|
59
|
+
|
|
60
|
+
for (let i = 1; i < key_count; i++) {
|
|
61
|
+
const key_previous = keyframes[i - 1];
|
|
62
|
+
const key_current = keyframes[i];
|
|
63
|
+
|
|
64
|
+
let should_remove = false;
|
|
65
|
+
|
|
66
|
+
if (key_current.equals(key_previous)) {
|
|
67
|
+
// adds no semantic value
|
|
68
|
+
should_remove = true;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (!should_remove && i < key_count - 1) {
|
|
72
|
+
const key_next = keyframes[i + 1];
|
|
73
|
+
|
|
74
|
+
const max_error = compute_keyframe_value_effect(key_current, key_previous, key_next);
|
|
75
|
+
|
|
76
|
+
if (max_error <= absolute_error_tolerance) {
|
|
77
|
+
// does not significantly affect the curve shape
|
|
78
|
+
should_remove = true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
if (should_remove) {
|
|
84
|
+
curve.remove(key_current);
|
|
85
|
+
i--;
|
|
86
|
+
key_count--;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animation_curve_optimize.spec.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/animation_curve_optimize.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { animation_curve_optimize } from "./animation_curve_optimize.js";
|
|
2
|
+
import { AnimationCurve } from "./AnimationCurve.js";
|
|
3
|
+
import { Keyframe } from "./Keyframe.js";
|
|
4
|
+
|
|
5
|
+
test("single key", () => {
|
|
6
|
+
|
|
7
|
+
const curve = AnimationCurve.from([
|
|
8
|
+
Keyframe.from(1, -2, 3, -5)
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
animation_curve_optimize(curve);
|
|
12
|
+
|
|
13
|
+
expect(curve.keys.length).toBe(1);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test("repeated key", () => {
|
|
17
|
+
|
|
18
|
+
const curve = AnimationCurve.from([
|
|
19
|
+
Keyframe.from(1, -2, 3, -5),
|
|
20
|
+
Keyframe.from(1, -2, 3, -5),
|
|
21
|
+
Keyframe.from(1, -2, 3, -5)
|
|
22
|
+
]);
|
|
23
|
+
|
|
24
|
+
animation_curve_optimize(curve);
|
|
25
|
+
|
|
26
|
+
expect(curve.equals(
|
|
27
|
+
AnimationCurve.from([
|
|
28
|
+
Keyframe.from(1, -2, 3, -5)
|
|
29
|
+
])
|
|
30
|
+
)).toBe(true);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test("linear curve", () => {
|
|
34
|
+
|
|
35
|
+
const curve = AnimationCurve.from([
|
|
36
|
+
Keyframe.from(0, 0, 1, 1),
|
|
37
|
+
Keyframe.from(1, 1, 1, 1),
|
|
38
|
+
Keyframe.from(2, 2, 1, 1),
|
|
39
|
+
])
|
|
40
|
+
|
|
41
|
+
animation_curve_optimize(curve);
|
|
42
|
+
|
|
43
|
+
expect(curve.equals(
|
|
44
|
+
AnimationCurve.from([
|
|
45
|
+
Keyframe.from(0, 0, 1, 1),
|
|
46
|
+
Keyframe.from(2, 2, 1, 1)
|
|
47
|
+
])
|
|
48
|
+
)).toBe(true);
|
|
49
|
+
|
|
50
|
+
});
|
|
@@ -11,8 +11,8 @@ import { canvas2d_plot_data_line } from "../../../graphics/canvas/canvas2d_plot_
|
|
|
11
11
|
import { MouseEvents } from "../../../input/devices/events/MouseEvents.js";
|
|
12
12
|
import { readPositionFromMouseEvent } from "../../../input/devices/PointerDevice.js";
|
|
13
13
|
import { DraggableAspect } from "../../../ui/DraggableAspect.js";
|
|
14
|
+
import { animation_curve_compute_aabb } from "../animation_curve_compute_aabb.js";
|
|
14
15
|
import { sample_animation_curve_to_float_array } from "../compression/sample_animation_curve_to_float_array.js";
|
|
15
|
-
import { compute_curve_aabb } from "../compute_curve_aabb.js";
|
|
16
16
|
import { Keyframe } from "../Keyframe.js";
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -106,7 +106,7 @@ export function build_curve_editor({
|
|
|
106
106
|
});
|
|
107
107
|
|
|
108
108
|
function handle_curve_update() {
|
|
109
|
-
|
|
109
|
+
animation_curve_compute_aabb(frame, curve);
|
|
110
110
|
|
|
111
111
|
frame_updated.send0();
|
|
112
112
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number} time
|
|
4
|
+
* @param {Keyframe} keyframe0
|
|
5
|
+
* @param {Keyframe} keyframe1
|
|
6
|
+
* @return {number}
|
|
7
|
+
*/
|
|
8
|
+
export function evaluate_two_key_curve(time: number, keyframe0: Keyframe, keyframe1: Keyframe): number;
|
|
9
|
+
//# sourceMappingURL=evaluate_two_key_curve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluate_two_key_curve.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/evaluate_two_key_curve.js"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,6CALW,MAAM,aACN,QAAQ,aACR,QAAQ,GACP,MAAM,CAcjB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { inverseLerp } from "../../../core/math/inverseLerp.js";
|
|
2
|
+
import { spline_hermite3 } from "../../../core/math/spline/spline_hermite3.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param {number} time
|
|
7
|
+
* @param {Keyframe} keyframe0
|
|
8
|
+
* @param {Keyframe} keyframe1
|
|
9
|
+
* @return {number}
|
|
10
|
+
*/
|
|
11
|
+
export function evaluate_two_key_curve(time, keyframe0, keyframe1) {
|
|
12
|
+
// convert to 0..1 region
|
|
13
|
+
const normalized_time = inverseLerp(keyframe0.time, keyframe1.time, time);
|
|
14
|
+
|
|
15
|
+
const time_distance = keyframe1.time - keyframe0.time;
|
|
16
|
+
|
|
17
|
+
return spline_hermite3(
|
|
18
|
+
normalized_time,
|
|
19
|
+
keyframe0.value, keyframe1.value,
|
|
20
|
+
keyframe0.outTangent * time_distance,
|
|
21
|
+
keyframe1.inTangent * time_distance
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -38,17 +38,17 @@ async function main(engine) {
|
|
|
38
38
|
yaw: 3.123185307179593,
|
|
39
39
|
});
|
|
40
40
|
//
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
make_sample('data/models/samples/InterpolationTest.glb',[
|
|
42
|
+
'Step Scale',
|
|
43
|
+
'Linear Scale',
|
|
44
|
+
'CubicSpline Scale',
|
|
45
|
+
'Step Rotation',
|
|
46
|
+
'CubicSpline Rotation',
|
|
47
|
+
'Linear Rotation',
|
|
48
|
+
'Step Translation',
|
|
49
|
+
'CubicSpline Translation',
|
|
50
|
+
'Linear Translation'
|
|
51
|
+
],engine.entityManager.dataset);
|
|
52
52
|
|
|
53
53
|
// make_sample('data/models/samples/BoxAnimated.glb',[
|
|
54
54
|
// 'animation_0'
|
|
@@ -61,9 +61,9 @@ async function main(engine) {
|
|
|
61
61
|
// make_sample('moicon/Separated_Cardboard-Box-800x600x400_Roughness0/V1 Cardboard B.gltf', [
|
|
62
62
|
// 'All Animations'
|
|
63
63
|
// ], engine.entityManager.dataset);
|
|
64
|
-
make_sample('moicon/v26/v26.gltf', [
|
|
65
|
-
|
|
66
|
-
], engine.entityManager.dataset);
|
|
64
|
+
// make_sample('moicon/v26/v26.gltf', [
|
|
65
|
+
// 'All Animations'
|
|
66
|
+
// ], engine.entityManager.dataset);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeTextureEquality.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/asset/loaders/material/computeTextureEquality.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"computeTextureEquality.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/asset/loaders/material/computeTextureEquality.js"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,gEAFa,OAAO,CAoDnB;AAGD;;;;;GAKG;AACH,sCAJW,8DAAM,EAAE,GAAC;IAAC,KAAK,EAAC,MAAM,CAAC;IAAC,MAAM,EAAC,MAAM,CAAA;CAAC,KACtC,8DAAM,EAAE,GAAC;IAAC,KAAK,EAAC,MAAM,CAAC;IAAC,MAAM,EAAC,MAAM,CAAA;CAAC,GACpC,OAAO,CAgEnB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { fastArrayEquals } from "../../../../core/collection/array/fastArrayEquals.js";
|
|
2
2
|
import { isTypedArray } from "../../../../core/collection/array/typed/isTypedArray.js";
|
|
3
|
+
import { isImageBitmap } from "../../../graphics/texture/isImageBitmap.js";
|
|
3
4
|
import { computeImageBitmapEquality } from "./computeImageBitmapEquality.js";
|
|
4
5
|
|
|
5
6
|
//
|
|
@@ -93,13 +94,10 @@ export function textureImagesEqual(a, b) {
|
|
|
93
94
|
return false;
|
|
94
95
|
}
|
|
95
96
|
|
|
96
|
-
if (
|
|
97
|
-
|
|
98
|
-
// Required for Safari below version 15.6
|
|
99
|
-
ImageBitmap !== undefined
|
|
100
|
-
&& (a instanceof ImageBitmap && b instanceof ImageBitmap)
|
|
101
|
-
) {
|
|
97
|
+
if (isImageBitmap(a) && isImageBitmap(b)) {
|
|
98
|
+
|
|
102
99
|
return computeImageBitmapEquality(a, b);
|
|
100
|
+
|
|
103
101
|
}
|
|
104
102
|
|
|
105
103
|
if (Array.isArray(a) && Array.isArray(b)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeTextureHash.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/asset/loaders/material/computeTextureHash.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"computeTextureHash.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/asset/loaders/material/computeTextureHash.js"],"names":[],"mappings":"AAwBA;;;;GAIG;AACH;;WAHoD,MAAM;YAAQ,MAAM;IAC5D,MAAM,CAsCjB;AA4CD;;;;GAIG;AACH,sCAHW,UAAQ,MAAM,OAAO,GACnB,MAAM,CAqClB"}
|
|
@@ -2,6 +2,7 @@ import { computeHashIntegerArray } from "../../../../core/collection/array/compu
|
|
|
2
2
|
import { murmur3_32 } from "../../../../core/math/hash/murmur3_32.js";
|
|
3
3
|
import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
|
|
4
4
|
import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
|
|
5
|
+
import { isImageBitmap } from "../../../graphics/texture/isImageBitmap.js";
|
|
5
6
|
import { computeImageBitmapHash } from "./computeImageBitmapHash.js";
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -35,15 +36,14 @@ export function computeImageDataHash(image) {
|
|
|
35
36
|
|
|
36
37
|
let result = 0;
|
|
37
38
|
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
// Required for Safari below version 15.6
|
|
41
|
-
ImageBitmap !== undefined
|
|
42
|
-
&& (image instanceof ImageBitmap)
|
|
43
|
-
) {
|
|
39
|
+
if (isImageBitmap(image)) {
|
|
40
|
+
|
|
44
41
|
result = computeImageBitmapHash(image);
|
|
42
|
+
|
|
45
43
|
} else if (image instanceof HTMLImageElement) {
|
|
44
|
+
|
|
46
45
|
result = computeStringHash(image.src);
|
|
46
|
+
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
let width = 0;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export class DynamicRuleDescription {
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @type {UUID}
|
|
5
|
+
*/
|
|
6
|
+
id: UUID;
|
|
3
7
|
/**
|
|
4
8
|
*
|
|
5
9
|
* @type {ReactiveExpression}
|
|
@@ -51,5 +55,6 @@ export class DynamicRuleDescription {
|
|
|
51
55
|
priority?: number;
|
|
52
56
|
}): void;
|
|
53
57
|
}
|
|
58
|
+
import { UUID } from "../../guid/UUID.js";
|
|
54
59
|
import { DynamicRuleCooldownDescription } from "./DynamicRuleCooldownDescription.js";
|
|
55
60
|
//# sourceMappingURL=DynamicRuleDescription.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicRuleDescription.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/dynamic_actions/rules/DynamicRuleDescription.js"],"names":[],"mappings":"AAQA;IACI,
|
|
1
|
+
{"version":3,"file":"DynamicRuleDescription.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/dynamic_actions/rules/DynamicRuleDescription.js"],"names":[],"mappings":"AAQA;IACI;;;OAGG;IACH,IAFU,IAAI,CAEC;IAEf;;;OAGG;IACH,8BAAiB;IACjB;;;OAGG;IACH,kCAAc;IACd;;;OAGG;IACH,YAFU,mBAAmB,CAEb;IAChB;;;OAGG;IACH,UAFU,MAAM,CAEH;IACb;;;OAGG;IACH,6BAAyB;IACzB;;;OAGG;IACH,kBAFU,8BAA8B,EAAE,CAEpB;IAEtB;;;;OAIG;IACH,cAHW,sBAAsB,GACpB,OAAO,CAInB;IAED;;;OAGG;IACH,0BAFa,MAAM,CAIlB;IAED,yCAEC;IAED,cA+BC;IAED;;;;;;aA2BC;CACJ;qBA5HoB,oBAAoB;+CAEM,qCAAqC"}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import UUID from "../../../../core/UUID.js";
|
|
2
1
|
import { assert } from "../../../../core/assert.js";
|
|
2
|
+
import { compileReactiveExpression } from "../../../../core/lang/reactive/compileReactiveExpression.js";
|
|
3
3
|
import { inferReactiveExpressionTypes } from "../../../../core/model/reactive/transform/ReactiveTypeInferrence.js";
|
|
4
4
|
import DataType from "../../../../core/parser/simple/DataType.js";
|
|
5
|
-
import {
|
|
5
|
+
import { UUID } from "../../guid/UUID.js";
|
|
6
6
|
import { deserializeActionFromJSON } from "../actions/definition/deserializeActionFromJSON.js";
|
|
7
7
|
import { DynamicRuleCooldownDescription } from "./DynamicRuleCooldownDescription.js";
|
|
8
8
|
|
|
9
9
|
export class DynamicRuleDescription {
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @type {UUID}
|
|
13
|
+
*/
|
|
14
|
+
id = UUID.v1();
|
|
15
|
+
|
|
11
16
|
/**
|
|
12
17
|
*
|
|
13
18
|
* @type {ReactiveExpression}
|
|
@@ -45,7 +50,7 @@ export class DynamicRuleDescription {
|
|
|
45
50
|
* @returns {boolean}
|
|
46
51
|
*/
|
|
47
52
|
equals(other) {
|
|
48
|
-
return this.id
|
|
53
|
+
return this.id.equals(other.id);
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
/**
|
|
@@ -94,7 +99,7 @@ export class DynamicRuleDescription {
|
|
|
94
99
|
}
|
|
95
100
|
|
|
96
101
|
fromJSON({
|
|
97
|
-
id = UUID.
|
|
102
|
+
id = UUID.v1().toString(),
|
|
98
103
|
condition,
|
|
99
104
|
action,
|
|
100
105
|
global_cooldowns = [],
|
|
@@ -113,7 +118,7 @@ export class DynamicRuleDescription {
|
|
|
113
118
|
|
|
114
119
|
this.action = deserializeActionFromJSON(action);
|
|
115
120
|
|
|
116
|
-
this.id
|
|
121
|
+
this.id.parse(id);
|
|
117
122
|
|
|
118
123
|
this.priority = priority;
|
|
119
124
|
|