@woosh/meep-engine 2.110.8 → 2.110.10
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 +116 -107
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +116 -107
- 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/2d/aabb/AABB2.d.ts.map +1 -1
- package/src/core/geom/2d/aabb/AABB2.js +27 -1
- 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 +61 -0
- package/src/core/geom/3d/tetrahedra/get_tetrahedron_volume.d.ts +9 -0
- package/src/core/geom/3d/tetrahedra/get_tetrahedron_volume.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/get_tetrahedron_volume.js +18 -0
- package/src/core/geom/3d/tetrahedra/is_tetrahedron_degenerate.d.ts +9 -0
- package/src/core/geom/3d/tetrahedra/is_tetrahedron_degenerate.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/is_tetrahedron_degenerate.js +21 -0
- package/src/core/geom/3d/tetrahedra/validate_tetrahedral_mesh.d.ts +2 -10
- package/src/core/geom/3d/tetrahedra/validate_tetrahedral_mesh.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/validate_tetrahedral_mesh.js +3 -40
- 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/mat3/m3_cm_invert.d.ts +7 -0
- package/src/core/geom/mat3/m3_cm_invert.d.ts.map +1 -0
- package/src/core/geom/mat3/m3_cm_invert.js +45 -0
- package/src/core/geom/vec2/v2_matrix3_cm_multiply.d.ts +10 -0
- package/src/core/geom/vec2/v2_matrix3_cm_multiply.d.ts.map +1 -0
- package/src/core/geom/vec2/v2_matrix3_cm_multiply.js +20 -0
- package/src/core/geom/vec2/v2_matrix3_rm_multiply.d.ts +10 -0
- package/src/core/geom/vec2/v2_matrix3_rm_multiply.d.ts.map +1 -0
- package/src/core/geom/vec2/v2_matrix3_rm_multiply.js +21 -0
- 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 +3 -2
- package/src/core/math/spline/spline_hermite3_to_bezier.d.ts +12 -0
- package/src/core/math/spline/spline_hermite3_to_bezier.d.ts.map +1 -0
- package/src/core/math/spline/spline_hermite3_to_bezier.js +24 -0
- 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 +8 -0
- 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/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 +4 -1
- 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 +32 -0
- package/src/engine/animation/curve/AnimationCurve.d.ts.map +1 -1
- package/src/engine/animation/curve/AnimationCurve.js +94 -19
- 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.d.ts.map +1 -1
- package/src/engine/animation/curve/draw/build_curve_editor.js +17 -11
- 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/animation/curve/view/AnimationCurveView.d.ts +47 -0
- package/src/engine/animation/curve/view/AnimationCurveView.d.ts.map +1 -0
- package/src/engine/animation/curve/view/AnimationCurveView.js +343 -0
- package/src/engine/animation/curve/view/prototype.d.ts +2 -0
- package/src/engine/animation/curve/view/prototype.d.ts.map +1 -0
- package/src/engine/animation/curve/view/prototype.js +86 -0
- 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/{GUID.d.ts → UUID.d.ts} +27 -15
- package/src/engine/ecs/guid/UUID.d.ts.map +1 -0
- package/src/engine/ecs/guid/{GUID.js → UUID.js} +52 -17
- 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} +25 -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/guid/UUIDSerializationAdapter.spec.d.ts +2 -0
- package/src/engine/ecs/guid/UUIDSerializationAdapter.spec.d.ts.map +1 -0
- package/src/engine/ecs/guid/{GUIDSerializationAdapter.spec.js → UUIDSerializationAdapter.spec.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/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 +1 -1
- package/src/view/elements/tiles2d/Tile.d.ts.map +1 -1
- package/src/view/elements/tiles2d/Tile.js +3 -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/engine/ecs/guid/GUIDSerializationAdapter.spec.d.ts +0 -2
- package/src/engine/ecs/guid/GUIDSerializationAdapter.spec.d.ts.map +0 -1
- /package/src/core/{math → function}/makeSequenceLoop.d.ts +0 -0
- /package/src/core/{math → function}/makeSequenceLoop.js +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { assert } from "../../../core/assert.js";
|
|
1
2
|
import Name from "../../ecs/name/Name.js";
|
|
2
3
|
import { BoundQuaternionWriter } from "../curve/binding/BoundQuaternionWriter.js";
|
|
3
4
|
import { BoundValueWriter } from "../curve/binding/BoundValueWriter.js";
|
|
@@ -24,14 +25,15 @@ function get_node_name(node) {
|
|
|
24
25
|
/**
|
|
25
26
|
* Following THREE.js PropertyBinding.findNode implementation
|
|
26
27
|
* @param {EntityNode} root
|
|
27
|
-
* @param {string}
|
|
28
|
+
* @param {string} node_name
|
|
28
29
|
* @returns {EntityNode|undefined}
|
|
29
30
|
*/
|
|
30
|
-
function find_node(root,
|
|
31
|
+
function find_node(root, node_name) {
|
|
32
|
+
assert.isString(node_name, 'node_name');
|
|
31
33
|
|
|
32
34
|
const root_name = get_node_name(root);
|
|
33
35
|
|
|
34
|
-
if (root_name ===
|
|
36
|
+
if (root_name === node_name) {
|
|
35
37
|
return root;
|
|
36
38
|
}
|
|
37
39
|
|
|
@@ -40,14 +42,13 @@ function find_node(root, nodeName) {
|
|
|
40
42
|
|
|
41
43
|
const child_count = children.length;
|
|
42
44
|
|
|
43
|
-
|
|
44
45
|
for (let j = 0; j < child_count; j++) {
|
|
45
46
|
/**
|
|
46
47
|
* @type {EntityNode}
|
|
47
48
|
*/
|
|
48
49
|
const child = children[j];
|
|
49
50
|
|
|
50
|
-
const subtree_result = find_node(child,
|
|
51
|
+
const subtree_result = find_node(child, node_name);
|
|
51
52
|
|
|
52
53
|
if (subtree_result !== undefined) {
|
|
53
54
|
return subtree_result;
|
|
@@ -59,13 +60,18 @@ function find_node(root, nodeName) {
|
|
|
59
60
|
*
|
|
60
61
|
* @param {EntityNode} root
|
|
61
62
|
* @param {string[]} path_parts
|
|
63
|
+
* @param {number} part_first
|
|
64
|
+
* @param {number} part_last
|
|
62
65
|
*/
|
|
63
|
-
function entity_node_resolve_path(root, path_parts) {
|
|
66
|
+
function entity_node_resolve_path(root, path_parts, part_first, part_last) {
|
|
67
|
+
assert.isNonNegativeInteger(part_first, 'part_first');
|
|
68
|
+
assert.isNonNegativeInteger(part_last, 'part_last');
|
|
69
|
+
|
|
70
|
+
assert.lessThan(part_last, path_parts.length, 'overflow');
|
|
64
71
|
|
|
65
72
|
let node = root;
|
|
66
73
|
|
|
67
|
-
|
|
68
|
-
for (let i = 0; i < part_count; i++) {
|
|
74
|
+
for (let i = part_first; i <= part_last; i++) {
|
|
69
75
|
|
|
70
76
|
const part = path_parts[i];
|
|
71
77
|
|
|
@@ -86,15 +92,18 @@ function entity_node_resolve_path(root, path_parts) {
|
|
|
86
92
|
/**
|
|
87
93
|
*
|
|
88
94
|
* @param {EntityNode} node
|
|
89
|
-
* @param {string}
|
|
95
|
+
* @param {string[]} path_parts
|
|
90
96
|
* @returns {BoundValueWriter}
|
|
91
97
|
*/
|
|
92
|
-
export function bind_property_writer(node,
|
|
93
|
-
|
|
98
|
+
export function bind_property_writer(node, path_parts) {
|
|
99
|
+
assert.defined(path_parts, 'path_parts');
|
|
100
|
+
assert.isArray(path_parts, 'path_parts');
|
|
101
|
+
|
|
102
|
+
const part_count = path_parts.length;
|
|
94
103
|
|
|
95
|
-
const property_name = path_parts[
|
|
104
|
+
const property_name = path_parts[part_count - 1];
|
|
96
105
|
|
|
97
|
-
const parent = entity_node_resolve_path(node, path_parts
|
|
106
|
+
const parent = entity_node_resolve_path(node, path_parts, 0, part_count - 2);
|
|
98
107
|
|
|
99
108
|
let writer;
|
|
100
109
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"curve_from_track_data.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/clip/curve_from_track_data.js"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,mEANW,0BAA0B,UAC1B,MAAM,EAAE,GAAC,YAAY,SACrB,MAAM,EAAE,GAAC,YAAY,mBACrB,MAAM,mBACN,MAAM,
|
|
1
|
+
{"version":3,"file":"curve_from_track_data.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/clip/curve_from_track_data.js"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,mEANW,0BAA0B,UAC1B,MAAM,EAAE,GAAC,YAAY,SACrB,MAAM,EAAE,GAAC,YAAY,mBACrB,MAAM,mBACN,MAAM,QAsBhB;2CAlC0C,iCAAiC"}
|
|
@@ -12,7 +12,15 @@ import { curve_from_track_data_linear } from "./curve_from_track_data_linear.js"
|
|
|
12
12
|
* @param {number} component_count
|
|
13
13
|
* @param {number} component_index
|
|
14
14
|
*/
|
|
15
|
-
export function curve_from_track_data(
|
|
15
|
+
export function curve_from_track_data(
|
|
16
|
+
curve,
|
|
17
|
+
type,
|
|
18
|
+
values,
|
|
19
|
+
times,
|
|
20
|
+
component_count,
|
|
21
|
+
component_index
|
|
22
|
+
) {
|
|
23
|
+
|
|
16
24
|
switch (type) {
|
|
17
25
|
case AnimationInterpolationKind.Discrete:
|
|
18
26
|
return curve_from_track_data_discrete(curve, values, times, component_count, component_index);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecd_bind_animation_curve.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/clip/ecd_bind_animation_curve.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ecd_bind_animation_curve.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/clip/ecd_bind_animation_curve.js"],"names":[],"mappings":"AAoGA;;;;GAIG;AACH,2DAFW,mBAAmB,wBAgC7B;8BArI6B,oBAAoB;qCACb,2BAA2B"}
|
|
@@ -85,11 +85,9 @@ function convert_three_track_to_curves(track) {
|
|
|
85
85
|
/**
|
|
86
86
|
*
|
|
87
87
|
* @param {THREE.KeyframeTrack} track
|
|
88
|
-
* @param {EntityNode} node
|
|
89
88
|
* @returns {AnimationTrack}
|
|
90
89
|
*/
|
|
91
|
-
function convert_three_track(track
|
|
92
|
-
|
|
90
|
+
function convert_three_track(track) {
|
|
93
91
|
|
|
94
92
|
const track_name = track.name;
|
|
95
93
|
|
|
@@ -120,9 +118,12 @@ export function convert_three_clip(node, clip) {
|
|
|
120
118
|
for (let i = 0; i < track_count; i++) {
|
|
121
119
|
try {
|
|
122
120
|
const three_track = three_tracks[i];
|
|
123
|
-
const meep_track = convert_three_track(three_track, node);
|
|
124
121
|
|
|
125
|
-
const
|
|
122
|
+
const meep_track = convert_three_track(three_track);
|
|
123
|
+
|
|
124
|
+
const property_path = three_track.name.split('.');
|
|
125
|
+
|
|
126
|
+
const writer = bind_property_writer(node, property_path);
|
|
126
127
|
|
|
127
128
|
meep_clip.tracks.push(meep_track);
|
|
128
129
|
clip_binding.tracks.push(AnimationTrackBinding.from(writer, meep_track));
|
|
@@ -66,10 +66,20 @@ export class AnimationCurve {
|
|
|
66
66
|
* @returns {number}
|
|
67
67
|
*/
|
|
68
68
|
get length(): number;
|
|
69
|
+
/**
|
|
70
|
+
* Time of the first keyframe, returns 0 if there are no keys
|
|
71
|
+
* @returns {number}
|
|
72
|
+
*/
|
|
73
|
+
get start_time(): number;
|
|
69
74
|
/**
|
|
70
75
|
* Time of the last chronological key in the curve
|
|
71
76
|
* @return {number}
|
|
72
77
|
*/
|
|
78
|
+
get end_time(): number;
|
|
79
|
+
/**
|
|
80
|
+
* Time difference between first and last frame
|
|
81
|
+
* @returns {number}
|
|
82
|
+
*/
|
|
73
83
|
get duration(): number;
|
|
74
84
|
/**
|
|
75
85
|
*
|
|
@@ -79,6 +89,7 @@ export class AnimationCurve {
|
|
|
79
89
|
evaluate(time: number): number;
|
|
80
90
|
/**
|
|
81
91
|
* Set tangents of a key to match surrounding keys
|
|
92
|
+
* Produces a smoother looking curve
|
|
82
93
|
* @param {number} index index of keyframe
|
|
83
94
|
*/
|
|
84
95
|
alignTangents(index: number): void;
|
|
@@ -89,6 +100,27 @@ export class AnimationCurve {
|
|
|
89
100
|
*/
|
|
90
101
|
smoothTangents(index: number, weight: number): void;
|
|
91
102
|
smoothAllTangents(): void;
|
|
103
|
+
/**
|
|
104
|
+
*
|
|
105
|
+
* @param {AnimationCurve} other
|
|
106
|
+
* @return {boolean}
|
|
107
|
+
*/
|
|
108
|
+
equals(other: AnimationCurve): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* The copy is deep
|
|
111
|
+
* @param {AnimationCurve} other
|
|
112
|
+
*/
|
|
113
|
+
copy(other: AnimationCurve): void;
|
|
114
|
+
/**
|
|
115
|
+
*
|
|
116
|
+
* @return {AnimationCurve}
|
|
117
|
+
*/
|
|
118
|
+
clone(): AnimationCurve;
|
|
119
|
+
/**
|
|
120
|
+
*
|
|
121
|
+
* @return {number}
|
|
122
|
+
*/
|
|
123
|
+
hash(): number;
|
|
92
124
|
toJSON(): {
|
|
93
125
|
keys: any[];
|
|
94
126
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimationCurve.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/AnimationCurve.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AnimationCurve.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/AnimationCurve.js"],"names":[],"mappings":"AAqBA;;;GAGG;AACH;IAkFI;;;;OAIG;IACH,kBAHW,QAAQ,EAAE,GACR,cAAc,CAQ1B;IA0ND;;;;;;;OAOG;IACH,6BANW,MAAM,eACN,MAAM,YACN,MAAM,aACN,MAAM,GACL,cAAc,CAUzB;IAED;;;;;;OAMG;IACH,4BALW,MAAM,YACN,MAAM,UACN,MAAM,GACL,cAAc,CAOzB;IAED;;;;;;;OAOG;IACH,0BANW,MAAM,eACN,MAAM,YACN,MAAM,aACN,MAAM,GACL,cAAc,CAYzB;IAxWD;;;OAGG;IACH,eAFU,QAAQ,EAAE,CAEV;IAEV;;;;OAIG;IACH,SAHW,QAAQ,GACN,MAAM,CAgClB;IAED;;;OAGG;IACH,cAFW,QAAQ,EAAE,QAUpB;IAED;;;;OAIG;IACH,YAHW,QAAQ,GACN,OAAO,CAYnB;IAED;;OAEG;IACH,cAEC;IAeD;;;OAGG;IACH,qBAEC;IAED;;;OAGG;IACH,yBAUC;IAED;;;OAGG;IACH,uBAUC;IAED;;;OAGG;IACH,uBAaC;IAED;;;;OAIG;IACH,eAHW,MAAM,GACL,MAAM,CAiCjB;IAED;;;;OAIG;IACH,qBAFW,MAAM,QA+BhB;IAED;;;;OAIG;IACH,sBAHW,MAAM,UACN,MAAM,QAWhB;IAED,0BAKC;IAED;;;;OAIG;IACH,cAHW,cAAc,GACb,OAAO,CAIlB;IAED;;;OAGG;IACH,YAFW,cAAc,QAIxB;IAED;;;OAGG;IACH,SAFY,cAAc,CAQzB;IAED;;;OAGG;IACH,QAFY,MAAM,CAIjB;IAED;;MAIC;IAED;;aAeC;CAqDJ;yBA1XwB,eAAe"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { assert } from "../../../core/assert.js";
|
|
2
2
|
import { binarySearchHighIndex } from "../../../core/collection/array/binarySearchHighIndex.js";
|
|
3
|
-
import {
|
|
3
|
+
import { computeHashArray } from "../../../core/collection/array/computeHashArray.js";
|
|
4
|
+
import { isArrayEqual } from "../../../core/collection/array/isArrayEqual.js";
|
|
4
5
|
import { lerp } from "../../../core/math/lerp.js";
|
|
5
|
-
import {
|
|
6
|
+
import { invokeObjectClone } from "../../../core/model/object/invokeObjectClone.js";
|
|
7
|
+
import { invokeObjectHash } from "../../../core/model/object/invokeObjectHash.js";
|
|
6
8
|
import { invokeObjectToJSON } from "../../../core/model/object/invokeObjectToJSON.js";
|
|
9
|
+
import { evaluate_two_key_curve } from "./evaluate_two_key_curve.js";
|
|
7
10
|
import { Keyframe } from "./Keyframe.js";
|
|
8
11
|
|
|
9
12
|
/**
|
|
@@ -112,8 +115,6 @@ export class AnimationCurve {
|
|
|
112
115
|
|
|
113
116
|
curve.addMany(keys);
|
|
114
117
|
|
|
115
|
-
curve.smoothAllTangents();
|
|
116
|
-
|
|
117
118
|
return curve;
|
|
118
119
|
}
|
|
119
120
|
|
|
@@ -125,11 +126,27 @@ export class AnimationCurve {
|
|
|
125
126
|
return this.keys.length;
|
|
126
127
|
}
|
|
127
128
|
|
|
129
|
+
/**
|
|
130
|
+
* Time of the first keyframe, returns 0 if there are no keys
|
|
131
|
+
* @returns {number}
|
|
132
|
+
*/
|
|
133
|
+
get start_time() {
|
|
134
|
+
const keys = this.keys;
|
|
135
|
+
|
|
136
|
+
if (keys.length === 0) {
|
|
137
|
+
return 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const first = keys[0];
|
|
141
|
+
|
|
142
|
+
return first.time;
|
|
143
|
+
}
|
|
144
|
+
|
|
128
145
|
/**
|
|
129
146
|
* Time of the last chronological key in the curve
|
|
130
147
|
* @return {number}
|
|
131
148
|
*/
|
|
132
|
-
get
|
|
149
|
+
get end_time() {
|
|
133
150
|
const keys = this.keys;
|
|
134
151
|
const key_count = keys.length;
|
|
135
152
|
|
|
@@ -141,6 +158,25 @@ export class AnimationCurve {
|
|
|
141
158
|
return keys[key_count - 1].time;
|
|
142
159
|
}
|
|
143
160
|
|
|
161
|
+
/**
|
|
162
|
+
* Time difference between first and last frame
|
|
163
|
+
* @returns {number}
|
|
164
|
+
*/
|
|
165
|
+
get duration() {
|
|
166
|
+
|
|
167
|
+
const keys = this.keys;
|
|
168
|
+
const key_count = keys.length;
|
|
169
|
+
|
|
170
|
+
if (key_count < 2) {
|
|
171
|
+
return 0;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const first = keys[0];
|
|
175
|
+
const last = keys[key_count - 1];
|
|
176
|
+
|
|
177
|
+
return last.time - first.time;
|
|
178
|
+
}
|
|
179
|
+
|
|
144
180
|
/**
|
|
145
181
|
*
|
|
146
182
|
* @param {number} time time in seconds
|
|
@@ -171,17 +207,7 @@ export class AnimationCurve {
|
|
|
171
207
|
if (time < keyframe1.time) {
|
|
172
208
|
const keyframe0 = keys[i - 1];
|
|
173
209
|
|
|
174
|
-
|
|
175
|
-
const normalized_time = inverseLerp(keyframe0.time, keyframe1.time, time);
|
|
176
|
-
|
|
177
|
-
const time_distance = keyframe1.time - keyframe0.time;
|
|
178
|
-
|
|
179
|
-
return spline_hermite3(
|
|
180
|
-
normalized_time,
|
|
181
|
-
keyframe0.value, keyframe1.value,
|
|
182
|
-
keyframe0.outTangent * time_distance,
|
|
183
|
-
keyframe1.inTangent * time_distance
|
|
184
|
-
);
|
|
210
|
+
return evaluate_two_key_curve(time, keyframe0, keyframe1);
|
|
185
211
|
}
|
|
186
212
|
}
|
|
187
213
|
|
|
@@ -191,10 +217,15 @@ export class AnimationCurve {
|
|
|
191
217
|
|
|
192
218
|
/**
|
|
193
219
|
* Set tangents of a key to match surrounding keys
|
|
220
|
+
* Produces a smoother looking curve
|
|
194
221
|
* @param {number} index index of keyframe
|
|
195
222
|
*/
|
|
196
223
|
alignTangents(index) {
|
|
197
224
|
const keys = this.keys;
|
|
225
|
+
const last_index = keys.length - 1;
|
|
226
|
+
|
|
227
|
+
assert.isNonNegativeInteger(index, "index");
|
|
228
|
+
assert.lessThanOrEqual(index, last_index, "index overflow");
|
|
198
229
|
|
|
199
230
|
const key_main = keys[index];
|
|
200
231
|
|
|
@@ -202,14 +233,21 @@ export class AnimationCurve {
|
|
|
202
233
|
if (has_previous) {
|
|
203
234
|
const key_previous = keys[index - 1];
|
|
204
235
|
|
|
205
|
-
|
|
236
|
+
const time_span = key_main.time - key_previous.time;
|
|
237
|
+
const value_span = key_main.value - key_previous.value;
|
|
238
|
+
|
|
239
|
+
key_main.inTangent = value_span / time_span;
|
|
206
240
|
}
|
|
207
241
|
|
|
208
|
-
const has_next = index <
|
|
242
|
+
const has_next = index < last_index;
|
|
243
|
+
|
|
209
244
|
if (has_next) {
|
|
210
245
|
const key_next = keys[index + 1];
|
|
211
246
|
|
|
212
|
-
|
|
247
|
+
const time_span = key_next.time - key_main.time;
|
|
248
|
+
const value_span = key_next.value - key_main.value;
|
|
249
|
+
|
|
250
|
+
key_main.outTangent = value_span / time_span;
|
|
213
251
|
}
|
|
214
252
|
}
|
|
215
253
|
|
|
@@ -236,6 +274,43 @@ export class AnimationCurve {
|
|
|
236
274
|
}
|
|
237
275
|
}
|
|
238
276
|
|
|
277
|
+
/**
|
|
278
|
+
*
|
|
279
|
+
* @param {AnimationCurve} other
|
|
280
|
+
* @return {boolean}
|
|
281
|
+
*/
|
|
282
|
+
equals(other) {
|
|
283
|
+
return isArrayEqual(this.keys, other.keys);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* The copy is deep
|
|
288
|
+
* @param {AnimationCurve} other
|
|
289
|
+
*/
|
|
290
|
+
copy(other) {
|
|
291
|
+
this.keys = other.keys.map(invokeObjectClone);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
*
|
|
296
|
+
* @return {AnimationCurve}
|
|
297
|
+
*/
|
|
298
|
+
clone() {
|
|
299
|
+
const curve = new AnimationCurve();
|
|
300
|
+
|
|
301
|
+
curve.copy(this);
|
|
302
|
+
|
|
303
|
+
return curve;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
*
|
|
308
|
+
* @return {number}
|
|
309
|
+
*/
|
|
310
|
+
hash() {
|
|
311
|
+
return computeHashArray(this.keys, invokeObjectHash);
|
|
312
|
+
}
|
|
313
|
+
|
|
239
314
|
toJSON() {
|
|
240
315
|
return {
|
|
241
316
|
keys: this.keys.map(invokeObjectToJSON)
|
|
@@ -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"}
|