@forgeax/engine-gltf 0.0.0-dev.8d955ade1c79

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 (220) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +204 -0
  3. package/dist/.tsbuildinfo +1 -0
  4. package/dist/__tests__/animation-target-errors.unit.test.d.ts +2 -0
  5. package/dist/__tests__/animation-target-errors.unit.test.d.ts.map +1 -0
  6. package/dist/__tests__/bridge-material-samplers.unit.test.d.ts +2 -0
  7. package/dist/__tests__/bridge-material-samplers.unit.test.d.ts.map +1 -0
  8. package/dist/__tests__/bridge-material-values.unit.test.d.ts +2 -0
  9. package/dist/__tests__/bridge-material-values.unit.test.d.ts.map +1 -0
  10. package/dist/__tests__/bridge-mixed-color.unit.test.d.ts +2 -0
  11. package/dist/__tests__/bridge-mixed-color.unit.test.d.ts.map +1 -0
  12. package/dist/__tests__/bridge-sampler-required.test-d.d.ts +2 -0
  13. package/dist/__tests__/bridge-sampler-required.test-d.d.ts.map +1 -0
  14. package/dist/__tests__/bridge-skin-shader-route.unit.test.d.ts +2 -0
  15. package/dist/__tests__/bridge-skin-shader-route.unit.test.d.ts.map +1 -0
  16. package/dist/__tests__/bridge-skin-stride.unit.test.d.ts +2 -0
  17. package/dist/__tests__/bridge-skin-stride.unit.test.d.ts.map +1 -0
  18. package/dist/__tests__/bridge-test-helpers.d.ts +5 -0
  19. package/dist/__tests__/bridge-test-helpers.d.ts.map +1 -0
  20. package/dist/__tests__/bridge.unit.test.d.ts +2 -0
  21. package/dist/__tests__/bridge.unit.test.d.ts.map +1 -0
  22. package/dist/__tests__/cli-gltf.integration.test.d.ts +2 -0
  23. package/dist/__tests__/cli-gltf.integration.test.d.ts.map +1 -0
  24. package/dist/__tests__/color-0-accessor.unit.test.d.ts +2 -0
  25. package/dist/__tests__/color-0-accessor.unit.test.d.ts.map +1 -0
  26. package/dist/__tests__/data-uri-surface.unit.test.d.ts +2 -0
  27. package/dist/__tests__/data-uri-surface.unit.test.d.ts.map +1 -0
  28. package/dist/__tests__/extension-admission.unit.test.d.ts +2 -0
  29. package/dist/__tests__/extension-admission.unit.test.d.ts.map +1 -0
  30. package/dist/__tests__/gltf-error-derived-views.test-d.d.ts +2 -0
  31. package/dist/__tests__/gltf-error-derived-views.test-d.d.ts.map +1 -0
  32. package/dist/__tests__/gltf-error-migration.test.d.ts +2 -0
  33. package/dist/__tests__/gltf-error-migration.test.d.ts.map +1 -0
  34. package/dist/__tests__/gltf-error-policy-owner.unit.test.d.ts +2 -0
  35. package/dist/__tests__/gltf-error-policy-owner.unit.test.d.ts.map +1 -0
  36. package/dist/__tests__/gltf-importer.test.d.ts +2 -0
  37. package/dist/__tests__/gltf-importer.test.d.ts.map +1 -0
  38. package/dist/__tests__/gltf-local-artifacts.test.d.ts +2 -0
  39. package/dist/__tests__/gltf-local-artifacts.test.d.ts.map +1 -0
  40. package/dist/__tests__/gltf.unit.test.d.ts +2 -0
  41. package/dist/__tests__/gltf.unit.test.d.ts.map +1 -0
  42. package/dist/__tests__/malformed-buffer-data-uri.integration.test.d.ts +2 -0
  43. package/dist/__tests__/malformed-buffer-data-uri.integration.test.d.ts.map +1 -0
  44. package/dist/__tests__/material-missing-uv.unit.test.d.ts +2 -0
  45. package/dist/__tests__/material-missing-uv.unit.test.d.ts.map +1 -0
  46. package/dist/__tests__/material-pack-refs.integration.test.d.ts +2 -0
  47. package/dist/__tests__/material-pack-refs.integration.test.d.ts.map +1 -0
  48. package/dist/__tests__/material-per-slot-ir.unit.test.d.ts +2 -0
  49. package/dist/__tests__/material-per-slot-ir.unit.test.d.ts.map +1 -0
  50. package/dist/__tests__/material-texture-transform.unit.test.d.ts +2 -0
  51. package/dist/__tests__/material-texture-transform.unit.test.d.ts.map +1 -0
  52. package/dist/__tests__/material-unused-uv.unit.test.d.ts +2 -0
  53. package/dist/__tests__/material-unused-uv.unit.test.d.ts.map +1 -0
  54. package/dist/__tests__/meshopt-decode.unit.test.d.ts +2 -0
  55. package/dist/__tests__/meshopt-decode.unit.test.d.ts.map +1 -0
  56. package/dist/__tests__/meshopt-falsifier.unit.test.d.ts +2 -0
  57. package/dist/__tests__/meshopt-falsifier.unit.test.d.ts.map +1 -0
  58. package/dist/__tests__/meshopt-mode-filter-owner.test-d.d.ts +2 -0
  59. package/dist/__tests__/meshopt-mode-filter-owner.test-d.d.ts.map +1 -0
  60. package/dist/__tests__/meshopt-real-matrix.integration.test.d.ts +2 -0
  61. package/dist/__tests__/meshopt-real-matrix.integration.test.d.ts.map +1 -0
  62. package/dist/__tests__/morph-import.integration.test.d.ts +2 -0
  63. package/dist/__tests__/morph-import.integration.test.d.ts.map +1 -0
  64. package/dist/__tests__/morph-import.unit.test.d.ts +2 -0
  65. package/dist/__tests__/morph-import.unit.test.d.ts.map +1 -0
  66. package/dist/__tests__/parse-decode.unit.test.d.ts +2 -0
  67. package/dist/__tests__/parse-decode.unit.test.d.ts.map +1 -0
  68. package/dist/__tests__/parse-gltf-multi-uv.test.d.ts +2 -0
  69. package/dist/__tests__/parse-gltf-multi-uv.test.d.ts.map +1 -0
  70. package/dist/__tests__/parse-gltf-skin-attrs.unit.test.d.ts +2 -0
  71. package/dist/__tests__/parse-gltf-skin-attrs.unit.test.d.ts.map +1 -0
  72. package/dist/__tests__/parse-gltf.unit.test.d.ts +2 -0
  73. package/dist/__tests__/parse-gltf.unit.test.d.ts.map +1 -0
  74. package/dist/__tests__/pick-e2e.integration.test.d.ts +2 -0
  75. package/dist/__tests__/pick-e2e.integration.test.d.ts.map +1 -0
  76. package/dist/__tests__/public-surface.unit.test.d.ts +2 -0
  77. package/dist/__tests__/public-surface.unit.test.d.ts.map +1 -0
  78. package/dist/__tests__/source-key-diagnostics.integration.test.d.ts +2 -0
  79. package/dist/__tests__/source-key-diagnostics.integration.test.d.ts.map +1 -0
  80. package/dist/__tests__/source-key-producer.integration.test.d.ts +2 -0
  81. package/dist/__tests__/source-key-producer.integration.test.d.ts.map +1 -0
  82. package/dist/__tests__/source-key.unit.test.d.ts +2 -0
  83. package/dist/__tests__/source-key.unit.test.d.ts.map +1 -0
  84. package/dist/accessor/decode-accessor.d.ts +75 -0
  85. package/dist/accessor/decode-accessor.d.ts.map +1 -0
  86. package/dist/accessor/decode-color.d.ts +15 -0
  87. package/dist/accessor/decode-color.d.ts.map +1 -0
  88. package/dist/accessor/index.d.ts +3 -0
  89. package/dist/accessor/index.d.ts.map +1 -0
  90. package/dist/bridge.d.ts +103 -0
  91. package/dist/bridge.d.ts.map +1 -0
  92. package/dist/check-extensions.d.ts +29 -0
  93. package/dist/check-extensions.d.ts.map +1 -0
  94. package/dist/cli-gltf.d.ts +8 -0
  95. package/dist/cli-gltf.d.ts.map +1 -0
  96. package/dist/cli-gltf.mjs +2435 -0
  97. package/dist/cli-gltf.mjs.map +1 -0
  98. package/dist/data-uri.d.ts +6 -0
  99. package/dist/data-uri.d.ts.map +1 -0
  100. package/dist/errors.d.ts +201 -0
  101. package/dist/errors.d.ts.map +1 -0
  102. package/dist/extract-image-bytes.d.ts +42 -0
  103. package/dist/extract-image-bytes.d.ts.map +1 -0
  104. package/dist/gltf-importer.d.ts +21 -0
  105. package/dist/gltf-importer.d.ts.map +1 -0
  106. package/dist/image-color-space.d.ts +35 -0
  107. package/dist/image-color-space.d.ts.map +1 -0
  108. package/dist/importer-entry.d.ts +10 -0
  109. package/dist/importer-entry.d.ts.map +1 -0
  110. package/dist/importer-entry.mjs +3378 -0
  111. package/dist/importer-entry.mjs.map +1 -0
  112. package/dist/index.d.ts +25 -0
  113. package/dist/index.d.ts.map +1 -0
  114. package/dist/index.mjs +3673 -0
  115. package/dist/index.mjs.map +1 -0
  116. package/dist/meshopt-decode.d.ts +39 -0
  117. package/dist/meshopt-decode.d.ts.map +1 -0
  118. package/dist/node-file-entry.d.ts +14 -0
  119. package/dist/node-file-entry.d.ts.map +1 -0
  120. package/dist/node-file-entry.mjs +1946 -0
  121. package/dist/node-file-entry.mjs.map +1 -0
  122. package/dist/node-path.d.ts +14 -0
  123. package/dist/node-path.d.ts.map +1 -0
  124. package/dist/parse-animation.d.ts +70 -0
  125. package/dist/parse-animation.d.ts.map +1 -0
  126. package/dist/parse-glb-chunks.d.ts +25 -0
  127. package/dist/parse-glb-chunks.d.ts.map +1 -0
  128. package/dist/parse-glb.d.ts +3 -0
  129. package/dist/parse-glb.d.ts.map +1 -0
  130. package/dist/parse-gltf-header.d.ts +18 -0
  131. package/dist/parse-gltf-header.d.ts.map +1 -0
  132. package/dist/parse-gltf.d.ts +263 -0
  133. package/dist/parse-gltf.d.ts.map +1 -0
  134. package/dist/parse-skin.d.ts +70 -0
  135. package/dist/parse-skin.d.ts.map +1 -0
  136. package/dist/reimport-reuse-meta.d.ts +48 -0
  137. package/dist/reimport-reuse-meta.d.ts.map +1 -0
  138. package/dist/serialize-meta.d.ts +2 -0
  139. package/dist/serialize-meta.d.ts.map +1 -0
  140. package/dist/source-key.d.ts +44 -0
  141. package/dist/source-key.d.ts.map +1 -0
  142. package/dist/sub-asset-key.d.ts +12 -0
  143. package/dist/sub-asset-key.d.ts.map +1 -0
  144. package/dist/to-asset-pack.d.ts +2 -0
  145. package/dist/to-asset-pack.d.ts.map +1 -0
  146. package/dist/transform.d.ts +37 -0
  147. package/dist/transform.d.ts.map +1 -0
  148. package/package.json +92 -0
  149. package/src/__tests__/animation-target-errors.unit.test.ts +51 -0
  150. package/src/__tests__/bridge-material-samplers.unit.test.ts +67 -0
  151. package/src/__tests__/bridge-material-values.unit.test.ts +106 -0
  152. package/src/__tests__/bridge-mixed-color.unit.test.ts +100 -0
  153. package/src/__tests__/bridge-sampler-required.test-d.ts +59 -0
  154. package/src/__tests__/bridge-skin-shader-route.unit.test.ts +42 -0
  155. package/src/__tests__/bridge-skin-stride.unit.test.ts +115 -0
  156. package/src/__tests__/bridge-test-helpers.ts +9 -0
  157. package/src/__tests__/bridge.unit.test.ts +1227 -0
  158. package/src/__tests__/cli-gltf.integration.test.ts +122 -0
  159. package/src/__tests__/color-0-accessor.unit.test.ts +174 -0
  160. package/src/__tests__/data-uri-surface.unit.test.ts +26 -0
  161. package/src/__tests__/extension-admission.unit.test.ts +19 -0
  162. package/src/__tests__/fixtures/color-0/float-vec3.gltf +13 -0
  163. package/src/__tests__/fixtures/color-0/interleaved-vec3.gltf +6 -0
  164. package/src/__tests__/fixtures/color-0/normalized-ubyte.gltf +6 -0
  165. package/src/__tests__/fixtures/color-0/normalized-ushort.gltf +6 -0
  166. package/src/__tests__/gltf-error-derived-views.test-d.ts +152 -0
  167. package/src/__tests__/gltf-error-migration.test.ts +147 -0
  168. package/src/__tests__/gltf-error-policy-owner.unit.test.ts +185 -0
  169. package/src/__tests__/gltf-importer.test.ts +12 -0
  170. package/src/__tests__/gltf-local-artifacts.test.ts +11 -0
  171. package/src/__tests__/gltf.unit.test.ts +2975 -0
  172. package/src/__tests__/malformed-buffer-data-uri.integration.test.ts +140 -0
  173. package/src/__tests__/material-missing-uv.unit.test.ts +29 -0
  174. package/src/__tests__/material-pack-refs.integration.test.ts +58 -0
  175. package/src/__tests__/material-per-slot-ir.unit.test.ts +90 -0
  176. package/src/__tests__/material-texture-transform.unit.test.ts +105 -0
  177. package/src/__tests__/material-unused-uv.unit.test.ts +44 -0
  178. package/src/__tests__/meshopt-decode.unit.test.ts +87 -0
  179. package/src/__tests__/meshopt-falsifier.unit.test.ts +92 -0
  180. package/src/__tests__/meshopt-mode-filter-owner.test-d.ts +79 -0
  181. package/src/__tests__/meshopt-real-matrix.integration.test.ts +370 -0
  182. package/src/__tests__/morph-import.integration.test.ts +115 -0
  183. package/src/__tests__/morph-import.unit.test.ts +62 -0
  184. package/src/__tests__/parse-decode.unit.test.ts +919 -0
  185. package/src/__tests__/parse-gltf-multi-uv.test.ts +238 -0
  186. package/src/__tests__/parse-gltf-skin-attrs.unit.test.ts +191 -0
  187. package/src/__tests__/parse-gltf.unit.test.ts +133 -0
  188. package/src/__tests__/pick-e2e.integration.test.ts +238 -0
  189. package/src/__tests__/public-surface.unit.test.ts +10 -0
  190. package/src/__tests__/source-key-diagnostics.integration.test.ts +140 -0
  191. package/src/__tests__/source-key-producer.integration.test.ts +171 -0
  192. package/src/__tests__/source-key.unit.test.ts +159 -0
  193. package/src/accessor/decode-accessor.ts +309 -0
  194. package/src/accessor/decode-color.ts +128 -0
  195. package/src/accessor/index.ts +15 -0
  196. package/src/bridge.ts +928 -0
  197. package/src/check-extensions.ts +85 -0
  198. package/src/cli-gltf.ts +339 -0
  199. package/src/data-uri.ts +29 -0
  200. package/src/errors.ts +386 -0
  201. package/src/extract-image-bytes.ts +343 -0
  202. package/src/gltf-importer.ts +976 -0
  203. package/src/image-color-space.ts +104 -0
  204. package/src/importer-entry.ts +24 -0
  205. package/src/index.ts +148 -0
  206. package/src/meshopt-decode.ts +200 -0
  207. package/src/node-file-entry.ts +98 -0
  208. package/src/node-path.ts +41 -0
  209. package/src/parse-animation.ts +286 -0
  210. package/src/parse-glb-chunks.ts +167 -0
  211. package/src/parse-glb.ts +16 -0
  212. package/src/parse-gltf-header.ts +58 -0
  213. package/src/parse-gltf.ts +1731 -0
  214. package/src/parse-skin.ts +238 -0
  215. package/src/reimport-reuse-meta.ts +134 -0
  216. package/src/serialize-meta.ts +24 -0
  217. package/src/source-key.ts +106 -0
  218. package/src/sub-asset-key.ts +61 -0
  219. package/src/to-asset-pack.ts +8 -0
  220. package/src/transform.ts +117 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meshopt-falsifier.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/meshopt-falsifier.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=meshopt-mode-filter-owner.test-d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meshopt-mode-filter-owner.test-d.d.ts","sourceRoot":"","sources":["../../src/__tests__/meshopt-mode-filter-owner.test-d.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=meshopt-real-matrix.integration.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meshopt-real-matrix.integration.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/meshopt-real-matrix.integration.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=morph-import.integration.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"morph-import.integration.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/morph-import.integration.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=morph-import.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"morph-import.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/morph-import.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=parse-decode.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-decode.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/parse-decode.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=parse-gltf-multi-uv.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-gltf-multi-uv.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/parse-gltf-multi-uv.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=parse-gltf-skin-attrs.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-gltf-skin-attrs.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/parse-gltf-skin-attrs.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=parse-gltf.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-gltf.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/parse-gltf.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=pick-e2e.integration.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pick-e2e.integration.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/pick-e2e.integration.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=public-surface.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-surface.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/public-surface.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=source-key-diagnostics.integration.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-key-diagnostics.integration.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/source-key-diagnostics.integration.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=source-key-producer.integration.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-key-producer.integration.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/source-key-producer.integration.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=source-key.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-key.unit.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/source-key.unit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,75 @@
1
+ import { type GltfError, type Result } from '../errors.js';
2
+ /** glTF 2.0 component-type IDs (KHR spec section 3.6 table 4). */
3
+ export declare const COMPONENT_TYPE: {
4
+ readonly I8: 5120;
5
+ readonly U8: 5121;
6
+ readonly I16: 5122;
7
+ readonly U16: 5123;
8
+ readonly U32: 5125;
9
+ readonly F32: 5126;
10
+ };
11
+ export type ComponentTypeId = (typeof COMPONENT_TYPE)[keyof typeof COMPONENT_TYPE];
12
+ /** Minimal accessor JSON shape touched by the decoder. */
13
+ export interface AccessorJson {
14
+ readonly bufferView: number;
15
+ readonly byteOffset?: number;
16
+ readonly componentType: number;
17
+ readonly count: number;
18
+ readonly normalized?: boolean;
19
+ readonly type: string;
20
+ readonly sparse?: unknown;
21
+ }
22
+ /** Minimal bufferView JSON shape touched by the decoder. */
23
+ export interface BufferViewJson {
24
+ readonly buffer: number;
25
+ readonly byteOffset?: number;
26
+ readonly byteLength: number;
27
+ readonly byteStride?: number;
28
+ }
29
+ /**
30
+ * Caller intent flag: when this accessor backs a mesh `INDICES` slot, U8
31
+ * indices auto-widen to U16 (Tier-B v1 mesh asset stores U16 only).
32
+ */
33
+ export type AccessorRole = 'attribute' | 'indices' | 'joints';
34
+ export interface DecodeAccessorInput {
35
+ readonly accessorIndex: number;
36
+ readonly accessor: AccessorJson;
37
+ readonly bufferView: BufferViewJson;
38
+ readonly buffer: Uint8Array;
39
+ readonly role: AccessorRole;
40
+ }
41
+ export type DecodedAccessor = {
42
+ readonly kind: 'f32';
43
+ readonly data: Float32Array;
44
+ } | {
45
+ readonly kind: 'u16';
46
+ readonly data: Uint16Array;
47
+ } | {
48
+ readonly kind: 'u32';
49
+ readonly data: Uint32Array;
50
+ };
51
+ type F32AccessorJson = Omit<AccessorJson, 'bufferView'> & {
52
+ readonly bufferView?: number;
53
+ };
54
+ /**
55
+ * Decode an F32 accessor for parser-owned type subsets without duplicating
56
+ * buffer lookup and dense-range handling in each parser.
57
+ */
58
+ export declare function decodeF32Accessor(accessorIndex: number, accessor: F32AccessorJson, allowedTypes: readonly string[], bufferViews: readonly BufferViewJson[], buffers: readonly Uint8Array[]): Result<Float32Array, GltfError>;
59
+ /**
60
+ * Decode a dense glTF accessor into the typed array view of its values.
61
+ * Rejects sparse / morph / interleaved / unknown-componentType variants
62
+ * with `gltf-accessor-type-mismatch`. Out-of-range byte slices return
63
+ * `gltf-buffer-out-of-bounds`.
64
+ *
65
+ * `morph` is signalled by the caller (mesh primitive iteration in
66
+ * parseGltf) by passing an accessor reached via a `targets[]` slot - the
67
+ * decoder cannot infer it from the accessor JSON alone, so this function
68
+ * surfaces the reason via the `morph` parameter when the caller has
69
+ * already detected it.
70
+ */
71
+ export declare function decodeAccessor(input: DecodeAccessorInput, flags?: {
72
+ readonly morph?: boolean;
73
+ }): Result<DecodedAccessor, GltfError>;
74
+ export {};
75
+ //# sourceMappingURL=decode-accessor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decode-accessor.d.ts","sourceRoot":"","sources":["../../src/accessor/decode-accessor.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAO,KAAK,SAAS,EAAe,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAE7E,kEAAkE;AAClE,eAAO,MAAM,cAAc;;;;;;;CAOjB,CAAC;AACX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AAuBnF,0DAA0D;AAC1D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,4DAA4D;AAC5D,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAA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,CAAC,CA2HpC"}
@@ -0,0 +1,15 @@
1
+ import { type Result } from '../errors.js';
2
+ import type { AccessorJson, BufferViewJson } from './decode-accessor.js';
3
+ export interface DecodeColorAccessorInput {
4
+ readonly accessorIndex: number;
5
+ readonly accessor: AccessorJson;
6
+ readonly bufferView: BufferViewJson;
7
+ readonly buffer: Uint8Array;
8
+ readonly bufferIndex?: number;
9
+ readonly semantic: 'COLOR_0';
10
+ }
11
+ /** Decode one dense glTF COLOR_0 accessor into linear RGBA float values. */
12
+ export declare function decodeColorAccessor(input: DecodeColorAccessorInput, flags?: {
13
+ readonly morph?: boolean;
14
+ }): Result<Float32Array, import('../errors.js').GltfError>;
15
+ //# sourceMappingURL=decode-color.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decode-color.d.ts","sourceRoot":"","sources":["../../src/accessor/decode-color.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEzE,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAC9B;AAyCD,4EAA4E;AAC5E,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,wBAAwB,EAC/B,KAAK,GAAE;IAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GACvC,MAAM,CAAC,YAAY,EAAE,OAAO,cAAc,EAAE,SAAS,CAAC,CAwExD"}
@@ -0,0 +1,3 @@
1
+ export { type AccessorJson, type AccessorRole, type BufferViewJson, COMPONENT_TYPE, type ComponentTypeId, type DecodeAccessorInput, type DecodedAccessor, decodeAccessor, decodeF32Accessor, } from './decode-accessor.js';
2
+ export { type DecodeColorAccessorInput, decodeColorAccessor, } from './decode-color.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/accessor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,cAAc,EACd,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,cAAc,EACd,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,KAAK,wBAAwB,EAC7B,mBAAmB,GACpB,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,103 @@
1
+ import type { AssetGuid, Handle, MaterialAsset, MaterialError, MeshAsset, Result, SceneAsset } from '@forgeax/engine-types';
2
+ import { type GltfError } from './errors.js';
3
+ import type { GltfDoc, GltfMaterialIr, GltfMeshIr, GltfNodeIr } from './parse-gltf.js';
4
+ /**
5
+ * Convert one or more parsed `GltfMeshIr` primitives sharing the same glTF
6
+ * mesh-index into a single runtime `MeshAsset` POD. Each primitive becomes one
7
+ * `Submesh` row; per-primitive vertex data is concatenated into one big
8
+ * interleaved vertex buffer (12 floats / vertex for unskinned meshes; 18 floats
9
+ * / vertex when any primitive carries `joints0` + `weights0`), and per-primitive
10
+ * index buffers are concatenated into one big index buffer. Each submesh's
11
+ * indices are biased by the running vertex offset so they reference vertices
12
+ * within the merged buffer.
13
+ *
14
+ * Per-MeshAsset stride decision (D-2): if any primitive contains skin
15
+ * attributes, the entire MeshAsset is promoted to 18-float stride and
16
+ * unskinned primitives' skin slots are zero-filled (joints {0,0,0,0} +
17
+ * weights {0,0,0,0}). This avoids splitting one glTF mesh into multiple
18
+ * MeshAsset rows when a model mixes skinned and unskinned primitives.
19
+ *
20
+ * AI users get a 1-to-1 mapping with `MeshRenderer.materials[]`: the i-th
21
+ * submesh is the i-th primitive of the i-th material slot.
22
+ *
23
+ * Pure function (no fs / fetch / registry). Missing attributes fall back to
24
+ * identity defaults per primitive: normal -> +Y, uv -> 0, tangent -> +X with
25
+ * w=1.
26
+ *
27
+ * Invalid source data is returned as a typed `GltfError`; callers must branch
28
+ * on `Result.ok` before publishing a MeshAsset. Caller (gltfImporter / smoke
29
+ * driver) is responsible for grouping by `meshIr.meshIndex` before calling.
30
+ */
31
+ export declare function meshIrToMeshAsset(prims: readonly GltfMeshIr[], materials?: {
32
+ readonly guidByIndex?: ReadonlyMap<number, string>;
33
+ readonly nameByIndex?: ReadonlyMap<number, string>;
34
+ readonly sourceKeyByIndex?: ReadonlyMap<number, string>;
35
+ }): Result<MeshAsset, GltfError>;
36
+ export interface GltfBridgeContext {
37
+ /** glTF mesh index -> registry MeshAsset handle (multi-submesh). */
38
+ readonly meshHandles: ReadonlyMap<number, Handle<'MeshAsset', 'shared'>>;
39
+ /** glTF material index -> registry MaterialAsset handle. */
40
+ readonly materialHandles: ReadonlyMap<number, Handle<'MaterialAsset', 'shared'>>;
41
+ /**
42
+ * glTF skin index -> SkeletonAsset GUID (string form). When a GltfNodeIr carries
43
+ * a skin reference, the bridge emits `Skin: { skeleton: <guid-string> }` on
44
+ * that node's entity; AssetRegistry._resolveSceneGuids resolves the GUID to
45
+ * a runtime Handle at instantiate time (same protocol as MeshFilter and
46
+ * MeshRenderer.materials[]). Optional — skinless glTFs pass an empty Map
47
+ * (or omit the field) and the bridge does not emit Skin.
48
+ *
49
+ * tweak-20260611 M6 / D-7: emitting Skin from the bridge means the standard
50
+ * loadByGuid<SceneAsset> + instantiate path Just Works for skinned glTF;
51
+ * demos no longer need to runtime-parseGlb + post-load patch the SceneAsset.
52
+ * postSpawnResolveJoints (called from AssetRegistry.instantiate) walks the
53
+ * matching SkinAsset.jointPaths against the spawn subtree to fill Skin.joints[].
54
+ */
55
+ readonly skeletonGuidBySkinIndex?: ReadonlyMap<number, string>;
56
+ }
57
+ /**
58
+ * Convert a parsed GltfDoc into a SceneAsset POD. Caller supplies registry
59
+ * handles via `ctx`; the bridge does no registration of its own.
60
+ *
61
+ * Visits the default scene's nodes depth-first, accumulating world-space
62
+ * transforms from parent to child (B3). Assigns sequential LocalEntityId in
63
+ * document order for reimport-stable identity. Camera nodes are detected by
64
+ * GltfNodeIr.camera (B6 fix).
65
+ *
66
+ * B1: each glTF mesh's N primitives are merged into a single entity.
67
+ * The caller provides `ctx.meshHandles` keyed by glTF mesh index, where each
68
+ * handle points to a MeshAsset whose `submeshes` already span all primitives.
69
+ * `ctx.materialHandles` is keyed by glTF material index; the bridge assembles a
70
+ * `MeshRenderer.materials[]` array from the primitives' materialIndex values
71
+ * in the order they appear in `doc.meshes`.
72
+ *
73
+ * B2: visit recursively walks `ir.children`.
74
+ *
75
+ * D-2 (empty container): transform-only nodes (no mesh, no camera) produce
76
+ * an entity with just Transform + optionally a Name component, preserving the
77
+ * hierarchy for animation/picking hooks.
78
+ */
79
+ export declare function gltfDocToSceneAsset(doc: GltfDoc, ctx: GltfBridgeContext): SceneAsset;
80
+ /** Internal helper: mark GltfNodeIr usable so future surface evolutions stay typed. */
81
+ export type _NodeIrAlias = GltfNodeIr;
82
+ export interface MaterialBridgeContext {
83
+ /** glTF texture index -> registry TextureAsset handle. */
84
+ readonly textureHandles?: ReadonlyMap<number, Handle<'TextureAsset', 'shared'>>;
85
+ /** glTF sampler index -> registry SamplerAsset handle. */
86
+ readonly samplerHandles?: ReadonlyMap<number, Handle<'SamplerAsset', 'shared'>>;
87
+ /** Built-in standard MaterialAsset GUID supplied by the importing project. */
88
+ readonly standardRootGuid?: AssetGuid;
89
+ /**
90
+ * feat-20260611 w17-a: when any primitive consuming this material carries
91
+ * JOINTS_0 + WEIGHTS_0, the cooker passes `skinned: true` so the emitted
92
+ * MaterialAsset's pass[0].program.module is `forgeax::pbr-skin` instead of
93
+ * `forgeax::default-standard-pbr`. The cooker (gltf-importer) is the only
94
+ * site with full mesh<->material wiring info; routing here keeps shader
95
+ * choice content-driven (not user-driven, per Q4 — runtime fail-fast in
96
+ * render-system-extract remains the reverse-direction safety net).
97
+ */
98
+ readonly skinned?: boolean;
99
+ }
100
+ export declare function validateMaterialUvSets(mat: GltfMaterialIr, primitive: string, availableSets: readonly number[]): Result<void, MaterialError>;
101
+ /** Convert a parsed GltfMaterialIr into a standard-root derived MaterialAsset. */
102
+ export declare function toMaterialAsset(mat: GltfMaterialIr, ctx?: MaterialBridgeContext): MaterialAsset;
103
+ //# sourceMappingURL=bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EACV,SAAS,EACT,MAAM,EAEN,aAAa,EACb,aAAa,EAEb,SAAS,EAIT,MAAM,EACN,UAAU,EAIX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAA4B,KAAK,SAAS,EAAe,MAAM,aAAa,CAAC;AACpF,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,UAAU,EACV,UAAU,EAGX,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,SAAS,GAAE;IACT,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnD,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpD,GACL,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,CA0U9B;AAED,MAAM,WAAW,iBAAiB;IAChC,oEAAoE;IACpE,QAAQ,CAAC,WAAW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Result } from './errors.js';
2
+ /** Hard-coded v1 allowlist (plan-strategy decision section 2 D-1 / D-3). */
3
+ export declare const EXTENSION_ALLOWLIST: readonly string[];
4
+ export interface ExtensionsCheckResult {
5
+ /** Names listed in extensionsUsed but not in the allowlist. */
6
+ readonly unsupportedUsed: readonly string[];
7
+ }
8
+ export interface GltfExtensionsJson {
9
+ readonly extensionsRequired?: readonly string[];
10
+ readonly extensionsUsed?: readonly string[];
11
+ }
12
+ /**
13
+ * Validate the glTF JSON's extension declarations against the v1 allowlist.
14
+ *
15
+ * Returns:
16
+ * - `Result.err(gltf-extension-unsupported)` for the FIRST entry of
17
+ * `extensionsRequired[]` that is not allowlisted (fail-fast; the
18
+ * remaining required entries are not surfaced; first wins because the
19
+ * diagnostic carries one extension name + source slot only).
20
+ * - `Result.ok({ unsupportedUsed })` otherwise; the `unsupportedUsed`
21
+ * array names every extensionsUsed entry not in the allowlist (used as
22
+ * input for `importSettings.diagnostics.unsupportedExtensions`).
23
+ * extensionsUsed entries never fail parsing and never write to stderr —
24
+ * they are informational per the glTF spec and routinely over-declared.
25
+ *
26
+ * Pure function: no fs / network / stderr.
27
+ */
28
+ export declare function checkExtensions(json: GltfExtensionsJson): Result<ExtensionsCheckResult, GltfError>;
29
+ //# sourceMappingURL=check-extensions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-extensions.d.ts","sourceRoot":"","sources":["../src/check-extensions.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAO,KAAK,SAAS,EAAe,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAE5E,4EAA4E;AAC5E,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAGhD,CAAC;AAOF,MAAM,WAAW,qBAAqB;IACpC,+DAA+D;IAC/D,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7C;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,kBAAkB,GACvB,MAAM,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAsB1C"}
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ interface AssetCtx {
3
+ readonly stdoutWrite: (line: string) => void;
4
+ readonly stderrWrite: (line: string) => void;
5
+ }
6
+ export declare function runCliGltf(rest: string[], ctx: AssetCtx): Promise<number>;
7
+ export {};
8
+ //# sourceMappingURL=cli-gltf.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-gltf.d.ts","sourceRoot":"","sources":["../src/cli-gltf.ts"],"names":[],"mappings":";AAgCA,UAAU,QAAQ;IAChB,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C;AAkCD,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAe/E"}