@itwin/core-frontend 3.0.0-dev.173 → 3.0.0-dev.177

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 (78) hide show
  1. package/LICENSE.md +1 -1
  2. package/lib/cjs/IModelApp.js +1 -1
  3. package/lib/cjs/IModelApp.js.map +1 -1
  4. package/lib/cjs/SheetViewState.d.ts.map +1 -1
  5. package/lib/cjs/SheetViewState.js +1 -2
  6. package/lib/cjs/SheetViewState.js.map +1 -1
  7. package/lib/cjs/render/RenderSystem.d.ts.map +1 -1
  8. package/lib/cjs/render/RenderSystem.js +5 -6
  9. package/lib/cjs/render/RenderSystem.js.map +1 -1
  10. package/lib/cjs/render/RenderTexture.d.ts +2 -17
  11. package/lib/cjs/render/RenderTexture.d.ts.map +1 -1
  12. package/lib/cjs/render/RenderTexture.js +0 -17
  13. package/lib/cjs/render/RenderTexture.js.map +1 -1
  14. package/lib/cjs/render/primitives/Primitives.d.ts +1 -1
  15. package/lib/cjs/render/primitives/Primitives.d.ts.map +1 -1
  16. package/lib/cjs/render/primitives/Primitives.js.map +1 -1
  17. package/lib/cjs/render/webgl/BackgroundMapDrape.js +1 -1
  18. package/lib/cjs/render/webgl/BackgroundMapDrape.js.map +1 -1
  19. package/lib/cjs/render/webgl/PlanarClassifier.d.ts.map +1 -1
  20. package/lib/cjs/render/webgl/PlanarClassifier.js +2 -1
  21. package/lib/cjs/render/webgl/PlanarClassifier.js.map +1 -1
  22. package/lib/cjs/render/webgl/SolarShadowMap.d.ts.map +1 -1
  23. package/lib/cjs/render/webgl/SolarShadowMap.js +2 -2
  24. package/lib/cjs/render/webgl/SolarShadowMap.js.map +1 -1
  25. package/lib/cjs/render/webgl/System.d.ts.map +1 -1
  26. package/lib/cjs/render/webgl/System.js +15 -11
  27. package/lib/cjs/render/webgl/System.js.map +1 -1
  28. package/lib/cjs/render/webgl/Texture.d.ts +15 -11
  29. package/lib/cjs/render/webgl/Texture.d.ts.map +1 -1
  30. package/lib/cjs/render/webgl/Texture.js +27 -23
  31. package/lib/cjs/render/webgl/Texture.js.map +1 -1
  32. package/lib/cjs/tile/GltfReader.d.ts +29 -17
  33. package/lib/cjs/tile/GltfReader.d.ts.map +1 -1
  34. package/lib/cjs/tile/GltfReader.js +103 -80
  35. package/lib/cjs/tile/GltfReader.js.map +1 -1
  36. package/lib/cjs/tile/ImdlReader.d.ts +3 -1
  37. package/lib/cjs/tile/ImdlReader.d.ts.map +1 -1
  38. package/lib/cjs/tile/ImdlReader.js +1 -1
  39. package/lib/cjs/tile/ImdlReader.js.map +1 -1
  40. package/lib/esm/IModelApp.js +1 -1
  41. package/lib/esm/IModelApp.js.map +1 -1
  42. package/lib/esm/SheetViewState.d.ts.map +1 -1
  43. package/lib/esm/SheetViewState.js +1 -2
  44. package/lib/esm/SheetViewState.js.map +1 -1
  45. package/lib/esm/render/RenderSystem.d.ts.map +1 -1
  46. package/lib/esm/render/RenderSystem.js +6 -7
  47. package/lib/esm/render/RenderSystem.js.map +1 -1
  48. package/lib/esm/render/RenderTexture.d.ts +2 -17
  49. package/lib/esm/render/RenderTexture.d.ts.map +1 -1
  50. package/lib/esm/render/RenderTexture.js +1 -16
  51. package/lib/esm/render/RenderTexture.js.map +1 -1
  52. package/lib/esm/render/primitives/Primitives.d.ts +1 -1
  53. package/lib/esm/render/primitives/Primitives.d.ts.map +1 -1
  54. package/lib/esm/render/primitives/Primitives.js.map +1 -1
  55. package/lib/esm/render/webgl/BackgroundMapDrape.js +2 -2
  56. package/lib/esm/render/webgl/BackgroundMapDrape.js.map +1 -1
  57. package/lib/esm/render/webgl/PlanarClassifier.d.ts.map +1 -1
  58. package/lib/esm/render/webgl/PlanarClassifier.js +3 -2
  59. package/lib/esm/render/webgl/PlanarClassifier.js.map +1 -1
  60. package/lib/esm/render/webgl/SolarShadowMap.d.ts.map +1 -1
  61. package/lib/esm/render/webgl/SolarShadowMap.js +3 -3
  62. package/lib/esm/render/webgl/SolarShadowMap.js.map +1 -1
  63. package/lib/esm/render/webgl/System.d.ts.map +1 -1
  64. package/lib/esm/render/webgl/System.js +16 -12
  65. package/lib/esm/render/webgl/System.js.map +1 -1
  66. package/lib/esm/render/webgl/Texture.d.ts +15 -11
  67. package/lib/esm/render/webgl/Texture.d.ts.map +1 -1
  68. package/lib/esm/render/webgl/Texture.js +28 -24
  69. package/lib/esm/render/webgl/Texture.js.map +1 -1
  70. package/lib/esm/tile/GltfReader.d.ts +29 -17
  71. package/lib/esm/tile/GltfReader.d.ts.map +1 -1
  72. package/lib/esm/tile/GltfReader.js +105 -82
  73. package/lib/esm/tile/GltfReader.js.map +1 -1
  74. package/lib/esm/tile/ImdlReader.d.ts +3 -1
  75. package/lib/esm/tile/ImdlReader.d.ts.map +1 -1
  76. package/lib/esm/tile/ImdlReader.js +1 -1
  77. package/lib/esm/tile/ImdlReader.js.map +1 -1
  78. package/package.json +24 -23
@@ -17,7 +17,6 @@ const GraphicBranch_1 = require("../render/GraphicBranch");
17
17
  const DisplayParams_1 = require("../render/primitives/DisplayParams");
18
18
  const MeshPrimitives_1 = require("../render/primitives/mesh/MeshPrimitives");
19
19
  const RealityMeshPrimitive_1 = require("../render/primitives/mesh/RealityMeshPrimitive");
20
- const RenderTexture_1 = require("../render/RenderTexture");
21
20
  /* eslint-disable no-restricted-syntax */
22
21
  /** Enumerates the types of [[GltfMeshPrimitive]] topologies. */
23
22
  var GltfMeshMode;
@@ -102,6 +101,12 @@ function getNodeMeshIds(node) {
102
101
  return [node.mesh];
103
102
  return [];
104
103
  }
104
+ /** GL states that can be enabled by a [[GltfTechnique]]. Only those queried by this implementation are enumerated. */
105
+ var GltfTechniqueState;
106
+ (function (GltfTechniqueState) {
107
+ /** Enables alpha blending. */
108
+ GltfTechniqueState[GltfTechniqueState["Blend"] = 3042] = "Blend";
109
+ })(GltfTechniqueState || (GltfTechniqueState = {}));
105
110
  function isGltf1Material(material) {
106
111
  const mat1 = material;
107
112
  return undefined !== mat1.technique || undefined !== mat1.values;
@@ -289,21 +294,23 @@ const emptyDict = {};
289
294
  function colorFromJson(values) {
290
295
  return core_common_1.ColorDef.from(values[0] * 255, values[1] * 255, values[2] * 255, (1.0 - values[3]) * 255);
291
296
  }
292
- function colorFromMaterial(material) {
297
+ function colorFromMaterial(material, isTransparent) {
293
298
  var _a, _b, _c, _d, _e;
294
- if (material) {
295
- if (isGltf1Material(material)) {
296
- if (((_a = material.values) === null || _a === void 0 ? void 0 : _a.color) && Array.isArray(material.values.color))
297
- return colorFromJson(material.values.color);
298
- }
299
- else if ((_d = (_c = (_b = material.extensions) === null || _b === void 0 ? void 0 : _b.KHR_techniques_webgl) === null || _c === void 0 ? void 0 : _c.values) === null || _d === void 0 ? void 0 : _d.u_color) {
300
- return colorFromJson(material.extensions.KHR_techniques_webgl.values.u_color);
301
- }
302
- else if ((_e = material.pbrMetallicRoughness) === null || _e === void 0 ? void 0 : _e.baseColorFactor) {
303
- return colorFromJson(material.pbrMetallicRoughness.baseColorFactor);
304
- }
299
+ let color = core_common_1.ColorDef.white;
300
+ if (isGltf1Material(material)) {
301
+ if (((_a = material.values) === null || _a === void 0 ? void 0 : _a.color) && Array.isArray(material.values.color))
302
+ color = colorFromJson(material.values.color);
303
+ }
304
+ else if ((_d = (_c = (_b = material.extensions) === null || _b === void 0 ? void 0 : _b.KHR_techniques_webgl) === null || _c === void 0 ? void 0 : _c.values) === null || _d === void 0 ? void 0 : _d.u_color) {
305
+ color = colorFromJson(material.extensions.KHR_techniques_webgl.values.u_color);
306
+ }
307
+ else if ((_e = material.pbrMetallicRoughness) === null || _e === void 0 ? void 0 : _e.baseColorFactor) {
308
+ color = colorFromJson(material.pbrMetallicRoughness.baseColorFactor);
305
309
  }
306
- return core_common_1.ColorDef.white;
310
+ // SPEC: Opaque materials ignore any alpha channel.
311
+ if (!isTransparent)
312
+ color = color.withTransparency(0);
313
+ return color;
307
314
  }
308
315
  class TransformStack {
309
316
  constructor() {
@@ -357,12 +364,25 @@ function* traverseNodes(ids, nodes, traversed) {
357
364
  yield child;
358
365
  }
359
366
  }
367
+ function compareTextureKeys(lhs, rhs) {
368
+ const cmp = (0, core_bentley_1.compareBooleans)(lhs.isTransparent, rhs.isTransparent);
369
+ if (0 !== cmp)
370
+ return cmp;
371
+ (0, core_bentley_1.assert)(typeof lhs.id === typeof rhs.id);
372
+ if ("string" === typeof lhs.id) {
373
+ (0, core_bentley_1.assert)("string" === typeof rhs.id);
374
+ return (0, core_bentley_1.compareStrings)(lhs.id, rhs.id);
375
+ }
376
+ (0, core_bentley_1.assert)("number" === typeof lhs.id && "number" === typeof rhs.id);
377
+ return (0, core_bentley_1.compareNumbers)(lhs.id, rhs.id);
378
+ }
360
379
  /** Deserializes [glTF](https://www.khronos.org/gltf/).
361
380
  * @internal
362
381
  */
363
382
  class GltfReader {
364
383
  constructor(args) {
365
384
  var _a, _b, _c, _d, _e, _f, _g;
385
+ this._resolvedTextures = new core_bentley_1.Dictionary((lhs, rhs) => compareTextureKeys(lhs, rhs));
366
386
  this._glTF = args.props.glTF;
367
387
  this._version = args.props.version;
368
388
  this._yAxisUp = args.props.yAxisUp;
@@ -660,22 +680,41 @@ class GltfReader {
660
680
  }
661
681
  }
662
682
  }
663
- const id = extractId((_g = material.emissiveTexture) === null || _g === void 0 ? void 0 : _g.index);
664
- return id !== null && id !== void 0 ? id : extractId((_j = (_h = material.pbrMetallicRoughness) === null || _h === void 0 ? void 0 : _h.baseColorTexture) === null || _j === void 0 ? void 0 : _j.index);
683
+ const id = extractId((_h = (_g = material.pbrMetallicRoughness) === null || _g === void 0 ? void 0 : _g.baseColorTexture) === null || _h === void 0 ? void 0 : _h.index);
684
+ return id !== null && id !== void 0 ? id : extractId((_j = material.emissiveTexture) === null || _j === void 0 ? void 0 : _j.index);
685
+ }
686
+ isMaterialTransparent(material) {
687
+ var _a, _b;
688
+ if (isGltf1Material(material)) {
689
+ if (this._glTF.techniques && undefined !== material.technique) {
690
+ const technique = this._glTF.techniques[material.technique];
691
+ if ((_b = (_a = technique === null || technique === void 0 ? void 0 : technique.states) === null || _a === void 0 ? void 0 : _a.enable) === null || _b === void 0 ? void 0 : _b.some((state) => state === GltfTechniqueState.Blend))
692
+ return true;
693
+ }
694
+ return false;
695
+ }
696
+ else {
697
+ // Default: OPAQUE.
698
+ // ###TODO support MASK. For now treat as opaque.
699
+ return "BLEND" === material.alphaMode;
700
+ }
665
701
  }
666
- createDisplayParams(materialJson, hasBakedLighting) {
667
- const textureId = this.extractTextureId(materialJson);
668
- const textureMapping = undefined !== textureId ? this.findTextureMapping(textureId) : undefined;
669
- const color = colorFromMaterial(materialJson);
702
+ createDisplayParams(material, hasBakedLighting) {
703
+ const isTransparent = this.isMaterialTransparent(material);
704
+ const textureId = this.extractTextureId(material);
705
+ const textureMapping = undefined !== textureId ? this.findTextureMapping(textureId, isTransparent) : undefined;
706
+ const color = colorFromMaterial(material, isTransparent);
670
707
  return new DisplayParams_1.DisplayParams(DisplayParams_1.DisplayParams.Type.Mesh, color, color, 1, core_common_1.LinePixels.Solid, core_common_1.FillFlags.Always, undefined, undefined, hasBakedLighting, textureMapping);
671
708
  }
672
709
  readMeshPrimitive(primitive, featureTable, pseudoRtcBias) {
673
- var _a, _b, _c, _d, _e, _f;
710
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
674
711
  const materialName = core_bentley_1.JsonUtils.asString(primitive.material);
675
- const hasBakedLighting = undefined === primitive.attributes.NORMAL;
676
712
  const material = 0 < materialName.length ? this._materials[materialName] : undefined;
713
+ if (!material)
714
+ return undefined;
715
+ const hasBakedLighting = undefined === primitive.attributes.NORMAL || undefined !== ((_a = material.extensions) === null || _a === void 0 ? void 0 : _a.KHR_materials_unlit);
677
716
  const displayParams = material ? this.createDisplayParams(material, hasBakedLighting) : undefined;
678
- if (undefined === displayParams)
717
+ if (!displayParams)
679
718
  return undefined;
680
719
  let primitiveType = -1;
681
720
  const meshMode = core_bentley_1.JsonUtils.asInt(primitive.mode, GltfMeshMode.Triangles);
@@ -713,9 +752,9 @@ class GltfReader {
713
752
  if (undefined !== colorIndices && material) {
714
753
  let texStep;
715
754
  if (isGltf1Material(material))
716
- texStep = (_a = material.values) === null || _a === void 0 ? void 0 : _a.texStep;
755
+ texStep = (_b = material.values) === null || _b === void 0 ? void 0 : _b.texStep;
717
756
  else
718
- texStep = (_d = (_c = (_b = material.extensions) === null || _b === void 0 ? void 0 : _b.KHR_techniques_webgl) === null || _c === void 0 ? void 0 : _c.values) === null || _d === void 0 ? void 0 : _d.u_texStep;
757
+ texStep = (_e = (_d = (_c = material.extensions) === null || _c === void 0 ? void 0 : _c.KHR_techniques_webgl) === null || _d === void 0 ? void 0 : _d.values) === null || _e === void 0 ? void 0 : _e.u_texStep;
719
758
  if (texStep) {
720
759
  const uvParams = [];
721
760
  for (let i = 0; i < colorIndices.count; i++)
@@ -725,7 +764,7 @@ class GltfReader {
725
764
  mesh.uvQParams = paramList.params;
726
765
  }
727
766
  }
728
- if ((_e = primitive.extensions) === null || _e === void 0 ? void 0 : _e.KHR_draco_mesh_compression) {
767
+ if ((_f = primitive.extensions) === null || _f === void 0 ? void 0 : _f.KHR_draco_mesh_compression) {
729
768
  return undefined; // Defer Draco decompression until web workers implementation.
730
769
  /*
731
770
  const dracoExtension = primitive.extensions.KHR_draco_mesh_compression;
@@ -744,8 +783,12 @@ class GltfReader {
744
783
  return undefined;
745
784
  if (!displayParams.ignoreLighting && !this.readNormals(mesh, primitive.attributes, "NORMAL"))
746
785
  return undefined;
747
- if (!mesh.uvs)
748
- this.readUVParams(mesh, primitive.attributes, "TEXCOORD_0");
786
+ if (!mesh.uvs) {
787
+ let texCoordIndex = 0;
788
+ if (!isGltf1Material(material) && undefined !== ((_h = (_g = material.pbrMetallicRoughness) === null || _g === void 0 ? void 0 : _g.baseColorTexture) === null || _h === void 0 ? void 0 : _h.texCoord))
789
+ texCoordIndex = core_bentley_1.JsonUtils.asInt(material.pbrMetallicRoughness.baseColorTexture.texCoord);
790
+ this.readUVParams(mesh, primitive.attributes, `TEXCOORD_${texCoordIndex}`);
791
+ }
749
792
  if (this._deduplicateVertices && !this.deduplicateVertices(mesh))
750
793
  return undefined;
751
794
  break;
@@ -763,7 +806,7 @@ class GltfReader {
763
806
  }
764
807
  if (displayParams.textureMapping && !mesh.uvs)
765
808
  return undefined;
766
- if ((_f = primitive.extensions) === null || _f === void 0 ? void 0 : _f.CESIUM_primitive_outline) {
809
+ if ((_j = primitive.extensions) === null || _j === void 0 ? void 0 : _j.CESIUM_primitive_outline) {
767
810
  const data = this.readBufferData32(primitive.extensions.CESIUM_primitive_outline, "indices");
768
811
  if (data !== undefined) {
769
812
  (0, core_bentley_1.assert)(0 === data.count % 2);
@@ -782,6 +825,8 @@ class GltfReader {
782
825
  const indices = mesh.indices;
783
826
  if (indices instanceof Uint16Array && numPoints > 0xffff)
784
827
  mesh.indices = new Uint32Array(numPoints);
828
+ else if (indices instanceof Uint8Array && numPoints > 0xff)
829
+ mesh.indices = new Uint32Array(numPoints);
785
830
  const points = new Uint16Array(3 * numPoints);
786
831
  const normals = mesh.normals ? new Uint16Array(numPoints) : undefined;
787
832
  const uvs = mesh.uvs ? new Uint16Array(2 * numPoints) : undefined;
@@ -882,10 +927,22 @@ class GltfReader {
882
927
  readBatchTable(_mesh, _json) {
883
928
  }
884
929
  readMeshIndices(mesh, json) {
885
- const data = this.readBufferData16(json, "indices") || this.readBufferData32(json, "indices");
886
- if (undefined === data || (!(data.buffer instanceof (Uint16Array)) && !(data.buffer instanceof (Uint32Array))))
930
+ var _a;
931
+ if (undefined !== json.indices) {
932
+ const data = this.readBufferData16(json, "indices") || this.readBufferData32(json, "indices");
933
+ if (data && (data.buffer instanceof Uint8Array || data.buffer instanceof Uint16Array || data.buffer instanceof Uint32Array)) {
934
+ mesh.indices = data.buffer;
935
+ return true;
936
+ }
937
+ return false;
938
+ }
939
+ // Non-indexed geometry. Manufacture triangle indices from points.
940
+ const numPoints = (_a = mesh.points) === null || _a === void 0 ? void 0 : _a.length;
941
+ if (undefined === numPoints || 0 !== numPoints % 3)
887
942
  return false;
888
- mesh.indices = data.buffer;
943
+ mesh.indices = numPoints < 255 ? new Uint8Array(numPoints) : (numPoints < 0xffff ? new Uint16Array(numPoints) : new Uint32Array(numPoints));
944
+ for (let i = 0; i < numPoints; i++)
945
+ mesh.indices[i] = i;
889
946
  return true;
890
947
  }
891
948
  readNormals(mesh, json, accessorName) {
@@ -1023,9 +1080,6 @@ class GltfReader {
1023
1080
  if (!image.resolvedImage)
1024
1081
  promises.push(this.resolveImage(image));
1025
1082
  await Promise.all(promises);
1026
- if (this._isCanceled)
1027
- return;
1028
- this.resolveTextures();
1029
1083
  }
1030
1084
  catch (_) {
1031
1085
  }
@@ -1083,64 +1137,33 @@ class GltfReader {
1083
1137
  if (undefined !== url)
1084
1138
  image.resolvedImage = await (0, ImageUtil_1.tryImageElementFromUrl)(url);
1085
1139
  }
1086
- resolveTextures() {
1087
- var _a, _b;
1088
- if (undefined === this._glTF.textures)
1089
- return;
1090
- // ###TODO this seems pretty hacky, and won't work for glTF 2.0 even if the KHR_techniques_webgl extension is used...
1091
- const transparentTextures = new Set();
1092
- if (this._glTF.techniques) {
1093
- for (const name of Object.keys(this._materials)) {
1094
- const material = this._materials[name];
1095
- if (material && isGltf1Material(material) && undefined !== material.technique && undefined !== ((_a = material.values) === null || _a === void 0 ? void 0 : _a.tex)) {
1096
- const technique = this._glTF.techniques[material.technique];
1097
- if ((_b = technique === null || technique === void 0 ? void 0 : technique.states) === null || _b === void 0 ? void 0 : _b.enable) {
1098
- for (const enable of technique.states.enable) {
1099
- if (3042 === enable) { // 3042 = BLEND
1100
- transparentTextures.add(material.values.tex.toString());
1101
- break;
1102
- }
1103
- }
1104
- }
1105
- }
1106
- }
1107
- }
1108
- for (const node of this.traverseScene()) {
1109
- for (const meshId of getNodeMeshIds(node)) {
1110
- const mesh = this._meshes[meshId];
1111
- if (!(mesh === null || mesh === void 0 ? void 0 : mesh.primitives))
1112
- continue;
1113
- for (const primitive of mesh.primitives) {
1114
- const material = undefined !== primitive.material ? this._materials[primitive.material] : undefined;
1115
- const textureId = material ? this.extractTextureId(material) : undefined;
1116
- if (undefined !== textureId)
1117
- this.resolveTexture(textureId, transparentTextures.has(textureId));
1118
- }
1119
- }
1120
- }
1121
- }
1122
1140
  resolveTexture(textureId, isTransparent) {
1123
1141
  var _a;
1124
1142
  const texture = this._textures[textureId];
1125
- if (!texture || texture.resolvedTexture || undefined === texture.source)
1126
- return;
1143
+ if (!texture || undefined === texture.source)
1144
+ return false;
1127
1145
  const image = (_a = this._images[texture.source]) === null || _a === void 0 ? void 0 : _a.resolvedImage;
1128
1146
  if (!image)
1129
- return;
1147
+ return false;
1130
1148
  const samplerId = texture.sampler;
1131
1149
  const sampler = undefined !== samplerId ? this._samplers[samplerId] : undefined;
1132
- const textureType = undefined !== (sampler === null || sampler === void 0 ? void 0 : sampler.wrapS) || undefined !== (sampler === null || sampler === void 0 ? void 0 : sampler.wrapT) ? core_common_1.RenderTexture.Type.TileSection : core_common_1.RenderTexture.Type.Normal;
1133
- texture.resolvedTexture = this._system.createTexture({
1150
+ // ###TODO: RenderTexture should support different wrapping behavior for U vs V, and support mirrored repeat.
1151
+ // For now, repeat unless either explicitly clamps.
1152
+ const textureType = GltfWrapMode.ClampToEdge === (sampler === null || sampler === void 0 ? void 0 : sampler.wrapS) || GltfWrapMode.ClampToEdge === (sampler === null || sampler === void 0 ? void 0 : sampler.wrapT) ? core_common_1.RenderTexture.Type.TileSection : core_common_1.RenderTexture.Type.Normal;
1153
+ const renderTexture = this._system.createTexture({
1134
1154
  type: textureType,
1135
1155
  image: {
1136
1156
  source: image,
1137
- transparency: isTransparent ? RenderTexture_1.TextureTransparency.Translucent : RenderTexture_1.TextureTransparency.Opaque,
1157
+ transparency: isTransparent ? core_common_1.TextureTransparency.Mixed : core_common_1.TextureTransparency.Opaque,
1138
1158
  },
1139
1159
  });
1160
+ return renderTexture !== null && renderTexture !== void 0 ? renderTexture : false;
1140
1161
  }
1141
- findTextureMapping(textureId) {
1142
- const texture = this._textures[textureId];
1143
- return (texture === null || texture === void 0 ? void 0 : texture.resolvedTexture) ? new core_common_1.TextureMapping(texture.resolvedTexture, new core_common_1.TextureMapping.Params()) : undefined;
1162
+ findTextureMapping(id, isTransparent) {
1163
+ let texture = this._resolvedTextures.get({ id, isTransparent });
1164
+ if (undefined === texture)
1165
+ this._resolvedTextures.set({ id, isTransparent }, texture = this.resolveTexture(id, isTransparent));
1166
+ return texture ? new core_common_1.TextureMapping(texture, new core_common_1.TextureMapping.Params()) : undefined;
1144
1167
  }
1145
1168
  }
1146
1169
  exports.GltfReader = GltfReader;