@itwin/core-frontend 5.8.0-dev.1 → 5.8.0-dev.3
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.
- package/CHANGELOG.md +22 -1
- package/lib/cjs/internal/tile/RealityTileLoader.d.ts.map +1 -1
- package/lib/cjs/internal/tile/RealityTileLoader.js +26 -5
- package/lib/cjs/internal/tile/RealityTileLoader.js.map +1 -1
- package/lib/cjs/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/cjs/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js +7 -1
- package/lib/cjs/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/internal/tile/map/WmtsCapabilities.js +1 -1
- package/lib/cjs/internal/tile/map/WmtsCapabilities.js.map +1 -1
- package/lib/cjs/tile/GltfReader.d.ts +4 -2
- package/lib/cjs/tile/GltfReader.d.ts.map +1 -1
- package/lib/cjs/tile/GltfReader.js +54 -4
- package/lib/cjs/tile/GltfReader.js.map +1 -1
- package/lib/cjs/tile/map/ImageryTileTree.js +7 -7
- package/lib/cjs/tile/map/ImageryTileTree.js.map +1 -1
- package/lib/cjs/tools/MeasureTool.d.ts.map +1 -1
- package/lib/cjs/tools/MeasureTool.js +18 -1
- package/lib/cjs/tools/MeasureTool.js.map +1 -1
- package/lib/cjs/tools/PrimitiveTool.d.ts.map +1 -1
- package/lib/cjs/tools/PrimitiveTool.js +7 -1
- package/lib/cjs/tools/PrimitiveTool.js.map +1 -1
- package/lib/cjs/tools/ToolAdmin.d.ts +1 -0
- package/lib/cjs/tools/ToolAdmin.d.ts.map +1 -1
- package/lib/cjs/tools/ToolAdmin.js +32 -18
- package/lib/cjs/tools/ToolAdmin.js.map +1 -1
- package/lib/esm/internal/tile/RealityTileLoader.d.ts.map +1 -1
- package/lib/esm/internal/tile/RealityTileLoader.js +26 -5
- package/lib/esm/internal/tile/RealityTileLoader.js.map +1 -1
- package/lib/esm/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/esm/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js +7 -1
- package/lib/esm/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js.map +1 -1
- package/lib/esm/internal/tile/map/WmtsCapabilities.js +1 -1
- package/lib/esm/internal/tile/map/WmtsCapabilities.js.map +1 -1
- package/lib/esm/tile/GltfReader.d.ts +4 -2
- package/lib/esm/tile/GltfReader.d.ts.map +1 -1
- package/lib/esm/tile/GltfReader.js +54 -4
- package/lib/esm/tile/GltfReader.js.map +1 -1
- package/lib/esm/tile/map/ImageryTileTree.js +8 -8
- package/lib/esm/tile/map/ImageryTileTree.js.map +1 -1
- package/lib/esm/tools/MeasureTool.d.ts.map +1 -1
- package/lib/esm/tools/MeasureTool.js +18 -1
- package/lib/esm/tools/MeasureTool.js.map +1 -1
- package/lib/esm/tools/PrimitiveTool.d.ts.map +1 -1
- package/lib/esm/tools/PrimitiveTool.js +7 -1
- package/lib/esm/tools/PrimitiveTool.js.map +1 -1
- package/lib/esm/tools/ToolAdmin.d.ts +1 -0
- package/lib/esm/tools/ToolAdmin.d.ts.map +1 -1
- package/lib/esm/tools/ToolAdmin.js +32 -18
- package/lib/esm/tools/ToolAdmin.js.map +1 -1
- package/package.json +20 -20
|
@@ -200,7 +200,7 @@ export class GltfReaderProps {
|
|
|
200
200
|
}
|
|
201
201
|
/** 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
|
|
202
202
|
* ContextCapture, then a RealityMesh is created directly from this data. Otherwise, the mesh primitive is populated from the raw data and a MeshPrimitive
|
|
203
|
-
* is generated. The
|
|
203
|
+
* is generated. The MeshPrimitive path is much less efficient but should be rarely used.
|
|
204
204
|
*
|
|
205
205
|
* @internal
|
|
206
206
|
*/
|
|
@@ -487,7 +487,8 @@ export class GltfReader {
|
|
|
487
487
|
}),
|
|
488
488
|
};
|
|
489
489
|
}
|
|
490
|
-
readGltfAndCreateGeometry(transformToRoot, needNormals = false, needParams = false) {
|
|
490
|
+
async readGltfAndCreateGeometry(transformToRoot, needNormals = false, needParams = false) {
|
|
491
|
+
await this.resolveResources();
|
|
491
492
|
const transformStack = new TransformStack(this.getTileTransform(transformToRoot));
|
|
492
493
|
const polyfaces = [];
|
|
493
494
|
for (const nodeKey of this._sceneNodes) {
|
|
@@ -722,9 +723,18 @@ export class GltfReader {
|
|
|
722
723
|
}
|
|
723
724
|
}
|
|
724
725
|
polyfaceFromGltfMesh(mesh, transform, needNormals, needParams) {
|
|
725
|
-
if (
|
|
726
|
+
if (mesh.pointQParams && mesh.points && mesh.indices)
|
|
727
|
+
return this.polyfaceFromQuantizedData(mesh.pointQParams, mesh.points, mesh.indices, mesh.normals, mesh.uvQParams, mesh.uvs, transform, needNormals, needParams);
|
|
728
|
+
const meshPrim = mesh.primitive;
|
|
729
|
+
const triangles = meshPrim.triangles;
|
|
730
|
+
const points = meshPrim.points;
|
|
731
|
+
if (!triangles || triangles.isEmpty || points.length === 0)
|
|
726
732
|
return undefined;
|
|
727
|
-
|
|
733
|
+
// This will likely only be the case for Draco-compressed meshes-- see where readDracoMeshPrimitive is called within readMeshPrimitive
|
|
734
|
+
// That is the only case where mesh.primitive is populated but mesh.pointQParams, mesh.points, & mesh.indices are not
|
|
735
|
+
return this.polyfaceFromMeshPrimitive(triangles, points, meshPrim.normals, meshPrim.uvParams, transform, needNormals, needParams);
|
|
736
|
+
}
|
|
737
|
+
polyfaceFromQuantizedData(pointQParams, points, indices, normals, uvQParams, uvs, transform, needNormals, needParams) {
|
|
728
738
|
const includeNormals = needNormals && undefined !== normals;
|
|
729
739
|
const includeParams = needParams && undefined !== uvQParams && undefined !== uvs;
|
|
730
740
|
const polyface = IndexedPolyface.create(includeNormals, includeParams);
|
|
@@ -752,6 +762,46 @@ export class GltfReader {
|
|
|
752
762
|
}
|
|
753
763
|
return polyface;
|
|
754
764
|
}
|
|
765
|
+
polyfaceFromMeshPrimitive(triangles, points, normals, uvParams, transform, needNormals, needParams) {
|
|
766
|
+
const includeNormals = needNormals && normals.length > 0;
|
|
767
|
+
const includeParams = needParams && uvParams.length > 0;
|
|
768
|
+
const polyface = IndexedPolyface.create(includeNormals, includeParams);
|
|
769
|
+
if (points instanceof QPoint3dList) {
|
|
770
|
+
for (let i = 0; i < points.length; i++) {
|
|
771
|
+
const point = points.unquantize(i);
|
|
772
|
+
if (transform)
|
|
773
|
+
transform.multiplyPoint3d(point, point);
|
|
774
|
+
polyface.addPoint(point);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
else {
|
|
778
|
+
const center = points.range.center;
|
|
779
|
+
for (const pt of points) {
|
|
780
|
+
const point = pt.plus(center);
|
|
781
|
+
if (transform)
|
|
782
|
+
transform.multiplyPoint3d(point, point);
|
|
783
|
+
polyface.addPoint(point);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
if (includeNormals)
|
|
787
|
+
for (const normal of normals)
|
|
788
|
+
polyface.addNormal(OctEncodedNormal.decodeValue(normal.value));
|
|
789
|
+
if (includeParams)
|
|
790
|
+
for (const uv of uvParams)
|
|
791
|
+
polyface.addParam(uv);
|
|
792
|
+
const indices = triangles.indices;
|
|
793
|
+
let j = 0;
|
|
794
|
+
for (const index of indices) {
|
|
795
|
+
polyface.addPointIndex(index);
|
|
796
|
+
if (includeNormals)
|
|
797
|
+
polyface.addNormalIndex(index);
|
|
798
|
+
if (includeParams)
|
|
799
|
+
polyface.addParamIndex(index);
|
|
800
|
+
if (0 === (++j % 3))
|
|
801
|
+
polyface.terminateFacet();
|
|
802
|
+
}
|
|
803
|
+
return polyface;
|
|
804
|
+
}
|
|
755
805
|
// ###TODO what is the actual type of `json`?
|
|
756
806
|
getBufferView(json, accessorName) {
|
|
757
807
|
try {
|