@itwin/core-frontend 5.7.0-dev.9 → 5.7.1

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/CHANGELOG.md +34 -1
  2. package/lib/cjs/CategorySelectorState.d.ts +8 -0
  3. package/lib/cjs/CategorySelectorState.d.ts.map +1 -1
  4. package/lib/cjs/CategorySelectorState.js +12 -0
  5. package/lib/cjs/CategorySelectorState.js.map +1 -1
  6. package/lib/cjs/GeoServices.js +1 -1
  7. package/lib/cjs/GeoServices.js.map +1 -1
  8. package/lib/cjs/IModelConnection.d.ts +0 -2
  9. package/lib/cjs/IModelConnection.d.ts.map +1 -1
  10. package/lib/cjs/IModelConnection.js +110 -105
  11. package/lib/cjs/IModelConnection.js.map +1 -1
  12. package/lib/cjs/ViewState.d.ts.map +1 -1
  13. package/lib/cjs/ViewState.js +2 -0
  14. package/lib/cjs/ViewState.js.map +1 -1
  15. package/lib/cjs/Viewport.d.ts +2 -1
  16. package/lib/cjs/Viewport.d.ts.map +1 -1
  17. package/lib/cjs/Viewport.js +10 -3
  18. package/lib/cjs/Viewport.js.map +1 -1
  19. package/lib/cjs/common/gltf/GltfParser.js +1 -1
  20. package/lib/cjs/common/gltf/GltfParser.js.map +1 -1
  21. package/lib/cjs/internal/tile/MeshoptCompression.js +1 -1
  22. package/lib/cjs/internal/tile/MeshoptCompression.js.map +1 -1
  23. package/lib/cjs/internal/tile/PntsReader.js +1 -1
  24. package/lib/cjs/internal/tile/PntsReader.js.map +1 -1
  25. package/lib/cjs/internal/tile/RealityTileLoader.d.ts.map +1 -1
  26. package/lib/cjs/internal/tile/RealityTileLoader.js +26 -5
  27. package/lib/cjs/internal/tile/RealityTileLoader.js.map +1 -1
  28. package/lib/cjs/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.d.ts.map +1 -1
  29. package/lib/cjs/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js +7 -1
  30. package/lib/cjs/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js.map +1 -1
  31. package/lib/cjs/internal/tile/map/WmtsCapabilities.js +1 -1
  32. package/lib/cjs/internal/tile/map/WmtsCapabilities.js.map +1 -1
  33. package/lib/cjs/tile/GltfReader.d.ts +4 -2
  34. package/lib/cjs/tile/GltfReader.d.ts.map +1 -1
  35. package/lib/cjs/tile/GltfReader.js +55 -5
  36. package/lib/cjs/tile/GltfReader.js.map +1 -1
  37. package/lib/cjs/tile/map/ImageryTileTree.js +7 -7
  38. package/lib/cjs/tile/map/ImageryTileTree.js.map +1 -1
  39. package/lib/esm/CategorySelectorState.d.ts +8 -0
  40. package/lib/esm/CategorySelectorState.d.ts.map +1 -1
  41. package/lib/esm/CategorySelectorState.js +12 -0
  42. package/lib/esm/CategorySelectorState.js.map +1 -1
  43. package/lib/esm/GeoServices.js +1 -1
  44. package/lib/esm/GeoServices.js.map +1 -1
  45. package/lib/esm/IModelConnection.d.ts +0 -2
  46. package/lib/esm/IModelConnection.d.ts.map +1 -1
  47. package/lib/esm/IModelConnection.js +110 -105
  48. package/lib/esm/IModelConnection.js.map +1 -1
  49. package/lib/esm/ViewState.d.ts.map +1 -1
  50. package/lib/esm/ViewState.js +2 -0
  51. package/lib/esm/ViewState.js.map +1 -1
  52. package/lib/esm/Viewport.d.ts +2 -1
  53. package/lib/esm/Viewport.d.ts.map +1 -1
  54. package/lib/esm/Viewport.js +10 -3
  55. package/lib/esm/Viewport.js.map +1 -1
  56. package/lib/esm/common/gltf/GltfParser.js +1 -1
  57. package/lib/esm/common/gltf/GltfParser.js.map +1 -1
  58. package/lib/esm/internal/tile/MeshoptCompression.js +1 -1
  59. package/lib/esm/internal/tile/MeshoptCompression.js.map +1 -1
  60. package/lib/esm/internal/tile/PntsReader.js +1 -1
  61. package/lib/esm/internal/tile/PntsReader.js.map +1 -1
  62. package/lib/esm/internal/tile/RealityTileLoader.d.ts.map +1 -1
  63. package/lib/esm/internal/tile/RealityTileLoader.js +26 -5
  64. package/lib/esm/internal/tile/RealityTileLoader.js.map +1 -1
  65. package/lib/esm/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.d.ts.map +1 -1
  66. package/lib/esm/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js +7 -1
  67. package/lib/esm/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js.map +1 -1
  68. package/lib/esm/internal/tile/map/WmtsCapabilities.js +1 -1
  69. package/lib/esm/internal/tile/map/WmtsCapabilities.js.map +1 -1
  70. package/lib/esm/tile/GltfReader.d.ts +4 -2
  71. package/lib/esm/tile/GltfReader.d.ts.map +1 -1
  72. package/lib/esm/tile/GltfReader.js +55 -5
  73. package/lib/esm/tile/GltfReader.js.map +1 -1
  74. package/lib/esm/tile/map/ImageryTileTree.js +8 -8
  75. package/lib/esm/tile/map/ImageryTileTree.js.map +1 -1
  76. package/lib/public/scripts/parse-imdl-worker.js +1 -1
  77. package/lib/workers/webpack/parse-imdl-worker.js +1 -1
  78. package/package.json +20 -20
@@ -232,7 +232,7 @@ class GltfReaderProps {
232
232
  exports.GltfReaderProps = GltfReaderProps;
233
233
  /** The GltfMeshData contains the raw GLTF mesh data. If the data is suitable to create a [[RealityMesh]] directly, basically in the quantized format produced by
234
234
  * ContextCapture, then a RealityMesh is created directly from this data. Otherwise, the mesh primitive is populated from the raw data and a MeshPrimitive
235
- * is generated. The MeshPrimitve path is much less efficient but should be rarely used.
235
+ * is generated. The MeshPrimitive path is much less efficient but should be rarely used.
236
236
  *
237
237
  * @internal
238
238
  */
@@ -520,7 +520,8 @@ class GltfReader {
520
520
  }),
521
521
  };
522
522
  }
523
- readGltfAndCreateGeometry(transformToRoot, needNormals = false, needParams = false) {
523
+ async readGltfAndCreateGeometry(transformToRoot, needNormals = false, needParams = false) {
524
+ await this.resolveResources();
524
525
  const transformStack = new TransformStack(this.getTileTransform(transformToRoot));
525
526
  const polyfaces = [];
526
527
  for (const nodeKey of this._sceneNodes) {
@@ -755,9 +756,18 @@ class GltfReader {
755
756
  }
756
757
  }
757
758
  polyfaceFromGltfMesh(mesh, transform, needNormals, needParams) {
758
- if (!mesh.pointQParams || !mesh.points || !mesh.indices)
759
+ if (mesh.pointQParams && mesh.points && mesh.indices)
760
+ return this.polyfaceFromQuantizedData(mesh.pointQParams, mesh.points, mesh.indices, mesh.normals, mesh.uvQParams, mesh.uvs, transform, needNormals, needParams);
761
+ const meshPrim = mesh.primitive;
762
+ const triangles = meshPrim.triangles;
763
+ const points = meshPrim.points;
764
+ if (!triangles || triangles.isEmpty || points.length === 0)
759
765
  return undefined;
760
- const { points, pointQParams, normals, uvs, uvQParams, indices } = mesh;
766
+ // This will likely only be the case for Draco-compressed meshes-- see where readDracoMeshPrimitive is called within readMeshPrimitive
767
+ // That is the only case where mesh.primitive is populated but mesh.pointQParams, mesh.points, & mesh.indices are not
768
+ return this.polyfaceFromMeshPrimitive(triangles, points, meshPrim.normals, meshPrim.uvParams, transform, needNormals, needParams);
769
+ }
770
+ polyfaceFromQuantizedData(pointQParams, points, indices, normals, uvQParams, uvs, transform, needNormals, needParams) {
761
771
  const includeNormals = needNormals && undefined !== normals;
762
772
  const includeParams = needParams && undefined !== uvQParams && undefined !== uvs;
763
773
  const polyface = core_geometry_1.IndexedPolyface.create(includeNormals, includeParams);
@@ -785,6 +795,46 @@ class GltfReader {
785
795
  }
786
796
  return polyface;
787
797
  }
798
+ polyfaceFromMeshPrimitive(triangles, points, normals, uvParams, transform, needNormals, needParams) {
799
+ const includeNormals = needNormals && normals.length > 0;
800
+ const includeParams = needParams && uvParams.length > 0;
801
+ const polyface = core_geometry_1.IndexedPolyface.create(includeNormals, includeParams);
802
+ if (points instanceof core_common_1.QPoint3dList) {
803
+ for (let i = 0; i < points.length; i++) {
804
+ const point = points.unquantize(i);
805
+ if (transform)
806
+ transform.multiplyPoint3d(point, point);
807
+ polyface.addPoint(point);
808
+ }
809
+ }
810
+ else {
811
+ const center = points.range.center;
812
+ for (const pt of points) {
813
+ const point = pt.plus(center);
814
+ if (transform)
815
+ transform.multiplyPoint3d(point, point);
816
+ polyface.addPoint(point);
817
+ }
818
+ }
819
+ if (includeNormals)
820
+ for (const normal of normals)
821
+ polyface.addNormal(core_common_1.OctEncodedNormal.decodeValue(normal.value));
822
+ if (includeParams)
823
+ for (const uv of uvParams)
824
+ polyface.addParam(uv);
825
+ const indices = triangles.indices;
826
+ let j = 0;
827
+ for (const index of indices) {
828
+ polyface.addPointIndex(index);
829
+ if (includeNormals)
830
+ polyface.addNormalIndex(index);
831
+ if (includeParams)
832
+ polyface.addParamIndex(index);
833
+ if (0 === (++j % 3))
834
+ polyface.terminateFacet();
835
+ }
836
+ return polyface;
837
+ }
788
838
  // ###TODO what is the actual type of `json`?
789
839
  getBufferView(json, accessorName) {
790
840
  try {
@@ -1827,7 +1877,7 @@ class GltfReader {
1827
1877
  }
1828
1878
  catch (err) {
1829
1879
  core_bentley_1.Logger.logWarning(FrontendLoggerCategory_1.FrontendLoggerCategory.Render, "Failed to decode draco-encoded glTF mesh");
1830
- core_bentley_1.Logger.logException(FrontendLoggerCategory_1.FrontendLoggerCategory.Render, err);
1880
+ core_bentley_1.Logger.logError(FrontendLoggerCategory_1.FrontendLoggerCategory.Render, err);
1831
1881
  }
1832
1882
  }
1833
1883
  async _resolveResources() {