@itwin/core-frontend 3.6.0-dev.41 → 3.6.0-dev.45

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 (70) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/lib/cjs/IModelApp.d.ts +3 -3
  3. package/lib/cjs/IModelApp.d.ts.map +1 -1
  4. package/lib/cjs/IModelApp.js +1 -1
  5. package/lib/cjs/IModelApp.js.map +1 -1
  6. package/lib/cjs/ViewContext.js +1 -1
  7. package/lib/cjs/ViewContext.js.map +1 -1
  8. package/lib/cjs/ViewState.d.ts +4 -5
  9. package/lib/cjs/ViewState.d.ts.map +1 -1
  10. package/lib/cjs/ViewState.js +0 -1
  11. package/lib/cjs/ViewState.js.map +1 -1
  12. package/lib/cjs/Viewport.d.ts +0 -1
  13. package/lib/cjs/Viewport.d.ts.map +1 -1
  14. package/lib/cjs/Viewport.js +0 -1
  15. package/lib/cjs/Viewport.js.map +1 -1
  16. package/lib/cjs/extension/ExtensionRuntime.js +1 -0
  17. package/lib/cjs/extension/ExtensionRuntime.js.map +1 -1
  18. package/lib/cjs/render/VisibleFeature.d.ts +5 -5
  19. package/lib/cjs/render/VisibleFeature.js.map +1 -1
  20. package/lib/cjs/render/webgl/BackgroundMapDrape.js +1 -1
  21. package/lib/cjs/render/webgl/BackgroundMapDrape.js.map +1 -1
  22. package/lib/cjs/render/webgl/PlanarClassifier.d.ts.map +1 -1
  23. package/lib/cjs/render/webgl/PlanarClassifier.js +2 -1
  24. package/lib/cjs/render/webgl/PlanarClassifier.js.map +1 -1
  25. package/lib/cjs/render/webgl/PlanarTextureProjection.js +1 -1
  26. package/lib/cjs/render/webgl/PlanarTextureProjection.js.map +1 -1
  27. package/lib/cjs/render/webgl/RenderCommands.js +1 -1
  28. package/lib/cjs/render/webgl/RenderCommands.js.map +1 -1
  29. package/lib/cjs/render/webgl/SolarShadowMap.js +1 -1
  30. package/lib/cjs/render/webgl/SolarShadowMap.js.map +1 -1
  31. package/lib/cjs/tile/RealityTileTree.d.ts.map +1 -1
  32. package/lib/cjs/tile/RealityTileTree.js +1 -3
  33. package/lib/cjs/tile/RealityTileTree.js.map +1 -1
  34. package/lib/cjs/tile/TileDrawArgs.js +1 -1
  35. package/lib/cjs/tile/TileDrawArgs.js.map +1 -1
  36. package/lib/esm/IModelApp.d.ts +3 -3
  37. package/lib/esm/IModelApp.d.ts.map +1 -1
  38. package/lib/esm/IModelApp.js +1 -1
  39. package/lib/esm/IModelApp.js.map +1 -1
  40. package/lib/esm/ViewContext.js +1 -1
  41. package/lib/esm/ViewContext.js.map +1 -1
  42. package/lib/esm/ViewState.d.ts +4 -5
  43. package/lib/esm/ViewState.d.ts.map +1 -1
  44. package/lib/esm/ViewState.js +0 -1
  45. package/lib/esm/ViewState.js.map +1 -1
  46. package/lib/esm/Viewport.d.ts +0 -1
  47. package/lib/esm/Viewport.d.ts.map +1 -1
  48. package/lib/esm/Viewport.js +0 -1
  49. package/lib/esm/Viewport.js.map +1 -1
  50. package/lib/esm/extension/ExtensionRuntime.js +2 -1
  51. package/lib/esm/extension/ExtensionRuntime.js.map +1 -1
  52. package/lib/esm/render/VisibleFeature.d.ts +5 -5
  53. package/lib/esm/render/VisibleFeature.js.map +1 -1
  54. package/lib/esm/render/webgl/BackgroundMapDrape.js +1 -1
  55. package/lib/esm/render/webgl/BackgroundMapDrape.js.map +1 -1
  56. package/lib/esm/render/webgl/PlanarClassifier.d.ts.map +1 -1
  57. package/lib/esm/render/webgl/PlanarClassifier.js +2 -1
  58. package/lib/esm/render/webgl/PlanarClassifier.js.map +1 -1
  59. package/lib/esm/render/webgl/PlanarTextureProjection.js +1 -1
  60. package/lib/esm/render/webgl/PlanarTextureProjection.js.map +1 -1
  61. package/lib/esm/render/webgl/RenderCommands.js +1 -1
  62. package/lib/esm/render/webgl/RenderCommands.js.map +1 -1
  63. package/lib/esm/render/webgl/SolarShadowMap.js +1 -1
  64. package/lib/esm/render/webgl/SolarShadowMap.js.map +1 -1
  65. package/lib/esm/tile/RealityTileTree.d.ts.map +1 -1
  66. package/lib/esm/tile/RealityTileTree.js +1 -3
  67. package/lib/esm/tile/RealityTileTree.js.map +1 -1
  68. package/lib/esm/tile/TileDrawArgs.js +1 -1
  69. package/lib/esm/tile/TileDrawArgs.js.map +1 -1
  70. package/package.json +20 -20
@@ -106,7 +106,6 @@ class TraversalSelectionContext {
106
106
  }
107
107
  exports.TraversalSelectionContext = TraversalSelectionContext;
108
108
  const scratchFrustum = new core_common_1.Frustum();
109
- const scratchFrustumPlanes = new core_common_1.FrustumPlanes();
110
109
  const scratchCarto = core_common_1.Cartographic.createZero();
111
110
  const scratchPoint = core_geometry_1.Point3d.createZero(), scratchOrigin = core_geometry_1.Point3d.createZero();
112
111
  const scratchRange = core_geometry_1.Range3d.createNull();
@@ -380,11 +379,10 @@ class RealityTileTree extends internal_1.TileTree {
380
379
  /** @internal */
381
380
  preloadTilesForScene(args, context, frustumTransform) {
382
381
  const preloadFrustum = args.viewingSpace.getPreloadFrustum(frustumTransform, scratchFrustum);
383
- const preloadFrustumPlanes = new core_common_1.FrustumPlanes(preloadFrustum);
382
+ const preloadFrustumPlanes = core_common_1.FrustumPlanes.fromFrustum(preloadFrustum);
384
383
  const worldToNpc = preloadFrustum.toMap4d();
385
384
  const preloadWorldToViewMap = args.viewingSpace.calcNpcToView().multiplyMapMap(worldToNpc);
386
385
  const preloadArgs = new internal_1.RealityTileDrawArgs(args, preloadWorldToViewMap, preloadFrustumPlanes);
387
- scratchFrustumPlanes.init(preloadFrustum);
388
386
  if (context.preloadDebugBuilder) {
389
387
  context.preloadDebugBuilder.setSymbology(core_common_1.ColorDef.blue, core_common_1.ColorDef.blue, 2, 0);
390
388
  context.preloadDebugBuilder.addFrustum(preloadFrustum);
@@ -1 +1 @@
1
- {"version":3,"file":"RealityTileTree.js","sourceRoot":"","sources":["../../../src/tile/RealityTileTree.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG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,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;YACzB,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YAChC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YAChC,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAClC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;SAC1D;QAED,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,WAAW,IAAI,GAAG,GAAG,IAAI,KAAK,IAAI,CAAC,CAAC;QACrE,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,KAAK,KAAK,SAAS,GAAG,SAAS,GAAG,YAAY,WAAW,EAAE,CAAC,CAAC;IACnF,CAAC;CACF;AArWD,0CAqWC","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 { assert, BeTimePoint } from \"@itwin/core-bentley\";\r\nimport {\r\n Matrix3d, Point3d, Range3d, Transform, Vector3d, XYZProps,\r\n} from \"@itwin/core-geometry\";\r\nimport { Cartographic, ColorDef, Frustum, FrustumPlanes, GeoCoordStatus, ViewFlagOverrides } from \"@itwin/core-common\";\r\nimport { BackgroundMapGeometry } from \"../BackgroundMapGeometry\";\r\nimport { GeoConverter } from \"../GeoServices\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { GraphicBranch } from \"../render/GraphicBranch\";\r\nimport { GraphicBuilder } from \"../render/GraphicBuilder\";\r\nimport { SceneContext } from \"../ViewContext\";\r\nimport {\r\n GraphicsCollectorDrawArgs, MapTile, RealityTile, RealityTileDrawArgs, RealityTileLoader, RealityTileParams, Tile, TileDrawArgs, TileGeometryCollector,\r\n TileGraphicType, TileParams, TileTree, TileTreeParams,\r\n} from \"./internal\";\r\n\r\n/** @internal */\r\nexport class TraversalDetails {\r\n public queuedChildren = new Array<Tile>();\r\n public childrenLoading = false;\r\n public childrenSelected = false;\r\n\r\n public initialize() {\r\n this.queuedChildren.length = 0;\r\n this.childrenLoading = false;\r\n this.childrenSelected = false;\r\n }\r\n}\r\n/** @internal */\r\nexport class TraversalChildrenDetails {\r\n private _childDetails: TraversalDetails[] = [];\r\n\r\n public initialize() {\r\n for (const child of this._childDetails)\r\n child.initialize();\r\n }\r\n public getChildDetail(index: number) {\r\n while (this._childDetails.length <= index)\r\n this._childDetails.push(new TraversalDetails());\r\n\r\n return this._childDetails[index];\r\n }\r\n\r\n public combine(parentDetails: TraversalDetails) {\r\n parentDetails.queuedChildren.length = 0;\r\n parentDetails.childrenLoading = false;\r\n parentDetails.childrenSelected = false;\r\n for (const child of this._childDetails) {\r\n parentDetails.childrenLoading = parentDetails.childrenLoading || child.childrenLoading;\r\n parentDetails.childrenSelected = parentDetails.childrenSelected || child.childrenSelected;\r\n for (const queuedChild of child.queuedChildren)\r\n parentDetails.queuedChildren.push(queuedChild);\r\n }\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class TraversalSelectionContext {\r\n public preloaded = new Set<RealityTile>();\r\n public missing = new Array<RealityTile>();\r\n public get selectionCountExceeded() { return this._maxSelectionCount === undefined ? false : (this.missing.length + this.selected.length) > this._maxSelectionCount; } // Avoid selecting excessive number of tiles.\r\n constructor(public selected: Tile[], public displayedDescendants: Tile[][], public preloadDebugBuilder?: GraphicBuilder, private _maxSelectionCount?: number) { }\r\n\r\n public selectOrQueue(tile: RealityTile, args: TileDrawArgs, traversalDetails: TraversalDetails) {\r\n tile.selectSecondaryTiles(args, this);\r\n tile.markUsed(args);\r\n if (tile.isReady) {\r\n args.markReady(tile);\r\n this.selected.push(tile);\r\n tile.markDisplayed();\r\n this.displayedDescendants.push((traversalDetails.childrenSelected) ? traversalDetails.queuedChildren.slice() : []);\r\n traversalDetails.queuedChildren.length = 0;\r\n traversalDetails.childrenLoading = false;\r\n traversalDetails.childrenSelected = true;\r\n } else if (!tile.isNotFound) {\r\n traversalDetails.queuedChildren.push(tile);\r\n if (!tile.isLoaded)\r\n this.missing.push(tile);\r\n }\r\n }\r\n\r\n public preload(tile: RealityTile, args: TileDrawArgs): void {\r\n if (!this.preloaded.has(tile)) {\r\n if (this.preloadDebugBuilder)\r\n tile.addBoundingGraphic(this.preloadDebugBuilder, ColorDef.red);\r\n\r\n tile.markUsed(args);\r\n tile.selectSecondaryTiles(args, this);\r\n this.preloaded.add(tile);\r\n if (!tile.isNotFound && !tile.isLoaded)\r\n this.missing.push(tile);\r\n }\r\n }\r\n\r\n public select(tiles: RealityTile[], args: TileDrawArgs): void {\r\n for (const tile of tiles) {\r\n tile.markUsed(args);\r\n this.selected.push(tile);\r\n this.displayedDescendants.push([]);\r\n }\r\n }\r\n}\r\n\r\nconst scratchFrustum = new Frustum();\r\nconst scratchFrustumPlanes = new FrustumPlanes();\r\nconst scratchCarto = Cartographic.createZero();\r\nconst scratchPoint = Point3d.createZero(), scratchOrigin = Point3d.createZero();\r\nconst scratchRange = Range3d.createNull();\r\nconst scratchX = Vector3d.createZero(), scratchY = Vector3d.createZero(), scratchZ = Vector3d.createZero();\r\nconst scratchMatrix = Matrix3d.createZero(), scratchTransform = Transform.createZero();\r\n\r\ninterface ChildReprojection {\r\n child: RealityTile;\r\n ecefCenter: Point3d;\r\n dbPoints: Point3d[]; // Center, xEnd, yEnd, zEnd\r\n}\r\n\r\n/** @internal */\r\nexport interface RealityTileTreeParams extends TileTreeParams {\r\n readonly loader: RealityTileLoader;\r\n readonly yAxisUp?: boolean;\r\n readonly rootTile: RealityTileParams;\r\n readonly rootToEcef?: Transform;\r\n readonly gcsConverterAvailable: boolean;\r\n}\r\n\r\n/** Base class for a [[TileTree]] representing a reality model (e.g., a point cloud or photogrammetry mesh) or 3d terrain with map imagery.\r\n * The tiles within the tree are instances of [[RealityTile]]s.\r\n * @beta\r\n */\r\nexport class RealityTileTree extends TileTree {\r\n /** @internal */\r\n public traversalChildrenByDepth: TraversalChildrenDetails[] = [];\r\n /** @internal */\r\n public readonly loader: RealityTileLoader;\r\n /** @internal */\r\n public readonly yAxisUp: boolean;\r\n /** @internal */\r\n public cartesianRange: Range3d;\r\n /** @internal */\r\n public cartesianTransitionDistance: number;\r\n /** @internal */\r\n protected _gcsConverter: GeoConverter | undefined;\r\n /** @internal */\r\n protected _rootTile: RealityTile;\r\n /** @internal */\r\n protected _rootToEcef?: Transform;\r\n /** @internal */\r\n protected _ecefToDb?: Transform;\r\n\r\n /** @internal */\r\n public constructor(params: RealityTileTreeParams) {\r\n super(params);\r\n this.loader = params.loader;\r\n this.yAxisUp = true === params.yAxisUp;\r\n this._rootTile = this.createTile(params.rootTile);\r\n this.cartesianRange = BackgroundMapGeometry.getCartesianRange(this.iModel);\r\n this.cartesianTransitionDistance = this.cartesianRange.diagonal().magnitudeXY() * .25; // Transition distance from elliptical to cartesian.\r\n this._gcsConverter = params.gcsConverterAvailable ? params.iModel.geoServices.getConverter(\"WGS84\") : undefined;\r\n if (params.rootToEcef) {\r\n this._rootToEcef = params.rootToEcef;\r\n const dbToRoot = this.iModelTransform.inverse();\r\n if (dbToRoot) {\r\n const dbToEcef = this._rootToEcef.multiplyTransformTransform(dbToRoot);\r\n this._ecefToDb = dbToEcef.inverse();\r\n }\r\n }\r\n }\r\n\r\n /** @internal */\r\n public get rootTile(): RealityTile { return this._rootTile; }\r\n /** @internal */\r\n public get is3d() { return true; }\r\n /** @internal */\r\n public get maxDepth() { return this.loader.maxDepth; }\r\n /** @internal */\r\n public get minDepth() { return this.loader.minDepth; }\r\n /** @internal */\r\n public override get isContentUnbounded() { return this.loader.isContentUnbounded; }\r\n /** @internal */\r\n public get isTransparent() { return false; }\r\n\r\n /** @internal */\r\n protected _selectTiles(args: TileDrawArgs): Tile[] { return this.selectRealityTiles(args, []); }\r\n /** @internal */\r\n public get viewFlagOverrides(): ViewFlagOverrides { return this.loader.viewFlagOverrides; }\r\n /** @internal */\r\n public override get parentsAndChildrenExclusive() { return this.loader.parentsAndChildrenExclusive; }\r\n\r\n /** @internal */\r\n public createTile(props: TileParams): RealityTile { return new RealityTile(props, this); }\r\n\r\n /** Collect tiles from this tile tree based on the criteria implemented by `collector`.\r\n * @internal\r\n */\r\n public override collectTileGeometry(collector: TileGeometryCollector): void {\r\n this.rootTile.collectTileGeometry(collector);\r\n }\r\n\r\n /** @internal */\r\n public prune(): void {\r\n const olderThan = BeTimePoint.now().minus(this.expirationTime);\r\n this.rootTile.purgeContents(olderThan);\r\n }\r\n\r\n /** @internal */\r\n public draw(args: TileDrawArgs): void {\r\n const displayedTileDescendants = new Array<RealityTile[]>();\r\n const debugControl = args.context.target.debugControl;\r\n const selectBuilder = (debugControl && debugControl.displayRealityTileRanges) ? args.context.createSceneGraphicBuilder() : undefined;\r\n const preloadDebugBuilder = (debugControl && debugControl.displayRealityTilePreload) ? args.context.createSceneGraphicBuilder() : undefined;\r\n const graphicTypeBranches = new Map<TileGraphicType, GraphicBranch>();\r\n\r\n const selectedTiles = this.selectRealityTiles(args, displayedTileDescendants, preloadDebugBuilder);\r\n args.processSelectedTiles(selectedTiles);\r\n let sortIndices;\r\n\r\n if (!this.parentsAndChildrenExclusive) {\r\n sortIndices = selectedTiles.map((_x, i) => i);\r\n sortIndices.sort((a, b) => selectedTiles[a].depth - selectedTiles[b].depth);\r\n }\r\n\r\n if (! (args instanceof GraphicsCollectorDrawArgs))\r\n this.collectClassifierGraphics(args, selectedTiles);\r\n\r\n assert(selectedTiles.length === displayedTileDescendants.length);\r\n for (let i = 0; i < selectedTiles.length; i++) {\r\n const index = sortIndices ? sortIndices[i] : i;\r\n const selectedTile = selectedTiles[index];\r\n const graphics = args.getTileGraphics(selectedTile);\r\n const tileGraphicType = selectedTile.graphicType;\r\n let targetBranch;\r\n if (undefined !== tileGraphicType && tileGraphicType !== args.context.graphicType) {\r\n if (!(targetBranch = graphicTypeBranches.get(tileGraphicType))) {\r\n graphicTypeBranches.set(tileGraphicType, targetBranch = new GraphicBranch(false));\r\n targetBranch.setViewFlagOverrides(args.graphics.viewFlagOverrides);\r\n targetBranch.symbologyOverrides = args.graphics.symbologyOverrides;\r\n }\r\n }\r\n\r\n if (!targetBranch)\r\n targetBranch = args.graphics;\r\n\r\n if (undefined !== graphics) {\r\n const displayedDescendants = displayedTileDescendants[index];\r\n if (0 === displayedDescendants.length || !this.loader.parentsAndChildrenExclusive || selectedTile.allChildrenIncluded(displayedDescendants)) {\r\n targetBranch.add(graphics);\r\n if (selectBuilder)\r\n selectedTile.addBoundingGraphic(selectBuilder, ColorDef.green);\r\n } else {\r\n if (selectBuilder)\r\n selectedTile.addBoundingGraphic(selectBuilder, ColorDef.red);\r\n\r\n for (const displayedDescendant of displayedDescendants) {\r\n const clipVector = displayedDescendant.getContentClip();\r\n if (selectBuilder)\r\n displayedDescendant.addBoundingGraphic(selectBuilder, ColorDef.blue);\r\n\r\n if (undefined === clipVector) {\r\n targetBranch.add(graphics);\r\n } else {\r\n clipVector.transformInPlace(args.location);\r\n if (!this.isTransparent)\r\n for (const primitive of clipVector.clips)\r\n for (const clipPlanes of primitive.fetchClipPlanesRef()!.convexSets)\r\n for (const plane of clipPlanes.planes)\r\n plane.offsetDistance(-displayedDescendant.radius * .05); // Overlap with existing (high resolution) tile slightly to avoid cracks.\r\n\r\n const branch = new GraphicBranch(false);\r\n branch.add(graphics);\r\n const clipVolume = args.context.target.renderSystem.createClipVolume(clipVector);\r\n targetBranch.add(args.context.createGraphicBranch(branch, Transform.createIdentity(), { clipVolume }));\r\n }\r\n }\r\n }\r\n if (preloadDebugBuilder)\r\n targetBranch.add(preloadDebugBuilder.finish());\r\n\r\n if (selectBuilder)\r\n targetBranch.add(selectBuilder.finish());\r\n\r\n const rangeGraphic = selectedTile.getRangeGraphic(args.context);\r\n if (undefined !== rangeGraphic)\r\n targetBranch.add(rangeGraphic);\r\n }\r\n }\r\n\r\n args.drawGraphics();\r\n for (const graphicTypeBranch of graphicTypeBranches) {\r\n args.drawGraphicsWithType(graphicTypeBranch[0], graphicTypeBranch[1]);\r\n }\r\n }\r\n\r\n /** @internal */\r\n protected collectClassifierGraphics(args: TileDrawArgs, selectedTiles: RealityTile[]) {\r\n const classifier = args.context.planarClassifiers.get(this.modelId);\r\n if (classifier)\r\n classifier.collectGraphics(args.context, { modelId: this.modelId, tiles: selectedTiles, location: args.location, isPointCloud: this.isPointCloud });\r\n }\r\n\r\n /** @internal */\r\n public getTraversalChildren(depth: number) {\r\n while (this.traversalChildrenByDepth.length <= depth)\r\n this.traversalChildrenByDepth.push(new TraversalChildrenDetails());\r\n\r\n return this.traversalChildrenByDepth[depth];\r\n }\r\n\r\n /** @internal */\r\n public doReprojectChildren(tile: Tile): boolean {\r\n if (!(tile instanceof RealityTile) || this._gcsConverter === undefined || this._rootToEcef === undefined || undefined === this._ecefToDb)\r\n return false;\r\n\r\n const tileRange = this.iModelTransform.isIdentity ? tile.range : this.iModelTransform.multiplyRange(tile.range, scratchRange);\r\n\r\n return this.cartesianRange.intersectsRange(tileRange);\r\n }\r\n\r\n /** @internal */\r\n public reprojectAndResolveChildren(parent: Tile, children: Tile[], resolve: (children: Tile[] | undefined) => void): void {\r\n if (!this.doReprojectChildren(parent)) {\r\n resolve(children);\r\n return;\r\n }\r\n\r\n const ecefToDb = this._ecefToDb!; // Tested for undefined in doReprojectChildren\r\n const rootToDb = this.iModelTransform;\r\n const dbToEcef = ecefToDb.inverse()!;\r\n const reprojectChildren = new Array<ChildReprojection>();\r\n for (const child of children) {\r\n const realityChild = child as RealityTile;\r\n const childRange = realityChild.rangeCorners ? Range3d.createTransformedArray(rootToDb, realityChild.rangeCorners) : rootToDb.multiplyRange(realityChild.contentRange, scratchRange);\r\n const dbCenter = childRange.center;\r\n const ecefCenter = dbToEcef.multiplyPoint3d(dbCenter);\r\n const dbPoints = [dbCenter, dbCenter.plusXYZ(1), dbCenter.plusXYZ(0, 1), dbCenter.plusXYZ(0, 0, 1)];\r\n reprojectChildren.push({ child: realityChild, ecefCenter, dbPoints });\r\n }\r\n if (reprojectChildren.length === 0)\r\n resolve(children);\r\n else {\r\n const requestProps = new Array<XYZProps>();\r\n\r\n for (const reprojection of reprojectChildren) {\r\n for (const dbPoint of reprojection.dbPoints) {\r\n const ecefPoint = dbToEcef.multiplyPoint3d(dbPoint);\r\n const carto = Cartographic.fromEcef(ecefPoint, scratchCarto);\r\n if (carto)\r\n requestProps.push({ x: carto.longitudeDegrees, y: carto.latitudeDegrees, z: carto.height });\r\n\r\n }\r\n }\r\n\r\n if (requestProps.length !== 4 * reprojectChildren.length)\r\n resolve(children);\r\n else {\r\n this._gcsConverter!.getIModelCoordinatesFromGeoCoordinates(requestProps).then((response) => {\r\n\r\n const reprojectedCoords = response.iModelCoords;\r\n const dbToRoot = rootToDb.inverse()!;\r\n const getReprojectedPoint = (original: Point3d, reprojectedXYZ: XYZProps) => {\r\n scratchPoint.setFromJSON(reprojectedXYZ);\r\n const cartesianDistance = this.cartesianRange.distanceToPoint(scratchPoint);\r\n if (cartesianDistance < this.cartesianTransitionDistance)\r\n return scratchPoint.interpolate(cartesianDistance / this.cartesianTransitionDistance, original, scratchPoint);\r\n else\r\n return original;\r\n };\r\n\r\n let responseIndex = 0;\r\n for (const reprojection of reprojectChildren) {\r\n if (reprojectedCoords.every((coord) => coord.s === GeoCoordStatus.Success)) {\r\n const reprojectedOrigin = getReprojectedPoint(reprojection.dbPoints[0], reprojectedCoords[responseIndex++].p).clone(scratchOrigin);\r\n const xVector = Vector3d.createStartEnd(reprojectedOrigin, getReprojectedPoint(reprojection.dbPoints[1], reprojectedCoords[responseIndex++].p), scratchX);\r\n const yVector = Vector3d.createStartEnd(reprojectedOrigin, getReprojectedPoint(reprojection.dbPoints[2], reprojectedCoords[responseIndex++].p), scratchY);\r\n const zVector = Vector3d.createStartEnd(reprojectedOrigin, getReprojectedPoint(reprojection.dbPoints[3], reprojectedCoords[responseIndex++].p), scratchZ);\r\n const matrix = Matrix3d.createColumns(xVector, yVector, zVector, scratchMatrix);\r\n if (matrix !== undefined) {\r\n const dbReprojection = Transform.createMatrixPickupPutdown(matrix, reprojection.dbPoints[0], reprojectedOrigin, scratchTransform);\r\n if (dbReprojection) {\r\n const rootReprojection = dbToRoot.multiplyTransformTransform(dbReprojection).multiplyTransformTransform(rootToDb);\r\n reprojection.child.reproject(rootReprojection);\r\n }\r\n }\r\n }\r\n }\r\n\r\n resolve(children);\r\n }).catch(() => {\r\n resolve(children); // Error occured in reprojection - just resolve with unprojected corners.\r\n });\r\n }\r\n }\r\n }\r\n\r\n /** @internal */\r\n public getBaseRealityDepth(_sceneContext: SceneContext) { return -1; }\r\n\r\n /** @internal */\r\n public selectRealityTiles(args: TileDrawArgs, displayedDescendants: RealityTile[][], preloadDebugBuilder?: GraphicBuilder): RealityTile[] {\r\n this._lastSelected = BeTimePoint.now();\r\n const selected: RealityTile[] = [];\r\n const context = new TraversalSelectionContext(selected, displayedDescendants, preloadDebugBuilder, args.maxRealityTreeSelectionCount);\r\n const rootTile = this.rootTile;\r\n const debugControl = args.context.target.debugControl;\r\n const freezeTiles = debugControl && debugControl.freezeRealityTiles;\r\n\r\n rootTile.selectRealityTiles(context, args, new TraversalDetails());\r\n\r\n const baseDepth = this.getBaseRealityDepth(args.context);\r\n\r\n if (!args.context.target.renderSystem.isMobile && 0 === context.missing.length) { // We skip preloading on mobile devices.\r\n if (baseDepth > 0) // Maps may force loading of low level globe tiles.\r\n rootTile.preloadRealityTilesAtDepth(baseDepth, context, args);\r\n\r\n if (!freezeTiles)\r\n this.preloadTilesForScene(args, context, undefined);\r\n }\r\n\r\n if (!freezeTiles)\r\n for (const tile of context.missing) {\r\n const loadableTile = tile.loadableTile;\r\n\r\n loadableTile.markUsed(args);\r\n args.insertMissing(loadableTile);\r\n }\r\n\r\n if (debugControl && debugControl.logRealityTiles) {\r\n this.logTiles(\"Selected: \", selected.values());\r\n const preloaded = [];\r\n for (const tile of context.preloaded)\r\n preloaded.push(tile);\r\n\r\n this.logTiles(\"Preloaded: \", preloaded.values());\r\n this.logTiles(\"Missing: \", context.missing.values());\r\n\r\n const imageryTiles: RealityTile[] = [];\r\n for (const selectedTile of selected) {\r\n if (selectedTile instanceof MapTile) {\r\n const selectedImageryTiles = (selectedTile).imageryTiles;\r\n if (selectedImageryTiles)\r\n selectedImageryTiles.forEach((tile) => imageryTiles.push(tile));\r\n }\r\n }\r\n if (imageryTiles.length)\r\n this.logTiles(\"Imagery:\", imageryTiles.values());\r\n }\r\n\r\n IModelApp.tileAdmin.addTilesForUser(args.context.viewport, selected, args.readyTiles);\r\n return selected;\r\n }\r\n\r\n /** @internal */\r\n public preloadTilesForScene(args: TileDrawArgs, context: TraversalSelectionContext, frustumTransform?: Transform) {\r\n const preloadFrustum = args.viewingSpace.getPreloadFrustum(frustumTransform, scratchFrustum);\r\n const preloadFrustumPlanes = new FrustumPlanes(preloadFrustum);\r\n const worldToNpc = preloadFrustum.toMap4d();\r\n const preloadWorldToViewMap = args.viewingSpace.calcNpcToView().multiplyMapMap(worldToNpc!);\r\n const preloadArgs = new RealityTileDrawArgs(args, preloadWorldToViewMap, preloadFrustumPlanes);\r\n\r\n scratchFrustumPlanes.init(preloadFrustum);\r\n if (context.preloadDebugBuilder) {\r\n context.preloadDebugBuilder.setSymbology(ColorDef.blue, ColorDef.blue, 2, 0);\r\n context.preloadDebugBuilder.addFrustum(preloadFrustum);\r\n }\r\n\r\n this.rootTile.preloadTilesInFrustum(preloadArgs, context, 2);\r\n }\r\n\r\n /** @internal */\r\n protected logTiles(label: string, tiles: IterableIterator<Tile>) {\r\n let depthString = \"\";\r\n let min = 10000, max = -10000;\r\n let count = 0;\r\n const depthMap = new Map<number, number>();\r\n for (const tile of tiles) {\r\n count++;\r\n const depth = tile.depth;\r\n min = Math.min(min, tile.depth);\r\n max = Math.max(max, tile.depth);\r\n const found = depthMap.get(depth);\r\n depthMap.set(depth, found === undefined ? 1 : found + 1);\r\n }\r\n\r\n depthMap.forEach((key, value) => depthString += `${key}-${value}, `);\r\n // eslint-disable-next-line no-console\r\n console.log(`${label}: ${count} Min: ${min} Max: ${max} Depths: ${depthString}`);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"RealityTileTree.js","sourceRoot":"","sources":["../../../src/tile/RealityTileTree.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA0D;AAC1D,wDAE8B;AAC9B,oDAAuH;AACvH,oEAAiE;AAEjE,4CAAyC;AACzC,2DAAwD;AAGxD,yCAGoB;AAEpB,gBAAgB;AAChB,MAAa,gBAAgB;IAA7B;QACS,mBAAc,GAAG,IAAI,KAAK,EAAQ,CAAC;QACnC,oBAAe,GAAG,KAAK,CAAC;QACxB,qBAAgB,GAAG,KAAK,CAAC;IAOlC,CAAC;IALQ,UAAU;QACf,IAAI,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC;QAC/B,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAC7B,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;IAChC,CAAC;CACF;AAVD,4CAUC;AACD,gBAAgB;AAChB,MAAa,wBAAwB;IAArC;QACU,kBAAa,GAAuB,EAAE,CAAC;IAwBjD,CAAC;IAtBQ,UAAU;QACf,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,aAAa;YACpC,KAAK,CAAC,UAAU,EAAE,CAAC;IACvB,CAAC;IACM,cAAc,CAAC,KAAa;QACjC,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,IAAI,KAAK;YACvC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,gBAAgB,EAAE,CAAC,CAAC;QAElD,O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AAC;IAED,gBAAgB;IACN,QAAQ,CAAC,KAAa,EAAE,KAA6B;QAC7D,IAAI,WAAW,GAAG,EAAE,CAAC;QACrB,IAAI,GAAG,GAAG,KAAK,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC;QAC9B,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAC;QAC3C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACxB,KAAK,EAAE,CAAC;YACR,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;YACzB,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YAChC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YAChC,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAClC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;SAC1D;QAED,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,WAAW,IAAI,GAAG,GAAG,IAAI,KAAK,IAAI,CAAC,CAAC;QACrE,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,KAAK,KAAK,SAAS,GAAG,SAAS,GAAG,YAAY,WAAW,EAAE,CAAC,CAAC;IACnF,CAAC;CACF;AApWD,0CAoWC","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 { assert, BeTimePoint } from \"@itwin/core-bentley\";\r\nimport {\r\n Matrix3d, Point3d, Range3d, Transform, Vector3d, XYZProps,\r\n} from \"@itwin/core-geometry\";\r\nimport { Cartographic, ColorDef, Frustum, FrustumPlanes, GeoCoordStatus, ViewFlagOverrides } from \"@itwin/core-common\";\r\nimport { BackgroundMapGeometry } from \"../BackgroundMapGeometry\";\r\nimport { GeoConverter } from \"../GeoServices\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { GraphicBranch } from \"../render/GraphicBranch\";\r\nimport { GraphicBuilder } from \"../render/GraphicBuilder\";\r\nimport { SceneContext } from \"../ViewContext\";\r\nimport {\r\n GraphicsCollectorDrawArgs, MapTile, RealityTile, RealityTileDrawArgs, RealityTileLoader, RealityTileParams, Tile, TileDrawArgs, TileGeometryCollector,\r\n TileGraphicType, TileParams, TileTree, TileTreeParams,\r\n} from \"./internal\";\r\n\r\n/** @internal */\r\nexport class TraversalDetails {\r\n public queuedChildren = new Array<Tile>();\r\n public childrenLoading = false;\r\n public childrenSelected = false;\r\n\r\n public initialize() {\r\n this.queuedChildren.length = 0;\r\n this.childrenLoading = false;\r\n this.childrenSelected = false;\r\n }\r\n}\r\n/** @internal */\r\nexport class TraversalChildrenDetails {\r\n private _childDetails: TraversalDetails[] = [];\r\n\r\n public initialize() {\r\n for (const child of this._childDetails)\r\n child.initialize();\r\n }\r\n public getChildDetail(index: number) {\r\n while (this._childDetails.length <= index)\r\n this._childDetails.push(new TraversalDetails());\r\n\r\n return this._childDetails[index];\r\n }\r\n\r\n public combine(parentDetails: TraversalDetails) {\r\n parentDetails.queuedChildren.length = 0;\r\n parentDetails.childrenLoading = false;\r\n parentDetails.childrenSelected = false;\r\n for (const child of this._childDetails) {\r\n parentDetails.childrenLoading = parentDetails.childrenLoading || child.childrenLoading;\r\n parentDetails.childrenSelected = parentDetails.childrenSelected || child.childrenSelected;\r\n for (const queuedChild of child.queuedChildren)\r\n parentDetails.queuedChildren.push(queuedChild);\r\n }\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class TraversalSelectionContext {\r\n public preloaded = new Set<RealityTile>();\r\n public missing = new Array<RealityTile>();\r\n public get selectionCountExceeded() { return this._maxSelectionCount === undefined ? false : (this.missing.length + this.selected.length) > this._maxSelectionCount; } // Avoid selecting excessive number of tiles.\r\n constructor(public selected: Tile[], public displayedDescendants: Tile[][], public preloadDebugBuilder?: GraphicBuilder, private _maxSelectionCount?: number) { }\r\n\r\n public selectOrQueue(tile: RealityTile, args: TileDrawArgs, traversalDetails: TraversalDetails) {\r\n tile.selectSecondaryTiles(args, this);\r\n tile.markUsed(args);\r\n if (tile.isReady) {\r\n args.markReady(tile);\r\n this.selected.push(tile);\r\n tile.markDisplayed();\r\n this.displayedDescendants.push((traversalDetails.childrenSelected) ? traversalDetails.queuedChildren.slice() : []);\r\n traversalDetails.queuedChildren.length = 0;\r\n traversalDetails.childrenLoading = false;\r\n traversalDetails.childrenSelected = true;\r\n } else if (!tile.isNotFound) {\r\n traversalDetails.queuedChildren.push(tile);\r\n if (!tile.isLoaded)\r\n this.missing.push(tile);\r\n }\r\n }\r\n\r\n public preload(tile: RealityTile, args: TileDrawArgs): void {\r\n if (!this.preloaded.has(tile)) {\r\n if (this.preloadDebugBuilder)\r\n tile.addBoundingGraphic(this.preloadDebugBuilder, ColorDef.red);\r\n\r\n tile.markUsed(args);\r\n tile.selectSecondaryTiles(args, this);\r\n this.preloaded.add(tile);\r\n if (!tile.isNotFound && !tile.isLoaded)\r\n this.missing.push(tile);\r\n }\r\n }\r\n\r\n public select(tiles: RealityTile[], args: TileDrawArgs): void {\r\n for (const tile of tiles) {\r\n tile.markUsed(args);\r\n this.selected.push(tile);\r\n this.displayedDescendants.push([]);\r\n }\r\n }\r\n}\r\n\r\nconst scratchFrustum = new Frustum();\r\nconst scratchCarto = Cartographic.createZero();\r\nconst scratchPoint = Point3d.createZero(), scratchOrigin = Point3d.createZero();\r\nconst scratchRange = Range3d.createNull();\r\nconst scratchX = Vector3d.createZero(), scratchY = Vector3d.createZero(), scratchZ = Vector3d.createZero();\r\nconst scratchMatrix = Matrix3d.createZero(), scratchTransform = Transform.createZero();\r\n\r\ninterface ChildReprojection {\r\n child: RealityTile;\r\n ecefCenter: Point3d;\r\n dbPoints: Point3d[]; // Center, xEnd, yEnd, zEnd\r\n}\r\n\r\n/** @internal */\r\nexport interface RealityTileTreeParams extends TileTreeParams {\r\n readonly loader: RealityTileLoader;\r\n readonly yAxisUp?: boolean;\r\n readonly rootTile: RealityTileParams;\r\n readonly rootToEcef?: Transform;\r\n readonly gcsConverterAvailable: boolean;\r\n}\r\n\r\n/** Base class for a [[TileTree]] representing a reality model (e.g., a point cloud or photogrammetry mesh) or 3d terrain with map imagery.\r\n * The tiles within the tree are instances of [[RealityTile]]s.\r\n * @beta\r\n */\r\nexport class RealityTileTree extends TileTree {\r\n /** @internal */\r\n public traversalChildrenByDepth: TraversalChildrenDetails[] = [];\r\n /** @internal */\r\n public readonly loader: RealityTileLoader;\r\n /** @internal */\r\n public readonly yAxisUp: boolean;\r\n /** @internal */\r\n public cartesianRange: Range3d;\r\n /** @internal */\r\n public cartesianTransitionDistance: number;\r\n /** @internal */\r\n protected _gcsConverter: GeoConverter | undefined;\r\n /** @internal */\r\n protected _rootTile: RealityTile;\r\n /** @internal */\r\n protected _rootToEcef?: Transform;\r\n /** @internal */\r\n protected _ecefToDb?: Transform;\r\n\r\n /** @internal */\r\n public constructor(params: RealityTileTreeParams) {\r\n super(params);\r\n this.loader = params.loader;\r\n this.yAxisUp = true === params.yAxisUp;\r\n this._rootTile = this.createTile(params.rootTile);\r\n this.cartesianRange = BackgroundMapGeometry.getCartesianRange(this.iModel);\r\n this.cartesianTransitionDistance = this.cartesianRange.diagonal().magnitudeXY() * .25; // Transition distance from elliptical to cartesian.\r\n this._gcsConverter = params.gcsConverterAvailable ? params.iModel.geoServices.getConverter(\"WGS84\") : undefined;\r\n if (params.rootToEcef) {\r\n this._rootToEcef = params.rootToEcef;\r\n const dbToRoot = this.iModelTransform.inverse();\r\n if (dbToRoot) {\r\n const dbToEcef = this._rootToEcef.multiplyTransformTransform(dbToRoot);\r\n this._ecefToDb = dbToEcef.inverse();\r\n }\r\n }\r\n }\r\n\r\n /** @internal */\r\n public get rootTile(): RealityTile { return this._rootTile; }\r\n /** @internal */\r\n public get is3d() { return true; }\r\n /** @internal */\r\n public get maxDepth() { return this.loader.maxDepth; }\r\n /** @internal */\r\n public get minDepth() { return this.loader.minDepth; }\r\n /** @internal */\r\n public override get isContentUnbounded() { return this.loader.isContentUnbounded; }\r\n /** @internal */\r\n public get isTransparent() { return false; }\r\n\r\n /** @internal */\r\n protected _selectTiles(args: TileDrawArgs): Tile[] { return this.selectRealityTiles(args, []); }\r\n /** @internal */\r\n public get viewFlagOverrides(): ViewFlagOverrides { return this.loader.viewFlagOverrides; }\r\n /** @internal */\r\n public override get parentsAndChildrenExclusive() { return this.loader.parentsAndChildrenExclusive; }\r\n\r\n /** @internal */\r\n public createTile(props: TileParams): RealityTile { return new RealityTile(props, this); }\r\n\r\n /** Collect tiles from this tile tree based on the criteria implemented by `collector`.\r\n * @internal\r\n */\r\n public override collectTileGeometry(collector: TileGeometryCollector): void {\r\n this.rootTile.collectTileGeometry(collector);\r\n }\r\n\r\n /** @internal */\r\n public prune(): void {\r\n const olderThan = BeTimePoint.now().minus(this.expirationTime);\r\n this.rootTile.purgeContents(olderThan);\r\n }\r\n\r\n /** @internal */\r\n public draw(args: TileDrawArgs): void {\r\n const displayedTileDescendants = new Array<RealityTile[]>();\r\n const debugControl = args.context.target.debugControl;\r\n const selectBuilder = (debugControl && debugControl.displayRealityTileRanges) ? args.context.createSceneGraphicBuilder() : undefined;\r\n const preloadDebugBuilder = (debugControl && debugControl.displayRealityTilePreload) ? args.context.createSceneGraphicBuilder() : undefined;\r\n const graphicTypeBranches = new Map<TileGraphicType, GraphicBranch>();\r\n\r\n const selectedTiles = this.selectRealityTiles(args, displayedTileDescendants, preloadDebugBuilder);\r\n args.processSelectedTiles(selectedTiles);\r\n let sortIndices;\r\n\r\n if (!this.parentsAndChildrenExclusive) {\r\n sortIndices = selectedTiles.map((_x, i) => i);\r\n sortIndices.sort((a, b) => selectedTiles[a].depth - selectedTiles[b].depth);\r\n }\r\n\r\n if (! (args instanceof GraphicsCollectorDrawArgs))\r\n this.collectClassifierGraphics(args, selectedTiles);\r\n\r\n assert(selectedTiles.length === displayedTileDescendants.length);\r\n for (let i = 0; i < selectedTiles.length; i++) {\r\n const index = sortIndices ? sortIndices[i] : i;\r\n const selectedTile = selectedTiles[index];\r\n const graphics = args.getTileGraphics(selectedTile);\r\n const tileGraphicType = selectedTile.graphicType;\r\n let targetBranch;\r\n if (undefined !== tileGraphicType && tileGraphicType !== args.context.graphicType) {\r\n if (!(targetBranch = graphicTypeBranches.get(tileGraphicType))) {\r\n graphicTypeBranches.set(tileGraphicType, targetBranch = new GraphicBranch(false));\r\n targetBranch.setViewFlagOverrides(args.graphics.viewFlagOverrides);\r\n targetBranch.symbologyOverrides = args.graphics.symbologyOverrides;\r\n }\r\n }\r\n\r\n if (!targetBranch)\r\n targetBranch = args.graphics;\r\n\r\n if (undefined !== graphics) {\r\n const displayedDescendants = displayedTileDescendants[index];\r\n if (0 === displayedDescendants.length || !this.loader.parentsAndChildrenExclusive || selectedTile.allChildrenIncluded(displayedDescendants)) {\r\n targetBranch.add(graphics);\r\n if (selectBuilder)\r\n selectedTile.addBoundingGraphic(selectBuilder, ColorDef.green);\r\n } else {\r\n if (selectBuilder)\r\n selectedTile.addBoundingGraphic(selectBuilder, ColorDef.red);\r\n\r\n for (const displayedDescendant of displayedDescendants) {\r\n const clipVector = displayedDescendant.getContentClip();\r\n if (selectBuilder)\r\n displayedDescendant.addBoundingGraphic(selectBuilder, ColorDef.blue);\r\n\r\n if (undefined === clipVector) {\r\n targetBranch.add(graphics);\r\n } else {\r\n clipVector.transformInPlace(args.location);\r\n if (!this.isTransparent)\r\n for (const primitive of clipVector.clips)\r\n for (const clipPlanes of primitive.fetchClipPlanesRef()!.convexSets)\r\n for (const plane of clipPlanes.planes)\r\n plane.offsetDistance(-displayedDescendant.radius * .05); // Overlap with existing (high resolution) tile slightly to avoid cracks.\r\n\r\n const branch = new GraphicBranch(false);\r\n branch.add(graphics);\r\n const clipVolume = args.context.target.renderSystem.createClipVolume(clipVector);\r\n targetBranch.add(args.context.createGraphicBranch(branch, Transform.createIdentity(), { clipVolume }));\r\n }\r\n }\r\n }\r\n if (preloadDebugBuilder)\r\n targetBranch.add(preloadDebugBuilder.finish());\r\n\r\n if (selectBuilder)\r\n targetBranch.add(selectBuilder.finish());\r\n\r\n const rangeGraphic = selectedTile.getRangeGraphic(args.context);\r\n if (undefined !== rangeGraphic)\r\n targetBranch.add(rangeGraphic);\r\n }\r\n }\r\n\r\n args.drawGraphics();\r\n for (const graphicTypeBranch of graphicTypeBranches) {\r\n args.drawGraphicsWithType(graphicTypeBranch[0], graphicTypeBranch[1]);\r\n }\r\n }\r\n\r\n /** @internal */\r\n protected collectClassifierGraphics(args: TileDrawArgs, selectedTiles: RealityTile[]) {\r\n const classifier = args.context.planarClassifiers.get(this.modelId);\r\n if (classifier)\r\n classifier.collectGraphics(args.context, { modelId: this.modelId, tiles: selectedTiles, location: args.location, isPointCloud: this.isPointCloud });\r\n }\r\n\r\n /** @internal */\r\n public getTraversalChildren(depth: number) {\r\n while (this.traversalChildrenByDepth.length <= depth)\r\n this.traversalChildrenByDepth.push(new TraversalChildrenDetails());\r\n\r\n return this.traversalChildrenByDepth[depth];\r\n }\r\n\r\n /** @internal */\r\n public doReprojectChildren(tile: Tile): boolean {\r\n if (!(tile instanceof RealityTile) || this._gcsConverter === undefined || this._rootToEcef === undefined || undefined === this._ecefToDb)\r\n return false;\r\n\r\n const tileRange = this.iModelTransform.isIdentity ? tile.range : this.iModelTransform.multiplyRange(tile.range, scratchRange);\r\n\r\n return this.cartesianRange.intersectsRange(tileRange);\r\n }\r\n\r\n /** @internal */\r\n public reprojectAndResolveChildren(parent: Tile, children: Tile[], resolve: (children: Tile[] | undefined) => void): void {\r\n if (!this.doReprojectChildren(parent)) {\r\n resolve(children);\r\n return;\r\n }\r\n\r\n const ecefToDb = this._ecefToDb!; // Tested for undefined in doReprojectChildren\r\n const rootToDb = this.iModelTransform;\r\n const dbToEcef = ecefToDb.inverse()!;\r\n const reprojectChildren = new Array<ChildReprojection>();\r\n for (const child of children) {\r\n const realityChild = child as RealityTile;\r\n const childRange = realityChild.rangeCorners ? Range3d.createTransformedArray(rootToDb, realityChild.rangeCorners) : rootToDb.multiplyRange(realityChild.contentRange, scratchRange);\r\n const dbCenter = childRange.center;\r\n const ecefCenter = dbToEcef.multiplyPoint3d(dbCenter);\r\n const dbPoints = [dbCenter, dbCenter.plusXYZ(1), dbCenter.plusXYZ(0, 1), dbCenter.plusXYZ(0, 0, 1)];\r\n reprojectChildren.push({ child: realityChild, ecefCenter, dbPoints });\r\n }\r\n if (reprojectChildren.length === 0)\r\n resolve(children);\r\n else {\r\n const requestProps = new Array<XYZProps>();\r\n\r\n for (const reprojection of reprojectChildren) {\r\n for (const dbPoint of reprojection.dbPoints) {\r\n const ecefPoint = dbToEcef.multiplyPoint3d(dbPoint);\r\n const carto = Cartographic.fromEcef(ecefPoint, scratchCarto);\r\n if (carto)\r\n requestProps.push({ x: carto.longitudeDegrees, y: carto.latitudeDegrees, z: carto.height });\r\n\r\n }\r\n }\r\n\r\n if (requestProps.length !== 4 * reprojectChildren.length)\r\n resolve(children);\r\n else {\r\n this._gcsConverter!.getIModelCoordinatesFromGeoCoordinates(requestProps).then((response) => {\r\n\r\n const reprojectedCoords = response.iModelCoords;\r\n const dbToRoot = rootToDb.inverse()!;\r\n const getReprojectedPoint = (original: Point3d, reprojectedXYZ: XYZProps) => {\r\n scratchPoint.setFromJSON(reprojectedXYZ);\r\n const cartesianDistance = this.cartesianRange.distanceToPoint(scratchPoint);\r\n if (cartesianDistance < this.cartesianTransitionDistance)\r\n return scratchPoint.interpolate(cartesianDistance / this.cartesianTransitionDistance, original, scratchPoint);\r\n else\r\n return original;\r\n };\r\n\r\n let responseIndex = 0;\r\n for (const reprojection of reprojectChildren) {\r\n if (reprojectedCoords.every((coord) => coord.s === GeoCoordStatus.Success)) {\r\n const reprojectedOrigin = getReprojectedPoint(reprojection.dbPoints[0], reprojectedCoords[responseIndex++].p).clone(scratchOrigin);\r\n const xVector = Vector3d.createStartEnd(reprojectedOrigin, getReprojectedPoint(reprojection.dbPoints[1], reprojectedCoords[responseIndex++].p), scratchX);\r\n const yVector = Vector3d.createStartEnd(reprojectedOrigin, getReprojectedPoint(reprojection.dbPoints[2], reprojectedCoords[responseIndex++].p), scratchY);\r\n const zVector = Vector3d.createStartEnd(reprojectedOrigin, getReprojectedPoint(reprojection.dbPoints[3], reprojectedCoords[responseIndex++].p), scratchZ);\r\n const matrix = Matrix3d.createColumns(xVector, yVector, zVector, scratchMatrix);\r\n if (matrix !== undefined) {\r\n const dbReprojection = Transform.createMatrixPickupPutdown(matrix, reprojection.dbPoints[0], reprojectedOrigin, scratchTransform);\r\n if (dbReprojection) {\r\n const rootReprojection = dbToRoot.multiplyTransformTransform(dbReprojection).multiplyTransformTransform(rootToDb);\r\n reprojection.child.reproject(rootReprojection);\r\n }\r\n }\r\n }\r\n }\r\n\r\n resolve(children);\r\n }).catch(() => {\r\n resolve(children); // Error occured in reprojection - just resolve with unprojected corners.\r\n });\r\n }\r\n }\r\n }\r\n\r\n /** @internal */\r\n public getBaseRealityDepth(_sceneContext: SceneContext) { return -1; }\r\n\r\n /** @internal */\r\n public selectRealityTiles(args: TileDrawArgs, displayedDescendants: RealityTile[][], preloadDebugBuilder?: GraphicBuilder): RealityTile[] {\r\n this._lastSelected = BeTimePoint.now();\r\n const selected: RealityTile[] = [];\r\n const context = new TraversalSelectionContext(selected, displayedDescendants, preloadDebugBuilder, args.maxRealityTreeSelectionCount);\r\n const rootTile = this.rootTile;\r\n const debugControl = args.context.target.debugControl;\r\n const freezeTiles = debugControl && debugControl.freezeRealityTiles;\r\n\r\n rootTile.selectRealityTiles(context, args, new TraversalDetails());\r\n\r\n const baseDepth = this.getBaseRealityDepth(args.context);\r\n\r\n if (!args.context.target.renderSystem.isMobile && 0 === context.missing.length) { // We skip preloading on mobile devices.\r\n if (baseDepth > 0) // Maps may force loading of low level globe tiles.\r\n rootTile.preloadRealityTilesAtDepth(baseDepth, context, args);\r\n\r\n if (!freezeTiles)\r\n this.preloadTilesForScene(args, context, undefined);\r\n }\r\n\r\n if (!freezeTiles)\r\n for (const tile of context.missing) {\r\n const loadableTile = tile.loadableTile;\r\n\r\n loadableTile.markUsed(args);\r\n args.insertMissing(loadableTile);\r\n }\r\n\r\n if (debugControl && debugControl.logRealityTiles) {\r\n this.logTiles(\"Selected: \", selected.values());\r\n const preloaded = [];\r\n for (const tile of context.preloaded)\r\n preloaded.push(tile);\r\n\r\n this.logTiles(\"Preloaded: \", preloaded.values());\r\n this.logTiles(\"Missing: \", context.missing.values());\r\n\r\n const imageryTiles: RealityTile[] = [];\r\n for (const selectedTile of selected) {\r\n if (selectedTile instanceof MapTile) {\r\n const selectedImageryTiles = (selectedTile).imageryTiles;\r\n if (selectedImageryTiles)\r\n selectedImageryTiles.forEach((tile) => imageryTiles.push(tile));\r\n }\r\n }\r\n if (imageryTiles.length)\r\n this.logTiles(\"Imagery:\", imageryTiles.values());\r\n }\r\n\r\n IModelApp.tileAdmin.addTilesForUser(args.context.viewport, selected, args.readyTiles);\r\n return selected;\r\n }\r\n\r\n /** @internal */\r\n public preloadTilesForScene(args: TileDrawArgs, context: TraversalSelectionContext, frustumTransform?: Transform) {\r\n const preloadFrustum = args.viewingSpace.getPreloadFrustum(frustumTransform, scratchFrustum);\r\n const preloadFrustumPlanes = FrustumPlanes.fromFrustum(preloadFrustum);\r\n const worldToNpc = preloadFrustum.toMap4d();\r\n const preloadWorldToViewMap = args.viewingSpace.calcNpcToView().multiplyMapMap(worldToNpc!);\r\n const preloadArgs = new RealityTileDrawArgs(args, preloadWorldToViewMap, preloadFrustumPlanes);\r\n\r\n if (context.preloadDebugBuilder) {\r\n context.preloadDebugBuilder.setSymbology(ColorDef.blue, ColorDef.blue, 2, 0);\r\n context.preloadDebugBuilder.addFrustum(preloadFrustum);\r\n }\r\n\r\n this.rootTile.preloadTilesInFrustum(preloadArgs, context, 2);\r\n }\r\n\r\n /** @internal */\r\n protected logTiles(label: string, tiles: IterableIterator<Tile>) {\r\n let depthString = \"\";\r\n let min = 10000, max = -10000;\r\n let count = 0;\r\n const depthMap = new Map<number, number>();\r\n for (const tile of tiles) {\r\n count++;\r\n const depth = tile.depth;\r\n min = Math.min(min, tile.depth);\r\n max = Math.max(max, tile.depth);\r\n const found = depthMap.get(depth);\r\n depthMap.set(depth, found === undefined ? 1 : found + 1);\r\n }\r\n\r\n depthMap.forEach((key, value) => depthString += `${key}-${value}, `);\r\n // eslint-disable-next-line no-console\r\n console.log(`${label}: ${count} Min: ${min} Max: ${max} Depths: ${depthString}`);\r\n }\r\n}\r\n"]}
@@ -50,7 +50,7 @@ class TileDrawArgs {
50
50
  this.graphics.symbologyOverrides = symbologyOverrides;
51
51
  this.graphics.animationId = tree.modelId;
52
52
  this.viewingSpace = context.viewingSpace;
53
- this._frustumPlanes = new core_common_1.FrustumPlanes(this.viewingSpace.getFrustum());
53
+ this._frustumPlanes = core_common_1.FrustumPlanes.fromFrustum(this.viewingSpace.getFrustum());
54
54
  this.planarClassifier = context.getPlanarClassifierForModel(tree.modelId);
55
55
  this.drape = context.getTextureDrapeForModel(tree.modelId);
56
56
  // NB: If the tile tree has its own clip, do not also apply the view's clip.
@@ -1 +1 @@
1
- {"version":3,"file":"TileDrawArgs.js","sourceRoot":"","sources":["../../../src/tile/TileDrawArgs.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,wDAAsI;AACtI,oDAA6G;AAE7G,2DAAwD;AAOxD,gDAA6C;AAG7C,MAAM,YAAY,GAAG,IAAI,uBAAO,EAAE,CAAC;AACnC,MAAM,YAAY,GAAG,uBAAO,CAAC,MAAM,EAAE,CA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AA4B,EAAE,QAAuB;QAC/E,MAAM,MAAM,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QACpD,IAAI,SAAS,KAAK,MAAM;YACtB,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IACxF,CAAC;IAED,4JAA4J;IACrJ,aAAa,CAAC,IAAU;QAC7B,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAED,mEAAmE;IAC5D,mBAAmB;QACxB,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC;IACrC,CAAC;IAED,oVAAoV;IAC7U,QAAQ,CAAC,IAAU;QACxB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACzD,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,IAAU;QACzB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED;;OAEG;IACI,oBAAoB,CAAC,MAAc,IAAU,CAAC;IAErD,eAAe;IACf,IAAW,4BAA4B,KAAyB,OAAO,SAAS,CAAC,CAAC,CAAC;CACpF;AA3UD,oCA2UC","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 { BeTimePoint } from \"@itwin/core-bentley\";\r\nimport { ClipVector, Geometry, Map4d, Matrix4d, Point3d, Point4d, Range1d, Range3d, Transform, Vector3d } from \"@itwin/core-geometry\";\r\nimport { FeatureAppearanceProvider, FrustumPlanes, HiddenLine, ViewFlagOverrides } from \"@itwin/core-common\";\r\nimport { FeatureSymbology } from \"../render/FeatureSymbology\";\r\nimport { GraphicBranch } from \"../render/GraphicBranch\";\r\nimport { RenderClipVolume } from \"../render/RenderClipVolume\";\r\nimport { RenderGraphic } from \"../render/RenderGraphic\";\r\nimport { RenderPlanarClassifier } from \"../render/RenderPlanarClassifier\";\r\nimport { RenderTextureDrape } from \"../render/RenderSystem\";\r\nimport { SceneContext } from \"../ViewContext\";\r\nimport { ViewingSpace } from \"../ViewingSpace\";\r\nimport { CoordSystem } from \"../CoordSystem\";\r\nimport { Tile, TileGraphicType, TileTree } from \"./internal\";\r\n\r\nconst scratchRange = new Range3d();\r\nconst scratchPoint = Point3d.create();\r\nconst scratchPoint4d = Point4d.create();\r\nconst scratchXRange = Range1d.createNull();\r\nconst scratchYRange = Range1d.createNull();\r\nconst scratchMatrix4d = Matrix4d.createIdentity();\r\n\r\n/** Parameters used to construct [[TileDrawArgs]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface TileDrawArgParams {\r\n /** Context for the scene into which the tiles are to be rendered. */\r\n context: SceneContext;\r\n /** Transform to be applied when drawing the tiles. */\r\n location: Transform;\r\n /** The tile tree from which to obtain tiles. */\r\n tree: TileTree;\r\n /** The time at which these args were created. */\r\n now: BeTimePoint;\r\n /** Overrides to apply to the view's [ViewFlags]($common) when drawing the tiles. */\r\n viewFlagOverrides: ViewFlagOverrides;\r\n /** Clip volume used to clip the tiles. */\r\n clipVolume?: RenderClipVolume;\r\n /** True if a tile and its child tiles should not be drawn simultaneously. */\r\n parentsAndChildrenExclusive: boolean;\r\n /** Symbology overrides to apply to the tiles. */\r\n symbologyOverrides: FeatureSymbology.Overrides | undefined;\r\n /** Optionally customizes the view's symbology overrides for the tiles. */\r\n appearanceProvider?: FeatureAppearanceProvider;\r\n /** Optionally overrides the view's hidden line settings. */\r\n hiddenLineSettings?: HiddenLine.Settings;\r\n /** If defined, tiles should be culled if they do not intersect this clip. */\r\n intersectionClip?: ClipVector;\r\n /** If defined, the Id of a node in the scene's [RenderSchedule.Script]($common) that applies a transform to the graphics;\r\n * or \"0xffffffff\" for any node that does *not* apply a transform.\r\n * @internal\r\n */\r\n animationTransformNodeId?: number;\r\n /** If defined, a bounding range in tile tree coordinates outside of which tiles should not be selected. */\r\n boundingRange?: Range3d;\r\n /** @alpha */\r\n maximumScreenSpaceError?: number;\r\n}\r\n\r\n/**\r\n * Provides context used when selecting and drawing [[Tile]]s.\r\n * @see [[TileTree.selectTiles]]\r\n * @see [[TileTree.draw]]\r\n * @public\r\n * @extensions\r\n */\r\nexport class TileDrawArgs {\r\n /** Transform to the location in iModel coordinates at which the tiles are to be drawn. */\r\n public readonly location: Transform;\r\n /** The tile tree being drawn. */\r\n public readonly tree: TileTree;\r\n /** Optional clip volume applied to the tiles. */\r\n public clipVolume: RenderClipVolume | undefined;\r\n /** The context in which the tiles will be drawn, exposing, e.g., the [[Viewport]] and accepting [[RenderGraphic]]s to be drawn. */\r\n public readonly context: SceneContext;\r\n /** Describes the viewed volume. */\r\n public viewingSpace: ViewingSpace;\r\n /** Holds the tile graphics to be drawn. */\r\n public readonly graphics: GraphicBranch = new GraphicBranch();\r\n /** @internal */\r\n public readonly now: BeTimePoint;\r\n /** The planes of the viewing frustum, used for frustum culling. */\r\n protected _frustumPlanes?: FrustumPlanes;\r\n /** @internal */\r\n public planarClassifier?: RenderPlanarClassifier;\r\n /** @internal */\r\n public drape?: RenderTextureDrape;\r\n /** Optional clip volume applied to all tiles in the view. */\r\n public readonly viewClip?: ClipVector;\r\n /** True if a tile and its child tiles should not be drawn simultaneously. */\r\n public parentsAndChildrenExclusive: boolean;\r\n /** @internal */\r\n private _appearanceProvider?: FeatureAppearanceProvider;\r\n /** Optional overrides for the view's hidden line settings. */\r\n public hiddenLineSettings?: HiddenLine.Settings;\r\n /** Tiles that we want to draw and that are ready to draw. May not actually be selected, e.g. if sibling tiles are not yet ready. */\r\n public readonly readyTiles = new Set<Tile>();\r\n /** For perspective views, the view-Z of the near plane. */\r\n private readonly _nearFrontCenter?: Point3d;\r\n /** Overrides applied to the view's [ViewFlags]($common) when drawing the tiles. */\r\n public get viewFlagOverrides(): ViewFlagOverrides { return this.graphics.viewFlagOverrides; }\r\n /** If defined, replaces the view's own symbology overrides when drawing the tiles. */\r\n public get symbologyOverrides(): FeatureSymbology.Overrides | undefined { return this.graphics.symbologyOverrides; }\r\n /** If defined, tiles will be culled if they do not intersect this clip. */\r\n public intersectionClip?: ClipVector;\r\n /** If defined, a bounding range in tile tree coordinates outside of which tiles should not be selected. */\r\n public boundingRange?: Range3d;\r\n /** @internal */\r\n public readonly pixelSizeScaleFactor;\r\n /** @internal */\r\n public readonly animationTransformNodeId?: number;\r\n /** @alpha */\r\n public maximumScreenSpaceError;\r\n\r\n /** Compute the size in pixels of the specified tile at the point on its bounding sphere closest to the camera. */\r\n public getPixelSize(tile: Tile): number {\r\n const sizeFromProjection = this.getPixelSizeFromProjection(tile);\r\n if (undefined !== sizeFromProjection)\r\n return sizeFromProjection;\r\n\r\n const radius = this.getTileRadius(tile); // use a sphere to test pixel size. We don't know the orientation of the image within the bounding box.\r\n const center = this.getTileCenter(tile);\r\n\r\n const pixelSizeAtPt = this.computePixelSizeInMetersAtClosestPoint(center, radius);\r\n return 0 !== pixelSizeAtPt ? this.context.adjustPixelSizeForLOD(radius / pixelSizeAtPt) : 1.0e-3;\r\n }\r\n\r\n /** If the tile provides corners (from an OBB) then this produces most accurate representation of the tile size */\r\n private getPixelSizeFromProjection(tile: Tile): number | undefined {\r\n const sizeProjectionCorners = tile.getSizeProjectionCorners();\r\n if (!sizeProjectionCorners)\r\n return undefined;\r\n\r\n /* For maps or global reality models we use the projected screen rectangle rather than sphere to calculate pixel size to avoid excessive tiles at horizon. */\r\n const tileToView = this.worldToViewMap.transform0.multiplyMatrixMatrix(Matrix4d.createTransform(this.location, scratchMatrix4d), scratchMatrix4d);\r\n scratchXRange.setNull();\r\n scratchYRange.setNull();\r\n\r\n let behindEye = false;\r\n for (const corner of sizeProjectionCorners) {\r\n const viewCorner = tileToView.multiplyPoint3d(corner, 1, scratchPoint4d);\r\n if (viewCorner.w < 0.0) {\r\n behindEye = true;\r\n break;\r\n }\r\n\r\n scratchXRange.extendX(viewCorner.x / viewCorner.w);\r\n scratchYRange.extendX(viewCorner.y / viewCorner.w);\r\n }\r\n if (behindEye)\r\n return undefined;\r\n\r\n return scratchXRange.isNull ? 1.0E-3 : this.context.adjustPixelSizeForLOD(Math.sqrt(scratchXRange.length() * scratchYRange.length()));\r\n }\r\n\r\n /** Compute the size in meters of one pixel at the point on the tile's bounding sphere closest to the camera. */\r\n public getPixelSizeInMetersAtClosestPoint(tile: Tile): number {\r\n const radius = this.getTileRadius(tile); // use a sphere to test pixel size. We don't know the orientation of the image within the bounding box.\r\n const center = this.getTileCenter(tile);\r\n\r\n const pixelSizeAtPt = this.computePixelSizeInMetersAtClosestPoint(center, radius);\r\n return 0 !== pixelSizeAtPt ? this.context.adjustPixelSizeForLOD(pixelSizeAtPt) : 1.0e-3;\r\n }\r\n\r\n /** Compute the size in meters of one pixel at the point on a sphere closest to the camera.\r\n * Device scaling is not applied.\r\n */\r\n public computePixelSizeInMetersAtClosestPoint(center: Point3d, radius: number): number {\r\n if (this.context.viewport.view.is3d() && this.context.viewport.isCameraOn && this._nearFrontCenter) {\r\n const toFront = Vector3d.createStartEnd(center, this._nearFrontCenter);\r\n const viewZ = this.context.viewport.rotation.rowZ();\r\n // If the sphere overlaps the near front plane just use near front point. This also handles behind eye conditions.\r\n if (viewZ.dotProduct(toFront) < radius) {\r\n center = this._nearFrontCenter;\r\n } else {\r\n // Find point on sphere closest to eye.\r\n const toEye = center.unitVectorTo(this.context.viewport.view.camera.eye);\r\n\r\n if (toEye) { // Only if tile is not already behind the eye.\r\n toEye.scaleInPlace(radius);\r\n center.addInPlace(toEye);\r\n }\r\n }\r\n }\r\n\r\n const viewPt = this.worldToViewMap.transform0.multiplyPoint3dQuietNormalize(center);\r\n const viewPt2 = new Point3d(viewPt.x + 1.0, viewPt.y, viewPt.z);\r\n return this.worldToViewMap.transform1.multiplyPoint3dQuietNormalize(viewPt).distance(this.worldToViewMap.transform1.multiplyPoint3dQuietNormalize(viewPt2));\r\n }\r\n\r\n /** Compute this size of a sphere on screen in pixels */\r\n public getRangePixelSize(range: Range3d): number {\r\n const transformedRange = this.location.multiplyRange(range, scratchRange);\r\n const center = transformedRange.localXYZToWorld(.5, .5, .5, scratchPoint)!;\r\n const radius = transformedRange.diagonal().magnitude();\r\n\r\n const viewPt = this.worldToViewMap.transform0.multiplyPoint3dQuietNormalize(center);\r\n const viewPt2 = new Point3d(viewPt.x + 1.0, viewPt.y, viewPt.z);\r\n const pixelSizeAtPt = this.worldToViewMap.transform1.multiplyPoint3dQuietNormalize(viewPt).distance(this.worldToViewMap.transform1.multiplyPoint3dQuietNormalize(viewPt2));\r\n return 0 !== pixelSizeAtPt ? radius / pixelSizeAtPt : 1.0e-3;\r\n }\r\n\r\n /** @internal */\r\n public getTileGraphics(tile: Tile) {\r\n return tile.produceGraphics();\r\n }\r\n\r\n /** The planes of the viewing frustum, used for frustum culling. */\r\n public get frustumPlanes(): FrustumPlanes {\r\n return this._frustumPlanes !== undefined ? this._frustumPlanes : this.context.frustumPlanes;\r\n }\r\n\r\n /** Provides conversions between [[CoordSystem.World]] and [[CoordSystem.View]]. */\r\n public get worldToViewMap(): Map4d {\r\n return this.viewingSpace.worldToViewMap;\r\n }\r\n\r\n private computePixelSizeScaleFactor(): number {\r\n // Check to see if a model display transform with non-uniform scaling is being used.\r\n const mat = this.context.viewport.view.modelDisplayTransformProvider?.getModelDisplayTransform(this.tree.modelId)?.matrix;\r\n if (!mat)\r\n return 1;\r\n\r\n const scale = [0, 1, 2].map((x) => mat.getColumn(x).magnitude());\r\n if (Math.abs(scale[0] - scale[1]) <= Geometry.smallMetricDistance && Math.abs(scale[0] - scale[2]) <= Geometry.smallMetricDistance)\r\n return 1;\r\n\r\n // If the component with the largest scale is not the same as the component with the largest tile range use it to adjust the pixel size.\r\n const rangeDiag = this.tree.range.diagonal();\r\n let maxS = 0;\r\n let maxR = 0;\r\n if (scale[0] > scale[1])\r\n maxS = (scale[0] > scale[2] ? 0 : 2);\r\n else\r\n maxS = (scale[1] > scale[2] ? 1 : 2);\r\n\r\n if (rangeDiag.x > rangeDiag.y)\r\n maxR = (rangeDiag.x > rangeDiag.z ? 0 : 2);\r\n else\r\n maxR = (rangeDiag.y > rangeDiag.z ? 1 : 2);\r\n\r\n return maxS !== maxR ? scale[maxS] : 1;\r\n }\r\n\r\n /** Constructor */\r\n public constructor(params: TileDrawArgParams) {\r\n const { location, tree, context, now, viewFlagOverrides, clipVolume, parentsAndChildrenExclusive, symbologyOverrides } = params;\r\n this.location = location;\r\n this.tree = tree;\r\n this.context = context;\r\n this.now = now;\r\n this._appearanceProvider = params.appearanceProvider;\r\n this.hiddenLineSettings = params.hiddenLineSettings;\r\n this.animationTransformNodeId = params.animationTransformNodeId;\r\n this.boundingRange = params.boundingRange;\r\n this.maximumScreenSpaceError = params.maximumScreenSpaceError ?? 16; // 16 is Cesium's default.\r\n\r\n // Do not cull tiles based on clip volume if tiles outside clip are supposed to be drawn but in a different color.\r\n if (undefined !== clipVolume && !context.viewport.view.displayStyle.settings.clipStyle.outsideColor)\r\n this.clipVolume = clipVolume;\r\n\r\n this.graphics.setViewFlagOverrides(viewFlagOverrides);\r\n this.graphics.symbologyOverrides = symbologyOverrides;\r\n this.graphics.animationId = tree.modelId;\r\n\r\n this.viewingSpace = context.viewingSpace;\r\n this._frustumPlanes = new FrustumPlanes(this.viewingSpace.getFrustum());\r\n\r\n this.planarClassifier = context.getPlanarClassifierForModel(tree.modelId);\r\n this.drape = context.getTextureDrapeForModel(tree.modelId);\r\n\r\n // NB: If the tile tree has its own clip, do not also apply the view's clip.\r\n if (context.viewFlags.clipVolume && false !== viewFlagOverrides.clipVolume && undefined === clipVolume) {\r\n const outsideClipColor = context.viewport.displayStyle.settings.clipStyle.outsideColor;\r\n this.viewClip = undefined === outsideClipColor ? context.viewport.view.getViewClip() : undefined;\r\n }\r\n\r\n this.parentsAndChildrenExclusive = parentsAndChildrenExclusive;\r\n if (context.viewport.isCameraOn)\r\n this._nearFrontCenter = context.viewport.getFrustum(CoordSystem.World).frontCenter;\r\n\r\n this.pixelSizeScaleFactor = this.computePixelSizeScaleFactor();\r\n }\r\n\r\n /** A multiplier applied to a [[Tile]]'s `maximumSize` property to adjust level of detail.\r\n * @see [[Viewport.tileSizeModifier]].\r\n * @public\r\n */\r\n public get tileSizeModifier(): number { return this.context.viewport.tileSizeModifier; }\r\n\r\n /** @internal */\r\n public getTileCenter(tile: Tile): Point3d { return this.location.multiplyPoint3d(tile.center); }\r\n\r\n /** @internal */\r\n public getTileRadius(tile: Tile): number {\r\n let range: Range3d = tile.range.clone(scratchRange);\r\n if (tile.tree.is2d) {\r\n // 2d tiles have a fixed Z range of [-1, 1]. Sometimes (e.g., hypermodeling) we draw them within a 3d view. Prevent Z from artificially expanding the radius.\r\n range.low.z = range.high.z = 0;\r\n }\r\n\r\n range = this.location.multiplyRange(range, range);\r\n return 0.5 * range.low.distance(range.high);\r\n }\r\n\r\n /** @internal */\r\n public get clip(): ClipVector | undefined {\r\n return undefined !== this.clipVolume ? this.clipVolume.clipVector : undefined;\r\n }\r\n\r\n /** Add a provider to supplement or override the symbology overrides for the view.\r\n * @note If a provider already exists, the new provider will be chained such that it sees the base overrides\r\n * after they have potentially been modified by the existing provider.\r\n * @public\r\n */\r\n public addAppearanceProvider(provider: FeatureAppearanceProvider): void {\r\n this._appearanceProvider = this._appearanceProvider ? FeatureAppearanceProvider.chain(this._appearanceProvider, provider) : provider;\r\n }\r\n\r\n /** Optionally customizes aspects of the view's [[FeatureSymbology.Overrides]]. */\r\n public get appearanceProvider(): FeatureAppearanceProvider | undefined {\r\n return this._appearanceProvider;\r\n }\r\n\r\n /** @internal */\r\n public produceGraphics(): RenderGraphic | undefined {\r\n return this._produceGraphicBranch(this.graphics);\r\n }\r\n /** @internal */\r\n public get secondaryClassifiers(): Map<number, RenderPlanarClassifier>| undefined {\r\n return undefined;\r\n }\r\n\r\n /** @internal */\r\n private _produceGraphicBranch(graphics: GraphicBranch): RenderGraphic | undefined {\r\n if (graphics.isEmpty)\r\n return undefined;\r\n\r\n const opts = {\r\n iModel: this.tree.iModel,\r\n clipVolume: this.clipVolume,\r\n classifierOrDrape: this.planarClassifier ?? this.drape,\r\n appearanceProvider: this.appearanceProvider,\r\n hline: this.hiddenLineSettings,\r\n secondaryClassifiers: this.secondaryClassifiers,\r\n };\r\n\r\n let graphic = this.context.createGraphicBranch(graphics, this.location, opts);\r\n if (undefined !== this.animationTransformNodeId)\r\n graphic = this.context.renderSystem.createAnimationTransformNode(graphic, this.animationTransformNodeId);\r\n\r\n return graphic;\r\n }\r\n\r\n /** Output graphics for all accumulated tiles. */\r\n public drawGraphics(): void {\r\n const graphics = this.produceGraphics();\r\n if (undefined !== graphics)\r\n this.context.outputGraphic(graphics);\r\n }\r\n\r\n /** Output graphics of the specified type for all accumulated tiles. */\r\n public drawGraphicsWithType(graphicType: TileGraphicType, graphics: GraphicBranch): void {\r\n const branch = this._produceGraphicBranch(graphics);\r\n if (undefined !== branch)\r\n this.context.withGraphicType(graphicType, () => this.context.outputGraphic(branch));\r\n }\r\n\r\n /** Indicate that graphics for the specified tile are desired but not yet available. Subsequently a request will be enqueued to load the tile's graphics. */\r\n public insertMissing(tile: Tile): void {\r\n this.context.insertMissingTile(tile);\r\n }\r\n\r\n /** Indicate that some requested child tiles are not yet loaded. */\r\n public markChildrenLoading(): void {\r\n this.context.markChildrenLoading();\r\n }\r\n\r\n /** Indicate that the specified tile is being used for some purpose by the [[SceneContext]]'s [[Viewport]]. Typically \"used\" means \"displayed\", but the exact meaning is up to the [[TileTree]] - for example, \"used\" might also mean that the tile's children are being used. A tile that is \"in use\" by any [[Viewport]] will not be discarded. */\r\n public markUsed(tile: Tile): void {\r\n tile.usageMarker.mark(this.context.viewport, this.now);\r\n }\r\n\r\n /** Indicate that the specified tile should be displayed and that its graphics are ready to be displayed. The number of \"ready\" tiles is used in conjunction with the number of \"missing\" tiles to convey to the user how complete the current view is.\r\n * @see [[insertMissing]]\r\n */\r\n public markReady(tile: Tile): void {\r\n this.readyTiles.add(tile);\r\n }\r\n\r\n /** Invoked by [[TileTree.selectTiles]]. This exists chiefly for [[SolarShadowMap]].\r\n * @internal\r\n */\r\n public processSelectedTiles(_tiles: Tile[]): void { }\r\n\r\n /* @internal */\r\n public get maxRealityTreeSelectionCount(): number | undefined { return undefined; }\r\n}\r\n"]}
1
+ {"version":3,"file":"TileDrawArgs.js","sourceRoot":"","sources":["../../../src/tile/TileDrawArgs.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,wDAAsI;AACtI,oDAA6G;AAE7G,2DAAwD;AAOxD,gDAA6C;AAG7C,MAAM,YAAY,GAAG,IAAI,uBAAO,EAAE,CAAC;AACnC,MAAM,YAAY,GAAG,uBAAO,CAAC,MAAM,EAAE,CAAC;AACtC,MAAM,cAAc,GAAG,uBAAO,CAAC,MAAM,EAAE,CAAC;AACxC,MAAM,aAAa,GAAG,uBAAO,CAAC,UAAU,EAAE,CAAC;AAC3C,MAAM,aAAa,GAAG,uBAAO,CAAC,UAAU,EAAE,CAAC;AAC3C,MAAM,eAAe,GAAG,wBAAQ,CAAC,cAAc,EAAE,CAAC;AAwClD;;;;;;GAMG;AACH,MAAa,YAAY;IAkLvB,kBAAkB;IAClB,YAAmB,MAAyB;;QAxK5C,2CAA2C;QAC3B,aAAQ,GAAkB,IAAI,6BAAa,EAAE,CAAC;QAiB9D,oIAAoI;QACpH,eAAU,GAAG,IAAI,GAAG,EAAQ,CAAC;QAsJ3C,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,iBAAiB,EAAE,UAAU,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,GAAG,MAAM,CAAC;QAChI,IAAI,CAAC,QAAQ,G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AAI,CAAC,GAAG,CAAC,CAAC;IACzD,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,IAAU;QACzB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED;;OAEG;IACI,oBAAoB,CAAC,MAAc,IAAU,CAAC;IAErD,eAAe;IACf,IAAW,4BAA4B,KAAyB,OAAO,SAAS,CAAC,CAAC,CAAC;CACpF;AA3UD,oCA2UC","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 { BeTimePoint } from \"@itwin/core-bentley\";\r\nimport { ClipVector, Geometry, Map4d, Matrix4d, Point3d, Point4d, Range1d, Range3d, Transform, Vector3d } from \"@itwin/core-geometry\";\r\nimport { FeatureAppearanceProvider, FrustumPlanes, HiddenLine, ViewFlagOverrides } from \"@itwin/core-common\";\r\nimport { FeatureSymbology } from \"../render/FeatureSymbology\";\r\nimport { GraphicBranch } from \"../render/GraphicBranch\";\r\nimport { RenderClipVolume } from \"../render/RenderClipVolume\";\r\nimport { RenderGraphic } from \"../render/RenderGraphic\";\r\nimport { RenderPlanarClassifier } from \"../render/RenderPlanarClassifier\";\r\nimport { RenderTextureDrape } from \"../render/RenderSystem\";\r\nimport { SceneContext } from \"../ViewContext\";\r\nimport { ViewingSpace } from \"../ViewingSpace\";\r\nimport { CoordSystem } from \"../CoordSystem\";\r\nimport { Tile, TileGraphicType, TileTree } from \"./internal\";\r\n\r\nconst scratchRange = new Range3d();\r\nconst scratchPoint = Point3d.create();\r\nconst scratchPoint4d = Point4d.create();\r\nconst scratchXRange = Range1d.createNull();\r\nconst scratchYRange = Range1d.createNull();\r\nconst scratchMatrix4d = Matrix4d.createIdentity();\r\n\r\n/** Parameters used to construct [[TileDrawArgs]].\r\n * @public\r\n * @extensions\r\n */\r\nexport interface TileDrawArgParams {\r\n /** Context for the scene into which the tiles are to be rendered. */\r\n context: SceneContext;\r\n /** Transform to be applied when drawing the tiles. */\r\n location: Transform;\r\n /** The tile tree from which to obtain tiles. */\r\n tree: TileTree;\r\n /** The time at which these args were created. */\r\n now: BeTimePoint;\r\n /** Overrides to apply to the view's [ViewFlags]($common) when drawing the tiles. */\r\n viewFlagOverrides: ViewFlagOverrides;\r\n /** Clip volume used to clip the tiles. */\r\n clipVolume?: RenderClipVolume;\r\n /** True if a tile and its child tiles should not be drawn simultaneously. */\r\n parentsAndChildrenExclusive: boolean;\r\n /** Symbology overrides to apply to the tiles. */\r\n symbologyOverrides: FeatureSymbology.Overrides | undefined;\r\n /** Optionally customizes the view's symbology overrides for the tiles. */\r\n appearanceProvider?: FeatureAppearanceProvider;\r\n /** Optionally overrides the view's hidden line settings. */\r\n hiddenLineSettings?: HiddenLine.Settings;\r\n /** If defined, tiles should be culled if they do not intersect this clip. */\r\n intersectionClip?: ClipVector;\r\n /** If defined, the Id of a node in the scene's [RenderSchedule.Script]($common) that applies a transform to the graphics;\r\n * or \"0xffffffff\" for any node that does *not* apply a transform.\r\n * @internal\r\n */\r\n animationTransformNodeId?: number;\r\n /** If defined, a bounding range in tile tree coordinates outside of which tiles should not be selected. */\r\n boundingRange?: Range3d;\r\n /** @alpha */\r\n maximumScreenSpaceError?: number;\r\n}\r\n\r\n/**\r\n * Provides context used when selecting and drawing [[Tile]]s.\r\n * @see [[TileTree.selectTiles]]\r\n * @see [[TileTree.draw]]\r\n * @public\r\n * @extensions\r\n */\r\nexport class TileDrawArgs {\r\n /** Transform to the location in iModel coordinates at which the tiles are to be drawn. */\r\n public readonly location: Transform;\r\n /** The tile tree being drawn. */\r\n public readonly tree: TileTree;\r\n /** Optional clip volume applied to the tiles. */\r\n public clipVolume: RenderClipVolume | undefined;\r\n /** The context in which the tiles will be drawn, exposing, e.g., the [[Viewport]] and accepting [[RenderGraphic]]s to be drawn. */\r\n public readonly context: SceneContext;\r\n /** Describes the viewed volume. */\r\n public viewingSpace: ViewingSpace;\r\n /** Holds the tile graphics to be drawn. */\r\n public readonly graphics: GraphicBranch = new GraphicBranch();\r\n /** @internal */\r\n public readonly now: BeTimePoint;\r\n /** The planes of the viewing frustum, used for frustum culling. */\r\n protected _frustumPlanes?: FrustumPlanes;\r\n /** @internal */\r\n public planarClassifier?: RenderPlanarClassifier;\r\n /** @internal */\r\n public drape?: RenderTextureDrape;\r\n /** Optional clip volume applied to all tiles in the view. */\r\n public readonly viewClip?: ClipVector;\r\n /** True if a tile and its child tiles should not be drawn simultaneously. */\r\n public parentsAndChildrenExclusive: boolean;\r\n /** @internal */\r\n private _appearanceProvider?: FeatureAppearanceProvider;\r\n /** Optional overrides for the view's hidden line settings. */\r\n public hiddenLineSettings?: HiddenLine.Settings;\r\n /** Tiles that we want to draw and that are ready to draw. May not actually be selected, e.g. if sibling tiles are not yet ready. */\r\n public readonly readyTiles = new Set<Tile>();\r\n /** For perspective views, the view-Z of the near plane. */\r\n private readonly _nearFrontCenter?: Point3d;\r\n /** Overrides applied to the view's [ViewFlags]($common) when drawing the tiles. */\r\n public get viewFlagOverrides(): ViewFlagOverrides { return this.graphics.viewFlagOverrides; }\r\n /** If defined, replaces the view's own symbology overrides when drawing the tiles. */\r\n public get symbologyOverrides(): FeatureSymbology.Overrides | undefined { return this.graphics.symbologyOverrides; }\r\n /** If defined, tiles will be culled if they do not intersect this clip. */\r\n public intersectionClip?: ClipVector;\r\n /** If defined, a bounding range in tile tree coordinates outside of which tiles should not be selected. */\r\n public boundingRange?: Range3d;\r\n /** @internal */\r\n public readonly pixelSizeScaleFactor;\r\n /** @internal */\r\n public readonly animationTransformNodeId?: number;\r\n /** @alpha */\r\n public maximumScreenSpaceError;\r\n\r\n /** Compute the size in pixels of the specified tile at the point on its bounding sphere closest to the camera. */\r\n public getPixelSize(tile: Tile): number {\r\n const sizeFromProjection = this.getPixelSizeFromProjection(tile);\r\n if (undefined !== sizeFromProjection)\r\n return sizeFromProjection;\r\n\r\n const radius = this.getTileRadius(tile); // use a sphere to test pixel size. We don't know the orientation of the image within the bounding box.\r\n const center = this.getTileCenter(tile);\r\n\r\n const pixelSizeAtPt = this.computePixelSizeInMetersAtClosestPoint(center, radius);\r\n return 0 !== pixelSizeAtPt ? this.context.adjustPixelSizeForLOD(radius / pixelSizeAtPt) : 1.0e-3;\r\n }\r\n\r\n /** If the tile provides corners (from an OBB) then this produces most accurate representation of the tile size */\r\n private getPixelSizeFromProjection(tile: Tile): number | undefined {\r\n const sizeProjectionCorners = tile.getSizeProjectionCorners();\r\n if (!sizeProjectionCorners)\r\n return undefined;\r\n\r\n /* For maps or global reality models we use the projected screen rectangle rather than sphere to calculate pixel size to avoid excessive tiles at horizon. */\r\n const tileToView = this.worldToViewMap.transform0.multiplyMatrixMatrix(Matrix4d.createTransform(this.location, scratchMatrix4d), scratchMatrix4d);\r\n scratchXRange.setNull();\r\n scratchYRange.setNull();\r\n\r\n let behindEye = false;\r\n for (const corner of sizeProjectionCorners) {\r\n const viewCorner = tileToView.multiplyPoint3d(corner, 1, scratchPoint4d);\r\n if (viewCorner.w < 0.0) {\r\n behindEye = true;\r\n break;\r\n }\r\n\r\n scratchXRange.extendX(viewCorner.x / viewCorner.w);\r\n scratchYRange.extendX(viewCorner.y / viewCorner.w);\r\n }\r\n if (behindEye)\r\n return undefined;\r\n\r\n return scratchXRange.isNull ? 1.0E-3 : this.context.adjustPixelSizeForLOD(Math.sqrt(scratchXRange.length() * scratchYRange.length()));\r\n }\r\n\r\n /** Compute the size in meters of one pixel at the point on the tile's bounding sphere closest to the camera. */\r\n public getPixelSizeInMetersAtClosestPoint(tile: Tile): number {\r\n const radius = this.getTileRadius(tile); // use a sphere to test pixel size. We don't know the orientation of the image within the bounding box.\r\n const center = this.getTileCenter(tile);\r\n\r\n const pixelSizeAtPt = this.computePixelSizeInMetersAtClosestPoint(center, radius);\r\n return 0 !== pixelSizeAtPt ? this.context.adjustPixelSizeForLOD(pixelSizeAtPt) : 1.0e-3;\r\n }\r\n\r\n /** Compute the size in meters of one pixel at the point on a sphere closest to the camera.\r\n * Device scaling is not applied.\r\n */\r\n public computePixelSizeInMetersAtClosestPoint(center: Point3d, radius: number): number {\r\n if (this.context.viewport.view.is3d() && this.context.viewport.isCameraOn && this._nearFrontCenter) {\r\n const toFront = Vector3d.createStartEnd(center, this._nearFrontCenter);\r\n const viewZ = this.context.viewport.rotation.rowZ();\r\n // If the sphere overlaps the near front plane just use near front point. This also handles behind eye conditions.\r\n if (viewZ.dotProduct(toFront) < radius) {\r\n center = this._nearFrontCenter;\r\n } else {\r\n // Find point on sphere closest to eye.\r\n const toEye = center.unitVectorTo(this.context.viewport.view.camera.eye);\r\n\r\n if (toEye) { // Only if tile is not already behind the eye.\r\n toEye.scaleInPlace(radius);\r\n center.addInPlace(toEye);\r\n }\r\n }\r\n }\r\n\r\n const viewPt = this.worldToViewMap.transform0.multiplyPoint3dQuietNormalize(center);\r\n const viewPt2 = new Point3d(viewPt.x + 1.0, viewPt.y, viewPt.z);\r\n return this.worldToViewMap.transform1.multiplyPoint3dQuietNormalize(viewPt).distance(this.worldToViewMap.transform1.multiplyPoint3dQuietNormalize(viewPt2));\r\n }\r\n\r\n /** Compute this size of a sphere on screen in pixels */\r\n public getRangePixelSize(range: Range3d): number {\r\n const transformedRange = this.location.multiplyRange(range, scratchRange);\r\n const center = transformedRange.localXYZToWorld(.5, .5, .5, scratchPoint)!;\r\n const radius = transformedRange.diagonal().magnitude();\r\n\r\n const viewPt = this.worldToViewMap.transform0.multiplyPoint3dQuietNormalize(center);\r\n const viewPt2 = new Point3d(viewPt.x + 1.0, viewPt.y, viewPt.z);\r\n const pixelSizeAtPt = this.worldToViewMap.transform1.multiplyPoint3dQuietNormalize(viewPt).distance(this.worldToViewMap.transform1.multiplyPoint3dQuietNormalize(viewPt2));\r\n return 0 !== pixelSizeAtPt ? radius / pixelSizeAtPt : 1.0e-3;\r\n }\r\n\r\n /** @internal */\r\n public getTileGraphics(tile: Tile) {\r\n return tile.produceGraphics();\r\n }\r\n\r\n /** The planes of the viewing frustum, used for frustum culling. */\r\n public get frustumPlanes(): FrustumPlanes {\r\n return this._frustumPlanes !== undefined ? this._frustumPlanes : this.context.frustumPlanes;\r\n }\r\n\r\n /** Provides conversions between [[CoordSystem.World]] and [[CoordSystem.View]]. */\r\n public get worldToViewMap(): Map4d {\r\n return this.viewingSpace.worldToViewMap;\r\n }\r\n\r\n private computePixelSizeScaleFactor(): number {\r\n // Check to see if a model display transform with non-uniform scaling is being used.\r\n const mat = this.context.viewport.view.modelDisplayTransformProvider?.getModelDisplayTransform(this.tree.modelId)?.matrix;\r\n if (!mat)\r\n return 1;\r\n\r\n const scale = [0, 1, 2].map((x) => mat.getColumn(x).magnitude());\r\n if (Math.abs(scale[0] - scale[1]) <= Geometry.smallMetricDistance && Math.abs(scale[0] - scale[2]) <= Geometry.smallMetricDistance)\r\n return 1;\r\n\r\n // If the component with the largest scale is not the same as the component with the largest tile range use it to adjust the pixel size.\r\n const rangeDiag = this.tree.range.diagonal();\r\n let maxS = 0;\r\n let maxR = 0;\r\n if (scale[0] > scale[1])\r\n maxS = (scale[0] > scale[2] ? 0 : 2);\r\n else\r\n maxS = (scale[1] > scale[2] ? 1 : 2);\r\n\r\n if (rangeDiag.x > rangeDiag.y)\r\n maxR = (rangeDiag.x > rangeDiag.z ? 0 : 2);\r\n else\r\n maxR = (rangeDiag.y > rangeDiag.z ? 1 : 2);\r\n\r\n return maxS !== maxR ? scale[maxS] : 1;\r\n }\r\n\r\n /** Constructor */\r\n public constructor(params: TileDrawArgParams) {\r\n const { location, tree, context, now, viewFlagOverrides, clipVolume, parentsAndChildrenExclusive, symbologyOverrides } = params;\r\n this.location = location;\r\n this.tree = tree;\r\n this.context = context;\r\n this.now = now;\r\n this._appearanceProvider = params.appearanceProvider;\r\n this.hiddenLineSettings = params.hiddenLineSettings;\r\n this.animationTransformNodeId = params.animationTransformNodeId;\r\n this.boundingRange = params.boundingRange;\r\n this.maximumScreenSpaceError = params.maximumScreenSpaceError ?? 16; // 16 is Cesium's default.\r\n\r\n // Do not cull tiles based on clip volume if tiles outside clip are supposed to be drawn but in a different color.\r\n if (undefined !== clipVolume && !context.viewport.view.displayStyle.settings.clipStyle.outsideColor)\r\n this.clipVolume = clipVolume;\r\n\r\n this.graphics.setViewFlagOverrides(viewFlagOverrides);\r\n this.graphics.symbologyOverrides = symbologyOverrides;\r\n this.graphics.animationId = tree.modelId;\r\n\r\n this.viewingSpace = context.viewingSpace;\r\n this._frustumPlanes = FrustumPlanes.fromFrustum(this.viewingSpace.getFrustum());\r\n\r\n this.planarClassifier = context.getPlanarClassifierForModel(tree.modelId);\r\n this.drape = context.getTextureDrapeForModel(tree.modelId);\r\n\r\n // NB: If the tile tree has its own clip, do not also apply the view's clip.\r\n if (context.viewFlags.clipVolume && false !== viewFlagOverrides.clipVolume && undefined === clipVolume) {\r\n const outsideClipColor = context.viewport.displayStyle.settings.clipStyle.outsideColor;\r\n this.viewClip = undefined === outsideClipColor ? context.viewport.view.getViewClip() : undefined;\r\n }\r\n\r\n this.parentsAndChildrenExclusive = parentsAndChildrenExclusive;\r\n if (context.viewport.isCameraOn)\r\n this._nearFrontCenter = context.viewport.getFrustum(CoordSystem.World).frontCenter;\r\n\r\n this.pixelSizeScaleFactor = this.computePixelSizeScaleFactor();\r\n }\r\n\r\n /** A multiplier applied to a [[Tile]]'s `maximumSize` property to adjust level of detail.\r\n * @see [[Viewport.tileSizeModifier]].\r\n * @public\r\n */\r\n public get tileSizeModifier(): number { return this.context.viewport.tileSizeModifier; }\r\n\r\n /** @internal */\r\n public getTileCenter(tile: Tile): Point3d { return this.location.multiplyPoint3d(tile.center); }\r\n\r\n /** @internal */\r\n public getTileRadius(tile: Tile): number {\r\n let range: Range3d = tile.range.clone(scratchRange);\r\n if (tile.tree.is2d) {\r\n // 2d tiles have a fixed Z range of [-1, 1]. Sometimes (e.g., hypermodeling) we draw them within a 3d view. Prevent Z from artificially expanding the radius.\r\n range.low.z = range.high.z = 0;\r\n }\r\n\r\n range = this.location.multiplyRange(range, range);\r\n return 0.5 * range.low.distance(range.high);\r\n }\r\n\r\n /** @internal */\r\n public get clip(): ClipVector | undefined {\r\n return undefined !== this.clipVolume ? this.clipVolume.clipVector : undefined;\r\n }\r\n\r\n /** Add a provider to supplement or override the symbology overrides for the view.\r\n * @note If a provider already exists, the new provider will be chained such that it sees the base overrides\r\n * after they have potentially been modified by the existing provider.\r\n * @public\r\n */\r\n public addAppearanceProvider(provider: FeatureAppearanceProvider): void {\r\n this._appearanceProvider = this._appearanceProvider ? FeatureAppearanceProvider.chain(this._appearanceProvider, provider) : provider;\r\n }\r\n\r\n /** Optionally customizes aspects of the view's [[FeatureSymbology.Overrides]]. */\r\n public get appearanceProvider(): FeatureAppearanceProvider | undefined {\r\n return this._appearanceProvider;\r\n }\r\n\r\n /** @internal */\r\n public produceGraphics(): RenderGraphic | undefined {\r\n return this._produceGraphicBranch(this.graphics);\r\n }\r\n /** @internal */\r\n public get secondaryClassifiers(): Map<number, RenderPlanarClassifier>| undefined {\r\n return undefined;\r\n }\r\n\r\n /** @internal */\r\n private _produceGraphicBranch(graphics: GraphicBranch): RenderGraphic | undefined {\r\n if (graphics.isEmpty)\r\n return undefined;\r\n\r\n const opts = {\r\n iModel: this.tree.iModel,\r\n clipVolume: this.clipVolume,\r\n classifierOrDrape: this.planarClassifier ?? this.drape,\r\n appearanceProvider: this.appearanceProvider,\r\n hline: this.hiddenLineSettings,\r\n secondaryClassifiers: this.secondaryClassifiers,\r\n };\r\n\r\n let graphic = this.context.createGraphicBranch(graphics, this.location, opts);\r\n if (undefined !== this.animationTransformNodeId)\r\n graphic = this.context.renderSystem.createAnimationTransformNode(graphic, this.animationTransformNodeId);\r\n\r\n return graphic;\r\n }\r\n\r\n /** Output graphics for all accumulated tiles. */\r\n public drawGraphics(): void {\r\n const graphics = this.produceGraphics();\r\n if (undefined !== graphics)\r\n this.context.outputGraphic(graphics);\r\n }\r\n\r\n /** Output graphics of the specified type for all accumulated tiles. */\r\n public drawGraphicsWithType(graphicType: TileGraphicType, graphics: GraphicBranch): void {\r\n const branch = this._produceGraphicBranch(graphics);\r\n if (undefined !== branch)\r\n this.context.withGraphicType(graphicType, () => this.context.outputGraphic(branch));\r\n }\r\n\r\n /** Indicate that graphics for the specified tile are desired but not yet available. Subsequently a request will be enqueued to load the tile's graphics. */\r\n public insertMissing(tile: Tile): void {\r\n this.context.insertMissingTile(tile);\r\n }\r\n\r\n /** Indicate that some requested child tiles are not yet loaded. */\r\n public markChildrenLoading(): void {\r\n this.context.markChildrenLoading();\r\n }\r\n\r\n /** Indicate that the specified tile is being used for some purpose by the [[SceneContext]]'s [[Viewport]]. Typically \"used\" means \"displayed\", but the exact meaning is up to the [[TileTree]] - for example, \"used\" might also mean that the tile's children are being used. A tile that is \"in use\" by any [[Viewport]] will not be discarded. */\r\n public markUsed(tile: Tile): void {\r\n tile.usageMarker.mark(this.context.viewport, this.now);\r\n }\r\n\r\n /** Indicate that the specified tile should be displayed and that its graphics are ready to be displayed. The number of \"ready\" tiles is used in conjunction with the number of \"missing\" tiles to convey to the user how complete the current view is.\r\n * @see [[insertMissing]]\r\n */\r\n public markReady(tile: Tile): void {\r\n this.readyTiles.add(tile);\r\n }\r\n\r\n /** Invoked by [[TileTree.selectTiles]]. This exists chiefly for [[SolarShadowMap]].\r\n * @internal\r\n */\r\n public processSelectedTiles(_tiles: Tile[]): void { }\r\n\r\n /* @internal */\r\n public get maxRealityTreeSelectionCount(): number | undefined { return undefined; }\r\n}\r\n"]}
@@ -73,7 +73,7 @@ export interface IModelAppOptions {
73
73
  accuSnap?: AccuSnap;
74
74
  /** If present, supplies the [[Localization]] for this session. Defaults to [ITwinLocalization]($i18n). */
75
75
  localization?: Localization;
76
- /** If present, supplies the authorization information for various frontend APIs */
76
+ /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */
77
77
  authorizationClient?: AuthorizationClient;
78
78
  /** If present, supplies security options for the frontend. */
79
79
  security?: FrontendSecurityOptions;
@@ -169,7 +169,7 @@ export declare class IModelApp {
169
169
  * @internal
170
170
  */
171
171
  static readonly onAfterStartup: BeEvent<() => void>;
172
- /** Provides authorization information for various frontend APIs */
172
+ /** The AuthorizationClient used to obtain [AccessToken]($bentley)s. */
173
173
  static authorizationClient?: AuthorizationClient;
174
174
  /** The [[ToolRegistry]] for this session. */
175
175
  static readonly tools: ToolRegistry;
@@ -296,7 +296,7 @@ export declare class IModelApp {
296
296
  /** The main event processing loop for Tools and rendering. */
297
297
  private static eventLoop;
298
298
  /** Get the user's access token for this IModelApp, or a blank string if none is available.
299
- * @note accessTokens expire periodically and are automatically refreshed, if possible. Therefore tokens should not be saved, and the value
299
+ * @note Access tokens expire periodically and are automatically refreshed, if possible. Therefore tokens should not be saved, and the value
300
300
  * returned by this method may change over time throughout the course of a session.
301
301
  */
302
302
  static getAccessToken(): Promise<AccessToken>;
@@ -1 +1 @@
1
- {"version":3,"file":"IModelApp.d.ts","sourceRoot":"","sources":["../../src/IModelApp.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,cAAc;AAEd,eAAO,MAAM,oBAAoB,QAAkD,CAAC;AAGpF,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAA0C,UAAU,EAA2B,MAAM,qBAAqB,CAAC;AACpJ,OAAO,EACL,mBAAmB,EAAgB,YAAY,EAAE,iBAAiB,EAAoB,sBAAsB,EAC7G,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAA4B,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AACpG,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,OAAO,EAAE,cAAc,EAAE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AC,MAAM,CAAC,qBAAqB;CAKrC"}
@@ -335,7 +335,7 @@ export class IModelApp {
335
335
  }
336
336
  }
337
337
  /** Get the user's access token for this IModelApp, or a blank string if none is available.
338
- * @note accessTokens expire periodically and are automatically refreshed, if possible. Therefore tokens should not be saved, and the value
338
+ * @note Access tokens expire periodically and are automatically refreshed, if possible. Therefore tokens should not be saved, and the value
339
339
  * returned by this method may change over time throughout the course of a session.
340
340
  */
341
341
  static async getAccessToken() {