@haiyue/extensions 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (293) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +30 -0
  3. package/dist/animation/Animation2DComponent.d.ts +46 -0
  4. package/dist/animation/Animation2DExtensionRegistry.d.ts +27 -0
  5. package/dist/animation/Animation2DRenderSystem.d.ts +89 -0
  6. package/dist/animation/Animation2DRuntime.d.ts +99 -0
  7. package/dist/animation/Animation2DStateMachine.d.ts +13 -0
  8. package/dist/animation/Animation2DStateMachineComponent.d.ts +54 -0
  9. package/dist/animation/Animation2DStateMachineRuntime.d.ts +30 -0
  10. package/dist/animation/Animation2DStateMachineSystem.d.ts +14 -0
  11. package/dist/animation/Animation2DStateMachineVisualRuntime.d.ts +27 -0
  12. package/dist/animation/Animation2DSystem.d.ts +14 -0
  13. package/dist/animation/AnimationAssetLoader.d.ts +9 -0
  14. package/dist/animation/AnimationAudioClip.d.ts +26 -0
  15. package/dist/animation/AnimationPathTessellator.d.ts +52 -0
  16. package/dist/animation/AnimationTextRasterizer.d.ts +21 -0
  17. package/dist/animation/AnimationVisual2D.d.ts +68 -0
  18. package/dist/animation/HyaAnimation2DClipAdapter.d.ts +16 -0
  19. package/dist/animation/Particle2DDescriptorAdapter.d.ts +5 -0
  20. package/dist/animation/runtime/mixer/Action.d.ts +150 -0
  21. package/dist/animation/runtime/mixer/Mixer.d.ts +54 -0
  22. package/dist/animation/runtime/mixer/PoseBuffer.d.ts +23 -0
  23. package/dist/animation/runtime/mixer/Sampler.d.ts +17 -0
  24. package/dist/animation/runtime/mixer/Types.d.ts +101 -0
  25. package/dist/animation/runtime/mixer/index.d.ts +6 -0
  26. package/dist/animation-state-machine/AnimationStateMachine.d.ts +111 -0
  27. package/dist/animation-state-machine/AnimationStateMachineChannels.d.ts +23 -0
  28. package/dist/animation-state-machine/runtime/Animation2DStateMachineMixerAdapter.d.ts +51 -0
  29. package/dist/animation-state-machine/runtime/AnimationStateMachineBlendTreeWeights.d.ts +14 -0
  30. package/dist/animation-state-machine/runtime/AnimationStateMachineCompiler.d.ts +109 -0
  31. package/dist/animation-state-machine/runtime/AnimationStateMachineController.d.ts +103 -0
  32. package/dist/animation-state-machine/runtime/AnimationStateMachineMixerPort.d.ts +35 -0
  33. package/dist/animation-state-machine/runtime/index.d.ts +7 -0
  34. package/dist/animation.d.ts +15 -0
  35. package/dist/animation.js +1171 -0
  36. package/dist/animation3d/Animation3DAction.d.ts +46 -0
  37. package/dist/animation3d/Animation3DBinding.d.ts +85 -0
  38. package/dist/animation3d/Animation3DClip.d.ts +20 -0
  39. package/dist/animation3d/Animation3DError.d.ts +13 -0
  40. package/dist/animation3d/Animation3DMixer.d.ts +27 -0
  41. package/dist/animation3d/Animation3DPose.d.ts +40 -0
  42. package/dist/animation3d/Animation3DPoseBuffer.d.ts +24 -0
  43. package/dist/animation3d/Animation3DResource.d.ts +28 -0
  44. package/dist/animation3d/Animation3DStateMachine.d.ts +95 -0
  45. package/dist/animation3d/Animation3DStateMachineRuntime.d.ts +70 -0
  46. package/dist/animation3d/Animation3DTrack.d.ts +19 -0
  47. package/dist/animation3d/hya/HyaAnimation3DRuntime.d.ts +73 -0
  48. package/dist/animation3d/hya/HyaAnimation3DStateMachineRuntime.d.ts +65 -0
  49. package/dist/animation3d/hya/HyaAnimation3DTypes.d.ts +170 -0
  50. package/dist/animation3d/hya/index.d.ts +4 -0
  51. package/dist/animation3d/index.d.ts +14 -0
  52. package/dist/animation3d/runtime/integration/Animation3DStateMachineMixerAdapter.d.ts +81 -0
  53. package/dist/animation3d/runtime/integration/Animation3DStateMachineMixerIntegration.d.ts +39 -0
  54. package/dist/animation3d/runtime/integration/index.d.ts +2 -0
  55. package/dist/animation3d/runtime/mixer/Action.d.ts +150 -0
  56. package/dist/animation3d/runtime/mixer/Animation3DMixerRuntimeStore.d.ts +6 -0
  57. package/dist/animation3d/runtime/mixer/Mixer.d.ts +59 -0
  58. package/dist/animation3d/runtime/mixer/PoseBuffer.d.ts +1 -0
  59. package/dist/animation3d/runtime/mixer/TrackSampler.d.ts +24 -0
  60. package/dist/animation3d/runtime/mixer/index.d.ts +4 -0
  61. package/dist/animation3d/runtime/state-machine/Animation3DBlendTreeWeights.d.ts +1 -0
  62. package/dist/animation3d/runtime/state-machine/Animation3DStateMachineCompiler.d.ts +1 -0
  63. package/dist/animation3d/runtime/state-machine/Animation3DStateMachineController.d.ts +1 -0
  64. package/dist/animation3d/runtime/state-machine/Animation3DStateMachineMixerPort.d.ts +1 -0
  65. package/dist/animation3d/runtime/state-machine/index.d.ts +6 -0
  66. package/dist/animation3d.d.ts +5 -0
  67. package/dist/animation3d.js +1708 -0
  68. package/dist/benchmark.d.ts +30 -0
  69. package/dist/benchmark.js +119 -0
  70. package/dist/canvas-text/CanvasText2DRenderSystem.d.ts +24 -0
  71. package/dist/canvas-text/CanvasTextComponent.d.ts +18 -0
  72. package/dist/canvas-text.d.ts +4 -0
  73. package/dist/canvas-text.js +276 -0
  74. package/dist/chunks/2d-ui-animation-2d.generated-D4aHzFU2.js +4 -0
  75. package/dist/chunks/2d-ui-canvas-text-2d.generated-C0Eaej2m.js +4 -0
  76. package/dist/chunks/2d-ui-spine2d.generated-CUUi8xjl.js +4 -0
  77. package/dist/chunks/2d-ui-tilemap2d.generated-gebw4mX7.js +4 -0
  78. package/dist/chunks/Animation2DStateMachine-9IonguNa.js +3245 -0
  79. package/dist/chunks/AnimationStateMachineController-BIcAh-sT.js +1438 -0
  80. package/dist/chunks/GltfAnimation3DAdapter-Cu3rQQsW.js +2240 -0
  81. package/dist/chunks/GltfAnimationRuntime-CRHsLycN.js +631 -0
  82. package/dist/chunks/RenderSystem2DBase-DDT61dAu.js +227 -0
  83. package/dist/chunks/Spine2DRuntime-D9M9LAQR.js +3056 -0
  84. package/dist/chunks/SpineAssetParser-BSDmPge1.js +378 -0
  85. package/dist/chunks/gltfLoader-Dm22jLYB.js +2085 -0
  86. package/dist/chunks/pluginUtils-CvwroRMd.js +33 -0
  87. package/dist/experimental-gltf-worker.d.ts +4 -0
  88. package/dist/experimental-gltf-worker.js +138 -0
  89. package/dist/experimental-spine-worker.d.ts +4 -0
  90. package/dist/experimental-spine-worker.js +110 -0
  91. package/dist/gltf/GltfAccessorReader.d.ts +7 -0
  92. package/dist/gltf/GltfAnimation3DAdapter.d.ts +47 -0
  93. package/dist/gltf/GltfAnimationRuntime.d.ts +10 -0
  94. package/dist/gltf/GltfAssetWorkerClient.d.ts +20 -0
  95. package/dist/gltf/GltfCompatibilityReport.d.ts +70 -0
  96. package/dist/gltf/GltfConservativeBounds.d.ts +18 -0
  97. package/dist/gltf/GltfDracoDecoder.d.ts +4 -0
  98. package/dist/gltf/GltfExtensionAdapter.d.ts +54 -0
  99. package/dist/gltf/GltfLoaderContract.d.ts +249 -0
  100. package/dist/gltf/GltfLoaderErrors.d.ts +4 -0
  101. package/dist/gltf/GltfMaterialDescriptor.d.ts +23 -0
  102. package/dist/gltf/GltfMaterialEncoder.d.ts +20 -0
  103. package/dist/gltf/GltfMaterialLoader.d.ts +6 -0
  104. package/dist/gltf/GltfModelComponent.d.ts +72 -0
  105. package/dist/gltf/GltfModelSystem.d.ts +37 -0
  106. package/dist/gltf/GltfPlugin.d.ts +6 -0
  107. package/dist/gltf/GltfSchema.d.ts +225 -0
  108. package/dist/gltf/GltfUvSemanticPlanner.d.ts +33 -0
  109. package/dist/gltf/gltfLoader.d.ts +9 -0
  110. package/dist/gltf-animation3d.d.ts +3 -0
  111. package/dist/gltf-animation3d.js +8 -0
  112. package/dist/gltf-worker-runtime.d.ts +7 -0
  113. package/dist/gltf-worker-runtime.js +6981 -0
  114. package/dist/gltf.d.ts +12 -0
  115. package/dist/gltf.js +517 -0
  116. package/dist/grid/Grid2DComponent.d.ts +25 -0
  117. package/dist/grid.d.ts +2 -0
  118. package/dist/grid.js +56 -0
  119. package/dist/hya-state-machine.d.ts +7 -0
  120. package/dist/hya-state-machine.js +2934 -0
  121. package/dist/index.d.ts +2 -0
  122. package/dist/index.js +7 -0
  123. package/dist/internal/2d-ui-shader-artifact.js +870 -0
  124. package/dist/plugins/pluginUtils.d.ts +20 -0
  125. package/dist/plugins.d.ts +6 -0
  126. package/dist/shaders/generated/2d-ui-artifact.generated.d.ts +658 -0
  127. package/dist/spine/Spine2DComponent.d.ts +116 -0
  128. package/dist/spine/Spine2DGpuRenderer.d.ts +65 -0
  129. package/dist/spine/Spine2DRenderSystem.d.ts +27 -0
  130. package/dist/spine/Spine2DRuntime.d.ts +103 -0
  131. package/dist/spine/SpineAnimationBoneTimelines.d.ts +8 -0
  132. package/dist/spine/SpineAssetParser.d.ts +18 -0
  133. package/dist/spine/SpineAssetWorkerClient.d.ts +19 -0
  134. package/dist/spine/SpineAssetWorkerContract.d.ts +6 -0
  135. package/dist/spine/SpineAtlasParser.d.ts +21 -0
  136. package/dist/spine/SpineFloatBuilder.d.ts +15 -0
  137. package/dist/spine/SpinePathConstraintSolver.d.ts +32 -0
  138. package/dist/spine/SpinePlugin.d.ts +8 -0
  139. package/dist/spine/SpineSkeletonRuntime.d.ts +185 -0
  140. package/dist/spine/SpineSlotAnimation.d.ts +17 -0
  141. package/dist/spine/SpineTimelineRuntime.d.ts +25 -0
  142. package/dist/spine/SpineVertexBuilder.d.ts +61 -0
  143. package/dist/spine.d.ts +7 -0
  144. package/dist/spine.js +578 -0
  145. package/dist/tilemap/Tilemap2DComponent.d.ts +110 -0
  146. package/dist/tilemap/Tilemap2DRenderSystem.d.ts +11 -0
  147. package/dist/tilemap/Tilemap2DRenderer.d.ts +24 -0
  148. package/dist/tilemap/TilemapPlugin.d.ts +8 -0
  149. package/dist/tilemap.d.ts +6 -0
  150. package/dist/tilemap.js +535 -0
  151. package/dist/tween/Tween2DComponent.d.ts +70 -0
  152. package/dist/tween/Tween2DSystem.d.ts +12 -0
  153. package/dist/tween.d.ts +4 -0
  154. package/dist/tween.js +138 -0
  155. package/dist/utils/RenderSystem2DBase.d.ts +42 -0
  156. package/dist/utils/arrayAccess.d.ts +4 -0
  157. package/dist/utils/camera2d.d.ts +12 -0
  158. package/dist/utils/render2dGpu.d.ts +32 -0
  159. package/package.json +124 -0
  160. package/src/animation/Animation2DComponent.ts +135 -0
  161. package/src/animation/Animation2DExtensionRegistry.ts +52 -0
  162. package/src/animation/Animation2DRenderSystem.ts +1026 -0
  163. package/src/animation/Animation2DRuntime.ts +1326 -0
  164. package/src/animation/Animation2DStateMachine.ts +39 -0
  165. package/src/animation/Animation2DStateMachineComponent.ts +228 -0
  166. package/src/animation/Animation2DStateMachineRuntime.ts +141 -0
  167. package/src/animation/Animation2DStateMachineSystem.ts +60 -0
  168. package/src/animation/Animation2DStateMachineVisualRuntime.ts +282 -0
  169. package/src/animation/Animation2DSystem.ts +72 -0
  170. package/src/animation/AnimationAssetLoader.ts +84 -0
  171. package/src/animation/AnimationAudioClip.ts +140 -0
  172. package/src/animation/AnimationPathTessellator.ts +691 -0
  173. package/src/animation/AnimationTextRasterizer.ts +340 -0
  174. package/src/animation/AnimationVisual2D.ts +153 -0
  175. package/src/animation/HyaAnimation2DClipAdapter.ts +845 -0
  176. package/src/animation/Particle2DDescriptorAdapter.ts +35 -0
  177. package/src/animation/runtime/mixer/Action.ts +876 -0
  178. package/src/animation/runtime/mixer/Mixer.ts +505 -0
  179. package/src/animation/runtime/mixer/PoseBuffer.ts +105 -0
  180. package/src/animation/runtime/mixer/Sampler.ts +252 -0
  181. package/src/animation/runtime/mixer/Types.ts +138 -0
  182. package/src/animation/runtime/mixer/index.ts +31 -0
  183. package/src/animation-state-machine/AnimationStateMachine.ts +146 -0
  184. package/src/animation-state-machine/AnimationStateMachineChannels.ts +116 -0
  185. package/src/animation-state-machine/runtime/Animation2DStateMachineMixerAdapter.ts +197 -0
  186. package/src/animation-state-machine/runtime/AnimationStateMachineBlendTreeWeights.ts +503 -0
  187. package/src/animation-state-machine/runtime/AnimationStateMachineCompiler.ts +763 -0
  188. package/src/animation-state-machine/runtime/AnimationStateMachineController.ts +987 -0
  189. package/src/animation-state-machine/runtime/AnimationStateMachineMixerPort.ts +54 -0
  190. package/src/animation-state-machine/runtime/index.ts +47 -0
  191. package/src/animation.ts +33 -0
  192. package/src/animation3d/Animation3DAction.ts +73 -0
  193. package/src/animation3d/Animation3DBinding.ts +116 -0
  194. package/src/animation3d/Animation3DClip.ts +22 -0
  195. package/src/animation3d/Animation3DError.ts +34 -0
  196. package/src/animation3d/Animation3DMixer.ts +82 -0
  197. package/src/animation3d/Animation3DPose.ts +100 -0
  198. package/src/animation3d/Animation3DPoseBuffer.ts +85 -0
  199. package/src/animation3d/Animation3DResource.ts +49 -0
  200. package/src/animation3d/Animation3DStateMachine.ts +126 -0
  201. package/src/animation3d/Animation3DStateMachineRuntime.ts +191 -0
  202. package/src/animation3d/Animation3DTrack.ts +29 -0
  203. package/src/animation3d/hya/HyaAnimation3DRuntime.ts +756 -0
  204. package/src/animation3d/hya/HyaAnimation3DStateMachineRuntime.ts +618 -0
  205. package/src/animation3d/hya/HyaAnimation3DTypes.ts +168 -0
  206. package/src/animation3d/hya/index.ts +10 -0
  207. package/src/animation3d/index.ts +76 -0
  208. package/src/animation3d/runtime/integration/Animation3DStateMachineMixerAdapter.ts +325 -0
  209. package/src/animation3d/runtime/integration/Animation3DStateMachineMixerIntegration.ts +158 -0
  210. package/src/animation3d/runtime/integration/index.ts +9 -0
  211. package/src/animation3d/runtime/mixer/Action.ts +833 -0
  212. package/src/animation3d/runtime/mixer/Animation3DMixerRuntimeStore.ts +26 -0
  213. package/src/animation3d/runtime/mixer/Mixer.ts +562 -0
  214. package/src/animation3d/runtime/mixer/PoseBuffer.ts +1 -0
  215. package/src/animation3d/runtime/mixer/TrackSampler.ts +399 -0
  216. package/src/animation3d/runtime/mixer/index.ts +8 -0
  217. package/src/animation3d/runtime/state-machine/Animation3DBlendTreeWeights.ts +4 -0
  218. package/src/animation3d/runtime/state-machine/Animation3DStateMachineCompiler.ts +1 -0
  219. package/src/animation3d/runtime/state-machine/Animation3DStateMachineController.ts +1 -0
  220. package/src/animation3d/runtime/state-machine/Animation3DStateMachineMixerPort.ts +1 -0
  221. package/src/animation3d/runtime/state-machine/index.ts +45 -0
  222. package/src/animation3d.ts +5 -0
  223. package/src/benchmark.ts +168 -0
  224. package/src/canvas-text/CanvasText2DRenderSystem.ts +292 -0
  225. package/src/canvas-text/CanvasTextComponent.ts +47 -0
  226. package/src/canvas-text.ts +4 -0
  227. package/src/experimental-gltf-worker.ts +18 -0
  228. package/src/experimental-spine-worker.ts +9 -0
  229. package/src/gltf/GltfAccessorReader.ts +271 -0
  230. package/src/gltf/GltfAnimation3DAdapter.ts +680 -0
  231. package/src/gltf/GltfAnimationRuntime.ts +392 -0
  232. package/src/gltf/GltfAssetWorkerClient.ts +136 -0
  233. package/src/gltf/GltfCompatibilityReport.ts +214 -0
  234. package/src/gltf/GltfConservativeBounds.ts +219 -0
  235. package/src/gltf/GltfDracoDecoder.ts +251 -0
  236. package/src/gltf/GltfExtensionAdapter.ts +340 -0
  237. package/src/gltf/GltfLoaderContract.ts +333 -0
  238. package/src/gltf/GltfLoaderErrors.ts +59 -0
  239. package/src/gltf/GltfMaterialDescriptor.ts +134 -0
  240. package/src/gltf/GltfMaterialEncoder.ts +173 -0
  241. package/src/gltf/GltfMaterialLoader.ts +293 -0
  242. package/src/gltf/GltfModelComponent.ts +115 -0
  243. package/src/gltf/GltfModelSystem.ts +208 -0
  244. package/src/gltf/GltfPlugin.ts +84 -0
  245. package/src/gltf/GltfSchema.ts +229 -0
  246. package/src/gltf/GltfUvSemanticPlanner.ts +166 -0
  247. package/src/gltf/gltfLoader.ts +910 -0
  248. package/src/gltf-animation3d.ts +10 -0
  249. package/src/gltf-worker-runtime.ts +10 -0
  250. package/src/gltf.ts +56 -0
  251. package/src/grid/Grid2DComponent.ts +69 -0
  252. package/src/grid.ts +2 -0
  253. package/src/hya-state-machine.ts +19 -0
  254. package/src/index.ts +2 -0
  255. package/src/plugins/pluginUtils.ts +50 -0
  256. package/src/plugins.ts +6 -0
  257. package/src/shaders/generated/2d-ui-animation-2d.generated.wgsl +242 -0
  258. package/src/shaders/generated/2d-ui-artifact.generated.ts +867 -0
  259. package/src/shaders/generated/2d-ui-canvas-text-2d.generated.wgsl +38 -0
  260. package/src/shaders/generated/2d-ui-spine2d.generated.wgsl +41 -0
  261. package/src/shaders/generated/2d-ui-tilemap2d.generated.wgsl +36 -0
  262. package/src/spine/Spine2DComponent.ts +168 -0
  263. package/src/spine/Spine2DGpuRenderer.ts +449 -0
  264. package/src/spine/Spine2DRenderSystem.ts +199 -0
  265. package/src/spine/Spine2DRuntime.ts +1529 -0
  266. package/src/spine/SpineAnimationBoneTimelines.ts +30 -0
  267. package/src/spine/SpineAssetParser.ts +20 -0
  268. package/src/spine/SpineAssetWorkerClient.ts +112 -0
  269. package/src/spine/SpineAssetWorkerContract.ts +4 -0
  270. package/src/spine/SpineAtlasParser.ts +127 -0
  271. package/src/spine/SpineFloatBuilder.ts +66 -0
  272. package/src/spine/SpinePathConstraintSolver.ts +582 -0
  273. package/src/spine/SpinePlugin.ts +76 -0
  274. package/src/spine/SpineSkeletonRuntime.ts +521 -0
  275. package/src/spine/SpineSlotAnimation.ts +195 -0
  276. package/src/spine/SpineTimelineRuntime.ts +453 -0
  277. package/src/spine/SpineVertexBuilder.ts +686 -0
  278. package/src/spine.ts +7 -0
  279. package/src/tilemap/Tilemap2DComponent.ts +232 -0
  280. package/src/tilemap/Tilemap2DRenderSystem.ts +58 -0
  281. package/src/tilemap/Tilemap2DRenderer.ts +289 -0
  282. package/src/tilemap/TilemapPlugin.ts +75 -0
  283. package/src/tilemap.ts +6 -0
  284. package/src/tween/Tween2DComponent.ts +83 -0
  285. package/src/tween/Tween2DSystem.ts +78 -0
  286. package/src/tween.ts +4 -0
  287. package/src/types/earcut.d.ts +7 -0
  288. package/src/types/wgsl.d.ts +4 -0
  289. package/src/utils/RenderSystem2DBase.ts +164 -0
  290. package/src/utils/arrayAccess.ts +17 -0
  291. package/src/utils/camera2d.ts +68 -0
  292. package/src/utils/render2dGpu.ts +132 -0
  293. package/test/fixtures/gltf/animation-characterization.gltf +344 -0
@@ -0,0 +1,249 @@
1
+ import type { AssetHandle, AssetManager } from '@haiyue/engine/assets';
2
+ import type { Entity, Geometry3D } from '@haiyue/engine';
3
+ import type { Transform3D } from '@haiyue/engine/components';
4
+ import { type GltfAnimationInterpolation, type GltfAsset } from './GltfSchema';
5
+ import { type GltfExtensionAdapter, type GltfExtensionCapability } from './GltfExtensionAdapter';
6
+ import type { GltfCompatibilityExtensionEntry, GltfCompatibilityReport, GltfPrimitiveCompatibilityInput } from './GltfCompatibilityReport';
7
+ export type { GltfCompatibilityExtensionEntry, GltfCompatibilityIssue, GltfCompatibilityPerformanceSummary, GltfCompatibilityReport, GltfCompatibilityStatus, GltfPrimitiveBoundsCompatibilityEntry, GltfPrimitiveBoundsSupport, GltfPrimitiveUvSemanticCompatibilityEntry, GltfTextureCompatibilityEntry, GltfTextureMipmapSource, } from './GltfCompatibilityReport';
8
+ export type { GltfAnimationInterpolation } from './GltfSchema';
9
+ export type { GltfExtensionAdapter, GltfExtensionCapability, GltfExtensionSupport, } from './GltfExtensionAdapter';
10
+ export interface LoadedGltfModel {
11
+ root: Entity;
12
+ animations: GltfAnimationInfo[];
13
+ animationClips: GltfAnimationClip[];
14
+ assetStats: GltfAssetStats;
15
+ loadMetrics: GltfLoadMetrics;
16
+ objectUrls: string[];
17
+ assetHandles: AssetHandle<unknown>[];
18
+ materialVariants: readonly string[];
19
+ warnings: readonly GltfLoadWarning[];
20
+ extensionReport: GltfExtensionReport;
21
+ compatibilityReport: GltfCompatibilityReport;
22
+ }
23
+ export type GltfExtensionReportEntry = GltfCompatibilityExtensionEntry;
24
+ export interface GltfExtensionReport {
25
+ readonly fullySupported: boolean;
26
+ readonly entries: readonly GltfExtensionReportEntry[];
27
+ }
28
+ export declare const GLTF_EXTENSION_CAPABILITIES: Readonly<Record<string, GltfExtensionCapability>>;
29
+ export interface GltfLoadWarning {
30
+ readonly code: 'W_GLTF_PARTIAL_OPTIONAL_EXTENSION' | 'W_GLTF_UNSUPPORTED_OPTIONAL_EXTENSION';
31
+ readonly message: string;
32
+ readonly extension: string;
33
+ readonly path: string;
34
+ }
35
+ export interface GltfAnimationInfo {
36
+ name: string;
37
+ duration: number;
38
+ channelCount: number;
39
+ }
40
+ export type GltfAnimationPath = 'translation' | 'rotation' | 'scale' | 'weights';
41
+ export interface GltfAnimationTarget {
42
+ entity: Entity;
43
+ transform: Transform3D;
44
+ translation: [number, number, number];
45
+ rotation: [number, number, number, number];
46
+ scale: [number, number, number];
47
+ weights: number[];
48
+ morphPrimitives: GltfMorphPrimitiveRuntime[];
49
+ }
50
+ export interface GltfMorphPrimitiveRuntime {
51
+ geometry: Geometry3D;
52
+ basePositions: Float32Array;
53
+ baseNormals: Float32Array | null;
54
+ positionTargets: Float32Array[];
55
+ normalTargets: Float32Array[];
56
+ }
57
+ export interface GltfAnimationChannelRuntime {
58
+ target: GltfAnimationTarget;
59
+ path: GltfAnimationPath;
60
+ interpolation: GltfAnimationInterpolation;
61
+ valueSize: number;
62
+ input: Float32Array;
63
+ output: Float32Array;
64
+ sampleA: Float32Array;
65
+ sampleB: Float32Array;
66
+ sampleOut: Float32Array;
67
+ quatScratch: Float32Array;
68
+ }
69
+ export interface GltfAnimationClip {
70
+ name: string;
71
+ duration: number;
72
+ channels: GltfAnimationChannelRuntime[];
73
+ skinnedPrimitives: GltfSkinnedPrimitiveRuntime[];
74
+ stateCache: Map<GltfAnimationTarget, GltfAnimationTargetState>;
75
+ activeStates: GltfAnimationTargetState[];
76
+ }
77
+ export interface GltfAnimationTargetState {
78
+ target: GltfAnimationTarget;
79
+ translation: Float32Array;
80
+ rotation: Float32Array;
81
+ scale: Float32Array;
82
+ matrix: Float32Array<ArrayBuffer>;
83
+ active: boolean;
84
+ }
85
+ export interface GltfAssetStats {
86
+ meshCount: number;
87
+ primitiveCount: number;
88
+ materialCount: number;
89
+ textureCount: number;
90
+ imageCount: number;
91
+ animationCount: number;
92
+ }
93
+ export interface GltfLoadPhaseTimings {
94
+ readonly fetchMs: number;
95
+ readonly workerParseMs: number;
96
+ readonly dracoDecodeMs: number;
97
+ readonly geometryPreparationMs: number;
98
+ readonly instantiateMs: number;
99
+ readonly textureDecodeTranscodeUploadMs: number;
100
+ readonly totalMs: number;
101
+ }
102
+ export interface GltfLoadMetrics {
103
+ readonly timings: GltfLoadPhaseTimings;
104
+ readonly sourceBytes: number;
105
+ readonly decodedGeometryBytes: number;
106
+ readonly workerTransferBytes: number;
107
+ readonly workerTransferBufferCount: number;
108
+ }
109
+ export interface GltfLoadDiagnostics {
110
+ onDracoDecode?(durationMs: number, decodedBytes: number): void;
111
+ }
112
+ export interface LoadGltfOptions {
113
+ scene?: number | null;
114
+ baseColorFactor?: [number, number, number, number];
115
+ dracoDecoder?: DracoDecoderModule | Promise<DracoDecoderModule> | DracoDecoderFactory | null;
116
+ dracoDecoderConfig?: DracoDecoderConfig;
117
+ assetManager?: AssetManager | null;
118
+ assetWorker?: GltfAssetWorker | null;
119
+ signal?: AbortSignal;
120
+ onWarning?: (warning: GltfLoadWarning) => void;
121
+ diagnostics?: GltfLoadDiagnostics;
122
+ extensionAdapters?: readonly GltfExtensionAdapter[];
123
+ }
124
+ export interface GltfAssetWorker {
125
+ loadParsedAsset(src: string, options?: {
126
+ signal?: AbortSignal;
127
+ dracoDecoderConfig?: DracoDecoderConfig;
128
+ }): Promise<GltfParsedAsset>;
129
+ }
130
+ export interface GltfParsedAsset {
131
+ gltf: GltfAsset;
132
+ binaryChunk: ArrayBuffer | null;
133
+ buffers: ArrayBuffer[];
134
+ baseUrl: string;
135
+ geometryPayloads?: GltfGeometryPayloadMatrix;
136
+ metrics?: GltfParsedAssetMetrics;
137
+ }
138
+ export interface GltfParsedAssetMetrics {
139
+ readonly fetchMs: number;
140
+ readonly parseMs: number;
141
+ readonly workerParseMs: number;
142
+ readonly dracoDecodeMs: number;
143
+ readonly geometryPreparationMs: number;
144
+ readonly sourceBytes: number;
145
+ readonly workerTransferBytes: number;
146
+ readonly workerTransferBufferCount: number;
147
+ }
148
+ export declare function isGltfParsedAsset(value: unknown): value is GltfParsedAsset;
149
+ export type GltfGeometryPayloadMatrix = Array<Array<GltfPrimitiveGeometryPayload | null>>;
150
+ export interface GltfPrimitiveGeometryPayload {
151
+ positions: Float32Array;
152
+ indices?: Uint16Array | Uint32Array;
153
+ normals?: Float32Array;
154
+ textureCoordinates: Array<{
155
+ set: number;
156
+ data: Float32Array;
157
+ }>;
158
+ joints?: Uint16Array | Uint32Array;
159
+ weights?: Float32Array;
160
+ positionTargets: Float32Array[];
161
+ normalTargets: Float32Array[];
162
+ }
163
+ export interface DracoDecoderConfig {
164
+ scriptUrl?: string;
165
+ locateFile?: (path: string, prefix: string) => string;
166
+ wasmBinary?: ArrayBuffer | Uint8Array;
167
+ }
168
+ export interface DracoDecoderArray {
169
+ GetValue(index: number): number;
170
+ size(): number;
171
+ }
172
+ export interface DracoPointAttribute {
173
+ size(): number;
174
+ }
175
+ export interface DracoStatus {
176
+ ok(): boolean;
177
+ error_msg(): string;
178
+ }
179
+ export interface DracoMesh {
180
+ num_faces(): number;
181
+ num_points(): number;
182
+ }
183
+ export interface DracoDecoder {
184
+ DecodeBufferToMesh(buffer: unknown, mesh: DracoMesh): DracoStatus;
185
+ GetAttributeByUniqueId(mesh: DracoMesh, uniqueId: number): DracoPointAttribute;
186
+ GetAttributeFloatForAllPoints(mesh: DracoMesh, attribute: DracoPointAttribute, out: DracoDecoderArray): boolean;
187
+ GetAttributeUInt16ForAllPoints?(mesh: DracoMesh, attribute: DracoPointAttribute, out: DracoDecoderArray): boolean;
188
+ GetAttributeUInt32ForAllPoints?(mesh: DracoMesh, attribute: DracoPointAttribute, out: DracoDecoderArray): boolean;
189
+ GetFaceFromMesh(mesh: DracoMesh, faceIndex: number, out: DracoDecoderArray): boolean;
190
+ }
191
+ export interface DracoDecoderModule {
192
+ Decoder: new () => DracoDecoder;
193
+ DecoderBuffer: new () => {
194
+ Init(data: Uint8Array, byteLength: number): void;
195
+ };
196
+ Mesh: new () => DracoMesh;
197
+ DracoFloat32Array: new () => DracoDecoderArray;
198
+ DracoUInt16Array?: new () => DracoDecoderArray;
199
+ DracoUInt32Array?: new () => DracoDecoderArray;
200
+ DracoInt32Array: new () => DracoDecoderArray;
201
+ destroy(object: unknown): void;
202
+ }
203
+ export type DracoDecoderFactory = (config?: DracoDecoderConfig) => Promise<DracoDecoderModule> | DracoDecoderModule;
204
+ export interface DracoPrimitiveGeometry {
205
+ positions: Float32Array;
206
+ normals?: Float32Array;
207
+ textureCoordinates: Array<{
208
+ set: number;
209
+ data: Float32Array;
210
+ }>;
211
+ joints?: Uint16Array | Uint32Array;
212
+ weights?: Float32Array;
213
+ indices: Uint16Array | Uint32Array;
214
+ }
215
+ export interface GltfLoadContext {
216
+ baseUrl: string;
217
+ assetIdentity: string;
218
+ objectUrls: string[];
219
+ imageSources: Map<number, string>;
220
+ sharedImageSources: boolean;
221
+ preloadedTextures: Map<string, GPUTexture>;
222
+ animationTargets: Map<number, GltfAnimationTarget>;
223
+ skinnedPrimitives: GltfSkinnedPrimitiveRuntime[];
224
+ pendingSkinnedPrimitives: GltfPendingSkinnedPrimitive[];
225
+ assetHandles: AssetHandle<unknown>[];
226
+ geometryPayloads?: GltfGeometryPayloadMatrix;
227
+ compatibilityPrimitives: GltfPrimitiveCompatibilityInput[];
228
+ extensionAdapters: readonly GltfExtensionAdapter[];
229
+ }
230
+ export interface GltfPendingSkinnedPrimitive {
231
+ skinIndex: number;
232
+ geometry: Geometry3D;
233
+ meshEntity: Entity;
234
+ joints: Uint16Array | Uint32Array;
235
+ weights: Float32Array;
236
+ }
237
+ export interface GltfSkinnedPrimitiveRuntime {
238
+ geometry: Geometry3D;
239
+ meshEntity: Entity;
240
+ jointTargets: Array<GltfAnimationTarget | null>;
241
+ inverseBindMatrices: Float32Array[];
242
+ jointMatrices: Float32Array;
243
+ inverseMeshWorldScratch: Float32Array;
244
+ jointMatrixScratch: Float32Array;
245
+ skinMatrixScratch: Float32Array;
246
+ lastMeshWorldVersion: number;
247
+ lastGeometryVersion: number;
248
+ lastJointWorldVersions: Int32Array;
249
+ }
@@ -0,0 +1,4 @@
1
+ import { EngineError } from '@haiyue/engine';
2
+ export declare function throwIfGltfLoadAborted(signal: AbortSignal | undefined): void;
3
+ export declare function attachGltfSource(error: unknown, src: string): Error;
4
+ export declare function gltfDataError(message: string, context?: Record<string, unknown>, path?: string, cause?: unknown): EngineError;
@@ -0,0 +1,23 @@
1
+ import { type MaterialDescriptor, type MaterialTextureSource, type PbrTextureMappingOptions } from '@haiyue/engine/material';
2
+ import type { GltfAsset, GltfMaterial, GltfPrimitive } from './GltfSchema';
3
+ import { type GltfExtensionAdapter, type GltfMaterialTextureBinding } from './GltfExtensionAdapter';
4
+ export interface ResolvedGltfMaterialTexture {
5
+ readonly source: MaterialTextureSource;
6
+ readonly mapping: PbrTextureMappingOptions;
7
+ readonly sampler: GPUSamplerDescriptor | null;
8
+ }
9
+ export interface GltfMaterialDescriptorInput {
10
+ readonly gltf: GltfAsset;
11
+ readonly material: GltfMaterial | null;
12
+ readonly primitive: GltfPrimitive;
13
+ readonly materialPath: string;
14
+ readonly defaultBaseColor?: readonly [number, number, number, number];
15
+ readonly adapters: readonly GltfExtensionAdapter[];
16
+ readonly resolveTexture: (binding: GltfMaterialTextureBinding) => ResolvedGltfMaterialTexture;
17
+ }
18
+ /** Compiles glTF core material data and extension patches into one engine descriptor. */
19
+ export declare function createGltfMaterialDescriptor(input: GltfMaterialDescriptorInput): Extract<MaterialDescriptor, {
20
+ shadingModel: 'pbr-metallic-roughness';
21
+ }>;
22
+ /** Shared semantic source for preload, UV planning, and descriptor compilation. */
23
+ export declare function collectGltfMaterialTextureBindings(gltf: GltfAsset, material: GltfMaterial | null, primitive: GltfPrimitive, materialPath: string, adapters: readonly GltfExtensionAdapter[]): readonly GltfMaterialTextureBinding[];
@@ -0,0 +1,20 @@
1
+ import type { MaterialTextureSource, PbrMaterial, PbrTextureSlot } from '@haiyue/engine/material';
2
+ import type { GltfMaterial } from './GltfSchema';
3
+ export interface EncodeGltfPbrMaterialOptions {
4
+ readonly name?: string;
5
+ /**
6
+ * Resolves an engine texture source to the texture index already allocated
7
+ * by the surrounding glTF/GLB exporter.
8
+ */
9
+ readonly resolveTextureIndex: (slot: PbrTextureSlot, source: MaterialTextureSource) => number;
10
+ }
11
+ export interface EncodedGltfPbrMaterial {
12
+ readonly material: GltfMaterial;
13
+ readonly extensionsUsed: readonly string[];
14
+ }
15
+ /**
16
+ * Encodes the standard glTF material portion without taking ownership of image,
17
+ * sampler, or buffer allocation. Scene exporters can share this codec instead
18
+ * of duplicating KHR material semantics.
19
+ */
20
+ export declare function encodeGltfPbrMaterial(material: PbrMaterial, options: EncodeGltfPbrMaterialOptions): EncodedGltfPbrMaterial;
@@ -0,0 +1,6 @@
1
+ import type { PbrMaterial } from '@haiyue/engine';
2
+ import { type GltfUvSemanticPlan } from './GltfUvSemanticPlanner';
3
+ import type { GltfLoadContext, LoadGltfOptions } from './GltfLoaderContract';
4
+ import type { GltfAsset, GltfPrimitive } from './GltfSchema';
5
+ export declare function createGltfMaterial(gltf: GltfAsset, buffers: ArrayBuffer[], primitive: GltfPrimitive, options: LoadGltfOptions, context: GltfLoadContext, uvPlan: GltfUvSemanticPlan): Promise<PbrMaterial>;
6
+ export declare function preloadGltfTextures(gltf: GltfAsset, buffers: ArrayBuffer[], options: LoadGltfOptions, context: GltfLoadContext): Promise<void>;
@@ -0,0 +1,72 @@
1
+ import { Component, Entity } from '@haiyue/engine';
2
+ import type { GltfAnimationClip, GltfAnimationInfo, GltfAssetStats } from './GltfLoaderContract';
3
+ import type { GltfCompatibilityReport } from './GltfCompatibilityReport';
4
+ export interface GltfModelComponentOptions {
5
+ src?: string;
6
+ scene?: number;
7
+ autoLoad?: boolean;
8
+ clearPrevious?: boolean;
9
+ baseColorFactor?: [number, number, number, number];
10
+ }
11
+ export type GltfModelStatus = 'idle' | 'loading' | 'loaded' | 'error';
12
+ export declare class GltfModelComponent extends Component {
13
+ static UniqueCheckType: number;
14
+ static UniqueSymbol: symbol;
15
+ static editor: {
16
+ fields: {
17
+ src: {
18
+ type: string;
19
+ label: string;
20
+ assetType: string;
21
+ placeholder: string;
22
+ validate: (value: unknown) => "Source is required." | null;
23
+ };
24
+ scene: {
25
+ type: string;
26
+ label: string;
27
+ min: number;
28
+ step: number;
29
+ visibleWhen: (component: GltfModelComponent) => boolean;
30
+ };
31
+ autoLoad: {
32
+ type: string;
33
+ label: string;
34
+ };
35
+ clearPrevious: {
36
+ type: string;
37
+ label: string;
38
+ };
39
+ baseColorFactor: {
40
+ type: string;
41
+ label: string;
42
+ rows: number;
43
+ validate: (value: unknown) => "Fallback Color must be [r, g, b, a]." | null;
44
+ };
45
+ };
46
+ };
47
+ private _src;
48
+ private _scene;
49
+ private _sourceKey;
50
+ private _sourceKeyDirty;
51
+ autoLoad: boolean;
52
+ clearPrevious: boolean;
53
+ baseColorFactor: [number, number, number, number];
54
+ status: GltfModelStatus;
55
+ error: string | null;
56
+ /** Runtime root inserted by GltfModelSystem. Do not serialize. */
57
+ runtimeRoot: Entity | null;
58
+ runtimeAnimations: GltfAnimationInfo[];
59
+ runtimeAnimationClips: GltfAnimationClip[];
60
+ runtimeAssetStats: GltfAssetStats | null;
61
+ runtimeCompatibilityReport: GltfCompatibilityReport | null;
62
+ runtimeMaterialVariants: readonly string[];
63
+ runtimeSourceKey: string;
64
+ loadingSourceKey: string;
65
+ constructor(options?: GltfModelComponentOptions);
66
+ get src(): string;
67
+ set src(value: string);
68
+ get scene(): number | null;
69
+ set scene(value: number | null);
70
+ get sourceKey(): string;
71
+ clone(): GltfModelComponent;
72
+ }
@@ -0,0 +1,37 @@
1
+ import { type AssetJobPriority, type AssetManager } from '@haiyue/engine/assets';
2
+ import { System, type World } from '@haiyue/engine';
3
+ import type { DracoDecoderConfig, DracoDecoderFactory, DracoDecoderModule, GltfAssetWorker } from './GltfLoaderContract';
4
+ export interface GltfModelSystemOptions {
5
+ priority?: number;
6
+ dracoDecoder?: DracoDecoderModule | Promise<DracoDecoderModule> | DracoDecoderFactory | null;
7
+ dracoDecoderConfig?: DracoDecoderConfig;
8
+ loadTimeoutMs?: number;
9
+ assetManager?: AssetManager | null;
10
+ assetWorker?: GltfAssetWorker | null;
11
+ assetPriority?: AssetJobPriority | number;
12
+ }
13
+ export declare class GltfModelSystem extends System {
14
+ private dracoDecoder;
15
+ private dracoDecoderConfig;
16
+ private loadTimeoutMs;
17
+ private assetManager;
18
+ private assetWorker;
19
+ private assetPriority;
20
+ private readonly componentModels;
21
+ private readonly pendingLoads;
22
+ private readonly failedLoads;
23
+ private readonly liveComponents;
24
+ constructor(options?: GltfModelSystemOptions);
25
+ update(world: World, _time: number, _delta: number): this;
26
+ destroy(): this;
27
+ private loadIntoEntity;
28
+ private createPendingLoad;
29
+ private clearPendingLoad;
30
+ private abortPendingLoad;
31
+ private trackModel;
32
+ private disposeModelsForComponent;
33
+ private releaseModelsNotIn;
34
+ private abortLoadsNotIn;
35
+ private releaseFailuresNotIn;
36
+ private disposeAllModels;
37
+ }
@@ -0,0 +1,6 @@
1
+ import type { EnginePlugin } from '@haiyue/engine/core';
2
+ import { type GltfModelSystemOptions } from './GltfModelSystem';
3
+ export interface GltfPluginOptions {
4
+ system?: GltfModelSystemOptions;
5
+ }
6
+ export declare function createGltfPlugin(options?: GltfPluginOptions): EnginePlugin;
@@ -0,0 +1,225 @@
1
+ export type GltfComponentType = 5120 | 5121 | 5122 | 5123 | 5125 | 5126;
2
+ export type GltfAccessorType = 'SCALAR' | 'VEC2' | 'VEC3' | 'VEC4' | 'MAT2' | 'MAT3' | 'MAT4';
3
+ export type GltfAnimationInterpolation = 'LINEAR' | 'STEP' | 'CUBICSPLINE';
4
+ export interface GltfBuffer {
5
+ uri?: string;
6
+ byteLength?: number;
7
+ }
8
+ export interface GltfBufferView {
9
+ buffer: number;
10
+ byteOffset?: number;
11
+ byteLength: number;
12
+ byteStride?: number;
13
+ }
14
+ export interface GltfAccessor {
15
+ bufferView?: number;
16
+ byteOffset?: number;
17
+ componentType: GltfComponentType;
18
+ count: number;
19
+ type: GltfAccessorType;
20
+ normalized?: boolean;
21
+ min?: number[];
22
+ max?: number[];
23
+ sparse?: GltfAccessorSparse;
24
+ }
25
+ export interface GltfAccessorSparse {
26
+ count: number;
27
+ indices: {
28
+ bufferView: number;
29
+ byteOffset?: number;
30
+ componentType: 5121 | 5123 | 5125;
31
+ };
32
+ values: {
33
+ bufferView: number;
34
+ byteOffset?: number;
35
+ };
36
+ }
37
+ export interface GltfDracoMeshCompression {
38
+ bufferView: number;
39
+ attributes: Record<string, number>;
40
+ }
41
+ export interface GltfPrimitive {
42
+ attributes: Record<string, number>;
43
+ indices?: number;
44
+ material?: number;
45
+ mode?: number;
46
+ targets?: Array<Record<string, number>>;
47
+ extensions?: {
48
+ [extension: string]: unknown;
49
+ KHR_draco_mesh_compression?: GltfDracoMeshCompression;
50
+ KHR_materials_variants?: {
51
+ mappings: Array<{
52
+ material: number;
53
+ variants: number[];
54
+ }>;
55
+ };
56
+ };
57
+ }
58
+ export interface GltfMesh {
59
+ name?: string;
60
+ primitives: GltfPrimitive[];
61
+ weights?: number[];
62
+ }
63
+ export interface GltfNode {
64
+ name?: string;
65
+ mesh?: number;
66
+ skin?: number;
67
+ children?: number[];
68
+ matrix?: number[];
69
+ translation?: [number, number, number];
70
+ rotation?: [number, number, number, number];
71
+ scale?: [number, number, number];
72
+ }
73
+ export interface GltfScene {
74
+ nodes?: number[];
75
+ }
76
+ export interface GltfSkin {
77
+ inverseBindMatrices?: number;
78
+ joints: number[];
79
+ skeleton?: number;
80
+ name?: string;
81
+ }
82
+ export interface GltfMaterial {
83
+ name?: string;
84
+ doubleSided?: boolean;
85
+ pbrMetallicRoughness?: {
86
+ baseColorFactor?: [number, number, number, number];
87
+ baseColorTexture?: GltfTextureInfo;
88
+ metallicRoughnessTexture?: GltfTextureInfo;
89
+ metallicFactor?: number;
90
+ roughnessFactor?: number;
91
+ };
92
+ emissiveFactor?: [number, number, number];
93
+ emissiveTexture?: GltfTextureInfo;
94
+ normalTexture?: GltfTextureInfo & {
95
+ scale?: number;
96
+ };
97
+ occlusionTexture?: GltfTextureInfo & {
98
+ strength?: number;
99
+ };
100
+ alphaMode?: 'OPAQUE' | 'MASK' | 'BLEND';
101
+ alphaCutoff?: number;
102
+ extensions?: {
103
+ [extension: string]: unknown;
104
+ KHR_materials_clearcoat?: {
105
+ clearcoatFactor?: number;
106
+ clearcoatTexture?: GltfTextureInfo;
107
+ clearcoatRoughnessFactor?: number;
108
+ clearcoatRoughnessTexture?: GltfTextureInfo;
109
+ clearcoatNormalTexture?: GltfTextureInfo & {
110
+ scale?: number;
111
+ };
112
+ };
113
+ KHR_materials_anisotropy?: {
114
+ anisotropyStrength?: number;
115
+ anisotropyRotation?: number;
116
+ anisotropyTexture?: GltfTextureInfo;
117
+ };
118
+ KHR_materials_ior?: {
119
+ ior?: number;
120
+ };
121
+ KHR_materials_specular?: {
122
+ specularFactor?: number;
123
+ specularTexture?: GltfTextureInfo;
124
+ specularColorFactor?: [number, number, number];
125
+ specularColorTexture?: GltfTextureInfo;
126
+ };
127
+ KHR_materials_sheen?: {
128
+ sheenColorFactor?: [number, number, number];
129
+ sheenColorTexture?: GltfTextureInfo;
130
+ sheenRoughnessFactor?: number;
131
+ sheenRoughnessTexture?: GltfTextureInfo;
132
+ };
133
+ KHR_materials_transmission?: {
134
+ transmissionFactor?: number;
135
+ transmissionTexture?: GltfTextureInfo;
136
+ };
137
+ KHR_materials_volume?: {
138
+ thicknessFactor?: number;
139
+ thicknessTexture?: GltfTextureInfo;
140
+ attenuationDistance?: number;
141
+ attenuationColor?: [number, number, number];
142
+ };
143
+ };
144
+ }
145
+ export interface GltfTextureInfo {
146
+ index: number;
147
+ texCoord?: number;
148
+ extensions?: {
149
+ [extension: string]: unknown;
150
+ KHR_texture_transform?: GltfTextureTransform;
151
+ };
152
+ }
153
+ export interface GltfTextureTransform {
154
+ offset?: [number, number];
155
+ rotation?: number;
156
+ scale?: [number, number];
157
+ texCoord?: number;
158
+ }
159
+ export interface GltfImage {
160
+ uri?: string;
161
+ bufferView?: number;
162
+ mimeType?: string;
163
+ }
164
+ export interface GltfTexture {
165
+ sampler?: number;
166
+ source?: number;
167
+ extensions?: {
168
+ [extension: string]: unknown;
169
+ KHR_texture_basisu?: {
170
+ source: number;
171
+ };
172
+ };
173
+ }
174
+ export interface GltfSampler {
175
+ magFilter?: number;
176
+ minFilter?: number;
177
+ wrapS?: number;
178
+ wrapT?: number;
179
+ }
180
+ export interface GltfAnimation {
181
+ name?: string;
182
+ channels?: Array<{
183
+ sampler: number;
184
+ target: {
185
+ node?: number;
186
+ path?: string;
187
+ };
188
+ }>;
189
+ samplers?: Array<{
190
+ input: number;
191
+ output: number;
192
+ interpolation?: GltfAnimationInterpolation;
193
+ }>;
194
+ }
195
+ export interface GltfAsset {
196
+ asset: {
197
+ version: string;
198
+ };
199
+ extensionsUsed?: string[];
200
+ extensionsRequired?: string[];
201
+ buffers?: GltfBuffer[];
202
+ bufferViews?: GltfBufferView[];
203
+ accessors?: GltfAccessor[];
204
+ meshes?: GltfMesh[];
205
+ nodes?: GltfNode[];
206
+ scenes?: GltfScene[];
207
+ scene?: number;
208
+ skins?: GltfSkin[];
209
+ materials?: GltfMaterial[];
210
+ images?: GltfImage[];
211
+ textures?: GltfTexture[];
212
+ samplers?: GltfSampler[];
213
+ animations?: GltfAnimation[];
214
+ extensions?: {
215
+ [extension: string]: unknown;
216
+ KHR_materials_variants?: {
217
+ variants: Array<{
218
+ name: string;
219
+ }>;
220
+ };
221
+ };
222
+ }
223
+ /** Validates the untrusted JSON envelope before the loader follows references. */
224
+ export declare function isGltfAsset(value: unknown): value is GltfAsset;
225
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
@@ -0,0 +1,33 @@
1
+ import type { GltfAsset, GltfPrimitive } from './GltfSchema';
2
+ import { type GltfExtensionAdapter } from './GltfExtensionAdapter';
3
+ export declare const GLTF_UV_CHANNEL_CAPACITY: 2;
4
+ export interface GltfUvSemanticMapping {
5
+ readonly semantic: string;
6
+ readonly set: number;
7
+ readonly channel: 0 | 1;
8
+ }
9
+ export interface GltfUvSemanticPlan {
10
+ readonly meshIndex: number;
11
+ readonly primitiveIndex: number;
12
+ readonly path: string;
13
+ readonly capacity: typeof GLTF_UV_CHANNEL_CAPACITY;
14
+ readonly availableSemantics: readonly string[];
15
+ readonly referencedSemantics: readonly string[];
16
+ readonly mappings: readonly GltfUvSemanticMapping[];
17
+ }
18
+ export interface GltfUvSemanticPlanFailure {
19
+ readonly code: 'GLTF_UV_SEMANTIC_MISSING' | 'GLTF_UV_CHANNEL_CAPACITY_EXCEEDED';
20
+ readonly message: string;
21
+ readonly path: string;
22
+ readonly context: Readonly<Record<string, unknown>>;
23
+ }
24
+ export type GltfUvSemanticPlanResult = {
25
+ readonly ok: true;
26
+ readonly plan: GltfUvSemanticPlan;
27
+ } | {
28
+ readonly ok: false;
29
+ readonly failure: GltfUvSemanticPlanFailure;
30
+ };
31
+ export declare function planGltfUvSemantics(gltf: GltfAsset, primitive: GltfPrimitive, meshIndex: number, primitiveIndex: number, adapters?: readonly GltfExtensionAdapter[]): GltfUvSemanticPlanResult;
32
+ export declare function getGltfUvChannel(plan: GltfUvSemanticPlan, semanticSet: number): 0 | 1 | null;
33
+ export declare function parseTextureCoordinateSemantic(semantic: string): number | null;