@flighthq/skeleton2d 0.5.1-next.973.788d3d7 → 0.6.0
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/README.md +2 -2
- package/dist/.tsbuildinfo.contract +1 -0
- package/dist/.tsbuildinfo.runtime +1 -0
- package/dist/Attachment2D.d.ts +6 -0
- package/dist/Attachment2D.d.ts.map +1 -0
- package/dist/Attachment2D.js +2 -0
- package/dist/Attachment2D.js.map +1 -0
- package/dist/AttachmentSkin2D.d.ts +11 -0
- package/dist/AttachmentSkin2D.d.ts.map +1 -0
- package/dist/AttachmentSkin2D.js +2 -0
- package/dist/AttachmentSkin2D.js.map +1 -0
- package/dist/Bone2D.d.ts +15 -0
- package/dist/Bone2D.d.ts.map +1 -0
- package/dist/Bone2D.js +2 -0
- package/dist/Bone2D.js.map +1 -0
- package/dist/BoundingBoxAttachment2DContract.d.ts +10 -0
- package/dist/BoundingBoxAttachment2DContract.d.ts.map +1 -0
- package/dist/BoundingBoxAttachment2DContract.js +2 -0
- package/dist/BoundingBoxAttachment2DContract.js.map +1 -0
- package/dist/ClippingAttachment2DContract.d.ts +12 -0
- package/dist/ClippingAttachment2DContract.d.ts.map +1 -0
- package/dist/ClippingAttachment2DContract.js +2 -0
- package/dist/ClippingAttachment2DContract.js.map +1 -0
- package/dist/MeshAttachment2D.d.ts +11 -0
- package/dist/MeshAttachment2D.d.ts.map +1 -0
- package/dist/MeshAttachment2D.js +2 -0
- package/dist/MeshAttachment2D.js.map +1 -0
- package/dist/PathAttachment2D.d.ts +13 -0
- package/dist/PathAttachment2D.d.ts.map +1 -0
- package/dist/PathAttachment2D.js +2 -0
- package/dist/PathAttachment2D.js.map +1 -0
- package/dist/PointAttachment2DContract.d.ts +9 -0
- package/dist/PointAttachment2DContract.d.ts.map +1 -0
- package/dist/PointAttachment2DContract.js +2 -0
- package/dist/PointAttachment2DContract.js.map +1 -0
- package/dist/RegionAttachment2DContract.d.ts +12 -0
- package/dist/RegionAttachment2DContract.d.ts.map +1 -0
- package/dist/RegionAttachment2DContract.js +2 -0
- package/dist/RegionAttachment2DContract.js.map +1 -0
- package/dist/Skeleton2DAnimationPath.d.ts +14 -0
- package/dist/Skeleton2DAnimationPath.d.ts.map +1 -0
- package/dist/Skeleton2DAnimationPath.js +48 -0
- package/dist/Skeleton2DAnimationPath.js.map +1 -0
- package/dist/Skeleton2DAnimationTargetBinder.d.ts +14 -0
- package/dist/Skeleton2DAnimationTargetBinder.d.ts.map +1 -0
- package/dist/Skeleton2DAnimationTargetBinder.js +2 -0
- package/dist/Skeleton2DAnimationTargetBinder.js.map +1 -0
- package/dist/Skeleton2DAnimationTargetContract.d.ts +9 -0
- package/dist/Skeleton2DAnimationTargetContract.d.ts.map +1 -0
- package/dist/Skeleton2DAnimationTargetContract.js +2 -0
- package/dist/Skeleton2DAnimationTargetContract.js.map +1 -0
- package/dist/Skeleton2DAnimationTargetKind.d.ts +9 -0
- package/dist/Skeleton2DAnimationTargetKind.d.ts.map +1 -0
- package/dist/Skeleton2DAnimationTargetKind.js +20 -0
- package/dist/Skeleton2DAnimationTargetKind.js.map +1 -0
- package/dist/Skeleton2DConstraintContract.d.ts +37 -0
- package/dist/Skeleton2DConstraintContract.d.ts.map +1 -0
- package/dist/Skeleton2DConstraintContract.js +10 -0
- package/dist/Skeleton2DConstraintContract.js.map +1 -0
- package/dist/Skeleton2DContract.d.ts +13 -0
- package/dist/Skeleton2DContract.d.ts.map +1 -0
- package/dist/Skeleton2DContract.js +2 -0
- package/dist/Skeleton2DContract.js.map +1 -0
- package/dist/Skeleton2DDeformAnimationTarget.d.ts +22 -0
- package/dist/Skeleton2DDeformAnimationTarget.d.ts.map +1 -0
- package/dist/Skeleton2DDeformAnimationTarget.js +2 -0
- package/dist/Skeleton2DDeformAnimationTarget.js.map +1 -0
- package/dist/Skeleton2DDeformLengthExplanation.d.ts +21 -0
- package/dist/Skeleton2DDeformLengthExplanation.d.ts.map +1 -0
- package/dist/Skeleton2DDeformLengthExplanation.js +2 -0
- package/dist/Skeleton2DDeformLengthExplanation.js.map +1 -0
- package/dist/Skeleton2DDrawOrderAnimationTarget.d.ts +28 -0
- package/dist/Skeleton2DDrawOrderAnimationTarget.d.ts.map +1 -0
- package/dist/Skeleton2DDrawOrderAnimationTarget.js +2 -0
- package/dist/Skeleton2DDrawOrderAnimationTarget.js.map +1 -0
- package/dist/Skeleton2DDrawOrderTimeline.d.ts +24 -0
- package/dist/Skeleton2DDrawOrderTimeline.d.ts.map +1 -0
- package/dist/Skeleton2DDrawOrderTimeline.js +2 -0
- package/dist/Skeleton2DDrawOrderTimeline.js.map +1 -0
- package/dist/Skeleton2DGuardsContract.d.ts +38 -0
- package/dist/Skeleton2DGuardsContract.d.ts.map +1 -0
- package/dist/Skeleton2DGuardsContract.js +2 -0
- package/dist/Skeleton2DGuardsContract.js.map +1 -0
- package/dist/Skeleton2DIkConstraint.d.ts +29 -0
- package/dist/Skeleton2DIkConstraint.d.ts.map +1 -0
- package/dist/Skeleton2DIkConstraint.js +2 -0
- package/dist/Skeleton2DIkConstraint.js.map +1 -0
- package/dist/Skeleton2DPathConstraint.d.ts +53 -0
- package/dist/Skeleton2DPathConstraint.d.ts.map +1 -0
- package/dist/Skeleton2DPathConstraint.js +14 -0
- package/dist/Skeleton2DPathConstraint.js.map +1 -0
- package/dist/Skeleton2DSlotAnimationTarget.d.ts +15 -0
- package/dist/Skeleton2DSlotAnimationTarget.d.ts.map +1 -0
- package/dist/Skeleton2DSlotAnimationTarget.js +18 -0
- package/dist/Skeleton2DSlotAnimationTarget.js.map +1 -0
- package/dist/Skeleton2DSlotDeform.d.ts +29 -0
- package/dist/Skeleton2DSlotDeform.d.ts.map +1 -0
- package/dist/Skeleton2DSlotDeform.js +2 -0
- package/dist/Skeleton2DSlotDeform.js.map +1 -0
- package/dist/Skeleton2DTransformConstraint.d.ts +37 -0
- package/dist/Skeleton2DTransformConstraint.d.ts.map +1 -0
- package/dist/Skeleton2DTransformConstraint.js +2 -0
- package/dist/Skeleton2DTransformConstraint.js.map +1 -0
- package/dist/Skin2DContract.d.ts +6 -0
- package/dist/Skin2DContract.d.ts.map +1 -0
- package/dist/Skin2DContract.js +2 -0
- package/dist/Skin2DContract.js.map +1 -0
- package/dist/Slot2D.d.ts +10 -0
- package/dist/Slot2D.d.ts.map +1 -0
- package/dist/Slot2D.js +2 -0
- package/dist/Slot2D.js.map +1 -0
- package/dist/TransformInherit2D.d.ts +7 -0
- package/dist/TransformInherit2D.d.ts.map +1 -0
- package/dist/TransformInherit2D.js +2 -0
- package/dist/TransformInherit2D.js.map +1 -0
- package/dist/TransformMode2D.d.ts +33 -0
- package/dist/TransformMode2D.d.ts.map +1 -0
- package/dist/TransformMode2D.js +21 -0
- package/dist/TransformMode2D.js.map +1 -0
- package/dist/applyAnimationClipToSkeleton2D.d.ts +2 -1
- package/dist/applyAnimationClipToSkeleton2D.d.ts.map +1 -1
- package/dist/applyAnimationClipToSkeleton2D.js +1 -1
- package/dist/applyAnimationClipToSkeleton2D.js.map +1 -1
- package/dist/boundingBoxAttachment2D.d.ts +1 -1
- package/dist/boundingBoxAttachment2D.d.ts.map +1 -1
- package/dist/boundingBoxAttachment2D.js +1 -1
- package/dist/boundingBoxAttachment2D.js.map +1 -1
- package/dist/clippingAttachment2D.d.ts +1 -1
- package/dist/clippingAttachment2D.d.ts.map +1 -1
- package/dist/clippingAttachment2D.js +1 -1
- package/dist/clippingAttachment2D.js.map +1 -1
- package/dist/contract.d.ts +24 -25
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +24 -25
- package/dist/contract.js.map +1 -1
- package/dist/contract.skeleton2d-types.d.ts +30 -0
- package/dist/contract.skeleton2d-types.d.ts.map +1 -0
- package/dist/contract.skeleton2d-types.js +32 -0
- package/dist/contract.skeleton2d-types.js.map +1 -0
- package/dist/deformAnimationTarget2D.d.ts.map +1 -1
- package/dist/deformAnimationTarget2D.js +3 -3
- package/dist/deformAnimationTarget2D.js.map +1 -1
- package/dist/deformMeshAttachment2D.d.ts +1 -1
- package/dist/deformMeshAttachment2D.d.ts.map +1 -1
- package/dist/deformMeshAttachment2D.js +1 -1
- package/dist/deformMeshAttachment2D.js.map +1 -1
- package/dist/deformPathAttachment2D.d.ts +2 -1
- package/dist/deformPathAttachment2D.d.ts.map +1 -1
- package/dist/deformPathAttachment2D.js +1 -1
- package/dist/deformPathAttachment2D.js.map +1 -1
- package/dist/enableSkeleton2DGuards.d.ts +4 -1
- package/dist/enableSkeleton2DGuards.d.ts.map +1 -1
- package/dist/enableSkeleton2DGuards.js +11 -9
- package/dist/enableSkeleton2DGuards.js.map +1 -1
- package/dist/explainSkeleton2DChannel.d.ts +2 -1
- package/dist/explainSkeleton2DChannel.d.ts.map +1 -1
- package/dist/explainSkeleton2DChannel.js.map +1 -1
- package/dist/explainSkeleton2DDeformLength.d.ts +1 -1
- package/dist/explainSkeleton2DDeformLength.d.ts.map +1 -1
- package/dist/ikConstraint2D.d.ts +1 -1
- package/dist/ikConstraint2D.d.ts.map +1 -1
- package/dist/ikConstraint2D.js +4 -4
- package/dist/ikConstraint2D.js.map +1 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -1
- package/dist/index.js.map +1 -1
- package/dist/pathConstraint2D.d.ts +1 -1
- package/dist/pathConstraint2D.d.ts.map +1 -1
- package/dist/pathConstraint2D.js +5 -5
- package/dist/pathConstraint2D.js.map +1 -1
- package/dist/pointAttachment2D.d.ts +2 -1
- package/dist/pointAttachment2D.d.ts.map +1 -1
- package/dist/pointAttachment2D.js +1 -1
- package/dist/pointAttachment2D.js.map +1 -1
- package/dist/regionAttachment2D.d.ts +1 -1
- package/dist/regionAttachment2D.d.ts.map +1 -1
- package/dist/regionAttachment2D.js +1 -1
- package/dist/regionAttachment2D.js.map +1 -1
- package/dist/skeleton2d.d.ts +3 -1
- package/dist/skeleton2d.d.ts.map +1 -1
- package/dist/skeleton2d.js +4 -4
- package/dist/skeleton2d.js.map +1 -1
- package/dist/skeleton2dAnimationTarget.d.ts +2 -1
- package/dist/skeleton2dAnimationTarget.d.ts.map +1 -1
- package/dist/skeleton2dAnimationTarget.js +14 -14
- package/dist/skeleton2dAnimationTarget.js.map +1 -1
- package/dist/skeleton2dConstraint.d.ts +1 -1
- package/dist/skeleton2dConstraint.d.ts.map +1 -1
- package/dist/skeleton2dDrawOrderTarget.d.ts +7 -4
- package/dist/skeleton2dDrawOrderTarget.d.ts.map +1 -1
- package/dist/skeleton2dDrawOrderTarget.js +5 -5
- package/dist/skeleton2dDrawOrderTarget.js.map +1 -1
- package/dist/skeleton2dGuards.d.ts +1 -1
- package/dist/skeleton2dGuards.d.ts.map +1 -1
- package/dist/skin2D.d.ts +2 -1
- package/dist/skin2D.d.ts.map +1 -1
- package/dist/skin2D.js +2 -2
- package/dist/skin2D.js.map +1 -1
- package/dist/skinAttachment2DPoints.d.ts +1 -1
- package/dist/skinAttachment2DPoints.d.ts.map +1 -1
- package/dist/skinAttachment2DPoints.js +2 -2
- package/dist/skinAttachment2DPoints.js.map +1 -1
- package/dist/slotDeform2D.d.ts +1 -1
- package/dist/slotDeform2D.d.ts.map +1 -1
- package/dist/transformConstraint2D.d.ts +1 -1
- package/dist/transformConstraint2D.d.ts.map +1 -1
- package/dist/transformConstraint2D.js +4 -4
- package/dist/transformConstraint2D.js.map +1 -1
- package/package.json +12 -11
- package/src/applyAnimationClipToSkeleton2D.test.ts +9 -10
- package/src/boundingBoxAttachment2D.test.ts +7 -7
- package/src/clippingAttachment2D.test.ts +6 -6
- package/src/deformAnimationTarget2D.test.ts +10 -10
- package/src/deformMeshAttachment2D.test.ts +10 -10
- package/src/deformPathAttachment2D.test.ts +13 -10
- package/src/enableSkeleton2DGuards.test.ts +17 -16
- package/src/explainSkeleton2DChannel.test.ts +5 -2
- package/src/explainSkeleton2DDeformLength.test.ts +3 -3
- package/src/ikConstraint2D.test.ts +7 -7
- package/src/pathConstraint2D.test.ts +20 -14
- package/src/pointAttachment2D.test.ts +6 -6
- package/src/regionAttachment2D.test.ts +6 -6
- package/src/skeleton2d.test.ts +5 -5
- package/src/skeleton2dAnimationTarget.test.ts +7 -7
- package/src/skeleton2dConstraint.test.ts +7 -7
- package/src/skeleton2dDrawOrderTarget.test.ts +5 -4
- package/src/skeleton2dGuards.test.ts +2 -3
- package/src/skin2D.test.ts +2 -2
- package/src/skinAttachment2DPoints.test.ts +6 -6
- package/src/slotDeform2D.test.ts +6 -6
- package/src/transformConstraint2D.test.ts +7 -7
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import type { LogState } from '@flighthq/log/contract';
|
|
2
|
+
import { createLogState, setLogSink } from '@flighthq/log/contract';
|
|
3
|
+
import type { LogEntry } from '@flighthq/log/contract';
|
|
3
4
|
|
|
4
|
-
import { disableSkeleton2DGuards, enableSkeleton2DGuards } from './enableSkeleton2DGuards';
|
|
5
|
-
import { reportSkeleton2DCoercedInterpolation, reportSkeleton2DDeformLengthMismatch } from './skeleton2dGuards';
|
|
5
|
+
import { disableSkeleton2DGuards, enableSkeleton2DGuards } from './enableSkeleton2DGuards.ts';
|
|
6
|
+
import { reportSkeleton2DCoercedInterpolation, reportSkeleton2DDeformLengthMismatch } from './skeleton2dGuards.ts';
|
|
6
7
|
|
|
7
|
-
// Each case uses its own subject string. `logOnce` keys
|
|
8
|
-
// behaviour a shipped app wants — one warning per subject, not one per frame
|
|
9
|
-
//
|
|
8
|
+
// Each case uses its own subject string. `logOnce` keys last for the LogState's lifetime, which is the
|
|
9
|
+
// behaviour a shipped app wants — one warning per subject, not one per frame. Every case gets a fresh
|
|
10
|
+
// state here, so no case can be silently suppressed by another.
|
|
10
11
|
const entries: LogEntry[] = [];
|
|
12
|
+
let logState: LogState;
|
|
11
13
|
|
|
12
14
|
beforeEach(() => {
|
|
13
|
-
|
|
15
|
+
logState = createLogState();
|
|
14
16
|
entries.length = 0;
|
|
15
|
-
setLogSink((entry) => void entries.push(entry));
|
|
17
|
+
setLogSink(logState, (entry) => void entries.push(entry));
|
|
16
18
|
});
|
|
17
19
|
|
|
18
20
|
afterEach(() => {
|
|
19
21
|
disableSkeleton2DGuards();
|
|
20
|
-
setLogSink(null);
|
|
21
22
|
});
|
|
22
23
|
|
|
23
24
|
describe('disableSkeleton2DGuards', () => {
|
|
24
25
|
it('silences both cases again', () => {
|
|
25
|
-
enableSkeleton2DGuards();
|
|
26
|
+
enableSkeleton2DGuards(logState, 0);
|
|
26
27
|
disableSkeleton2DGuards();
|
|
27
28
|
|
|
28
29
|
reportSkeleton2DCoercedInterpolation('DisabledChannel', 'Linear', 'Step');
|
|
@@ -40,7 +41,7 @@ describe('enableSkeleton2DGuards', () => {
|
|
|
40
41
|
});
|
|
41
42
|
|
|
42
43
|
it('names what was stated and what actually happens to a coerced channel', () => {
|
|
43
|
-
enableSkeleton2DGuards();
|
|
44
|
+
enableSkeleton2DGuards(logState, 0);
|
|
44
45
|
|
|
45
46
|
reportSkeleton2DCoercedInterpolation('StatedAndApplied', 'Linear', 'Step');
|
|
46
47
|
|
|
@@ -52,7 +53,7 @@ describe('enableSkeleton2DGuards', () => {
|
|
|
52
53
|
});
|
|
53
54
|
|
|
54
55
|
it('reports both lengths on a deform mismatch, and why nothing was applied', () => {
|
|
55
|
-
enableSkeleton2DGuards();
|
|
56
|
+
enableSkeleton2DGuards(logState, 0);
|
|
56
57
|
|
|
57
58
|
reportSkeleton2DDeformLengthMismatch('BothLengths', 6, 8);
|
|
58
59
|
|
|
@@ -63,7 +64,7 @@ describe('enableSkeleton2DGuards', () => {
|
|
|
63
64
|
});
|
|
64
65
|
|
|
65
66
|
it('keys the coercion message per subject, so two families both get heard', () => {
|
|
66
|
-
enableSkeleton2DGuards();
|
|
67
|
+
enableSkeleton2DGuards(logState, 0);
|
|
67
68
|
|
|
68
69
|
reportSkeleton2DCoercedInterpolation('PerSubjectOne', 'Linear', 'Step');
|
|
69
70
|
reportSkeleton2DCoercedInterpolation('PerSubjectTwo', 'Linear', 'Step');
|
|
@@ -74,8 +75,8 @@ describe('enableSkeleton2DGuards', () => {
|
|
|
74
75
|
});
|
|
75
76
|
|
|
76
77
|
it('installs one guard however many times it is enabled', () => {
|
|
77
|
-
enableSkeleton2DGuards();
|
|
78
|
-
enableSkeleton2DGuards();
|
|
78
|
+
enableSkeleton2DGuards(logState, 0);
|
|
79
|
+
enableSkeleton2DGuards(logState, 0);
|
|
79
80
|
|
|
80
81
|
reportSkeleton2DDeformLengthMismatch('EnabledTwice', 6, 8);
|
|
81
82
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { createAnimationChannel, createAnimationTrack } from '@flighthq/animation/contract';
|
|
2
|
-
import type { AnimationChannel, AnimationInterpolation } from '@flighthq/
|
|
2
|
+
import type { AnimationChannel, AnimationInterpolation } from '@flighthq/animation/contract';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
explainSkeleton2DChannelInterpolation,
|
|
6
|
+
isSkeleton2DSteppedChannelSubject,
|
|
7
|
+
} from './explainSkeleton2DChannel.ts';
|
|
5
8
|
|
|
6
9
|
describe('explainSkeleton2DChannelInterpolation', () => {
|
|
7
10
|
it('reports the override a non-step attachment channel will receive', () => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Skin2D } from '@flighthq/types/contract';
|
|
2
1
|
import { describe, expect, it } from 'vitest';
|
|
3
2
|
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import type { Skin2D } from './contract.skeleton2d-types.ts';
|
|
4
|
+
import { explainSkeleton2DDeformLength } from './explainSkeleton2DDeformLength.ts';
|
|
5
|
+
import { createSkin2D } from './skin2D.ts';
|
|
6
6
|
|
|
7
7
|
// One vertex bound to two bones: eight floats of influence data, so the deform stream it parallels is
|
|
8
8
|
// FOUR floats — twice what a per-vertex reading predicts.
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { allocateEntity
|
|
2
|
-
import type { Bone2D, Skeleton2D, Skeleton2DIkConstraint } from '@flighthq/types/contract';
|
|
3
|
-
import { Skeleton2DConstraintKind, TransformMode2D } from '@flighthq/types/contract';
|
|
1
|
+
import { allocateEntity } from '@flighthq/entity/contract';
|
|
4
2
|
import { afterEach, describe, expect, it } from 'vitest';
|
|
5
3
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import type { Bone2D, Skeleton2D, Skeleton2DIkConstraint } from './contract.skeleton2d-types.ts';
|
|
5
|
+
import { Skeleton2DConstraintKind, TransformMode2D } from './contract.skeleton2d-types.ts';
|
|
6
|
+
import { registerSkeleton2DIkConstraintSolver, solveSkeleton2DIkConstraint } from './ikConstraint2D.ts';
|
|
7
|
+
import { computeSkeleton2DWorldTransforms, createSkeleton2D } from './skeleton2d.ts';
|
|
8
8
|
import {
|
|
9
9
|
getSkeleton2DConstraintSolver,
|
|
10
10
|
registerSkeleton2DConstraintSolver,
|
|
11
11
|
solveSkeleton2DConstraints,
|
|
12
12
|
unregisterSkeleton2DConstraintSolver,
|
|
13
|
-
} from './skeleton2dConstraint';
|
|
13
|
+
} from './skeleton2dConstraint.ts';
|
|
14
14
|
|
|
15
15
|
function makeBone(overrides: Partial<Bone2D> = {}): Bone2D {
|
|
16
16
|
return {
|
|
@@ -39,7 +39,7 @@ function ik(overrides: Partial<Skeleton2DIkConstraint> = {}): Skeleton2DIkConstr
|
|
|
39
39
|
out.stretch = false;
|
|
40
40
|
out.targetBoneIndex = 1;
|
|
41
41
|
Object.assign(out, overrides);
|
|
42
|
-
return
|
|
42
|
+
return out as Skeleton2DIkConstraint;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
// The world position of a bone's TIP — its origin plus its length along its own x axis. That is the point
|
|
@@ -1,23 +1,29 @@
|
|
|
1
|
-
import { allocateEntity
|
|
2
|
-
import
|
|
1
|
+
import { allocateEntity } from '@flighthq/entity/contract';
|
|
2
|
+
import { PathCommand } from '@flighthq/path/contract';
|
|
3
|
+
import { afterEach, describe, expect, it } from 'vitest';
|
|
4
|
+
|
|
5
|
+
import type {
|
|
6
|
+
Bone2D,
|
|
7
|
+
PathAttachment2D,
|
|
8
|
+
Skeleton2D,
|
|
9
|
+
Skeleton2DPathConstraint,
|
|
10
|
+
Slot2D,
|
|
11
|
+
} from './contract.skeleton2d-types.ts';
|
|
3
12
|
import {
|
|
4
13
|
PathAttachment2DKind,
|
|
5
|
-
PathCommand,
|
|
6
14
|
Skeleton2DConstraintKind,
|
|
7
15
|
Skeleton2DPathPositionMode,
|
|
8
16
|
Skeleton2DPathRotateMode,
|
|
9
17
|
Skeleton2DPathSpacingMode,
|
|
10
18
|
TransformMode2D,
|
|
11
|
-
} from '
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
import { registerSkeleton2DPathConstraintSolver, solveSkeleton2DPathConstraint } from './pathConstraint2D';
|
|
15
|
-
import { computeSkeleton2DWorldTransforms, createSkeleton2D } from './skeleton2d';
|
|
19
|
+
} from './contract.skeleton2d-types.ts';
|
|
20
|
+
import { registerSkeleton2DPathConstraintSolver, solveSkeleton2DPathConstraint } from './pathConstraint2D.ts';
|
|
21
|
+
import { computeSkeleton2DWorldTransforms, createSkeleton2D } from './skeleton2d.ts';
|
|
16
22
|
import {
|
|
17
23
|
getSkeleton2DConstraintSolver,
|
|
18
24
|
registerSkeleton2DConstraintSolver,
|
|
19
25
|
unregisterSkeleton2DConstraintSolver,
|
|
20
|
-
} from './skeleton2dConstraint';
|
|
26
|
+
} from './skeleton2dConstraint.ts';
|
|
21
27
|
|
|
22
28
|
function makeBone(overrides: Partial<Bone2D> = {}): Bone2D {
|
|
23
29
|
return {
|
|
@@ -46,7 +52,7 @@ function straightPath(): PathAttachment2D {
|
|
|
46
52
|
out.skin = null;
|
|
47
53
|
out.vertices = new Float32Array([0, 0, 100, 0]);
|
|
48
54
|
out.winding = 'nonZero' as const;
|
|
49
|
-
return
|
|
55
|
+
return out as PathAttachment2D;
|
|
50
56
|
}
|
|
51
57
|
|
|
52
58
|
function pathSlot(attachment: PathAttachment2D | null): Slot2D {
|
|
@@ -68,7 +74,7 @@ function constraint(overrides: Partial<Skeleton2DPathConstraint> = {}): Skeleton
|
|
|
68
74
|
out.spacingMode = Skeleton2DPathSpacingMode.Fixed;
|
|
69
75
|
out.targetSlotIndex = 0;
|
|
70
76
|
Object.assign(out, overrides);
|
|
71
|
-
return
|
|
77
|
+
return out as Skeleton2DPathConstraint;
|
|
72
78
|
}
|
|
73
79
|
|
|
74
80
|
// Bone 0 carries the path slot; bones 1..n are the chain laid along it.
|
|
@@ -211,7 +217,7 @@ describe('solveSkeleton2DPathConstraint', () => {
|
|
|
211
217
|
out.skin = null;
|
|
212
218
|
out.vertices = new Float32Array([0, 0, 0, 100]);
|
|
213
219
|
out.winding = 'nonZero' as const;
|
|
214
|
-
return
|
|
220
|
+
return out as PathAttachment2D;
|
|
215
221
|
})(),
|
|
216
222
|
);
|
|
217
223
|
skeleton.bones[1].x = 40;
|
|
@@ -236,7 +242,7 @@ describe('solveSkeleton2DPathConstraint', () => {
|
|
|
236
242
|
out.skin = null;
|
|
237
243
|
out.vertices = new Float32Array([0, 0, 0, 100]);
|
|
238
244
|
out.winding = 'nonZero' as const;
|
|
239
|
-
return
|
|
245
|
+
return out as PathAttachment2D;
|
|
240
246
|
})(),
|
|
241
247
|
);
|
|
242
248
|
|
|
@@ -257,7 +263,7 @@ describe('solveSkeleton2DPathConstraint', () => {
|
|
|
257
263
|
out.skin = null;
|
|
258
264
|
out.vertices = new Float32Array([0, 0, 50, 0, 50, 50]);
|
|
259
265
|
out.winding = 'nonZero' as const;
|
|
260
|
-
return
|
|
266
|
+
return out as PathAttachment2D;
|
|
261
267
|
})(),
|
|
262
268
|
);
|
|
263
269
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { allocateEntity
|
|
2
|
-
import type { Bone2D, PointAttachment2D } from '@flighthq/types/contract';
|
|
3
|
-
import { PointAttachment2DKind, TransformMode2D } from '@flighthq/types/contract';
|
|
1
|
+
import { allocateEntity } from '@flighthq/entity/contract';
|
|
4
2
|
import { describe, expect, it } from 'vitest';
|
|
5
3
|
|
|
4
|
+
import type { Bone2D, PointAttachment2D } from './contract.skeleton2d-types.ts';
|
|
5
|
+
import { PointAttachment2DKind, TransformMode2D } from './contract.skeleton2d-types.ts';
|
|
6
6
|
import {
|
|
7
7
|
computeSkeleton2DPointAttachmentPosition,
|
|
8
8
|
computeSkeleton2DPointAttachmentRotation,
|
|
9
|
-
} from './pointAttachment2D';
|
|
10
|
-
import { computeSkeleton2DWorldTransforms, createSkeleton2D } from './skeleton2d';
|
|
9
|
+
} from './pointAttachment2D.ts';
|
|
10
|
+
import { computeSkeleton2DWorldTransforms, createSkeleton2D } from './skeleton2d.ts';
|
|
11
11
|
|
|
12
12
|
function makeBone(overrides: Partial<Bone2D> = {}): Bone2D {
|
|
13
13
|
return {
|
|
@@ -32,7 +32,7 @@ function point(x: number, y: number, rotation: number): PointAttachment2D {
|
|
|
32
32
|
out.rotation = rotation;
|
|
33
33
|
out.x = x;
|
|
34
34
|
out.y = y;
|
|
35
|
-
return
|
|
35
|
+
return out as PointAttachment2D;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
describe('computeSkeleton2DPointAttachmentPosition', () => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { allocateEntity
|
|
2
|
-
import type { Bone2D, RegionAttachment2D } from '@flighthq/types/contract';
|
|
3
|
-
import { RegionAttachment2DKind, TransformMode2D } from '@flighthq/types/contract';
|
|
1
|
+
import { allocateEntity } from '@flighthq/entity/contract';
|
|
4
2
|
import { describe, expect, it } from 'vitest';
|
|
5
3
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import type { Bone2D, RegionAttachment2D } from './contract.skeleton2d-types.ts';
|
|
5
|
+
import { RegionAttachment2DKind, TransformMode2D } from './contract.skeleton2d-types.ts';
|
|
6
|
+
import { computeSkeleton2DRegionAttachmentVertices } from './regionAttachment2D.ts';
|
|
7
|
+
import { computeSkeleton2DWorldTransforms, createSkeleton2D } from './skeleton2d.ts';
|
|
8
8
|
|
|
9
9
|
function makeBone(overrides: Partial<Bone2D> = {}): Bone2D {
|
|
10
10
|
return {
|
|
@@ -34,7 +34,7 @@ function region(overrides: Partial<RegionAttachment2D> = {}): RegionAttachment2D
|
|
|
34
34
|
out.x = 0;
|
|
35
35
|
out.y = 0;
|
|
36
36
|
Object.assign(out, overrides);
|
|
37
|
-
return
|
|
37
|
+
return out as RegionAttachment2D;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
describe('computeSkeleton2DRegionAttachmentVertices', () => {
|
package/src/skeleton2d.test.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { allocateEntity
|
|
1
|
+
import { allocateEntity } from '@flighthq/entity/contract';
|
|
2
2
|
import { createMatrix } from '@flighthq/geometry/contract';
|
|
3
|
-
import type { Bone2D, RegionAttachment2D, Slot2D } from '@flighthq/types/contract';
|
|
4
|
-
import { RegionAttachment2DKind, TransformMode2D } from '@flighthq/types/contract';
|
|
5
3
|
import { describe, expect, it } from 'vitest';
|
|
6
4
|
|
|
5
|
+
import type { Bone2D, RegionAttachment2D, Slot2D } from './contract.skeleton2d-types.ts';
|
|
6
|
+
import { RegionAttachment2DKind, TransformMode2D } from './contract.skeleton2d-types.ts';
|
|
7
7
|
import {
|
|
8
8
|
cloneSkeleton2D,
|
|
9
9
|
computeSkeleton2DBoneMatrices,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
setSkeleton2DBindPose,
|
|
21
21
|
setSkeleton2DSkin,
|
|
22
22
|
validateSkeleton2D,
|
|
23
|
-
} from './skeleton2d';
|
|
23
|
+
} from './skeleton2d.ts';
|
|
24
24
|
|
|
25
25
|
function makeBone(overrides: Partial<Bone2D> = {}): Bone2D {
|
|
26
26
|
return {
|
|
@@ -514,7 +514,7 @@ function testRegion(name: string): RegionAttachment2D {
|
|
|
514
514
|
out.width = 0;
|
|
515
515
|
out.x = 0;
|
|
516
516
|
out.y = 0;
|
|
517
|
-
return
|
|
517
|
+
return out as RegionAttachment2D;
|
|
518
518
|
}
|
|
519
519
|
describe('validateSkeleton2D', () => {
|
|
520
520
|
it('returns null for a valid parent-before-child skeleton', () => {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { createAnimationChannel, createAnimationClip, createAnimationTrack } from '@flighthq/animation/contract';
|
|
2
|
-
import
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
|
|
4
|
+
import { applyAnimationClipToSkeleton2D } from './applyAnimationClipToSkeleton2D.ts';
|
|
5
|
+
import type { Bone2D, Skeleton2D } from './contract.skeleton2d-types.ts';
|
|
3
6
|
import {
|
|
4
7
|
Skeleton2DAnimationPath,
|
|
5
8
|
Skeleton2DAnimationTargetKind,
|
|
6
9
|
Skeleton2DSlotAnimationPath,
|
|
7
10
|
TransformMode2D,
|
|
8
|
-
} from '
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
import { applyAnimationClipToSkeleton2D } from './applyAnimationClipToSkeleton2D';
|
|
12
|
-
import { cloneSkeleton2D, createSkeleton2D } from './skeleton2d';
|
|
11
|
+
} from './contract.skeleton2d-types.ts';
|
|
12
|
+
import { cloneSkeleton2D, createSkeleton2D } from './skeleton2d.ts';
|
|
13
13
|
import {
|
|
14
14
|
createSkeleton2DBoneAnimationTarget,
|
|
15
15
|
createSkeleton2DSlotAnimationTarget,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
initializeSkeleton2DSlotAnimationTarget,
|
|
21
21
|
registerSkeleton2DAnimationTargetBinder,
|
|
22
22
|
unregisterSkeleton2DAnimationTargetBinder,
|
|
23
|
-
} from './skeleton2dAnimationTarget';
|
|
23
|
+
} from './skeleton2dAnimationTarget.ts';
|
|
24
24
|
|
|
25
25
|
describe('createSkeleton2DBoneAnimationTarget', () => {
|
|
26
26
|
it('stamps the bone kind, which is what the binder dispatches on', () => {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { allocateEntity
|
|
2
|
-
import type { Bone2D, Skeleton2DConstraint } from '@flighthq/types/contract';
|
|
3
|
-
import { Skeleton2DConstraintKind, TransformMode2D } from '@flighthq/types/contract';
|
|
1
|
+
import { allocateEntity } from '@flighthq/entity/contract';
|
|
4
2
|
import { afterEach, describe, expect, it } from 'vitest';
|
|
5
3
|
|
|
6
|
-
import {
|
|
4
|
+
import type { Bone2D, Skeleton2DConstraint } from './contract.skeleton2d-types.ts';
|
|
5
|
+
import { Skeleton2DConstraintKind, TransformMode2D } from './contract.skeleton2d-types.ts';
|
|
6
|
+
import { computeSkeleton2DWorldTransforms, createSkeleton2D } from './skeleton2d.ts';
|
|
7
7
|
import {
|
|
8
8
|
getSkeleton2DConstraintSolver,
|
|
9
9
|
registerSkeleton2DConstraintSolver,
|
|
10
10
|
solveSkeleton2DConstraints,
|
|
11
11
|
unregisterSkeleton2DConstraintSolver,
|
|
12
|
-
} from './skeleton2dConstraint';
|
|
12
|
+
} from './skeleton2dConstraint.ts';
|
|
13
13
|
|
|
14
14
|
function makeBone(overrides: Partial<Bone2D> = {}): Bone2D {
|
|
15
15
|
return {
|
|
@@ -32,7 +32,7 @@ function constraint(kind: string): Skeleton2DConstraint {
|
|
|
32
32
|
const out = allocateEntity<Skeleton2DConstraint>();
|
|
33
33
|
out.kind = kind;
|
|
34
34
|
out.mix = 1;
|
|
35
|
-
return
|
|
35
|
+
return out as Skeleton2DConstraint;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
// The registry is a module GLOBAL, deliberately: last-write-wins is what lets a caller replace a built-in
|
|
@@ -109,7 +109,7 @@ describe('solveSkeleton2DConstraints', () => {
|
|
|
109
109
|
out.kind = 'acme.Rope';
|
|
110
110
|
out.mix = 0.25;
|
|
111
111
|
out.slack = 3;
|
|
112
|
-
return
|
|
112
|
+
return out as Skeleton2DConstraint;
|
|
113
113
|
})();
|
|
114
114
|
|
|
115
115
|
solveSkeleton2DConstraints(skeleton, [rope]);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createAnimationChannel, createAnimationTrack } from '@flighthq/animation/contract';
|
|
2
|
+
import type { AnimationChannel, AnimationInterpolation } from '@flighthq/animation/contract';
|
|
2
3
|
import {
|
|
3
4
|
addNodeChild,
|
|
4
5
|
applyNodeOrderList,
|
|
@@ -6,17 +7,17 @@ import {
|
|
|
6
7
|
createNodeOrderList,
|
|
7
8
|
getNodeChildAt,
|
|
8
9
|
} from '@flighthq/node/contract';
|
|
9
|
-
import type {
|
|
10
|
+
import type { Node, NodeOrderList } from '@flighthq/node/contract';
|
|
10
11
|
|
|
11
|
-
import { getSkeleton2DAnimationTargetBinder } from './skeleton2dAnimationTarget';
|
|
12
|
+
import { getSkeleton2DAnimationTargetBinder } from './skeleton2dAnimationTarget.ts';
|
|
12
13
|
import {
|
|
13
14
|
createSkeleton2DDrawOrderAnimationTarget,
|
|
14
15
|
createSkeleton2DDrawOrderChannel,
|
|
15
16
|
initializeSkeleton2DDrawOrderAnimationTarget,
|
|
16
17
|
registerSkeleton2DDrawOrderAnimationBinder,
|
|
17
18
|
unregisterSkeleton2DDrawOrderAnimationBinder,
|
|
18
|
-
} from './skeleton2dDrawOrderTarget';
|
|
19
|
-
import { setSkeleton2DCoercedInterpolationGuard } from './skeleton2dGuards';
|
|
19
|
+
} from './skeleton2dDrawOrderTarget.ts';
|
|
20
|
+
import { setSkeleton2DCoercedInterpolationGuard } from './skeleton2dGuards.ts';
|
|
20
21
|
|
|
21
22
|
afterEach(() => {
|
|
22
23
|
unregisterSkeleton2DDrawOrderAnimationBinder();
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { Skeleton2DCoercedInterpolation, Skeleton2DDeformLengthMismatch } from '
|
|
2
|
-
|
|
1
|
+
import type { Skeleton2DCoercedInterpolation, Skeleton2DDeformLengthMismatch } from './contract.skeleton2d-types.ts';
|
|
3
2
|
import {
|
|
4
3
|
reportSkeleton2DCoercedInterpolation,
|
|
5
4
|
reportSkeleton2DDeformLengthMismatch,
|
|
6
5
|
setSkeleton2DCoercedInterpolationGuard,
|
|
7
6
|
setSkeleton2DDeformLengthGuard,
|
|
8
|
-
} from './skeleton2dGuards';
|
|
7
|
+
} from './skeleton2dGuards.ts';
|
|
9
8
|
|
|
10
9
|
afterEach(() => {
|
|
11
10
|
setSkeleton2DCoercedInterpolationGuard(null);
|
package/src/skin2D.test.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EntityRuntimeKey } from '@flighthq/
|
|
1
|
+
import { EntityRuntimeKey } from '@flighthq/entity/contract';
|
|
2
2
|
|
|
3
|
-
import { createSkin2D, initializeSkin2D } from './skin2D';
|
|
3
|
+
import { createSkin2D, initializeSkin2D } from './skin2D.ts';
|
|
4
4
|
|
|
5
5
|
describe('createSkin2D', () => {
|
|
6
6
|
it('adopts the streams it is given rather than copying them', () => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { Bone2D, Skin2D } from '@flighthq/types/contract';
|
|
2
|
-
import { TransformMode2D } from '@flighthq/types/contract';
|
|
3
1
|
import { describe, expect, it } from 'vitest';
|
|
4
2
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
3
|
+
import type { Bone2D, Skin2D } from './contract.skeleton2d-types.ts';
|
|
4
|
+
import { TransformMode2D } from './contract.skeleton2d-types.ts';
|
|
5
|
+
import { computeSkeleton2DWorldTransforms, createSkeleton2D } from './skeleton2d.ts';
|
|
6
|
+
import { setSkeleton2DDeformLengthGuard } from './skeleton2dGuards.ts';
|
|
7
|
+
import { createSkin2D } from './skin2D.ts';
|
|
8
|
+
import { skinSkeleton2DAttachmentPoints } from './skinAttachment2DPoints.ts';
|
|
9
9
|
|
|
10
10
|
function makeBone(overrides: Partial<Bone2D> = {}): Bone2D {
|
|
11
11
|
return {
|
package/src/slotDeform2D.test.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { allocateEntity
|
|
2
|
-
import type { Attachment2D, MeshAttachment2D, Skin2D, Slot2D } from '@flighthq/types/contract';
|
|
3
|
-
import { MeshAttachment2DKind } from '@flighthq/types/contract';
|
|
1
|
+
import { allocateEntity } from '@flighthq/entity/contract';
|
|
4
2
|
import { describe, expect, it } from 'vitest';
|
|
5
3
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import type { Attachment2D, MeshAttachment2D, Skin2D, Slot2D } from './contract.skeleton2d-types.ts';
|
|
5
|
+
import { MeshAttachment2DKind } from './contract.skeleton2d-types.ts';
|
|
6
|
+
import { createSkin2D } from './skin2D.ts';
|
|
7
|
+
import { getSkeleton2DSlotDeformOffsets, setSkeleton2DSlotDeform } from './slotDeform2D.ts';
|
|
8
8
|
|
|
9
9
|
function slot(attachment: Attachment2D | null): Slot2D {
|
|
10
10
|
return { attachment, boneIndex: 0, color: 0xffffffff, name: 's' };
|
|
@@ -19,7 +19,7 @@ function mesh(pointCount: number): MeshAttachment2D {
|
|
|
19
19
|
out.uvs = new Float32Array(pointCount * 2);
|
|
20
20
|
out.vertexCount = pointCount;
|
|
21
21
|
out.vertices = null;
|
|
22
|
-
return
|
|
22
|
+
return out as MeshAttachment2D;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
describe('getSkeleton2DSlotDeformOffsets', () => {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { allocateEntity
|
|
2
|
-
import type { Bone2D, Skeleton2DTransformConstraint } from '@flighthq/types/contract';
|
|
3
|
-
import { Skeleton2DConstraintKind, TransformMode2D } from '@flighthq/types/contract';
|
|
1
|
+
import { allocateEntity } from '@flighthq/entity/contract';
|
|
4
2
|
import { afterEach, describe, expect, it } from 'vitest';
|
|
5
3
|
|
|
6
|
-
import {
|
|
4
|
+
import type { Bone2D, Skeleton2DTransformConstraint } from './contract.skeleton2d-types.ts';
|
|
5
|
+
import { Skeleton2DConstraintKind, TransformMode2D } from './contract.skeleton2d-types.ts';
|
|
6
|
+
import { computeSkeleton2DWorldTransforms, createSkeleton2D } from './skeleton2d.ts';
|
|
7
7
|
import {
|
|
8
8
|
getSkeleton2DConstraintSolver,
|
|
9
9
|
registerSkeleton2DConstraintSolver,
|
|
10
10
|
unregisterSkeleton2DConstraintSolver,
|
|
11
|
-
} from './skeleton2dConstraint';
|
|
11
|
+
} from './skeleton2dConstraint.ts';
|
|
12
12
|
import {
|
|
13
13
|
registerSkeleton2DTransformConstraintSolver,
|
|
14
14
|
solveSkeleton2DTransformConstraint,
|
|
15
|
-
} from './transformConstraint2D';
|
|
15
|
+
} from './transformConstraint2D.ts';
|
|
16
16
|
|
|
17
17
|
function makeBone(overrides: Partial<Bone2D> = {}): Bone2D {
|
|
18
18
|
return {
|
|
@@ -51,7 +51,7 @@ function transform(overrides: Partial<Skeleton2DTransformConstraint> = {}): Skel
|
|
|
51
51
|
out.offsetY = 0;
|
|
52
52
|
out.targetBoneIndex = 1;
|
|
53
53
|
Object.assign(out, overrides);
|
|
54
|
-
return
|
|
54
|
+
return out as Skeleton2DTransformConstraint;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
// This file registers a built-in solver into a module-global registry, so it restores whatever it found
|