@haiyue/extensions 0.1.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/LICENSE +21 -0
- package/README.md +30 -0
- package/dist/animation/Animation2DComponent.d.ts +46 -0
- package/dist/animation/Animation2DExtensionRegistry.d.ts +27 -0
- package/dist/animation/Animation2DRenderSystem.d.ts +89 -0
- package/dist/animation/Animation2DRuntime.d.ts +99 -0
- package/dist/animation/Animation2DStateMachine.d.ts +13 -0
- package/dist/animation/Animation2DStateMachineComponent.d.ts +54 -0
- package/dist/animation/Animation2DStateMachineRuntime.d.ts +30 -0
- package/dist/animation/Animation2DStateMachineSystem.d.ts +14 -0
- package/dist/animation/Animation2DStateMachineVisualRuntime.d.ts +27 -0
- package/dist/animation/Animation2DSystem.d.ts +14 -0
- package/dist/animation/AnimationAssetLoader.d.ts +9 -0
- package/dist/animation/AnimationAudioClip.d.ts +26 -0
- package/dist/animation/AnimationPathTessellator.d.ts +52 -0
- package/dist/animation/AnimationTextRasterizer.d.ts +21 -0
- package/dist/animation/AnimationVisual2D.d.ts +68 -0
- package/dist/animation/HyaAnimation2DClipAdapter.d.ts +16 -0
- package/dist/animation/Particle2DDescriptorAdapter.d.ts +5 -0
- package/dist/animation/runtime/mixer/Action.d.ts +150 -0
- package/dist/animation/runtime/mixer/Mixer.d.ts +54 -0
- package/dist/animation/runtime/mixer/PoseBuffer.d.ts +23 -0
- package/dist/animation/runtime/mixer/Sampler.d.ts +17 -0
- package/dist/animation/runtime/mixer/Types.d.ts +101 -0
- package/dist/animation/runtime/mixer/index.d.ts +6 -0
- package/dist/animation-state-machine/AnimationStateMachine.d.ts +111 -0
- package/dist/animation-state-machine/AnimationStateMachineChannels.d.ts +23 -0
- package/dist/animation-state-machine/runtime/Animation2DStateMachineMixerAdapter.d.ts +51 -0
- package/dist/animation-state-machine/runtime/AnimationStateMachineBlendTreeWeights.d.ts +14 -0
- package/dist/animation-state-machine/runtime/AnimationStateMachineCompiler.d.ts +109 -0
- package/dist/animation-state-machine/runtime/AnimationStateMachineController.d.ts +103 -0
- package/dist/animation-state-machine/runtime/AnimationStateMachineMixerPort.d.ts +35 -0
- package/dist/animation-state-machine/runtime/index.d.ts +7 -0
- package/dist/animation.d.ts +15 -0
- package/dist/animation.js +1171 -0
- package/dist/animation3d/Animation3DAction.d.ts +46 -0
- package/dist/animation3d/Animation3DBinding.d.ts +85 -0
- package/dist/animation3d/Animation3DClip.d.ts +20 -0
- package/dist/animation3d/Animation3DError.d.ts +13 -0
- package/dist/animation3d/Animation3DMixer.d.ts +27 -0
- package/dist/animation3d/Animation3DPose.d.ts +40 -0
- package/dist/animation3d/Animation3DPoseBuffer.d.ts +24 -0
- package/dist/animation3d/Animation3DResource.d.ts +28 -0
- package/dist/animation3d/Animation3DStateMachine.d.ts +95 -0
- package/dist/animation3d/Animation3DStateMachineRuntime.d.ts +70 -0
- package/dist/animation3d/Animation3DTrack.d.ts +19 -0
- package/dist/animation3d/hya/HyaAnimation3DRuntime.d.ts +73 -0
- package/dist/animation3d/hya/HyaAnimation3DStateMachineRuntime.d.ts +65 -0
- package/dist/animation3d/hya/HyaAnimation3DTypes.d.ts +170 -0
- package/dist/animation3d/hya/index.d.ts +4 -0
- package/dist/animation3d/index.d.ts +14 -0
- package/dist/animation3d/runtime/integration/Animation3DStateMachineMixerAdapter.d.ts +81 -0
- package/dist/animation3d/runtime/integration/Animation3DStateMachineMixerIntegration.d.ts +39 -0
- package/dist/animation3d/runtime/integration/index.d.ts +2 -0
- package/dist/animation3d/runtime/mixer/Action.d.ts +150 -0
- package/dist/animation3d/runtime/mixer/Animation3DMixerRuntimeStore.d.ts +6 -0
- package/dist/animation3d/runtime/mixer/Mixer.d.ts +59 -0
- package/dist/animation3d/runtime/mixer/PoseBuffer.d.ts +1 -0
- package/dist/animation3d/runtime/mixer/TrackSampler.d.ts +24 -0
- package/dist/animation3d/runtime/mixer/index.d.ts +4 -0
- package/dist/animation3d/runtime/state-machine/Animation3DBlendTreeWeights.d.ts +1 -0
- package/dist/animation3d/runtime/state-machine/Animation3DStateMachineCompiler.d.ts +1 -0
- package/dist/animation3d/runtime/state-machine/Animation3DStateMachineController.d.ts +1 -0
- package/dist/animation3d/runtime/state-machine/Animation3DStateMachineMixerPort.d.ts +1 -0
- package/dist/animation3d/runtime/state-machine/index.d.ts +6 -0
- package/dist/animation3d.d.ts +5 -0
- package/dist/animation3d.js +1708 -0
- package/dist/benchmark.d.ts +30 -0
- package/dist/benchmark.js +119 -0
- package/dist/canvas-text/CanvasText2DRenderSystem.d.ts +24 -0
- package/dist/canvas-text/CanvasTextComponent.d.ts +18 -0
- package/dist/canvas-text.d.ts +4 -0
- package/dist/canvas-text.js +276 -0
- package/dist/chunks/2d-ui-animation-2d.generated-D4aHzFU2.js +4 -0
- package/dist/chunks/2d-ui-canvas-text-2d.generated-C0Eaej2m.js +4 -0
- package/dist/chunks/2d-ui-spine2d.generated-CUUi8xjl.js +4 -0
- package/dist/chunks/2d-ui-tilemap2d.generated-gebw4mX7.js +4 -0
- package/dist/chunks/Animation2DStateMachine-9IonguNa.js +3245 -0
- package/dist/chunks/AnimationStateMachineController-BIcAh-sT.js +1438 -0
- package/dist/chunks/GltfAnimation3DAdapter-Cu3rQQsW.js +2240 -0
- package/dist/chunks/GltfAnimationRuntime-CRHsLycN.js +631 -0
- package/dist/chunks/RenderSystem2DBase-DDT61dAu.js +227 -0
- package/dist/chunks/Spine2DRuntime-D9M9LAQR.js +3056 -0
- package/dist/chunks/SpineAssetParser-BSDmPge1.js +378 -0
- package/dist/chunks/gltfLoader-Dm22jLYB.js +2085 -0
- package/dist/chunks/pluginUtils-CvwroRMd.js +33 -0
- package/dist/experimental-gltf-worker.d.ts +4 -0
- package/dist/experimental-gltf-worker.js +138 -0
- package/dist/experimental-spine-worker.d.ts +4 -0
- package/dist/experimental-spine-worker.js +110 -0
- package/dist/gltf/GltfAccessorReader.d.ts +7 -0
- package/dist/gltf/GltfAnimation3DAdapter.d.ts +47 -0
- package/dist/gltf/GltfAnimationRuntime.d.ts +10 -0
- package/dist/gltf/GltfAssetWorkerClient.d.ts +20 -0
- package/dist/gltf/GltfCompatibilityReport.d.ts +70 -0
- package/dist/gltf/GltfConservativeBounds.d.ts +18 -0
- package/dist/gltf/GltfDracoDecoder.d.ts +4 -0
- package/dist/gltf/GltfExtensionAdapter.d.ts +54 -0
- package/dist/gltf/GltfLoaderContract.d.ts +249 -0
- package/dist/gltf/GltfLoaderErrors.d.ts +4 -0
- package/dist/gltf/GltfMaterialDescriptor.d.ts +23 -0
- package/dist/gltf/GltfMaterialEncoder.d.ts +20 -0
- package/dist/gltf/GltfMaterialLoader.d.ts +6 -0
- package/dist/gltf/GltfModelComponent.d.ts +72 -0
- package/dist/gltf/GltfModelSystem.d.ts +37 -0
- package/dist/gltf/GltfPlugin.d.ts +6 -0
- package/dist/gltf/GltfSchema.d.ts +225 -0
- package/dist/gltf/GltfUvSemanticPlanner.d.ts +33 -0
- package/dist/gltf/gltfLoader.d.ts +9 -0
- package/dist/gltf-animation3d.d.ts +3 -0
- package/dist/gltf-animation3d.js +8 -0
- package/dist/gltf-worker-runtime.d.ts +7 -0
- package/dist/gltf-worker-runtime.js +6981 -0
- package/dist/gltf.d.ts +12 -0
- package/dist/gltf.js +517 -0
- package/dist/grid/Grid2DComponent.d.ts +25 -0
- package/dist/grid.d.ts +2 -0
- package/dist/grid.js +56 -0
- package/dist/hya-state-machine.d.ts +7 -0
- package/dist/hya-state-machine.js +2934 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7 -0
- package/dist/internal/2d-ui-shader-artifact.js +870 -0
- package/dist/plugins/pluginUtils.d.ts +20 -0
- package/dist/plugins.d.ts +6 -0
- package/dist/shaders/generated/2d-ui-artifact.generated.d.ts +658 -0
- package/dist/spine/Spine2DComponent.d.ts +116 -0
- package/dist/spine/Spine2DGpuRenderer.d.ts +65 -0
- package/dist/spine/Spine2DRenderSystem.d.ts +27 -0
- package/dist/spine/Spine2DRuntime.d.ts +103 -0
- package/dist/spine/SpineAnimationBoneTimelines.d.ts +8 -0
- package/dist/spine/SpineAssetParser.d.ts +18 -0
- package/dist/spine/SpineAssetWorkerClient.d.ts +19 -0
- package/dist/spine/SpineAssetWorkerContract.d.ts +6 -0
- package/dist/spine/SpineAtlasParser.d.ts +21 -0
- package/dist/spine/SpineFloatBuilder.d.ts +15 -0
- package/dist/spine/SpinePathConstraintSolver.d.ts +32 -0
- package/dist/spine/SpinePlugin.d.ts +8 -0
- package/dist/spine/SpineSkeletonRuntime.d.ts +185 -0
- package/dist/spine/SpineSlotAnimation.d.ts +17 -0
- package/dist/spine/SpineTimelineRuntime.d.ts +25 -0
- package/dist/spine/SpineVertexBuilder.d.ts +61 -0
- package/dist/spine.d.ts +7 -0
- package/dist/spine.js +578 -0
- package/dist/tilemap/Tilemap2DComponent.d.ts +110 -0
- package/dist/tilemap/Tilemap2DRenderSystem.d.ts +11 -0
- package/dist/tilemap/Tilemap2DRenderer.d.ts +24 -0
- package/dist/tilemap/TilemapPlugin.d.ts +8 -0
- package/dist/tilemap.d.ts +6 -0
- package/dist/tilemap.js +535 -0
- package/dist/tween/Tween2DComponent.d.ts +70 -0
- package/dist/tween/Tween2DSystem.d.ts +12 -0
- package/dist/tween.d.ts +4 -0
- package/dist/tween.js +138 -0
- package/dist/utils/RenderSystem2DBase.d.ts +42 -0
- package/dist/utils/arrayAccess.d.ts +4 -0
- package/dist/utils/camera2d.d.ts +12 -0
- package/dist/utils/render2dGpu.d.ts +32 -0
- package/package.json +124 -0
- package/src/animation/Animation2DComponent.ts +135 -0
- package/src/animation/Animation2DExtensionRegistry.ts +52 -0
- package/src/animation/Animation2DRenderSystem.ts +1026 -0
- package/src/animation/Animation2DRuntime.ts +1326 -0
- package/src/animation/Animation2DStateMachine.ts +39 -0
- package/src/animation/Animation2DStateMachineComponent.ts +228 -0
- package/src/animation/Animation2DStateMachineRuntime.ts +141 -0
- package/src/animation/Animation2DStateMachineSystem.ts +60 -0
- package/src/animation/Animation2DStateMachineVisualRuntime.ts +282 -0
- package/src/animation/Animation2DSystem.ts +72 -0
- package/src/animation/AnimationAssetLoader.ts +84 -0
- package/src/animation/AnimationAudioClip.ts +140 -0
- package/src/animation/AnimationPathTessellator.ts +691 -0
- package/src/animation/AnimationTextRasterizer.ts +340 -0
- package/src/animation/AnimationVisual2D.ts +153 -0
- package/src/animation/HyaAnimation2DClipAdapter.ts +845 -0
- package/src/animation/Particle2DDescriptorAdapter.ts +35 -0
- package/src/animation/runtime/mixer/Action.ts +876 -0
- package/src/animation/runtime/mixer/Mixer.ts +505 -0
- package/src/animation/runtime/mixer/PoseBuffer.ts +105 -0
- package/src/animation/runtime/mixer/Sampler.ts +252 -0
- package/src/animation/runtime/mixer/Types.ts +138 -0
- package/src/animation/runtime/mixer/index.ts +31 -0
- package/src/animation-state-machine/AnimationStateMachine.ts +146 -0
- package/src/animation-state-machine/AnimationStateMachineChannels.ts +116 -0
- package/src/animation-state-machine/runtime/Animation2DStateMachineMixerAdapter.ts +197 -0
- package/src/animation-state-machine/runtime/AnimationStateMachineBlendTreeWeights.ts +503 -0
- package/src/animation-state-machine/runtime/AnimationStateMachineCompiler.ts +763 -0
- package/src/animation-state-machine/runtime/AnimationStateMachineController.ts +987 -0
- package/src/animation-state-machine/runtime/AnimationStateMachineMixerPort.ts +54 -0
- package/src/animation-state-machine/runtime/index.ts +47 -0
- package/src/animation.ts +33 -0
- package/src/animation3d/Animation3DAction.ts +73 -0
- package/src/animation3d/Animation3DBinding.ts +116 -0
- package/src/animation3d/Animation3DClip.ts +22 -0
- package/src/animation3d/Animation3DError.ts +34 -0
- package/src/animation3d/Animation3DMixer.ts +82 -0
- package/src/animation3d/Animation3DPose.ts +100 -0
- package/src/animation3d/Animation3DPoseBuffer.ts +85 -0
- package/src/animation3d/Animation3DResource.ts +49 -0
- package/src/animation3d/Animation3DStateMachine.ts +126 -0
- package/src/animation3d/Animation3DStateMachineRuntime.ts +191 -0
- package/src/animation3d/Animation3DTrack.ts +29 -0
- package/src/animation3d/hya/HyaAnimation3DRuntime.ts +756 -0
- package/src/animation3d/hya/HyaAnimation3DStateMachineRuntime.ts +618 -0
- package/src/animation3d/hya/HyaAnimation3DTypes.ts +168 -0
- package/src/animation3d/hya/index.ts +10 -0
- package/src/animation3d/index.ts +76 -0
- package/src/animation3d/runtime/integration/Animation3DStateMachineMixerAdapter.ts +325 -0
- package/src/animation3d/runtime/integration/Animation3DStateMachineMixerIntegration.ts +158 -0
- package/src/animation3d/runtime/integration/index.ts +9 -0
- package/src/animation3d/runtime/mixer/Action.ts +833 -0
- package/src/animation3d/runtime/mixer/Animation3DMixerRuntimeStore.ts +26 -0
- package/src/animation3d/runtime/mixer/Mixer.ts +562 -0
- package/src/animation3d/runtime/mixer/PoseBuffer.ts +1 -0
- package/src/animation3d/runtime/mixer/TrackSampler.ts +399 -0
- package/src/animation3d/runtime/mixer/index.ts +8 -0
- package/src/animation3d/runtime/state-machine/Animation3DBlendTreeWeights.ts +4 -0
- package/src/animation3d/runtime/state-machine/Animation3DStateMachineCompiler.ts +1 -0
- package/src/animation3d/runtime/state-machine/Animation3DStateMachineController.ts +1 -0
- package/src/animation3d/runtime/state-machine/Animation3DStateMachineMixerPort.ts +1 -0
- package/src/animation3d/runtime/state-machine/index.ts +45 -0
- package/src/animation3d.ts +5 -0
- package/src/benchmark.ts +168 -0
- package/src/canvas-text/CanvasText2DRenderSystem.ts +292 -0
- package/src/canvas-text/CanvasTextComponent.ts +47 -0
- package/src/canvas-text.ts +4 -0
- package/src/experimental-gltf-worker.ts +18 -0
- package/src/experimental-spine-worker.ts +9 -0
- package/src/gltf/GltfAccessorReader.ts +271 -0
- package/src/gltf/GltfAnimation3DAdapter.ts +680 -0
- package/src/gltf/GltfAnimationRuntime.ts +392 -0
- package/src/gltf/GltfAssetWorkerClient.ts +136 -0
- package/src/gltf/GltfCompatibilityReport.ts +214 -0
- package/src/gltf/GltfConservativeBounds.ts +219 -0
- package/src/gltf/GltfDracoDecoder.ts +251 -0
- package/src/gltf/GltfExtensionAdapter.ts +340 -0
- package/src/gltf/GltfLoaderContract.ts +333 -0
- package/src/gltf/GltfLoaderErrors.ts +59 -0
- package/src/gltf/GltfMaterialDescriptor.ts +134 -0
- package/src/gltf/GltfMaterialEncoder.ts +173 -0
- package/src/gltf/GltfMaterialLoader.ts +293 -0
- package/src/gltf/GltfModelComponent.ts +115 -0
- package/src/gltf/GltfModelSystem.ts +208 -0
- package/src/gltf/GltfPlugin.ts +84 -0
- package/src/gltf/GltfSchema.ts +229 -0
- package/src/gltf/GltfUvSemanticPlanner.ts +166 -0
- package/src/gltf/gltfLoader.ts +910 -0
- package/src/gltf-animation3d.ts +10 -0
- package/src/gltf-worker-runtime.ts +10 -0
- package/src/gltf.ts +56 -0
- package/src/grid/Grid2DComponent.ts +69 -0
- package/src/grid.ts +2 -0
- package/src/hya-state-machine.ts +19 -0
- package/src/index.ts +2 -0
- package/src/plugins/pluginUtils.ts +50 -0
- package/src/plugins.ts +6 -0
- package/src/shaders/generated/2d-ui-animation-2d.generated.wgsl +242 -0
- package/src/shaders/generated/2d-ui-artifact.generated.ts +867 -0
- package/src/shaders/generated/2d-ui-canvas-text-2d.generated.wgsl +38 -0
- package/src/shaders/generated/2d-ui-spine2d.generated.wgsl +41 -0
- package/src/shaders/generated/2d-ui-tilemap2d.generated.wgsl +36 -0
- package/src/spine/Spine2DComponent.ts +168 -0
- package/src/spine/Spine2DGpuRenderer.ts +449 -0
- package/src/spine/Spine2DRenderSystem.ts +199 -0
- package/src/spine/Spine2DRuntime.ts +1529 -0
- package/src/spine/SpineAnimationBoneTimelines.ts +30 -0
- package/src/spine/SpineAssetParser.ts +20 -0
- package/src/spine/SpineAssetWorkerClient.ts +112 -0
- package/src/spine/SpineAssetWorkerContract.ts +4 -0
- package/src/spine/SpineAtlasParser.ts +127 -0
- package/src/spine/SpineFloatBuilder.ts +66 -0
- package/src/spine/SpinePathConstraintSolver.ts +582 -0
- package/src/spine/SpinePlugin.ts +76 -0
- package/src/spine/SpineSkeletonRuntime.ts +521 -0
- package/src/spine/SpineSlotAnimation.ts +195 -0
- package/src/spine/SpineTimelineRuntime.ts +453 -0
- package/src/spine/SpineVertexBuilder.ts +686 -0
- package/src/spine.ts +7 -0
- package/src/tilemap/Tilemap2DComponent.ts +232 -0
- package/src/tilemap/Tilemap2DRenderSystem.ts +58 -0
- package/src/tilemap/Tilemap2DRenderer.ts +289 -0
- package/src/tilemap/TilemapPlugin.ts +75 -0
- package/src/tilemap.ts +6 -0
- package/src/tween/Tween2DComponent.ts +83 -0
- package/src/tween/Tween2DSystem.ts +78 -0
- package/src/tween.ts +4 -0
- package/src/types/earcut.d.ts +7 -0
- package/src/types/wgsl.d.ts +4 -0
- package/src/utils/RenderSystem2DBase.ts +164 -0
- package/src/utils/arrayAccess.ts +17 -0
- package/src/utils/camera2d.ts +68 -0
- package/src/utils/render2dGpu.ts +132 -0
- package/test/fixtures/gltf/animation-characterization.gltf +344 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { Component } from '@haiyue/engine';
|
|
2
|
+
export interface Spine2DComponentOptions {
|
|
3
|
+
jsonUrl?: string;
|
|
4
|
+
atlasUrl?: string;
|
|
5
|
+
imageUrl?: string;
|
|
6
|
+
imageUrls?: Record<string, string>;
|
|
7
|
+
skin?: string;
|
|
8
|
+
animation?: string;
|
|
9
|
+
loop?: boolean;
|
|
10
|
+
timeScale?: number;
|
|
11
|
+
scale?: number;
|
|
12
|
+
premultipliedAlpha?: boolean;
|
|
13
|
+
debugMesh?: boolean;
|
|
14
|
+
debugBones?: boolean;
|
|
15
|
+
mixDuration?: number;
|
|
16
|
+
}
|
|
17
|
+
export type Spine2DStatus = 'idle' | 'loading' | 'loaded' | 'error';
|
|
18
|
+
export declare class Spine2DComponent extends Component {
|
|
19
|
+
static UniqueCheckType: number;
|
|
20
|
+
static UniqueSymbol: symbol;
|
|
21
|
+
static editor: {
|
|
22
|
+
fields: {
|
|
23
|
+
jsonUrl: {
|
|
24
|
+
type: string;
|
|
25
|
+
label: string;
|
|
26
|
+
};
|
|
27
|
+
atlasUrl: {
|
|
28
|
+
type: string;
|
|
29
|
+
label: string;
|
|
30
|
+
};
|
|
31
|
+
imageUrl: {
|
|
32
|
+
type: string;
|
|
33
|
+
label: string;
|
|
34
|
+
};
|
|
35
|
+
skin: {
|
|
36
|
+
type: string;
|
|
37
|
+
label: string;
|
|
38
|
+
};
|
|
39
|
+
animation: {
|
|
40
|
+
type: string;
|
|
41
|
+
label: string;
|
|
42
|
+
};
|
|
43
|
+
loop: {
|
|
44
|
+
type: string;
|
|
45
|
+
label: string;
|
|
46
|
+
};
|
|
47
|
+
timeScale: {
|
|
48
|
+
type: string;
|
|
49
|
+
label: string;
|
|
50
|
+
step: number;
|
|
51
|
+
};
|
|
52
|
+
scale: {
|
|
53
|
+
type: string;
|
|
54
|
+
label: string;
|
|
55
|
+
min: number;
|
|
56
|
+
step: number;
|
|
57
|
+
};
|
|
58
|
+
premultipliedAlpha: {
|
|
59
|
+
type: string;
|
|
60
|
+
label: string;
|
|
61
|
+
};
|
|
62
|
+
debugMesh: {
|
|
63
|
+
type: string;
|
|
64
|
+
label: string;
|
|
65
|
+
};
|
|
66
|
+
debugBones: {
|
|
67
|
+
type: string;
|
|
68
|
+
label: string;
|
|
69
|
+
};
|
|
70
|
+
mixDuration: {
|
|
71
|
+
type: string;
|
|
72
|
+
label: string;
|
|
73
|
+
min: number;
|
|
74
|
+
step: number;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
private _jsonUrl;
|
|
79
|
+
private _atlasUrl;
|
|
80
|
+
private _imageUrl;
|
|
81
|
+
private _imageUrls;
|
|
82
|
+
private _imageUrlsKey;
|
|
83
|
+
private _skin;
|
|
84
|
+
private _sourceKey;
|
|
85
|
+
private _sourceKeyDirty;
|
|
86
|
+
animation: string;
|
|
87
|
+
loop: boolean;
|
|
88
|
+
timeScale: number;
|
|
89
|
+
scale: number;
|
|
90
|
+
premultipliedAlpha: boolean;
|
|
91
|
+
debugMesh: boolean;
|
|
92
|
+
debugBones: boolean;
|
|
93
|
+
mixDuration: number;
|
|
94
|
+
status: Spine2DStatus;
|
|
95
|
+
error: string | null;
|
|
96
|
+
elapsed: number;
|
|
97
|
+
previousAnimation: string;
|
|
98
|
+
previousElapsed: number;
|
|
99
|
+
mixElapsed: number;
|
|
100
|
+
runtimeKey: string;
|
|
101
|
+
loadingKey: string;
|
|
102
|
+
constructor(options?: Spine2DComponentOptions);
|
|
103
|
+
get jsonUrl(): string;
|
|
104
|
+
set jsonUrl(value: string);
|
|
105
|
+
get atlasUrl(): string;
|
|
106
|
+
set atlasUrl(value: string);
|
|
107
|
+
get imageUrl(): string;
|
|
108
|
+
set imageUrl(value: string);
|
|
109
|
+
get imageUrls(): Record<string, string>;
|
|
110
|
+
set imageUrls(value: Record<string, string>);
|
|
111
|
+
get skin(): string;
|
|
112
|
+
set skin(value: string);
|
|
113
|
+
get sourceKey(): string;
|
|
114
|
+
invalidateSourceKey(refreshImageUrlsKey?: boolean): this;
|
|
115
|
+
clone(): Spine2DComponent;
|
|
116
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type IEngine } from '@haiyue/engine/extension-authoring';
|
|
2
|
+
import { Spine2DComponent } from './Spine2DComponent';
|
|
3
|
+
import { SpineFloatBuilder } from './SpineFloatBuilder';
|
|
4
|
+
import { type AtlasRegion } from './SpineAtlasParser';
|
|
5
|
+
import { type SpineDrawBatch } from './SpineVertexBuilder';
|
|
6
|
+
export interface SpineBufferDirtyRange {
|
|
7
|
+
byteOffset: number;
|
|
8
|
+
byteLength: number;
|
|
9
|
+
}
|
|
10
|
+
export interface AtlasPageGpu {
|
|
11
|
+
image: HTMLImageElement;
|
|
12
|
+
texture: GPUTexture;
|
|
13
|
+
textureBindGroup: GPUBindGroup;
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
}
|
|
17
|
+
export interface SpineRuntimeGpu {
|
|
18
|
+
pages: Map<string, AtlasPageGpu>;
|
|
19
|
+
vertexBuffer: GPUBuffer;
|
|
20
|
+
vertexBufferSize: number;
|
|
21
|
+
debugVertexBuffer: GPUBuffer;
|
|
22
|
+
debugVertexBufferSize: number;
|
|
23
|
+
batches: SpineDrawBatch[];
|
|
24
|
+
mergedDirtyRanges: SpineBufferDirtyRange[];
|
|
25
|
+
mergedDirtyRangePool: SpineBufferDirtyRange[];
|
|
26
|
+
allocationStats: {
|
|
27
|
+
dirtyRangePoolMisses: number;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export interface SpineRuntimeGpuBuffers {
|
|
31
|
+
vertexBuffer: GPUBuffer;
|
|
32
|
+
vertexBufferSize: number;
|
|
33
|
+
debugVertexBuffer: GPUBuffer;
|
|
34
|
+
debugVertexBufferSize: number;
|
|
35
|
+
}
|
|
36
|
+
export declare class Spine2DGpuRenderer {
|
|
37
|
+
private engine;
|
|
38
|
+
private cameraGpu;
|
|
39
|
+
private textureGpu;
|
|
40
|
+
private objectLayoutGpu;
|
|
41
|
+
private shaderModule;
|
|
42
|
+
private pipelineLayout;
|
|
43
|
+
private readonly pipelines;
|
|
44
|
+
private reverseZ;
|
|
45
|
+
private sampleCount;
|
|
46
|
+
private readonly pendingBufferDestroys;
|
|
47
|
+
get cameraBuffer(): GPUBuffer;
|
|
48
|
+
get objectLayout(): GPUBindGroupLayout;
|
|
49
|
+
prepare(engine: IEngine): void;
|
|
50
|
+
destroy(): void;
|
|
51
|
+
setRenderView(reverseZ: boolean, sampleCount: 1 | 4): void;
|
|
52
|
+
createRuntimeBuffers(): SpineRuntimeGpuBuffers;
|
|
53
|
+
loadAtlasPages(component: Spine2DComponent, atlas: Map<string, AtlasRegion>): Promise<Map<string, AtlasPageGpu>>;
|
|
54
|
+
writeVertices(runtime: SpineRuntimeGpu, vertices: SpineFloatBuilder, dirtyRanges: SpineBufferDirtyRange[]): void;
|
|
55
|
+
writeDebugVertices(runtime: SpineRuntimeGpu, vertices: SpineFloatBuilder, dirtyRanges: SpineBufferDirtyRange[]): void;
|
|
56
|
+
drawRuntime(pass: GPURenderPassEncoder, runtime: SpineRuntimeGpu, objectBindGroup: GPUBindGroup, debugVertexCount: number): void;
|
|
57
|
+
destroyRuntime(runtime: SpineRuntimeGpu): void;
|
|
58
|
+
private destroyAtlasPage;
|
|
59
|
+
private getPipeline;
|
|
60
|
+
private writeDirtyRanges;
|
|
61
|
+
private deferBufferDestroy;
|
|
62
|
+
private flushPendingBufferDestroys;
|
|
63
|
+
private requireEngine;
|
|
64
|
+
private requirePrepared;
|
|
65
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type IEngine, type RenderCommandContext, type RenderPipelineEntryOptions } from '@haiyue/engine/extension-authoring';
|
|
2
|
+
import { Entity, type World } from '@haiyue/engine/ecs';
|
|
3
|
+
import type { SpineAssetWorker } from './SpineAssetWorkerContract';
|
|
4
|
+
import { RenderSystem2DBase, type RenderSystem2DBaseOptions } from '../utils/RenderSystem2DBase';
|
|
5
|
+
export interface Spine2DRenderSystemOptions extends RenderSystem2DBaseOptions {
|
|
6
|
+
assetWorker?: SpineAssetWorker | null;
|
|
7
|
+
}
|
|
8
|
+
export declare class Spine2DRenderSystem extends RenderSystem2DBase {
|
|
9
|
+
private gpuRenderer;
|
|
10
|
+
private runtimes;
|
|
11
|
+
private entityGpu;
|
|
12
|
+
private readonly liveComponents;
|
|
13
|
+
private readonly pendingLoads;
|
|
14
|
+
private readonly assetWorker;
|
|
15
|
+
private disposed;
|
|
16
|
+
get renderPipelineOptions(): RenderPipelineEntryOptions;
|
|
17
|
+
constructor(engine: IEngine, cameraEntity: Entity, options?: Spine2DRenderSystemOptions);
|
|
18
|
+
record(world: World, delta: number, context: RenderCommandContext): this;
|
|
19
|
+
destroy(): this;
|
|
20
|
+
protected releaseGpuResourcesForRecovery(): void;
|
|
21
|
+
protected restoreGpuResourcesAfterRecovery(): void;
|
|
22
|
+
private getEntityGpu;
|
|
23
|
+
private releaseRuntimesNotIn;
|
|
24
|
+
private destroyEntityGpu;
|
|
25
|
+
private destroyRuntime;
|
|
26
|
+
private ensureRuntime;
|
|
27
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Spine2DComponent } from './Spine2DComponent';
|
|
2
|
+
import { Spine2DGpuRenderer, type AtlasPageGpu, type SpineBufferDirtyRange } from './Spine2DGpuRenderer';
|
|
3
|
+
import { SpineFloatBuilder } from './SpineFloatBuilder';
|
|
4
|
+
import { type AtlasRegion } from './SpineAtlasParser';
|
|
5
|
+
import { type SpinePathConstraintScratch } from './SpinePathConstraintSolver';
|
|
6
|
+
import { type SpineDrawBatch, type SpineSlotGeometryCache } from './SpineVertexBuilder';
|
|
7
|
+
import { type BonePose, type IkConstraintData, type PathConstraintData, type SliderAnimationState, type SliderConstraintData, type SlotData, type SpineData, type TransformConstraintData } from './SpineSkeletonRuntime';
|
|
8
|
+
import { type SpineTimelineCompileStats, type SpineTimelineSamplerState } from './SpineTimelineRuntime';
|
|
9
|
+
import type { SpineAssetWorker } from './SpineAssetWorkerContract';
|
|
10
|
+
export interface SpineVertexBuild {
|
|
11
|
+
vertices: SpineFloatBuilder;
|
|
12
|
+
batches: SpineDrawBatch[];
|
|
13
|
+
debugVertices: SpineFloatBuilder;
|
|
14
|
+
vertexDirtyRanges: SpineBufferDirtyRange[];
|
|
15
|
+
debugDirtyRanges: SpineBufferDirtyRange[];
|
|
16
|
+
verticesChanged: boolean;
|
|
17
|
+
debugVerticesChanged: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface SpineRuntimeAllocationStats {
|
|
20
|
+
slotRegionGrowths: number;
|
|
21
|
+
batchPoolMisses: number;
|
|
22
|
+
dirtyRangePoolMisses: number;
|
|
23
|
+
}
|
|
24
|
+
type SpineConstraintEntry = {
|
|
25
|
+
type: 'ik';
|
|
26
|
+
order: number;
|
|
27
|
+
constraint: IkConstraintData;
|
|
28
|
+
} | {
|
|
29
|
+
type: 'path';
|
|
30
|
+
order: number;
|
|
31
|
+
constraint: PathConstraintData;
|
|
32
|
+
} | {
|
|
33
|
+
type: 'transform';
|
|
34
|
+
order: number;
|
|
35
|
+
constraint: TransformConstraintData;
|
|
36
|
+
};
|
|
37
|
+
export interface SpineRuntime extends SpinePathConstraintScratch {
|
|
38
|
+
data: SpineData;
|
|
39
|
+
atlas: Map<string, AtlasRegion>;
|
|
40
|
+
pages: Map<string, AtlasPageGpu>;
|
|
41
|
+
vertexBuffer: GPUBuffer;
|
|
42
|
+
vertexBufferSize: number;
|
|
43
|
+
debugVertexBuffer: GPUBuffer;
|
|
44
|
+
debugVertexBufferSize: number;
|
|
45
|
+
batches: SpineDrawBatch[];
|
|
46
|
+
batchPool: SpineDrawBatch[];
|
|
47
|
+
vertexBuilder: SpineFloatBuilder;
|
|
48
|
+
debugVertexBuilder: SpineFloatBuilder;
|
|
49
|
+
slotVertexBuilder: SpineFloatBuilder;
|
|
50
|
+
slotDebugVertexBuilder: SpineFloatBuilder;
|
|
51
|
+
clipBuilder: SpineFloatBuilder;
|
|
52
|
+
meshPointBuilder: SpineFloatBuilder;
|
|
53
|
+
slotGeometryCache: Map<string, SpineSlotGeometryCache>;
|
|
54
|
+
slotOrderHash: number;
|
|
55
|
+
boneChildren: Map<string, string[]>;
|
|
56
|
+
setupPoses: Map<string, BonePose>;
|
|
57
|
+
previousSetupPoses: Map<string, BonePose>;
|
|
58
|
+
slotIndexByName: Map<string, number>;
|
|
59
|
+
slotCacheKeyByName: Map<string, string>;
|
|
60
|
+
sliderConstraintsByOrder: SliderConstraintData[];
|
|
61
|
+
sortedConstraintsBySkin: Map<string, SpineConstraintEntry[]>;
|
|
62
|
+
transformConstraintBoneSets: WeakMap<TransformConstraintData, Set<string>>;
|
|
63
|
+
transformWorldSpaceBonesScratch: string[];
|
|
64
|
+
drawOrderScratch: number[];
|
|
65
|
+
unchangedSlotScratch: number[];
|
|
66
|
+
orderedSlotScratch: SlotData[];
|
|
67
|
+
liveSlotKeys: Set<string>;
|
|
68
|
+
slotEntries: SpineSlotGeometryCache[];
|
|
69
|
+
changedVertexEntries: SpineSlotGeometryCache[];
|
|
70
|
+
changedDebugEntries: SpineSlotGeometryCache[];
|
|
71
|
+
sliderStateScratch: SliderAnimationState[];
|
|
72
|
+
sliderStatePool: SliderAnimationState[];
|
|
73
|
+
vertexDirtyRanges: SpineBufferDirtyRange[];
|
|
74
|
+
debugDirtyRanges: SpineBufferDirtyRange[];
|
|
75
|
+
mergedDirtyRanges: SpineBufferDirtyRange[];
|
|
76
|
+
vertexDirtyRangePool: SpineBufferDirtyRange[];
|
|
77
|
+
debugDirtyRangePool: SpineBufferDirtyRange[];
|
|
78
|
+
mergedDirtyRangePool: SpineBufferDirtyRange[];
|
|
79
|
+
vertexBuildResult: SpineVertexBuild;
|
|
80
|
+
slotColorScratch: [number, number, number, number];
|
|
81
|
+
sliderColorScratch: [number, number, number, number];
|
|
82
|
+
vertexColorScratch: [number, number, number, number];
|
|
83
|
+
timelineCompileStats: SpineTimelineCompileStats;
|
|
84
|
+
timelineSamplerState: SpineTimelineSamplerState;
|
|
85
|
+
allocationStats: SpineRuntimeAllocationStats;
|
|
86
|
+
ikStateScratch: {
|
|
87
|
+
mix: number;
|
|
88
|
+
softness: number;
|
|
89
|
+
bendPositive: boolean;
|
|
90
|
+
};
|
|
91
|
+
transformStateScratch: Pick<TransformConstraintData, 'mixRotate' | 'mixX' | 'mixY' | 'mixScaleX' | 'mixScaleY' | 'mixShearY'>;
|
|
92
|
+
}
|
|
93
|
+
export declare function advanceSpineRuntime(component: Spine2DComponent, delta: number): void;
|
|
94
|
+
export declare function buildSpineVertices(component: Spine2DComponent, runtime: SpineRuntime): SpineVertexBuild;
|
|
95
|
+
export declare function loadSpineRuntime(gpuRenderer: Spine2DGpuRenderer, component: Spine2DComponent, options?: {
|
|
96
|
+
assetWorker?: SpineAssetWorker | null;
|
|
97
|
+
signal?: AbortSignal;
|
|
98
|
+
}): Promise<SpineRuntime>;
|
|
99
|
+
/** Monorepo benchmark adapter; not re-exported from the Spine package facade. */
|
|
100
|
+
export declare function createSpineRuntimeForBenchmark(data: SpineData, atlas: Map<string, AtlasRegion>, pages: Map<string, AtlasPageGpu>): SpineRuntime;
|
|
101
|
+
/** Monorepo benchmark adapter; samples the complete animation/constraint pose path. */
|
|
102
|
+
export declare function sampleSpinePosesForBenchmark(component: Spine2DComponent, runtime: SpineRuntime): number;
|
|
103
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SpineAnimationBoneTimelines, SpineAnimationData } from './SpineSkeletonRuntime';
|
|
2
|
+
interface SpineAnimationBoneTimelineEntry {
|
|
3
|
+
boneName: string;
|
|
4
|
+
timelines: SpineAnimationBoneTimelines;
|
|
5
|
+
}
|
|
6
|
+
export declare function compileAnimationBoneTimelines(animations: Record<string, SpineAnimationData>): void;
|
|
7
|
+
export declare function getAnimationBoneTimelines(animation: SpineAnimationData | undefined): SpineAnimationBoneTimelineEntry[];
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type AtlasRegion } from './SpineAtlasParser';
|
|
2
|
+
export interface SpineAssetParserInput {
|
|
3
|
+
json: unknown;
|
|
4
|
+
atlasText: string;
|
|
5
|
+
}
|
|
6
|
+
/** Structured-clone-safe parser boundary; the runtime validates and narrows this payload before use. */
|
|
7
|
+
export interface SpineParsedAsset {
|
|
8
|
+
data: unknown;
|
|
9
|
+
regions: Array<[string, AtlasRegion]>;
|
|
10
|
+
}
|
|
11
|
+
export declare const SPINE_ASSET_PARSER: Readonly<{
|
|
12
|
+
type: "skeleton/spine";
|
|
13
|
+
parse(input: SpineAssetParserInput, _context?: {
|
|
14
|
+
signal?: AbortSignal;
|
|
15
|
+
source?: string;
|
|
16
|
+
}): SpineParsedAsset;
|
|
17
|
+
}>;
|
|
18
|
+
export declare function parseSpineAssetPayload(input: SpineAssetParserInput): SpineParsedAsset;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type WorkerChannelLike } from '@haiyue/engine/experimental/async';
|
|
2
|
+
import type { SpineParsedAsset } from './SpineAssetParser';
|
|
3
|
+
import type { SpineAssetWorker } from './SpineAssetWorkerContract';
|
|
4
|
+
type SpineWorkerLike = WorkerChannelLike;
|
|
5
|
+
export declare class SpineAssetWorkerClient implements SpineAssetWorker {
|
|
6
|
+
private readonly objectUrl;
|
|
7
|
+
private readonly channel;
|
|
8
|
+
constructor(worker: SpineWorkerLike, objectUrl?: string | null);
|
|
9
|
+
loadParsedAsset(jsonUrl: string, atlasUrl: string, options?: {
|
|
10
|
+
signal?: AbortSignal;
|
|
11
|
+
}): Promise<SpineParsedAsset>;
|
|
12
|
+
dispose(options?: {
|
|
13
|
+
terminate?: boolean;
|
|
14
|
+
}): void;
|
|
15
|
+
}
|
|
16
|
+
export declare function createSpineAssetWorkerSource(extensionSpineModuleUrl: string): string;
|
|
17
|
+
export declare function createInlineSpineAssetWorkerClient(extensionSpineModuleUrl: string, options?: WorkerOptions): SpineAssetWorkerClient;
|
|
18
|
+
export declare function createSpineAssetWorkerClientFromUrl(url: string | URL, options?: WorkerOptions): SpineAssetWorkerClient;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface AtlasRegion {
|
|
2
|
+
name: string;
|
|
3
|
+
page: string;
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
originalWidth: number;
|
|
9
|
+
originalHeight: number;
|
|
10
|
+
offsetX: number;
|
|
11
|
+
offsetY: number;
|
|
12
|
+
rotate: number;
|
|
13
|
+
}
|
|
14
|
+
export interface ResolveAtlasPageImageOptions {
|
|
15
|
+
atlasUrl: string;
|
|
16
|
+
imageUrl: string;
|
|
17
|
+
imageUrls: Record<string, string>;
|
|
18
|
+
}
|
|
19
|
+
export declare function parseAtlas(text: string): Map<string, AtlasRegion>;
|
|
20
|
+
export declare function resolveAtlasPageImageUrl(options: ResolveAtlasPageImageOptions, atlas: Map<string, AtlasRegion>, page: string): string;
|
|
21
|
+
export declare function atlasPageCount(atlas: Map<string, AtlasRegion>): number;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare class SpineFloatBuilder {
|
|
2
|
+
data: Float32Array;
|
|
3
|
+
length: number;
|
|
4
|
+
constructor(initialCapacity?: number);
|
|
5
|
+
clear(): void;
|
|
6
|
+
get byteLength(): number;
|
|
7
|
+
get(index: number): number;
|
|
8
|
+
push(...values: number[]): void;
|
|
9
|
+
push8(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): void;
|
|
10
|
+
appendArray(values: ArrayLike<number>, length?: number): void;
|
|
11
|
+
truncate(length: number): void;
|
|
12
|
+
/** Grows storage if needed and exposes a reusable writable region without allocating a temporary array. */
|
|
13
|
+
reserveLength(length: number): void;
|
|
14
|
+
private ensureCapacity;
|
|
15
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Spine2DComponent } from './Spine2DComponent';
|
|
2
|
+
import { type BonePose, type PathConstraintData, type SpineData } from './SpineSkeletonRuntime';
|
|
3
|
+
import { type SpineTimelineSamplerState } from './SpineTimelineRuntime';
|
|
4
|
+
export interface SpinePathConstraintScratch {
|
|
5
|
+
pathBonesScratch: BonePose[];
|
|
6
|
+
pathConstrainedBonesScratch: Set<string>;
|
|
7
|
+
pathSpacesScratch: number[];
|
|
8
|
+
pathLengthsScratch: number[];
|
|
9
|
+
pathWorldScratch: number[];
|
|
10
|
+
pathOutScratch: number[];
|
|
11
|
+
pathCurveWorldScratch: number[];
|
|
12
|
+
pathCurvesScratch: number[];
|
|
13
|
+
pathSegmentsScratch: number[];
|
|
14
|
+
pathCurvePointScratch: number[];
|
|
15
|
+
pathStateScratch: {
|
|
16
|
+
position: number;
|
|
17
|
+
spacing: number;
|
|
18
|
+
mixRotate: number;
|
|
19
|
+
mixX: number;
|
|
20
|
+
mixY: number;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface SpinePathConstraintRuntime extends SpinePathConstraintScratch {
|
|
24
|
+
data: SpineData;
|
|
25
|
+
timelineSamplerState: SpineTimelineSamplerState;
|
|
26
|
+
}
|
|
27
|
+
export interface SpinePathConstraintDeps {
|
|
28
|
+
normalizeRadians(value: number): number;
|
|
29
|
+
updateDescendantBoneTrees(name: string, poses: Map<string, BonePose>, children: Map<string, string[]>, blockedRoots?: Set<string>): void;
|
|
30
|
+
}
|
|
31
|
+
export declare function createSpinePathConstraintScratch(): SpinePathConstraintScratch;
|
|
32
|
+
export declare function applyPathConstraint(runtime: SpinePathConstraintRuntime, component: Spine2DComponent, constraint: PathConstraintData, time: number, duration: number, loop: boolean, poses: Map<string, BonePose>, children: Map<string, string[]>, deps: SpinePathConstraintDeps): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EnginePlugin } from '@haiyue/engine/core';
|
|
2
|
+
import type { RenderPipelineEntryOptions } from '@haiyue/engine/extension-authoring';
|
|
3
|
+
import { type Spine2DRenderSystemOptions } from './Spine2DRenderSystem';
|
|
4
|
+
export interface SpinePluginOptions {
|
|
5
|
+
system?: Spine2DRenderSystemOptions;
|
|
6
|
+
render?: RenderPipelineEntryOptions | false | null;
|
|
7
|
+
}
|
|
8
|
+
export declare function createSpinePlugin(options?: SpinePluginOptions): EnginePlugin;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
export interface BoneData {
|
|
2
|
+
name: string;
|
|
3
|
+
parent?: string;
|
|
4
|
+
inherit?: string;
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
rotation: number;
|
|
8
|
+
shearX: number;
|
|
9
|
+
shearY: number;
|
|
10
|
+
scaleX: number;
|
|
11
|
+
scaleY: number;
|
|
12
|
+
length: number;
|
|
13
|
+
}
|
|
14
|
+
export interface IkConstraintData {
|
|
15
|
+
name: string;
|
|
16
|
+
order: number;
|
|
17
|
+
skin: boolean;
|
|
18
|
+
bones: string[];
|
|
19
|
+
target: string;
|
|
20
|
+
mix: number;
|
|
21
|
+
softness: number;
|
|
22
|
+
bendPositive: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface TransformConstraintData {
|
|
25
|
+
name: string;
|
|
26
|
+
order: number;
|
|
27
|
+
skin: boolean;
|
|
28
|
+
bones: string[];
|
|
29
|
+
target: string;
|
|
30
|
+
rotation: number;
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
scaleX: number;
|
|
34
|
+
scaleY: number;
|
|
35
|
+
shearY: number;
|
|
36
|
+
mixRotate: number;
|
|
37
|
+
mixX: number;
|
|
38
|
+
mixY: number;
|
|
39
|
+
mixScaleX: number;
|
|
40
|
+
mixScaleY: number;
|
|
41
|
+
mixShearY: number;
|
|
42
|
+
localSource: boolean;
|
|
43
|
+
localTarget: boolean;
|
|
44
|
+
additive: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface PathConstraintData {
|
|
47
|
+
name: string;
|
|
48
|
+
order: number;
|
|
49
|
+
skin: boolean;
|
|
50
|
+
bones: string[];
|
|
51
|
+
slot: string;
|
|
52
|
+
position: number;
|
|
53
|
+
spacing: number;
|
|
54
|
+
mixRotate: number;
|
|
55
|
+
mixX: number;
|
|
56
|
+
mixY: number;
|
|
57
|
+
positionMode: string;
|
|
58
|
+
spacingMode: string;
|
|
59
|
+
rotateMode: string;
|
|
60
|
+
offsetRotation: number;
|
|
61
|
+
}
|
|
62
|
+
export interface SliderConstraintData {
|
|
63
|
+
name: string;
|
|
64
|
+
order: number;
|
|
65
|
+
skin: boolean;
|
|
66
|
+
animation: string;
|
|
67
|
+
bone?: string;
|
|
68
|
+
property: string;
|
|
69
|
+
scale: number;
|
|
70
|
+
offset: number;
|
|
71
|
+
loop: boolean;
|
|
72
|
+
local: boolean;
|
|
73
|
+
mix: number;
|
|
74
|
+
}
|
|
75
|
+
export interface SlotData {
|
|
76
|
+
name: string;
|
|
77
|
+
bone: string;
|
|
78
|
+
attachment?: string;
|
|
79
|
+
color?: [number, number, number, number];
|
|
80
|
+
blend: 'normal' | 'additive' | string;
|
|
81
|
+
}
|
|
82
|
+
export interface RegionAttachment {
|
|
83
|
+
type?: string;
|
|
84
|
+
name: string;
|
|
85
|
+
path: string;
|
|
86
|
+
x: number;
|
|
87
|
+
y: number;
|
|
88
|
+
rotation: number;
|
|
89
|
+
scaleX: number;
|
|
90
|
+
scaleY: number;
|
|
91
|
+
width: number;
|
|
92
|
+
height: number;
|
|
93
|
+
color?: [number, number, number, number];
|
|
94
|
+
uvs?: number[];
|
|
95
|
+
triangles?: number[];
|
|
96
|
+
vertices?: number[];
|
|
97
|
+
vertexCount?: number;
|
|
98
|
+
lengths?: number[];
|
|
99
|
+
sequence?: {
|
|
100
|
+
count?: number;
|
|
101
|
+
start?: number;
|
|
102
|
+
digits?: number;
|
|
103
|
+
setup?: number;
|
|
104
|
+
};
|
|
105
|
+
closed?: boolean;
|
|
106
|
+
constantSpeed?: boolean;
|
|
107
|
+
end?: string;
|
|
108
|
+
skin?: string;
|
|
109
|
+
source?: string;
|
|
110
|
+
}
|
|
111
|
+
export interface SpineAnimationBoneTimelines {
|
|
112
|
+
rotate?: unknown[];
|
|
113
|
+
translate?: unknown[];
|
|
114
|
+
scale?: unknown[];
|
|
115
|
+
shear?: unknown[];
|
|
116
|
+
[timeline: string]: unknown;
|
|
117
|
+
}
|
|
118
|
+
export interface SpineAnimationData {
|
|
119
|
+
bones?: Record<string, SpineAnimationBoneTimelines>;
|
|
120
|
+
slots?: Record<string, {
|
|
121
|
+
attachment?: Array<{
|
|
122
|
+
time?: number;
|
|
123
|
+
name?: string | null;
|
|
124
|
+
}>;
|
|
125
|
+
rgba?: unknown[];
|
|
126
|
+
[timeline: string]: unknown;
|
|
127
|
+
}>;
|
|
128
|
+
attachments?: Record<string, Record<string, Record<string, {
|
|
129
|
+
sequence?: unknown[];
|
|
130
|
+
}>>>;
|
|
131
|
+
ik?: Record<string, unknown[]>;
|
|
132
|
+
transform?: Record<string, unknown[]>;
|
|
133
|
+
path?: Record<string, unknown[]>;
|
|
134
|
+
slider?: Record<string, {
|
|
135
|
+
mix?: unknown[];
|
|
136
|
+
}>;
|
|
137
|
+
drawOrder?: Array<{
|
|
138
|
+
time?: number;
|
|
139
|
+
offsets?: Array<{
|
|
140
|
+
slot: string;
|
|
141
|
+
offset?: number;
|
|
142
|
+
}>;
|
|
143
|
+
}>;
|
|
144
|
+
[timeline: string]: unknown;
|
|
145
|
+
}
|
|
146
|
+
export interface SpineData {
|
|
147
|
+
bones: BoneData[];
|
|
148
|
+
ik: IkConstraintData[];
|
|
149
|
+
transform: TransformConstraintData[];
|
|
150
|
+
path: PathConstraintData[];
|
|
151
|
+
sliders: SliderConstraintData[];
|
|
152
|
+
slots: SlotData[];
|
|
153
|
+
skins: Record<string, Record<string, Record<string, RegionAttachment>>>;
|
|
154
|
+
skinConstraints: Record<string, {
|
|
155
|
+
ik: string[];
|
|
156
|
+
transform: string[];
|
|
157
|
+
path: string[];
|
|
158
|
+
slider: string[];
|
|
159
|
+
}>;
|
|
160
|
+
animations: Record<string, SpineAnimationData>;
|
|
161
|
+
}
|
|
162
|
+
export interface BonePose {
|
|
163
|
+
data: BoneData;
|
|
164
|
+
a: number;
|
|
165
|
+
b: number;
|
|
166
|
+
c: number;
|
|
167
|
+
d: number;
|
|
168
|
+
worldX: number;
|
|
169
|
+
worldY: number;
|
|
170
|
+
rotation: number;
|
|
171
|
+
shearX: number;
|
|
172
|
+
shearY: number;
|
|
173
|
+
x: number;
|
|
174
|
+
y: number;
|
|
175
|
+
scaleX: number;
|
|
176
|
+
scaleY: number;
|
|
177
|
+
}
|
|
178
|
+
export interface SliderAnimationState {
|
|
179
|
+
animation: string;
|
|
180
|
+
time: number;
|
|
181
|
+
loop: boolean;
|
|
182
|
+
mix: number;
|
|
183
|
+
}
|
|
184
|
+
export declare function normalizeSpineData(input: unknown): SpineData;
|
|
185
|
+
export declare function parseColor(value?: string): [number, number, number, number] | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Spine2DComponent } from './Spine2DComponent';
|
|
2
|
+
import type { RegionAttachment, SliderAnimationState, SlotData, SpineData } from './SpineSkeletonRuntime';
|
|
3
|
+
import { type SpineTimelineSamplerState } from './SpineTimelineRuntime';
|
|
4
|
+
interface SpineSlotAnimationRuntime {
|
|
5
|
+
readonly data: SpineData;
|
|
6
|
+
readonly timelineSamplerState: SpineTimelineSamplerState;
|
|
7
|
+
readonly slotColorScratch: [number, number, number, number];
|
|
8
|
+
readonly sliderColorScratch: [number, number, number, number];
|
|
9
|
+
}
|
|
10
|
+
type SpineSlotAnimationComponent = Pick<Spine2DComponent, 'animation' | 'skin'>;
|
|
11
|
+
/** Resolves the active slot attachment timeline without owning pose evaluation. */
|
|
12
|
+
export declare function getSpineSlotAttachmentName(runtime: SpineSlotAnimationRuntime, component: SpineSlotAnimationComponent, slot: SlotData, time: number): string | null;
|
|
13
|
+
/** Resolves sequence attachments across the base animation and slider overlays. */
|
|
14
|
+
export declare function getSpineAttachmentRegionName(runtime: SpineSlotAnimationRuntime, component: SpineSlotAnimationComponent, slot: SlotData, attachmentName: string, attachment: RegionAttachment, time: number, sliderStates: readonly SliderAnimationState[]): string;
|
|
15
|
+
/** Samples slot RGBA timelines and slider blends into runtime-owned scratch storage. */
|
|
16
|
+
export declare function getSpineSlotColor(runtime: SpineSlotAnimationRuntime, component: SpineSlotAnimationComponent, slot: SlotData, time: number, sliderStates: readonly SliderAnimationState[]): [number, number, number, number];
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
interface SpineTimelineCursor {
|
|
2
|
+
intervalCursor: number;
|
|
3
|
+
intervalTime: number;
|
|
4
|
+
discreteCursor: number;
|
|
5
|
+
discreteTime: number;
|
|
6
|
+
}
|
|
7
|
+
/** Runtime-local playback cursors; compiled timeline TypedArrays remain immutable and shareable. */
|
|
8
|
+
export interface SpineTimelineSamplerState {
|
|
9
|
+
readonly cursors: WeakMap<object, SpineTimelineCursor>;
|
|
10
|
+
cursorMisses: number;
|
|
11
|
+
}
|
|
12
|
+
export interface SpineTimelineCompileStats {
|
|
13
|
+
readonly timelineCount: number;
|
|
14
|
+
readonly frameCount: number;
|
|
15
|
+
readonly numericChannelCount: number;
|
|
16
|
+
}
|
|
17
|
+
export declare function createSpineTimelineSamplerState(): SpineTimelineSamplerState;
|
|
18
|
+
/** Eagerly compiles every frame array reachable from the animation tree. */
|
|
19
|
+
export declare function compileSpineTimelines(animations: Record<string, unknown>, samplerState?: SpineTimelineSamplerState): SpineTimelineCompileStats;
|
|
20
|
+
export declare function getCompiledAnimationDuration(animation: unknown): number;
|
|
21
|
+
export declare function sampleCompiledTimeline(frames: unknown[], time: number, key: string, fallback: number, _duration?: number, _loop?: boolean, samplerState?: SpineTimelineSamplerState): number;
|
|
22
|
+
/** Returns the last frame whose time is <= sample time, or -1 before the first frame. */
|
|
23
|
+
export declare function findCompiledFrameIndex(frames: unknown[] | undefined, time: number, samplerState?: SpineTimelineSamplerState): number;
|
|
24
|
+
export declare function sampleCompiledColor(frames: unknown[], time: number, fallback: ArrayLike<number>, out: [number, number, number, number], samplerState?: SpineTimelineSamplerState): [number, number, number, number];
|
|
25
|
+
export {};
|