@forgeax/engine-gltf 0.1.23 → 0.1.24

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 (43) hide show
  1. package/README.md +56 -3
  2. package/dist/__tests__/physical-clearcoat.unit.test.d.ts +2 -0
  3. package/dist/__tests__/physical-clearcoat.unit.test.d.ts.map +1 -0
  4. package/dist/__tests__/physical-material-import.integration.test.d.ts +2 -0
  5. package/dist/__tests__/physical-material-import.integration.test.d.ts.map +1 -0
  6. package/dist/bridge.d.ts +1 -0
  7. package/dist/bridge.d.ts.map +1 -1
  8. package/dist/check-extensions.d.ts +1 -1
  9. package/dist/check-extensions.d.ts.map +1 -1
  10. package/dist/cli-gltf.mjs +181 -8
  11. package/dist/cli-gltf.mjs.map +1 -1
  12. package/dist/errors.d.ts +7 -0
  13. package/dist/errors.d.ts.map +1 -1
  14. package/dist/gltf-importer.d.ts.map +1 -1
  15. package/dist/image-color-space.d.ts +12 -0
  16. package/dist/image-color-space.d.ts.map +1 -1
  17. package/dist/importer-entry.mjs +373 -24
  18. package/dist/importer-entry.mjs.map +1 -1
  19. package/dist/index.d.ts +2 -2
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.mjs +374 -25
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/material/parse-material.d.ts +66 -0
  24. package/dist/material/parse-material.d.ts.map +1 -1
  25. package/dist/node-file-entry.mjs +181 -8
  26. package/dist/node-file-entry.mjs.map +1 -1
  27. package/package.json +12 -12
  28. package/src/__tests__/bridge-material-values.unit.test.ts +84 -1
  29. package/src/__tests__/bridge-skin-stride.unit.test.ts +22 -0
  30. package/src/__tests__/gltf-error-derived-views.test-d.ts +4 -0
  31. package/src/__tests__/gltf-error-migration.test.ts +3 -3
  32. package/src/__tests__/gltf.unit.test.ts +52 -6
  33. package/src/__tests__/material-pack-refs.integration.test.ts +53 -0
  34. package/src/__tests__/parse-gltf.unit.test.ts +29 -1
  35. package/src/__tests__/physical-clearcoat.unit.test.ts +110 -0
  36. package/src/__tests__/physical-material-import.integration.test.ts +239 -0
  37. package/src/bridge.ts +258 -13
  38. package/src/check-extensions.ts +16 -10
  39. package/src/errors.ts +21 -2
  40. package/src/gltf-importer.ts +35 -0
  41. package/src/image-color-space.ts +29 -4
  42. package/src/index.ts +8 -1
  43. package/src/material/parse-material.ts +307 -0
package/dist/errors.d.ts CHANGED
@@ -38,6 +38,12 @@ export interface GltfMaterialTransmissionInvalidDetail {
38
38
  readonly reason: 'type' | 'range' | 'non-finite' | 'blend';
39
39
  readonly actual?: unknown;
40
40
  }
41
+ export interface GltfMaterialPhysicalInvalidDetail {
42
+ readonly extension: 'KHR_materials_clearcoat' | 'KHR_materials_anisotropy' | 'KHR_materials_sheen' | 'KHR_materials_iridescence' | 'KHR_materials_specular';
43
+ readonly field: string;
44
+ readonly reason: 'type' | 'range' | 'non-finite';
45
+ readonly actual?: unknown;
46
+ }
41
47
  /** `gltf-accessor-type-mismatch` payload: 4-member closed reason discriminator. */
42
48
  export interface GltfAccessorTypeMismatchDetail {
43
49
  readonly accessorIndex: number;
@@ -200,6 +206,7 @@ interface DetailFor {
200
206
  readonly 'gltf-color-accessor-malformed': GltfColorAccessorMalformedDetail;
201
207
  readonly 'gltf-mesh-bridge-invalid': GltfMeshBridgeInvalidDetail;
202
208
  readonly 'gltf-material-transmission-invalid': GltfMaterialTransmissionInvalidDetail;
209
+ readonly 'gltf-material-physical-invalid': GltfMaterialPhysicalInvalidDetail;
203
210
  }
204
211
  /**
205
212
  * Build a fully-typed GltfError. The discriminated-union return type lets
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,mBAAmB,EACnB,GAAG,EACH,KAAK,8BAA8B,EACnC,KAAK,aAAa,EAClB,EAAE,EACF,KAAK,MAAM,GACZ,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,yBAAyB,EAAE,M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AC;IACrF,QAAQ,CAAC,gCAAgC,EAAE,iCAAiC,CAAC;CAC9E;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,aAAa,EAC7C,IAAI,EAAE,CAAC,EACP,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,SAAS,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAA;CAAE,CAAC,CAO1C"}
@@ -1 +1 @@
1
- {"version":3,"file":"gltf-importer.d.ts","sourceRoot":"","sources":["../src/gltf-importer.ts"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAEV,QAAQ,EAIR,QAAQ,EAMT,MAAM,uBAAuB,CAAC;AAiB/B,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAqB,MAAM,iBAAiB,CAAC;AAwTlF,iFAAiF;AACjF,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,cAAc,EACnB,GAAG,EAAE,OAAO,EACZ,kBAAkB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/C,kBAAkB,GAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAa,GAC1D,SAAS,QAAQ,EAAE,CAiCrB;AAonBD;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,8BAA8B,GAAG,QAAQ,CAMrF;AAED,8EAA8E;AAC9E,eAAO,MAAM,YAAY,EAAE,QAA+B,CAAC"}
1
+ {"version":3,"file":"gltf-importer.d.ts","sourceRoot":"","sources":["../src/gltf-importer.ts"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAEV,QAAQ,EAIR,QAAQ,EAMT,MAAM,uBAAuB,CAAC;AAkB/B,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAqB,MAAM,iBAAiB,CAAC;AAwTlF,iFAAiF;AACjF,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,cAAc,EACnB,GAAG,EAAE,OAAO,EACZ,kBAAkB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/C,kBAAkB,GAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAa,GAC1D,SAAS,QAAQ,EAAE,CA2CrB;AA4oBD;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,8BAA8B,GAAG,QAAQ,CAMrF;AAED,8EAA8E;AAC9E,eAAO,MAAM,YAAY,EAAE,QAA+B,CAAC"}
@@ -9,6 +9,18 @@ export interface MaterialColorSpaceInput {
9
9
  readonly normalTexture?: TextureBinding;
10
10
  readonly emissiveTexture?: TextureBinding;
11
11
  readonly occlusionTexture?: TextureBinding;
12
+ readonly transmissionTexture?: TextureBinding;
13
+ readonly thicknessTexture?: TextureBinding;
14
+ readonly clearcoatTexture?: TextureBinding;
15
+ readonly clearcoatRoughnessTexture?: TextureBinding;
16
+ readonly clearcoatNormalTexture?: TextureBinding;
17
+ readonly anisotropyTexture?: TextureBinding;
18
+ readonly sheenColorTexture?: TextureBinding;
19
+ readonly sheenRoughnessTexture?: TextureBinding;
20
+ readonly iridescenceTexture?: TextureBinding;
21
+ readonly iridescenceThicknessTexture?: TextureBinding;
22
+ readonly specularTexture?: TextureBinding;
23
+ readonly specularColorTexture?: TextureBinding;
12
24
  }
13
25
  /** Slim view of a parsed `textures[]` row. */
14
26
  export interface TextureColorSpaceInput {
@@ -1 +1 @@
1
- {"version":3,"file":"image-color-space.d.ts","sourceRoot":"","sources":["../src/image-color-space.ts"],"names":[],"mappings":"AA2BA,MAAM,MAAM,2BAA2B,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE5D,KAAK,cAAc,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5D,k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,EAAE,cAAc,CAAC;IAC3C,QAAQ,CAAC,mBAAmB,CAAC,EAAE,cAAc,CAAC;IAC9C,QAAQ,CAAC,gBAAgB,CAAC,EAAE,cAAc,CAAC;IAC3C,QAAQ,CAAC,gBAAgB,CAAC,EAAE,cAAc,CAAC;IAC3C,QAAQ,CAAC,yBAAyB,CAAC,EAAE,cAAc,CAAC;IACpD,QAAQ,CAAC,sBAAsB,CAAC,EAAE,cAAc,CAAC;IACjD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,cAAc,CAAC;IAC5C,QAAQ,CAAC,iBAAiB,CAAC,EAAE,cAAc,CAAC;IAC5C,QAAQ,CAAC,qBAAqB,CAAC,EAAE,cAAc,CAAC;IAChD,QAAQ,CAAC,kBAAkB,CAAC,EAAE,cAAc,CAAC;IAC7C,QAAQ,CAAC,2BAA2B,CAAC,EAAE,cAAc,CAAC;IACtD,QAAQ,CAAC,eAAe,CAAC,EAAE,cAAc,CAAC;IAC1C,QAAQ,CAAC,oBAAoB,CAAC,EAAE,cAAc,CAAC;CAChD;AAED,8CAA8C;AAC9C,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,SAAS,sBAAsB,EAAE,GAAG,SAAS,CAAC;IACjE,QAAQ,CAAC,SAAS,EAAE,SAAS,uBAAuB,EAAE,CAAC;CACxD;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,4BAA4B,GAClC,GAAG,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAmD1C"}
@@ -2,8 +2,8 @@ import { MeshoptDecoder } from 'meshoptimizer';
2
2
  import { deriveDefaultLodScreenCoverages } from '@forgeax/engine-import';
3
3
  import { packMeshBinV4 } from '@forgeax/engine-import/mesh-bin';
4
4
  import { AssetGuid } from '@forgeax/engine-pack/guid';
5
- import { ImportError, toShared, err, ok, reconcileMeshMaterialSlotTopology, IMPORT_ERROR_HINTS, resolveMeshMaterialSlotDefaultGuid, createMaterialError } from '@forgeax/engine-types';
6
- import { packInterleavedVertexAttributes } from '@forgeax/engine-geometry';
5
+ import { ImportError, toShared, err, ok, reconcileMeshMaterialSlotTopology, IMPORT_ERROR_HINTS, resolveMeshMaterialSlotDefaultGuid, createMaterialError, standardMaterialParameters, STANDARD_MATERIAL_PARAM_SCHEMA, STANDARD_PHYSICAL_PARAMETER_NAMES, STANDARD_TRANSMISSION_PARAMETER_NAMES, STANDARD_LAYER_PARAMETER_GROUPS } from '@forgeax/engine-types';
6
+ import { computeTangentVec4, packInterleavedVertexAttributes } from '@forgeax/engine-geometry';
7
7
  import { box3, mat4, vec3, quat } from '@forgeax/engine-math';
8
8
  import { deriveAnimationTargetId } from '@forgeax/engine-animation/target-id';
9
9
 
@@ -24,8 +24,8 @@ var gltfErrorPolicy = {
24
24
  hint: "rebuild .gltf with valid bufferViews; check accessor index; ensure accessor.byteOffset + EFFECTIVE_STRIDE * (count - 1) + element_size <= bufferView.byteLength"
25
25
  },
26
26
  "gltf-extension-unsupported": {
27
- expected: "extension listed in v1 allowlist (see EXTENSION_ALLOWLIST in @forgeax/engine-gltf)",
28
- hint: "see feat-future-gltf-extensions-allowlist; remove this extension or wait for the allowlist to expand"
27
+ expected: "extension listed in the supported allowlist (see EXTENSION_ALLOWLIST in @forgeax/engine-gltf)",
28
+ hint: "remove the unsupported required extension or use a supported glTF extension; extensionsUsed-only entries remain diagnostic"
29
29
  },
30
30
  "gltf-lod-invalid": {
31
31
  expected: "MSFT_lod ids to reference unique existing node indices with valid coverage",
@@ -35,6 +35,10 @@ var gltfErrorPolicy = {
35
35
  expected: "KHR transmission, IOR, and volume values are finite and within their glTF ranges",
36
36
  hint: "repair the named glTF material extension value and re-import the source"
37
37
  },
38
+ "gltf-material-physical-invalid": {
39
+ expected: "KHR clearcoat, anisotropy, sheen, iridescence, and specular values are finite and within their glTF ranges",
40
+ hint: "repair the named physical material extension value and re-import the source"
41
+ },
38
42
  "gltf-accessor-type-mismatch": {
39
43
  expected: "dense fixed-stride accessor with supported componentType",
40
44
  hint: "sparse: see feat-future-gltf-sparse-accessor; morph: see feat-future-gltf-morph; interleaved: see feat-future-gltf-mesh-multi-section"
@@ -218,6 +222,16 @@ function meshIrToMeshAsset(prims, materials = {}) {
218
222
  const materialSlot = slotFor(mesh.materialIndex);
219
223
  const primVertexCount = mesh.positions.length / 3;
220
224
  const primIndexCount = mesh.indices === void 0 ? 0 : mesh.indices.length;
225
+ let generatedTangents;
226
+ if (mesh.tangents === void 0 && mesh.normals !== void 0 && mesh.texcoord0 !== void 0) {
227
+ const generated = computeTangentVec4(
228
+ mesh.positions,
229
+ mesh.normals,
230
+ mesh.texcoord0,
231
+ mesh.indices
232
+ );
233
+ if (generated.ok) generatedTangents = generated.value;
234
+ }
221
235
  if (mesh.colors0 !== void 0 && mesh.colors0.length !== primVertexCount * 4) {
222
236
  return err(
223
237
  gltfErr("gltf-mesh-bridge-invalid", {
@@ -249,12 +263,13 @@ function meshIrToMeshAsset(prims, materials = {}) {
249
263
  uvsCat[(vertexCursor + i) * 2 + 0] = mesh.texcoord0[t + 0];
250
264
  uvsCat[(vertexCursor + i) * 2 + 1] = mesh.texcoord0[t + 1];
251
265
  }
252
- if (mesh.tangents !== void 0) {
266
+ const sourceTangents = mesh.tangents ?? generatedTangents;
267
+ if (sourceTangents !== void 0) {
253
268
  const g = i * 4;
254
- tangentsCat[(vertexCursor + i) * 4 + 0] = mesh.tangents[g + 0];
255
- tangentsCat[(vertexCursor + i) * 4 + 1] = mesh.tangents[g + 1];
256
- tangentsCat[(vertexCursor + i) * 4 + 2] = mesh.tangents[g + 2];
257
- tangentsCat[(vertexCursor + i) * 4 + 3] = mesh.tangents[g + 3];
269
+ tangentsCat[(vertexCursor + i) * 4 + 0] = sourceTangents[g + 0];
270
+ tangentsCat[(vertexCursor + i) * 4 + 1] = sourceTangents[g + 1];
271
+ tangentsCat[(vertexCursor + i) * 4 + 2] = sourceTangents[g + 2];
272
+ tangentsCat[(vertexCursor + i) * 4 + 3] = sourceTangents[g + 3];
258
273
  } else {
259
274
  tangentsCat[(vertexCursor + i) * 4 + 0] = 1;
260
275
  tangentsCat[(vertexCursor + i) * 4 + 3] = 1;
@@ -589,6 +604,12 @@ function textureValue(info, slot, ctx) {
589
604
  return { ...value, normalScale: normal.scale };
590
605
  }
591
606
  }
607
+ if (slot === "clearcoatNormalTexture") {
608
+ const normal = info;
609
+ if (typeof normal === "object" && normal?.scale !== void 0) {
610
+ return { ...value, normalScale: normal.scale };
611
+ }
612
+ }
592
613
  if (slot === "occlusionTexture") {
593
614
  const occlusion = info;
594
615
  if (typeof occlusion === "object" && occlusion?.strength !== void 0) {
@@ -597,6 +618,47 @@ function textureValue(info, slot, ctx) {
597
618
  }
598
619
  return value;
599
620
  }
621
+ function standardRootParameterNames(mat) {
622
+ const names = new Set(
623
+ STANDARD_MATERIAL_PARAM_SCHEMA.filter(
624
+ (entry) => !STANDARD_PHYSICAL_PARAMETER_NAMES.has(entry.name) && !STANDARD_TRANSMISSION_PARAMETER_NAMES.has(entry.name)
625
+ ).map((entry) => entry.name)
626
+ );
627
+ names.add("ior");
628
+ const addLayer = (layer) => {
629
+ for (const name of STANDARD_LAYER_PARAMETER_GROUPS[layer]) names.add(name);
630
+ };
631
+ const addTexture = (name, info) => {
632
+ if (info !== void 0) names.add(name);
633
+ };
634
+ const clearcoat = mat.clearcoatFactor !== void 0 || mat.clearcoatRoughnessFactor !== void 0 || mat.clearcoatNormalTexture !== void 0 || mat.clearcoatTexture !== void 0 || mat.clearcoatRoughnessTexture !== void 0;
635
+ const anisotropy = mat.anisotropyStrength !== void 0 || mat.anisotropyRotation !== void 0 || mat.anisotropyTexture !== void 0;
636
+ const sheen = mat.sheenColorFactor !== void 0 || mat.sheenRoughnessFactor !== void 0 || mat.sheenColorTexture !== void 0 || mat.sheenRoughnessTexture !== void 0;
637
+ const iridescence = mat.iridescenceFactor !== void 0 || mat.iridescenceIor !== void 0 || mat.iridescenceThicknessMinimum !== void 0 || mat.iridescenceThicknessMaximum !== void 0 || mat.iridescenceTexture !== void 0 || mat.iridescenceThicknessTexture !== void 0;
638
+ if (clearcoat) addLayer("clearcoat");
639
+ if (anisotropy) addLayer("anisotropy");
640
+ if (sheen) addLayer("sheen");
641
+ if (iridescence) addLayer("iridescence");
642
+ if (clearcoat && mat.clearcoatNormalTexture !== void 0) names.add("clearcoatNormalScale");
643
+ addTexture("clearcoatTexture", mat.clearcoatTexture);
644
+ addTexture("clearcoatRoughnessTexture", mat.clearcoatRoughnessTexture);
645
+ addTexture("clearcoatNormalTexture", mat.clearcoatNormalTexture);
646
+ addTexture("anisotropyTexture", mat.anisotropyTexture);
647
+ addTexture("sheenColorTexture", mat.sheenColorTexture);
648
+ addTexture("sheenRoughnessTexture", mat.sheenRoughnessTexture);
649
+ addTexture("iridescenceTexture", mat.iridescenceTexture);
650
+ addTexture("iridescenceThicknessTexture", mat.iridescenceThicknessTexture);
651
+ addTexture("specularTexture", mat.specularTexture);
652
+ addTexture("specularColorTexture", mat.specularColorTexture);
653
+ const transmission = mat.transmissionFactor !== void 0 || mat.transmissionTexture !== void 0 || mat.ior !== void 0 || mat.thicknessFactor !== void 0 || mat.thicknessTexture !== void 0 || mat.attenuationColor !== void 0 || mat.attenuationDistance !== void 0;
654
+ if (transmission) {
655
+ for (const name of STANDARD_TRANSMISSION_PARAMETER_NAMES) names.add(name);
656
+ }
657
+ return {
658
+ names,
659
+ extended: clearcoat || anisotropy || sheen || iridescence || transmission || mat.specularTexture !== void 0 || mat.specularColorTexture !== void 0
660
+ };
661
+ }
600
662
  function validateMaterialUvSets(mat, primitive, availableSets) {
601
663
  const available = new Set(availableSets);
602
664
  const slots = [
@@ -606,7 +668,17 @@ function validateMaterialUvSets(mat, primitive, availableSets) {
606
668
  ["occlusionTexture", mat.occlusionTexture],
607
669
  ["emissiveTexture", mat.emissiveTexture],
608
670
  ["transmissionTexture", mat.transmissionTexture],
609
- ["thicknessTexture", mat.thicknessTexture]
671
+ ["thicknessTexture", mat.thicknessTexture],
672
+ ["clearcoatTexture", mat.clearcoatTexture],
673
+ ["clearcoatRoughnessTexture", mat.clearcoatRoughnessTexture],
674
+ ["clearcoatNormalTexture", mat.clearcoatNormalTexture],
675
+ ["anisotropyTexture", mat.anisotropyTexture],
676
+ ["sheenColorTexture", mat.sheenColorTexture],
677
+ ["sheenRoughnessTexture", mat.sheenRoughnessTexture],
678
+ ["iridescenceTexture", mat.iridescenceTexture],
679
+ ["iridescenceThicknessTexture", mat.iridescenceThicknessTexture],
680
+ ["specularTexture", mat.specularTexture],
681
+ ["specularColorTexture", mat.specularColorTexture]
610
682
  ];
611
683
  for (const [slot, rawBinding] of slots) {
612
684
  const binding = textureInfo(rawBinding);
@@ -626,7 +698,44 @@ function validateMaterialUvSets(mat, primitive, availableSets) {
626
698
  }
627
699
  return ok(void 0);
628
700
  }
701
+ function validateMaterialTangentInputs(mat, mesh, layer = "clearcoat") {
702
+ const anisotropyDeclared = mat.anisotropyStrength !== void 0 || mat.anisotropyRotation !== void 0 || mat.anisotropyTexture !== void 0;
703
+ const tangentSlot = anisotropyDeclared ? { layer: "anisotropy", info: mat.anisotropyTexture } : mat.clearcoatNormalTexture !== void 0 ? { layer: "clearcoat", info: mat.clearcoatNormalTexture } : void 0;
704
+ if (tangentSlot === void 0) return ok(void 0);
705
+ const selected = textureInfo(tangentSlot.info);
706
+ const uvSet = selected?.texCoord ?? 0;
707
+ const uv = mesh[`texcoord${uvSet === 0 ? "0" : uvSet}`];
708
+ const attributes = ["NORMAL", `TEXCOORD_${uvSet}`, "TANGENT"];
709
+ const fail = (reason) => err(
710
+ createMaterialError("material-tangent-required", {
711
+ code: "material-tangent-required",
712
+ material: mat.name ?? "<unnamed>",
713
+ mesh: mesh.name ?? "<unnamed>",
714
+ layer: tangentSlot.layer ?? layer,
715
+ uv: `TEXCOORD_${uvSet}`,
716
+ attributes,
717
+ reason
718
+ })
719
+ );
720
+ if (mesh.tangents !== void 0) {
721
+ if (mesh.tangents.length !== mesh.positions.length / 3 * 4 || mesh.tangents.some((value) => !Number.isFinite(value))) {
722
+ return fail("imported TANGENT must be finite vec4 per vertex");
723
+ }
724
+ return ok(void 0);
725
+ }
726
+ if (mesh.normals === void 0) return fail("NORMAL is required to generate tangent");
727
+ if (!(uv instanceof Float32Array))
728
+ return fail("the selected UV set is required to generate tangent");
729
+ const generated = computeTangentVec4(mesh.positions, mesh.normals, uv, mesh.indices);
730
+ if (!generated.ok) {
731
+ const detail = generated.error.detail;
732
+ const reason = detail !== void 0 && "reason" in detail ? String(detail.reason) : "tangent producer rejected topology";
733
+ return fail(reason);
734
+ }
735
+ return ok(void 0);
736
+ }
629
737
  function toMaterialAsset(mat, ctx) {
738
+ const rootContract = standardRootParameterNames(mat);
630
739
  const values = {
631
740
  baseColor: mat.baseColorFactor,
632
741
  metallic: mat.metallicFactor,
@@ -643,7 +752,17 @@ function toMaterialAsset(mat, ctx) {
643
752
  ["occlusionTexture", mat.occlusionTexture],
644
753
  ["emissiveTexture", mat.emissiveTexture],
645
754
  ["transmissionTexture", mat.transmissionTexture],
646
- ["thicknessTexture", mat.thicknessTexture]
755
+ ["thicknessTexture", mat.thicknessTexture],
756
+ ["clearcoatTexture", mat.clearcoatTexture],
757
+ ["clearcoatRoughnessTexture", mat.clearcoatRoughnessTexture],
758
+ ["clearcoatNormalTexture", mat.clearcoatNormalTexture],
759
+ ["anisotropyTexture", mat.anisotropyTexture],
760
+ ["sheenColorTexture", mat.sheenColorTexture],
761
+ ["sheenRoughnessTexture", mat.sheenRoughnessTexture],
762
+ ["iridescenceTexture", mat.iridescenceTexture],
763
+ ["iridescenceThicknessTexture", mat.iridescenceThicknessTexture],
764
+ ["specularTexture", mat.specularTexture],
765
+ ["specularColorTexture", mat.specularColorTexture]
647
766
  ];
648
767
  for (const [slot, info] of textureSlots) {
649
768
  const value = textureValue(info, slot, ctx);
@@ -652,11 +771,35 @@ function toMaterialAsset(mat, ctx) {
652
771
  if (mat.occlusionTexture !== void 0 && values.occlusionStrength === void 0) {
653
772
  values.occlusionStrength = 1;
654
773
  }
655
- if (mat.transmissionFactor !== void 0) values.transmission = mat.transmissionFactor;
656
- if (mat.ior !== void 0) values.ior = mat.ior;
657
- if (mat.thicknessFactor !== void 0) values.thickness = mat.thicknessFactor;
658
- if (mat.attenuationColor !== void 0) values.attenuationColor = mat.attenuationColor;
659
- if (mat.attenuationDistance !== void 0) values.attenuationDistance = mat.attenuationDistance;
774
+ if (rootContract.extended && rootContract.names.has("transmission")) {
775
+ values.transmission = mat.transmissionFactor ?? 0;
776
+ values.ior = mat.ior ?? 1.5;
777
+ values.thickness = mat.thicknessFactor ?? 0;
778
+ values.attenuationColor = mat.attenuationColor ?? [1, 1, 1];
779
+ if (mat.attenuationDistance !== void 0) values.attenuationDistance = mat.attenuationDistance;
780
+ }
781
+ if (rootContract.names.has("clearcoat")) {
782
+ values.clearcoat = mat.clearcoatFactor ?? 0;
783
+ values.clearcoatRoughness = mat.clearcoatRoughnessFactor ?? 0;
784
+ }
785
+ const clearcoatNormal = textureInfo(mat.clearcoatNormalTexture);
786
+ if (clearcoatNormal?.scale !== void 0) values.clearcoatNormalScale = clearcoatNormal.scale;
787
+ if (rootContract.names.has("anisotropyStrength")) {
788
+ values.anisotropyStrength = mat.anisotropyStrength ?? 0;
789
+ values.anisotropyRotation = mat.anisotropyRotation ?? 0;
790
+ }
791
+ if (rootContract.names.has("sheenColor")) {
792
+ values.sheenColor = mat.sheenColorFactor ?? [0, 0, 0];
793
+ values.sheenRoughness = mat.sheenRoughnessFactor ?? 0;
794
+ }
795
+ if (rootContract.names.has("iridescence")) {
796
+ values.iridescence = mat.iridescenceFactor ?? 0;
797
+ values.iridescenceIor = mat.iridescenceIor ?? 1.3;
798
+ values.iridescenceThicknessMinimum = mat.iridescenceThicknessMinimum ?? 100;
799
+ values.iridescenceThicknessMaximum = mat.iridescenceThicknessMaximum ?? 400;
800
+ }
801
+ if (mat.specularFactor !== void 0) values.specular = mat.specularFactor;
802
+ if (mat.specularColorFactor !== void 0) values.specularColor = mat.specularColorFactor;
660
803
  const module = ctx?.skinned === true ? "forgeax::pbr-skin" : "forgeax::default-standard-pbr";
661
804
  const isMask = mat.alphaMode === "MASK";
662
805
  const alphaCutoff = isMask ? mat.alphaCutoff ?? 0.5 : void 0;
@@ -689,8 +832,9 @@ function toMaterialAsset(mat, ctx) {
689
832
  return {
690
833
  kind: "material",
691
834
  colorSpace: "linear",
692
- ...ctx?.standardRootGuid === void 0 ? {} : { parent: ctx.standardRootGuid },
835
+ ...!rootContract.extended && ctx?.standardRootGuid !== void 0 ? { parent: ctx.standardRootGuid } : {},
693
836
  passes: [pass],
837
+ ...ctx?.standardRootGuid !== void 0 && !rootContract.extended ? {} : { parameters: standardMaterialParameters(rootContract.names) },
694
838
  values
695
839
  };
696
840
  }
@@ -1109,9 +1253,21 @@ function deriveTextureColorSpace(input) {
1109
1253
  for (const mat of input.materials) {
1110
1254
  record(imageOfTexture(mat.baseColorTexture), "srgb");
1111
1255
  record(imageOfTexture(mat.emissiveTexture), "srgb");
1256
+ record(imageOfTexture(mat.sheenColorTexture), "srgb");
1257
+ record(imageOfTexture(mat.specularColorTexture), "srgb");
1112
1258
  record(imageOfTexture(mat.metallicRoughnessTexture), "linear");
1113
1259
  record(imageOfTexture(mat.normalTexture), "linear");
1114
1260
  record(imageOfTexture(mat.occlusionTexture), "linear");
1261
+ record(imageOfTexture(mat.transmissionTexture), "linear");
1262
+ record(imageOfTexture(mat.thicknessTexture), "linear");
1263
+ record(imageOfTexture(mat.clearcoatTexture), "linear");
1264
+ record(imageOfTexture(mat.clearcoatRoughnessTexture), "linear");
1265
+ record(imageOfTexture(mat.clearcoatNormalTexture), "linear");
1266
+ record(imageOfTexture(mat.anisotropyTexture), "linear");
1267
+ record(imageOfTexture(mat.sheenRoughnessTexture), "linear");
1268
+ record(imageOfTexture(mat.iridescenceTexture), "linear");
1269
+ record(imageOfTexture(mat.iridescenceThicknessTexture), "linear");
1270
+ record(imageOfTexture(mat.specularTexture), "linear");
1115
1271
  }
1116
1272
  for (let i = 0; i < input.imageCount; i++) {
1117
1273
  if (!result.has(i)) {
@@ -1400,16 +1556,21 @@ function decodeColorAccessor(input, flags = {}) {
1400
1556
  var EXTENSION_ALLOWLIST = [
1401
1557
  "EXT_mesh_gpu_instancing",
1402
1558
  "EXT_meshopt_compression",
1403
- "MSFT_lod",
1404
- "MSFT_screencoverage"
1405
- ];
1406
- var SUPPORTED_EXTENSIONS = [
1407
- ...EXTENSION_ALLOWLIST,
1408
1559
  "KHR_lights_punctual",
1409
1560
  "KHR_texture_transform",
1410
1561
  "KHR_materials_transmission",
1411
1562
  "KHR_materials_ior",
1412
- "KHR_materials_volume"
1563
+ "KHR_materials_volume",
1564
+ "KHR_materials_clearcoat",
1565
+ "KHR_materials_anisotropy",
1566
+ "KHR_materials_sheen",
1567
+ "KHR_materials_iridescence",
1568
+ "KHR_materials_specular"
1569
+ ];
1570
+ var SUPPORTED_EXTENSIONS = [
1571
+ ...EXTENSION_ALLOWLIST,
1572
+ "MSFT_lod",
1573
+ "MSFT_screencoverage"
1413
1574
  ];
1414
1575
  function checkExtensions(json) {
1415
1576
  const required = json.extensionsRequired ?? [];
@@ -1552,6 +1713,11 @@ function parseMaterial(matJson, textures) {
1552
1713
  const transmission = matJson.extensions?.KHR_materials_transmission;
1553
1714
  const ior = matJson.extensions?.KHR_materials_ior;
1554
1715
  const volume = matJson.extensions?.KHR_materials_volume;
1716
+ const clearcoat = matJson.extensions?.KHR_materials_clearcoat;
1717
+ const anisotropy = matJson.extensions?.KHR_materials_anisotropy;
1718
+ const sheen = matJson.extensions?.KHR_materials_sheen;
1719
+ const iridescence = matJson.extensions?.KHR_materials_iridescence;
1720
+ const specular = matJson.extensions?.KHR_materials_specular;
1555
1721
  const attenuationColor = tuple3(volume?.attenuationColor);
1556
1722
  const invalid = (extension, field, reason, actual) => err(
1557
1723
  gltfErr("gltf-material-transmission-invalid", {
@@ -1561,6 +1727,14 @@ function parseMaterial(matJson, textures) {
1561
1727
  ...actual === void 0 ? {} : { actual }
1562
1728
  })
1563
1729
  );
1730
+ const physicalInvalid = (extension, field, reason, actual) => err(
1731
+ gltfErr("gltf-material-physical-invalid", {
1732
+ extension,
1733
+ field,
1734
+ reason,
1735
+ ...actual === void 0 ? {} : { actual }
1736
+ })
1737
+ );
1564
1738
  if (transmission?.transmissionFactor !== void 0 && (typeof transmission.transmissionFactor !== "number" || !Number.isFinite(transmission.transmissionFactor))) {
1565
1739
  return invalid(
1566
1740
  "KHR_materials_transmission",
@@ -1611,6 +1785,98 @@ function parseMaterial(matJson, textures) {
1611
1785
  if (alphaMode === "BLEND" && (transmission?.transmissionFactor ?? 0) > 0) {
1612
1786
  return invalid("KHR_materials_transmission", "alphaMode", "blend", alphaMode);
1613
1787
  }
1788
+ if (clearcoat?.clearcoatFactor !== void 0 && (typeof clearcoat.clearcoatFactor !== "number" || !Number.isFinite(clearcoat.clearcoatFactor))) {
1789
+ return physicalInvalid(
1790
+ "KHR_materials_clearcoat",
1791
+ "clearcoatFactor",
1792
+ "non-finite",
1793
+ clearcoat.clearcoatFactor
1794
+ );
1795
+ }
1796
+ if (clearcoat?.clearcoatFactor !== void 0 && (clearcoat.clearcoatFactor < 0 || clearcoat.clearcoatFactor > 1)) {
1797
+ return physicalInvalid(
1798
+ "KHR_materials_clearcoat",
1799
+ "clearcoatFactor",
1800
+ "range",
1801
+ clearcoat.clearcoatFactor
1802
+ );
1803
+ }
1804
+ if (clearcoat?.clearcoatRoughnessFactor !== void 0 && (typeof clearcoat.clearcoatRoughnessFactor !== "number" || !Number.isFinite(clearcoat.clearcoatRoughnessFactor))) {
1805
+ return physicalInvalid(
1806
+ "KHR_materials_clearcoat",
1807
+ "clearcoatRoughnessFactor",
1808
+ "non-finite",
1809
+ clearcoat.clearcoatRoughnessFactor
1810
+ );
1811
+ }
1812
+ if (clearcoat?.clearcoatRoughnessFactor !== void 0 && (clearcoat.clearcoatRoughnessFactor < 0 || clearcoat.clearcoatRoughnessFactor > 1)) {
1813
+ return physicalInvalid(
1814
+ "KHR_materials_clearcoat",
1815
+ "clearcoatRoughnessFactor",
1816
+ "range",
1817
+ clearcoat.clearcoatRoughnessFactor
1818
+ );
1819
+ }
1820
+ if (clearcoat?.clearcoatNormalTexture?.scale !== void 0 && (typeof clearcoat.clearcoatNormalTexture.scale !== "number" || !Number.isFinite(clearcoat.clearcoatNormalTexture.scale) || clearcoat.clearcoatNormalTexture.scale < 0)) {
1821
+ return physicalInvalid(
1822
+ "KHR_materials_clearcoat",
1823
+ "clearcoatNormalTexture.scale",
1824
+ "range",
1825
+ clearcoat.clearcoatNormalTexture.scale
1826
+ );
1827
+ }
1828
+ const validateUnit = (extension, field, value) => {
1829
+ if (value === void 0) return void 0;
1830
+ if (typeof value !== "number" || !Number.isFinite(value))
1831
+ return physicalInvalid(extension, field, "non-finite", value);
1832
+ if (value < 0 || value > 1) return physicalInvalid(extension, field, "range", value);
1833
+ return void 0;
1834
+ };
1835
+ const validateFinite = (extension, field, value, minimum) => {
1836
+ if (value === void 0) return void 0;
1837
+ if (typeof value !== "number" || !Number.isFinite(value))
1838
+ return physicalInvalid(extension, field, "non-finite", value);
1839
+ if (minimum !== void 0 && value < minimum)
1840
+ return physicalInvalid(extension, field, "range", value);
1841
+ return void 0;
1842
+ };
1843
+ const validateColor = (extension, field, value) => {
1844
+ if (value === void 0) return void 0;
1845
+ if (value.length < 3 || value.slice(0, 3).some((channel) => typeof channel !== "number" || !Number.isFinite(channel))) {
1846
+ return physicalInvalid(extension, field, "type", value);
1847
+ }
1848
+ if (value.slice(0, 3).some((channel) => channel < 0 || channel > 1)) {
1849
+ return physicalInvalid(extension, field, "range", value);
1850
+ }
1851
+ return void 0;
1852
+ };
1853
+ const physicalChecks = [
1854
+ validateUnit("KHR_materials_anisotropy", "anisotropyStrength", anisotropy?.anisotropyStrength),
1855
+ validateFinite(
1856
+ "KHR_materials_anisotropy",
1857
+ "anisotropyRotation",
1858
+ anisotropy?.anisotropyRotation
1859
+ ),
1860
+ validateUnit("KHR_materials_sheen", "sheenRoughnessFactor", sheen?.sheenRoughnessFactor),
1861
+ validateColor("KHR_materials_sheen", "sheenColorFactor", sheen?.sheenColorFactor),
1862
+ validateUnit("KHR_materials_iridescence", "iridescenceFactor", iridescence?.iridescenceFactor),
1863
+ validateFinite("KHR_materials_iridescence", "iridescenceIor", iridescence?.iridescenceIor, 1),
1864
+ validateFinite(
1865
+ "KHR_materials_iridescence",
1866
+ "iridescenceThicknessMinimum",
1867
+ iridescence?.iridescenceThicknessMinimum,
1868
+ 0
1869
+ ),
1870
+ validateFinite(
1871
+ "KHR_materials_iridescence",
1872
+ "iridescenceThicknessMaximum",
1873
+ iridescence?.iridescenceThicknessMaximum,
1874
+ 0
1875
+ ),
1876
+ validateUnit("KHR_materials_specular", "specularFactor", specular?.specularFactor),
1877
+ validateColor("KHR_materials_specular", "specularColorFactor", specular?.specularColorFactor)
1878
+ ];
1879
+ for (const check of physicalChecks) if (check !== void 0) return check;
1614
1880
  return ok({
1615
1881
  ...matJson.name === void 0 ? {} : { name: matJson.name },
1616
1882
  baseColorFactor: baseColor4,
@@ -1647,6 +1913,65 @@ function parseMaterial(matJson, textures) {
1647
1913
  ...attenuationColor === void 0 ? {} : { attenuationColor },
1648
1914
  ...finiteOrUndefined(volume.attenuationDistance) === void 0 ? {} : { attenuationDistance: volume.attenuationDistance }
1649
1915
  },
1916
+ ...clearcoat === void 0 ? {} : {
1917
+ clearcoatFactor: clearcoat.clearcoatFactor ?? 0,
1918
+ clearcoatChannel: 0,
1919
+ clearcoatRoughnessFactor: clearcoat.clearcoatRoughnessFactor ?? 0,
1920
+ clearcoatRoughnessChannel: 1,
1921
+ clearcoatNormalChannel: [0, 1],
1922
+ ...clearcoat.clearcoatTexture === void 0 ? {} : { clearcoatTexture: parseTextureInfo(clearcoat.clearcoatTexture, textures) },
1923
+ ...clearcoat.clearcoatRoughnessTexture === void 0 ? {} : {
1924
+ clearcoatRoughnessTexture: parseTextureInfo(
1925
+ clearcoat.clearcoatRoughnessTexture,
1926
+ textures
1927
+ )
1928
+ },
1929
+ ...clearcoat.clearcoatNormalTexture === void 0 ? {} : {
1930
+ clearcoatNormalTexture: {
1931
+ ...parseTextureInfo(clearcoat.clearcoatNormalTexture, textures),
1932
+ ...clearcoat.clearcoatNormalTexture.scale === void 0 ? {} : { scale: clearcoat.clearcoatNormalTexture.scale }
1933
+ }
1934
+ }
1935
+ },
1936
+ ...anisotropy === void 0 ? {} : {
1937
+ anisotropyStrength: anisotropy.anisotropyStrength ?? 0,
1938
+ anisotropyRotation: anisotropy.anisotropyRotation ?? 0,
1939
+ anisotropyChannel: [0, 1, 2],
1940
+ ...anisotropy.anisotropyTexture === void 0 ? {} : { anisotropyTexture: parseTextureInfo(anisotropy.anisotropyTexture, textures) }
1941
+ },
1942
+ ...sheen === void 0 ? {} : {
1943
+ sheenColorFactor: tuple3(sheen.sheenColorFactor) ?? [0, 0, 0],
1944
+ sheenColorChannel: [0, 1, 2],
1945
+ sheenRoughnessFactor: sheen.sheenRoughnessFactor ?? 0,
1946
+ sheenRoughnessChannel: 3,
1947
+ ...sheen.sheenColorTexture === void 0 ? {} : { sheenColorTexture: parseTextureInfo(sheen.sheenColorTexture, textures) },
1948
+ ...sheen.sheenRoughnessTexture === void 0 ? {} : { sheenRoughnessTexture: parseTextureInfo(sheen.sheenRoughnessTexture, textures) }
1949
+ },
1950
+ ...iridescence === void 0 ? {} : {
1951
+ iridescenceFactor: iridescence.iridescenceFactor ?? 0,
1952
+ iridescenceIor: iridescence.iridescenceIor ?? 1.3,
1953
+ iridescenceThicknessMinimum: iridescence.iridescenceThicknessMinimum ?? 100,
1954
+ iridescenceThicknessMaximum: iridescence.iridescenceThicknessMaximum ?? 400,
1955
+ iridescenceChannel: 0,
1956
+ iridescenceThicknessChannel: 1,
1957
+ ...iridescence.iridescenceTexture === void 0 ? {} : { iridescenceTexture: parseTextureInfo(iridescence.iridescenceTexture, textures) },
1958
+ ...iridescence.iridescenceThicknessTexture === void 0 ? {} : {
1959
+ iridescenceThicknessTexture: parseTextureInfo(
1960
+ iridescence.iridescenceThicknessTexture,
1961
+ textures
1962
+ )
1963
+ }
1964
+ },
1965
+ ...specular === void 0 ? {} : {
1966
+ specularFactor: specular.specularFactor ?? 1,
1967
+ specularChannel: 3,
1968
+ specularColorFactor: tuple3(specular.specularColorFactor) ?? [1, 1, 1],
1969
+ specularColorChannel: [0, 1, 2],
1970
+ ...specular.specularTexture === void 0 ? {} : { specularTexture: parseTextureInfo(specular.specularTexture, textures) },
1971
+ ...specular.specularColorTexture === void 0 ? {} : {
1972
+ specularColorTexture: parseTextureInfo(specular.specularColorTexture, textures)
1973
+ }
1974
+ },
1650
1975
  ...alphaMode === void 0 ? {} : { alphaMode },
1651
1976
  ...alphaCutoff === void 0 ? {} : { alphaCutoff },
1652
1977
  ...matJson.doubleSided === true ? { doubleSided: true } : {},
@@ -3137,6 +3462,16 @@ function materialRefsForPack(mat, doc, textureGuidByIndex, samplerGuidByIndex =
3137
3462
  pushRefsForSlot(mat.emissiveTexture, "emissiveTexture");
3138
3463
  pushRefsForSlot(mat.transmissionTexture, "transmissionTexture");
3139
3464
  pushRefsForSlot(mat.thicknessTexture, "thicknessTexture");
3465
+ pushRefsForSlot(mat.clearcoatTexture, "clearcoatTexture");
3466
+ pushRefsForSlot(mat.clearcoatRoughnessTexture, "clearcoatRoughnessTexture");
3467
+ pushRefsForSlot(mat.clearcoatNormalTexture, "clearcoatNormalTexture");
3468
+ pushRefsForSlot(mat.anisotropyTexture, "anisotropyTexture");
3469
+ pushRefsForSlot(mat.sheenColorTexture, "sheenColorTexture");
3470
+ pushRefsForSlot(mat.sheenRoughnessTexture, "sheenRoughnessTexture");
3471
+ pushRefsForSlot(mat.iridescenceTexture, "iridescenceTexture");
3472
+ pushRefsForSlot(mat.iridescenceThicknessTexture, "iridescenceThicknessTexture");
3473
+ pushRefsForSlot(mat.specularTexture, "specularTexture");
3474
+ pushRefsForSlot(mat.specularColorTexture, "specularColorTexture");
3140
3475
  return refs;
3141
3476
  }
3142
3477
  function availableUvSets(mesh) {
@@ -3157,7 +3492,17 @@ function rewriteMaterialAssetRefs(matAsset, mat, doc, maps) {
3157
3492
  ["occlusionTexture", mat.occlusionTexture],
3158
3493
  ["emissiveTexture", mat.emissiveTexture],
3159
3494
  ["transmissionTexture", mat.transmissionTexture],
3160
- ["thicknessTexture", mat.thicknessTexture]
3495
+ ["thicknessTexture", mat.thicknessTexture],
3496
+ ["clearcoatTexture", mat.clearcoatTexture],
3497
+ ["clearcoatRoughnessTexture", mat.clearcoatRoughnessTexture],
3498
+ ["clearcoatNormalTexture", mat.clearcoatNormalTexture],
3499
+ ["anisotropyTexture", mat.anisotropyTexture],
3500
+ ["sheenColorTexture", mat.sheenColorTexture],
3501
+ ["sheenRoughnessTexture", mat.sheenRoughnessTexture],
3502
+ ["iridescenceTexture", mat.iridescenceTexture],
3503
+ ["iridescenceThicknessTexture", mat.iridescenceThicknessTexture],
3504
+ ["specularTexture", mat.specularTexture],
3505
+ ["specularColorTexture", mat.specularColorTexture]
3161
3506
  ];
3162
3507
  let cursor = 0;
3163
3508
  for (const [slot, rawBinding] of slots) {
@@ -3374,6 +3719,10 @@ async function importGltf(ctx, meshopt) {
3374
3719
  if (!uvResult.ok) {
3375
3720
  throw Object.assign(new Error(uvResult.error.message), uvResult.error);
3376
3721
  }
3722
+ const tangentResult = validateMaterialTangentInputs(mat, meshIr);
3723
+ if (!tangentResult.ok) {
3724
+ throw Object.assign(new Error(tangentResult.error.message), tangentResult.error);
3725
+ }
3377
3726
  }
3378
3727
  const matAsset = toMaterialAsset(mat, {
3379
3728
  textureHandles: maps.textureHandles,