@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
@@ -1434,5 +1434,5 @@ function resolveTransactionalPort(port) {
1434
1434
  return candidate;
1435
1435
  }
1436
1436
 
1437
- export { Animation3DStateMachineController as A, AnimationStateMachineValidationError as a, compileAnimation3DStateMachineDefinition as b, compileAnimationStateMachineDefinition as c, validateAnimation3DStateMachineDefinition as d, runAnimationStateMachineControllerUpdateTransaction as r, validateAnimationStateMachineDefinition as v };
1438
- //# sourceMappingURL=AnimationStateMachineController-BIcAh-sT.js.map
1437
+ export { Animation3DStateMachineController as A, compileAnimationStateMachineDefinition as a, AnimationStateMachineValidationError as b, compileAnimation3DStateMachineDefinition as c, validateAnimationStateMachineDefinition as d, runAnimationStateMachineControllerUpdateTransaction as r, validateAnimation3DStateMachineDefinition as v };
1438
+ //# sourceMappingURL=AnimationStateMachineController-4sKaqh9E.js.map
@@ -0,0 +1,230 @@
1
+ import { Component } from '@haiyue/engine';
2
+ import { UniqueCheckType } from '@haiyue/engine/ecs';
3
+
4
+ /** Runtime-private render item consumed by Animation2DRenderSystem. */
5
+ class AnimationVisual2D extends Component {
6
+ static UniqueCheckType = UniqueCheckType.SYMBOL | UniqueCheckType.REPLACE;
7
+ static UniqueSymbol = Symbol.for('AnimationVisual2D');
8
+ geometry;
9
+ instanceId;
10
+ nodeId;
11
+ nodeKey;
12
+ order;
13
+ blendMode;
14
+ textureAlphaMode;
15
+ culling;
16
+ uvs;
17
+ sourceOnly;
18
+ compositeLayers;
19
+ compositeKeys;
20
+ /** Compatibility accessors for single-layer renderer diagnostics. */
21
+ compositeSource;
22
+ compositeKey;
23
+ compositeMode;
24
+ uvRect;
25
+ color;
26
+ multiplyColor;
27
+ screenColor;
28
+ texture;
29
+ textureHandle;
30
+ textMaterial;
31
+ requiresTexture;
32
+ gradient;
33
+ effects;
34
+ revision = 0;
35
+ constructor(options) {
36
+ super('AnimationVisual2D');
37
+ this.geometry = options.geometry;
38
+ this.instanceId = options.instanceId;
39
+ this.nodeId = options.nodeId;
40
+ this.nodeKey = `${options.instanceId}:${options.nodeId}`;
41
+ this.order = options.order;
42
+ this.blendMode = options.blendMode ?? 'normal';
43
+ this.textureAlphaMode = options.textureAlphaMode ?? 'straight';
44
+ if (options.culling !== undefined && typeof options.culling !== 'boolean') {
45
+ throw new AnimationVisual2DConfigurationError('E_ANIMATION_2D_CULLING_INVALID', 'AnimationVisual2D culling must be boolean when present.', '$.culling');
46
+ }
47
+ this.culling = options.culling ?? false;
48
+ if (options.uvs && options.uvs.length !== options.geometry.positions.length) {
49
+ throw new RangeError('AnimationVisual2D explicit UV count must match geometry positions.');
50
+ }
51
+ this.uvs = options.uvs ?? null;
52
+ this.sourceOnly = options.sourceOnly ?? false;
53
+ this.compositeLayers = Object.freeze(options.composite
54
+ ? ('layers' in options.composite
55
+ ? options.composite.layers.map(layer => ({ ...layer }))
56
+ : [{ ...options.composite }])
57
+ : []);
58
+ this.compositeKeys = Object.freeze(this.compositeLayers.map(layer => `${options.instanceId}:${layer.source}`));
59
+ this.compositeSource = this.compositeLayers[0]?.source;
60
+ this.compositeKey = this.compositeKeys[0];
61
+ this.compositeMode = this.compositeLayers[0]?.mode;
62
+ this.uvRect = [...(options.uvRect ?? [0, 0, 1, 1])];
63
+ this.color = [...options.color];
64
+ this.multiplyColor = drawableColor(options.multiplyColor ?? [1, 1, 1, 1], 'multiplyColor');
65
+ this.screenColor = drawableColor(options.screenColor ?? [0, 0, 0, 0], 'screenColor');
66
+ this.texture = options.texture ?? null;
67
+ this.textureHandle = options.textureHandle ?? null;
68
+ this.textMaterial = options.textMaterial ?? null;
69
+ this.requiresTexture = options.requiresTexture ?? false;
70
+ this.gradient = options.gradient ?? null;
71
+ this.effects = Object.freeze(options.effects ? [...options.effects] : []);
72
+ }
73
+ setTexture(texture) {
74
+ if (this.texture === texture)
75
+ return;
76
+ this.texture = texture;
77
+ this.revision++;
78
+ }
79
+ setOrder(order) {
80
+ if (!Number.isSafeInteger(order))
81
+ throw new RangeError('AnimationVisual2D order must be a safe integer.');
82
+ this.order = order;
83
+ }
84
+ setTextureHandle(handle) {
85
+ if (this.textureHandle === handle)
86
+ return;
87
+ this.textureHandle = handle;
88
+ this.revision++;
89
+ }
90
+ setUvRect(value) {
91
+ if (this.uvRect.every((current, index) => current === value[index]))
92
+ return;
93
+ this.uvRect[0] = value[0];
94
+ this.uvRect[1] = value[1];
95
+ this.uvRect[2] = value[2];
96
+ this.uvRect[3] = value[3];
97
+ this.revision++;
98
+ }
99
+ /** Updates caller-owned drawable color state without replacing visual or GPU owners. */
100
+ setDrawableColors(multiplyColor, screenColor) {
101
+ assertDrawableColor(multiplyColor, 'multiplyColor');
102
+ assertDrawableColor(screenColor, 'screenColor');
103
+ let changed = false;
104
+ for (let index = 0; index < 4; index++) {
105
+ if (this.multiplyColor[index] !== multiplyColor[index]) {
106
+ this.multiplyColor[index] = multiplyColor[index];
107
+ changed = true;
108
+ }
109
+ if (this.screenColor[index] !== screenColor[index]) {
110
+ this.screenColor[index] = screenColor[index];
111
+ changed = true;
112
+ }
113
+ }
114
+ if (changed)
115
+ this.revision++;
116
+ }
117
+ setCompositeExpansion(index, value) {
118
+ const layer = this.compositeLayers[index];
119
+ if (!layer || layer.expansion === value)
120
+ return;
121
+ layer.expansion = value;
122
+ this.revision++;
123
+ }
124
+ resolveTexture() {
125
+ if (!this.textureHandle)
126
+ return this.texture;
127
+ try {
128
+ return this.textureHandle.value;
129
+ }
130
+ catch {
131
+ return null;
132
+ }
133
+ }
134
+ clone() {
135
+ return new AnimationVisual2D({
136
+ geometry: this.geometry,
137
+ color: this.color,
138
+ multiplyColor: this.multiplyColor,
139
+ screenColor: this.screenColor,
140
+ instanceId: this.instanceId,
141
+ nodeId: this.nodeId,
142
+ order: this.order,
143
+ blendMode: this.blendMode,
144
+ textureAlphaMode: this.textureAlphaMode,
145
+ culling: this.culling,
146
+ ...(this.uvs ? { uvs: this.uvs } : {}),
147
+ sourceOnly: this.sourceOnly,
148
+ ...(this.compositeLayers.length === 0 ? {} : { composite: { layers: this.compositeLayers } }),
149
+ texture: this.texture,
150
+ textureHandle: this.textureHandle,
151
+ textMaterial: this.textMaterial,
152
+ requiresTexture: this.requiresTexture,
153
+ uvRect: this.uvRect,
154
+ gradient: this.gradient ? {
155
+ kind: this.gradient.kind,
156
+ start: [...this.gradient.start],
157
+ end: [...this.gradient.end],
158
+ stops: new Float32Array(this.gradient.stops),
159
+ opacity: this.gradient.opacity,
160
+ } : null,
161
+ effects: this.effects.map(effect => ({ kind: effect.kind, values: new Float32Array(effect.values) })),
162
+ });
163
+ }
164
+ }
165
+ class AnimationVisual2DConfigurationError extends TypeError {
166
+ code;
167
+ path;
168
+ constructor(code, message, path) {
169
+ super(message);
170
+ this.code = code;
171
+ this.path = path;
172
+ this.name = 'AnimationVisual2DConfigurationError';
173
+ }
174
+ }
175
+ function drawableColor(value, kind) {
176
+ assertDrawableColor(value, kind);
177
+ return [value[0], value[1], value[2], value[3]];
178
+ }
179
+ function assertDrawableColor(value, kind) {
180
+ let valid = value.length === 4;
181
+ for (let index = 0; valid && index < 4; index++) {
182
+ const channel = value[index];
183
+ valid = Number.isFinite(channel) && channel >= 0 && channel <= 1;
184
+ }
185
+ if (valid)
186
+ return;
187
+ if (kind === 'multiplyColor' || kind === 'screenColor') {
188
+ throw new AnimationVisual2DConfigurationError(kind === 'multiplyColor' ? 'E_ANIMATION_2D_MULTIPLY_COLOR_INVALID' : 'E_ANIMATION_2D_SCREEN_COLOR_INVALID', `AnimationVisual2D ${kind} must contain four finite values within [0, 1].`, `$.${kind}`);
189
+ }
190
+ throw new RangeError(`Animation drawable ${kind} must contain four finite values within [0, 1].`);
191
+ }
192
+ class Animation2DPipelineCreationError extends Error {
193
+ pipelineKey;
194
+ cause;
195
+ code = 'E_ANIMATION_2D_PIPELINE_CREATION_FAILED';
196
+ path = '$runtime.animation2D.pipeline';
197
+ constructor(pipelineKey, cause) {
198
+ super(`Animation2D render pipeline creation failed for ${pipelineKey}.`);
199
+ this.pipelineKey = pipelineKey;
200
+ this.cause = cause;
201
+ this.name = 'Animation2DPipelineCreationError';
202
+ }
203
+ }
204
+ function createAnimation2DPipeline(pipelineKey, create) {
205
+ try {
206
+ return create();
207
+ }
208
+ catch (cause) {
209
+ throw new Animation2DPipelineCreationError(pipelineKey, cause);
210
+ }
211
+ }
212
+ /**
213
+ * Source-neutral 2D front faces are CCW in clip space. WebGPU normalizes the
214
+ * viewport convention for front-face classification; callers must not add an
215
+ * extra framebuffer-Y inversion. Real model/world reflections still reverse it.
216
+ */
217
+ const ANIMATION_2D_WEBGPU_FRONT_FACE = 'ccw';
218
+ function animation2DCullingPrimitive(culling) {
219
+ return {
220
+ topology: 'triangle-list',
221
+ frontFace: ANIMATION_2D_WEBGPU_FRONT_FACE,
222
+ cullMode: culling ? 'back' : 'none',
223
+ };
224
+ }
225
+ function animation2DCullingPipelineKey(culling) {
226
+ return culling ? `back:${ANIMATION_2D_WEBGPU_FRONT_FACE}` : `none:${ANIMATION_2D_WEBGPU_FRONT_FACE}`;
227
+ }
228
+
229
+ export { AnimationVisual2D as A, animation2DCullingPipelineKey as a, animation2DCullingPrimitive as b, createAnimation2DPipeline as c };
230
+ //# sourceMappingURL=AnimationVisual2D-8y3qp0_U.js.map
@@ -26,7 +26,7 @@ mat4.identity();
26
26
 
27
27
  function createCamera2DLayout(device) {
28
28
  return device.createBindGroupLayout({
29
- entries: [{ binding: 0, visibility: GPUShaderStage.VERTEX, buffer: { type: 'uniform' } }],
29
+ entries: [{ binding: 0, visibility: GPUShaderStage.VERTEX | GPUShaderStage.FRAGMENT, buffer: { type: 'uniform' } }],
30
30
  });
31
31
  }
32
32
  function createCamera2DGpu(device, tracker, layout = createCamera2DLayout(device)) {
@@ -224,4 +224,4 @@ class RenderSystem2DBase extends System {
224
224
  }
225
225
 
226
226
  export { RenderSystem2DBase as R, destroyTexture2DGpu as a, createObject2DLayout as b, createCamera2DGpu as c, destroyCamera2DGpu as d, createTexture2DGpu as e, writeFloatBuffer as f, createObject2DGpu as g, destroyObject2DGpu as h, createCamera2DLayout as i, writeObjectMatrixIfChanged as w };
227
- //# sourceMappingURL=RenderSystem2DBase-DDT61dAu.js.map
227
+ //# sourceMappingURL=RenderSystem2DBase-CF2s00vg.js.map
@@ -0,0 +1,46 @@
1
+ import { System, type World } from '@haiyue/engine/ecs';
2
+ import { EventEmitter } from '@haiyue/engine/core';
3
+ import type { VirtualJoystickEventMap, VirtualJoystickOptions, VirtualJoystickState, VirtualJoystickSurface } from './contracts';
4
+ /**
5
+ * Single-owner multitouch joystick. Add as a non-render System, or call step(dtMs)
6
+ * exactly once per frame. Set touch-action:none on the browser input surface.
7
+ * The supplied target is moved in parent-local coordinates without collision solving.
8
+ */
9
+ export declare class VirtualJoystickControls extends System {
10
+ readonly events: EventEmitter<VirtualJoystickEventMap>;
11
+ private readonly surface;
12
+ private readonly document;
13
+ private readonly window;
14
+ private options;
15
+ private view;
16
+ private pointerId;
17
+ private center;
18
+ private point;
19
+ private bounds;
20
+ private disposed;
21
+ constructor(surface: VirtualJoystickSurface, options?: VirtualJoystickOptions);
22
+ get disabled(): boolean;
23
+ set disabled(value: boolean);
24
+ /** Retainable immutable snapshot; caller mutation cannot alter future movement. */
25
+ get state(): VirtualJoystickState;
26
+ /** Atomic parameter update. A valid update cancels the current gesture. */
27
+ configure(options: VirtualJoystickOptions): this;
28
+ /** Cancel from native suspend/unload hooks; idempotent, returns thumb to center. */
29
+ cancel(): this;
30
+ /** Delta is milliseconds, matching World.update(). No internal RAF or timer. */
31
+ step(deltaMilliseconds: number): this;
32
+ update(_world: World, _time: number, delta: number): this;
33
+ destroy(): this;
34
+ private refreshLayout;
35
+ private createView;
36
+ private updateView;
37
+ private local;
38
+ private readonly onDown;
39
+ private readonly onMove;
40
+ private readonly onUp;
41
+ private readonly onCancel;
42
+ private readonly onBlur;
43
+ private readonly onVisibility;
44
+ private finish;
45
+ private moveTarget;
46
+ }
@@ -0,0 +1,91 @@
1
+ import type { Entity } from '@haiyue/engine/ecs';
2
+ import type { GuiRoot, GuiStyle } from '@haiyue/engine/gui';
3
+ export interface JoystickPoint {
4
+ readonly x: number;
5
+ readonly y: number;
6
+ }
7
+ export interface JoystickViewport {
8
+ readonly width: number;
9
+ readonly height: number;
10
+ }
11
+ export interface JoystickRegion extends JoystickPoint, JoystickViewport {
12
+ }
13
+ /** Coordinates and radii use surface-local CSS/logical pixels, never framebuffer pixels. */
14
+ export interface VirtualJoystickSurface extends EventTarget {
15
+ getBoundingClientRect(): {
16
+ left: number;
17
+ top: number;
18
+ width: number;
19
+ height: number;
20
+ };
21
+ setPointerCapture?(pointerId: number): void;
22
+ releasePointerCapture?(pointerId: number): void;
23
+ readonly ownerDocument?: Document | null;
24
+ }
25
+ export interface VirtualJoystickOptions {
26
+ /** Fixed center, or the initial press becomes the center. Default: floating. */
27
+ mode?: 'fixed' | 'floating';
28
+ /** Fixed mode center. Default: near the bottom-left corner. */
29
+ center?: JoystickPoint | ((viewport: JoystickViewport) => JoystickPoint);
30
+ /** Activation region in both modes. Default: the bottom-left quarter. */
31
+ region?: JoystickRegion | ((viewport: JoystickViewport) => JoystickRegion);
32
+ /** Maximum thumb travel from center, in logical pixels. Default: 64. */
33
+ maxDistance?: number;
34
+ /** Fixed mode hit radius; null uses maxDistance + knobRadius. Default: null. */
35
+ activationRadius?: number | null;
36
+ /** Fraction of maxDistance with zero output, in [0, 1). Default: 0.1. */
37
+ deadZone?: number;
38
+ /** Optional Entity with CartesianTransform3D (xz) or Transform2D (xy). */
39
+ target?: Entity | null;
40
+ /** Parent-local movement plane. Default: xz; up on screen maps to -Z or +Y. */
41
+ plane?: 'xz' | 'xy';
42
+ /** World/parent units per second at full strength. Default: 4. */
43
+ moveSpeed?: number;
44
+ /** Scale speed by dead-zone-adjusted strength. Default: true. */
45
+ analog?: boolean;
46
+ rotateToDirection?: boolean;
47
+ /** Maximum turning radians per second; Infinity snaps. Default: Infinity. */
48
+ turnSpeed?: number;
49
+ /** Heading correction for the model. Default forward: -Z (xz), +X (xy). */
50
+ rotationOffset?: number;
51
+ /** Rotate the movement basis around +Y (xz) or +Z (xy), in radians. Default: 0. */
52
+ movementRotation?: number;
53
+ /** Cap only built-in movement integration after stalls. Frame events retain actual dt. Default: 100. */
54
+ maxDeltaMilliseconds?: number;
55
+ /** Optional shared, full-surface Engine GUI root. Omit for input-only/custom rendering. */
56
+ guiRoot?: GuiRoot | null;
57
+ knobRadius?: number;
58
+ /** Show the fixed joystick while idle. Floating mode always hides while idle. */
59
+ showIdle?: boolean;
60
+ baseStyle?: GuiStyle;
61
+ knobStyle?: GuiStyle;
62
+ /** Optional HUD/input arbitration. Returning false leaves this pointer untouched. */
63
+ shouldActivate?: (point: JoystickPoint, event: PointerEvent) => boolean;
64
+ }
65
+ export interface VirtualJoystickState {
66
+ readonly active: boolean;
67
+ readonly pointerId: number | null;
68
+ readonly center: JoystickPoint;
69
+ /** Unit screen direction: +X right, +Y down. Zero inside the dead zone. */
70
+ readonly direction: JoystickPoint;
71
+ /** Clamped thumb displacement, including displacement within the dead zone. */
72
+ readonly offset: JoystickPoint;
73
+ readonly rawDistance: number;
74
+ readonly distance: number;
75
+ /** [0, 1], rescaled continuously after the dead zone. */
76
+ readonly strength: number;
77
+ /** Screen radians from +X clockwise, or zero inside the dead zone. */
78
+ readonly angle: number;
79
+ }
80
+ export interface VirtualJoystickFrame extends VirtualJoystickState {
81
+ readonly deltaMilliseconds: number;
82
+ readonly deltaSeconds: number;
83
+ readonly movementDeltaSeconds: number;
84
+ }
85
+ export interface VirtualJoystickEventMap {
86
+ start: VirtualJoystickState;
87
+ end: VirtualJoystickState;
88
+ cancel: VirtualJoystickState;
89
+ /** One event per enabled step, including idle frames and held stationary input. */
90
+ frame: VirtualJoystickFrame;
91
+ }
@@ -0,0 +1,2 @@
1
+ export { VirtualJoystickControls } from './controls/VirtualJoystickControls';
2
+ export type { JoystickPoint, JoystickViewport, JoystickRegion, VirtualJoystickSurface, VirtualJoystickOptions, VirtualJoystickState, VirtualJoystickFrame, VirtualJoystickEventMap, } from './controls/contracts';