@haiyue/extensions 0.1.0 → 0.2.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.
Files changed (269) hide show
  1. package/README.md +25 -0
  2. package/dist/animation/Animation2DComponent.d.ts +18 -0
  3. package/dist/animation/Animation2DExtensionRegistry.d.ts +7 -0
  4. package/dist/animation/Animation2DRenderSystem.d.ts +6 -0
  5. package/dist/animation/Animation2DRuntime.d.ts +6 -2
  6. package/dist/animation/AnimationTextRasterizer.d.ts +4 -0
  7. package/dist/animation/AnimationVisual2D.d.ts +58 -2
  8. package/dist/animation/interaction/InteractionRuntime.d.ts +83 -0
  9. package/dist/animation/interaction/runtime-types.d.ts +257 -0
  10. package/dist/animation.d.ts +3 -1
  11. package/dist/animation.js +551 -59
  12. package/dist/animation3d.js +1 -1
  13. package/dist/canvas-text.js +1 -1
  14. package/dist/chunks/2d-ui-animation-2d.generated-FpziAeGJ.js +4 -0
  15. package/dist/chunks/2d-ui-indexed-sprite.generated-DmKR0CC3.js +4 -0
  16. package/dist/chunks/Animation2DStateMachine-BHcA6Cu3.js +18212 -0
  17. package/dist/chunks/{AnimationStateMachineController-BIcAh-sT.js → AnimationStateMachineController-4sKaqh9E.js} +2 -2
  18. package/dist/chunks/AnimationVisual2D-8y3qp0_U.js +230 -0
  19. package/dist/chunks/{RenderSystem2DBase-DDT61dAu.js → RenderSystem2DBase-CF2s00vg.js} +2 -2
  20. package/dist/controls/VirtualJoystickControls.d.ts +46 -0
  21. package/dist/controls/contracts.d.ts +91 -0
  22. package/dist/controls.d.ts +2 -0
  23. package/dist/controls.js +358 -0
  24. package/dist/deformable-animation/runtime/DeformableMesh2DRuntimeExtension.d.ts +11 -0
  25. package/dist/deformable-animation/runtime/DeformableMesh2DSampler.d.ts +11 -0
  26. package/dist/deformable-animation.d.ts +5 -0
  27. package/dist/deformable-animation.js +316 -0
  28. package/dist/experimental-indexed-sprite.d.ts +5 -0
  29. package/dist/experimental-indexed-sprite.js +482 -0
  30. package/dist/gltf-worker-runtime.js +9 -9
  31. package/dist/hya-state-machine.js +3 -2
  32. package/dist/index.js +1 -1
  33. package/dist/indexed-sprite/AtlasLayout.d.ts +2 -0
  34. package/dist/indexed-sprite/IndexedSpriteRenderer.d.ts +23 -0
  35. package/dist/indexed-sprite/contracts.d.ts +89 -0
  36. package/dist/internal/2d-ui-shader-artifact.js +232 -23
  37. package/dist/ray-tracing/acceleration/bvh.d.ts +37 -0
  38. package/dist/ray-tracing/acceleration/index.d.ts +6 -0
  39. package/dist/ray-tracing/acceleration/pack.d.ts +152 -0
  40. package/dist/ray-tracing/acceleration/query.d.ts +4 -0
  41. package/dist/ray-tracing/acceleration/runtime.d.ts +30 -0
  42. package/dist/ray-tracing/acceleration/tlas.d.ts +4 -0
  43. package/dist/ray-tracing/acceleration/types.d.ts +165 -0
  44. package/dist/ray-tracing/denoise/index.d.ts +3 -0
  45. package/dist/ray-tracing/denoise/layout.d.ts +9 -0
  46. package/dist/ray-tracing/denoise/runtime.d.ts +23 -0
  47. package/dist/ray-tracing/denoise/types.d.ts +28 -0
  48. package/dist/ray-tracing/hybrid/contract.d.ts +2 -0
  49. package/dist/ray-tracing/hybrid/index.d.ts +5 -0
  50. package/dist/ray-tracing/hybrid/layout.d.ts +17 -0
  51. package/dist/ray-tracing/hybrid/plan.d.ts +2 -0
  52. package/dist/ray-tracing/hybrid/runtime.d.ts +31 -0
  53. package/dist/ray-tracing/hybrid/shaders/hybrid-artifact.generated.d.ts +625 -0
  54. package/dist/ray-tracing/hybrid/types.d.ts +144 -0
  55. package/dist/ray-tracing/lifecycle/device-recovery.d.ts +31 -0
  56. package/dist/ray-tracing/lifecycle/index.d.ts +2 -0
  57. package/dist/ray-tracing/lifecycle/types.d.ts +37 -0
  58. package/dist/ray-tracing/material/index.d.ts +2 -0
  59. package/dist/ray-tracing/material/pack.d.ts +5 -0
  60. package/dist/ray-tracing/material/types.d.ts +63 -0
  61. package/dist/ray-tracing/reference/index.d.ts +122 -0
  62. package/dist/ray-tracing/renderer/index.d.ts +7 -0
  63. package/dist/ray-tracing/renderer/layout.d.ts +20 -0
  64. package/dist/ray-tracing/renderer/plan.d.ts +2 -0
  65. package/dist/ray-tracing/renderer/reference.d.ts +17 -0
  66. package/dist/ray-tracing/renderer/runtime.d.ts +39 -0
  67. package/dist/ray-tracing/renderer/scene.d.ts +4 -0
  68. package/dist/ray-tracing/renderer/types.d.ts +115 -0
  69. package/dist/ray-tracing/sampling/index.d.ts +8 -0
  70. package/dist/ray-tracing/sampling/layout.d.ts +12 -0
  71. package/dist/ray-tracing/sampling/plan.d.ts +5 -0
  72. package/dist/ray-tracing/sampling/revision.d.ts +15 -0
  73. package/dist/ray-tracing/sampling/runtime.d.ts +44 -0
  74. package/dist/ray-tracing/sampling/sequence.d.ts +2 -0
  75. package/dist/ray-tracing/sampling/types.d.ts +96 -0
  76. package/dist/ray-tracing/scene/index.d.ts +41 -0
  77. package/dist/ray-tracing/traversal/index.d.ts +4 -0
  78. package/dist/ray-tracing/traversal/layout.d.ts +16 -0
  79. package/dist/ray-tracing/traversal/plan.d.ts +2 -0
  80. package/dist/ray-tracing/traversal/runtime.d.ts +25 -0
  81. package/dist/ray-tracing/traversal/types.d.ts +79 -0
  82. package/dist/ray-tracing/worker/client.d.ts +25 -0
  83. package/dist/ray-tracing/worker/index.d.ts +5 -0
  84. package/dist/ray-tracing/worker/runtime.d.ts +11 -0
  85. package/dist/ray-tracing/worker/serialization.d.ts +16 -0
  86. package/dist/ray-tracing/worker/source.d.ts +1 -0
  87. package/dist/ray-tracing/worker/types.d.ts +91 -0
  88. package/dist/ray-tracing.d.ts +17 -0
  89. package/dist/ray-tracing.js +7666 -0
  90. package/dist/spine.js +1 -1
  91. package/dist/tilemap.js +1 -1
  92. package/package.json +26 -23
  93. package/dist/animation/Animation2DStateMachineVisualRuntime.d.ts +0 -27
  94. package/dist/animation/Particle2DDescriptorAdapter.d.ts +0 -5
  95. package/dist/animation3d/Animation3DResource.d.ts +0 -28
  96. package/dist/animation3d/hya/HyaAnimation3DStateMachineRuntime.d.ts +0 -65
  97. package/dist/animation3d/hya/index.d.ts +0 -4
  98. package/dist/animation3d/runtime/integration/Animation3DStateMachineMixerAdapter.d.ts +0 -81
  99. package/dist/animation3d/runtime/integration/Animation3DStateMachineMixerIntegration.d.ts +0 -39
  100. package/dist/animation3d/runtime/integration/index.d.ts +0 -2
  101. package/dist/animation3d/runtime/mixer/Action.d.ts +0 -150
  102. package/dist/animation3d/runtime/mixer/Animation3DMixerRuntimeStore.d.ts +0 -6
  103. package/dist/animation3d/runtime/mixer/Mixer.d.ts +0 -59
  104. package/dist/animation3d/runtime/mixer/PoseBuffer.d.ts +0 -1
  105. package/dist/animation3d/runtime/mixer/TrackSampler.d.ts +0 -24
  106. package/dist/animation3d/runtime/mixer/index.d.ts +0 -4
  107. package/dist/animation3d/runtime/state-machine/Animation3DBlendTreeWeights.d.ts +0 -1
  108. package/dist/animation3d/runtime/state-machine/Animation3DStateMachineCompiler.d.ts +0 -1
  109. package/dist/animation3d/runtime/state-machine/Animation3DStateMachineController.d.ts +0 -1
  110. package/dist/animation3d/runtime/state-machine/Animation3DStateMachineMixerPort.d.ts +0 -1
  111. package/dist/animation3d/runtime/state-machine/index.d.ts +0 -6
  112. package/dist/benchmark.d.ts +0 -30
  113. package/dist/chunks/2d-ui-animation-2d.generated-D4aHzFU2.js +0 -4
  114. package/dist/chunks/Animation2DStateMachine-9IonguNa.js +0 -3245
  115. package/dist/gltf/GltfAccessorReader.d.ts +0 -7
  116. package/dist/gltf/GltfDracoDecoder.d.ts +0 -4
  117. package/dist/gltf/GltfLoaderErrors.d.ts +0 -4
  118. package/dist/gltf/GltfMaterialDescriptor.d.ts +0 -23
  119. package/dist/gltf/GltfMaterialLoader.d.ts +0 -6
  120. package/dist/gltf-worker-runtime.d.ts +0 -7
  121. package/dist/plugins/pluginUtils.d.ts +0 -20
  122. package/dist/plugins.d.ts +0 -6
  123. package/dist/shaders/generated/2d-ui-artifact.generated.d.ts +0 -658
  124. package/dist/spine/Spine2DGpuRenderer.d.ts +0 -65
  125. package/dist/spine/Spine2DRuntime.d.ts +0 -103
  126. package/dist/spine/SpineAnimationBoneTimelines.d.ts +0 -8
  127. package/dist/spine/SpineFloatBuilder.d.ts +0 -15
  128. package/dist/spine/SpinePathConstraintSolver.d.ts +0 -32
  129. package/dist/spine/SpineSkeletonRuntime.d.ts +0 -185
  130. package/dist/spine/SpineSlotAnimation.d.ts +0 -17
  131. package/dist/spine/SpineTimelineRuntime.d.ts +0 -25
  132. package/dist/spine/SpineVertexBuilder.d.ts +0 -61
  133. package/dist/tilemap/Tilemap2DRenderer.d.ts +0 -24
  134. package/dist/utils/arrayAccess.d.ts +0 -4
  135. package/dist/utils/camera2d.d.ts +0 -12
  136. package/src/animation/Animation2DComponent.ts +0 -135
  137. package/src/animation/Animation2DExtensionRegistry.ts +0 -52
  138. package/src/animation/Animation2DRenderSystem.ts +0 -1026
  139. package/src/animation/Animation2DRuntime.ts +0 -1326
  140. package/src/animation/Animation2DStateMachine.ts +0 -39
  141. package/src/animation/Animation2DStateMachineComponent.ts +0 -228
  142. package/src/animation/Animation2DStateMachineRuntime.ts +0 -141
  143. package/src/animation/Animation2DStateMachineSystem.ts +0 -60
  144. package/src/animation/Animation2DStateMachineVisualRuntime.ts +0 -282
  145. package/src/animation/Animation2DSystem.ts +0 -72
  146. package/src/animation/AnimationAssetLoader.ts +0 -84
  147. package/src/animation/AnimationAudioClip.ts +0 -140
  148. package/src/animation/AnimationPathTessellator.ts +0 -691
  149. package/src/animation/AnimationTextRasterizer.ts +0 -340
  150. package/src/animation/AnimationVisual2D.ts +0 -153
  151. package/src/animation/HyaAnimation2DClipAdapter.ts +0 -845
  152. package/src/animation/Particle2DDescriptorAdapter.ts +0 -35
  153. package/src/animation/runtime/mixer/Action.ts +0 -876
  154. package/src/animation/runtime/mixer/Mixer.ts +0 -505
  155. package/src/animation/runtime/mixer/PoseBuffer.ts +0 -105
  156. package/src/animation/runtime/mixer/Sampler.ts +0 -252
  157. package/src/animation/runtime/mixer/Types.ts +0 -138
  158. package/src/animation/runtime/mixer/index.ts +0 -31
  159. package/src/animation-state-machine/AnimationStateMachine.ts +0 -146
  160. package/src/animation-state-machine/AnimationStateMachineChannels.ts +0 -116
  161. package/src/animation-state-machine/runtime/Animation2DStateMachineMixerAdapter.ts +0 -197
  162. package/src/animation-state-machine/runtime/AnimationStateMachineBlendTreeWeights.ts +0 -503
  163. package/src/animation-state-machine/runtime/AnimationStateMachineCompiler.ts +0 -763
  164. package/src/animation-state-machine/runtime/AnimationStateMachineController.ts +0 -987
  165. package/src/animation-state-machine/runtime/AnimationStateMachineMixerPort.ts +0 -54
  166. package/src/animation-state-machine/runtime/index.ts +0 -47
  167. package/src/animation.ts +0 -33
  168. package/src/animation3d/Animation3DAction.ts +0 -73
  169. package/src/animation3d/Animation3DBinding.ts +0 -116
  170. package/src/animation3d/Animation3DClip.ts +0 -22
  171. package/src/animation3d/Animation3DError.ts +0 -34
  172. package/src/animation3d/Animation3DMixer.ts +0 -82
  173. package/src/animation3d/Animation3DPose.ts +0 -100
  174. package/src/animation3d/Animation3DPoseBuffer.ts +0 -85
  175. package/src/animation3d/Animation3DResource.ts +0 -49
  176. package/src/animation3d/Animation3DStateMachine.ts +0 -126
  177. package/src/animation3d/Animation3DStateMachineRuntime.ts +0 -191
  178. package/src/animation3d/Animation3DTrack.ts +0 -29
  179. package/src/animation3d/hya/HyaAnimation3DRuntime.ts +0 -756
  180. package/src/animation3d/hya/HyaAnimation3DStateMachineRuntime.ts +0 -618
  181. package/src/animation3d/hya/HyaAnimation3DTypes.ts +0 -168
  182. package/src/animation3d/hya/index.ts +0 -10
  183. package/src/animation3d/index.ts +0 -76
  184. package/src/animation3d/runtime/integration/Animation3DStateMachineMixerAdapter.ts +0 -325
  185. package/src/animation3d/runtime/integration/Animation3DStateMachineMixerIntegration.ts +0 -158
  186. package/src/animation3d/runtime/integration/index.ts +0 -9
  187. package/src/animation3d/runtime/mixer/Action.ts +0 -833
  188. package/src/animation3d/runtime/mixer/Animation3DMixerRuntimeStore.ts +0 -26
  189. package/src/animation3d/runtime/mixer/Mixer.ts +0 -562
  190. package/src/animation3d/runtime/mixer/PoseBuffer.ts +0 -1
  191. package/src/animation3d/runtime/mixer/TrackSampler.ts +0 -399
  192. package/src/animation3d/runtime/mixer/index.ts +0 -8
  193. package/src/animation3d/runtime/state-machine/Animation3DBlendTreeWeights.ts +0 -4
  194. package/src/animation3d/runtime/state-machine/Animation3DStateMachineCompiler.ts +0 -1
  195. package/src/animation3d/runtime/state-machine/Animation3DStateMachineController.ts +0 -1
  196. package/src/animation3d/runtime/state-machine/Animation3DStateMachineMixerPort.ts +0 -1
  197. package/src/animation3d/runtime/state-machine/index.ts +0 -45
  198. package/src/animation3d.ts +0 -5
  199. package/src/benchmark.ts +0 -168
  200. package/src/canvas-text/CanvasText2DRenderSystem.ts +0 -292
  201. package/src/canvas-text/CanvasTextComponent.ts +0 -47
  202. package/src/canvas-text.ts +0 -4
  203. package/src/experimental-gltf-worker.ts +0 -18
  204. package/src/experimental-spine-worker.ts +0 -9
  205. package/src/gltf/GltfAccessorReader.ts +0 -271
  206. package/src/gltf/GltfAnimation3DAdapter.ts +0 -680
  207. package/src/gltf/GltfAnimationRuntime.ts +0 -392
  208. package/src/gltf/GltfAssetWorkerClient.ts +0 -136
  209. package/src/gltf/GltfCompatibilityReport.ts +0 -214
  210. package/src/gltf/GltfConservativeBounds.ts +0 -219
  211. package/src/gltf/GltfDracoDecoder.ts +0 -251
  212. package/src/gltf/GltfExtensionAdapter.ts +0 -340
  213. package/src/gltf/GltfLoaderContract.ts +0 -333
  214. package/src/gltf/GltfLoaderErrors.ts +0 -59
  215. package/src/gltf/GltfMaterialDescriptor.ts +0 -134
  216. package/src/gltf/GltfMaterialEncoder.ts +0 -173
  217. package/src/gltf/GltfMaterialLoader.ts +0 -293
  218. package/src/gltf/GltfModelComponent.ts +0 -115
  219. package/src/gltf/GltfModelSystem.ts +0 -208
  220. package/src/gltf/GltfPlugin.ts +0 -84
  221. package/src/gltf/GltfSchema.ts +0 -229
  222. package/src/gltf/GltfUvSemanticPlanner.ts +0 -166
  223. package/src/gltf/gltfLoader.ts +0 -910
  224. package/src/gltf-animation3d.ts +0 -10
  225. package/src/gltf-worker-runtime.ts +0 -10
  226. package/src/gltf.ts +0 -56
  227. package/src/grid/Grid2DComponent.ts +0 -69
  228. package/src/grid.ts +0 -2
  229. package/src/hya-state-machine.ts +0 -19
  230. package/src/index.ts +0 -2
  231. package/src/plugins/pluginUtils.ts +0 -50
  232. package/src/plugins.ts +0 -6
  233. package/src/shaders/generated/2d-ui-animation-2d.generated.wgsl +0 -242
  234. package/src/shaders/generated/2d-ui-artifact.generated.ts +0 -867
  235. package/src/shaders/generated/2d-ui-canvas-text-2d.generated.wgsl +0 -38
  236. package/src/shaders/generated/2d-ui-spine2d.generated.wgsl +0 -41
  237. package/src/shaders/generated/2d-ui-tilemap2d.generated.wgsl +0 -36
  238. package/src/spine/Spine2DComponent.ts +0 -168
  239. package/src/spine/Spine2DGpuRenderer.ts +0 -449
  240. package/src/spine/Spine2DRenderSystem.ts +0 -199
  241. package/src/spine/Spine2DRuntime.ts +0 -1529
  242. package/src/spine/SpineAnimationBoneTimelines.ts +0 -30
  243. package/src/spine/SpineAssetParser.ts +0 -20
  244. package/src/spine/SpineAssetWorkerClient.ts +0 -112
  245. package/src/spine/SpineAssetWorkerContract.ts +0 -4
  246. package/src/spine/SpineAtlasParser.ts +0 -127
  247. package/src/spine/SpineFloatBuilder.ts +0 -66
  248. package/src/spine/SpinePathConstraintSolver.ts +0 -582
  249. package/src/spine/SpinePlugin.ts +0 -76
  250. package/src/spine/SpineSkeletonRuntime.ts +0 -521
  251. package/src/spine/SpineSlotAnimation.ts +0 -195
  252. package/src/spine/SpineTimelineRuntime.ts +0 -453
  253. package/src/spine/SpineVertexBuilder.ts +0 -686
  254. package/src/spine.ts +0 -7
  255. package/src/tilemap/Tilemap2DComponent.ts +0 -232
  256. package/src/tilemap/Tilemap2DRenderSystem.ts +0 -58
  257. package/src/tilemap/Tilemap2DRenderer.ts +0 -289
  258. package/src/tilemap/TilemapPlugin.ts +0 -75
  259. package/src/tilemap.ts +0 -6
  260. package/src/tween/Tween2DComponent.ts +0 -83
  261. package/src/tween/Tween2DSystem.ts +0 -78
  262. package/src/tween.ts +0 -4
  263. package/src/types/earcut.d.ts +0 -7
  264. package/src/types/wgsl.d.ts +0 -4
  265. package/src/utils/RenderSystem2DBase.ts +0 -164
  266. package/src/utils/arrayAccess.ts +0 -17
  267. package/src/utils/camera2d.ts +0 -68
  268. package/src/utils/render2dGpu.ts +0 -132
  269. package/test/fixtures/gltf/animation-characterization.gltf +0 -344
@@ -1,54 +0,0 @@
1
- import type {
2
- AnimationStateMachineBindingMask,
3
- AnimationStateMachineBlendMode,
4
- AnimationStateMachineLoopMode,
5
- } from '../AnimationStateMachine.js';
6
-
7
- /**
8
- * The only action shape the state-machine runtime needs. Concrete mixer
9
- * actions are adapted to this interface by the integration layer.
10
- */
11
- export interface AnimationStateMachineActionHandle {
12
- /** Source clip duration in seconds. */
13
- readonly duration: number;
14
- }
15
-
16
- export interface AnimationStateMachineActionOptions {
17
- readonly layerId: string;
18
- readonly stateId: string;
19
- readonly loop: AnimationStateMachineLoopMode;
20
- readonly blendMode: AnimationStateMachineBlendMode;
21
- readonly mask: AnimationStateMachineBindingMask | null;
22
- }
23
-
24
- /**
25
- * Internal boundary between the state-machine controller and an animation
26
- * mixer. It deliberately has no dependency on Animation3DMixer or
27
- * Animation3DAction.
28
- */
29
- export interface AnimationStateMachineMixerPort<
30
- TAction extends AnimationStateMachineActionHandle =
31
- AnimationStateMachineActionHandle,
32
- > {
33
- createAction(
34
- clipId: string,
35
- options: AnimationStateMachineActionOptions,
36
- ): TAction;
37
- play(action: TAction): void;
38
- stop(action: TAction): void;
39
- fade(action: TAction, targetWeight: number, durationSeconds: number): void;
40
- setWeight(action: TAction, weight: number): void;
41
- setTime(action: TAction, timeSeconds: number): void;
42
- setTimeScale(action: TAction, timeScale: number): void;
43
- destroyAction(action: TAction): void;
44
- }
45
-
46
- /** Compatibility aliases for the original 3D-prefixed runtime boundary. */
47
- export type Animation3DStateMachineActionHandle =
48
- AnimationStateMachineActionHandle;
49
- export type Animation3DStateMachineActionOptions =
50
- AnimationStateMachineActionOptions;
51
- export type Animation3DStateMachineMixerPort<
52
- TAction extends AnimationStateMachineActionHandle =
53
- AnimationStateMachineActionHandle,
54
- > = AnimationStateMachineMixerPort<TAction>;
@@ -1,47 +0,0 @@
1
- export {
2
- evaluateAnimation3DBlend1DWeights as evaluateAnimationBlend1DWeights,
3
- evaluateAnimation3DBlend2DWeights as evaluateAnimationBlend2DWeights,
4
- } from './AnimationStateMachineBlendTreeWeights.js';
5
- export {
6
- AnimationStateMachineValidationError,
7
- compileAnimationStateMachineDefinition as compileAnimationStateMachine,
8
- compileAnimationStateMachineDefinition,
9
- validateAnimationStateMachineDefinition,
10
- } from './AnimationStateMachineCompiler.js';
11
- export type {
12
- Animation3DStateMachineValidationCode as AnimationStateMachineValidationCode,
13
- Animation3DStateMachineValidationIssue as AnimationStateMachineValidationIssue,
14
- CompiledAnimation3DBlend1DChild as CompiledAnimationBlend1DChild,
15
- CompiledAnimation3DBlend1DMotion as CompiledAnimationBlend1DMotion,
16
- CompiledAnimation3DBlend2DChild as CompiledAnimationBlend2DChild,
17
- CompiledAnimation3DBlend2DMotion as CompiledAnimationBlend2DMotion,
18
- CompiledAnimation3DClipMotion as CompiledAnimationClipMotion,
19
- CompiledAnimation3DCondition as CompiledAnimationCondition,
20
- CompiledAnimation3DConditionOperator as CompiledAnimationConditionOperator,
21
- CompiledAnimation3DLayer as CompiledAnimationLayer,
22
- CompiledAnimation3DMotion as CompiledAnimationMotion,
23
- CompiledAnimation3DParameter as CompiledAnimationParameter,
24
- CompiledAnimation3DParameterType as CompiledAnimationParameterType,
25
- CompiledAnimation3DState as CompiledAnimationState,
26
- CompiledAnimation3DStateMachine as CompiledAnimationStateMachine,
27
- CompiledAnimation3DTransition as CompiledAnimationTransition,
28
- } from './AnimationStateMachineCompiler.js';
29
- export {
30
- Animation3DStateMachineController as AnimationStateMachineController,
31
- createAnimation3DStateMachineController as createAnimationStateMachineController,
32
- runAnimationStateMachineControllerUpdateTransaction,
33
- } from './AnimationStateMachineController.js';
34
- export type {
35
- Animation3DStateMachineControllerOptions as AnimationStateMachineControllerOptions,
36
- Animation3DStateMachineControllerStatus as AnimationStateMachineControllerStatus,
37
- Animation3DStateMachineLayerSnapshot as AnimationStateMachineLayerSnapshot,
38
- } from './AnimationStateMachineController.js';
39
- export type {
40
- AnimationStateMachineActionHandle,
41
- AnimationStateMachineActionOptions,
42
- AnimationStateMachineMixerPort,
43
- } from './AnimationStateMachineMixerPort.js';
44
- export {
45
- Animation2DStateMachineActionRuntimeHandle,
46
- Animation2DStateMachineMixerAdapter,
47
- } from './Animation2DStateMachineMixerAdapter.js';
package/src/animation.ts DELETED
@@ -1,33 +0,0 @@
1
- export { Animation2DComponent } from './animation/Animation2DComponent';
2
- export type { Animation2DComponentOptions, Animation2DRuntimeStats } from './animation/Animation2DComponent';
3
- export { Animation2DSystem } from './animation/Animation2DSystem';
4
- export type { Animation2DSystemOptions } from './animation/Animation2DSystem';
5
- export { Animation2DRenderSystem } from './animation/Animation2DRenderSystem';
6
- export type { Animation2DRenderStats, Animation2DRenderSystemOptions } from './animation/Animation2DRenderSystem';
7
- export { tessellateAnimationPath } from './animation/AnimationPathTessellator';
8
- export { createAnimationAssetLoader, HAIYUE_ANIMATION_ASSET_TYPE } from './animation/AnimationAssetLoader';
9
- export type { AnimationAssetLoaderOptions } from './animation/AnimationAssetLoader';
10
- export { Animation2DExtensionRegistry } from './animation/Animation2DExtensionRegistry';
11
- export type {
12
- Animation2DExtensionContext,
13
- Animation2DExtensionHandler,
14
- Animation2DExtensionInstance,
15
- } from './animation/Animation2DExtensionRegistry';
16
- export {
17
- createAnimation2DStateMachineController,
18
- } from './animation/Animation2DStateMachine';
19
- export type {
20
- AnimationStateMachineDefinition,
21
- } from './animation-state-machine/AnimationStateMachine';
22
- export {
23
- AnimationStateMachineController,
24
- AnimationStateMachineValidationError,
25
- compileAnimationStateMachine,
26
- validateAnimationStateMachineDefinition,
27
- } from './animation-state-machine/runtime/index';
28
- export type {
29
- AnimationStateMachineControllerOptions,
30
- AnimationStateMachineLayerSnapshot,
31
- AnimationStateMachineMixerPort,
32
- AnimationStateMachineValidationIssue,
33
- } from './animation-state-machine/runtime/index';
@@ -1,73 +0,0 @@
1
- import type {
2
- Animation3DBindingMask,
3
- } from './Animation3DBinding';
4
- import type { Animation3DClip } from './Animation3DClip';
5
-
6
- export type Animation3DLoopMode =
7
- | 'once'
8
- | 'repeat'
9
- | 'ping-pong';
10
-
11
- export type Animation3DBlendMode =
12
- | 'override'
13
- | 'additive';
14
-
15
- export type Animation3DActionStatus =
16
- | 'idle'
17
- | 'scheduled'
18
- | 'running'
19
- | 'paused'
20
- | 'finished'
21
- | 'stopped';
22
-
23
- export interface Animation3DActionOptions {
24
- readonly id?: string;
25
- readonly loop?: Animation3DLoopMode;
26
- /** Infinity is valid for repeat and ping-pong. */
27
- readonly repetitions?: number;
28
- readonly clampWhenFinished?: boolean;
29
- readonly timeScale?: number;
30
- readonly weight?: number;
31
- readonly blendMode?: Animation3DBlendMode;
32
- readonly mask?: Animation3DBindingMask;
33
- }
34
-
35
- /**
36
- * One mutable playback instance of an immutable clip.
37
- * Actions are mixer-owned and become invalid after removal or mixer destroy.
38
- */
39
- export interface Animation3DAction {
40
- readonly id: string;
41
- readonly clip: Animation3DClip;
42
- readonly status: Animation3DActionStatus;
43
- enabled: boolean;
44
- paused: boolean;
45
- time: number;
46
- timeScale: number;
47
- weight: number;
48
- loop: Animation3DLoopMode;
49
- repetitions: number;
50
- clampWhenFinished: boolean;
51
- blendMode: Animation3DBlendMode;
52
- mask: Animation3DBindingMask | null;
53
- readonly effectiveTimeScale: number;
54
- readonly effectiveWeight: number;
55
-
56
- play(): this;
57
- stop(): this;
58
- reset(): this;
59
- startAt(mixerTimeSeconds: number): this;
60
- fadeIn(durationSeconds: number): this;
61
- fadeOut(durationSeconds: number): this;
62
- crossFadeFrom(
63
- source: Animation3DAction,
64
- durationSeconds: number,
65
- warp?: boolean,
66
- ): this;
67
- crossFadeTo(
68
- destination: Animation3DAction,
69
- durationSeconds: number,
70
- warp?: boolean,
71
- ): this;
72
- stopFading(): this;
73
- }
@@ -1,116 +0,0 @@
1
- /**
2
- * Logical targets keep authored clips independent from a concrete ECS World.
3
- * A runtime resolver maps one of these stable references to an actual target.
4
- */
5
- export type Animation3DBindingTarget =
6
- | Readonly<{
7
- kind: 'node-id';
8
- nodeId: string;
9
- }>
10
- | Readonly<{
11
- kind: 'node-path';
12
- segments: readonly string[];
13
- }>
14
- | Readonly<{
15
- kind: 'slot';
16
- slot: string;
17
- }>;
18
-
19
- export type Animation3DFixedValueType =
20
- | 'scalar'
21
- | 'vec2'
22
- | 'vec3'
23
- | 'vec4'
24
- | 'quaternion';
25
-
26
- export type Animation3DValueType =
27
- | Animation3DFixedValueType
28
- | 'weights';
29
-
30
- export interface Animation3DTranslationBinding {
31
- readonly id: string;
32
- readonly target: Animation3DBindingTarget;
33
- readonly path: 'transform.translation';
34
- readonly valueType: 'vec3';
35
- readonly valueSize: 3;
36
- }
37
-
38
- export interface Animation3DRotationBinding {
39
- readonly id: string;
40
- readonly target: Animation3DBindingTarget;
41
- readonly path: 'transform.rotation';
42
- readonly valueType: 'quaternion';
43
- readonly valueSize: 4;
44
- }
45
-
46
- export interface Animation3DScaleBinding {
47
- readonly id: string;
48
- readonly target: Animation3DBindingTarget;
49
- readonly path: 'transform.scale';
50
- readonly valueType: 'vec3';
51
- readonly valueSize: 3;
52
- }
53
-
54
- export interface Animation3DMorphWeightsBinding {
55
- readonly id: string;
56
- readonly target: Animation3DBindingTarget;
57
- readonly path: 'morph.weights';
58
- readonly valueType: 'weights';
59
- /** Positive morph target count. Loaders must reject zero or negative values. */
60
- readonly valueSize: number;
61
- }
62
-
63
- export type Animation3DFixedValueSize = {
64
- readonly scalar: 1;
65
- readonly vec2: 2;
66
- readonly vec3: 3;
67
- readonly vec4: 4;
68
- readonly quaternion: 4;
69
- };
70
-
71
- export type Animation3DPropertyBinding = {
72
- [TValueType in Animation3DFixedValueType]: Readonly<{
73
- id: string;
74
- target: Animation3DBindingTarget;
75
- path: 'property';
76
- /** Stable component or adapter namespace, never a constructor reference. */
77
- component: string;
78
- property: string;
79
- valueType: TValueType;
80
- valueSize: Animation3DFixedValueSize[TValueType];
81
- }>;
82
- }[Animation3DFixedValueType];
83
-
84
- export type Animation3DBinding =
85
- | Animation3DTranslationBinding
86
- | Animation3DRotationBinding
87
- | Animation3DScaleBinding
88
- | Animation3DMorphWeightsBinding
89
- | Animation3DPropertyBinding;
90
-
91
- export interface Animation3DResolvedBinding<
92
- TBinding extends Animation3DBinding = Animation3DBinding,
93
- > {
94
- readonly binding: TBinding;
95
- /** Writes exactly binding.valueSize values into out. */
96
- read(out: Float32Array): void;
97
- /** Reads exactly binding.valueSize values from value. */
98
- write(value: ArrayLike<number>): void;
99
- }
100
-
101
- /**
102
- * Resolver revisions invalidate cached resolved bindings after hierarchy or
103
- * component structure changes.
104
- */
105
- export interface Animation3DBindingResolver {
106
- readonly revision: number;
107
- resolve<TBinding extends Animation3DBinding>(
108
- binding: TBinding,
109
- ): Animation3DResolvedBinding<TBinding> | null;
110
- }
111
-
112
- export interface Animation3DBindingMask {
113
- /** Empty or omitted include means all bindings are eligible. */
114
- readonly include?: readonly string[];
115
- readonly exclude?: readonly string[];
116
- }
@@ -1,22 +0,0 @@
1
- import type { Animation3DTrack } from './Animation3DTrack';
2
-
3
- export interface Animation3DEvent {
4
- readonly id: string;
5
- readonly time: number;
6
- readonly name: string;
7
- /** Loader-validated, structured-cloneable event data. */
8
- readonly payload?: Readonly<Record<string, unknown>>;
9
- }
10
-
11
- /**
12
- * Immutable, source-format-independent CPU animation resource.
13
- * Times are seconds; rotations are normalized XYZW quaternions.
14
- */
15
- export interface Animation3DClip {
16
- readonly format: 'haiyue-animation3d-clip@1';
17
- readonly id: string;
18
- readonly name: string;
19
- readonly duration: number;
20
- readonly tracks: readonly Animation3DTrack[];
21
- readonly events: readonly Animation3DEvent[];
22
- }
@@ -1,34 +0,0 @@
1
- export type Animation3DErrorCode =
2
- | 'mixer-destroyed'
3
- | 'invalid-clip'
4
- | 'invalid-track'
5
- | 'invalid-action'
6
- | 'duplicate-action-id'
7
- | 'resolver-miss';
8
-
9
- export type Animation3DErrorDetails = Readonly<Record<
10
- string,
11
- string | number | boolean | null
12
- >>;
13
-
14
- /**
15
- * Stable domain error for the Animation3D facade.
16
- *
17
- * Callers should branch on `code`; messages remain diagnostic and may gain
18
- * additional context without changing the error contract.
19
- */
20
- export class Animation3DError extends Error {
21
- readonly code: Animation3DErrorCode;
22
- readonly details: Animation3DErrorDetails;
23
-
24
- constructor(
25
- code: Animation3DErrorCode,
26
- message: string,
27
- details: Animation3DErrorDetails = {},
28
- ) {
29
- super(message);
30
- this.name = 'Animation3DError';
31
- this.code = code;
32
- this.details = Object.freeze({ ...details });
33
- }
34
- }
@@ -1,82 +0,0 @@
1
- import type {
2
- Animation3DBindingResolver,
3
- } from './Animation3DBinding.js';
4
- import type {
5
- Animation3DAction,
6
- Animation3DActionOptions,
7
- } from './Animation3DAction.js';
8
- import type { Animation3DClip } from './Animation3DClip.js';
9
- import type {
10
- Animation3DMutablePose,
11
- Animation3DPose,
12
- } from './Animation3DPose.js';
13
- import { Animation3DMixerRuntime } from './runtime/mixer/Mixer.js';
14
- import {
15
- registerAnimation3DMixerRuntime,
16
- } from './runtime/mixer/Animation3DMixerRuntimeStore.js';
17
-
18
- export type Animation3DMixerState =
19
- | 'active'
20
- | 'destroyed';
21
-
22
- /**
23
- * Public mixer facade. Controller-only clock/transaction hooks remain on the
24
- * internal runtime and are intentionally absent from this surface.
25
- */
26
- export class Animation3DMixer {
27
- #runtime: Animation3DMixerRuntime;
28
-
29
- constructor(resolver: Animation3DBindingResolver) {
30
- this.#runtime = new Animation3DMixerRuntime(resolver);
31
- registerAnimation3DMixerRuntime(this, this.#runtime);
32
- }
33
-
34
- get state(): Animation3DMixerState { return this.#runtime.state; }
35
- get resolver(): Animation3DBindingResolver { return this.#runtime.resolver; }
36
- get actions(): readonly Animation3DAction[] { return this.#runtime.actions; }
37
- get time(): number { return this.#runtime.time; }
38
- get timeScale(): number { return this.#runtime.timeScale; }
39
- set timeScale(value: number) { this.#runtime.timeScale = value; }
40
-
41
- createAction(
42
- clip: Animation3DClip,
43
- options?: Animation3DActionOptions,
44
- ): Animation3DAction {
45
- return this.#runtime.createAction(clip, options);
46
- }
47
-
48
- getAction(actionId: string): Animation3DAction | null {
49
- return this.#runtime.getAction(actionId);
50
- }
51
-
52
- removeAction(action: Animation3DAction | string): boolean {
53
- return this.#runtime.removeAction(action);
54
- }
55
-
56
- stopAllActions(): this {
57
- this.#runtime.stopAllActions();
58
- return this;
59
- }
60
-
61
- update(
62
- deltaSeconds: number,
63
- out: Animation3DMutablePose,
64
- ): Animation3DPose {
65
- return this.#runtime.update(deltaSeconds, out);
66
- }
67
-
68
- evaluate(out: Animation3DMutablePose): Animation3DPose {
69
- return this.#runtime.evaluate(out);
70
- }
71
-
72
- setTime(
73
- timeSeconds: number,
74
- out: Animation3DMutablePose,
75
- ): Animation3DPose {
76
- return this.#runtime.setTime(timeSeconds, out);
77
- }
78
-
79
- destroy(): void {
80
- this.#runtime.destroy();
81
- }
82
- }
@@ -1,100 +0,0 @@
1
- import type {
2
- Animation3DBinding,
3
- Animation3DBindingResolver,
4
- Animation3DResolvedBinding,
5
- } from './Animation3DBinding.js';
6
- import type { Animation3DEvent } from './Animation3DClip.js';
7
- import { Animation3DError } from './Animation3DError.js';
8
-
9
- export interface Animation3DPoseChannel<
10
- TBinding extends Animation3DBinding = Animation3DBinding,
11
- > {
12
- readonly binding: TBinding;
13
- /** Exactly binding.valueSize sampled and blended values. */
14
- readonly value: Readonly<Float32Array>;
15
- }
16
-
17
- export interface Animation3DPoseEvent {
18
- readonly actionId: string;
19
- readonly clipId: string;
20
- readonly event: Animation3DEvent;
21
- }
22
-
23
- /**
24
- * Frame-transient mixer output. Implementations may reuse its arrays on the
25
- * next evaluate/update call; callers must copy values they need to retain.
26
- */
27
- export interface Animation3DPose {
28
- readonly sequence: number;
29
- readonly mixerTime: number;
30
- readonly channels: readonly Animation3DPoseChannel[];
31
- readonly events: readonly Animation3DPoseEvent[];
32
- }
33
-
34
- /**
35
- * Caller-provided scratch target used to keep mixer evaluation allocation-free.
36
- * reset() begins a new pose and seal() returns the current read-only view.
37
- */
38
- export interface Animation3DMutablePose {
39
- reset(mixerTime: number): void;
40
- write(
41
- binding: Animation3DBinding,
42
- value: ArrayLike<number>,
43
- ): void;
44
- emit(event: Animation3DPoseEvent): void;
45
- seal(): Animation3DPose;
46
- }
47
-
48
- interface Animation3DPoseApplierState {
49
- readonly resolver: Animation3DBindingResolver;
50
- resolverRevision: number;
51
- readonly resolvedBindings: Map<
52
- string,
53
- Animation3DResolvedBinding | null
54
- >;
55
- }
56
-
57
- const POSE_APPLIER_STATES = new WeakMap<
58
- Animation3DPoseApplier,
59
- Animation3DPoseApplierState
60
- >();
61
-
62
- /**
63
- * Applies pose channels through a revision-aware binding resolver cache.
64
- * Resolver misses fail explicitly and never write to a fallback target.
65
- */
66
- export class Animation3DPoseApplier {
67
- constructor(resolver: Animation3DBindingResolver) {
68
- POSE_APPLIER_STATES.set(this, {
69
- resolver,
70
- resolverRevision: Number.NaN,
71
- resolvedBindings: new Map(),
72
- });
73
- }
74
-
75
- apply(pose: Animation3DPose): void {
76
- const state = POSE_APPLIER_STATES.get(this)!;
77
- const { resolver } = state;
78
- if (state.resolverRevision !== resolver.revision) {
79
- state.resolverRevision = resolver.revision;
80
- state.resolvedBindings.clear();
81
- }
82
- for (let index = 0; index < pose.channels.length; index++) {
83
- const channel = pose.channels[index]!;
84
- const bindingId = channel.binding.id;
85
- let resolved = state.resolvedBindings.get(bindingId);
86
- if (resolved === undefined && !state.resolvedBindings.has(bindingId)) {
87
- resolved = resolver.resolve(channel.binding);
88
- state.resolvedBindings.set(bindingId, resolved);
89
- }
90
- if (!resolved) {
91
- throw new Animation3DError(
92
- 'resolver-miss',
93
- `Animation3D binding resolver could not resolve "${bindingId}".`,
94
- { resolver: 'binding', bindingId },
95
- );
96
- }
97
- resolved.write(channel.value);
98
- }
99
- }
100
- }
@@ -1,85 +0,0 @@
1
- import type { Animation3DBinding } from './Animation3DBinding.js';
2
- import type {
3
- Animation3DMutablePose,
4
- Animation3DPose,
5
- Animation3DPoseChannel,
6
- Animation3DPoseEvent,
7
- } from './Animation3DPose.js';
8
-
9
- class ReusablePoseChannel implements Animation3DPoseChannel {
10
- binding: Animation3DBinding;
11
- value: Float32Array;
12
-
13
- constructor(binding: Animation3DBinding) {
14
- this.binding = binding;
15
- this.value = new Float32Array(binding.valueSize);
16
- }
17
-
18
- write(binding: Animation3DBinding, source: ArrayLike<number>): void {
19
- this.binding = binding;
20
- if (this.value.length !== binding.valueSize) {
21
- this.value = new Float32Array(binding.valueSize);
22
- }
23
- for (let index = 0; index < binding.valueSize; index++) {
24
- this.value[index] = source[index] ?? 0;
25
- }
26
- }
27
- }
28
-
29
- /**
30
- * Reusable caller-owned mixer output.
31
- *
32
- * Channel records and value arrays are pooled after first use. seal() returns
33
- * this object as the read-only pose view rather than allocating a snapshot.
34
- */
35
- export class Animation3DPoseBuffer implements Animation3DMutablePose, Animation3DPose {
36
- private readonly _channelPool: ReusablePoseChannel[] = [];
37
- private readonly _channels: ReusablePoseChannel[] = [];
38
- private readonly _events: Animation3DPoseEvent[] = [];
39
- private _sequence = 0;
40
- private _mixerTime = 0;
41
- private _sealed = true;
42
-
43
- get sequence(): number { return this._sequence; }
44
- get mixerTime(): number { return this._mixerTime; }
45
- get channels(): readonly Animation3DPoseChannel[] { return this._channels; }
46
- get events(): readonly Animation3DPoseEvent[] { return this._events; }
47
-
48
- reset(mixerTime: number): void {
49
- if (!Number.isFinite(mixerTime)) {
50
- throw new RangeError(`Animation3D pose mixerTime must be finite; received ${mixerTime}.`);
51
- }
52
- this._mixerTime = mixerTime;
53
- this._channels.length = 0;
54
- this._events.length = 0;
55
- this._sealed = false;
56
- }
57
-
58
- write(binding: Animation3DBinding, value: ArrayLike<number>): void {
59
- if (value.length < binding.valueSize) {
60
- throw new RangeError(
61
- `Animation3D pose channel "${binding.id}" requires ${binding.valueSize} values; received ${value.length}.`,
62
- );
63
- }
64
- const index = this._channels.length;
65
- let channel = this._channelPool[index];
66
- if (!channel) {
67
- channel = new ReusablePoseChannel(binding);
68
- this._channelPool.push(channel);
69
- }
70
- channel.write(binding, value);
71
- this._channels.push(channel);
72
- }
73
-
74
- emit(event: Animation3DPoseEvent): void {
75
- this._events.push(event);
76
- }
77
-
78
- seal(): Animation3DPose {
79
- if (!this._sealed) {
80
- this._sequence++;
81
- this._sealed = true;
82
- }
83
- return this;
84
- }
85
- }