@aura3d/animation 1.0.6
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 +19 -0
- package/dist/AnimationAction.d.ts +40 -0
- package/dist/AnimationAction.d.ts.map +1 -0
- package/dist/AnimationAction.js +143 -0
- package/dist/AnimationAction.js.map +1 -0
- package/dist/AnimationClip.d.ts +24 -0
- package/dist/AnimationClip.d.ts.map +1 -0
- package/dist/AnimationClip.js +45 -0
- package/dist/AnimationClip.js.map +1 -0
- package/dist/AnimationClipEvents.d.ts +57 -0
- package/dist/AnimationClipEvents.d.ts.map +1 -0
- package/dist/AnimationClipEvents.js +171 -0
- package/dist/AnimationClipEvents.js.map +1 -0
- package/dist/AnimationClipRegistry.d.ts +76 -0
- package/dist/AnimationClipRegistry.d.ts.map +1 -0
- package/dist/AnimationClipRegistry.js +130 -0
- package/dist/AnimationClipRegistry.js.map +1 -0
- package/dist/AnimationController.d.ts +168 -0
- package/dist/AnimationController.d.ts.map +1 -0
- package/dist/AnimationController.js +619 -0
- package/dist/AnimationController.js.map +1 -0
- package/dist/AnimationEvents.d.ts +10 -0
- package/dist/AnimationEvents.d.ts.map +1 -0
- package/dist/AnimationEvents.js +26 -0
- package/dist/AnimationEvents.js.map +1 -0
- package/dist/AnimationLayer.d.ts +27 -0
- package/dist/AnimationLayer.d.ts.map +1 -0
- package/dist/AnimationLayer.js +53 -0
- package/dist/AnimationLayer.js.map +1 -0
- package/dist/AnimationMixer.d.ts +54 -0
- package/dist/AnimationMixer.d.ts.map +1 -0
- package/dist/AnimationMixer.js +319 -0
- package/dist/AnimationMixer.js.map +1 -0
- package/dist/AnimationStateGraph.d.ts +2 -0
- package/dist/AnimationStateGraph.d.ts.map +1 -0
- package/dist/AnimationStateGraph.js +2 -0
- package/dist/AnimationStateGraph.js.map +1 -0
- package/dist/AnimationStateMachine.d.ts +59 -0
- package/dist/AnimationStateMachine.d.ts.map +1 -0
- package/dist/AnimationStateMachine.js +154 -0
- package/dist/AnimationStateMachine.js.map +1 -0
- package/dist/AnimationTrack.d.ts +23 -0
- package/dist/AnimationTrack.d.ts.map +1 -0
- package/dist/AnimationTrack.js +124 -0
- package/dist/AnimationTrack.js.map +1 -0
- package/dist/BlendTree.d.ts +23 -0
- package/dist/BlendTree.d.ts.map +1 -0
- package/dist/BlendTree.js +68 -0
- package/dist/BlendTree.js.map +1 -0
- package/dist/Bone.d.ts +20 -0
- package/dist/Bone.d.ts.map +1 -0
- package/dist/Bone.js +24 -0
- package/dist/Bone.js.map +1 -0
- package/dist/CrowdAnimation.d.ts +13 -0
- package/dist/CrowdAnimation.d.ts.map +1 -0
- package/dist/CrowdAnimation.js +14 -0
- package/dist/CrowdAnimation.js.map +1 -0
- package/dist/ECSAnimationBridge.d.ts +9 -0
- package/dist/ECSAnimationBridge.d.ts.map +1 -0
- package/dist/ECSAnimationBridge.js +24 -0
- package/dist/ECSAnimationBridge.js.map +1 -0
- package/dist/HumanoidRetargeting.d.ts +76 -0
- package/dist/HumanoidRetargeting.d.ts.map +1 -0
- package/dist/HumanoidRetargeting.js +331 -0
- package/dist/HumanoidRetargeting.js.map +1 -0
- package/dist/IK.d.ts +24 -0
- package/dist/IK.d.ts.map +1 -0
- package/dist/IK.js +76 -0
- package/dist/IK.js.map +1 -0
- package/dist/Keyframe.d.ts +50 -0
- package/dist/Keyframe.d.ts.map +1 -0
- package/dist/Keyframe.js +118 -0
- package/dist/Keyframe.js.map +1 -0
- package/dist/LocomotionController.d.ts +47 -0
- package/dist/LocomotionController.d.ts.map +1 -0
- package/dist/LocomotionController.js +106 -0
- package/dist/LocomotionController.js.map +1 -0
- package/dist/MotionMatchingFixtures.d.ts +58 -0
- package/dist/MotionMatchingFixtures.d.ts.map +1 -0
- package/dist/MotionMatchingFixtures.js +175 -0
- package/dist/MotionMatchingFixtures.js.map +1 -0
- package/dist/MotionQuality.d.ts +36 -0
- package/dist/MotionQuality.d.ts.map +1 -0
- package/dist/MotionQuality.js +117 -0
- package/dist/MotionQuality.js.map +1 -0
- package/dist/Retargeting.d.ts +12 -0
- package/dist/Retargeting.d.ts.map +1 -0
- package/dist/Retargeting.js +19 -0
- package/dist/Retargeting.js.map +1 -0
- package/dist/RootMotion.d.ts +21 -0
- package/dist/RootMotion.d.ts.map +1 -0
- package/dist/RootMotion.js +84 -0
- package/dist/RootMotion.js.map +1 -0
- package/dist/SceneAnimationBridge.d.ts +18 -0
- package/dist/SceneAnimationBridge.d.ts.map +1 -0
- package/dist/SceneAnimationBridge.js +69 -0
- package/dist/SceneAnimationBridge.js.map +1 -0
- package/dist/SecondaryAnimationFixtures.d.ts +55 -0
- package/dist/SecondaryAnimationFixtures.d.ts.map +1 -0
- package/dist/SecondaryAnimationFixtures.js +147 -0
- package/dist/SecondaryAnimationFixtures.js.map +1 -0
- package/dist/Skeleton.d.ts +9 -0
- package/dist/Skeleton.d.ts.map +1 -0
- package/dist/Skeleton.js +31 -0
- package/dist/Skeleton.js.map +1 -0
- package/dist/Skinning.d.ts +7 -0
- package/dist/Skinning.d.ts.map +1 -0
- package/dist/Skinning.js +12 -0
- package/dist/Skinning.js.map +1 -0
- package/dist/browser-index.d.ts +39 -0
- package/dist/browser-index.d.ts.map +1 -0
- package/dist/browser-index.js +34 -0
- package/dist/browser-index.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/threejs-compatibility/AnimationAction.d.ts +16 -0
- package/dist/threejs-compatibility/AnimationAction.d.ts.map +1 -0
- package/dist/threejs-compatibility/AnimationAction.js +25 -0
- package/dist/threejs-compatibility/AnimationAction.js.map +1 -0
- package/dist/threejs-compatibility/AnimationClip.d.ts +14 -0
- package/dist/threejs-compatibility/AnimationClip.d.ts.map +1 -0
- package/dist/threejs-compatibility/AnimationClip.js +11 -0
- package/dist/threejs-compatibility/AnimationClip.js.map +1 -0
- package/dist/threejs-compatibility/AnimationDiagnostics.d.ts +44 -0
- package/dist/threejs-compatibility/AnimationDiagnostics.d.ts.map +1 -0
- package/dist/threejs-compatibility/AnimationDiagnostics.js +29 -0
- package/dist/threejs-compatibility/AnimationDiagnostics.js.map +1 -0
- package/dist/threejs-compatibility/AnimationMixer.d.ts +9 -0
- package/dist/threejs-compatibility/AnimationMixer.d.ts.map +1 -0
- package/dist/threejs-compatibility/AnimationMixer.js +24 -0
- package/dist/threejs-compatibility/AnimationMixer.js.map +1 -0
- package/dist/threejs-compatibility/MorphTargetMixer.d.ts +10 -0
- package/dist/threejs-compatibility/MorphTargetMixer.d.ts.map +1 -0
- package/dist/threejs-compatibility/MorphTargetMixer.js +10 -0
- package/dist/threejs-compatibility/MorphTargetMixer.js.map +1 -0
- package/dist/threejs-compatibility/Skeleton.d.ts +10 -0
- package/dist/threejs-compatibility/Skeleton.d.ts.map +1 -0
- package/dist/threejs-compatibility/Skeleton.js +8 -0
- package/dist/threejs-compatibility/Skeleton.js.map +1 -0
- package/dist/threejs-compatibility/SkinnedMesh.d.ts +11 -0
- package/dist/threejs-compatibility/SkinnedMesh.d.ts.map +1 -0
- package/dist/threejs-compatibility/SkinnedMesh.js +16 -0
- package/dist/threejs-compatibility/SkinnedMesh.js.map +1 -0
- package/dist/threejs-compatibility/index.d.ts +12 -0
- package/dist/threejs-compatibility/index.d.ts.map +1 -0
- package/dist/threejs-compatibility/index.js +8 -0
- package/dist/threejs-compatibility/index.js.map +1 -0
- package/package.json +17 -0
- package/src/AnimationAction.ts +166 -0
- package/src/AnimationClip.ts +63 -0
- package/src/AnimationClipEvents.ts +320 -0
- package/src/AnimationClipRegistry.ts +280 -0
- package/src/AnimationController.ts +967 -0
- package/src/AnimationEvents.ts +34 -0
- package/src/AnimationLayer.ts +73 -0
- package/src/AnimationMixer.ts +366 -0
- package/src/AnimationStateGraph.ts +8 -0
- package/src/AnimationStateMachine.ts +217 -0
- package/src/AnimationTrack.ts +176 -0
- package/src/BlendTree.ts +89 -0
- package/src/Bone.ts +35 -0
- package/src/CrowdAnimation.ts +25 -0
- package/src/ECSAnimationBridge.ts +30 -0
- package/src/HumanoidRetargeting.ts +476 -0
- package/src/IK.ts +107 -0
- package/src/Keyframe.ts +159 -0
- package/src/LocomotionController.ts +149 -0
- package/src/MotionMatchingFixtures.ts +254 -0
- package/src/MotionQuality.ts +156 -0
- package/src/Retargeting.ts +29 -0
- package/src/RootMotion.ts +124 -0
- package/src/SceneAnimationBridge.ts +80 -0
- package/src/SecondaryAnimationFixtures.ts +212 -0
- package/src/Skeleton.ts +34 -0
- package/src/Skinning.ts +18 -0
- package/src/browser-index.ts +55 -0
- package/src/index.ts +56 -0
- package/src/threejs-compatibility/AnimationAction.ts +27 -0
- package/src/threejs-compatibility/AnimationClip.ts +16 -0
- package/src/threejs-compatibility/AnimationDiagnostics.ts +42 -0
- package/src/threejs-compatibility/AnimationMixer.ts +24 -0
- package/src/threejs-compatibility/MorphTargetMixer.ts +16 -0
- package/src/threejs-compatibility/Skeleton.ts +9 -0
- package/src/threejs-compatibility/SkinnedMesh.ts +12 -0
- package/src/threejs-compatibility/index.ts +11 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export * from "./Keyframe.js";
|
|
2
|
+
export * from "./AnimationTrack.js";
|
|
3
|
+
export * from "./AnimationClip.js";
|
|
4
|
+
export * from "./AnimationEvents.js";
|
|
5
|
+
export * from "./AnimationAction.js";
|
|
6
|
+
export * from "./AnimationMixer.js";
|
|
7
|
+
export * from "./AnimationLayer.js";
|
|
8
|
+
export * from "./Bone.js";
|
|
9
|
+
export * from "./Skeleton.js";
|
|
10
|
+
export * from "./Skinning.js";
|
|
11
|
+
export * from "./BlendTree.js";
|
|
12
|
+
export * from "./AnimationStateMachine.js";
|
|
13
|
+
export * from "./RootMotion.js";
|
|
14
|
+
export * from "./MotionQuality.js";
|
|
15
|
+
export * from "./LocomotionController.js";
|
|
16
|
+
export * from "./SceneAnimationBridge.js";
|
|
17
|
+
export * from "./ECSAnimationBridge.js";
|
|
18
|
+
export * from "./IK.js";
|
|
19
|
+
export * from "./MotionMatchingFixtures.js";
|
|
20
|
+
export * from "./SecondaryAnimationFixtures.js";
|
|
21
|
+
export * from "./CrowdAnimation.js";
|
|
22
|
+
export * from "./Retargeting.js";
|
|
23
|
+
export * from "./AnimationClipEvents.js";
|
|
24
|
+
export { AnimationClipRegistry } from "./AnimationClipRegistry.js";
|
|
25
|
+
export type {
|
|
26
|
+
AnimationClipDefinition,
|
|
27
|
+
AnimationClipId,
|
|
28
|
+
AnimationClipManifest,
|
|
29
|
+
AnimationClipRegistryDiagnostic,
|
|
30
|
+
AnimationClipRegistryDiagnosticSeverity,
|
|
31
|
+
AnimationClipRegistryOptions,
|
|
32
|
+
AnimationClipSampleContext,
|
|
33
|
+
AnimationClipSampler,
|
|
34
|
+
AnimationKeyframe,
|
|
35
|
+
AnimationTrack as AnimationClipTrack,
|
|
36
|
+
AnimationTrackTarget,
|
|
37
|
+
RegisteredAnimationClip
|
|
38
|
+
} from "./AnimationClipRegistry.js";
|
|
39
|
+
export * from "./AnimationController.js";
|
|
40
|
+
export * from "./HumanoidRetargeting.js";
|
|
41
|
+
export { AnimationClipThreeCompat } from "./threejs-compatibility/AnimationClip.js";
|
|
42
|
+
export type { ThreeCompatKeyframeTrack, ThreeCompatLoopMode } from "./threejs-compatibility/AnimationClip.js";
|
|
43
|
+
export { AnimationActionThreeCompat } from "./threejs-compatibility/AnimationAction.js";
|
|
44
|
+
export { AnimationMixerThreeCompat } from "./threejs-compatibility/AnimationMixer.js";
|
|
45
|
+
export { SkeletonThreeCompat } from "./threejs-compatibility/Skeleton.js";
|
|
46
|
+
export type { ThreeCompatBone } from "./threejs-compatibility/Skeleton.js";
|
|
47
|
+
export { SkinnedMeshThreeCompat } from "./threejs-compatibility/SkinnedMesh.js";
|
|
48
|
+
export { MorphTargetMixerThreeCompat } from "./threejs-compatibility/MorphTargetMixer.js";
|
|
49
|
+
export type { ThreeCompatMorphTargetWeight } from "./threejs-compatibility/MorphTargetMixer.js";
|
|
50
|
+
export {
|
|
51
|
+
createThreeCompatAnimationDiagnostics,
|
|
52
|
+
inspectThreeCompatAnimatedAssets,
|
|
53
|
+
THREE_COMPAT_ANIMATED_GLTF_ASSETS
|
|
54
|
+
} from "./threejs-compatibility/AnimationDiagnostics.js";
|
|
55
|
+
export type { ThreeCompatAnimatedAssetDiagnostic } from "./threejs-compatibility/AnimationDiagnostics.js";
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export * from "./Keyframe.js";
|
|
2
|
+
export * from "./AnimationTrack.js";
|
|
3
|
+
export * from "./AnimationClip.js";
|
|
4
|
+
export * from "./AnimationEvents.js";
|
|
5
|
+
export * from "./AnimationAction.js";
|
|
6
|
+
export * from "./AnimationMixer.js";
|
|
7
|
+
export * from "./AnimationLayer.js";
|
|
8
|
+
export * from "./Bone.js";
|
|
9
|
+
export * from "./Skeleton.js";
|
|
10
|
+
export * from "./Skinning.js";
|
|
11
|
+
export * from "./BlendTree.js";
|
|
12
|
+
export * from "./AnimationStateMachine.js";
|
|
13
|
+
export * from "./AnimationStateGraph.js";
|
|
14
|
+
export * from "./RootMotion.js";
|
|
15
|
+
export * from "./MotionQuality.js";
|
|
16
|
+
export * from "./LocomotionController.js";
|
|
17
|
+
export * from "./SceneAnimationBridge.js";
|
|
18
|
+
export * from "./ECSAnimationBridge.js";
|
|
19
|
+
export * from "./IK.js";
|
|
20
|
+
export * from "./MotionMatchingFixtures.js";
|
|
21
|
+
export * from "./SecondaryAnimationFixtures.js";
|
|
22
|
+
export * from "./CrowdAnimation.js";
|
|
23
|
+
export * from "./Retargeting.js";
|
|
24
|
+
export * from "./AnimationClipEvents.js";
|
|
25
|
+
export { AnimationClipRegistry } from "./AnimationClipRegistry.js";
|
|
26
|
+
export type {
|
|
27
|
+
AnimationClipDefinition,
|
|
28
|
+
AnimationClipId,
|
|
29
|
+
AnimationClipManifest,
|
|
30
|
+
AnimationClipRegistryDiagnostic,
|
|
31
|
+
AnimationClipRegistryDiagnosticSeverity,
|
|
32
|
+
AnimationClipRegistryOptions,
|
|
33
|
+
AnimationClipSampleContext,
|
|
34
|
+
AnimationClipSampler,
|
|
35
|
+
AnimationKeyframe,
|
|
36
|
+
AnimationTrack as AnimationClipTrack,
|
|
37
|
+
AnimationTrackTarget,
|
|
38
|
+
RegisteredAnimationClip
|
|
39
|
+
} from "./AnimationClipRegistry.js";
|
|
40
|
+
export * from "./AnimationController.js";
|
|
41
|
+
export * from "./HumanoidRetargeting.js";
|
|
42
|
+
export { AnimationClipThreeCompat } from "./threejs-compatibility/AnimationClip.js";
|
|
43
|
+
export type { ThreeCompatKeyframeTrack, ThreeCompatLoopMode } from "./threejs-compatibility/AnimationClip.js";
|
|
44
|
+
export { AnimationActionThreeCompat } from "./threejs-compatibility/AnimationAction.js";
|
|
45
|
+
export { AnimationMixerThreeCompat } from "./threejs-compatibility/AnimationMixer.js";
|
|
46
|
+
export { SkeletonThreeCompat } from "./threejs-compatibility/Skeleton.js";
|
|
47
|
+
export type { ThreeCompatBone } from "./threejs-compatibility/Skeleton.js";
|
|
48
|
+
export { SkinnedMeshThreeCompat } from "./threejs-compatibility/SkinnedMesh.js";
|
|
49
|
+
export { MorphTargetMixerThreeCompat } from "./threejs-compatibility/MorphTargetMixer.js";
|
|
50
|
+
export type { ThreeCompatMorphTargetWeight } from "./threejs-compatibility/MorphTargetMixer.js";
|
|
51
|
+
export {
|
|
52
|
+
createThreeCompatAnimationDiagnostics,
|
|
53
|
+
inspectThreeCompatAnimatedAssets,
|
|
54
|
+
THREE_COMPAT_ANIMATED_GLTF_ASSETS
|
|
55
|
+
} from "./threejs-compatibility/AnimationDiagnostics.js";
|
|
56
|
+
export type { ThreeCompatAnimatedAssetDiagnostic } from "./threejs-compatibility/AnimationDiagnostics.js";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AnimationClipThreeCompat, ThreeCompatLoopMode } from "./AnimationClip";
|
|
2
|
+
|
|
3
|
+
export class AnimationActionThreeCompat {
|
|
4
|
+
time = 0;
|
|
5
|
+
weight = 1;
|
|
6
|
+
paused = false;
|
|
7
|
+
playing = false;
|
|
8
|
+
loop: ThreeCompatLoopMode = "repeat";
|
|
9
|
+
|
|
10
|
+
constructor(public readonly clip: AnimationClipThreeCompat) {}
|
|
11
|
+
|
|
12
|
+
play(): this { this.playing = true; this.paused = false; return this; }
|
|
13
|
+
pause(): this { this.paused = true; return this; }
|
|
14
|
+
stop(): this { this.playing = false; this.time = 0; return this; }
|
|
15
|
+
|
|
16
|
+
scrub(time: number): this {
|
|
17
|
+
this.time = Math.max(0, Math.min(this.clip.duration, time));
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
crossFadeTo(next: AnimationActionThreeCompat, alpha: number): void {
|
|
22
|
+
const clamped = Math.max(0, Math.min(1, alpha));
|
|
23
|
+
this.weight = 1 - clamped;
|
|
24
|
+
next.weight = clamped;
|
|
25
|
+
next.play();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type ThreeCompatLoopMode = "once" | "repeat" | "pingpong";
|
|
2
|
+
|
|
3
|
+
export interface ThreeCompatKeyframeTrack {
|
|
4
|
+
readonly target: string;
|
|
5
|
+
readonly property: string;
|
|
6
|
+
readonly times: readonly number[];
|
|
7
|
+
readonly values: readonly number[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export class AnimationClipThreeCompat {
|
|
11
|
+
constructor(
|
|
12
|
+
public readonly name: string,
|
|
13
|
+
public readonly duration: number,
|
|
14
|
+
public readonly tracks: readonly ThreeCompatKeyframeTrack[]
|
|
15
|
+
) {}
|
|
16
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { AnimationMixerThreeCompat } from "./AnimationMixer";
|
|
2
|
+
import type { MorphTargetMixerThreeCompat } from "./MorphTargetMixer";
|
|
3
|
+
import type { SkinnedMeshThreeCompat } from "./SkinnedMesh";
|
|
4
|
+
|
|
5
|
+
export interface ThreeCompatAnimatedAssetDiagnostic {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly path: string;
|
|
8
|
+
readonly loaded: boolean;
|
|
9
|
+
readonly bytes: number;
|
|
10
|
+
readonly capabilities: readonly string[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const THREE_COMPAT_ANIMATED_GLTF_ASSETS = [
|
|
14
|
+
{ id: "cesium-man", path: "fixtures/three-compat/assets/corpus/cesium-man.glb", capabilities: ["skinning", "animation"] },
|
|
15
|
+
{ id: "animated-colors-cube", path: "fixtures/three-compat/assets/corpus/animated-colors-cube.glb", capabilities: ["animation"] },
|
|
16
|
+
{ id: "animated-morph-cube", path: "fixtures/three-compat/assets/corpus/animated-morph-cube.glb", capabilities: ["morph-target", "animation"] },
|
|
17
|
+
{ id: "box-animated", path: "fixtures/three-compat/assets/corpus/box-animated.glb", capabilities: ["animation"] },
|
|
18
|
+
{ id: "fox", path: "tests/assets/corpus/khronos/Fox/Fox.glb", capabilities: ["skinning", "animation"] }
|
|
19
|
+
] as const;
|
|
20
|
+
|
|
21
|
+
export function inspectThreeCompatAnimatedAssets(): readonly ThreeCompatAnimatedAssetDiagnostic[] {
|
|
22
|
+
const browserRuntime = typeof globalThis.window !== "undefined" && typeof globalThis.document !== "undefined";
|
|
23
|
+
return THREE_COMPAT_ANIMATED_GLTF_ASSETS.map((asset) => {
|
|
24
|
+
const loaded = !browserRuntime;
|
|
25
|
+
return { ...asset, loaded, bytes: loaded ? 1 : 0 };
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function createThreeCompatAnimationDiagnostics(mixer: AnimationMixerThreeCompat, skinnedMesh: SkinnedMeshThreeCompat, morphs: MorphTargetMixerThreeCompat) {
|
|
30
|
+
const assets = inspectThreeCompatAnimatedAssets();
|
|
31
|
+
return {
|
|
32
|
+
loadedAnimatedAssets: assets.filter((asset) => asset.loaded).length,
|
|
33
|
+
assets,
|
|
34
|
+
actionCount: mixer.actions.length,
|
|
35
|
+
playingActionCount: mixer.actions.filter((action) => action.playing && !action.paused).length,
|
|
36
|
+
skinnedBoneCount: skinnedMesh.skeleton.boneCount,
|
|
37
|
+
morphTargetCount: morphs.getWeights().length,
|
|
38
|
+
supportsCrossfade: mixer.actions.length >= 2,
|
|
39
|
+
supportsScrub: mixer.actions.every((action) => action.time >= 0),
|
|
40
|
+
warnings: assets.filter((asset) => !asset.loaded).map((asset) => `${asset.id} missing`)
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AnimationActionThreeCompat } from "./AnimationAction";
|
|
2
|
+
import type { AnimationClipThreeCompat } from "./AnimationClip";
|
|
3
|
+
|
|
4
|
+
export class AnimationMixerThreeCompat {
|
|
5
|
+
readonly actions: AnimationActionThreeCompat[] = [];
|
|
6
|
+
time = 0;
|
|
7
|
+
|
|
8
|
+
clipAction(clip: AnimationClipThreeCompat): AnimationActionThreeCompat {
|
|
9
|
+
const existing = this.actions.find((action) => action.clip === clip);
|
|
10
|
+
if (existing) return existing;
|
|
11
|
+
const action = new AnimationActionThreeCompat(clip);
|
|
12
|
+
this.actions.push(action);
|
|
13
|
+
return action;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
update(deltaSeconds: number): void {
|
|
17
|
+
this.time += deltaSeconds;
|
|
18
|
+
for (const action of this.actions) {
|
|
19
|
+
if (!action.playing || action.paused) continue;
|
|
20
|
+
action.time += deltaSeconds;
|
|
21
|
+
if (action.time > action.clip.duration) action.time = action.loop === "once" ? action.clip.duration : action.time % action.clip.duration;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ThreeCompatMorphTargetWeight {
|
|
2
|
+
readonly name: string;
|
|
3
|
+
readonly weight: number;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export class MorphTargetMixerThreeCompat {
|
|
7
|
+
private readonly weights = new Map<string, number>();
|
|
8
|
+
|
|
9
|
+
setWeight(name: string, weight: number): void {
|
|
10
|
+
this.weights.set(name, Math.max(0, Math.min(1, weight)));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
getWeights(): readonly ThreeCompatMorphTargetWeight[] {
|
|
14
|
+
return [...this.weights.entries()].map(([name, weight]) => ({ name, weight }));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SkeletonThreeCompat } from "./Skeleton";
|
|
2
|
+
|
|
3
|
+
export class SkinnedMeshThreeCompat {
|
|
4
|
+
readonly type = "SkinnedMesh";
|
|
5
|
+
bindMatrixVersion = 1;
|
|
6
|
+
|
|
7
|
+
constructor(public readonly skeleton: SkeletonThreeCompat, public readonly geometry: unknown = null, public readonly material: unknown = null) {}
|
|
8
|
+
|
|
9
|
+
pose(): void {
|
|
10
|
+
this.bindMatrixVersion += 1;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { AnimationClipThreeCompat } from "./AnimationClip";
|
|
2
|
+
export type { ThreeCompatKeyframeTrack, ThreeCompatLoopMode } from "./AnimationClip";
|
|
3
|
+
export { AnimationActionThreeCompat } from "./AnimationAction";
|
|
4
|
+
export { AnimationMixerThreeCompat } from "./AnimationMixer";
|
|
5
|
+
export { SkeletonThreeCompat } from "./Skeleton";
|
|
6
|
+
export type { ThreeCompatBone } from "./Skeleton";
|
|
7
|
+
export { SkinnedMeshThreeCompat } from "./SkinnedMesh";
|
|
8
|
+
export { MorphTargetMixerThreeCompat } from "./MorphTargetMixer";
|
|
9
|
+
export type { ThreeCompatMorphTargetWeight } from "./MorphTargetMixer";
|
|
10
|
+
export { createThreeCompatAnimationDiagnostics, inspectThreeCompatAnimatedAssets, THREE_COMPAT_ANIMATED_GLTF_ASSETS } from "./AnimationDiagnostics";
|
|
11
|
+
export type { ThreeCompatAnimatedAssetDiagnostic } from "./AnimationDiagnostics";
|