@itwin/core-frontend 5.0.0-dev.50 → 5.0.0-dev.53

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 (87) hide show
  1. package/lib/cjs/AccuDraw.d.ts +13 -1
  2. package/lib/cjs/AccuDraw.d.ts.map +1 -1
  3. package/lib/cjs/AccuDraw.js +13 -1
  4. package/lib/cjs/AccuDraw.js.map +1 -1
  5. package/lib/cjs/DisplayStyleState.d.ts +1 -3
  6. package/lib/cjs/DisplayStyleState.d.ts.map +1 -1
  7. package/lib/cjs/DisplayStyleState.js +4 -8
  8. package/lib/cjs/DisplayStyleState.js.map +1 -1
  9. package/lib/cjs/IModelConnection.d.ts +1 -8
  10. package/lib/cjs/IModelConnection.d.ts.map +1 -1
  11. package/lib/cjs/IModelConnection.js +0 -14
  12. package/lib/cjs/IModelConnection.js.map +1 -1
  13. package/lib/cjs/PlanarClipMaskState.js +2 -2
  14. package/lib/cjs/PlanarClipMaskState.js.map +1 -1
  15. package/lib/cjs/SpatialViewState.d.ts +1 -1
  16. package/lib/cjs/SpatialViewState.d.ts.map +1 -1
  17. package/lib/cjs/SpatialViewState.js +6 -5
  18. package/lib/cjs/SpatialViewState.js.map +1 -1
  19. package/lib/cjs/ViewState.d.ts +7 -7
  20. package/lib/cjs/ViewState.d.ts.map +1 -1
  21. package/lib/cjs/ViewState.js +31 -16
  22. package/lib/cjs/ViewState.js.map +1 -1
  23. package/lib/cjs/ViewingSpace.d.ts.map +1 -1
  24. package/lib/cjs/ViewingSpace.js +5 -4
  25. package/lib/cjs/ViewingSpace.js.map +1 -1
  26. package/lib/cjs/Viewport.d.ts +11 -5
  27. package/lib/cjs/Viewport.d.ts.map +1 -1
  28. package/lib/cjs/Viewport.js +49 -36
  29. package/lib/cjs/Viewport.js.map +1 -1
  30. package/lib/cjs/render/webgl/SolarShadowMap.js +4 -4
  31. package/lib/cjs/render/webgl/SolarShadowMap.js.map +1 -1
  32. package/lib/cjs/tile/TiledGraphicsProvider.d.ts +14 -1
  33. package/lib/cjs/tile/TiledGraphicsProvider.d.ts.map +1 -1
  34. package/lib/cjs/tile/TiledGraphicsProvider.js +15 -0
  35. package/lib/cjs/tile/TiledGraphicsProvider.js.map +1 -1
  36. package/lib/cjs/tile/map/MapTiledGraphicsProvider.d.ts +1 -0
  37. package/lib/cjs/tile/map/MapTiledGraphicsProvider.d.ts.map +1 -1
  38. package/lib/cjs/tile/map/MapTiledGraphicsProvider.js +6 -0
  39. package/lib/cjs/tile/map/MapTiledGraphicsProvider.js.map +1 -1
  40. package/lib/cjs/tools/AccuDrawViewportUI.d.ts +5 -0
  41. package/lib/cjs/tools/AccuDrawViewportUI.d.ts.map +1 -1
  42. package/lib/cjs/tools/AccuDrawViewportUI.js +10 -7
  43. package/lib/cjs/tools/AccuDrawViewportUI.js.map +1 -1
  44. package/lib/esm/AccuDraw.d.ts +13 -1
  45. package/lib/esm/AccuDraw.d.ts.map +1 -1
  46. package/lib/esm/AccuDraw.js +13 -1
  47. package/lib/esm/AccuDraw.js.map +1 -1
  48. package/lib/esm/DisplayStyleState.d.ts +1 -3
  49. package/lib/esm/DisplayStyleState.d.ts.map +1 -1
  50. package/lib/esm/DisplayStyleState.js +4 -8
  51. package/lib/esm/DisplayStyleState.js.map +1 -1
  52. package/lib/esm/IModelConnection.d.ts +1 -8
  53. package/lib/esm/IModelConnection.d.ts.map +1 -1
  54. package/lib/esm/IModelConnection.js +1 -15
  55. package/lib/esm/IModelConnection.js.map +1 -1
  56. package/lib/esm/PlanarClipMaskState.js +2 -2
  57. package/lib/esm/PlanarClipMaskState.js.map +1 -1
  58. package/lib/esm/SpatialViewState.d.ts +1 -1
  59. package/lib/esm/SpatialViewState.d.ts.map +1 -1
  60. package/lib/esm/SpatialViewState.js +6 -5
  61. package/lib/esm/SpatialViewState.js.map +1 -1
  62. package/lib/esm/ViewState.d.ts +7 -7
  63. package/lib/esm/ViewState.d.ts.map +1 -1
  64. package/lib/esm/ViewState.js +31 -16
  65. package/lib/esm/ViewState.js.map +1 -1
  66. package/lib/esm/ViewingSpace.d.ts.map +1 -1
  67. package/lib/esm/ViewingSpace.js +5 -4
  68. package/lib/esm/ViewingSpace.js.map +1 -1
  69. package/lib/esm/Viewport.d.ts +11 -5
  70. package/lib/esm/Viewport.d.ts.map +1 -1
  71. package/lib/esm/Viewport.js +49 -36
  72. package/lib/esm/Viewport.js.map +1 -1
  73. package/lib/esm/render/webgl/SolarShadowMap.js +4 -4
  74. package/lib/esm/render/webgl/SolarShadowMap.js.map +1 -1
  75. package/lib/esm/tile/TiledGraphicsProvider.d.ts +14 -1
  76. package/lib/esm/tile/TiledGraphicsProvider.d.ts.map +1 -1
  77. package/lib/esm/tile/TiledGraphicsProvider.js +15 -0
  78. package/lib/esm/tile/TiledGraphicsProvider.js.map +1 -1
  79. package/lib/esm/tile/map/MapTiledGraphicsProvider.d.ts +1 -0
  80. package/lib/esm/tile/map/MapTiledGraphicsProvider.d.ts.map +1 -1
  81. package/lib/esm/tile/map/MapTiledGraphicsProvider.js +6 -0
  82. package/lib/esm/tile/map/MapTiledGraphicsProvider.js.map +1 -1
  83. package/lib/esm/tools/AccuDrawViewportUI.d.ts +5 -0
  84. package/lib/esm/tools/AccuDrawViewportUI.d.ts.map +1 -1
  85. package/lib/esm/tools/AccuDrawViewportUI.js +10 -7
  86. package/lib/esm/tools/AccuDrawViewportUI.js.map +1 -1
  87. package/package.json +16 -16
@@ -254,7 +254,7 @@ class SolarShadowMap {
254
254
  const shadowRange = worldToMapTransform.multiplyRange(iModel.projectExtents);
255
255
  // Limit the map to only displayed models.
256
256
  const viewTileRange = core_geometry_1.Range3d.createNull();
257
- view.forEachTileTreeRef((ref) => {
257
+ for (const ref of view.getTileTreeRefs()) {
258
258
  if (ref.castsShadows) {
259
259
  if (ref.isGlobal) {
260
260
  // A shadow-casting tile tree that spans the globe. Limit its range to the viewed extents.
@@ -270,7 +270,7 @@ class SolarShadowMap {
270
270
  ref.accumulateTransformedRange(viewTileRange, worldToMap, undefined);
271
271
  }
272
272
  }
273
- });
273
+ }
274
274
  if (!viewTileRange.isNull)
275
275
  viewTileRange.clone(shadowRange);
276
276
  // Expand shadow range to include both the shadowers and shadowed portion of background map.
@@ -299,7 +299,7 @@ class SolarShadowMap {
299
299
  mapToWorld.multiplyPoint3dArrayQuietNormalize(this._shadowFrustum.points);
300
300
  const tileRange = core_geometry_1.Range3d.createNull();
301
301
  scratchFrustumPlanes.init(this._shadowFrustum);
302
- view.forEachTileTreeRef(((ref) => {
302
+ for (const ref of view.getTileTreeRefs()) {
303
303
  if (!ref.castsShadows)
304
304
  return;
305
305
  const drawArgs = createDrawArgs(context, this, ref, scratchFrustumPlanes, (tiles) => {
@@ -310,7 +310,7 @@ class SolarShadowMap {
310
310
  return;
311
311
  const tileToMapTransform = worldToMapTransform.multiplyTransformTransform(drawArgs.location, this._scratchTransform);
312
312
  drawArgs.tree.draw(drawArgs);
313
- }));
313
+ }
314
314
  if (tileRange.isNull) {
315
315
  this.clearGraphics(true);
316
316
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SolarShadowMap.js","sourceRoot":"","sources":["../../../../src/render/webgl/SolarShadowMap.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sDAAsD;AACtD,wDAAuK;AACvK,oDAE4B;AAC5B,oEAAwD;AACxD,kDAA4F;AAK5F,6CAA0C;AAC1C,qDAAgD;AAEhD,+CAA4C;AAC5C,6BAA0B;AAC1B,qDAAkD;AAClD,+CAAwD;AACxD,+CAA4C;AAC5C,2DAAoD;AACpD,qCAAkC;AAElC,uCAAmD;AAInD,SAAS,cAAc,CAAC,YAA0B,EAAE,cAA8B,EAAE,IAAuB,EAAE,aAA4B,EAAE,YAA0B;IACnK,MAAM,sBAAuB,SAAQ,uBAAY;QAI/C,YAAoB,iBAAgC,EAAU,UAA0B,EAAE,IAAkB,EAAE,OAAqB;YACjI,KAAK,CAAC,IAAI,CAAC,CAAC;YAD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,CAAC,yBAAW,CAAC,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;QACtG,EAAE,CAAC,cAAc,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;QACjC,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,kBAAkB,EAAE,EAAE,CAAC,oBAAoB,CAAC,CAAC;QAChF,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,kBAAkB,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;QAElE,eAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAC5C,kDAAkD;QAElD,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC,CAAG,yBAAyB;QACrD,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAElC,eAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAC5C,eAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,mBAAmB;QAC1G,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;CACF;AA/SD,wCA+SC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module WebGL\n */\n\nimport { assert, dispose } from \"@itwin/core-bentley\";\nimport { ClipUtilities, ConvexClipPlaneSet, Geometry, GrowableXYZArray, Map4d, Matrix3d, Matrix4d, Point3d, Range3d, Transform, Vector3d } from \"@itwin/core-geometry\";\nimport {\n Frustum, FrustumPlanes, RenderMode, RenderTexture, SolarShadowSettings, TextureTransparency, ViewFlags,\n} from \"@itwin/core-common\";\nimport { RenderType } from \"@itwin/webgl-compatibility\";\nimport { Tile, TileDrawArgs, TileTreeReference, TileVisibility } from \"../../tile/internal\";\nimport { SceneContext } from \"../../ViewContext\";\nimport { RenderGraphic } from \"../RenderGraphic\";\nimport { RenderMemory } from \"../RenderMemory\";\nimport { BranchStack } from \"./BranchStack\";\nimport { BatchState } from \"./BatchState\";\nimport { EVSMGeometry } from \"./CachedGeometry\";\nimport { WebGLDisposable } from \"./Disposable\";\nimport { FrameBuffer } from \"./FrameBuffer\";\nimport { GL } from \"./GL\";\nimport { RenderCommands } from \"./RenderCommands\";\nimport { RenderPass, TextureUnit } from \"./RenderFlags\";\nimport { RenderState } from \"./RenderState\";\nimport { getDrawParams } from \"./ScratchDrawParams\";\nimport { System } from \"./System\";\nimport { Target } from \"./Target\";\nimport { Texture, TextureHandle } from \"./Texture\";\n\ntype ProcessTiles = (tiles: Tile[]) => void;\n\nfunction createDrawArgs(sceneContext: SceneContext, solarShadowMap: SolarShadowMap, tree: TileTreeReference, frustumPlanes: FrustumPlanes, processTiles: ProcessTiles): TileDrawArgs | undefined {\n class SolarShadowMapDrawArgs extends TileDrawArgs {\n private _useViewportMap?: boolean;\n private readonly _processTiles: ProcessTiles;\n\n constructor(private _mapFrustumPlanes: FrustumPlanes, private _shadowMap: SolarShadowMap, args: TileDrawArgs, process: ProcessTiles) {\n super(args);\n this._processTiles = process;\n }\n\n // The solar shadow projection is parallel - which can cause excessive tile selection if it is along an axis of an unbounded tile\n // tree such as the OSM buildings. Rev limit the selection here.\n public override get maxRealityTreeSelectionCount(): undefined | number { return 500; }\n\n public override processSelectedTiles(tiles: Tile[]): void {\n this._processTiles(tiles);\n }\n\n public override get frustumPlanes(): FrustumPlanes {\n if (true === this._useViewportMap)\n return super.frustumPlanes;\n else\n return this._mapFrustumPlanes;\n }\n\n public override get worldToViewMap(): Map4d {\n if (true === this._useViewportMap)\n return super.worldToViewMap;\n else\n return this._shadowMap.worldToViewMap;\n }\n\n public override drawGraphics(): void {\n const graphics = this.produceGraphics();\n if (graphics)\n this._shadowMap.addGraphic(graphics);\n }\n\n public override getPixelSize(tile: Tile): number {\n // For tiles that are part of the scene, size them based on the viewport frustum so that shadow map uses same resolution tiles as scene\n // - otherwise artifacts like shadow acne may result.\n // For tiles that are NOT part of the scene, size them based on the shadow frustum, not the viewport frustum\n // - otherwise excessive numbers of excessively detailed may be requested for the shadow map.\n if (undefined === this._useViewportMap) {\n this._useViewportMap = true;\n const vis = tile.computeVisibility(this);\n this._useViewportMap = TileVisibility.OutsideFrustum !== vis;\n }\n\n const size = super.getPixelSize(tile);\n this._useViewportMap = undefined;\n return size;\n }\n\n public static create(context: SceneContext, shadowMap: SolarShadowMap, tileTree: TileTreeReference, planes: FrustumPlanes, process: ProcessTiles) {\n const args = tileTree.createDrawArgs(context);\n return undefined !== args ? new SolarShadowMapDrawArgs(planes, shadowMap, args, process) : undefined;\n }\n }\n\n return SolarShadowMapDrawArgs.create(sceneContext, solarShadowMap, tree, frustumPlanes, processTiles);\n}\n\nconst shadowMapWidth = 4096; // size of original depth buffer map\nconst shadowMapHeight = shadowMapWidth; // TBD - Adjust for aspect ratio.\nconst evsmWidth = shadowMapWidth / 2; // EVSM buffer is 1/2 size each direction\nconst evsmHeight = shadowMapHeight / 2;\nconst postProjectionMatrixNpc = Matrix4d.createRowValues(/* Row 1 */ 0, 1, 0, 0, /* Row 2 */ 0, 0, 1, 0, /* Row 3 */ 1, 0, 0, 0, /* Row 4 */ 0, 0, 0, 1);\n\n// Bundles up the disposable, create-once-and-reuse members of a SolarShadowMap.\nclass Bundle implements WebGLDisposable {\n private constructor(\n public readonly depthTexture: Texture,\n public readonly shadowMapTexture: Texture,\n public readonly fbo: FrameBuffer,\n public readonly fboSM: FrameBuffer,\n public readonly evsmGeom: EVSMGeometry,\n public readonly renderCommands: RenderCommands) {\n }\n\n public static create(target: Target, stack: BranchStack, batch: BatchState): Bundle | undefined {\n const depthTextureHandle = System.instance.createDepthBuffer(shadowMapWidth, shadowMapHeight) as TextureHandle;\n if (undefined === depthTextureHandle)\n return undefined;\n\n let pixelDataType = GL.Texture.DataType.Float;\n switch (System.instance.maxRenderType) {\n case RenderType.TextureFloat:\n break;\n case RenderType.TextureHalfFloat:\n pixelDataType = System.instance.context.HALF_FLOAT;\n break;\n /* falls through */\n default:\n return undefined;\n }\n\n const colorTextures: TextureHandle[] = [];\n\n const fbo = FrameBuffer.create(colorTextures, depthTextureHandle);\n if (undefined === fbo)\n return undefined;\n\n // shadowMap texture is 1/4 size the depth texture (and averaged down when converting)\n const shadowMapTextureHandle = TextureHandle.createForAttachment(evsmWidth, evsmHeight, GL.Texture.Format.Rgba, pixelDataType);\n if (undefined === shadowMapTextureHandle)\n return undefined;\n\n const fboSM = FrameBuffer.create([shadowMapTextureHandle]);\n if (undefined === fboSM)\n return undefined;\n\n const depthTexture = new Texture({ ownership: \"external\", type: RenderTexture.Type.TileSection, handle: depthTextureHandle, transparency: TextureTransparency.Opaque });\n const evsmGeom = EVSMGeometry.createGeometry(depthTexture.texture.getHandle()!, shadowMapWidth, shadowMapHeight);\n if (undefined === evsmGeom)\n return undefined;\n\n const shadowMapTexture = new Texture({ type: RenderTexture.Type.Normal, ownership: \"external\", handle: shadowMapTextureHandle, transparency: TextureTransparency.Opaque });\n const renderCommands = new RenderCommands(target, stack, batch);\n return new Bundle(depthTexture, shadowMapTexture, fbo, fboSM, evsmGeom, renderCommands);\n }\n\n public get isDisposed(): boolean {\n return this.depthTexture.isDisposed\n && this.shadowMapTexture.isDisposed\n && this.fbo.isDisposed\n && this.fboSM.isDisposed\n && this.evsmGeom.isDisposed;\n }\n\n public [Symbol.dispose](): void {\n dispose(this.depthTexture);\n dispose(this.shadowMapTexture);\n dispose(this.fbo);\n dispose(this.fboSM);\n dispose(this.evsmGeom);\n }\n}\n\n/** Describes the set of parameters which, when they change, require us to recreate the shadow map. */\nclass ShadowMapParams {\n public readonly direction = new Vector3d();\n public readonly viewFrustum = new Frustum();\n public settings: SolarShadowSettings;\n\n public constructor(viewFrustum: Frustum, direction: Vector3d, settings: SolarShadowSettings) {\n direction.clone(this.direction);\n this.viewFrustum.setFrom(viewFrustum);\n this.settings = settings;\n }\n\n public update(viewFrustum: Frustum, direction: Vector3d, settings: SolarShadowSettings): void {\n this.settings = settings;\n this.viewFrustum.setFrom(viewFrustum);\n direction.clone(this.direction);\n }\n}\n\nconst defaultSunDirection = Vector3d.create(-1, -1, -1).normalize()!;\nconst scratchFrustum = new Frustum();\nconst scratchFrustumPlanes = FrustumPlanes.createEmpty();\n\nexport class SolarShadowMap implements RenderMemory.Consumer, WebGLDisposable {\n private _bundle?: Bundle;\n private _projectionMatrix = Matrix4d.createIdentity();\n private _graphics: RenderGraphic[] = [];\n private _shadowFrustum = new Frustum();\n private _isReady = false;\n private _isDrawing = false;\n private _enabled = false;\n private _params?: ShadowMapParams;\n private readonly _scratchRange = Range3d.createNull();\n private readonly _scratchTransform = Transform.createIdentity();\n\n private readonly _scratchViewFlags = new ViewFlags();\n private readonly _renderState: RenderState;\n private readonly _noZRenderState: RenderState;\n private readonly _batchState: BatchState;\n private _worldToViewMap = Map4d.createIdentity();\n private readonly _target: Target;\n\n // This exists chiefly for debugging. See ToggleShadowMapTilesTool.\n public onGraphicsChanged?: (graphics: RenderGraphic[]) => void;\n\n private getBundle(target: Target): Bundle | undefined {\n if (undefined === this._bundle) {\n this._bundle = Bundle.create(target, target.uniforms.branch.stack, this._batchState);\n assert(undefined !== this._bundle);\n }\n\n return this._bundle;\n }\n\n public get isReady() { return this._isReady; }\n public get isDrawing() { return this._isDrawing; }\n public get isEnabled() { return this._enabled; }\n public get projectionMatrix(): Matrix4d { return this._projectionMatrix; }\n public get depthTexture(): Texture | undefined { return undefined !== this._bundle ? this._bundle.depthTexture : undefined; }\n public get shadowMapTexture(): Texture | undefined { return undefined !== this._bundle ? this._bundle.shadowMapTexture : undefined; }\n public get settings(): SolarShadowSettings | undefined { return undefined !== this._params ? this._params.settings : undefined; }\n public get direction(): Vector3d | undefined { return undefined !== this._params ? this._params.direction : undefined; }\n public get frustum(): Frustum { return this._shadowFrustum; }\n public get worldToViewMap(): Map4d { return this._worldToViewMap; }\n public addGraphic(graphic: RenderGraphic) { this._graphics.push(graphic); }\n\n public constructor(target: Target) {\n this._target = target;\n this._renderState = new RenderState();\n this._renderState.flags.depthMask = true;\n this._renderState.flags.blend = false;\n this._renderState.flags.depthTest = true;\n\n this._noZRenderState = new RenderState();\n this._noZRenderState.flags.depthMask = false;\n\n this._batchState = new BatchState(target.uniforms.branch.stack);\n }\n\n public disable() {\n this._enabled = this._isReady = false;\n this._bundle = dispose(this._bundle);\n this.clearGraphics(true);\n this._target.uniforms.shadow.update();\n }\n\n public collectStatistics(stats: RenderMemory.Statistics): void {\n const bundle = this._bundle;\n if (undefined !== bundle)\n stats.addShadowMap(bundle.depthTexture.bytesUsed + bundle.shadowMapTexture.bytesUsed);\n }\n\n public get isDisposed(): boolean { return undefined === this._bundle && 0 === this._graphics.length; }\n\n public [Symbol.dispose]() {\n this._bundle = dispose(this._bundle);\n this.clearGraphics(true);\n }\n\n private clearGraphics(notify: boolean) {\n for (const graphic of this._graphics)\n graphic[Symbol.dispose]();\n\n this._graphics.length = 0;\n if (notify)\n this.notifyGraphicsChanged();\n }\n\n private notifyGraphicsChanged(): void {\n if (undefined !== this.onGraphicsChanged)\n this.onGraphicsChanged(this._graphics);\n }\n\n public update(context: SceneContext | undefined) {\n this._isReady = false;\n this.clearGraphics(false);\n\n if (undefined === context || !context.viewport.view.isSpatialView()) {\n this.disable();\n this.notifyGraphicsChanged();\n return;\n }\n\n const view = context.viewport.view;\n const style = view.getDisplayStyle3d();\n const sunDirection = style.sunDirection ?? defaultSunDirection;\n\n const minimumHorizonDirection = -.01;\n if (sunDirection.z > minimumHorizonDirection) {\n this.notifyGraphicsChanged();\n return;\n }\n\n this._enabled = true;\n const viewFrustum = context.viewingSpace.getFrustum();\n const settings = style.settings.solarShadows;\n if (undefined === this._params)\n this._params = new ShadowMapParams(viewFrustum, sunDirection, settings);\n else\n this._params.update(viewFrustum, sunDirection, settings);\n\n const iModel = view.iModel;\n\n const worldToMapTransform = Transform.createRefs(Point3d.createZero(), Matrix3d.createRigidHeadsUp(this._params.direction.negate()).inverse()!);\n const worldToMap = Matrix4d.createTransform(worldToMapTransform);\n const mapToWorld = worldToMap.createInverse()!;\n\n // Start with entire project.\n const shadowRange = worldToMapTransform.multiplyRange(iModel.projectExtents);\n\n // Limit the map to only displayed models.\n const viewTileRange = Range3d.createNull();\n view.forEachTileTreeRef((ref) => {\n if (ref.castsShadows) {\n if (ref.isGlobal) {\n // A shadow-casting tile tree that spans the globe. Limit its range to the viewed extents.\n for (const p3 of viewFrustum.points) {\n const p4 = worldToMap.multiplyPoint3d(p3, 1);\n if (p4.w > 0.0001)\n viewTileRange.extendXYZW(p4.x, p4.y, p4.z, p4.w);\n else\n viewTileRange.high.z = Math.max(1.0, viewTileRange.high.z); // behind eye plane.\n }\n } else {\n ref.accumulateTransformedRange(viewTileRange, worldToMap, undefined);\n }\n }\n });\n\n if (!viewTileRange.isNull)\n viewTileRange.clone(shadowRange);\n\n // Expand shadow range to include both the shadowers and shadowed portion of background map.\n scratchFrustum.initFromRange(shadowRange);\n mapToWorld.multiplyPoint3dArrayQuietNormalize(scratchFrustum.points); // This frustum represents the shadowing geometry. Intersect it with background geometry and expand the range depth to include that intersection.\n const backgroundMapGeometry = context.viewport.view.displayStyle.getBackgroundMapGeometry();\n if (undefined !== backgroundMapGeometry) {\n const backgroundDepthRange = backgroundMapGeometry.getFrustumIntersectionDepthRange(this._shadowFrustum, iModel.projectExtents);\n if (!backgroundDepthRange.isNull)\n shadowRange.low.z = Math.min(shadowRange.low.z, backgroundDepthRange.low);\n }\n\n this._params.viewFrustum.transformBy(worldToMapTransform, scratchFrustum);\n scratchFrustumPlanes.init(scratchFrustum);\n\n const viewIntersectShadowRange = Range3d.createNull();\n const viewClipPlanes = ConvexClipPlaneSet.createPlanes(scratchFrustumPlanes.planes);\n ClipUtilities.announceLoopsOfConvexClipPlaneSetIntersectRange(viewClipPlanes, shadowRange, (points: GrowableXYZArray) => {\n for (const point of points.getPoint3dArray())\n viewIntersectShadowRange.extendPoint(point);\n });\n if (viewIntersectShadowRange.isNull) {\n this.notifyGraphicsChanged();\n return;\n }\n viewIntersectShadowRange.high.z = shadowRange.high.z; // We need to include shadowing geometry that may be outside view (along the solar axis).\n\n this._shadowFrustum.initFromRange(viewIntersectShadowRange);\n mapToWorld.multiplyPoint3dArrayQuietNormalize(this._shadowFrustum.points);\n\n const tileRange = Range3d.createNull();\n scratchFrustumPlanes.init(this._shadowFrustum);\n view.forEachTileTreeRef(((ref) => {\n if (!ref.castsShadows)\n return;\n\n const drawArgs = createDrawArgs(context, this, ref, scratchFrustumPlanes, (tiles: Tile[]) => {\n for (const tile of tiles)\n tileRange.extendRange(tileToMapTransform.multiplyRange(tile.range, this._scratchRange));\n });\n\n if (undefined === drawArgs)\n return;\n\n const tileToMapTransform = worldToMapTransform.multiplyTransformTransform(drawArgs.location, this._scratchTransform);\n drawArgs.tree.draw(drawArgs);\n }));\n\n if (tileRange.isNull) {\n this.clearGraphics(true);\n } else if (this._graphics.length > 0) {\n // Avoid an uninvertible matrix on empty range...\n if (Geometry.isAlmostEqualNumber(shadowRange.low.x, shadowRange.high.x) ||\n Geometry.isAlmostEqualNumber(shadowRange.low.y, shadowRange.high.y) ||\n Geometry.isAlmostEqualNumber(shadowRange.low.z, shadowRange.high.z)) {\n this.clearGraphics(true);\n return;\n }\n\n const frustumMap = this._shadowFrustum.toMap4d();\n if (undefined === frustumMap) {\n this.clearGraphics(true);\n assert(false);\n return;\n }\n\n this._projectionMatrix = frustumMap.transform0.clone();\n\n const worldToNpc = postProjectionMatrixNpc.multiplyMatrixMatrix(this._projectionMatrix);\n const npcToView = Map4d.createBoxMap(Point3d.create(0, 0, 0), Point3d.create(1, 1, 1), Point3d.create(0, 0, 0), Point3d.create(shadowMapWidth, shadowMapHeight, 1))!;\n const npcToWorld = worldToNpc.createInverse();\n if (undefined === npcToWorld) {\n this.clearGraphics(true);\n return;\n }\n\n const worldToNpcMap = Map4d.createRefs(worldToNpc, npcToWorld);\n this._worldToViewMap = npcToView.multiplyMapMap(worldToNpcMap);\n }\n\n this._target.uniforms.shadow.update();\n this.notifyGraphicsChanged();\n }\n\n public draw(target: Target) {\n assert(this.isEnabled);\n\n if (this.isReady || 0 === this._graphics.length)\n return;\n\n const bundle = this.getBundle(target);\n if (undefined === bundle)\n return;\n\n this._isDrawing = true;\n\n const prevState = System.instance.currentRenderState.clone();\n const gl = System.instance.context;\n gl.viewport(0, 0, shadowMapWidth, shadowMapHeight);\n\n // NB: textures and materials are needed because their transparencies affect whether or not a surface casts shadows\n const viewFlags = target.currentViewFlags.copy({\n renderMode: RenderMode.SmoothShade,\n wiremesh: false,\n transparency: false,\n lighting: false,\n shadows: false,\n monochrome: false,\n ambientOcclusion: false,\n visibleEdges: false,\n hiddenEdges: false,\n });\n\n System.instance.applyRenderState(this._renderState);\n const prevPlan = target.plan;\n\n target.changeFrustum(this._shadowFrustum, this._shadowFrustum.getFraction(), true);\n target.uniforms.branch.changeRenderPlan(viewFlags, target.plan.is3d, target.plan.hline);\n\n const renderCommands = bundle.renderCommands;\n renderCommands.reset(target, target.uniforms.branch.stack, this._batchState);\n renderCommands.addGraphics(this._graphics);\n\n System.instance.frameBufferStack.execute(bundle.fbo, true, false, () => {\n System.instance.context.clearDepth(1.0);\n System.instance.context.clear(GL.BufferBit.Depth);\n target.techniques.execute(target, renderCommands.getCommands(RenderPass.OpaquePlanar), RenderPass.PlanarClassification); // Draw these with RenderPass.PlanarClassification (rather than Opaque...) so that the pick ordering is avoided.\n target.techniques.execute(target, renderCommands.getCommands(RenderPass.OpaqueGeneral), RenderPass.PlanarClassification); // Draw these with RenderPass.PlanarClassification (rather than Opaque...) so that the pick ordering is avoided.\n });\n\n // copy depth buffer to EVSM shadow buffer and average down for AA effect\n gl.viewport(0, 0, evsmWidth, evsmHeight);\n System.instance.frameBufferStack.execute(bundle.fboSM, true, false, () => {\n System.instance.applyRenderState(this._noZRenderState);\n const params = getDrawParams(target, bundle.evsmGeom);\n target.techniques.draw(params);\n });\n\n // mipmap resulting EVSM texture and set filtering options\n System.instance.activateTexture2d(TextureUnit.ShadowMap, bundle.shadowMapTexture.texture.getHandle());\n gl.generateMipmap(gl.TEXTURE_2D);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n\n System.instance.setMaxAnisotropy(undefined);\n // target.recordPerformanceMetric(\"Compute EVSM\");\n\n this._batchState.reset(); // Reset the batch Ids...\n target.changeRenderPlan(prevPlan);\n\n System.instance.applyRenderState(prevState);\n System.instance.context.viewport(0, 0, target.viewRect.width, target.viewRect.height); // Restore viewport\n this.clearGraphics(false);\n this._isDrawing = false;\n this._isReady = true;\n }\n}\n"]}
1
+ {"version":3,"file":"SolarShadowMap.js","sourceRoot":"","sources":["../../../../src/render/webgl/SolarShadowMap.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sDAAsD;AACtD,wDAAuK;AACvK,oDAE4B;AAC5B,oEAAwD;AACxD,kDAA4F;AAK5F,6CAA0C;AAC1C,qDAAgD;AAEhD,+CAA4C;AAC5C,6BAA0B;AAC1B,qDAAkD;AAClD,+CAAwD;AACxD,+CAA4C;AAC5C,2DAAoD;AACpD,qCAAkC;AAElC,uCAAmD;AAInD,SAAS,cAAc,CAAC,YAA0B,EAAE,cAA8B,EAAE,IAAuB,EAAE,aAA4B,EAAE,YAA0B;IACnK,MAAM,sBAAuB,SAAQ,uBAAY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;QACjC,CAAC,CAAC,CAAC;QAEH,0DAA0D;QAC1D,eAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC,yBAAW,CAAC,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;QACtG,EAAE,CAAC,cAAc,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;QACjC,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,kBAAkB,EAAE,EAAE,CAAC,oBAAoB,CAAC,CAAC;QAChF,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,kBAAkB,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;QAElE,eAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAC5C,kDAAkD;QAElD,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC,CAAG,yBAAyB;QACrD,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAElC,eAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAC5C,eAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,mBAAmB;QAC1G,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;CACF;AA/SD,wCA+SC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module WebGL\n */\n\nimport { assert, dispose } from \"@itwin/core-bentley\";\nimport { ClipUtilities, ConvexClipPlaneSet, Geometry, GrowableXYZArray, Map4d, Matrix3d, Matrix4d, Point3d, Range3d, Transform, Vector3d } from \"@itwin/core-geometry\";\nimport {\n Frustum, FrustumPlanes, RenderMode, RenderTexture, SolarShadowSettings, TextureTransparency, ViewFlags,\n} from \"@itwin/core-common\";\nimport { RenderType } from \"@itwin/webgl-compatibility\";\nimport { Tile, TileDrawArgs, TileTreeReference, TileVisibility } from \"../../tile/internal\";\nimport { SceneContext } from \"../../ViewContext\";\nimport { RenderGraphic } from \"../RenderGraphic\";\nimport { RenderMemory } from \"../RenderMemory\";\nimport { BranchStack } from \"./BranchStack\";\nimport { BatchState } from \"./BatchState\";\nimport { EVSMGeometry } from \"./CachedGeometry\";\nimport { WebGLDisposable } from \"./Disposable\";\nimport { FrameBuffer } from \"./FrameBuffer\";\nimport { GL } from \"./GL\";\nimport { RenderCommands } from \"./RenderCommands\";\nimport { RenderPass, TextureUnit } from \"./RenderFlags\";\nimport { RenderState } from \"./RenderState\";\nimport { getDrawParams } from \"./ScratchDrawParams\";\nimport { System } from \"./System\";\nimport { Target } from \"./Target\";\nimport { Texture, TextureHandle } from \"./Texture\";\n\ntype ProcessTiles = (tiles: Tile[]) => void;\n\nfunction createDrawArgs(sceneContext: SceneContext, solarShadowMap: SolarShadowMap, tree: TileTreeReference, frustumPlanes: FrustumPlanes, processTiles: ProcessTiles): TileDrawArgs | undefined {\n class SolarShadowMapDrawArgs extends TileDrawArgs {\n private _useViewportMap?: boolean;\n private readonly _processTiles: ProcessTiles;\n\n constructor(private _mapFrustumPlanes: FrustumPlanes, private _shadowMap: SolarShadowMap, args: TileDrawArgs, process: ProcessTiles) {\n super(args);\n this._processTiles = process;\n }\n\n // The solar shadow projection is parallel - which can cause excessive tile selection if it is along an axis of an unbounded tile\n // tree such as the OSM buildings. Rev limit the selection here.\n public override get maxRealityTreeSelectionCount(): undefined | number { return 500; }\n\n public override processSelectedTiles(tiles: Tile[]): void {\n this._processTiles(tiles);\n }\n\n public override get frustumPlanes(): FrustumPlanes {\n if (true === this._useViewportMap)\n return super.frustumPlanes;\n else\n return this._mapFrustumPlanes;\n }\n\n public override get worldToViewMap(): Map4d {\n if (true === this._useViewportMap)\n return super.worldToViewMap;\n else\n return this._shadowMap.worldToViewMap;\n }\n\n public override drawGraphics(): void {\n const graphics = this.produceGraphics();\n if (graphics)\n this._shadowMap.addGraphic(graphics);\n }\n\n public override getPixelSize(tile: Tile): number {\n // For tiles that are part of the scene, size them based on the viewport frustum so that shadow map uses same resolution tiles as scene\n // - otherwise artifacts like shadow acne may result.\n // For tiles that are NOT part of the scene, size them based on the shadow frustum, not the viewport frustum\n // - otherwise excessive numbers of excessively detailed may be requested for the shadow map.\n if (undefined === this._useViewportMap) {\n this._useViewportMap = true;\n const vis = tile.computeVisibility(this);\n this._useViewportMap = TileVisibility.OutsideFrustum !== vis;\n }\n\n const size = super.getPixelSize(tile);\n this._useViewportMap = undefined;\n return size;\n }\n\n public static create(context: SceneContext, shadowMap: SolarShadowMap, tileTree: TileTreeReference, planes: FrustumPlanes, process: ProcessTiles) {\n const args = tileTree.createDrawArgs(context);\n return undefined !== args ? new SolarShadowMapDrawArgs(planes, shadowMap, args, process) : undefined;\n }\n }\n\n return SolarShadowMapDrawArgs.create(sceneContext, solarShadowMap, tree, frustumPlanes, processTiles);\n}\n\nconst shadowMapWidth = 4096; // size of original depth buffer map\nconst shadowMapHeight = shadowMapWidth; // TBD - Adjust for aspect ratio.\nconst evsmWidth = shadowMapWidth / 2; // EVSM buffer is 1/2 size each direction\nconst evsmHeight = shadowMapHeight / 2;\nconst postProjectionMatrixNpc = Matrix4d.createRowValues(/* Row 1 */ 0, 1, 0, 0, /* Row 2 */ 0, 0, 1, 0, /* Row 3 */ 1, 0, 0, 0, /* Row 4 */ 0, 0, 0, 1);\n\n// Bundles up the disposable, create-once-and-reuse members of a SolarShadowMap.\nclass Bundle implements WebGLDisposable {\n private constructor(\n public readonly depthTexture: Texture,\n public readonly shadowMapTexture: Texture,\n public readonly fbo: FrameBuffer,\n public readonly fboSM: FrameBuffer,\n public readonly evsmGeom: EVSMGeometry,\n public readonly renderCommands: RenderCommands) {\n }\n\n public static create(target: Target, stack: BranchStack, batch: BatchState): Bundle | undefined {\n const depthTextureHandle = System.instance.createDepthBuffer(shadowMapWidth, shadowMapHeight) as TextureHandle;\n if (undefined === depthTextureHandle)\n return undefined;\n\n let pixelDataType = GL.Texture.DataType.Float;\n switch (System.instance.maxRenderType) {\n case RenderType.TextureFloat:\n break;\n case RenderType.TextureHalfFloat:\n pixelDataType = System.instance.context.HALF_FLOAT;\n break;\n /* falls through */\n default:\n return undefined;\n }\n\n const colorTextures: TextureHandle[] = [];\n\n const fbo = FrameBuffer.create(colorTextures, depthTextureHandle);\n if (undefined === fbo)\n return undefined;\n\n // shadowMap texture is 1/4 size the depth texture (and averaged down when converting)\n const shadowMapTextureHandle = TextureHandle.createForAttachment(evsmWidth, evsmHeight, GL.Texture.Format.Rgba, pixelDataType);\n if (undefined === shadowMapTextureHandle)\n return undefined;\n\n const fboSM = FrameBuffer.create([shadowMapTextureHandle]);\n if (undefined === fboSM)\n return undefined;\n\n const depthTexture = new Texture({ ownership: \"external\", type: RenderTexture.Type.TileSection, handle: depthTextureHandle, transparency: TextureTransparency.Opaque });\n const evsmGeom = EVSMGeometry.createGeometry(depthTexture.texture.getHandle()!, shadowMapWidth, shadowMapHeight);\n if (undefined === evsmGeom)\n return undefined;\n\n const shadowMapTexture = new Texture({ type: RenderTexture.Type.Normal, ownership: \"external\", handle: shadowMapTextureHandle, transparency: TextureTransparency.Opaque });\n const renderCommands = new RenderCommands(target, stack, batch);\n return new Bundle(depthTexture, shadowMapTexture, fbo, fboSM, evsmGeom, renderCommands);\n }\n\n public get isDisposed(): boolean {\n return this.depthTexture.isDisposed\n && this.shadowMapTexture.isDisposed\n && this.fbo.isDisposed\n && this.fboSM.isDisposed\n && this.evsmGeom.isDisposed;\n }\n\n public [Symbol.dispose](): void {\n dispose(this.depthTexture);\n dispose(this.shadowMapTexture);\n dispose(this.fbo);\n dispose(this.fboSM);\n dispose(this.evsmGeom);\n }\n}\n\n/** Describes the set of parameters which, when they change, require us to recreate the shadow map. */\nclass ShadowMapParams {\n public readonly direction = new Vector3d();\n public readonly viewFrustum = new Frustum();\n public settings: SolarShadowSettings;\n\n public constructor(viewFrustum: Frustum, direction: Vector3d, settings: SolarShadowSettings) {\n direction.clone(this.direction);\n this.viewFrustum.setFrom(viewFrustum);\n this.settings = settings;\n }\n\n public update(viewFrustum: Frustum, direction: Vector3d, settings: SolarShadowSettings): void {\n this.settings = settings;\n this.viewFrustum.setFrom(viewFrustum);\n direction.clone(this.direction);\n }\n}\n\nconst defaultSunDirection = Vector3d.create(-1, -1, -1).normalize()!;\nconst scratchFrustum = new Frustum();\nconst scratchFrustumPlanes = FrustumPlanes.createEmpty();\n\nexport class SolarShadowMap implements RenderMemory.Consumer, WebGLDisposable {\n private _bundle?: Bundle;\n private _projectionMatrix = Matrix4d.createIdentity();\n private _graphics: RenderGraphic[] = [];\n private _shadowFrustum = new Frustum();\n private _isReady = false;\n private _isDrawing = false;\n private _enabled = false;\n private _params?: ShadowMapParams;\n private readonly _scratchRange = Range3d.createNull();\n private readonly _scratchTransform = Transform.createIdentity();\n\n private readonly _scratchViewFlags = new ViewFlags();\n private readonly _renderState: RenderState;\n private readonly _noZRenderState: RenderState;\n private readonly _batchState: BatchState;\n private _worldToViewMap = Map4d.createIdentity();\n private readonly _target: Target;\n\n // This exists chiefly for debugging. See ToggleShadowMapTilesTool.\n public onGraphicsChanged?: (graphics: RenderGraphic[]) => void;\n\n private getBundle(target: Target): Bundle | undefined {\n if (undefined === this._bundle) {\n this._bundle = Bundle.create(target, target.uniforms.branch.stack, this._batchState);\n assert(undefined !== this._bundle);\n }\n\n return this._bundle;\n }\n\n public get isReady() { return this._isReady; }\n public get isDrawing() { return this._isDrawing; }\n public get isEnabled() { return this._enabled; }\n public get projectionMatrix(): Matrix4d { return this._projectionMatrix; }\n public get depthTexture(): Texture | undefined { return undefined !== this._bundle ? this._bundle.depthTexture : undefined; }\n public get shadowMapTexture(): Texture | undefined { return undefined !== this._bundle ? this._bundle.shadowMapTexture : undefined; }\n public get settings(): SolarShadowSettings | undefined { return undefined !== this._params ? this._params.settings : undefined; }\n public get direction(): Vector3d | undefined { return undefined !== this._params ? this._params.direction : undefined; }\n public get frustum(): Frustum { return this._shadowFrustum; }\n public get worldToViewMap(): Map4d { return this._worldToViewMap; }\n public addGraphic(graphic: RenderGraphic) { this._graphics.push(graphic); }\n\n public constructor(target: Target) {\n this._target = target;\n this._renderState = new RenderState();\n this._renderState.flags.depthMask = true;\n this._renderState.flags.blend = false;\n this._renderState.flags.depthTest = true;\n\n this._noZRenderState = new RenderState();\n this._noZRenderState.flags.depthMask = false;\n\n this._batchState = new BatchState(target.uniforms.branch.stack);\n }\n\n public disable() {\n this._enabled = this._isReady = false;\n this._bundle = dispose(this._bundle);\n this.clearGraphics(true);\n this._target.uniforms.shadow.update();\n }\n\n public collectStatistics(stats: RenderMemory.Statistics): void {\n const bundle = this._bundle;\n if (undefined !== bundle)\n stats.addShadowMap(bundle.depthTexture.bytesUsed + bundle.shadowMapTexture.bytesUsed);\n }\n\n public get isDisposed(): boolean { return undefined === this._bundle && 0 === this._graphics.length; }\n\n public [Symbol.dispose]() {\n this._bundle = dispose(this._bundle);\n this.clearGraphics(true);\n }\n\n private clearGraphics(notify: boolean) {\n for (const graphic of this._graphics)\n graphic[Symbol.dispose]();\n\n this._graphics.length = 0;\n if (notify)\n this.notifyGraphicsChanged();\n }\n\n private notifyGraphicsChanged(): void {\n if (undefined !== this.onGraphicsChanged)\n this.onGraphicsChanged(this._graphics);\n }\n\n public update(context: SceneContext | undefined) {\n this._isReady = false;\n this.clearGraphics(false);\n\n if (undefined === context || !context.viewport.view.isSpatialView()) {\n this.disable();\n this.notifyGraphicsChanged();\n return;\n }\n\n const view = context.viewport.view;\n const style = view.getDisplayStyle3d();\n const sunDirection = style.sunDirection ?? defaultSunDirection;\n\n const minimumHorizonDirection = -.01;\n if (sunDirection.z > minimumHorizonDirection) {\n this.notifyGraphicsChanged();\n return;\n }\n\n this._enabled = true;\n const viewFrustum = context.viewingSpace.getFrustum();\n const settings = style.settings.solarShadows;\n if (undefined === this._params)\n this._params = new ShadowMapParams(viewFrustum, sunDirection, settings);\n else\n this._params.update(viewFrustum, sunDirection, settings);\n\n const iModel = view.iModel;\n\n const worldToMapTransform = Transform.createRefs(Point3d.createZero(), Matrix3d.createRigidHeadsUp(this._params.direction.negate()).inverse()!);\n const worldToMap = Matrix4d.createTransform(worldToMapTransform);\n const mapToWorld = worldToMap.createInverse()!;\n\n // Start with entire project.\n const shadowRange = worldToMapTransform.multiplyRange(iModel.projectExtents);\n\n // Limit the map to only displayed models.\n const viewTileRange = Range3d.createNull();\n for (const ref of view.getTileTreeRefs()) {\n if (ref.castsShadows) {\n if (ref.isGlobal) {\n // A shadow-casting tile tree that spans the globe. Limit its range to the viewed extents.\n for (const p3 of viewFrustum.points) {\n const p4 = worldToMap.multiplyPoint3d(p3, 1);\n if (p4.w > 0.0001)\n viewTileRange.extendXYZW(p4.x, p4.y, p4.z, p4.w);\n else\n viewTileRange.high.z = Math.max(1.0, viewTileRange.high.z); // behind eye plane.\n }\n } else {\n ref.accumulateTransformedRange(viewTileRange, worldToMap, undefined);\n }\n }\n }\n\n if (!viewTileRange.isNull)\n viewTileRange.clone(shadowRange);\n\n // Expand shadow range to include both the shadowers and shadowed portion of background map.\n scratchFrustum.initFromRange(shadowRange);\n mapToWorld.multiplyPoint3dArrayQuietNormalize(scratchFrustum.points); // This frustum represents the shadowing geometry. Intersect it with background geometry and expand the range depth to include that intersection.\n const backgroundMapGeometry = context.viewport.view.displayStyle.getBackgroundMapGeometry();\n if (undefined !== backgroundMapGeometry) {\n const backgroundDepthRange = backgroundMapGeometry.getFrustumIntersectionDepthRange(this._shadowFrustum, iModel.projectExtents);\n if (!backgroundDepthRange.isNull)\n shadowRange.low.z = Math.min(shadowRange.low.z, backgroundDepthRange.low);\n }\n\n this._params.viewFrustum.transformBy(worldToMapTransform, scratchFrustum);\n scratchFrustumPlanes.init(scratchFrustum);\n\n const viewIntersectShadowRange = Range3d.createNull();\n const viewClipPlanes = ConvexClipPlaneSet.createPlanes(scratchFrustumPlanes.planes);\n ClipUtilities.announceLoopsOfConvexClipPlaneSetIntersectRange(viewClipPlanes, shadowRange, (points: GrowableXYZArray) => {\n for (const point of points.getPoint3dArray())\n viewIntersectShadowRange.extendPoint(point);\n });\n if (viewIntersectShadowRange.isNull) {\n this.notifyGraphicsChanged();\n return;\n }\n viewIntersectShadowRange.high.z = shadowRange.high.z; // We need to include shadowing geometry that may be outside view (along the solar axis).\n\n this._shadowFrustum.initFromRange(viewIntersectShadowRange);\n mapToWorld.multiplyPoint3dArrayQuietNormalize(this._shadowFrustum.points);\n\n const tileRange = Range3d.createNull();\n scratchFrustumPlanes.init(this._shadowFrustum);\n for (const ref of view.getTileTreeRefs()) {\n if (!ref.castsShadows)\n return;\n\n const drawArgs = createDrawArgs(context, this, ref, scratchFrustumPlanes, (tiles: Tile[]) => {\n for (const tile of tiles)\n tileRange.extendRange(tileToMapTransform.multiplyRange(tile.range, this._scratchRange));\n });\n\n if (undefined === drawArgs)\n return;\n\n const tileToMapTransform = worldToMapTransform.multiplyTransformTransform(drawArgs.location, this._scratchTransform);\n drawArgs.tree.draw(drawArgs);\n }\n\n if (tileRange.isNull) {\n this.clearGraphics(true);\n } else if (this._graphics.length > 0) {\n // Avoid an uninvertible matrix on empty range...\n if (Geometry.isAlmostEqualNumber(shadowRange.low.x, shadowRange.high.x) ||\n Geometry.isAlmostEqualNumber(shadowRange.low.y, shadowRange.high.y) ||\n Geometry.isAlmostEqualNumber(shadowRange.low.z, shadowRange.high.z)) {\n this.clearGraphics(true);\n return;\n }\n\n const frustumMap = this._shadowFrustum.toMap4d();\n if (undefined === frustumMap) {\n this.clearGraphics(true);\n assert(false);\n return;\n }\n\n this._projectionMatrix = frustumMap.transform0.clone();\n\n const worldToNpc = postProjectionMatrixNpc.multiplyMatrixMatrix(this._projectionMatrix);\n const npcToView = Map4d.createBoxMap(Point3d.create(0, 0, 0), Point3d.create(1, 1, 1), Point3d.create(0, 0, 0), Point3d.create(shadowMapWidth, shadowMapHeight, 1))!;\n const npcToWorld = worldToNpc.createInverse();\n if (undefined === npcToWorld) {\n this.clearGraphics(true);\n return;\n }\n\n const worldToNpcMap = Map4d.createRefs(worldToNpc, npcToWorld);\n this._worldToViewMap = npcToView.multiplyMapMap(worldToNpcMap);\n }\n\n this._target.uniforms.shadow.update();\n this.notifyGraphicsChanged();\n }\n\n public draw(target: Target) {\n assert(this.isEnabled);\n\n if (this.isReady || 0 === this._graphics.length)\n return;\n\n const bundle = this.getBundle(target);\n if (undefined === bundle)\n return;\n\n this._isDrawing = true;\n\n const prevState = System.instance.currentRenderState.clone();\n const gl = System.instance.context;\n gl.viewport(0, 0, shadowMapWidth, shadowMapHeight);\n\n // NB: textures and materials are needed because their transparencies affect whether or not a surface casts shadows\n const viewFlags = target.currentViewFlags.copy({\n renderMode: RenderMode.SmoothShade,\n wiremesh: false,\n transparency: false,\n lighting: false,\n shadows: false,\n monochrome: false,\n ambientOcclusion: false,\n visibleEdges: false,\n hiddenEdges: false,\n });\n\n System.instance.applyRenderState(this._renderState);\n const prevPlan = target.plan;\n\n target.changeFrustum(this._shadowFrustum, this._shadowFrustum.getFraction(), true);\n target.uniforms.branch.changeRenderPlan(viewFlags, target.plan.is3d, target.plan.hline);\n\n const renderCommands = bundle.renderCommands;\n renderCommands.reset(target, target.uniforms.branch.stack, this._batchState);\n renderCommands.addGraphics(this._graphics);\n\n System.instance.frameBufferStack.execute(bundle.fbo, true, false, () => {\n System.instance.context.clearDepth(1.0);\n System.instance.context.clear(GL.BufferBit.Depth);\n target.techniques.execute(target, renderCommands.getCommands(RenderPass.OpaquePlanar), RenderPass.PlanarClassification); // Draw these with RenderPass.PlanarClassification (rather than Opaque...) so that the pick ordering is avoided.\n target.techniques.execute(target, renderCommands.getCommands(RenderPass.OpaqueGeneral), RenderPass.PlanarClassification); // Draw these with RenderPass.PlanarClassification (rather than Opaque...) so that the pick ordering is avoided.\n });\n\n // copy depth buffer to EVSM shadow buffer and average down for AA effect\n gl.viewport(0, 0, evsmWidth, evsmHeight);\n System.instance.frameBufferStack.execute(bundle.fboSM, true, false, () => {\n System.instance.applyRenderState(this._noZRenderState);\n const params = getDrawParams(target, bundle.evsmGeom);\n target.techniques.draw(params);\n });\n\n // mipmap resulting EVSM texture and set filtering options\n System.instance.activateTexture2d(TextureUnit.ShadowMap, bundle.shadowMapTexture.texture.getHandle());\n gl.generateMipmap(gl.TEXTURE_2D);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n\n System.instance.setMaxAnisotropy(undefined);\n // target.recordPerformanceMetric(\"Compute EVSM\");\n\n this._batchState.reset(); // Reset the batch Ids...\n target.changeRenderPlan(prevPlan);\n\n System.instance.applyRenderState(prevState);\n System.instance.context.viewport(0, 0, target.viewRect.width, target.viewRect.height); // Restore viewport\n this.clearGraphics(false);\n this._isDrawing = false;\n this._isReady = true;\n }\n}\n"]}
@@ -12,8 +12,16 @@ import { TileTreeReference } from "./internal";
12
12
  * @extensions
13
13
  */
14
14
  export interface TiledGraphicsProvider {
15
- /** For each [[TileTreeReference]] belonging to this provider that should be drawn in the specified [[Viewport]], apply the provided function. */
15
+ /** For each [[TileTreeReference]] belonging to this provider that should be drawn in the specified [[Viewport]], apply the provided function.
16
+ * This method is inefficient because it does not permit the caller to prematurely halt iteration; and awkward because `func` cannot be `async` nor
17
+ * return any value.
18
+ * Implementations should implement [[getReferences]], and callers should prefer to call [[TiledGraphicsProvider.getTileTreeRefs]].
19
+ */
16
20
  forEachTileTreeRef(viewport: Viewport, func: (ref: TileTreeReference) => void): void;
21
+ /** If defined, iterates over the [[TileTreeReference]]s belonging to this provider that should be drawn in the specified [[Viewport]].
22
+ * [[TiledGraphicsProvider.getTileTreeRefs]] will call this more efficient method if defined, and fall back to the less efficient [[forEachTileTreeRef]] otherwise.
23
+ */
24
+ getReferences?: (viewport: Viewport) => Iterable<TileTreeReference>;
17
25
  /** If defined, overrides the logic for adding this provider's graphics into the scene.
18
26
  * Otherwise, [[TileTreeReference.addToScene]] is invoked for each reference.
19
27
  */
@@ -31,5 +39,10 @@ export declare namespace TiledGraphicsProvider {
31
39
  function addToScene(provider: TiledGraphicsProvider, context: SceneContext): void;
32
40
  /** @internal because TypeDoc can't disambiguate with the interface method by same name. */
33
41
  function isLoadingComplete(provider: TiledGraphicsProvider, viewport: Viewport): boolean;
42
+ /** Obtain an iterator over all of the [[TileTreeReference]]s belonging to this provider that should be drawn in the specified [[Viewport]].
43
+ * This function invokes [[TiledGraphicsProvider.getReferences]] if implemented by `provider`; otherwise, it populates an iterable from the references
44
+ * provided by [[TiledGraphicsProvider.forEachTileTreeRef]], which is less efficient.
45
+ */
46
+ function getTileTreeRefs(provider: TiledGraphicsProvider, viewport: Viewport): Iterable<TileTreeReference>;
34
47
  }
35
48
  //# sourceMappingURL=TiledGraphicsProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TiledGraphicsProvider.d.ts","sourceRoot":"","sources":["../../../src/tile/TiledGraphicsProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACpC,iJAAiJ;IACjJ,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,iBAAiB,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AAgB,UAAU,CAAC,QAAQ,EAAE,qBAAqB,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI,CAKvF;IAED,2FAA2F;IAC3F,SAAgB,iBAAiB,CAAC,QAAQ,EAAE,qBAAqB,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAU9F;IAED;;;OAGG;IACH,SAAgB,eAAe,CAAC,QAAQ,EAAE,qBAAqB,EAAE,QAAQ,EAAE,QAAQ,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAWhH;CACF"}
@@ -30,5 +30,20 @@ var TiledGraphicsProvider;
30
30
  return allLoaded;
31
31
  }
32
32
  TiledGraphicsProvider.isLoadingComplete = isLoadingComplete;
33
+ /** Obtain an iterator over all of the [[TileTreeReference]]s belonging to this provider that should be drawn in the specified [[Viewport]].
34
+ * This function invokes [[TiledGraphicsProvider.getReferences]] if implemented by `provider`; otherwise, it populates an iterable from the references
35
+ * provided by [[TiledGraphicsProvider.forEachTileTreeRef]], which is less efficient.
36
+ */
37
+ function getTileTreeRefs(provider, viewport) {
38
+ if (provider.getReferences) {
39
+ return provider.getReferences(viewport);
40
+ }
41
+ const refs = [];
42
+ provider.forEachTileTreeRef(viewport, (ref) => {
43
+ refs.push(ref);
44
+ });
45
+ return refs;
46
+ }
47
+ TiledGraphicsProvider.getTileTreeRefs = getTileTreeRefs;
33
48
  })(TiledGraphicsProvider || (exports.TiledGraphicsProvider = TiledGraphicsProvider = {}));
34
49
  //# sourceMappingURL=TiledGraphicsProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TiledGraphicsProvider.js","sourceRoot":"","sources":["../../../src/tile/TiledGraphicsProvider.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AA8BH,cAAc;AACd,IAAiB,qBAAqB,CAqBrC;AArBD,WAAiB,qBAAqB;IACpC,2FAA2F;IAC3F,SAAgB,UAAU,CAAC,QAA+B,EAAE,OAAqB;QAC/E,IAAI,QAAQ,CAAC,UAAU;YACrB,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;;YAE7B,QAAQ,CAAC,kBAAkB,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IACpF,CAAC;IALe,gCAAU,aAKzB,CAAA;IAED,2FAA2F;IAC3F,SAAgB,iBAAiB,CAAC,QAA+B,EAAE,QAAkB;QACnF,IAAI,QAAQ,CAAC,iBAAiB,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,QAAQ,CAAC;YACrE,OAAO,KAAK,CAAC;QAEf,IAAI,SAAS,GAAG,IAAI,CAAC;QACrB,QAAQ,CAAC,kBAAkB,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE;YAC5C,SAAS,KAAK,GAAG,CAAC,iBAAiB,CAAC;QACtC,CAAC,CAAC,CAAC;QAEH,OAAO,SAAS,CAAC;IACnB,CAAC;IAVe,uCAAiB,oBAUhC,CAAA;AACH,CAAC,EArBgB,qBAAqB,qCAArB,qBAAqB,QAqBrC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Views\n */\n\nimport { Viewport } from \"../Viewport\";\nimport { SceneContext } from \"../ViewContext\";\nimport { TileTreeReference } from \"./internal\";\n\n/** Provides a way for applications to inject additional non-decorative graphics into a [[Viewport]] by supplying one or more [[TileTreeReference]]s capable of loading and drawing the graphics.\n * @see [[Viewport.addTiledGraphicsProvider]] to register a provider to be drawn in a viewport.\n * @see [Exploded View Sample](https://www.itwinjs.org/sample-showcase/?group=Viewer+Features&sample=explode-sample&imodel=House+Sample) for an interactive\n * demonstration of a custom provider.\n * @public\n * @extensions\n */\nexport interface TiledGraphicsProvider {\n /** For each [[TileTreeReference]] belonging to this provider that should be drawn in the specified [[Viewport]], apply the provided function. */\n forEachTileTreeRef(viewport: Viewport, func: (ref: TileTreeReference) => void): void;\n\n /** If defined, overrides the logic for adding this provider's graphics into the scene.\n * Otherwise, [[TileTreeReference.addToScene]] is invoked for each reference.\n */\n addToScene?: (context: SceneContext) => void;\n\n /** If defined, returns true if the [[TileTree]]s required for displaying this provider's graphics in the specified [[Viewport]] are loaded and ready to draw.\n * Otherwise, [[TileTreeReference.isLoadingComplete]] is invoked for each reference.\n * A provider might supply this function if it needs to perform some asynchronous work before it can supply its [[TileTreeReference]]s and/or after its\n * [[TileTree]]s are loaded.\n */\n isLoadingComplete?: (viewport: Viewport) => boolean;\n}\n\n/** @public */\nexport namespace TiledGraphicsProvider {\n /** @internal because TypeDoc can't disambiguate with the interface method by same name. */\n export function addToScene(provider: TiledGraphicsProvider, context: SceneContext): void {\n if (provider.addToScene)\n provider.addToScene(context);\n else\n provider.forEachTileTreeRef(context.viewport, (ref) => ref.addToScene(context));\n }\n\n /** @internal because TypeDoc can't disambiguate with the interface method by same name. */\n export function isLoadingComplete(provider: TiledGraphicsProvider, viewport: Viewport): boolean {\n if (provider.isLoadingComplete && !provider.isLoadingComplete(viewport))\n return false;\n\n let allLoaded = true;\n provider.forEachTileTreeRef(viewport, (ref) => {\n allLoaded &&= ref.isLoadingComplete;\n });\n\n return allLoaded;\n }\n}\n"]}
1
+ {"version":3,"file":"TiledGraphicsProvider.js","sourceRoot":"","sources":["../../../src/tile/TiledGraphicsProvider.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAuCH,cAAc;AACd,IAAiB,qBAAqB,CAsCrC;AAtCD,WAAiB,qBAAqB;IACpC,2FAA2F;IAC3F,SAAgB,UAAU,CAAC,QAA+B,EAAE,OAAqB;QAC/E,IAAI,QAAQ,CAAC,UAAU;YACrB,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;;YAE7B,QAAQ,CAAC,kBAAkB,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IACpF,CAAC;IALe,gCAAU,aAKzB,CAAA;IAED,2FAA2F;IAC3F,SAAgB,iBAAiB,CAAC,QAA+B,EAAE,QAAkB;QACnF,IAAI,QAAQ,CAAC,iBAAiB,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,QAAQ,CAAC;YACrE,OAAO,KAAK,CAAC;QAEf,IAAI,SAAS,GAAG,IAAI,CAAC;QACrB,QAAQ,CAAC,kBAAkB,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE;YAC5C,SAAS,KAAK,GAAG,CAAC,iBAAiB,CAAC;QACtC,CAAC,CAAC,CAAC;QAEH,OAAO,SAAS,CAAC;IACnB,CAAC;IAVe,uCAAiB,oBAUhC,CAAA;IAED;;;OAGG;IACH,SAAgB,eAAe,CAAC,QAA+B,EAAE,QAAkB;QACjF,IAAI,QAAQ,CAAC,aAAa,EAAE,CAAC;YAC3B,OAAO,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC1C,CAAC;QAED,MAAM,IAAI,GAAwB,EAAE,CAAC;QACrC,QAAQ,CAAC,kBAAkB,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE;YAC5C,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC;IAXe,qCAAe,kBAW9B,CAAA;AACH,CAAC,EAtCgB,qBAAqB,qCAArB,qBAAqB,QAsCrC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Views\n */\n\nimport { Viewport } from \"../Viewport\";\nimport { SceneContext } from \"../ViewContext\";\nimport { TileTreeReference } from \"./internal\";\n\n/** Provides a way for applications to inject additional non-decorative graphics into a [[Viewport]] by supplying one or more [[TileTreeReference]]s capable of loading and drawing the graphics.\n * @see [[Viewport.addTiledGraphicsProvider]] to register a provider to be drawn in a viewport.\n * @see [Exploded View Sample](https://www.itwinjs.org/sample-showcase/?group=Viewer+Features&sample=explode-sample&imodel=House+Sample) for an interactive\n * demonstration of a custom provider.\n * @public\n * @extensions\n */\nexport interface TiledGraphicsProvider {\n /** For each [[TileTreeReference]] belonging to this provider that should be drawn in the specified [[Viewport]], apply the provided function.\n * This method is inefficient because it does not permit the caller to prematurely halt iteration; and awkward because `func` cannot be `async` nor\n * return any value.\n * Implementations should implement [[getReferences]], and callers should prefer to call [[TiledGraphicsProvider.getTileTreeRefs]].\n */\n forEachTileTreeRef(viewport: Viewport, func: (ref: TileTreeReference) => void): void;\n\n /** If defined, iterates over the [[TileTreeReference]]s belonging to this provider that should be drawn in the specified [[Viewport]].\n * [[TiledGraphicsProvider.getTileTreeRefs]] will call this more efficient method if defined, and fall back to the less efficient [[forEachTileTreeRef]] otherwise.\n */\n getReferences?: (viewport: Viewport) => Iterable<TileTreeReference>;\n\n /** If defined, overrides the logic for adding this provider's graphics into the scene.\n * Otherwise, [[TileTreeReference.addToScene]] is invoked for each reference.\n */\n addToScene?: (context: SceneContext) => void;\n\n /** If defined, returns true if the [[TileTree]]s required for displaying this provider's graphics in the specified [[Viewport]] are loaded and ready to draw.\n * Otherwise, [[TileTreeReference.isLoadingComplete]] is invoked for each reference.\n * A provider might supply this function if it needs to perform some asynchronous work before it can supply its [[TileTreeReference]]s and/or after its\n * [[TileTree]]s are loaded.\n */\n isLoadingComplete?: (viewport: Viewport) => boolean;\n}\n\n/** @public */\nexport namespace TiledGraphicsProvider {\n /** @internal because TypeDoc can't disambiguate with the interface method by same name. */\n export function addToScene(provider: TiledGraphicsProvider, context: SceneContext): void {\n if (provider.addToScene)\n provider.addToScene(context);\n else\n provider.forEachTileTreeRef(context.viewport, (ref) => ref.addToScene(context));\n }\n\n /** @internal because TypeDoc can't disambiguate with the interface method by same name. */\n export function isLoadingComplete(provider: TiledGraphicsProvider, viewport: Viewport): boolean {\n if (provider.isLoadingComplete && !provider.isLoadingComplete(viewport))\n return false;\n\n let allLoaded = true;\n provider.forEachTileTreeRef(viewport, (ref) => {\n allLoaded &&= ref.isLoadingComplete;\n });\n\n return allLoaded;\n }\n\n /** Obtain an iterator over all of the [[TileTreeReference]]s belonging to this provider that should be drawn in the specified [[Viewport]].\n * This function invokes [[TiledGraphicsProvider.getReferences]] if implemented by `provider`; otherwise, it populates an iterable from the references\n * provided by [[TiledGraphicsProvider.forEachTileTreeRef]], which is less efficient.\n */\n export function getTileTreeRefs(provider: TiledGraphicsProvider, viewport: Viewport): Iterable<TileTreeReference> {\n if (provider.getReferences) {\n return provider.getReferences(viewport);\n }\n\n const refs: TileTreeReference[] = [];\n provider.forEachTileTreeRef(viewport, (ref) => {\n refs.push(ref);\n });\n\n return refs;\n }\n}\n"]}
@@ -25,6 +25,7 @@ export declare class MapTiledGraphicsProvider implements TiledGraphicsProvider {
25
25
  readonly overlayMap: MapTileTreeReference;
26
26
  readonly backgroundDrapeMap: MapTileTreeReference;
27
27
  private readonly _detachFromDisplayStyle;
28
+ getReferences(viewport: Viewport): Iterable<TileTreeReference>;
28
29
  forEachTileTreeRef(viewport: Viewport, func: (ref: TileTreeReference) => void): void;
29
30
  constructor(viewportId: number, displayStyle: DisplayStyleState);
30
31
  setView(newView: ViewState): void;
@@ -1 +1 @@
1
- {"version":3,"file":"MapTiledGraphicsProvider.d.ts","sourceRoot":"","sources":["../../../../src/tile/map/MapTiledGraphicsProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EA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../internal");
13
13
  const IModelApp_1 = require("../../IModelApp");
14
14
  /** @internal */
15
15
  class MapTiledGraphicsProvider {
16
+ *getReferences(viewport) {
17
+ if (viewport.viewFlags.backgroundMap) {
18
+ yield this.backgroundMap;
19
+ yield this.overlayMap;
20
+ }
21
+ }
16
22
  forEachTileTreeRef(viewport, func) {
17
23
  if (viewport.viewFlags.backgroundMap) {
18
24
  func(this.backgroundMap);
@@ -1 +1 @@
1
- {"version":3,"file":"MapTiledGraphicsProvider.js","sourceRoot":"","sources":["../../../../src/tile/map/MapTiledGraphicsProvider.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,oDAAgG;AAIhG,0CAA+L;AAC/L,+CAA4C;AAiB5C,gBAAgB;AAChB,MAAa,wBAAwB;IAM5B,kBAAkB,CAAC,QAAkB,EAAE,IAAsC;QAClF,IAAI,QAAQ,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC;YACrC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IACD,YAAY,UAAkB,EAAE,YAA+B;QAR9C,4BAAuB,GAAmB,EAAE,CAAC;QAS5D,MAAM,WAAW,GAAG,YAAY,CAAC,qBAAqB,CAAC;QACvD,MAAM,UAAU,GAAG,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC;QACpD,IAAI,CAAC,aAAa,GAAG,IAAI,+BAAoB,CAAC,WAAW,EAAE,UAAU,CAAC,cAAc,EAAE,UAAU,CAAC,gBAAgB,EAAE,YAAY,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,sBAAsB,EAAE,CAAC,CAAC;QAC/M,IAAI,CAAC,UAAU,GAAG,IAAI,+BAAoB,CAAC,WAAW,EAAE,SAAS,EAAE,UAAU,CAAC,aAAa,EAAE,YAAY,CAAC,MAAM,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AAqB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QACrF,MAAM,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC,qBAAqB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QACnF,OAAO,CAAC,GAAG,WAAW,EAAE,GAAG,YAAY,CAAC,CAAC;IAC3C,CAAC;CACF;AAtHD,4DAsHC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tiles\n */\n\nimport { Id64String } from \"@itwin/core-bentley\";\nimport { BaseMapLayerSettings, MapImagerySettings, MapLayerSettings } from \"@itwin/core-common\";\nimport { DisplayStyleState } from \"../../DisplayStyleState\";\nimport { ViewState } from \"../../ViewState\";\nimport { Viewport } from \"../../Viewport\";\nimport { DisclosedTileTreeSet, MapLayerImageryProvider, MapLayerInfoFromTileTree, MapTileTreeReference, TiledGraphicsProvider, TileTree, TileTreeOwner, TileTreeReference } from \"../internal\";\nimport { IModelApp } from \"../../IModelApp\";\n\n/** Position of a map-layer in the display style's map (i.e. background/overlay map)\n * @public\n */\nexport interface MapLayerIndex {\n /** True if map-layer is part of [[DisplayStyleState]]'s overlay map, otherwise map-layer is part of [[DisplayStyleState]]'s background map\n * @see [[DisplayStyleState.mapLayerAtIndex]].\n */\n isOverlay: boolean;\n\n /** Index of the map-layer in [[DisplayStyleState]]'s background/overlay map\n * @see [[DisplayStyleState.mapLayerAtIndex]].\n */\n index: number;\n}\n\n/** @internal */\nexport class MapTiledGraphicsProvider implements TiledGraphicsProvider {\n public readonly backgroundMap: MapTileTreeReference;\n public readonly overlayMap: MapTileTreeReference;\n public readonly backgroundDrapeMap: MapTileTreeReference;\n private readonly _detachFromDisplayStyle: VoidFunction[] = [];\n\n public forEachTileTreeRef(viewport: Viewport, func: (ref: TileTreeReference) => void): void {\n if (viewport.viewFlags.backgroundMap) {\n func(this.backgroundMap);\n func(this.overlayMap);\n }\n }\n constructor(viewportId: number, displayStyle: DisplayStyleState) {\n const mapSettings = displayStyle.backgroundMapSettings;\n const mapImagery = displayStyle.settings.mapImagery;\n this.backgroundMap = new MapTileTreeReference(mapSettings, mapImagery.backgroundBase, mapImagery.backgroundLayers, displayStyle.iModel, viewportId, false, false, () => displayStyle.overrideTerrainDisplay());\n this.overlayMap = new MapTileTreeReference(mapSettings, undefined, mapImagery.overlayLayers, displayStyle.iModel, viewportId, true, false);\n this.backgroundDrapeMap = new MapTileTreeReference(mapSettings, mapImagery.backgroundBase, mapImagery.backgroundLayers, displayStyle.iModel, viewportId, false, true);\n\n const removals = this._detachFromDisplayStyle;\n removals.push(displayStyle.settings.onBackgroundMapChanged.addListener((settings) => {\n this.backgroundMap.settings = settings;\n this.overlayMap.settings = settings;\n this.backgroundDrapeMap.settings = settings;\n }));\n\n removals.push(displayStyle.settings.onMapImageryChanged.addListener((imagery: Readonly<MapImagerySettings>) => {\n this.backgroundMap.setBaseLayerSettings(imagery.backgroundBase);\n this.backgroundMap.setLayerSettings(imagery.backgroundLayers);\n this.backgroundDrapeMap.setBaseLayerSettings(mapImagery.backgroundBase);\n this.backgroundDrapeMap.setLayerSettings(mapImagery.backgroundLayers);\n this.overlayMap.setLayerSettings(imagery.overlayLayers);\n }));\n\n // We need to clear imagery tiles assigned to map tiles every time a new ImageryTileTree is loaded,\n // otherwise the imagery tiles won't refresh correctly.\n const clearMapLayers = (loadedTileTree: TileTree, mapTileTreeToClear: MapTileTreeReference) => {\n const trees = new DisclosedTileTreeSet();\n mapTileTreeToClear.discloseTileTrees(trees);\n if (trees.has(loadedTileTree)) {\n mapTileTreeToClear.clearLayers();\n }\n };\n removals.push(IModelApp.tileAdmin.onTileTreeLoad.addListener((tileTree: TileTreeOwner) => {\n if (tileTree.tileTree !== undefined) {\n clearMapLayers(tileTree.tileTree, this.backgroundMap);\n clearMapLayers(tileTree.tileTree, this.overlayMap);\n }\n }));\n }\n\n // This is used in inital view setup and when views are synchronized. If view is being synchronized\n // we need to clear the layers which purges tile graphics if the settings or layers are changed.\n public setView(newView: ViewState) {\n const layersMatch = ((layers1: MapLayerSettings[], layers2: MapLayerSettings[]): boolean => {\n if (layers1.length !== layers2.length)\n return false;\n\n for (let i = 0; i < layers1.length; i++)\n if (!layers1[i].displayMatches(layers2[i]))\n return false;\n\n return true;\n });\n const mapImagery = newView.displayStyle.settings.mapImagery;\n if (!newView.displayStyle.backgroundMapSettings.equals(this.backgroundMap.settings)\n || !layersMatch(mapImagery.backgroundLayers, this.backgroundMap.layerSettings)\n || (mapImagery.backgroundBase instanceof BaseMapLayerSettings && !layersMatch([mapImagery.backgroundBase], this.backgroundDrapeMap.layerSettings))) {\n this.backgroundMap.clearLayers();\n this.backgroundDrapeMap.clearLayers();\n }\n if (!layersMatch(mapImagery.overlayLayers, this.overlayMap.layerSettings))\n this.overlayMap.clearLayers();\n }\n\n public detachFromDisplayStyle(): void {\n this._detachFromDisplayStyle.forEach((f) => f());\n this._detachFromDisplayStyle.length = 0;\n }\n\n /** @internal */\n public getMapLayerImageryProvider(mapLayerIndex: MapLayerIndex): MapLayerImageryProvider | undefined {\n const imageryTreeRef = mapLayerIndex.isOverlay ? this.overlayMap.getLayerImageryTreeRef(mapLayerIndex.index) : this.backgroundMap.getLayerImageryTreeRef(mapLayerIndex.index);\n return imageryTreeRef?.imageryProvider;\n }\n\n public resetMapLayer(mapLayerIndex: MapLayerIndex) {\n const imageryTreeRef = mapLayerIndex.isOverlay ? this.overlayMap.getLayerImageryTreeRef(mapLayerIndex.index) : this.backgroundMap.getLayerImageryTreeRef(mapLayerIndex.index);\n imageryTreeRef?.resetTreeOwner();\n }\n\n /** Return a list of map-layers indexes matching a given MapTile tree Id and a layer imagery tree id.\n * @internal\n */\n public getMapLayerIndexesFromIds(mapTreeId: Id64String, layerTreeId: Id64String): MapLayerIndex[] {\n const layers = new Array<MapLayerIndex>();\n if (mapTreeId === this.backgroundMap.treeOwner.tileTree?.id) {\n for (let i = 0; i < this.backgroundMap.layerSettings.length; i++) {\n if (this.backgroundMap.getLayerImageryTreeRef(i)?.treeOwner.tileTree?.id === layerTreeId) {\n layers.push({ index: i, isOverlay: false });\n }\n }\n } else if (mapTreeId === this.overlayMap.treeOwner.tileTree?.id) {\n for (let i = 0; i < this.overlayMap.layerSettings.length; i++) {\n if (this.overlayMap.getLayerImageryTreeRef(i)?.treeOwner.tileTree?.id === layerTreeId) {\n layers.push({ index: i, isOverlay: true });\n }\n }\n }\n return layers;\n }\n\n /** @internal */\n public mapLayerFromIds(mapTreeId: Id64String, layerTreeId: Id64String): MapLayerInfoFromTileTree[] {\n const bgMapLayers = this.backgroundMap.layerFromTreeModelIds(mapTreeId, layerTreeId);\n const ovlMapLayers = this.overlayMap.layerFromTreeModelIds(mapTreeId, layerTreeId);\n return [...bgMapLayers, ...ovlMapLayers];\n }\n}\n\n"]}
1
+ {"version":3,"file":"MapTiledGraphicsProvider.js","sourceRoot":"","sources":["../../../../src/tile/map/MapTiledGraphicsProvider.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,oDAAgG;AAIhG,0CAA+L;AAC/L,+CAA4C;AAiB5C,gBAAgB;AAChB,MAAa,wBAAwB;IAM5B,CAAE,aAAa,CAAC,QAAkB;QACvC,IAAI,QAAQ,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC;YACrC,MAAM,IAAI,CAAC,aAAa,CAAC;YACzB,MAAM,IAAI,CAAC,UAAU,CAAC;QACxB,CAAC;IACH,CAAC;IAEM,kBAAkB,CAAC,QAAkB,EAAE,IAAsC;QAClF,IAAI,QAAQ,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC;YACrC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IAED,YAAY,UAAkB,EAAE,YAA+B;QAhB9C,4BA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EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC9D,IAAI,IAAI,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,QAAQ,EAAE,EAAE,KAAK,WAAW,EAAE,CAAC;oBACtF,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;gBAC7C,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,gBAAgB;IACT,eAAe,CAAC,SAAqB,EAAE,WAAuB;QACnE,MAAM,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QACrF,MAAM,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC,qBAAqB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QACnF,OAAO,CAAC,GAAG,WAAW,EAAE,GAAG,YAAY,CAAC,CAAC;IAC3C,CAAC;CACF;AA9HD,4DA8HC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tiles\n */\n\nimport { Id64String } from \"@itwin/core-bentley\";\nimport { BaseMapLayerSettings, MapImagerySettings, MapLayerSettings } from \"@itwin/core-common\";\nimport { DisplayStyleState } from \"../../DisplayStyleState\";\nimport { ViewState } from \"../../ViewState\";\nimport { Viewport } from \"../../Viewport\";\nimport { DisclosedTileTreeSet, MapLayerImageryProvider, MapLayerInfoFromTileTree, MapTileTreeReference, TiledGraphicsProvider, TileTree, TileTreeOwner, TileTreeReference } from \"../internal\";\nimport { IModelApp } from \"../../IModelApp\";\n\n/** Position of a map-layer in the display style's map (i.e. background/overlay map)\n * @public\n */\nexport interface MapLayerIndex {\n /** True if map-layer is part of [[DisplayStyleState]]'s overlay map, otherwise map-layer is part of [[DisplayStyleState]]'s background map\n * @see [[DisplayStyleState.mapLayerAtIndex]].\n */\n isOverlay: boolean;\n\n /** Index of the map-layer in [[DisplayStyleState]]'s background/overlay map\n * @see [[DisplayStyleState.mapLayerAtIndex]].\n */\n index: number;\n}\n\n/** @internal */\nexport class MapTiledGraphicsProvider implements TiledGraphicsProvider {\n public readonly backgroundMap: MapTileTreeReference;\n public readonly overlayMap: MapTileTreeReference;\n public readonly backgroundDrapeMap: MapTileTreeReference;\n private readonly _detachFromDisplayStyle: VoidFunction[] = [];\n\n public * getReferences(viewport: Viewport): Iterable<TileTreeReference> {\n if (viewport.viewFlags.backgroundMap) {\n yield this.backgroundMap;\n yield this.overlayMap;\n }\n }\n\n public forEachTileTreeRef(viewport: Viewport, func: (ref: TileTreeReference) => void): void {\n if (viewport.viewFlags.backgroundMap) {\n func(this.backgroundMap);\n func(this.overlayMap);\n }\n }\n\n constructor(viewportId: number, displayStyle: DisplayStyleState) {\n const mapSettings = displayStyle.backgroundMapSettings;\n const mapImagery = displayStyle.settings.mapImagery;\n this.backgroundMap = new MapTileTreeReference(mapSettings, mapImagery.backgroundBase, mapImagery.backgroundLayers, displayStyle.iModel, viewportId, false, false, () => displayStyle.overrideTerrainDisplay());\n this.overlayMap = new MapTileTreeReference(mapSettings, undefined, mapImagery.overlayLayers, displayStyle.iModel, viewportId, true, false);\n this.backgroundDrapeMap = new MapTileTreeReference(mapSettings, mapImagery.backgroundBase, mapImagery.backgroundLayers, displayStyle.iModel, viewportId, false, true);\n\n const removals = this._detachFromDisplayStyle;\n removals.push(displayStyle.settings.onBackgroundMapChanged.addListener((settings) => {\n this.backgroundMap.settings = settings;\n this.overlayMap.settings = settings;\n this.backgroundDrapeMap.settings = settings;\n }));\n\n removals.push(displayStyle.settings.onMapImageryChanged.addListener((imagery: Readonly<MapImagerySettings>) => {\n this.backgroundMap.setBaseLayerSettings(imagery.backgroundBase);\n this.backgroundMap.setLayerSettings(imagery.backgroundLayers);\n this.backgroundDrapeMap.setBaseLayerSettings(mapImagery.backgroundBase);\n this.backgroundDrapeMap.setLayerSettings(mapImagery.backgroundLayers);\n this.overlayMap.setLayerSettings(imagery.overlayLayers);\n }));\n\n // We need to clear imagery tiles assigned to map tiles every time a new ImageryTileTree is loaded,\n // otherwise the imagery tiles won't refresh correctly.\n const clearMapLayers = (loadedTileTree: TileTree, mapTileTreeToClear: MapTileTreeReference) => {\n const trees = new DisclosedTileTreeSet();\n mapTileTreeToClear.discloseTileTrees(trees);\n if (trees.has(loadedTileTree)) {\n mapTileTreeToClear.clearLayers();\n }\n };\n removals.push(IModelApp.tileAdmin.onTileTreeLoad.addListener((tileTree: TileTreeOwner) => {\n if (tileTree.tileTree !== undefined) {\n clearMapLayers(tileTree.tileTree, this.backgroundMap);\n clearMapLayers(tileTree.tileTree, this.overlayMap);\n }\n }));\n }\n\n // This is used in inital view setup and when views are synchronized. If view is being synchronized\n // we need to clear the layers which purges tile graphics if the settings or layers are changed.\n public setView(newView: ViewState) {\n const layersMatch = ((layers1: MapLayerSettings[], layers2: MapLayerSettings[]): boolean => {\n if (layers1.length !== layers2.length)\n return false;\n\n for (let i = 0; i < layers1.length; i++)\n if (!layers1[i].displayMatches(layers2[i]))\n return false;\n\n return true;\n });\n const mapImagery = newView.displayStyle.settings.mapImagery;\n if (!newView.displayStyle.backgroundMapSettings.equals(this.backgroundMap.settings)\n || !layersMatch(mapImagery.backgroundLayers, this.backgroundMap.layerSettings)\n || (mapImagery.backgroundBase instanceof BaseMapLayerSettings && !layersMatch([mapImagery.backgroundBase], this.backgroundDrapeMap.layerSettings))) {\n this.backgroundMap.clearLayers();\n this.backgroundDrapeMap.clearLayers();\n }\n if (!layersMatch(mapImagery.overlayLayers, this.overlayMap.layerSettings))\n this.overlayMap.clearLayers();\n }\n\n public detachFromDisplayStyle(): void {\n this._detachFromDisplayStyle.forEach((f) => f());\n this._detachFromDisplayStyle.length = 0;\n }\n\n /** @internal */\n public getMapLayerImageryProvider(mapLayerIndex: MapLayerIndex): MapLayerImageryProvider | undefined {\n const imageryTreeRef = mapLayerIndex.isOverlay ? this.overlayMap.getLayerImageryTreeRef(mapLayerIndex.index) : this.backgroundMap.getLayerImageryTreeRef(mapLayerIndex.index);\n return imageryTreeRef?.imageryProvider;\n }\n\n public resetMapLayer(mapLayerIndex: MapLayerIndex) {\n const imageryTreeRef = mapLayerIndex.isOverlay ? this.overlayMap.getLayerImageryTreeRef(mapLayerIndex.index) : this.backgroundMap.getLayerImageryTreeRef(mapLayerIndex.index);\n imageryTreeRef?.resetTreeOwner();\n }\n\n /** Return a list of map-layers indexes matching a given MapTile tree Id and a layer imagery tree id.\n * @internal\n */\n public getMapLayerIndexesFromIds(mapTreeId: Id64String, layerTreeId: Id64String): MapLayerIndex[] {\n const layers = new Array<MapLayerIndex>();\n if (mapTreeId === this.backgroundMap.treeOwner.tileTree?.id) {\n for (let i = 0; i < this.backgroundMap.layerSettings.length; i++) {\n if (this.backgroundMap.getLayerImageryTreeRef(i)?.treeOwner.tileTree?.id === layerTreeId) {\n layers.push({ index: i, isOverlay: false });\n }\n }\n } else if (mapTreeId === this.overlayMap.treeOwner.tileTree?.id) {\n for (let i = 0; i < this.overlayMap.layerSettings.length; i++) {\n if (this.overlayMap.getLayerImageryTreeRef(i)?.treeOwner.tileTree?.id === layerTreeId) {\n layers.push({ index: i, isOverlay: true });\n }\n }\n }\n return layers;\n }\n\n /** @internal */\n public mapLayerFromIds(mapTreeId: Id64String, layerTreeId: Id64String): MapLayerInfoFromTileTree[] {\n const bgMapLayers = this.backgroundMap.layerFromTreeModelIds(mapTreeId, layerTreeId);\n const ovlMapLayers = this.overlayMap.layerFromTreeModelIds(mapTreeId, layerTreeId);\n return [...bgMapLayers, ...ovlMapLayers];\n }\n}\n\n"]}
@@ -20,6 +20,11 @@ export declare class AccuDrawViewportUI extends AccuDraw {
20
20
  fixedLocation: boolean;
21
21
  /** Layout controls in a single row horizontally instead of in columns vertically as an option when using fixed location. */
22
22
  horizontalArrangement: boolean;
23
+ /** When controls follow the cursor, the X and Y offsets applied to the current point to position the top left (values in inches based on screen DPI) */
24
+ cursorOffset: {
25
+ x: number;
26
+ y: number;
27
+ };
23
28
  /** Replace "^", ";", and ".." with "°" or ":" for easier input. */
24
29
  simplifiedInput: boolean;
25
30
  /** Enable simple math operations not supported by quantity parser. */
@@ -1 +1 @@
1
- {"version":3,"file":"AccuDrawViewportUI.d.ts","sourceRoot":"","sources":["../../../src/tools/AccuDrawViewportUI.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,QAAQ,EAAe,SAAS,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG9C,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAS7C;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,QAAQ;IAC9C,OAAO,CAAC,UAAU,CAAY;IAC9B,OAAO,CAAC,SAAS,CAAC,CAAmB;IACrC,OAAO,CAAC,kBAAkB,CAAC,CAAO;IAClC,OAAO,CAAC,WAAW,CAAC,CAAwC;IAE5D;;OAEG;IACH,OAAc,YAAY;QACxB,qGAAqG;;QAErG,+GAA+G;;QAE/G,4HAA4H;;QAE5H,mEAAmE;;QAEnE,sEAAsE;;QAEtE,iEAAiE;;QAEjE,iEAAiE;;QAEjE,kFAAkF;;QAElF,4DAA4D;;QAE5D,4EAA4E;;QAG5E,qEAAqE;;YAEnE,wEAAwE;;YAExE,sEAAsE;;YAEtE,uEAAuE;;YAEvE,oDAAoD;;;QAItD,yCAAyC;;YAEvC,0CAA0C;;YAE1C,gFAAgF;;YAEhF,+BAA+B;;YAE/B,2DAA2D;;;MAG7D;IAEF,oGAAoG;;IAMpG,gGAAgG;IACzF,uBAAuB;IAO9B,yFAAyF;IAClF,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I,OAAO,CAG3C;IAED;;OAEG;IACa,YAAY,CAAC,KAAK,EAAE,SAAS;IAQ7C;;OAEG;IACa,cAAc;IAO9B,OAAO,CAAC,aAAa;IAarB;;OAEG;IACa,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAMpE;;OAEG;IACa,mBAAmB,IAAI,IAAI;IAK3C;;;;;OAKG;IACa,wBAAwB,CAAC,IAAI,EAAE,SAAS;IAMxD;;OAEG;IACa,kBAAkB,CAAC,IAAI,EAAE,SAAS;IAMlD;;OAEG;IACa,iBAAiB,CAAC,IAAI,EAAE,SAAS;IAMjD;;;;OAIG;IACa,QAAQ,CAAC,EAAE,EAAE,aAAa,GAAG,IAAI;CAIlD"}
@@ -28,6 +28,8 @@ class AccuDrawViewportUI extends AccuDraw_1.AccuDraw {
28
28
  fixedLocation: false,
29
29
  /** Layout controls in a single row horizontally instead of in columns vertically as an option when using fixed location. */
30
30
  horizontalArrangement: false,
31
+ /** When controls follow the cursor, the X and Y offsets applied to the current point to position the top left (values in inches based on screen DPI) */
32
+ cursorOffset: { x: .4, y: .1 },
31
33
  /** Replace "^", ";", and ".." with "°" or ":" for easier input. */
32
34
  simplifiedInput: true,
33
35
  /** Enable simple math operations not supported by quantity parser. */
@@ -542,11 +544,12 @@ class AccuDrawViewportUI extends AccuDraw_1.AccuDraw {
542
544
  return;
543
545
  if (undefined !== this._controls && this._controls.overlay.parentElement !== vp.vpDiv)
544
546
  this.removeControls(); // Could be enhanced to save/restore partial input of currently focused item...
547
+ const props = AccuDrawViewportUI.controlProps;
545
548
  if (undefined === this._controls) {
546
549
  const overlay = vp.addNewDiv("accudraw-overlay", true, 35);
547
550
  const div = this.createControlDiv();
548
551
  const is3dLayout = vp.view.is3d();
549
- const isHorizontalLayout = AccuDrawViewportUI.controlProps.horizontalArrangement;
552
+ const isHorizontalLayout = props.horizontalArrangement;
550
553
  overlay.appendChild(div);
551
554
  const createFieldAndLock = (item) => {
552
555
  const itemField = itemFields[item] = this.createItemField(item);
@@ -554,7 +557,7 @@ class AccuDrawViewportUI extends AccuDraw_1.AccuDraw {
554
557
  itemField.style.left = isHorizontalLayout ? `${columnOffset}px` : "0";
555
558
  div.appendChild(itemField);
556
559
  if (is3dLayout || AccuDraw_1.ItemField.Z_Item !== item)
557
- rowOffset += itemField.offsetHeight * AccuDrawViewportUI.controlProps.rowSpacingFactor;
560
+ rowOffset += itemField.offsetHeight * props.rowSpacingFactor;
558
561
  itemWidth = itemField.offsetWidth;
559
562
  itemHeight = itemField.offsetHeight;
560
563
  const itemLock = itemLocks[item] = this.createItemFieldLock(item);
@@ -564,7 +567,7 @@ class AccuDrawViewportUI extends AccuDraw_1.AccuDraw {
564
567
  div.appendChild(itemLock);
565
568
  lockWidth = itemLock.offsetWidth;
566
569
  if (is3dLayout || AccuDraw_1.ItemField.Z_Item !== item)
567
- columnOffset += (itemWidth + lockWidth) * AccuDrawViewportUI.controlProps.columnSpacingFactor;
570
+ columnOffset += (itemWidth + lockWidth) * props.columnSpacingFactor;
568
571
  };
569
572
  let rowOffset = 0;
570
573
  let columnOffset = 0;
@@ -581,7 +584,7 @@ class AccuDrawViewportUI extends AccuDraw_1.AccuDraw {
581
584
  createFieldAndLock(AccuDraw_1.ItemField.Y_Item);
582
585
  createFieldAndLock(AccuDraw_1.ItemField.Z_Item); // Both polar and rectangular modes support Z in 3d views...
583
586
  div.style.width = isHorizontalLayout ? `${columnOffset}px` : `${itemWidth + lockWidth + 5}px`;
584
- div.style.height = isHorizontalLayout ? `${itemHeight * AccuDrawViewportUI.controlProps.rowSpacingFactor}px` : `${rowOffset}px`;
587
+ div.style.height = isHorizontalLayout ? `${itemHeight * props.rowSpacingFactor}px` : `${rowOffset}px`;
585
588
  this._controls = { overlay, div, itemFields, itemLocks };
586
589
  this.updateControlVisibility(AccuDraw_1.CompassMode.Polar === this.compassMode, vp.view.is3d());
587
590
  this.setFocusItem(this._focusItem);
@@ -590,13 +593,13 @@ class AccuDrawViewportUI extends AccuDraw_1.AccuDraw {
590
593
  }
591
594
  const viewRect = vp.viewRect;
592
595
  const position = vp.worldToView(ev.point);
593
- if (AccuDrawViewportUI.controlProps.fixedLocation) {
596
+ if (props.fixedLocation) {
594
597
  position.x = (viewRect.left + ((viewRect.width - this._controls.div.offsetWidth) * 0.5));
595
598
  position.y = (viewRect.bottom - this._controls.div.offsetHeight);
596
599
  }
597
600
  else {
598
- position.x += Math.floor(vp.pixelsFromInches(0.4)) + 0.5;
599
- position.y += Math.floor(vp.pixelsFromInches(0.1)) + 0.5;
601
+ position.x += Math.floor(vp.pixelsFromInches(props.cursorOffset.x)) + 0.5;
602
+ position.y += Math.floor(vp.pixelsFromInches(props.cursorOffset.y)) + 0.5;
600
603
  }
601
604
  const controlRect = new ViewRect_1.ViewRect(position.x, position.y, position.x + this._controls.div.offsetWidth, position.y + this._controls.div.offsetHeight);
602
605
  this.modifyControlRect(controlRect, vp);