@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,10 +0,0 @@
1
- /** Stable glTF adapter for the source-independent Animation3D runtime. */
2
- export {
3
- GltfAnimation3DRuntime,
4
- createGltfAnimation3DClips,
5
- createGltfAnimation3DRuntime,
6
- } from './gltf/GltfAnimation3DAdapter.js';
7
- export type {
8
- GltfAnimation3DRuntimeOptions,
9
- GltfAnimation3DRuntimeState,
10
- } from './gltf/GltfAnimation3DAdapter.js';
@@ -1,10 +0,0 @@
1
- /**
2
- * Self-contained module entry consumed by module workers.
3
- *
4
- * Keep these exports backed by the production glTF loader so worker parsing,
5
- * Draco decoding, and geometry preparation cannot drift from the main thread.
6
- */
7
- export {
8
- loadParsedGltfAsset,
9
- prepareGltfGeometryPayloads,
10
- } from './gltf/gltfLoader';
package/src/gltf.ts DELETED
@@ -1,56 +0,0 @@
1
- export { GltfModelComponent } from './gltf/GltfModelComponent';
2
- export type { GltfModelComponentOptions, GltfModelStatus } from './gltf/GltfModelComponent';
3
- export { GltfModelSystem } from './gltf/GltfModelSystem';
4
- export type { GltfModelSystemOptions } from './gltf/GltfModelSystem';
5
- export { applyGltfAnimationClip, disposeGltfModel, GLTF_EXTENSION_CAPABILITIES, loadGltfModel, setGltfMaterialVariant } from './gltf/gltfLoader';
6
- export {
7
- DEFAULT_GLTF_EXTENSION_ADAPTERS,
8
- collectGltfMaterialExtensionPatches,
9
- collectGltfMaterialVariantNames,
10
- collectGltfMaterialVariantReferences,
11
- resolveGltfExtensionAdapters,
12
- } from './gltf/GltfExtensionAdapter';
13
- export { encodeGltfPbrMaterial } from './gltf/GltfMaterialEncoder';
14
- export type {
15
- EncodedGltfPbrMaterial,
16
- EncodeGltfPbrMaterialOptions,
17
- } from './gltf/GltfMaterialEncoder';
18
- export type {
19
- DracoDecoderConfig,
20
- DracoDecoderFactory,
21
- DracoDecoderModule,
22
- GltfAssetWorker,
23
- GltfAnimationClip,
24
- GltfAnimationInfo,
25
- GltfAnimationInterpolation,
26
- GltfAnimationPath,
27
- GltfAssetStats,
28
- GltfExtensionCapability,
29
- GltfExtensionAdapter,
30
- GltfExtensionReport,
31
- GltfExtensionReportEntry,
32
- GltfExtensionSupport,
33
- GltfLoadWarning,
34
- GltfCompatibilityExtensionEntry,
35
- GltfCompatibilityIssue,
36
- GltfCompatibilityPerformanceSummary,
37
- GltfCompatibilityReport,
38
- GltfCompatibilityStatus,
39
- GltfPrimitiveBoundsCompatibilityEntry,
40
- GltfPrimitiveBoundsSupport,
41
- GltfPrimitiveUvSemanticCompatibilityEntry,
42
- GltfTextureCompatibilityEntry,
43
- GltfTextureMipmapSource,
44
- LoadedGltfModel,
45
- LoadGltfOptions,
46
- } from './gltf/gltfLoader';
47
- export type {
48
- GltfMaterialExtensionContext,
49
- GltfMaterialExtensionPatch,
50
- GltfMaterialStatePatch,
51
- GltfMaterialTextureBinding,
52
- GltfMaterialVariantReference,
53
- GltfPrimitiveExtensionContext,
54
- } from './gltf/GltfExtensionAdapter';
55
- export { createGltfPlugin } from './gltf/GltfPlugin';
56
- export type { GltfPluginOptions } from './gltf/GltfPlugin';
@@ -1,69 +0,0 @@
1
- import { Component } from '@haiyue/engine';
2
- import { UniqueCheckType } from '@haiyue/engine/ecs';
3
-
4
- export interface Grid2DComponentOptions {
5
- columns?: number;
6
- rows?: number;
7
- cellWidth?: number;
8
- cellHeight?: number;
9
- originX?: number;
10
- originY?: number;
11
- }
12
-
13
- export class Grid2DComponent extends Component {
14
- static override UniqueCheckType = UniqueCheckType.SYMBOL | UniqueCheckType.REPLACE;
15
- static override UniqueSymbol = Symbol.for('Grid2DComponent');
16
-
17
- columns: number;
18
- rows: number;
19
- cellWidth: number;
20
- cellHeight: number;
21
- originX: number;
22
- originY: number;
23
-
24
- constructor(options: Grid2DComponentOptions = {}) {
25
- super('Grid2DComponent');
26
- this.columns = Math.max(1, Math.floor(options.columns ?? 10));
27
- this.rows = Math.max(1, Math.floor(options.rows ?? 20));
28
- this.cellWidth = options.cellWidth ?? 32;
29
- this.cellHeight = options.cellHeight ?? 32;
30
- this.originX = options.originX ?? 0;
31
- this.originY = options.originY ?? 0;
32
- }
33
-
34
- gridToWorld(column: number, row: number): [number, number] {
35
- return [
36
- this.originX + column * this.cellWidth,
37
- this.originY + row * this.cellHeight,
38
- ];
39
- }
40
-
41
- gridToWorldCenter(column: number, row: number): [number, number] {
42
- return [
43
- this.originX + (column + 0.5) * this.cellWidth,
44
- this.originY + (row + 0.5) * this.cellHeight,
45
- ];
46
- }
47
-
48
- worldToGrid(x: number, y: number): [number, number] {
49
- return [
50
- Math.floor((x - this.originX) / this.cellWidth),
51
- Math.floor((y - this.originY) / this.cellHeight),
52
- ];
53
- }
54
-
55
- contains(column: number, row: number): boolean {
56
- return column >= 0 && row >= 0 && column < this.columns && row < this.rows;
57
- }
58
-
59
- override clone(): Grid2DComponent {
60
- return new Grid2DComponent({
61
- columns: this.columns,
62
- rows: this.rows,
63
- cellWidth: this.cellWidth,
64
- cellHeight: this.cellHeight,
65
- originX: this.originX,
66
- originY: this.originY,
67
- });
68
- }
69
- }
package/src/grid.ts DELETED
@@ -1,2 +0,0 @@
1
- export { Grid2DComponent } from './grid/Grid2DComponent';
2
- export type { Grid2DComponentOptions } from './grid/Grid2DComponent';
@@ -1,19 +0,0 @@
1
- export { Animation2DStateMachineComponent } from './animation/Animation2DStateMachineComponent';
2
- export type { Animation2DStateMachineComponentOptions } from './animation/Animation2DStateMachineComponent';
3
- export { Animation2DStateMachineSystem } from './animation/Animation2DStateMachineSystem';
4
- export type { Animation2DStateMachineSystemOptions } from './animation/Animation2DStateMachineSystem';
5
- export {
6
- createHyaAnimation2DClips,
7
- getHyaStateMachineExtension,
8
- } from './animation/HyaAnimation2DClipAdapter';
9
- export {
10
- AnimationStateMachineChannelError,
11
- assertAudioStateMachineCompatible,
12
- audioStateMachineCompatibilityDiagnostic,
13
- hyaStateMachineChannelCapability,
14
- HYA_STATE_MACHINE_CHANNEL_REGISTRY,
15
- } from './animation-state-machine/AnimationStateMachineChannels';
16
- export type {
17
- AnimationStateMachineChannelDiagnostic,
18
- AnimationStateMachineChannelDiagnosticCode,
19
- } from './animation-state-machine/AnimationStateMachineChannels';
package/src/index.ts DELETED
@@ -1,2 +0,0 @@
1
- export { RenderSystem2DBase } from './utils/RenderSystem2DBase';
2
- export type { RenderSystem2DBaseOptions } from './utils/RenderSystem2DBase';
@@ -1,50 +0,0 @@
1
- import type { EnginePlugin, RenderPipelineEntryOptions, ScenePluginContext, System } from '@haiyue/engine/experimental';
2
- import type { Entity, HaiyueEngine, World } from '@haiyue/engine';
3
-
4
- export const EXTENSIONS_PLUGIN_VERSION = '0.1.0';
5
-
6
- export interface EditorViewportContributionContext {
7
- world: World;
8
- engine: HaiyueEngine;
9
- camera2DEntity: Entity;
10
- registerRenderSystem?: (system: System, options?: RenderPipelineEntryOptions) => void;
11
- }
12
-
13
- export function removeSystem(context: ScenePluginContext, system: System | null): void {
14
- if (system) context.world.removeSystem(system);
15
- }
16
-
17
- export function installEditorRenderSystem<T extends System & { autoUpdate: boolean; setCameraEntity?(entity: Entity): unknown }>(
18
- context: EditorViewportContributionContext,
19
- constructor: new (...args: never[]) => T,
20
- create: () => T,
21
- ): { dispose(): void } {
22
- let system = context.world.getSystem(constructor) as T | null;
23
- const created = system === null;
24
- if (!system) {
25
- system = create();
26
- context.world.addSystem(system);
27
- }
28
- system.setCameraEntity?.(context.camera2DEntity);
29
- if (context.registerRenderSystem) {
30
- system.autoUpdate = false;
31
- context.registerRenderSystem(system);
32
- } else {
33
- system.autoUpdate = true;
34
- }
35
- return ownedEditorViewportSystem(context.world, system, created);
36
- }
37
-
38
- export function ownedEditorViewportSystem(
39
- world: World,
40
- system: System,
41
- owned: boolean,
42
- ): { dispose(): void } {
43
- return {
44
- dispose() {
45
- if (owned && world.hasSystem(system)) world.removeSystem(system);
46
- },
47
- };
48
- }
49
-
50
- export type { EnginePlugin, RenderPipelineEntryOptions };
package/src/plugins.ts DELETED
@@ -1,6 +0,0 @@
1
- export { createGltfPlugin } from './gltf/GltfPlugin';
2
- export type { GltfPluginOptions } from './gltf/GltfPlugin';
3
- export { createSpinePlugin } from './spine/SpinePlugin';
4
- export type { SpinePluginOptions } from './spine/SpinePlugin';
5
- export { createTilemapPlugin } from './tilemap/TilemapPlugin';
6
- export type { TilemapPluginOptions } from './tilemap/TilemapPlugin';
@@ -1,242 +0,0 @@
1
- // haiyue:builtin-render animation-2d
2
- // source: shader-language/builtin-components-2d-ui-family.json
3
-
4
- struct CameraUniforms {
5
- viewProj : mat4x4<f32>,
6
- }
7
-
8
- struct ObjectUniforms {
9
- model : mat4x4<f32>,
10
- color : vec4<f32>,
11
- params : vec4<f32>, // x: composite layer count, y: output offscreen source
12
- uvRect : vec4<f32>,
13
- compositeParams : array<vec4<f32>, 8>, // mode, operation, feather x/y
14
- compositeExpansion0 : vec4<f32>,
15
- compositeExpansion1 : vec4<f32>,
16
- gradientParams : vec4<f32>, // kind, stop count, opacity
17
- gradientGeometry : vec4<f32>, // start.xy, end.xy
18
- gradientColors : array<vec4<f32>, 8>,
19
- gradientOffsets0 : vec4<f32>,
20
- gradientOffsets1 : vec4<f32>,
21
- effectKinds0 : vec4<f32>,
22
- effectKinds1 : vec4<f32>,
23
- effectData : array<EffectData, 8>,
24
- }
25
-
26
- struct EffectData {
27
- data0 : vec4<f32>,
28
- data1 : vec4<f32>,
29
- data2 : vec4<f32>,
30
- data3 : vec4<f32>,
31
- data4 : vec4<f32>,
32
- data5 : vec4<f32>,
33
- }
34
-
35
- @group(0) @binding(0) var<uniform> camera : CameraUniforms;
36
- @group(1) @binding(0) var<uniform> object : ObjectUniforms;
37
- @group(2) @binding(0) var baseTexture : texture_2d<f32>;
38
- @group(2) @binding(1) var baseSampler : sampler;
39
- @group(3) @binding(0) var compositeTexture0 : texture_2d<f32>;
40
- @group(3) @binding(1) var compositeTexture1 : texture_2d<f32>;
41
- @group(3) @binding(2) var compositeTexture2 : texture_2d<f32>;
42
- @group(3) @binding(3) var compositeTexture3 : texture_2d<f32>;
43
- @group(3) @binding(4) var compositeTexture4 : texture_2d<f32>;
44
- @group(3) @binding(5) var compositeTexture5 : texture_2d<f32>;
45
- @group(3) @binding(6) var compositeTexture6 : texture_2d<f32>;
46
- @group(3) @binding(7) var compositeTexture7 : texture_2d<f32>;
47
- @group(3) @binding(8) var compositeSampler : sampler;
48
-
49
- struct VertexInput {
50
- @location(0) position : vec2<f32>,
51
- @location(1) uv : vec2<f32>,
52
- }
53
-
54
- struct VertexOutput {
55
- @builtin(position) clipPos : vec4<f32>,
56
- @location(0) uv : vec2<f32>,
57
- @location(1) localPosition : vec2<f32>,
58
- }
59
-
60
- @vertex
61
- fn vs_main(input : VertexInput) -> VertexOutput {
62
- var out : VertexOutput;
63
- out.clipPos = camera.viewProj * object.model * vec4<f32>(input.position, 0.0, 1.0);
64
- out.uv = object.uvRect.xy + input.uv * object.uvRect.zw;
65
- out.localPosition = input.position;
66
- return out;
67
- }
68
-
69
- struct EffectVertexOutput {
70
- @builtin(position) clipPos : vec4<f32>,
71
- @location(0) uv : vec2<f32>,
72
- @location(1) @interpolate(flat) effectIndex : u32,
73
- }
74
-
75
- @vertex
76
- fn vs_effect(@builtin(vertex_index) vertexIndex : u32, @builtin(instance_index) effectIndex : u32) -> EffectVertexOutput {
77
- let uv = vec2<f32>(f32((vertexIndex << 1u) & 2u), f32(vertexIndex & 2u));
78
- var out : EffectVertexOutput;
79
- out.clipPos = vec4<f32>(uv * vec2<f32>(2.0, -2.0) + vec2<f32>(-1.0, 1.0), 0.0, 1.0);
80
- out.uv = uv;
81
- out.effectIndex = effectIndex;
82
- return out;
83
- }
84
-
85
- fn decode_coverage(value : vec4<f32>, mode : f32) -> f32 {
86
- var coverage = select(value.a, dot(value.rgb, vec3<f32>(0.2126, 0.7152, 0.0722)), mode > 1.5);
87
- if ((mode > 0.5 && mode < 1.5) || mode > 2.5) { coverage = 1.0 - coverage; }
88
- return clamp(coverage, 0.0, 1.0);
89
- }
90
-
91
- fn filtered_coverage(
92
- source : texture_2d<f32>,
93
- uv : vec2<f32>,
94
- parameters : vec4<f32>,
95
- expansion : f32,
96
- ) -> f32 {
97
- let dimensions = vec2<f32>(textureDimensions(source));
98
- let radius = max(vec2<f32>(abs(expansion)), parameters.zw);
99
- let stepUv = radius / max(dimensions, vec2<f32>(1.0));
100
- let center = decode_coverage(textureSample(source, compositeSampler, uv), parameters.x);
101
- if (max(radius.x, radius.y) < 0.001) { return center; }
102
- let a = decode_coverage(textureSample(source, compositeSampler, uv + vec2<f32>(-stepUv.x, -stepUv.y)), parameters.x);
103
- let b = decode_coverage(textureSample(source, compositeSampler, uv + vec2<f32>(0.0, -stepUv.y)), parameters.x);
104
- let c = decode_coverage(textureSample(source, compositeSampler, uv + vec2<f32>(stepUv.x, -stepUv.y)), parameters.x);
105
- let d = decode_coverage(textureSample(source, compositeSampler, uv + vec2<f32>(-stepUv.x, 0.0)), parameters.x);
106
- let e = decode_coverage(textureSample(source, compositeSampler, uv + vec2<f32>(stepUv.x, 0.0)), parameters.x);
107
- let f = decode_coverage(textureSample(source, compositeSampler, uv + vec2<f32>(-stepUv.x, stepUv.y)), parameters.x);
108
- let g = decode_coverage(textureSample(source, compositeSampler, uv + vec2<f32>(0.0, stepUv.y)), parameters.x);
109
- let h = decode_coverage(textureSample(source, compositeSampler, uv + vec2<f32>(stepUv.x, stepUv.y)), parameters.x);
110
- var expanded = center;
111
- if (expansion > 0.001) { expanded = max(center, max(max(max(a, b), max(c, d)), max(max(e, f), max(g, h)))); }
112
- if (expansion < -0.001) { expanded = min(center, min(min(min(a, b), min(c, d)), min(min(e, f), min(g, h)))); }
113
- if (max(parameters.z, parameters.w) < 0.001) { return expanded; }
114
- let blurred = (center * 2.0 + a + b + c + d + e + f + g + h) / 10.0;
115
- return mix(expanded, blurred, clamp(max(parameters.z, parameters.w), 0.0, 1.0));
116
- }
117
-
118
- fn combine_coverage(current : f32, next : f32, operation : f32) -> f32 {
119
- if (operation < 0.5) { return current + next * (1.0 - current); }
120
- if (operation < 1.5) { return max(0.0, current - next); }
121
- if (operation < 2.5) { return current * next; }
122
- return abs(current - next);
123
- }
124
-
125
- fn gradient_offset(index : i32) -> f32 {
126
- if (index < 4) { return object.gradientOffsets0[index]; }
127
- return object.gradientOffsets1[index - 4];
128
- }
129
-
130
- fn gradient_color(position : vec2<f32>) -> vec4<f32> {
131
- let start = object.gradientGeometry.xy;
132
- let delta = object.gradientGeometry.zw - start;
133
- var progress = dot(position - start, delta) / max(dot(delta, delta), 1e-6);
134
- if (object.gradientParams.x > 1.5) { progress = length(position - start) / max(length(delta), 1e-6); }
135
- progress = clamp(progress, 0.0, 1.0);
136
- var previousOffset = gradient_offset(0);
137
- var previousColor = object.gradientColors[0];
138
- for (var index = 1; index < 8; index++) {
139
- if (f32(index) >= object.gradientParams.y) { break; }
140
- let nextOffset = gradient_offset(index);
141
- let nextColor = object.gradientColors[index];
142
- if (progress <= nextOffset) {
143
- let local = clamp((progress - previousOffset) / max(nextOffset - previousOffset, 1e-6), 0.0, 1.0);
144
- return mix(previousColor, nextColor, local) * vec4<f32>(1.0, 1.0, 1.0, object.gradientParams.z);
145
- }
146
- previousOffset = nextOffset;
147
- previousColor = nextColor;
148
- }
149
- return previousColor * vec4<f32>(1.0, 1.0, 1.0, object.gradientParams.z);
150
- }
151
-
152
- fn effect_kind(index : u32) -> f32 {
153
- if (index < 4u) { return object.effectKinds0[index]; }
154
- return object.effectKinds1[index - 4u];
155
- }
156
-
157
- fn unpremultiply(value : vec4<f32>) -> vec4<f32> {
158
- if (value.a <= 1e-6) { return vec4<f32>(0.0); }
159
- return vec4<f32>(value.rgb / value.a, value.a);
160
- }
161
-
162
- fn apply_color_effect(value : vec4<f32>, index : u32) -> vec4<f32> {
163
- let kind = effect_kind(index);
164
- let data = object.effectData[index];
165
- var color = unpremultiply(value);
166
- if (kind < 1.5) {
167
- let luminance = dot(color.rgb, vec3<f32>(0.2126, 0.7152, 0.0722));
168
- let tinted = mix(data.data0.xyz, vec3<f32>(data.data0.w, data.data1.x, data.data1.y), luminance);
169
- color = vec4<f32>(mix(color.rgb, tinted, clamp(data.data1.z, 0.0, 1.0)), color.a);
170
- } else if (kind < 2.5) {
171
- color = vec4<f32>(data.data0.rgb, color.a);
172
- color.a = color.a * data.data0.a * clamp(data.data1.x, 0.0, 1.0);
173
- } else if (kind < 3.5) {
174
- color.a = color.a * clamp(data.data0.x, 0.0, 1.0);
175
- } else if (kind < 4.5) {
176
- let source = color;
177
- color = vec4<f32>(
178
- dot(source, data.data0) + data.data1.x,
179
- dot(source, vec4<f32>(data.data1.yzw, data.data2.x)) + data.data2.y,
180
- dot(source, vec4<f32>(data.data2.zw, data.data3.xy)) + data.data3.z,
181
- dot(source, vec4<f32>(data.data3.w, data.data4.xyz)) + data.data4.w
182
- );
183
- color = clamp(color, vec4<f32>(0.0), vec4<f32>(1.0));
184
- }
185
- return vec4<f32>(color.rgb * color.a, color.a);
186
- }
187
-
188
- fn sample_blurred(uv : vec2<f32>, radius : vec2<f32>) -> vec4<f32> {
189
- let dimensions = max(vec2<f32>(textureDimensions(baseTexture)), vec2<f32>(1.0));
190
- let stepUv = radius / dimensions;
191
- if (max(radius.x, radius.y) < 0.01) { return textureSampleLevel(baseTexture, baseSampler, uv, 0.0); }
192
- var value = textureSampleLevel(baseTexture, baseSampler, uv, 0.0) * 0.25;
193
- value += textureSampleLevel(baseTexture, baseSampler, uv + vec2<f32>(-stepUv.x, 0.0), 0.0) * 0.125;
194
- value += textureSampleLevel(baseTexture, baseSampler, uv + vec2<f32>(stepUv.x, 0.0), 0.0) * 0.125;
195
- value += textureSampleLevel(baseTexture, baseSampler, uv + vec2<f32>(0.0, -stepUv.y), 0.0) * 0.125;
196
- value += textureSampleLevel(baseTexture, baseSampler, uv + vec2<f32>(0.0, stepUv.y), 0.0) * 0.125;
197
- value += textureSampleLevel(baseTexture, baseSampler, uv + vec2<f32>(-stepUv.x, -stepUv.y), 0.0) * 0.0625;
198
- value += textureSampleLevel(baseTexture, baseSampler, uv + vec2<f32>(stepUv.x, -stepUv.y), 0.0) * 0.0625;
199
- value += textureSampleLevel(baseTexture, baseSampler, uv + vec2<f32>(-stepUv.x, stepUv.y), 0.0) * 0.0625;
200
- value += textureSampleLevel(baseTexture, baseSampler, uv + vec2<f32>(stepUv.x, stepUv.y), 0.0) * 0.0625;
201
- return value;
202
- }
203
-
204
- @fragment
205
- fn fs_effect(input : EffectVertexOutput) -> @location(0) vec4<f32> {
206
- let kind = effect_kind(input.effectIndex);
207
- let data = object.effectData[input.effectIndex];
208
- if (kind < 4.5) { return apply_color_effect(textureSampleLevel(baseTexture, baseSampler, input.uv, 0.0), input.effectIndex); }
209
- if (kind < 5.5) { return sample_blurred(input.uv, max(data.data0.xy, vec2<f32>(0.0))); }
210
- let dimensions = max(vec2<f32>(textureDimensions(baseTexture)), vec2<f32>(1.0));
211
- let shadowUv = input.uv - data.data1.yz / dimensions;
212
- let shadowCoverage = sample_blurred(shadowUv, vec2<f32>(max(data.data1.w, 0.0))).a;
213
- let shadowAlpha = clamp(shadowCoverage * data.data1.x * data.data0.a, 0.0, 1.0);
214
- let shadow = vec4<f32>(data.data0.rgb * shadowAlpha, shadowAlpha);
215
- let foreground = textureSampleLevel(baseTexture, baseSampler, input.uv, 0.0);
216
- return foreground + shadow * (1.0 - foreground.a);
217
- }
218
-
219
- @fragment
220
- fn fs_present(input : EffectVertexOutput) -> @location(0) vec4<f32> {
221
- return textureSampleLevel(baseTexture, baseSampler, input.uv, 0.0);
222
- }
223
-
224
- @fragment
225
- fn fs_main(input : VertexOutput) -> @location(0) vec4<f32> {
226
- var base = textureSample(baseTexture, baseSampler, input.uv) * object.color;
227
- if (object.gradientParams.x > 0.5) { base = gradient_color(input.localPosition) * object.color; }
228
- var coverage = 1.0;
229
- if (object.params.x > 0.5) {
230
- let uv = input.clipPos.xy / vec2<f32>(textureDimensions(compositeTexture0));
231
- coverage = select(0.0, 1.0, object.compositeParams[0].y > 0.5 && object.compositeParams[0].y < 2.5);
232
- coverage = combine_coverage(coverage, filtered_coverage(compositeTexture0, uv, object.compositeParams[0], object.compositeExpansion0.x), object.compositeParams[0].y);
233
- if (object.params.x > 1.5) { coverage = combine_coverage(coverage, filtered_coverage(compositeTexture1, uv, object.compositeParams[1], object.compositeExpansion0.y), object.compositeParams[1].y); }
234
- if (object.params.x > 2.5) { coverage = combine_coverage(coverage, filtered_coverage(compositeTexture2, uv, object.compositeParams[2], object.compositeExpansion0.z), object.compositeParams[2].y); }
235
- if (object.params.x > 3.5) { coverage = combine_coverage(coverage, filtered_coverage(compositeTexture3, uv, object.compositeParams[3], object.compositeExpansion0.w), object.compositeParams[3].y); }
236
- if (object.params.x > 4.5) { coverage = combine_coverage(coverage, filtered_coverage(compositeTexture4, uv, object.compositeParams[4], object.compositeExpansion1.x), object.compositeParams[4].y); }
237
- if (object.params.x > 5.5) { coverage = combine_coverage(coverage, filtered_coverage(compositeTexture5, uv, object.compositeParams[5], object.compositeExpansion1.y), object.compositeParams[5].y); }
238
- if (object.params.x > 6.5) { coverage = combine_coverage(coverage, filtered_coverage(compositeTexture6, uv, object.compositeParams[6], object.compositeExpansion1.z), object.compositeParams[6].y); }
239
- if (object.params.x > 7.5) { coverage = combine_coverage(coverage, filtered_coverage(compositeTexture7, uv, object.compositeParams[7], object.compositeExpansion1.w), object.compositeParams[7].y); }
240
- }
241
- return vec4<f32>(base.rgb, base.a * coverage);
242
- }