@itwin/core-frontend 4.0.0-dev.70 → 4.0.0-dev.73
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 +74 -37
- package/lib/cjs/BingLocation.d.ts.map +1 -1
- package/lib/cjs/BingLocation.js +4 -5
- package/lib/cjs/BingLocation.js.map +1 -1
- package/lib/cjs/BriefcaseConnection.js.map +1 -1
- package/lib/cjs/NativeApp.d.ts.map +1 -1
- package/lib/cjs/NativeApp.js +0 -3
- package/lib/cjs/NativeApp.js.map +1 -1
- package/lib/cjs/RealityDataSourceCesiumIonAssetImpl.d.ts +1 -2
- package/lib/cjs/RealityDataSourceCesiumIonAssetImpl.d.ts.map +1 -1
- package/lib/cjs/RealityDataSourceCesiumIonAssetImpl.js +6 -20
- package/lib/cjs/RealityDataSourceCesiumIonAssetImpl.js.map +1 -1
- package/lib/cjs/RealityDataSourceContextShareImpl.d.ts +1 -1
- package/lib/cjs/RealityDataSourceContextShareImpl.d.ts.map +1 -1
- package/lib/cjs/RealityDataSourceContextShareImpl.js +2 -11
- package/lib/cjs/RealityDataSourceContextShareImpl.js.map +1 -1
- package/lib/cjs/RealityDataSourceTilesetUrlImpl.d.ts +4 -2
- package/lib/cjs/RealityDataSourceTilesetUrlImpl.d.ts.map +1 -1
- package/lib/cjs/RealityDataSourceTilesetUrlImpl.js +4 -12
- package/lib/cjs/RealityDataSourceTilesetUrlImpl.js.map +1 -1
- package/lib/cjs/extension/providers/RemoteExtensionProvider.d.ts.map +1 -1
- package/lib/cjs/extension/providers/RemoteExtensionProvider.js +1 -8
- package/lib/cjs/extension/providers/RemoteExtensionProvider.js.map +1 -1
- package/lib/cjs/render/primitives/PointCloudPrimitive.d.ts +1 -1
- package/lib/cjs/render/primitives/PointCloudPrimitive.d.ts.map +1 -1
- package/lib/cjs/render/primitives/PointCloudPrimitive.js.map +1 -1
- package/lib/cjs/render/webgl/AttributeBuffers.d.ts +1 -1
- package/lib/cjs/render/webgl/AttributeBuffers.d.ts.map +1 -1
- package/lib/cjs/render/webgl/AttributeBuffers.js.map +1 -1
- package/lib/cjs/render/webgl/PointCloud.js +1 -1
- package/lib/cjs/render/webgl/PointCloud.js.map +1 -1
- package/lib/cjs/request/Request.d.ts +17 -143
- package/lib/cjs/request/Request.d.ts.map +1 -1
- package/lib/cjs/request/Request.js +46 -303
- package/lib/cjs/request/Request.js.map +1 -1
- package/lib/cjs/tile/PntsReader.d.ts +5 -1
- package/lib/cjs/tile/PntsReader.d.ts.map +1 -1
- package/lib/cjs/tile/PntsReader.js +28 -25
- package/lib/cjs/tile/PntsReader.js.map +1 -1
- package/lib/cjs/tile/RealityTile.d.ts +12 -5
- package/lib/cjs/tile/RealityTile.d.ts.map +1 -1
- package/lib/cjs/tile/RealityTile.js +149 -57
- package/lib/cjs/tile/RealityTile.js.map +1 -1
- package/lib/cjs/tile/RealityTileLoader.d.ts.map +1 -1
- package/lib/cjs/tile/RealityTileLoader.js +14 -3
- package/lib/cjs/tile/RealityTileLoader.js.map +1 -1
- package/lib/cjs/tile/RealityTileTree.d.ts +1 -3
- package/lib/cjs/tile/RealityTileTree.d.ts.map +1 -1
- package/lib/cjs/tile/RealityTileTree.js +8 -21
- package/lib/cjs/tile/RealityTileTree.js.map +1 -1
- package/lib/cjs/tile/TileUsageMarker.d.ts +4 -0
- package/lib/cjs/tile/TileUsageMarker.d.ts.map +1 -1
- package/lib/cjs/tile/TileUsageMarker.js +9 -1
- package/lib/cjs/tile/TileUsageMarker.js.map +1 -1
- package/lib/cjs/tile/map/ArcGISTileMap.d.ts.map +1 -1
- package/lib/cjs/tile/map/ArcGISTileMap.js +1 -5
- package/lib/cjs/tile/map/ArcGISTileMap.js.map +1 -1
- package/lib/cjs/tile/map/BingElevation.d.ts.map +1 -1
- package/lib/cjs/tile/map/BingElevation.js +6 -16
- package/lib/cjs/tile/map/BingElevation.js.map +1 -1
- package/lib/cjs/tile/map/CesiumTerrainProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/CesiumTerrainProvider.js +12 -18
- package/lib/cjs/tile/map/CesiumTerrainProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/BingImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/BingImageryProvider.js +1 -3
- package/lib/cjs/tile/map/ImageryProviders/BingImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerSources.js +1 -1
- package/lib/cjs/tile/map/MapLayerSources.js.map +1 -1
- package/lib/cjs/tile/map/MapTile.d.ts +3 -1
- package/lib/cjs/tile/map/MapTile.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapTile.js +4 -0
- package/lib/cjs/tile/map/MapTile.js.map +1 -1
- package/lib/cjs/tile/map/WmsCapabilities.d.ts.map +1 -1
- package/lib/cjs/tile/map/WmsCapabilities.js +3 -6
- package/lib/cjs/tile/map/WmsCapabilities.js.map +1 -1
- package/lib/cjs/tile/map/WmtsCapabilities.d.ts.map +1 -1
- package/lib/cjs/tile/map/WmtsCapabilities.js +3 -6
- package/lib/cjs/tile/map/WmtsCapabilities.js.map +1 -1
- package/lib/cjs/tools/ViewTool.d.ts.map +1 -1
- package/lib/cjs/tools/ViewTool.js +0 -3
- package/lib/cjs/tools/ViewTool.js.map +1 -1
- package/lib/esm/BingLocation.d.ts.map +1 -1
- package/lib/esm/BingLocation.js +4 -5
- package/lib/esm/BingLocation.js.map +1 -1
- package/lib/esm/BriefcaseConnection.js.map +1 -1
- package/lib/esm/NativeApp.d.ts.map +1 -1
- package/lib/esm/NativeApp.js +0 -3
- package/lib/esm/NativeApp.js.map +1 -1
- package/lib/esm/RealityDataSourceCesiumIonAssetImpl.d.ts +1 -2
- package/lib/esm/RealityDataSourceCesiumIonAssetImpl.d.ts.map +1 -1
- package/lib/esm/RealityDataSourceCesiumIonAssetImpl.js +6 -20
- package/lib/esm/RealityDataSourceCesiumIonAssetImpl.js.map +1 -1
- package/lib/esm/RealityDataSourceContextShareImpl.d.ts +1 -1
- package/lib/esm/RealityDataSourceContextShareImpl.d.ts.map +1 -1
- package/lib/esm/RealityDataSourceContextShareImpl.js +2 -11
- package/lib/esm/RealityDataSourceContextShareImpl.js.map +1 -1
- package/lib/esm/RealityDataSourceTilesetUrlImpl.d.ts +4 -2
- package/lib/esm/RealityDataSourceTilesetUrlImpl.d.ts.map +1 -1
- package/lib/esm/RealityDataSourceTilesetUrlImpl.js +4 -12
- package/lib/esm/RealityDataSourceTilesetUrlImpl.js.map +1 -1
- package/lib/esm/extension/providers/RemoteExtensionProvider.d.ts.map +1 -1
- package/lib/esm/extension/providers/RemoteExtensionProvider.js +1 -8
- package/lib/esm/extension/providers/RemoteExtensionProvider.js.map +1 -1
- package/lib/esm/render/primitives/PointCloudPrimitive.d.ts +1 -1
- package/lib/esm/render/primitives/PointCloudPrimitive.d.ts.map +1 -1
- package/lib/esm/render/primitives/PointCloudPrimitive.js.map +1 -1
- package/lib/esm/render/webgl/AttributeBuffers.d.ts +1 -1
- package/lib/esm/render/webgl/AttributeBuffers.d.ts.map +1 -1
- package/lib/esm/render/webgl/AttributeBuffers.js.map +1 -1
- package/lib/esm/render/webgl/PointCloud.js +1 -1
- package/lib/esm/render/webgl/PointCloud.js.map +1 -1
- package/lib/esm/request/Request.d.ts +17 -143
- package/lib/esm/request/Request.d.ts.map +1 -1
- package/lib/esm/request/Request.js +42 -275
- package/lib/esm/request/Request.js.map +1 -1
- package/lib/esm/tile/PntsReader.d.ts +5 -1
- package/lib/esm/tile/PntsReader.d.ts.map +1 -1
- package/lib/esm/tile/PntsReader.js +29 -26
- package/lib/esm/tile/PntsReader.js.map +1 -1
- package/lib/esm/tile/RealityTile.d.ts +12 -5
- package/lib/esm/tile/RealityTile.d.ts.map +1 -1
- package/lib/esm/tile/RealityTile.js +149 -57
- package/lib/esm/tile/RealityTile.js.map +1 -1
- package/lib/esm/tile/RealityTileLoader.d.ts.map +1 -1
- package/lib/esm/tile/RealityTileLoader.js +14 -3
- package/lib/esm/tile/RealityTileLoader.js.map +1 -1
- package/lib/esm/tile/RealityTileTree.d.ts +1 -3
- package/lib/esm/tile/RealityTileTree.d.ts.map +1 -1
- package/lib/esm/tile/RealityTileTree.js +11 -24
- package/lib/esm/tile/RealityTileTree.js.map +1 -1
- package/lib/esm/tile/TileUsageMarker.d.ts +4 -0
- package/lib/esm/tile/TileUsageMarker.d.ts.map +1 -1
- package/lib/esm/tile/TileUsageMarker.js +9 -1
- package/lib/esm/tile/TileUsageMarker.js.map +1 -1
- package/lib/esm/tile/map/ArcGISTileMap.d.ts.map +1 -1
- package/lib/esm/tile/map/ArcGISTileMap.js +1 -5
- package/lib/esm/tile/map/ArcGISTileMap.js.map +1 -1
- package/lib/esm/tile/map/BingElevation.d.ts.map +1 -1
- package/lib/esm/tile/map/BingElevation.js +6 -16
- package/lib/esm/tile/map/BingElevation.js.map +1 -1
- package/lib/esm/tile/map/CesiumTerrainProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/CesiumTerrainProvider.js +12 -18
- package/lib/esm/tile/map/CesiumTerrainProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/BingImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/BingImageryProvider.js +1 -3
- package/lib/esm/tile/map/ImageryProviders/BingImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/MapLayerSources.js +2 -2
- package/lib/esm/tile/map/MapLayerSources.js.map +1 -1
- package/lib/esm/tile/map/MapTile.d.ts +3 -1
- package/lib/esm/tile/map/MapTile.d.ts.map +1 -1
- package/lib/esm/tile/map/MapTile.js +4 -0
- package/lib/esm/tile/map/MapTile.js.map +1 -1
- package/lib/esm/tile/map/WmsCapabilities.d.ts.map +1 -1
- package/lib/esm/tile/map/WmsCapabilities.js +3 -6
- package/lib/esm/tile/map/WmsCapabilities.js.map +1 -1
- package/lib/esm/tile/map/WmtsCapabilities.d.ts.map +1 -1
- package/lib/esm/tile/map/WmtsCapabilities.js +3 -6
- package/lib/esm/tile/map/WmtsCapabilities.js.map +1 -1
- package/lib/esm/tools/ViewTool.d.ts.map +1 -1
- package/lib/esm/tools/ViewTool.js +0 -3
- package/lib/esm/tools/ViewTool.js.map +1 -1
- package/package.json +21 -27
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PntsReader.js","sourceRoot":"","sources":["../../../src/tile/PntsReader.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,sDAAmF;AACnF,wDAAkE;AAClE,oDAA8J;AAC9J,sEAAmE;AAEnE,6EAAgE;AAsEhE,SAAS,cAAc,CAAC,MAAkB,EAAE,UAAkB,EAAE,IAAe;IAC7E,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC;IAChC,MAAM,WAAW,GAAG,CAAC,GAAG,IAAI,CAAC;IAC7B,IAAI,IAAI,CAAC,GAAG;QACV,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,WAAW,EAAE,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAE3F,IAAI,IAAI,CAAC,IAAI,EAAE;QACb,4CAA4C;QAC5C,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC;QACxC,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,WAAW,EAAE,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;QAChG,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,EAAE,CAAC,IAAI,CAAC,EAAE;YACvC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACzB,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACzB,GAAG,CAAC,CAAC,GAAG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AAO,CAAC,CAAC;IACrE,MAAM,QAAQ,GAAG,IAAI,qBAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IACjD,QAAQ,CAAC,GAAG,CAAC,IAAI,qBAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;IACtC,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC;IAE5D,IAAI,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;QAC1C,SAAS,EAAE,KAAK,CAAC,MAAM;QACvB,OAAO,EAAE,KAAK,CAAC,MAAM;QACrB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,QAAQ,EAAE,QAAQ,CAAC,cAAc,EAAE;QACnC,SAAS;QACT,WAAW,EAAE,KAAK;KACnB,EAAE,MAAM,CAAC,CAAC;IAEX,aAAa,GAAG,MAAM,CAAC,WAAW,CAAC,aAAc,EAAE,gCAAkB,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,KAAK,CAAC,CAAC;IACjG,OAAO,aAAa,CAAC;AACvB,CAAC;AAlED,8DAkEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { ByteStream, Id64String, Logger, utf8ToString } from \"@itwin/core-bentley\";\r\nimport { Point3d, Range3d, Vector3d } from \"@itwin/core-geometry\";\r\nimport { BatchType, ElementAlignedBox3d, Feature, FeatureTable, PackedFeatureTable, PntsHeader, QParams3d, QPoint3d, Quantization } from \"@itwin/core-common\";\r\nimport { FrontendLoggerCategory } from \"../FrontendLoggerCategory\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { Mesh } from \"../render/primitives/mesh/MeshPrimitives\";\r\nimport { RenderGraphic } from \"../render/RenderGraphic\";\r\nimport { RenderSystem } from \"../render/RenderSystem\";\r\n\r\n/** Schema for the [3DTILES_draco_point_compression](https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_draco_point_compression) extension. */\r\ninterface DracoPointCloud {\r\n byteLength: number;\r\n byteOffset: number;\r\n /** Each specifies the Id of a compressed attribute. */\r\n properties: {\r\n POSITION?: number; // eslint-disable-line @typescript-eslint/naming-convention\r\n RGB?: number; // eslint-disable-line @typescript-eslint/naming-convention\r\n RGBA?: number; // eslint-disable-line @typescript-eslint/naming-convention\r\n NORMAL?: number; // eslint-disable-line @typescript-eslint/naming-convention\r\n BATCH_ID?: number; // eslint-disable-line @typescript-eslint/naming-convention\r\n /** This is not in the spec but is present in sample data in Cesium's git repository. */\r\n COLOR_0?: number; // eslint-disable-line @typescript-eslint/naming-convention\r\n };\r\n}\r\n\r\ninterface PointCloudProps {\r\n params: QParams3d;\r\n points: Uint16Array;\r\n colors?: Uint8Array;\r\n}\r\n\r\ninterface BinaryBodyReference {\r\n byteOffset: number;\r\n}\r\n\r\n/** [3D tiles specification section 10.3](https://docs.opengeospatial.org/cs/18-053r2/18-053r2.html#199).\r\n * [JSON schema](https://github.com/CesiumGS/3d-tiles/blob/main/specification/schema/pnts.featureTable.schema.json).\r\n */\r\ninterface CommonPntsProps {\r\n POINTS_LENGTH: number; // eslint-disable-line @typescript-eslint/naming-convention\r\n RTC_CENTER?: number[]; // eslint-disable-line @typescript-eslint/naming-convention\r\n CONSTANT_RGBA?: number[]; // eslint-disable-line @typescript-eslint/naming-convention\r\n RGB?: BinaryBodyReference; // eslint-disable-line @typescript-eslint/naming-convention\r\n RGBA?: BinaryBodyReference; // eslint-disable-line @typescript-eslint/naming-convention\r\n RGB565?: BinaryBodyReference; // eslint-disable-line @typescript-eslint/naming-convention\r\n\r\n extensions?: {\r\n \"3DTILES_draco_point_compression\"?: DracoPointCloud; // eslint-disable-line @typescript-eslint/naming-convention\r\n };\r\n\r\n // The following are currently ignored.\r\n NORMAL?: BinaryBodyReference; // eslint-disable-line @typescript-eslint/naming-convention\r\n NORMAL_OCT16P?: BinaryBodyReference; // eslint-disable-line @typescript-eslint/naming-convention\r\n BATCH_ID?: BinaryBodyReference; // eslint-disable-line @typescript-eslint/naming-convention\r\n BATCH_LENGTH?: number; // eslint-disable-line @typescript-eslint/naming-convention\r\n}\r\n\r\ntype QuantizedPntsProps = CommonPntsProps & {\r\n POSITION_QUANTIZED: BinaryBodyReference; // eslint-disable-line @typescript-eslint/naming-convention\r\n QUANTIZED_VOLUME_OFFSET: number[]; // eslint-disable-line @typescript-eslint/naming-convention\r\n QUANTIZED_VOLUME_SCALE: number[]; // eslint-disable-line @typescript-eslint/naming-convention\r\n\r\n POSITION?: never; // eslint-disable-line @typescript-eslint/naming-convention\r\n};\r\n\r\ntype UnquantizedPntsProps = CommonPntsProps & {\r\n POSITION: BinaryBodyReference; // eslint-disable-line @typescript-eslint/naming-convention\r\n\r\n POSITION_QUANTIZED?: never; // eslint-disable-line @typescript-eslint/naming-convention\r\n QUANTIZED_VOLUME_OFFSET?: never; // eslint-disable-line @typescript-eslint/naming-convention\r\n QUANTIZED_VOLUME_SCALE?: never; // eslint-disable-line @typescript-eslint/naming-convention\r\n};\r\n\r\ntype PntsProps = QuantizedPntsProps | UnquantizedPntsProps;\r\n\r\nfunction readPntsColors(stream: ByteStream, dataOffset: number, pnts: PntsProps): Uint8Array | undefined {\r\n const nPts = pnts.POINTS_LENGTH;\r\n const nComponents = 3 * nPts;\r\n if (pnts.RGB)\r\n return new Uint8Array(stream.arrayBuffer, dataOffset + pnts.RGB.byteOffset, nComponents);\r\n\r\n if (pnts.RGBA) {\r\n // ###TODO support point cloud transparency.\r\n const rgb = new Uint8Array(nComponents);\r\n const rgba = new Uint8Array(stream.arrayBuffer, dataOffset + pnts.RGBA.byteOffset, nComponents);\r\n for (let i = 0; i < nComponents; i += 4) {\r\n rgb[i + 0] = rgba[i + 0];\r\n rgb[i + 1] = rgba[i + 1];\r\n rgb[i + 2] = rgba[i + 2];\r\n }\r\n\r\n return rgb;\r\n } else if (pnts.RGB565) {\r\n // Each color is 16 bits: 5 red, 6 green, 5 blue.\r\n const crgb = new Uint16Array(stream.arrayBuffer, dataOffset + pnts.RGB565.byteOffset, nPts);\r\n const rgb = new Uint8Array(nComponents);\r\n for (let i = 0; i < nPts; i++) {\r\n const c = crgb[i];\r\n rgb[i + 0] = (c >> 11) & 0x1f;\r\n rgb[i + 1] = (c >> 5) & 0x3f;\r\n rgb[i + 2] = c & 0x1f;\r\n }\r\n\r\n return rgb;\r\n }\r\n\r\n return undefined;\r\n}\r\n\r\nfunction readPnts(stream: ByteStream, dataOffset: number, pnts: PntsProps): PointCloudProps | undefined {\r\n const nPts = pnts.POINTS_LENGTH;\r\n let params: QParams3d;\r\n let points: Uint16Array;\r\n\r\n if (pnts.POSITION_QUANTIZED) {\r\n const qpos = pnts.POSITION_QUANTIZED;\r\n const offset = pnts.QUANTIZED_VOLUME_OFFSET;\r\n const scale = pnts.QUANTIZED_VOLUME_SCALE;\r\n\r\n const qOrigin = new Point3d(offset[0], offset[1], offset[2]);\r\n const qScale = new Point3d(Quantization.computeScale(scale[0]), Quantization.computeScale(scale[1]), Quantization.computeScale(scale[2]));\r\n\r\n params = QParams3d.fromOriginAndScale(qOrigin, qScale);\r\n points = new Uint16Array(stream.arrayBuffer, dataOffset + qpos.byteOffset, 3 * nPts);\r\n } else {\r\n const nCoords = nPts * 3;\r\n const fpts = new Float32Array(stream.arrayBuffer, dataOffset + pnts.POSITION.byteOffset, 3 * nPts);\r\n const range = Range3d.createNull();\r\n for (let i = 0; i < nCoords; i += 3)\r\n range.extendXYZ(fpts[i], fpts[i + 1], fpts[i + 2]);\r\n\r\n params = QParams3d.fromRange(range);\r\n const qpt = new QPoint3d();\r\n const fpt = new Point3d();\r\n points = new Uint16Array(3 * nPts);\r\n for (let i = 0; i < nCoords; i += 3) {\r\n fpt.set(fpts[i], fpts[i + 1], fpts[i + 2]);\r\n qpt.init(fpt, params);\r\n points[i] = qpt.x;\r\n points[i + 1] = qpt.y;\r\n points[i + 2] = qpt.z;\r\n }\r\n }\r\n\r\n const colors = readPntsColors(stream, dataOffset, pnts);\r\n return { params, points, colors };\r\n}\r\n\r\nasync function decodeDracoPointCloud(buf: Uint8Array): Promise<PointCloudProps | undefined> {\r\n try {\r\n const dracoLoader = (await import(\"@loaders.gl/draco\")).DracoLoader;\r\n const mesh = await dracoLoader.parse(buf, { });\r\n if (mesh.topology !== \"point-list\")\r\n return undefined;\r\n\r\n const pos = mesh.attributes.POSITION?.value;\r\n if (!pos || (pos.length % 3) !== 0)\r\n return undefined;\r\n\r\n let colors = mesh.attributes.RGB?.value ?? mesh.attributes.COLOR_0?.value;\r\n if (!colors) {\r\n // ###TODO support point cloud transparency.\r\n const rgba = mesh.attributes.RGBA?.value;\r\n if (rgba && (rgba.length % 4) === 0) {\r\n // We currently don't support alpha channel for point clouds - strip it.\r\n colors = new Uint8Array(3 * rgba.length / 4);\r\n let j = 0;\r\n for (let i = 0; i < rgba.length; i += 4) {\r\n colors[j++] = rgba[i];\r\n colors[j++] = rgba[i + 1];\r\n colors[j++] = rgba[i + 2];\r\n }\r\n }\r\n }\r\n\r\n let posRange: Range3d;\r\n const bbox = mesh.header?.boundingBox;\r\n if (bbox) {\r\n posRange = Range3d.createXYZXYZ(bbox[0][0], bbox[0][1], bbox[0][2], bbox[1][0], bbox[1][1], bbox[1][2]);\r\n } else {\r\n posRange = Range3d.createNull();\r\n for (let i = 0; i < pos.length; i += 3)\r\n posRange.extendXYZ(pos[i], pos[i + 1], pos[i + 2]);\r\n }\r\n\r\n const params = QParams3d.fromRange(posRange);\r\n const pt = Point3d.createZero();\r\n const qpt = QPoint3d.create(pt, params);\r\n const points = new Uint16Array(pos.length);\r\n for (let i = 0; i < pos.length; i += 3) {\r\n pt.set(pos[i], pos[i + 1], pos[i + 2]);\r\n qpt.init(pt, params);\r\n points[i] = qpt.x;\r\n points[i + 1] = qpt.y;\r\n points[i + 2] = qpt.z;\r\n }\r\n\r\n return { points, params, colors: colors instanceof Uint8Array ? colors : undefined };\r\n } catch (err) {\r\n Logger.logWarning(FrontendLoggerCategory.Render, \"Failed to decode draco-encoded point cloud\");\r\n Logger.logException(FrontendLoggerCategory.Render, err);\r\n return undefined;\r\n }\r\n}\r\n\r\n/** Deserialize a point cloud tile and return it as a RenderGraphic.\r\n * @internal\r\n */\r\nexport async function readPointCloudTileContent(stream: ByteStream, iModel: IModelConnection, modelId: Id64String, _is3d: boolean, range: ElementAlignedBox3d, system: RenderSystem): Promise<RenderGraphic | undefined> {\r\n const header = new PntsHeader(stream);\r\n if (!header.isValid)\r\n return undefined;\r\n\r\n const featureTableJsonOffset = stream.curPos;\r\n const featureStrData = stream.nextBytes(header.featureTableJsonLength);\r\n const featureStr = utf8ToString(featureStrData);\r\n const featureValue = JSON.parse(featureStr as string) as PntsProps;\r\n\r\n if (undefined === featureValue)\r\n return undefined;\r\n\r\n let props: PointCloudProps | undefined;\r\n const dataOffset = featureTableJsonOffset + header.featureTableJsonLength;\r\n const draco = featureValue.extensions ? featureValue.extensions[\"3DTILES_draco_point_compression\"] : undefined;\r\n if (draco) {\r\n try {\r\n const buf = new Uint8Array(stream.arrayBuffer, dataOffset + draco.byteOffset, draco.byteLength);\r\n props = await decodeDracoPointCloud(buf);\r\n } catch (_) {\r\n //\r\n }\r\n } else {\r\n props = readPnts(stream, dataOffset, featureValue);\r\n }\r\n\r\n if (!props)\r\n return undefined;\r\n\r\n if (featureValue.RTC_CENTER)\r\n props.params = QParams3d.fromOriginAndScale(props.params.origin.plus(Vector3d.fromJSON(featureValue.RTC_CENTER)), props.params.scale);\r\n\r\n if (!props.colors) {\r\n // ###TODO we really should support uniform color instead of allocating an RGB value per point...\r\n props.colors = new Uint8Array(3 * featureValue.POINTS_LENGTH);\r\n const rgba = featureValue.CONSTANT_RGBA;\r\n if (rgba) {\r\n // ###TODO support point cloud transparency.\r\n for (let i = 0; i < featureValue.POINTS_LENGTH * 3; i += 3) {\r\n props.colors[i] = rgba[0];\r\n props.colors[i + 1] = rgba[1];\r\n props.colors[i + 2] = rgba[2];\r\n }\r\n } else {\r\n // Default to white.\r\n props.colors.fill(0xff, 0, props.colors.length);\r\n }\r\n }\r\n\r\n const featureTable = new FeatureTable(1, modelId, BatchType.Primary);\r\n const features = new Mesh.Features(featureTable);\r\n features.add(new Feature(modelId), 1);\r\n const voxelSize = props.params.rangeDiagonal.maxAbs() / 256;\r\n\r\n let renderGraphic = system.createPointCloud({\r\n positions: props.points,\r\n qparams: props.params,\r\n colors: props.colors,\r\n features: features.toFeatureIndex(),\r\n voxelSize,\r\n colorFormat: \"rgb\",\r\n }, iModel);\r\n\r\n renderGraphic = system.createBatch(renderGraphic!, PackedFeatureTable.pack(featureTable), range);\r\n return renderGraphic;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"PntsReader.js","sourceRoot":"","sources":["../../../src/tile/PntsReader.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,sDAAmF;AACnF,wDAAwD;AACxD,oDAA8J;AAC9J,sEAAmE;AAEnE,6EAAgE;AAsEhE,SAAS,cAAc,CAAC,MAAkB,EAAE,UAAkB,EAAE,IAAe;IAC7E,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC;IAChC,MAAM,WAAW,GAAG,CAAC,GAAG,IAAI,CAAC;IAC7B,IAAI,IAAI,CAAC,GAAG;QACV,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,WAAW,EAAE,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAE3F,IAAI,IAAI,CAAC,IAAI,EAAE;QACb,4CAA4C;QAC5C,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC;QACxC,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,WAAW,EAAE,UAAU,GAAG,I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AI,KAAK,CAAC,MAAM,YAAY,YAAY,EAAE;QACxC,oFAAoF;QACpF,MAAM,GAAG,GAAG,uBAAO,CAAC,UAAU,EAAE,CAAC;QACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC;YAC7C,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC3E,MAAM,GAAG,uBAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;KACnC;IACD,MAAM,SAAS,GAAG,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC;IAEtD,OAAO,GAAG,MAAM,CAAC,gBAAgB,CAAC;QAChC,SAAS,EAAE,KAAK,CAAC,MAAM;QACvB,OAAO,EAAE,KAAK,CAAC,MAAM;QACrB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,QAAQ,EAAE,QAAQ,CAAC,cAAc,EAAE;QACnC,SAAS;QACT,WAAW,EAAE,KAAK;KACnB,EAAE,MAAM,CAAC,CAAC;IAEX,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,OAAQ,EAAE,gCAAkB,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,UAAU,CAAC,CAAC;IAC1F,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AAChC,CAAC;AAjFD,8DAiFC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { ByteStream, Id64String, Logger, utf8ToString } from \"@itwin/core-bentley\";\r\nimport { Point3d, Range3d } from \"@itwin/core-geometry\";\r\nimport { BatchType, ElementAlignedBox3d, Feature, FeatureTable, PackedFeatureTable, PntsHeader, QParams3d, QPoint3d, Quantization } from \"@itwin/core-common\";\r\nimport { FrontendLoggerCategory } from \"../FrontendLoggerCategory\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { Mesh } from \"../render/primitives/mesh/MeshPrimitives\";\r\nimport { RenderGraphic } from \"../render/RenderGraphic\";\r\nimport { RenderSystem } from \"../render/RenderSystem\";\r\n\r\n/** Schema for the [3DTILES_draco_point_compression](https://github.com/CesiumGS/3d-tiles/tree/main/extensions/3DTILES_draco_point_compression) extension. */\r\ninterface DracoPointCloud {\r\n byteLength: number;\r\n byteOffset: number;\r\n /** Each specifies the Id of a compressed attribute. */\r\n properties: {\r\n POSITION?: number; // eslint-disable-line @typescript-eslint/naming-convention\r\n RGB?: number; // eslint-disable-line @typescript-eslint/naming-convention\r\n RGBA?: number; // eslint-disable-line @typescript-eslint/naming-convention\r\n NORMAL?: number; // eslint-disable-line @typescript-eslint/naming-convention\r\n BATCH_ID?: number; // eslint-disable-line @typescript-eslint/naming-convention\r\n /** This is not in the spec but is present in sample data in Cesium's git repository. */\r\n COLOR_0?: number; // eslint-disable-line @typescript-eslint/naming-convention\r\n };\r\n}\r\n\r\ninterface PointCloudProps {\r\n params: QParams3d;\r\n points: Uint16Array | Float32Array;\r\n colors?: Uint8Array;\r\n}\r\n\r\ninterface BinaryBodyReference {\r\n byteOffset: number;\r\n}\r\n\r\n/** [3D tiles specification section 10.3](https://docs.opengeospatial.org/cs/18-053r2/18-053r2.html#199).\r\n * [JSON schema](https://github.com/CesiumGS/3d-tiles/blob/main/specification/schema/pnts.featureTable.schema.json).\r\n */\r\ninterface CommonPntsProps {\r\n POINTS_LENGTH: number; // eslint-disable-line @typescript-eslint/naming-convention\r\n RTC_CENTER?: number[]; // eslint-disable-line @typescript-eslint/naming-convention\r\n CONSTANT_RGBA?: number[]; // eslint-disable-line @typescript-eslint/naming-convention\r\n RGB?: BinaryBodyReference; // eslint-disable-line @typescript-eslint/naming-convention\r\n RGBA?: BinaryBodyReference; // eslint-disable-line @typescript-eslint/naming-convention\r\n RGB565?: BinaryBodyReference; // eslint-disable-line @typescript-eslint/naming-convention\r\n\r\n extensions?: {\r\n \"3DTILES_draco_point_compression\"?: DracoPointCloud; // eslint-disable-line @typescript-eslint/naming-convention\r\n };\r\n\r\n // The following are currently ignored.\r\n NORMAL?: BinaryBodyReference; // eslint-disable-line @typescript-eslint/naming-convention\r\n NORMAL_OCT16P?: BinaryBodyReference; // eslint-disable-line @typescript-eslint/naming-convention\r\n BATCH_ID?: BinaryBodyReference; // eslint-disable-line @typescript-eslint/naming-convention\r\n BATCH_LENGTH?: number; // eslint-disable-line @typescript-eslint/naming-convention\r\n}\r\n\r\ntype QuantizedPntsProps = CommonPntsProps & {\r\n POSITION_QUANTIZED: BinaryBodyReference; // eslint-disable-line @typescript-eslint/naming-convention\r\n QUANTIZED_VOLUME_OFFSET: number[]; // eslint-disable-line @typescript-eslint/naming-convention\r\n QUANTIZED_VOLUME_SCALE: number[]; // eslint-disable-line @typescript-eslint/naming-convention\r\n\r\n POSITION?: never; // eslint-disable-line @typescript-eslint/naming-convention\r\n};\r\n\r\ntype UnquantizedPntsProps = CommonPntsProps & {\r\n POSITION: BinaryBodyReference; // eslint-disable-line @typescript-eslint/naming-convention\r\n\r\n POSITION_QUANTIZED?: never; // eslint-disable-line @typescript-eslint/naming-convention\r\n QUANTIZED_VOLUME_OFFSET?: never; // eslint-disable-line @typescript-eslint/naming-convention\r\n QUANTIZED_VOLUME_SCALE?: never; // eslint-disable-line @typescript-eslint/naming-convention\r\n};\r\n\r\ntype PntsProps = QuantizedPntsProps | UnquantizedPntsProps;\r\n\r\nfunction readPntsColors(stream: ByteStream, dataOffset: number, pnts: PntsProps): Uint8Array | undefined {\r\n const nPts = pnts.POINTS_LENGTH;\r\n const nComponents = 3 * nPts;\r\n if (pnts.RGB)\r\n return new Uint8Array(stream.arrayBuffer, dataOffset + pnts.RGB.byteOffset, nComponents);\r\n\r\n if (pnts.RGBA) {\r\n // ###TODO support point cloud transparency.\r\n const rgb = new Uint8Array(nComponents);\r\n const rgba = new Uint8Array(stream.arrayBuffer, dataOffset + pnts.RGBA.byteOffset, nComponents);\r\n for (let i = 0; i < nComponents; i += 4) {\r\n rgb[i + 0] = rgba[i + 0];\r\n rgb[i + 1] = rgba[i + 1];\r\n rgb[i + 2] = rgba[i + 2];\r\n }\r\n\r\n return rgb;\r\n } else if (pnts.RGB565) {\r\n // Each color is 16 bits: 5 red, 6 green, 5 blue.\r\n const crgb = new Uint16Array(stream.arrayBuffer, dataOffset + pnts.RGB565.byteOffset, nPts);\r\n const rgb = new Uint8Array(nComponents);\r\n for (let i = 0; i < nPts; i++) {\r\n const c = crgb[i];\r\n rgb[i + 0] = (c >> 11) & 0x1f;\r\n rgb[i + 1] = (c >> 5) & 0x3f;\r\n rgb[i + 2] = c & 0x1f;\r\n }\r\n\r\n return rgb;\r\n }\r\n\r\n return undefined;\r\n}\r\n\r\nfunction readPnts(stream: ByteStream, dataOffset: number, pnts: PntsProps): PointCloudProps | undefined {\r\n const nPts = pnts.POINTS_LENGTH;\r\n let params: QParams3d;\r\n let points: Uint16Array | Float32Array;\r\n\r\n if (pnts.POSITION_QUANTIZED) {\r\n const qpos = pnts.POSITION_QUANTIZED;\r\n const offset = pnts.QUANTIZED_VOLUME_OFFSET;\r\n const scale = pnts.QUANTIZED_VOLUME_SCALE;\r\n\r\n const qOrigin = new Point3d(offset[0], offset[1], offset[2]);\r\n const qScale = new Point3d(Quantization.computeScale(scale[0]), Quantization.computeScale(scale[1]), Quantization.computeScale(scale[2]));\r\n\r\n params = QParams3d.fromOriginAndScale(qOrigin, qScale);\r\n points = new Uint16Array(stream.arrayBuffer, dataOffset + qpos.byteOffset, 3 * nPts);\r\n } else {\r\n const qOrigin = new Point3d(0, 0, 0);\r\n const qScale = new Point3d(1, 1, 1);\r\n params = QParams3d.fromOriginAndScale(qOrigin, qScale);\r\n points = new Float32Array(stream.arrayBuffer, dataOffset + pnts.POSITION.byteOffset, 3 * nPts);\r\n }\r\n\r\n const colors = readPntsColors(stream, dataOffset, pnts);\r\n return { params, points, colors };\r\n}\r\n\r\nasync function decodeDracoPointCloud(buf: Uint8Array): Promise<PointCloudProps | undefined> {\r\n try {\r\n const dracoLoader = (await import(\"@loaders.gl/draco\")).DracoLoader;\r\n const mesh = await dracoLoader.parse(buf, {});\r\n if (mesh.topology !== \"point-list\")\r\n return undefined;\r\n\r\n const pos = mesh.attributes.POSITION?.value;\r\n if (!pos || (pos.length % 3) !== 0)\r\n return undefined;\r\n\r\n let colors = mesh.attributes.RGB?.value ?? mesh.attributes.COLOR_0?.value;\r\n if (!colors) {\r\n // ###TODO support point cloud transparency.\r\n const rgba = mesh.attributes.RGBA?.value;\r\n if (rgba && (rgba.length % 4) === 0) {\r\n // We currently don't support alpha channel for point clouds - strip it.\r\n colors = new Uint8Array(3 * rgba.length / 4);\r\n let j = 0;\r\n for (let i = 0; i < rgba.length; i += 4) {\r\n colors[j++] = rgba[i];\r\n colors[j++] = rgba[i + 1];\r\n colors[j++] = rgba[i + 2];\r\n }\r\n }\r\n }\r\n\r\n let posRange: Range3d;\r\n const bbox = mesh.header?.boundingBox;\r\n if (bbox) {\r\n posRange = Range3d.createXYZXYZ(bbox[0][0], bbox[0][1], bbox[0][2], bbox[1][0], bbox[1][1], bbox[1][2]);\r\n } else {\r\n posRange = Range3d.createNull();\r\n for (let i = 0; i < pos.length; i += 3)\r\n posRange.extendXYZ(pos[i], pos[i + 1], pos[i + 2]);\r\n }\r\n\r\n const params = QParams3d.fromRange(posRange);\r\n const pt = Point3d.createZero();\r\n const qpt = QPoint3d.create(pt, params);\r\n const points = new Uint16Array(pos.length);\r\n for (let i = 0; i < pos.length; i += 3) {\r\n pt.set(pos[i], pos[i + 1], pos[i + 2]);\r\n qpt.init(pt, params);\r\n points[i] = qpt.x;\r\n points[i + 1] = qpt.y;\r\n points[i + 2] = qpt.z;\r\n }\r\n\r\n return { points, params, colors: colors instanceof Uint8Array ? colors : undefined };\r\n } catch (err) {\r\n Logger.logWarning(FrontendLoggerCategory.Render, \"Failed to decode draco-encoded point cloud\");\r\n Logger.logException(FrontendLoggerCategory.Render, err);\r\n return undefined;\r\n }\r\n}\r\n\r\n/** Deserialize a point cloud tile and return it as a RenderGraphic.\r\n * @internal\r\n */\r\nexport async function readPointCloudTileContent(stream: ByteStream, iModel: IModelConnection, modelId: Id64String, _is3d: boolean, range: ElementAlignedBox3d, system: RenderSystem): Promise<{ graphic: RenderGraphic | undefined, rtcCenter: Point3d | undefined }> {\r\n let graphic;\r\n let rtcCenter;\r\n const header = new PntsHeader(stream);\r\n if (!header.isValid)\r\n return { graphic, rtcCenter };\r\n\r\n const featureTableJsonOffset = stream.curPos;\r\n const featureStrData = stream.nextBytes(header.featureTableJsonLength);\r\n const featureStr = utf8ToString(featureStrData);\r\n const featureValue = JSON.parse(featureStr as string) as PntsProps;\r\n\r\n if (undefined === featureValue)\r\n return { graphic, rtcCenter };\r\n\r\n let props: PointCloudProps | undefined;\r\n const dataOffset = featureTableJsonOffset + header.featureTableJsonLength;\r\n const draco = featureValue.extensions ? featureValue.extensions[\"3DTILES_draco_point_compression\"] : undefined;\r\n if (draco) {\r\n try {\r\n const buf = new Uint8Array(stream.arrayBuffer, dataOffset + draco.byteOffset, draco.byteLength);\r\n props = await decodeDracoPointCloud(buf);\r\n } catch (_) {\r\n //\r\n }\r\n } else {\r\n props = readPnts(stream, dataOffset, featureValue);\r\n }\r\n\r\n if (!props)\r\n return { graphic, rtcCenter };\r\n\r\n let batchRange = range;\r\n if (featureValue.RTC_CENTER) {\r\n rtcCenter = Point3d.fromJSON(featureValue.RTC_CENTER);\r\n batchRange = range.clone();\r\n batchRange.low.minus(rtcCenter, batchRange.low);\r\n batchRange.high.minus(rtcCenter, batchRange.high);\r\n }\r\n\r\n if (!props.colors) {\r\n // ###TODO we really should support uniform color instead of allocating an RGB value per point...\r\n props.colors = new Uint8Array(3 * featureValue.POINTS_LENGTH);\r\n const rgba = featureValue.CONSTANT_RGBA;\r\n if (rgba) {\r\n // ###TODO support point cloud transparency.\r\n for (let i = 0; i < featureValue.POINTS_LENGTH * 3; i += 3) {\r\n props.colors[i] = rgba[0];\r\n props.colors[i + 1] = rgba[1];\r\n props.colors[i + 2] = rgba[2];\r\n }\r\n } else {\r\n // Default to white.\r\n props.colors.fill(0xff, 0, props.colors.length);\r\n }\r\n }\r\n\r\n const featureTable = new FeatureTable(1, modelId, BatchType.Primary);\r\n const features = new Mesh.Features(featureTable);\r\n features.add(new Feature(modelId), 1);\r\n let params = props.params;\r\n if (props.points instanceof Float32Array) {\r\n // we don't have a true range for unquantized points, so calc one here for voxelSize\r\n const rng = Range3d.createNull();\r\n for (let i = 0; i < props.points.length; i += 3)\r\n rng.extendXYZ(props.points[i], props.points[i + 1], props.points[i + 2]);\r\n params = QParams3d.fromRange(rng);\r\n }\r\n const voxelSize = params.rangeDiagonal.maxAbs() / 256;\r\n\r\n graphic = system.createPointCloud({\r\n positions: props.points,\r\n qparams: props.params,\r\n colors: props.colors,\r\n features: features.toFeatureIndex(),\r\n voxelSize,\r\n colorFormat: \"rgb\",\r\n }, iModel);\r\n\r\n graphic = system.createBatch(graphic!, PackedFeatureTable.pack(featureTable), batchRange);\r\n return { graphic, rtcCenter };\r\n}\r\n"]}
|
|
@@ -103,7 +103,7 @@ export declare class RealityTile extends Tile {
|
|
|
103
103
|
/** @internal */
|
|
104
104
|
preloadRealityTilesAtDepth(depth: number, context: TraversalSelectionContext, args: TileDrawArgs): void;
|
|
105
105
|
/** @internal */
|
|
106
|
-
|
|
106
|
+
preloadProtectedTiles(args: TileDrawArgs, context: TraversalSelectionContext): boolean;
|
|
107
107
|
/** @internal */
|
|
108
108
|
addBoundingGraphic(builder: GraphicBuilder, color: ColorDef): void;
|
|
109
109
|
/** @internal */
|
|
@@ -113,15 +113,22 @@ export declare class RealityTile extends Tile {
|
|
|
113
113
|
/** @internal */
|
|
114
114
|
protected getLoadedRealityChildren(args: TileDrawArgs): boolean;
|
|
115
115
|
/** @internal */
|
|
116
|
-
forceSelectRealityTile(): boolean;
|
|
116
|
+
protected forceSelectRealityTile(): boolean;
|
|
117
|
+
/** @internal */
|
|
118
|
+
protected minimumVisibleFactor(): number;
|
|
117
119
|
/** @internal */
|
|
118
120
|
selectRealityTiles(context: TraversalSelectionContext, args: TileDrawArgs, traversalDetails: TraversalDetails): void;
|
|
119
121
|
/** @internal */
|
|
120
|
-
|
|
122
|
+
protected selectRealityChildrenAsFallback(context: TraversalSelectionContext, args: TileDrawArgs, traversalDetails: TraversalDetails): void;
|
|
121
123
|
/** @internal */
|
|
122
|
-
|
|
124
|
+
protected selectRealityChildren(context: TraversalSelectionContext, args: TileDrawArgs, traversalDetails: TraversalDetails): void;
|
|
125
|
+
/** @internal */
|
|
126
|
+
purgeContents(olderThan: BeTimePoint, useProtectedTiles: boolean): void;
|
|
127
|
+
private getTilesToPurge;
|
|
128
|
+
private getTilesToPurgeWithoutProtection;
|
|
129
|
+
private removeFirstDisplayableChildrenFromSet;
|
|
123
130
|
/** @internal */
|
|
124
|
-
|
|
131
|
+
computeVisibilityFactor(args: TileDrawArgs): number;
|
|
125
132
|
/** @internal */
|
|
126
133
|
protected get _anyChildNotFound(): boolean;
|
|
127
134
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RealityTile.d.ts","sourceRoot":"","sources":["../../../src/tile/RealityTile.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAW,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAqC,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACnH,OAAO,EAAE,QAAQ,EAAW,MAAM,oBAAoB,CAAC;AAGvD,OAAO,EAAE,cAAc,EAAE,MAAM,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,7 +28,7 @@ class RealityTile extends internal_1.Tile {
|
|
|
28
28
|
super(props, tree);
|
|
29
29
|
this._everDisplayed = false;
|
|
30
30
|
this.transformToRoot = props.transformToRoot;
|
|
31
|
-
this.additiveRefinement =
|
|
31
|
+
this.additiveRefinement = props.additiveRefinement ?? this.realityParent?.additiveRefinement;
|
|
32
32
|
this.noContentButTerminateOnSelection = props.noContentButTerminateOnSelection;
|
|
33
33
|
this.rangeCorners = props.rangeCorners;
|
|
34
34
|
this.region = props.region;
|
|
@@ -143,21 +143,31 @@ class RealityTile extends internal_1.Tile {
|
|
|
143
143
|
child.preloadRealityTilesAtDepth(depth, context, args);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
+
// Preload tiles that are protected:
|
|
147
|
+
// * used tiles (where "used" may mean: selected/preloaded for display or content requested);
|
|
148
|
+
// * parents and siblings of other protected tiles.
|
|
146
149
|
/** @internal */
|
|
147
|
-
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
preloadProtectedTiles(args, context) {
|
|
151
|
+
const children = this.realityChildren;
|
|
152
|
+
let hasProtectedChildren = false;
|
|
153
|
+
if (children && !this.additiveRefinement) {
|
|
154
|
+
for (const child of children) {
|
|
155
|
+
hasProtectedChildren = child.preloadProtectedTiles(args, context) || hasProtectedChildren;
|
|
156
|
+
}
|
|
153
157
|
}
|
|
154
|
-
if (
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
if (children && hasProtectedChildren) {
|
|
159
|
+
for (const child of children) {
|
|
160
|
+
if (child.isDisplayable && !child.isLoaded)
|
|
161
|
+
context.preload(child, args);
|
|
162
|
+
}
|
|
163
|
+
return true; // Parents of protected tiles are protected
|
|
160
164
|
}
|
|
165
|
+
// Special case of the root tile
|
|
166
|
+
if (this === this.realityRoot.rootTile) {
|
|
167
|
+
context.preload(this, args);
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
return context.selected.find((tile) => tile === this) !== undefined;
|
|
161
171
|
}
|
|
162
172
|
/** @internal */
|
|
163
173
|
addBoundingGraphic(builder, color) {
|
|
@@ -194,55 +204,157 @@ class RealityTile extends internal_1.Tile {
|
|
|
194
204
|
if (child.isReady && child.computeVisibilityFactor(args) > 0) {
|
|
195
205
|
scratchLoadedChildren.push(child);
|
|
196
206
|
}
|
|
197
|
-
else if (!child.getLoadedRealityChildren(args))
|
|
207
|
+
else if (!child.getLoadedRealityChildren(args)) {
|
|
198
208
|
return false;
|
|
209
|
+
}
|
|
199
210
|
}
|
|
200
211
|
return true;
|
|
201
212
|
}
|
|
202
213
|
/** @internal */
|
|
203
214
|
forceSelectRealityTile() { return false; }
|
|
204
215
|
/** @internal */
|
|
216
|
+
minimumVisibleFactor() {
|
|
217
|
+
if (this.additiveRefinement)
|
|
218
|
+
return 0.25;
|
|
219
|
+
else
|
|
220
|
+
return 0;
|
|
221
|
+
}
|
|
222
|
+
/** @internal */
|
|
205
223
|
selectRealityTiles(context, args, traversalDetails) {
|
|
206
224
|
const visibility = this.computeVisibilityFactor(args);
|
|
207
|
-
|
|
225
|
+
const isNotVisible = visibility < 0;
|
|
226
|
+
if (isNotVisible)
|
|
208
227
|
return;
|
|
228
|
+
// Force loading if loader requires this tile. (cesium terrain visibility).
|
|
209
229
|
if (this.realityRoot.loader.forceTileLoad(this) && !this.isReady) {
|
|
210
|
-
context.selectOrQueue(this, args, traversalDetails);
|
|
230
|
+
context.selectOrQueue(this, args, traversalDetails);
|
|
211
231
|
return;
|
|
212
232
|
}
|
|
233
|
+
// Force to return early without selecting
|
|
213
234
|
if (visibility >= 1 && this.noContentButTerminateOnSelection)
|
|
214
235
|
return;
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
236
|
+
const shouldSelectThisTile = visibility >= 1 || this._anyChildNotFound || this.forceSelectRealityTile() || context.selectionCountExceeded;
|
|
237
|
+
if (shouldSelectThisTile && this.isDisplayable) { // Select this tile
|
|
238
|
+
// Return early if tile is totally occluded
|
|
239
|
+
if (this.isOccluded(args.viewingSpace))
|
|
240
|
+
return;
|
|
241
|
+
// Attempt to select this tile. If not ready, queue it
|
|
242
|
+
context.selectOrQueue(this, args, traversalDetails);
|
|
243
|
+
// This tile is visible but not loaded - Use higher resolution children if present
|
|
244
|
+
if (!this.isReady)
|
|
245
|
+
this.selectRealityChildrenAsFallback(context, args, traversalDetails);
|
|
224
246
|
}
|
|
225
|
-
else {
|
|
247
|
+
else { // Select children instead of this tile
|
|
248
|
+
// With additive refinement it is necessary to display this tile along with any displayed children
|
|
226
249
|
if (this.additiveRefinement && this.isDisplayable && !this.useAdditiveRefinementStepchildren())
|
|
227
|
-
context.selectOrQueue(this, args, traversalDetails);
|
|
250
|
+
context.selectOrQueue(this, args, traversalDetails);
|
|
228
251
|
this.selectRealityChildren(context, args, traversalDetails);
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
252
|
+
// Children are not ready: use this tile to avoid leaving a hole
|
|
253
|
+
traversalDetails.shouldSelectParent = traversalDetails.shouldSelectParent || traversalDetails.queuedChildren.length !== 0;
|
|
254
|
+
if (traversalDetails.shouldSelectParent) {
|
|
255
|
+
// If the tile has not yet been displayed in this viewport -- display only if it is visible enough. Avoid overly tiles popping into view unexpectedly (terrain)
|
|
256
|
+
if (visibility > this.minimumVisibleFactor() || this._everDisplayed) {
|
|
232
257
|
context.selectOrQueue(this, args, traversalDetails);
|
|
258
|
+
}
|
|
233
259
|
}
|
|
234
260
|
}
|
|
235
261
|
}
|
|
262
|
+
// Attempt to select the children of a tile in case they could be displayed while this tile is loading. This does not take into account visibility.
|
|
236
263
|
/** @internal */
|
|
237
|
-
|
|
238
|
-
|
|
264
|
+
selectRealityChildrenAsFallback(context, args, traversalDetails) {
|
|
265
|
+
const childrenReady = this.getLoadedRealityChildren(args);
|
|
266
|
+
if (childrenReady) {
|
|
267
|
+
context.select(scratchLoadedChildren, args);
|
|
268
|
+
traversalDetails.shouldSelectParent = false;
|
|
269
|
+
}
|
|
270
|
+
scratchLoadedChildren.length = 0;
|
|
271
|
+
}
|
|
272
|
+
// Recurse through children to select them normally
|
|
273
|
+
/** @internal */
|
|
274
|
+
selectRealityChildren(context, args, traversalDetails) {
|
|
275
|
+
// Load children if not yet requested
|
|
276
|
+
const childrenLoadStatus = this.loadChildren(); // NB: asynchronous
|
|
277
|
+
// Children are not ready yet
|
|
278
|
+
if (childrenLoadStatus === internal_1.TileTreeLoadStatus.Loading) {
|
|
279
|
+
args.markChildrenLoading();
|
|
280
|
+
traversalDetails.shouldSelectParent = true;
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
if (this.realityChildren !== undefined) {
|
|
284
|
+
// Attempt to select the children
|
|
285
|
+
const traversalChildren = this.realityRoot.getTraversalChildren(this.depth);
|
|
286
|
+
traversalChildren.initialize();
|
|
287
|
+
for (let i = 0; i < this.children.length; i++)
|
|
288
|
+
this.realityChildren[i].selectRealityTiles(context, args, traversalChildren.getChildDetail(i));
|
|
289
|
+
traversalChildren.combine(traversalDetails);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
/** @internal */
|
|
293
|
+
purgeContents(olderThan, useProtectedTiles) {
|
|
294
|
+
const tilesToPurge = new Set();
|
|
295
|
+
// Get the list of tiles to purge
|
|
296
|
+
if (useProtectedTiles && !this.additiveRefinement)
|
|
297
|
+
this.getTilesToPurge(olderThan, tilesToPurge);
|
|
298
|
+
else
|
|
299
|
+
this.getTilesToPurgeWithoutProtection(olderThan, tilesToPurge);
|
|
300
|
+
// Discard contents of tiles that have been marked.
|
|
239
301
|
// Note we do not discard the child Tile objects themselves.
|
|
240
|
-
|
|
241
|
-
|
|
302
|
+
for (const tile of tilesToPurge)
|
|
303
|
+
tile.disposeContents();
|
|
304
|
+
}
|
|
305
|
+
// Populate a set with tiles that should be disposed. Prevent some tiles to be disposed to avoid holes when moving.
|
|
306
|
+
// Return true if the current tile is "protected".
|
|
307
|
+
getTilesToPurge(olderThan, tilesToPurge) {
|
|
308
|
+
const children = this.realityChildren;
|
|
309
|
+
// Protected tiles cannot be purged. They are:
|
|
310
|
+
// * used tiles (where "used" may mean: selected/preloaded for display or content requested);
|
|
311
|
+
// * parents and siblings of other protected tiles.
|
|
312
|
+
let hasProtectedChildren = false;
|
|
313
|
+
if (children) {
|
|
314
|
+
for (const child of children) {
|
|
315
|
+
hasProtectedChildren = child.getTilesToPurge(olderThan, tilesToPurge) || hasProtectedChildren;
|
|
316
|
+
}
|
|
317
|
+
if (hasProtectedChildren) {
|
|
318
|
+
// Siblings of protected tiles are protected too. We need to remove them from it
|
|
319
|
+
for (const child of children) {
|
|
320
|
+
// Because the current tile can be invisible, relying on its children to display geometry,
|
|
321
|
+
// we have to recurse in order to remove the first children that has geometry, otherwise,
|
|
322
|
+
// some holes might appear
|
|
323
|
+
child.removeFirstDisplayableChildrenFromSet(tilesToPurge);
|
|
324
|
+
}
|
|
325
|
+
return true; // Parents of protected tiles are protected
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
const isInUse = this.usageMarker.getIsTileInUse();
|
|
329
|
+
if (!isInUse && this.usageMarker.isTimestampExpired(olderThan)) {
|
|
330
|
+
tilesToPurge.add(this);
|
|
331
|
+
}
|
|
332
|
+
return isInUse;
|
|
333
|
+
}
|
|
334
|
+
// Populate a set with tiles that should be disposed. Does not prevent some tiles to be disposed to avoid holes when moving.
|
|
335
|
+
// This method is simpler and more fitting for devices that has a bigger memory constraint, such as mobiles.
|
|
336
|
+
// However, it causes the apparition of holes by letting important tiles to be purged.
|
|
337
|
+
getTilesToPurgeWithoutProtection(olderThan, tilesToPurge) {
|
|
242
338
|
const children = this.realityChildren;
|
|
243
|
-
if (children)
|
|
244
|
-
for (const child of children)
|
|
245
|
-
child.
|
|
339
|
+
if (children) {
|
|
340
|
+
for (const child of children) {
|
|
341
|
+
child.getTilesToPurgeWithoutProtection(olderThan, tilesToPurge);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
if (this.usageMarker.isExpired(olderThan))
|
|
345
|
+
tilesToPurge.add(this);
|
|
346
|
+
}
|
|
347
|
+
removeFirstDisplayableChildrenFromSet(set) {
|
|
348
|
+
if (set.size === 0)
|
|
349
|
+
return;
|
|
350
|
+
if (this.isDisplayable) {
|
|
351
|
+
set.delete(this);
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
if (this.realityChildren !== undefined) {
|
|
355
|
+
for (const child of this.realityChildren)
|
|
356
|
+
child.removeFirstDisplayableChildrenFromSet(set);
|
|
357
|
+
}
|
|
246
358
|
}
|
|
247
359
|
/** @internal */
|
|
248
360
|
computeVisibilityFactor(args) {
|
|
@@ -269,26 +381,6 @@ class RealityTile extends internal_1.Tile {
|
|
|
269
381
|
return this.maximumSize / args.getPixelSize(this);
|
|
270
382
|
}
|
|
271
383
|
/** @internal */
|
|
272
|
-
preloadTilesInFrustum(args, context, preloadSizeModifier) {
|
|
273
|
-
const visibility = this.computeVisibilityFactor(args);
|
|
274
|
-
if (visibility < 0)
|
|
275
|
-
return;
|
|
276
|
-
if (visibility * preloadSizeModifier > 1) {
|
|
277
|
-
if (this.isDisplayable)
|
|
278
|
-
context.preload(this, args);
|
|
279
|
-
}
|
|
280
|
-
else {
|
|
281
|
-
const childrenLoadStatus = this.loadChildren(); // NB: asynchronous
|
|
282
|
-
if (internal_1.TileTreeLoadStatus.Loading === childrenLoadStatus) {
|
|
283
|
-
args.markChildrenLoading();
|
|
284
|
-
}
|
|
285
|
-
else if (undefined !== this.realityChildren) {
|
|
286
|
-
for (const child of this.realityChildren)
|
|
287
|
-
child.preloadTilesInFrustum(args, context, preloadSizeModifier);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
/** @internal */
|
|
292
384
|
get _anyChildNotFound() {
|
|
293
385
|
if (undefined !== this.children)
|
|
294
386
|
for (const child of this.children)
|