@itwin/core-frontend 3.0.0-dev.166 → 3.0.0-dev.170

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 (83) hide show
  1. package/lib/cjs/IModelApp.d.ts +1 -1
  2. package/lib/cjs/IModelApp.d.ts.map +1 -1
  3. package/lib/cjs/IModelApp.js.map +1 -1
  4. package/lib/cjs/ImageUtil.d.ts.map +1 -1
  5. package/lib/cjs/ImageUtil.js +4 -1
  6. package/lib/cjs/ImageUtil.js.map +1 -1
  7. package/lib/cjs/ViewManager.d.ts +6 -6
  8. package/lib/cjs/ViewManager.js +5 -5
  9. package/lib/cjs/ViewManager.js.map +1 -1
  10. package/lib/cjs/Viewport.d.ts +5 -3
  11. package/lib/cjs/Viewport.d.ts.map +1 -1
  12. package/lib/cjs/Viewport.js +5 -3
  13. package/lib/cjs/Viewport.js.map +1 -1
  14. package/lib/cjs/render/RenderSystem.d.ts +1 -0
  15. package/lib/cjs/render/RenderSystem.d.ts.map +1 -1
  16. package/lib/cjs/render/RenderSystem.js +1 -0
  17. package/lib/cjs/render/RenderSystem.js.map +1 -1
  18. package/lib/cjs/tile/B3dmReader.js +2 -2
  19. package/lib/cjs/tile/B3dmReader.js.map +1 -1
  20. package/lib/cjs/tile/DynamicIModelTile.js +1 -1
  21. package/lib/cjs/tile/DynamicIModelTile.js.map +1 -1
  22. package/lib/cjs/tile/GltfReader.d.ts +129 -36
  23. package/lib/cjs/tile/GltfReader.d.ts.map +1 -1
  24. package/lib/cjs/tile/GltfReader.js +261 -122
  25. package/lib/cjs/tile/GltfReader.js.map +1 -1
  26. package/lib/cjs/tile/I3dmReader.js +2 -2
  27. package/lib/cjs/tile/I3dmReader.js.map +1 -1
  28. package/lib/cjs/tile/IModelTile.js +1 -1
  29. package/lib/cjs/tile/IModelTile.js.map +1 -1
  30. package/lib/cjs/tile/ImdlReader.d.ts +12 -1
  31. package/lib/cjs/tile/ImdlReader.d.ts.map +1 -1
  32. package/lib/cjs/tile/ImdlReader.js +47 -3
  33. package/lib/cjs/tile/ImdlReader.js.map +1 -1
  34. package/lib/cjs/tile/RealityTileLoader.js +1 -1
  35. package/lib/cjs/tile/RealityTileLoader.js.map +1 -1
  36. package/lib/cjs/tile/map/CesiumTerrainProvider.js +1 -1
  37. package/lib/cjs/tile/map/CesiumTerrainProvider.js.map +1 -1
  38. package/lib/cjs/tools/Tool.d.ts +29 -1
  39. package/lib/cjs/tools/Tool.d.ts.map +1 -1
  40. package/lib/cjs/tools/Tool.js +66 -0
  41. package/lib/cjs/tools/Tool.js.map +1 -1
  42. package/lib/esm/IModelApp.d.ts +1 -1
  43. package/lib/esm/IModelApp.d.ts.map +1 -1
  44. package/lib/esm/IModelApp.js.map +1 -1
  45. package/lib/esm/ImageUtil.d.ts.map +1 -1
  46. package/lib/esm/ImageUtil.js +4 -1
  47. package/lib/esm/ImageUtil.js.map +1 -1
  48. package/lib/esm/ViewManager.d.ts +6 -6
  49. package/lib/esm/ViewManager.js +5 -5
  50. package/lib/esm/ViewManager.js.map +1 -1
  51. package/lib/esm/Viewport.d.ts +5 -3
  52. package/lib/esm/Viewport.d.ts.map +1 -1
  53. package/lib/esm/Viewport.js +5 -3
  54. package/lib/esm/Viewport.js.map +1 -1
  55. package/lib/esm/render/RenderSystem.d.ts +1 -0
  56. package/lib/esm/render/RenderSystem.d.ts.map +1 -1
  57. package/lib/esm/render/RenderSystem.js +1 -0
  58. package/lib/esm/render/RenderSystem.js.map +1 -1
  59. package/lib/esm/tile/B3dmReader.js +2 -2
  60. package/lib/esm/tile/B3dmReader.js.map +1 -1
  61. package/lib/esm/tile/DynamicIModelTile.js +1 -1
  62. package/lib/esm/tile/DynamicIModelTile.js.map +1 -1
  63. package/lib/esm/tile/GltfReader.d.ts +129 -36
  64. package/lib/esm/tile/GltfReader.d.ts.map +1 -1
  65. package/lib/esm/tile/GltfReader.js +261 -123
  66. package/lib/esm/tile/GltfReader.js.map +1 -1
  67. package/lib/esm/tile/I3dmReader.js +2 -2
  68. package/lib/esm/tile/I3dmReader.js.map +1 -1
  69. package/lib/esm/tile/IModelTile.js +1 -1
  70. package/lib/esm/tile/IModelTile.js.map +1 -1
  71. package/lib/esm/tile/ImdlReader.d.ts +12 -1
  72. package/lib/esm/tile/ImdlReader.d.ts.map +1 -1
  73. package/lib/esm/tile/ImdlReader.js +45 -2
  74. package/lib/esm/tile/ImdlReader.js.map +1 -1
  75. package/lib/esm/tile/RealityTileLoader.js +1 -1
  76. package/lib/esm/tile/RealityTileLoader.js.map +1 -1
  77. package/lib/esm/tile/map/CesiumTerrainProvider.js +1 -1
  78. package/lib/esm/tile/map/CesiumTerrainProvider.js.map +1 -1
  79. package/lib/esm/tools/Tool.d.ts +29 -1
  80. package/lib/esm/tools/Tool.d.ts.map +1 -1
  81. package/lib/esm/tools/Tool.js +66 -0
  82. package/lib/esm/tools/Tool.js.map +1 -1
  83. package/package.json +22 -22
@@ -186,6 +186,7 @@ export declare type RenderSkyBoxParams = RenderSkyGradientParams | RenderSkySphe
186
186
  /** A RenderSystem provides access to resources used by the internal WebGL-based rendering system.
187
187
  * An application rarely interacts directly with the RenderSystem; instead it interacts with types like [[Viewport]] which
188
188
  * coordinate with the RenderSystem on the application's behalf.
189
+ * @see [Display system overview]($docs/learning/display/index.md)
189
190
  * @see [[IModelApp.renderSystem]].
190
191
  * @public
191
192
  */
@@ -1 +1 @@
1
- {"version":3,"file":"RenderSystem.d.ts","sourceRoot":"","sources":["../../../src/render/RenderSystem.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAA4B,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACxF,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAW,OAAO,EAAE,OAAO,EAAW,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC5H,OAAO,EACL,QAAQ,EAAE,mBAAmB,EAAoB,OAAO,EAAE,QAAQ,EAAE,WAAW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AwB,GAAG,SAAS,CAAsB;IAErF,gBAAgB;IACT,iBAAiB,CAAC,MAAM,EAAE,YAAY,CAAC,UAAU,GAAG,IAAI;IAE/D;;;;;;;;;;;;OAYG;WACiB,kBAAkB,IAAI,OAAO,CAAC,GAAG,CAAC;CAIvD;AAED;;;;;GAKG;AACH,yBAAiB,YAAY,CAAC;IAC5B;;;OAGG;IACH,UAAiB,OAAO;QACtB;;;;;;WAMG;QACH,kBAAkB,CAAC,EAAE,kBAAkB,EAAE,CAAC;QAE1C;;;;;WAKG;QACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;QAEnC;;;;;WAKG;QACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;QAE9B;;;;;WAKG;QACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;QAEjC,oDAAoD;QACpD,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAC5B,oDAAoD;QACpD,sBAAsB,CAAC,EAAE,OAAO,CAAC;QAEjC;;;;;;;;WAQG;QACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAE5B;;;;;;;;;WASG;QACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;QAElC;;;;;;;;WAQG;QACH,WAAW,CAAC,EAAE,OAAO,CAAC;QAEtB;;;;;WAKG;QACH,SAAS,CAAC,EAAE,OAAO,CAAC;QAEpB;;;WAGG;QACH,eAAe,CAAC,EAAE,OAAO,CAAC;QAE1B;;;;;;;;;WASG;QACH,UAAU,CAAC,EAAE,OAAO,CAAC;QAErB;;;WAGG;QACH,iBAAiB,CAAC,EAAE,sBAAsB,CAAC;QAE3C;;;;WAIG;QACH,YAAY,CAAC,EAAE,OAAO,CAAC;QAEvB;;;;WAIG;QACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B;CACF"}
@@ -87,6 +87,7 @@ export class PlanarGridTransparency {
87
87
  /** A RenderSystem provides access to resources used by the internal WebGL-based rendering system.
88
88
  * An application rarely interacts directly with the RenderSystem; instead it interacts with types like [[Viewport]] which
89
89
  * coordinate with the RenderSystem on the application's behalf.
90
+ * @see [Display system overview]($docs/learning/display/index.md)
90
91
  * @see [[IModelApp.renderSystem]].
91
92
  * @public
92
93
  */
@@ -1 +1 @@
1
- {"version":3,"file":"RenderSystem.js","sourceRoot":"","sources":["../../../src/render/RenderSystem.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,wBAAwB,EAA2B,MAAM,qBAAqB,CAAC;AACxF,OAAO,EAAwB,OAAO,EAAE,OAAO,EAAW,OAAO,EAAE,SAAS,EAAmB,MAAM,sBAAsB,CAAC;AAC5H,OAAO,EAC0B,gBAAgB,EAAkC,iBAAiB,EAAE,WAAW,EAAE,iBAAiB,EAClI,wBAAwB,EAAsB,SAAS,EAAE,YAAY,EAAkB,aAAa,GACrG,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAI/C,OAAO,EAAE,aAAa,EAAwB,MAAM,iBAAiB,CAAC;AAGtE,OAAO,EAAE,QAAQ,EAAgB,MAAM,kCAAkC,CAAC;AAI1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAiB,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAIpE,OAAO,EAAmE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEvH,yCAAyC;AACzC,0EAA0E;AAE1E;;GAEG;AACH,MAAM,OAAgB,kBAAkB;CAMvC;AAgBD,gBAAgB;AAChB,MAAM,CAAN,IAAY,iBASX;AATD,WAAY,iBAAiB;IAC3B,8BAA8B;IAC9B,yDAAQ,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AAa,CAAC,KAAwB;QAC3C,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,mDAAmD;IAC5C,2BAA2B,CAAC,KAAuB,EAAE,KAAuB,EAAE,KAAuB,EAAE,KAAuB,EAAE,KAAuB,EAAE,KAAuB,EAAE,OAAyB,EAAE,OAA6B;QAC/O,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,gBAAgB;IACT,aAAa,KAAW,CAAC;IAEhC,gBAAgB;IACT,iBAAiB,CAAC,OAA0B,IAAU,CAAC;IAE9D,gBAAgB;IAChB,IAAW,kBAAkB,KAAc,OAAO,KAAK,KAAK,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC;IAElG;;OAEG;IACH,IAAW,YAAY,KAA2C,OAAO,SAAS,CAAC,CAAC,CAAC;IAErF,gBAAgB;IACT,iBAAiB,CAAC,MAA+B,IAAU,CAAC;IAEnE;;;;;;;;;;;;OAYG;IACI,MAAM,CAAC,KAAK,CAAC,kBAAkB;QACpC,MAAM,GAAG,GAAG,SAAS,CAAC,YAAY,CAAC,kBAAkB,CAAC,kCAAkC,CAAC,CAAC;QAC1F,OAAO,SAAS,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;CACF","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 Rendering\r\n */\r\n\r\nimport { base64StringToUint8Array, Id64String, IDisposable } from \"@itwin/core-bentley\";\r\nimport { ClipVector, Matrix3d, Point2d, Point3d, Range2d, Range3d, Transform, Vector2d, XAndY } from \"@itwin/core-geometry\";\r\nimport {\r\n ColorDef, ElementAlignedBox3d, FeatureIndexType, Frustum, Gradient, ImageBuffer, ImageBufferFormat, ImageSource, ImageSourceFormat,\r\n isValidImageSourceFormat, PackedFeatureTable, QParams3d, QPoint3dList, RenderMaterial, RenderTexture, SkyGradient, TextureProps,\r\n} from \"@itwin/core-common\";\r\nimport { WebGLExtensionName } from \"@itwin/webgl-compatibility\";\r\nimport { imageElementFromImageSource } from \"../ImageUtil\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { MapTileTreeReference, TileTreeReference } from \"../tile/internal\";\r\nimport { ToolAdmin } from \"../tools/ToolAdmin\";\r\nimport { SceneContext } from \"../ViewContext\";\r\nimport { Viewport } from \"../Viewport\";\r\nimport { ViewRect } from \"../ViewRect\";\r\nimport { GraphicBranch, GraphicBranchOptions } from \"./GraphicBranch\";\r\nimport { BatchOptions, CustomGraphicBuilderOptions, GraphicBuilder, GraphicType, ViewportGraphicBuilderOptions } from \"./GraphicBuilder\";\r\nimport { InstancedGraphicParams, PatternGraphicParams } from \"./InstancedGraphicParams\";\r\nimport { MeshArgs, PolylineArgs } from \"./primitives/mesh/MeshPrimitives\";\r\nimport { RealityMeshPrimitive } from \"./primitives/mesh/RealityMeshPrimitive\";\r\nimport { TerrainMeshPrimitive } from \"./primitives/mesh/TerrainMeshPrimitive\";\r\nimport { PointCloudArgs } from \"./primitives/PointCloudPrimitive\";\r\nimport { PointStringParams } from \"./primitives/PointStringParams\";\r\nimport { PolylineParams } from \"./primitives/PolylineParams\";\r\nimport { MeshParams } from \"./primitives/VertexTable\";\r\nimport { RenderClipVolume } from \"./RenderClipVolume\";\r\nimport { RenderGraphic, RenderGraphicOwner } from \"./RenderGraphic\";\r\nimport { RenderMemory } from \"./RenderMemory\";\r\nimport { RenderTarget } from \"./RenderTarget\";\r\nimport { ScreenSpaceEffectBuilder, ScreenSpaceEffectBuilderParams } from \"./ScreenSpaceEffectBuilder\";\r\nimport { CreateTextureArgs, CreateTextureFromSourceArgs, TextureCacheKey, TextureTransparency } from \"./RenderTexture\";\r\n\r\n/* eslint-disable no-restricted-syntax */\r\n// cSpell:ignore deserializing subcat uninstanced wiremesh qorigin trimesh\r\n\r\n/** An opaque representation of a texture draped on geometry within a [[Viewport]].\r\n * @internal\r\n */\r\nexport abstract class RenderTextureDrape implements IDisposable {\r\n public abstract dispose(): void;\r\n\r\n /** @internal */\r\n public abstract collectStatistics(stats: RenderMemory.Statistics): void;\r\n public abstract collectGraphics(context: SceneContext): void;\r\n}\r\n\r\n/** @internal */\r\nexport type TextureDrapeMap = Map<Id64String, RenderTextureDrape>;\r\n\r\n/** Describes a texture loaded from an HTMLImageElement\r\n * ###TODO Replace with TextureImage from RenderTexture.ts after we start returning transparency info from the backend.\r\n * @internal\r\n */\r\nexport interface OldTextureImage {\r\n /** The HTMLImageElement containing the texture's image data */\r\n image: HTMLImageElement;\r\n /** The format of the texture's image data */\r\n format: ImageSourceFormat;\r\n}\r\n\r\n/** @internal */\r\nexport enum RenderDiagnostics {\r\n /** No diagnostics enabled. */\r\n None = 0,\r\n /** Debugging output to browser console enabled. */\r\n DebugOutput = 1 << 1,\r\n /** Potentially expensive checks of WebGL state enabled. */\r\n WebGL = 1 << 2,\r\n /** All diagnostics enabled. */\r\n All = DebugOutput | WebGL,\r\n}\r\n\r\n/** @internal */\r\nexport interface GLTimerResult {\r\n /** Label from GLTimer.beginOperation */\r\n label: string;\r\n /** Time elapsed in nanoseconds, inclusive of child result times.\r\n * @note no-op queries seem to have 32ns of noise.\r\n */\r\n nanoseconds: number;\r\n /** Child results if GLTimer.beginOperation calls were nested */\r\n children?: GLTimerResult[];\r\n}\r\n\r\n/** @internal */\r\nexport type GLTimerResultCallback = (result: GLTimerResult) => void;\r\n\r\n/** Default implementation of RenderGraphicOwner. */\r\nclass GraphicOwner extends RenderGraphicOwner {\r\n public constructor(private readonly _graphic: RenderGraphic) { super(); }\r\n public get graphic(): RenderGraphic { return this._graphic; }\r\n}\r\n\r\n/** An interface optionally exposed by a RenderSystem that allows control of various debugging features.\r\n * @beta\r\n */\r\nexport interface RenderSystemDebugControl {\r\n /** Destroy this system's webgl context. Returns false if this behavior is not supported. */\r\n loseContext(): boolean;\r\n\r\n /** Overrides [[RenderSystem.dpiAwareLOD]].\r\n * @internal\r\n */\r\n dpiAwareLOD: boolean;\r\n\r\n /** Record GPU profiling information for each frame drawn. Check isGLTimerSupported before using.\r\n * @internal\r\n */\r\n resultsCallback?: GLTimerResultCallback;\r\n\r\n /** Returns true if the browser supports GPU profiling queries.\r\n * @internal\r\n */\r\n readonly isGLTimerSupported: boolean;\r\n\r\n /** Attempts to compile all shader programs and returns true if all were successful. May throw exceptions on errors.\r\n * This is useful for debugging shader compilation on specific platforms - especially those which use neither ANGLE nor SwiftShader (e.g., linux, mac, iOS)\r\n * because our unit tests which also compile all shaders run in software mode and therefore may not catch some \"errors\" (especially uniforms that have no effect on\r\n * program output).\r\n * @internal\r\n */\r\n compileAllShaders(): boolean;\r\n\r\n /** Obtain accumulated debug info collected during shader compilation. See `RenderSystem.Options.debugShaders`.\r\n * @internal\r\n */\r\n debugShaderFiles?: DebugShaderFile[];\r\n}\r\n\r\n/** @internal */\r\nexport abstract class RenderRealityMeshGeometry implements IDisposable, RenderMemory.Consumer {\r\n public abstract dispose(): void;\r\n public abstract collectStatistics(stats: RenderMemory.Statistics): void;\r\n}\r\n\r\n/** @internal */\r\nexport class TerrainTexture {\r\n public constructor(\r\n public readonly texture: RenderTexture,\r\n public featureId: number,\r\n public readonly scale: Vector2d,\r\n public readonly translate: Vector2d,\r\n public readonly targetRectangle: Range2d,\r\n public readonly layerIndex: number,\r\n public transparency: number,\r\n public readonly clipRectangle?: Range2d\r\n ) { }\r\n}\r\n\r\n/** @internal */\r\nexport class DebugShaderFile {\r\n public constructor(\r\n public readonly filename: string,\r\n public readonly src: string,\r\n public isVS: boolean,\r\n public isGL: boolean,\r\n public isUsed: boolean\r\n ) { }\r\n}\r\n/** Transparency settings for planar grid display.\r\n * @alpha\r\n */\r\nexport class PlanarGridTransparency {\r\n /** Transparency for the grid plane. This should generally be fairly high to avoid obscuring other geometry */\r\n public readonly planeTransparency = .9;\r\n /** Transparency of the grid lines. This should be higher than the plane, but less than reference line transparency */\r\n public readonly lineTransparency = .75;\r\n /** Transparency of the reference lines. This should be less than plane or line transparency so that reference lines are more prominent */\r\n public readonly refTransparency = .5;\r\n}\r\n\r\n/** Settings for planar grid display.\r\n * @alpha\r\n */\r\nexport interface PlanarGridProps {\r\n /** The grid origin */\r\n origin: Point3d;\r\n /** The grid orientation. The grid X and Y direction are the first and second matrix rows */\r\n rMatrix: Matrix3d;\r\n /** The spacing between grid liens in the X and Y direction */\r\n spacing: XAndY;\r\n /** Grid lines per reference. If zero no reference lines are displayed. */\r\n gridsPerRef: number;\r\n /** Grid color. [[Use Viewport.getContrastToBackgroundColor]] to get best constrast color based on current background. */\r\n color: ColorDef;\r\n /** Transparency settings. If omitted then the [[PlanarGridTransparency]] defaults are used. */\r\n transparency?: PlanarGridTransparency;\r\n}\r\n\r\n/** An opaque representation of geometry allocated by a [[RenderSystem]] to be supplied to [[RenderSystem.createRenderGraphic]].\r\n * @internal\r\n */\r\nexport type RenderGeometry = IDisposable & RenderMemory.Consumer;\r\n\r\n/** An opaque representation of instructions for repeatedly drawing a [[RenderGeometry]] to pattern a planar region, to be supplied to [[RenderSystem.createRenderGraphic]].\r\n * @internal\r\n */\r\nexport type RenderAreaPattern = IDisposable & RenderMemory.Consumer;\r\n\r\n/** @internal */\r\nexport interface RenderSkyGradientParams {\r\n type: \"gradient\";\r\n gradient: SkyGradient;\r\n zOffset: number;\r\n}\r\n\r\n/** @internal */\r\nexport interface RenderSkySphereParams {\r\n type: \"sphere\";\r\n texture: RenderTexture;\r\n rotation: number;\r\n zOffset: number;\r\n}\r\n\r\n/** @internal */\r\nexport interface RenderSkyCubeParams {\r\n type: \"cube\";\r\n texture: RenderTexture;\r\n}\r\n\r\n/** @internal */\r\nexport type RenderSkyBoxParams = RenderSkyGradientParams | RenderSkySphereParams | RenderSkyCubeParams;\r\n\r\n/** A RenderSystem provides access to resources used by the internal WebGL-based rendering system.\r\n * An application rarely interacts directly with the RenderSystem; instead it interacts with types like [[Viewport]] which\r\n * coordinate with the RenderSystem on the application's behalf.\r\n * @see [[IModelApp.renderSystem]].\r\n * @public\r\n */\r\nexport abstract class RenderSystem implements IDisposable {\r\n /** Options used to initialize the RenderSystem. These are primarily used for feature-gating.\r\n * This object is frozen and cannot be modified after the RenderSystem is created.\r\n * @internal\r\n */\r\n public readonly options: RenderSystem.Options;\r\n\r\n /** Antialias samples to use on all subsequently created render targets.\r\n * Default value: undefined (no antialiasing)\r\n * @beta\r\n */\r\n public antialiasSamples?: number;\r\n\r\n /** Initialize the RenderSystem with the specified options.\r\n * @note The RenderSystem takes ownership of the supplied Options and freezes it.\r\n * @internal\r\n */\r\n protected constructor(options?: RenderSystem.Options) {\r\n this.options = undefined !== options ? options : {};\r\n Object.freeze(this.options);\r\n if (undefined !== this.options.disabledExtensions)\r\n Object.freeze(this.options.disabledExtensions);\r\n }\r\n\r\n /** @internal */\r\n public abstract get isValid(): boolean;\r\n\r\n /** @internal */\r\n public abstract dispose(): void;\r\n\r\n /** @internal */\r\n public get maxTextureSize(): number { return 0; }\r\n\r\n /** @internal */\r\n public get supportsInstancing(): boolean { return true; }\r\n\r\n /** @internal */\r\n public get supportsIndexedEdges(): boolean { return true; }\r\n\r\n /** @internal */\r\n public get supportsNonuniformScaledInstancing(): boolean { return true; }\r\n\r\n /** @internal */\r\n public get dpiAwareLOD(): boolean { return true === this.options.dpiAwareLOD; }\r\n\r\n /** @internal */\r\n public get isMobile(): boolean { return false; }\r\n\r\n /** @internal */\r\n public abstract createTarget(canvas: HTMLCanvasElement): RenderTarget;\r\n /** @internal */\r\n public abstract createOffscreenTarget(rect: ViewRect): RenderTarget;\r\n\r\n /** Perform a small unit of idle work and return true if more idle work remains to be done. This function is invoked on each tick of the javascript event loop as long as no viewports are registered with the ViewManager, until it returns false to indicate all idle work has been completed.\r\n * @internal\r\n */\r\n public abstract doIdleWork(): boolean;\r\n\r\n /** Find a previously-created [RenderMaterial]($common) by its ID.\r\n * @param _key The unique ID of the material within the context of the IModelConnection. Typically an element ID.\r\n * @param _imodel The IModelConnection with which the material is associated.\r\n * @returns A previously-created material matching the specified ID, or undefined if no such material exists.\r\n */\r\n public findMaterial(_key: string, _imodel: IModelConnection): RenderMaterial | undefined { return undefined; }\r\n\r\n /** Create a [RenderMaterial]($common) from parameters\r\n * If the parameters include a non-empty key, and no previously-created material already exists with that key, the newly-created material will be cached on the IModelConnection such\r\n * that it can later be retrieved by the same key using [[RenderSystem.findMaterial]].\r\n * @param _params A description of the material's properties.\r\n * @param _imodel The IModelConnection associated with the material.\r\n * @returns the newly-created material, or undefined if the material could not be created or if a material with the same key as that specified in the params already exists.\r\n */\r\n public createMaterial(_params: RenderMaterial.Params, _imodel: IModelConnection): RenderMaterial | undefined { return undefined; }\r\n\r\n /** Creates a [[GraphicBuilder]] for creating a [[RenderGraphic]].\r\n * @param placement The local-to-world transform in which the builder's geometry is to be defined.\r\n * @param type The type of builder to create.\r\n * @param viewport The viewport in which the resultant [[RenderGraphic]] will be rendered.\r\n * @param pickableId If the decoration is to be pickable, a unique identifier to associate with the resultant [[RenderGraphic]].\r\n * @returns A builder for creating a [[RenderGraphic]] of the specified type appropriate for rendering within the specified viewport.\r\n * @see [[IModelConnection.transientIds]] for obtaining an ID for a pickable decoration.\r\n * @see [[RenderContext.createGraphicBuilder]].\r\n * @see [[Decorator]]\r\n */\r\n public createGraphicBuilder(placement: Transform, type: GraphicType, viewport: Viewport, pickableId?: Id64String): GraphicBuilder {\r\n const pickable = undefined !== pickableId ? { id: pickableId } : undefined;\r\n return this.createGraphic({ type, viewport, placement, pickable });\r\n }\r\n\r\n /** Obtain a [[GraphicBuilder]] from which to produce a [[RenderGraphic]].\r\n * @param options Options describing how to create the builder.\r\n * @returns A builder that produces a [[RenderGraphic]].\r\n */\r\n public abstract createGraphic(options: CustomGraphicBuilderOptions | ViewportGraphicBuilderOptions): GraphicBuilder;\r\n\r\n /** Obtain an object capable of producing a custom screen-space effect to be applied to the image rendered by a [[Viewport]].\r\n * @returns undefined if screen-space effects are not supported by this RenderSystem.\r\n */\r\n public createScreenSpaceEffectBuilder(_params: ScreenSpaceEffectBuilderParams): ScreenSpaceEffectBuilder | undefined {\r\n return undefined;\r\n }\r\n\r\n /** @internal */\r\n public createTriMesh(args: MeshArgs, instances?: InstancedGraphicParams | RenderAreaPattern | Point3d): RenderGraphic | undefined {\r\n const params = MeshParams.create(args);\r\n return this.createMesh(params, instances);\r\n }\r\n\r\n /** @internal */\r\n public createIndexedPolylines(args: PolylineArgs, instances?: InstancedGraphicParams | RenderAreaPattern | Point3d): RenderGraphic | undefined {\r\n if (args.flags.isDisjoint) {\r\n const pointStringParams = PointStringParams.create(args);\r\n return undefined !== pointStringParams ? this.createPointString(pointStringParams, instances) : undefined;\r\n } else {\r\n const polylineParams = PolylineParams.create(args);\r\n return undefined !== polylineParams ? this.createPolyline(polylineParams, instances) : undefined;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public createMeshGeometry(_params: MeshParams, _viewIndependentOrigin?: Point3d): RenderGeometry | undefined { return undefined; }\r\n /** @internal */\r\n public createPolylineGeometry(_params: PolylineParams, _viewIndependentOrigin?: Point3d): RenderGeometry | undefined { return undefined; }\r\n /** @internal */\r\n public createPointStringGeometry(_params: PointStringParams, _viewIndependentOrigin?: Point3d): RenderGeometry | undefined { return undefined; }\r\n\r\n /** @internal */\r\n public createAreaPattern(_params: PatternGraphicParams): RenderAreaPattern | undefined { return undefined; }\r\n\r\n /** Create a RenderGraphic from a RenderGeometry produced by this RenderSystem.\r\n * @internal\r\n */\r\n public abstract createRenderGraphic(_geometry: RenderGeometry, instances?: InstancedGraphicParams | RenderAreaPattern): RenderGraphic | undefined;\r\n\r\n private createGraphicFromGeometry(\r\n createGeometry: (viewIndependentOrigin?: Point3d) => RenderGeometry | undefined,\r\n instancesOrOrigin?: InstancedGraphicParams | RenderAreaPattern | Point3d): RenderGraphic | undefined {\r\n let viOrigin;\r\n let instances;\r\n if (instancesOrOrigin instanceof Point3d)\r\n viOrigin = instancesOrOrigin;\r\n else\r\n instances = instancesOrOrigin;\r\n\r\n const geom = createGeometry(viOrigin);\r\n return geom ? this.createRenderGraphic(geom, instances) : undefined;\r\n }\r\n\r\n /** @internal */\r\n public createMesh(params: MeshParams, instances?: InstancedGraphicParams | RenderAreaPattern | Point3d): RenderGraphic | undefined {\r\n return this.createGraphicFromGeometry((viOrigin) => this.createMeshGeometry(params, viOrigin), instances);\r\n }\r\n\r\n /** @internal */\r\n public createPolyline(params: PolylineParams, instances?: InstancedGraphicParams | RenderAreaPattern | Point3d): RenderGraphic | undefined {\r\n return this.createGraphicFromGeometry((origin) => this.createPolylineGeometry(params, origin), instances);\r\n }\r\n\r\n /** @internal */\r\n public createPointString(params: PointStringParams, instances?: InstancedGraphicParams | RenderAreaPattern | Point3d): RenderGraphic | undefined {\r\n return this.createGraphicFromGeometry((origin) => this.createPointStringGeometry(params, origin), instances);\r\n }\r\n\r\n /** @internal */\r\n public createRealityMeshFromTerrain(_terrainMesh: TerrainMeshPrimitive, _transform?: Transform): RenderRealityMeshGeometry | undefined { return undefined; }\r\n /** @internal */\r\n public createRealityMeshGraphic(_terrainGeometry: RenderRealityMeshGeometry, _featureTable: PackedFeatureTable, _tileId: string | undefined, _baseColor: ColorDef | undefined, _baseTransparent: boolean, _textures?: TerrainTexture[]): RenderGraphic | undefined { return undefined; }\r\n /** @internal */\r\n public createRealityMesh(_realityMesh: RealityMeshPrimitive): RenderGraphic | undefined { return undefined; }\r\n /** @internal */\r\n public get maxRealityImageryLayers() { return 0; }\r\n /** @internal */\r\n public createPointCloud(_args: PointCloudArgs, _imodel: IModelConnection): RenderGraphic | undefined { return undefined; }\r\n\r\n /** Create a clip volume to clip geometry.\r\n * @note The clip volume takes ownership of the ClipVector, which must not be subsequently mutated.\r\n * @param _clipVector Defines how the volume clips geometry.\r\n * @returns A clip volume, or undefined if, e.g., the clip vector does not clip anything.\r\n */\r\n public createClipVolume(_clipVector: ClipVector): RenderClipVolume | undefined { return undefined; }\r\n\r\n /** @internal */\r\n public createPlanarGrid(_frustum: Frustum, _grid: PlanarGridProps): RenderGraphic | undefined { return undefined; }\r\n /** @internal */\r\n public createBackgroundMapDrape(_drapedTree: TileTreeReference, _mapTree: MapTileTreeReference): RenderTextureDrape | undefined { return undefined; }\r\n /** @internal */\r\n public createTile(tileTexture: RenderTexture, corners: Point3d[], featureIndex?: number): RenderGraphic | undefined {\r\n const rasterTile = new MeshArgs();\r\n\r\n // corners\r\n // [0] [1]\r\n // [2] [3]\r\n // Quantize the points according to their range\r\n rasterTile.points = new QPoint3dList(QParams3d.fromRange(Range3d.create(...corners)));\r\n for (let i = 0; i < 4; ++i)\r\n rasterTile.points.add(corners[i]);\r\n\r\n // Now remove the translation from the quantized points and put it into a transform instead.\r\n // This prevents graphical artifacts when quantization origin is large relative to quantization scale.\r\n // ###TODO: Would be better not to create a branch for every tile.\r\n const qorigin = rasterTile.points.params.origin;\r\n const transform = Transform.createTranslationXYZ(qorigin.x, qorigin.y, qorigin.z);\r\n qorigin.setZero();\r\n\r\n rasterTile.vertIndices = [0, 1, 2, 2, 1, 3];\r\n rasterTile.textureUv = [\r\n new Point2d(0.0, 0.0),\r\n new Point2d(1.0, 0.0),\r\n new Point2d(0.0, 1.0),\r\n new Point2d(1.0, 1.0),\r\n ];\r\n\r\n rasterTile.texture = tileTexture;\r\n rasterTile.isPlanar = true;\r\n\r\n if (undefined !== featureIndex) {\r\n rasterTile.features.featureID = featureIndex;\r\n rasterTile.features.type = FeatureIndexType.Uniform;\r\n }\r\n\r\n const trimesh = this.createTriMesh(rasterTile);\r\n if (undefined === trimesh)\r\n return undefined;\r\n\r\n const branch = new GraphicBranch(true);\r\n branch.add(trimesh);\r\n return this.createBranch(branch, transform);\r\n }\r\n\r\n /** Create a Graphic for a [[SkyBox]] which encompasses the entire scene, rotating with the camera.\r\n * @internal\r\n */\r\n public createSkyBox(_params: RenderSkyBoxParams): RenderGraphic | undefined { return undefined; }\r\n\r\n /** Create a RenderGraphic consisting of a list of Graphics to be drawn together. */\r\n public abstract createGraphicList(primitives: RenderGraphic[]): RenderGraphic;\r\n\r\n /** Create a RenderGraphic consisting of a list of Graphics, with optional transform and symbology overrides applied to the list */\r\n public createBranch(branch: GraphicBranch, transform: Transform): RenderGraphic {\r\n return this.createGraphicBranch(branch, transform);\r\n }\r\n\r\n /** Create a graphic from a [[GraphicBranch]]. */\r\n public abstract createGraphicBranch(branch: GraphicBranch, transform: Transform, options?: GraphicBranchOptions): RenderGraphic;\r\n\r\n /** Create a node in the scene graph corresponding to a transform node in the scene's schedule script.\r\n * Nodes under this branch will only be drawn if they belong to the specified transform node.\r\n * This allows the graphics in a single Tile to be efficiently drawn with different transforms applied by different nodes.\r\n * The node Id is either the Id of a single transform node in the script, of 0xffffffff to indicate all nodes that have no transform applied to them.\r\n * @internal\r\n */\r\n public createAnimationTransformNode(graphic: RenderGraphic, _nodeId: number): RenderGraphic {\r\n return graphic;\r\n }\r\n\r\n /** Create a RenderGraphic consisting of batched [[Feature]]s.\r\n * @internal\r\n */\r\n public abstract createBatch(graphic: RenderGraphic, features: PackedFeatureTable, range: ElementAlignedBox3d, options?: BatchOptions): RenderGraphic;\r\n\r\n /** Return a Promise which when resolved indicates that all pending external textures have finished loading from the backend. */\r\n public async waitForAllExternalTextures(): Promise<void> { return Promise.resolve(); }\r\n\r\n /** Create a graphic that assumes ownership of another graphic.\r\n * @param ownedGraphic The RenderGraphic to be owned.\r\n * @returns The owning graphic that exposes a `disposeGraphic` method for explicitly disposing of the owned graphic.\r\n * @see [[RenderGraphicOwner]] for details regarding ownership semantics.\r\n * @public\r\n */\r\n public createGraphicOwner(ownedGraphic: RenderGraphic): RenderGraphicOwner { return new GraphicOwner(ownedGraphic); }\r\n\r\n /** Create a \"layer\" containing the graphics belonging to it. A layer has a unique identifier and all of its geometry lies in an XY plane.\r\n * Different layers can be drawn coincident with one another; their draw order can be controlled by a per-layer priority value so that one layer draws\r\n * on top of another. Layers cannot nest inside other layers. Multiple GraphicLayers can exist with the same ID; they are treated as belonging to the same layer.\r\n * A GraphicLayer must be contained (perhaps indirectly) inside a GraphicLayerContainer.\r\n * @see [[createGraphicLayerContainer]]\r\n * @internal\r\n */\r\n public createGraphicLayer(graphic: RenderGraphic, _layerId: string): RenderGraphic { return graphic; }\r\n\r\n /** Create a graphic that can contain [[GraphicLayer]]s.\r\n * @internal\r\n */\r\n public createGraphicLayerContainer(graphic: RenderGraphic, _drawAsOverlay: boolean, _transparency: number, _elevation: number): RenderGraphic { return graphic; }\r\n\r\n /** Find a previously-created [[RenderTexture]] by its key.\r\n * @param _key The unique key of the texture within the context of the IModelConnection. Typically an element Id.\r\n * @param _imodel The IModelConnection with which the texture is associated.\r\n * @returns A previously-created texture matching the specified key, or undefined if no such texture exists.\r\n */\r\n public findTexture(_key: TextureCacheKey, _imodel: IModelConnection): RenderTexture | undefined {\r\n return undefined;\r\n }\r\n\r\n /** Find or create a [[RenderTexture]] from a persistent texture element.\r\n * @param id The ID of the texture element.\r\n * @param iModel The IModel containing the texture element.\r\n * @returns A Promise resolving to the created RenderTexture or to undefined if the texture could not be created.\r\n * @note If the texture is successfully created, it will be cached on the IModelConnection such that it can later be retrieved by its ID using [[RenderSystem.findTexture]].\r\n * @see [[RenderSystem.loadTextureImage]].\r\n * @internal\r\n */\r\n public async loadTexture(id: Id64String, iModel: IModelConnection): Promise<RenderTexture | undefined> {\r\n let texture = this.findTexture(id.toString(), iModel);\r\n if (undefined === texture) {\r\n const image = await this.loadTextureImage(id, iModel);\r\n if (undefined !== image) {\r\n // This will return a pre-existing RenderTexture if somebody else loaded it while we were awaiting the image.\r\n texture = this.createTexture({\r\n type: RenderTexture.Type.Normal,\r\n ownership: { key: id, iModel },\r\n image: {\r\n source: image.image,\r\n transparency: ImageSourceFormat.Png === image.format ? TextureTransparency.Translucent : TextureTransparency.Opaque,\r\n },\r\n });\r\n }\r\n }\r\n\r\n return texture;\r\n }\r\n\r\n /**\r\n * Load a texture image given the ID of a texture element.\r\n * @param id The ID of the texture element.\r\n * @param iModel The IModel containing the texture element.\r\n * @returns A Promise resolving to a TextureImage created from the texture element's data, or to undefined if the TextureImage could not be created.\r\n * @see [[RenderSystem.loadTexture]]\r\n * @internal\r\n */\r\n public async loadTextureImage(id: Id64String, iModel: IModelConnection): Promise<OldTextureImage | undefined> {\r\n const elemProps = await iModel.elements.getProps(id);\r\n if (1 !== elemProps.length)\r\n return undefined;\r\n\r\n const textureProps = elemProps[0] as TextureProps;\r\n if (undefined === textureProps.data || \"string\" !== typeof (textureProps.data) || undefined === textureProps.format || \"number\" !== typeof (textureProps.format))\r\n return undefined;\r\n\r\n const format = textureProps.format;\r\n if (!isValidImageSourceFormat(format))\r\n return undefined;\r\n\r\n const imageSource = new ImageSource(base64StringToUint8Array(textureProps.data), format);\r\n const image = await imageElementFromImageSource(imageSource);\r\n return { image, format };\r\n }\r\n\r\n /** Obtain a texture created from a gradient.\r\n * @param _symb The description of the gradient.\r\n * @param _imodel The IModelConnection with which the texture is associated.\r\n * @returns A texture created from the gradient image, or undefined if the texture could not be created.\r\n * @note If a texture matching the specified gradient is already cached on the iModel, it will be returned.\r\n * Otherwise, if an iModel is supplied, the newly-created texture will be cached on the iModel such that subsequent calls with an equivalent gradient and the\r\n * same iModel will return the cached texture instead of creating a new one.\r\n */\r\n public getGradientTexture(_symb: Gradient.Symb, _imodel?: IModelConnection): RenderTexture | undefined {\r\n return undefined;\r\n }\r\n\r\n /** Create a new texture from an [[ImageBuffer]].\r\n * @deprecated Use [[createTexture]].\r\n */\r\n // eslint-disable-next-line deprecation/deprecation\r\n public createTextureFromImageBuffer(image: ImageBuffer, iModel: IModelConnection, params: RenderTexture.Params): RenderTexture | undefined {\r\n const ownership = params.key ? { key: params.key, iModel } : (params.isOwned ? \"external\" : undefined);\r\n return this.createTexture({\r\n type: params.type,\r\n ownership,\r\n image: {\r\n source: image,\r\n transparency: ImageBufferFormat.Rgba === image.format ? TextureTransparency.Translucent : TextureTransparency.Opaque,\r\n },\r\n });\r\n }\r\n\r\n /** Create a new texture from an HTML image. Typically the image was extracted from a binary representation of a jpeg or png via [[imageElementFromImageSource]].\r\n * @deprecated Use [[createTexture]].\r\n */\r\n // eslint-disable-next-line deprecation/deprecation\r\n public createTextureFromImage(image: HTMLImageElement, hasAlpha: boolean, iModel: IModelConnection | undefined, params: RenderTexture.Params): RenderTexture | undefined {\r\n const ownership = params.key && iModel ? { key: params.key, iModel } : (params.isOwned ? \"external\" : undefined);\r\n return this.createTexture({\r\n type: params.type,\r\n ownership,\r\n image: {\r\n source: image,\r\n transparency: hasAlpha ? TextureTransparency.Translucent : TextureTransparency.Opaque,\r\n },\r\n });\r\n }\r\n\r\n /** Create a new texture from an ImageSource.\r\n * @deprecated Use RenderSystem.createTextureFromSource.\r\n */\r\n // eslint-disable-next-line deprecation/deprecation\r\n public async createTextureFromImageSource(source: ImageSource, iModel: IModelConnection | undefined, params: RenderTexture.Params): Promise<RenderTexture | undefined> {\r\n const ownership = iModel && params.key ? { iModel, key: params.key } : (params.isOwned ? \"external\" : undefined);\r\n return this.createTextureFromSource({\r\n type: params.type,\r\n source,\r\n ownership,\r\n transparency: source.format === ImageSourceFormat.Jpeg ? TextureTransparency.Opaque : TextureTransparency.Translucent,\r\n });\r\n }\r\n\r\n /** Create a texture from an ImageSource. */\r\n public async createTextureFromSource(args: CreateTextureFromSourceArgs): Promise<RenderTexture | undefined> {\r\n try {\r\n // JPEGs don't support transparency.\r\n const transparency = ImageSourceFormat.Jpeg === args.source.format ? TextureTransparency.Opaque : (args.transparency ?? TextureTransparency.Translucent);\r\n const image = await imageElementFromImageSource(args.source);\r\n if (!IModelApp.hasRenderSystem)\r\n return undefined;\r\n\r\n return this.createTexture({\r\n type: args.type,\r\n ownership: args.ownership,\r\n image: {\r\n source: image,\r\n transparency,\r\n },\r\n });\r\n } catch {\r\n return undefined;\r\n }\r\n }\r\n\r\n /** Create a new texture by its element ID. This texture will be retrieved asynchronously from the backend. A placeholder image will be associated with the texture until the requested image data loads. */\r\n // eslint-disable-next-line deprecation/deprecation\r\n public createTextureFromElement(_id: Id64String, _imodel: IModelConnection, _params: RenderTexture.Params, _format: ImageSourceFormat): RenderTexture | undefined {\r\n return undefined;\r\n }\r\n\r\n public createTexture(_args: CreateTextureArgs): RenderTexture | undefined {\r\n return undefined;\r\n }\r\n\r\n /** Create a new texture from a cube of HTML images.\r\n * @internal\r\n */\r\n // eslint-disable-next-line deprecation/deprecation\r\n public createTextureFromCubeImages(_posX: HTMLImageElement, _negX: HTMLImageElement, _posY: HTMLImageElement, _negY: HTMLImageElement, _posZ: HTMLImageElement, _negZ: HTMLImageElement, _imodel: IModelConnection, _params: RenderTexture.Params): RenderTexture | undefined {\r\n return undefined;\r\n }\r\n\r\n /** @internal */\r\n public onInitialized(): void { }\r\n\r\n /** @internal */\r\n public enableDiagnostics(_enable: RenderDiagnostics): void { }\r\n\r\n /** @internal */\r\n public get supportsLogZBuffer(): boolean { return false !== this.options.logarithmicDepthBuffer; }\r\n\r\n /** Obtain an object that can be used to control various debugging features. Returns `undefined` if debugging features are unavailable for this `RenderSystem`.\r\n * @beta\r\n */\r\n public get debugControl(): RenderSystemDebugControl | undefined { return undefined; }\r\n\r\n /** @internal */\r\n public collectStatistics(_stats: RenderMemory.Statistics): void { }\r\n\r\n /** A function that is invoked after the WebGL context is lost. Context loss is almost always caused by excessive consumption of GPU memory.\r\n * After context loss occurs, the RenderSystem will be unable to interact with WebGL by rendering viewports, creating graphics and textures, etc.\r\n * By default, this function invokes [[ToolAdmin.exceptionHandler]] with a brief message describing what occurred.\r\n * An application can override this behavior as follows:\r\n * ```ts\r\n * RenderSystem.contextLossHandler = (): Promise<any> => {\r\n * // your implementation here.\r\n * }\r\n * ```\r\n * @note Context loss is reported by the browser some short time *after* it has occurred. It is not possible to determine the specific cause.\r\n * @see [[TileAdmin.gpuMemoryLimit]] to limit the amount of GPU memory consumed thereby reducing the likelihood of context loss.\r\n * @see [[TileAdmin.totalTileContentBytes]] for the amount of GPU memory allocated for tile graphics.\r\n */\r\n public static async contextLossHandler(): Promise<any> {\r\n const msg = IModelApp.localization.getLocalizedString(\"iModelJs:Errors.WebGLContextLost\");\r\n return ToolAdmin.exceptionHandler(msg);\r\n }\r\n}\r\n\r\n/** A RenderSystem provides access to resources used by the internal WebGL-based rendering system.\r\n * An application rarely interacts directly with the RenderSystem; instead it interacts with types like [[Viewport]] which\r\n * coordinate with the RenderSystem on the application's behalf.\r\n * @see [[IModelApp.renderSystem]].\r\n * @public\r\n */\r\nexport namespace RenderSystem { // eslint-disable-line no-redeclare\r\n /** Options passed to [[IModelApp.supplyRenderSystem]] to configure the [[RenderSystem]] on startup. Many of these options serve as \"feature flags\" used to enable newer, experimental features. As such they typically begin life tagged as \"alpha\" or \"beta\" and are subsequently deprecated when the feature is declared stable.\r\n *\r\n * @public\r\n */\r\n export interface Options {\r\n /** WebGL extensions to be explicitly disabled, regardless of whether or not the WebGL implementation supports them.\r\n * This is chiefly useful for testing code that only executes in the absence of particular extensions, while running on a system that supports those extensions.\r\n *\r\n * Default value: undefined\r\n *\r\n * @public\r\n */\r\n disabledExtensions?: WebGLExtensionName[];\r\n\r\n /** If true, preserve the shader source code as internal strings, useful for debugging purposes.\r\n *\r\n * Default value: false\r\n *\r\n * @public\r\n */\r\n preserveShaderSourceCode?: boolean;\r\n\r\n /** If true, display solar shadows when enabled by [ViewFlags.shadows]($common).\r\n *\r\n * Default value: true\r\n *\r\n * @beta\r\n */\r\n displaySolarShadows?: boolean;\r\n\r\n /** If the view frustum is sufficiently large, and the EXT_frag_depth WebGL extension is available, use a logarithmic depth buffer to improve depth buffer resolution. Framerate may degrade to an extent while the logarithmic depth buffer is in use. If this option is disabled, or the extension is not supported, the near and far planes of very large view frustums will instead be moved to reduce the draw distance.\r\n *\r\n * Default value: true\r\n *\r\n * @public\r\n */\r\n logarithmicDepthBuffer?: boolean;\r\n\r\n /** ###TODO this appears to do nothing. @internal */\r\n filterMapTextures?: boolean;\r\n /** ###TODO this appears to do nothing. @internal */\r\n filterMapDrapeTextures?: boolean;\r\n\r\n /** If true, [[ScreenViewport]]s will respect the DPI of the display. See [[Viewport.devicePixelRatio]] and [[Viewport.cssPixelsToDevicePixels]].\r\n * @see [[dpiAwareLOD]] to control whether device pixel ratio affects the level of detail for tile graphics and decorations.\r\n * @see [[Viewport.cssPixelsToDevicePixels]] to convert CSS pixels to device pixels.\r\n * @see [[Viewport.devicePixelRatio]].\r\n *\r\n * Default value: true\r\n *\r\n * @public\r\n */\r\n dpiAwareViewports?: boolean;\r\n\r\n /** If defined, this will be used as the device pixel ratio instead of the system's actual device pixel ratio.\r\n * This can be helpful for situations like running in the iOS Simulator where forcing a lower resolution by setting a sub-1 device pixel ratio would increase performance.\r\n * @note If this setting is used to decrease the effective device pixel ratio, the view will appear pixelated.\r\n * @note This setting should only be used to increase performance in situations like the iOS Simulator for testing purposes only. It should not be used in a production situation.\r\n * @note This setting has no effect if [[dpiAwareViewports]] is `false`.\r\n *\r\n * Default value: undefined\r\n *\r\n * @public\r\n */\r\n devicePixelRatioOverride?: number;\r\n\r\n /** If true, [[ScreenViewport]]s will take into account the DPI of the display when computing the level of detail for tile graphics and decorations.\r\n * This can result in sharper-looking images on high-DPI devices like mobile phones, but may reduce performance on such devices.\r\n * @note This setting has no effect if [[dpiAwareViewports]] is `false`.\r\n * @see [[Viewport.devicePixelRatio]].\r\n *\r\n * Default value: false\r\n *\r\n * @public\r\n */\r\n dpiAwareLOD?: boolean;\r\n\r\n /** If true will attempt to create a WebGL2 context, falling back to WebGL1 if WebGL2 is not supported.\r\n *\r\n * Default value: true\r\n *\r\n * @public\r\n */\r\n useWebGL2?: boolean;\r\n\r\n /** If true, plan projection models will be rendered using [PlanProjectionSettings]($common) defined by the [[DisplayStyle3dState]].\r\n * Default value: true\r\n * @public\r\n */\r\n planProjections?: boolean;\r\n\r\n /** To help prevent delays when a user interacts with a [[Viewport]], the WebGL render system can precompile shader programs before any Viewport is opened.\r\n * This particularly helps applications when they do not open a Viewport immediately upon startup - for example, if the user is first expected to select an iModel and a view through the user interface.\r\n * Shader precompilation will cease once all shader programs have been compiled, or when a Viewport is opened (registered with the [[ViewManager]]).\r\n * @note Enabling this feature can slow UI interactions before a [[Viewport]] is opened.\r\n * To enable this feature, set this to `true`.\r\n *\r\n * Default value: false\r\n *\r\n * @beta\r\n */\r\n doIdleWork?: boolean;\r\n\r\n /** WebGL context attributes to explicitly set when initializing [[IModelApp.renderSystem]].\r\n * Exposed chiefly for OpenCities Planner.\r\n * @internal\r\n */\r\n contextAttributes?: WebGLContextAttributes;\r\n\r\n /** If true, and the `WEBGL_debug_shaders` extension is available, accumulate debug information during shader compilation.\r\n * This information can be accessed via `RenderSystemDebugControl.debugShaderFiles`.\r\n * Default value: false\r\n * @internal\r\n */\r\n debugShaders?: boolean;\r\n\r\n /** Initial antialias setting\r\n * If > 1, and a WebGL2 context is being used, will turn on antialiasing using that many samples.\r\n * Default value: 1\r\n * @public\r\n */\r\n antialiasSamples?: number;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"RenderSystem.js","sourceRoot":"","sources":["../../../src/render/RenderSystem.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,wBAAwB,EAA2B,MAAM,qBAAqB,CAAC;AACxF,OAAO,EAAwB,OAAO,EAAE,OAAO,EAAW,OAAO,EAAE,SAAS,EAAmB,MAAM,sBAAsB,CAAC;AAC5H,OAAO,EAC0B,gBAAgB,EAAkC,iBAAiB,EAAE,WAAW,EAAE,iBAAiB,EAClI,wBAAwB,EAAsB,SAAS,EAAE,YAAY,EAAkB,aAAa,GACrG,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAI/C,OAAO,EAAE,aAAa,EAAwB,MAAM,i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AAS,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;CACF","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 Rendering\r\n */\r\n\r\nimport { base64StringToUint8Array, Id64String, IDisposable } from \"@itwin/core-bentley\";\r\nimport { ClipVector, Matrix3d, Point2d, Point3d, Range2d, Range3d, Transform, Vector2d, XAndY } from \"@itwin/core-geometry\";\r\nimport {\r\n ColorDef, ElementAlignedBox3d, FeatureIndexType, Frustum, Gradient, ImageBuffer, ImageBufferFormat, ImageSource, ImageSourceFormat,\r\n isValidImageSourceFormat, PackedFeatureTable, QParams3d, QPoint3dList, RenderMaterial, RenderTexture, SkyGradient, TextureProps,\r\n} from \"@itwin/core-common\";\r\nimport { WebGLExtensionName } from \"@itwin/webgl-compatibility\";\r\nimport { imageElementFromImageSource } from \"../ImageUtil\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { MapTileTreeReference, TileTreeReference } from \"../tile/internal\";\r\nimport { ToolAdmin } from \"../tools/ToolAdmin\";\r\nimport { SceneContext } from \"../ViewContext\";\r\nimport { Viewport } from \"../Viewport\";\r\nimport { ViewRect } from \"../ViewRect\";\r\nimport { GraphicBranch, GraphicBranchOptions } from \"./GraphicBranch\";\r\nimport { BatchOptions, CustomGraphicBuilderOptions, GraphicBuilder, GraphicType, ViewportGraphicBuilderOptions } from \"./GraphicBuilder\";\r\nimport { InstancedGraphicParams, PatternGraphicParams } from \"./InstancedGraphicParams\";\r\nimport { MeshArgs, PolylineArgs } from \"./primitives/mesh/MeshPrimitives\";\r\nimport { RealityMeshPrimitive } from \"./primitives/mesh/RealityMeshPrimitive\";\r\nimport { TerrainMeshPrimitive } from \"./primitives/mesh/TerrainMeshPrimitive\";\r\nimport { PointCloudArgs } from \"./primitives/PointCloudPrimitive\";\r\nimport { PointStringParams } from \"./primitives/PointStringParams\";\r\nimport { PolylineParams } from \"./primitives/PolylineParams\";\r\nimport { MeshParams } from \"./primitives/VertexTable\";\r\nimport { RenderClipVolume } from \"./RenderClipVolume\";\r\nimport { RenderGraphic, RenderGraphicOwner } from \"./RenderGraphic\";\r\nimport { RenderMemory } from \"./RenderMemory\";\r\nimport { RenderTarget } from \"./RenderTarget\";\r\nimport { ScreenSpaceEffectBuilder, ScreenSpaceEffectBuilderParams } from \"./ScreenSpaceEffectBuilder\";\r\nimport { CreateTextureArgs, CreateTextureFromSourceArgs, TextureCacheKey, TextureTransparency } from \"./RenderTexture\";\r\n\r\n/* eslint-disable no-restricted-syntax */\r\n// cSpell:ignore deserializing subcat uninstanced wiremesh qorigin trimesh\r\n\r\n/** An opaque representation of a texture draped on geometry within a [[Viewport]].\r\n * @internal\r\n */\r\nexport abstract class RenderTextureDrape implements IDisposable {\r\n public abstract dispose(): void;\r\n\r\n /** @internal */\r\n public abstract collectStatistics(stats: RenderMemory.Statistics): void;\r\n public abstract collectGraphics(context: SceneContext): void;\r\n}\r\n\r\n/** @internal */\r\nexport type TextureDrapeMap = Map<Id64String, RenderTextureDrape>;\r\n\r\n/** Describes a texture loaded from an HTMLImageElement\r\n * ###TODO Replace with TextureImage from RenderTexture.ts after we start returning transparency info from the backend.\r\n * @internal\r\n */\r\nexport interface OldTextureImage {\r\n /** The HTMLImageElement containing the texture's image data */\r\n image: HTMLImageElement;\r\n /** The format of the texture's image data */\r\n format: ImageSourceFormat;\r\n}\r\n\r\n/** @internal */\r\nexport enum RenderDiagnostics {\r\n /** No diagnostics enabled. */\r\n None = 0,\r\n /** Debugging output to browser console enabled. */\r\n DebugOutput = 1 << 1,\r\n /** Potentially expensive checks of WebGL state enabled. */\r\n WebGL = 1 << 2,\r\n /** All diagnostics enabled. */\r\n All = DebugOutput | WebGL,\r\n}\r\n\r\n/** @internal */\r\nexport interface GLTimerResult {\r\n /** Label from GLTimer.beginOperation */\r\n label: string;\r\n /** Time elapsed in nanoseconds, inclusive of child result times.\r\n * @note no-op queries seem to have 32ns of noise.\r\n */\r\n nanoseconds: number;\r\n /** Child results if GLTimer.beginOperation calls were nested */\r\n children?: GLTimerResult[];\r\n}\r\n\r\n/** @internal */\r\nexport type GLTimerResultCallback = (result: GLTimerResult) => void;\r\n\r\n/** Default implementation of RenderGraphicOwner. */\r\nclass GraphicOwner extends RenderGraphicOwner {\r\n public constructor(private readonly _graphic: RenderGraphic) { super(); }\r\n public get graphic(): RenderGraphic { return this._graphic; }\r\n}\r\n\r\n/** An interface optionally exposed by a RenderSystem that allows control of various debugging features.\r\n * @beta\r\n */\r\nexport interface RenderSystemDebugControl {\r\n /** Destroy this system's webgl context. Returns false if this behavior is not supported. */\r\n loseContext(): boolean;\r\n\r\n /** Overrides [[RenderSystem.dpiAwareLOD]].\r\n * @internal\r\n */\r\n dpiAwareLOD: boolean;\r\n\r\n /** Record GPU profiling information for each frame drawn. Check isGLTimerSupported before using.\r\n * @internal\r\n */\r\n resultsCallback?: GLTimerResultCallback;\r\n\r\n /** Returns true if the browser supports GPU profiling queries.\r\n * @internal\r\n */\r\n readonly isGLTimerSupported: boolean;\r\n\r\n /** Attempts to compile all shader programs and returns true if all were successful. May throw exceptions on errors.\r\n * This is useful for debugging shader compilation on specific platforms - especially those which use neither ANGLE nor SwiftShader (e.g., linux, mac, iOS)\r\n * because our unit tests which also compile all shaders run in software mode and therefore may not catch some \"errors\" (especially uniforms that have no effect on\r\n * program output).\r\n * @internal\r\n */\r\n compileAllShaders(): boolean;\r\n\r\n /** Obtain accumulated debug info collected during shader compilation. See `RenderSystem.Options.debugShaders`.\r\n * @internal\r\n */\r\n debugShaderFiles?: DebugShaderFile[];\r\n}\r\n\r\n/** @internal */\r\nexport abstract class RenderRealityMeshGeometry implements IDisposable, RenderMemory.Consumer {\r\n public abstract dispose(): void;\r\n public abstract collectStatistics(stats: RenderMemory.Statistics): void;\r\n}\r\n\r\n/** @internal */\r\nexport class TerrainTexture {\r\n public constructor(\r\n public readonly texture: RenderTexture,\r\n public featureId: number,\r\n public readonly scale: Vector2d,\r\n public readonly translate: Vector2d,\r\n public readonly targetRectangle: Range2d,\r\n public readonly layerIndex: number,\r\n public transparency: number,\r\n public readonly clipRectangle?: Range2d\r\n ) { }\r\n}\r\n\r\n/** @internal */\r\nexport class DebugShaderFile {\r\n public constructor(\r\n public readonly filename: string,\r\n public readonly src: string,\r\n public isVS: boolean,\r\n public isGL: boolean,\r\n public isUsed: boolean\r\n ) { }\r\n}\r\n/** Transparency settings for planar grid display.\r\n * @alpha\r\n */\r\nexport class PlanarGridTransparency {\r\n /** Transparency for the grid plane. This should generally be fairly high to avoid obscuring other geometry */\r\n public readonly planeTransparency = .9;\r\n /** Transparency of the grid lines. This should be higher than the plane, but less than reference line transparency */\r\n public readonly lineTransparency = .75;\r\n /** Transparency of the reference lines. This should be less than plane or line transparency so that reference lines are more prominent */\r\n public readonly refTransparency = .5;\r\n}\r\n\r\n/** Settings for planar grid display.\r\n * @alpha\r\n */\r\nexport interface PlanarGridProps {\r\n /** The grid origin */\r\n origin: Point3d;\r\n /** The grid orientation. The grid X and Y direction are the first and second matrix rows */\r\n rMatrix: Matrix3d;\r\n /** The spacing between grid liens in the X and Y direction */\r\n spacing: XAndY;\r\n /** Grid lines per reference. If zero no reference lines are displayed. */\r\n gridsPerRef: number;\r\n /** Grid color. [[Use Viewport.getContrastToBackgroundColor]] to get best constrast color based on current background. */\r\n color: ColorDef;\r\n /** Transparency settings. If omitted then the [[PlanarGridTransparency]] defaults are used. */\r\n transparency?: PlanarGridTransparency;\r\n}\r\n\r\n/** An opaque representation of geometry allocated by a [[RenderSystem]] to be supplied to [[RenderSystem.createRenderGraphic]].\r\n * @internal\r\n */\r\nexport type RenderGeometry = IDisposable & RenderMemory.Consumer;\r\n\r\n/** An opaque representation of instructions for repeatedly drawing a [[RenderGeometry]] to pattern a planar region, to be supplied to [[RenderSystem.createRenderGraphic]].\r\n * @internal\r\n */\r\nexport type RenderAreaPattern = IDisposable & RenderMemory.Consumer;\r\n\r\n/** @internal */\r\nexport interface RenderSkyGradientParams {\r\n type: \"gradient\";\r\n gradient: SkyGradient;\r\n zOffset: number;\r\n}\r\n\r\n/** @internal */\r\nexport interface RenderSkySphereParams {\r\n type: \"sphere\";\r\n texture: RenderTexture;\r\n rotation: number;\r\n zOffset: number;\r\n}\r\n\r\n/** @internal */\r\nexport interface RenderSkyCubeParams {\r\n type: \"cube\";\r\n texture: RenderTexture;\r\n}\r\n\r\n/** @internal */\r\nexport type RenderSkyBoxParams = RenderSkyGradientParams | RenderSkySphereParams | RenderSkyCubeParams;\r\n\r\n/** A RenderSystem provides access to resources used by the internal WebGL-based rendering system.\r\n * An application rarely interacts directly with the RenderSystem; instead it interacts with types like [[Viewport]] which\r\n * coordinate with the RenderSystem on the application's behalf.\r\n * @see [Display system overview]($docs/learning/display/index.md)\r\n * @see [[IModelApp.renderSystem]].\r\n * @public\r\n */\r\nexport abstract class RenderSystem implements IDisposable {\r\n /** Options used to initialize the RenderSystem. These are primarily used for feature-gating.\r\n * This object is frozen and cannot be modified after the RenderSystem is created.\r\n * @internal\r\n */\r\n public readonly options: RenderSystem.Options;\r\n\r\n /** Antialias samples to use on all subsequently created render targets.\r\n * Default value: undefined (no antialiasing)\r\n * @beta\r\n */\r\n public antialiasSamples?: number;\r\n\r\n /** Initialize the RenderSystem with the specified options.\r\n * @note The RenderSystem takes ownership of the supplied Options and freezes it.\r\n * @internal\r\n */\r\n protected constructor(options?: RenderSystem.Options) {\r\n this.options = undefined !== options ? options : {};\r\n Object.freeze(this.options);\r\n if (undefined !== this.options.disabledExtensions)\r\n Object.freeze(this.options.disabledExtensions);\r\n }\r\n\r\n /** @internal */\r\n public abstract get isValid(): boolean;\r\n\r\n /** @internal */\r\n public abstract dispose(): void;\r\n\r\n /** @internal */\r\n public get maxTextureSize(): number { return 0; }\r\n\r\n /** @internal */\r\n public get supportsInstancing(): boolean { return true; }\r\n\r\n /** @internal */\r\n public get supportsIndexedEdges(): boolean { return true; }\r\n\r\n /** @internal */\r\n public get supportsNonuniformScaledInstancing(): boolean { return true; }\r\n\r\n /** @internal */\r\n public get dpiAwareLOD(): boolean { return true === this.options.dpiAwareLOD; }\r\n\r\n /** @internal */\r\n public get isMobile(): boolean { return false; }\r\n\r\n /** @internal */\r\n public abstract createTarget(canvas: HTMLCanvasElement): RenderTarget;\r\n /** @internal */\r\n public abstract createOffscreenTarget(rect: ViewRect): RenderTarget;\r\n\r\n /** Perform a small unit of idle work and return true if more idle work remains to be done. This function is invoked on each tick of the javascript event loop as long as no viewports are registered with the ViewManager, until it returns false to indicate all idle work has been completed.\r\n * @internal\r\n */\r\n public abstract doIdleWork(): boolean;\r\n\r\n /** Find a previously-created [RenderMaterial]($common) by its ID.\r\n * @param _key The unique ID of the material within the context of the IModelConnection. Typically an element ID.\r\n * @param _imodel The IModelConnection with which the material is associated.\r\n * @returns A previously-created material matching the specified ID, or undefined if no such material exists.\r\n */\r\n public findMaterial(_key: string, _imodel: IModelConnection): RenderMaterial | undefined { return undefined; }\r\n\r\n /** Create a [RenderMaterial]($common) from parameters\r\n * If the parameters include a non-empty key, and no previously-created material already exists with that key, the newly-created material will be cached on the IModelConnection such\r\n * that it can later be retrieved by the same key using [[RenderSystem.findMaterial]].\r\n * @param _params A description of the material's properties.\r\n * @param _imodel The IModelConnection associated with the material.\r\n * @returns the newly-created material, or undefined if the material could not be created or if a material with the same key as that specified in the params already exists.\r\n */\r\n public createMaterial(_params: RenderMaterial.Params, _imodel: IModelConnection): RenderMaterial | undefined { return undefined; }\r\n\r\n /** Creates a [[GraphicBuilder]] for creating a [[RenderGraphic]].\r\n * @param placement The local-to-world transform in which the builder's geometry is to be defined.\r\n * @param type The type of builder to create.\r\n * @param viewport The viewport in which the resultant [[RenderGraphic]] will be rendered.\r\n * @param pickableId If the decoration is to be pickable, a unique identifier to associate with the resultant [[RenderGraphic]].\r\n * @returns A builder for creating a [[RenderGraphic]] of the specified type appropriate for rendering within the specified viewport.\r\n * @see [[IModelConnection.transientIds]] for obtaining an ID for a pickable decoration.\r\n * @see [[RenderContext.createGraphicBuilder]].\r\n * @see [[Decorator]]\r\n */\r\n public createGraphicBuilder(placement: Transform, type: GraphicType, viewport: Viewport, pickableId?: Id64String): GraphicBuilder {\r\n const pickable = undefined !== pickableId ? { id: pickableId } : undefined;\r\n return this.createGraphic({ type, viewport, placement, pickable });\r\n }\r\n\r\n /** Obtain a [[GraphicBuilder]] from which to produce a [[RenderGraphic]].\r\n * @param options Options describing how to create the builder.\r\n * @returns A builder that produces a [[RenderGraphic]].\r\n */\r\n public abstract createGraphic(options: CustomGraphicBuilderOptions | ViewportGraphicBuilderOptions): GraphicBuilder;\r\n\r\n /** Obtain an object capable of producing a custom screen-space effect to be applied to the image rendered by a [[Viewport]].\r\n * @returns undefined if screen-space effects are not supported by this RenderSystem.\r\n */\r\n public createScreenSpaceEffectBuilder(_params: ScreenSpaceEffectBuilderParams): ScreenSpaceEffectBuilder | undefined {\r\n return undefined;\r\n }\r\n\r\n /** @internal */\r\n public createTriMesh(args: MeshArgs, instances?: InstancedGraphicParams | RenderAreaPattern | Point3d): RenderGraphic | undefined {\r\n const params = MeshParams.create(args);\r\n return this.createMesh(params, instances);\r\n }\r\n\r\n /** @internal */\r\n public createIndexedPolylines(args: PolylineArgs, instances?: InstancedGraphicParams | RenderAreaPattern | Point3d): RenderGraphic | undefined {\r\n if (args.flags.isDisjoint) {\r\n const pointStringParams = PointStringParams.create(args);\r\n return undefined !== pointStringParams ? this.createPointString(pointStringParams, instances) : undefined;\r\n } else {\r\n const polylineParams = PolylineParams.create(args);\r\n return undefined !== polylineParams ? this.createPolyline(polylineParams, instances) : undefined;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public createMeshGeometry(_params: MeshParams, _viewIndependentOrigin?: Point3d): RenderGeometry | undefined { return undefined; }\r\n /** @internal */\r\n public createPolylineGeometry(_params: PolylineParams, _viewIndependentOrigin?: Point3d): RenderGeometry | undefined { return undefined; }\r\n /** @internal */\r\n public createPointStringGeometry(_params: PointStringParams, _viewIndependentOrigin?: Point3d): RenderGeometry | undefined { return undefined; }\r\n\r\n /** @internal */\r\n public createAreaPattern(_params: PatternGraphicParams): RenderAreaPattern | undefined { return undefined; }\r\n\r\n /** Create a RenderGraphic from a RenderGeometry produced by this RenderSystem.\r\n * @internal\r\n */\r\n public abstract createRenderGraphic(_geometry: RenderGeometry, instances?: InstancedGraphicParams | RenderAreaPattern): RenderGraphic | undefined;\r\n\r\n private createGraphicFromGeometry(\r\n createGeometry: (viewIndependentOrigin?: Point3d) => RenderGeometry | undefined,\r\n instancesOrOrigin?: InstancedGraphicParams | RenderAreaPattern | Point3d): RenderGraphic | undefined {\r\n let viOrigin;\r\n let instances;\r\n if (instancesOrOrigin instanceof Point3d)\r\n viOrigin = instancesOrOrigin;\r\n else\r\n instances = instancesOrOrigin;\r\n\r\n const geom = createGeometry(viOrigin);\r\n return geom ? this.createRenderGraphic(geom, instances) : undefined;\r\n }\r\n\r\n /** @internal */\r\n public createMesh(params: MeshParams, instances?: InstancedGraphicParams | RenderAreaPattern | Point3d): RenderGraphic | undefined {\r\n return this.createGraphicFromGeometry((viOrigin) => this.createMeshGeometry(params, viOrigin), instances);\r\n }\r\n\r\n /** @internal */\r\n public createPolyline(params: PolylineParams, instances?: InstancedGraphicParams | RenderAreaPattern | Point3d): RenderGraphic | undefined {\r\n return this.createGraphicFromGeometry((origin) => this.createPolylineGeometry(params, origin), instances);\r\n }\r\n\r\n /** @internal */\r\n public createPointString(params: PointStringParams, instances?: InstancedGraphicParams | RenderAreaPattern | Point3d): RenderGraphic | undefined {\r\n return this.createGraphicFromGeometry((origin) => this.createPointStringGeometry(params, origin), instances);\r\n }\r\n\r\n /** @internal */\r\n public createRealityMeshFromTerrain(_terrainMesh: TerrainMeshPrimitive, _transform?: Transform): RenderRealityMeshGeometry | undefined { return undefined; }\r\n /** @internal */\r\n public createRealityMeshGraphic(_terrainGeometry: RenderRealityMeshGeometry, _featureTable: PackedFeatureTable, _tileId: string | undefined, _baseColor: ColorDef | undefined, _baseTransparent: boolean, _textures?: TerrainTexture[]): RenderGraphic | undefined { return undefined; }\r\n /** @internal */\r\n public createRealityMesh(_realityMesh: RealityMeshPrimitive): RenderGraphic | undefined { return undefined; }\r\n /** @internal */\r\n public get maxRealityImageryLayers() { return 0; }\r\n /** @internal */\r\n public createPointCloud(_args: PointCloudArgs, _imodel: IModelConnection): RenderGraphic | undefined { return undefined; }\r\n\r\n /** Create a clip volume to clip geometry.\r\n * @note The clip volume takes ownership of the ClipVector, which must not be subsequently mutated.\r\n * @param _clipVector Defines how the volume clips geometry.\r\n * @returns A clip volume, or undefined if, e.g., the clip vector does not clip anything.\r\n */\r\n public createClipVolume(_clipVector: ClipVector): RenderClipVolume | undefined { return undefined; }\r\n\r\n /** @internal */\r\n public createPlanarGrid(_frustum: Frustum, _grid: PlanarGridProps): RenderGraphic | undefined { return undefined; }\r\n /** @internal */\r\n public createBackgroundMapDrape(_drapedTree: TileTreeReference, _mapTree: MapTileTreeReference): RenderTextureDrape | undefined { return undefined; }\r\n /** @internal */\r\n public createTile(tileTexture: RenderTexture, corners: Point3d[], featureIndex?: number): RenderGraphic | undefined {\r\n const rasterTile = new MeshArgs();\r\n\r\n // corners\r\n // [0] [1]\r\n // [2] [3]\r\n // Quantize the points according to their range\r\n rasterTile.points = new QPoint3dList(QParams3d.fromRange(Range3d.create(...corners)));\r\n for (let i = 0; i < 4; ++i)\r\n rasterTile.points.add(corners[i]);\r\n\r\n // Now remove the translation from the quantized points and put it into a transform instead.\r\n // This prevents graphical artifacts when quantization origin is large relative to quantization scale.\r\n // ###TODO: Would be better not to create a branch for every tile.\r\n const qorigin = rasterTile.points.params.origin;\r\n const transform = Transform.createTranslationXYZ(qorigin.x, qorigin.y, qorigin.z);\r\n qorigin.setZero();\r\n\r\n rasterTile.vertIndices = [0, 1, 2, 2, 1, 3];\r\n rasterTile.textureUv = [\r\n new Point2d(0.0, 0.0),\r\n new Point2d(1.0, 0.0),\r\n new Point2d(0.0, 1.0),\r\n new Point2d(1.0, 1.0),\r\n ];\r\n\r\n rasterTile.texture = tileTexture;\r\n rasterTile.isPlanar = true;\r\n\r\n if (undefined !== featureIndex) {\r\n rasterTile.features.featureID = featureIndex;\r\n rasterTile.features.type = FeatureIndexType.Uniform;\r\n }\r\n\r\n const trimesh = this.createTriMesh(rasterTile);\r\n if (undefined === trimesh)\r\n return undefined;\r\n\r\n const branch = new GraphicBranch(true);\r\n branch.add(trimesh);\r\n return this.createBranch(branch, transform);\r\n }\r\n\r\n /** Create a Graphic for a [[SkyBox]] which encompasses the entire scene, rotating with the camera.\r\n * @internal\r\n */\r\n public createSkyBox(_params: RenderSkyBoxParams): RenderGraphic | undefined { return undefined; }\r\n\r\n /** Create a RenderGraphic consisting of a list of Graphics to be drawn together. */\r\n public abstract createGraphicList(primitives: RenderGraphic[]): RenderGraphic;\r\n\r\n /** Create a RenderGraphic consisting of a list of Graphics, with optional transform and symbology overrides applied to the list */\r\n public createBranch(branch: GraphicBranch, transform: Transform): RenderGraphic {\r\n return this.createGraphicBranch(branch, transform);\r\n }\r\n\r\n /** Create a graphic from a [[GraphicBranch]]. */\r\n public abstract createGraphicBranch(branch: GraphicBranch, transform: Transform, options?: GraphicBranchOptions): RenderGraphic;\r\n\r\n /** Create a node in the scene graph corresponding to a transform node in the scene's schedule script.\r\n * Nodes under this branch will only be drawn if they belong to the specified transform node.\r\n * This allows the graphics in a single Tile to be efficiently drawn with different transforms applied by different nodes.\r\n * The node Id is either the Id of a single transform node in the script, of 0xffffffff to indicate all nodes that have no transform applied to them.\r\n * @internal\r\n */\r\n public createAnimationTransformNode(graphic: RenderGraphic, _nodeId: number): RenderGraphic {\r\n return graphic;\r\n }\r\n\r\n /** Create a RenderGraphic consisting of batched [[Feature]]s.\r\n * @internal\r\n */\r\n public abstract createBatch(graphic: RenderGraphic, features: PackedFeatureTable, range: ElementAlignedBox3d, options?: BatchOptions): RenderGraphic;\r\n\r\n /** Return a Promise which when resolved indicates that all pending external textures have finished loading from the backend. */\r\n public async waitForAllExternalTextures(): Promise<void> { return Promise.resolve(); }\r\n\r\n /** Create a graphic that assumes ownership of another graphic.\r\n * @param ownedGraphic The RenderGraphic to be owned.\r\n * @returns The owning graphic that exposes a `disposeGraphic` method for explicitly disposing of the owned graphic.\r\n * @see [[RenderGraphicOwner]] for details regarding ownership semantics.\r\n * @public\r\n */\r\n public createGraphicOwner(ownedGraphic: RenderGraphic): RenderGraphicOwner { return new GraphicOwner(ownedGraphic); }\r\n\r\n /** Create a \"layer\" containing the graphics belonging to it. A layer has a unique identifier and all of its geometry lies in an XY plane.\r\n * Different layers can be drawn coincident with one another; their draw order can be controlled by a per-layer priority value so that one layer draws\r\n * on top of another. Layers cannot nest inside other layers. Multiple GraphicLayers can exist with the same ID; they are treated as belonging to the same layer.\r\n * A GraphicLayer must be contained (perhaps indirectly) inside a GraphicLayerContainer.\r\n * @see [[createGraphicLayerContainer]]\r\n * @internal\r\n */\r\n public createGraphicLayer(graphic: RenderGraphic, _layerId: string): RenderGraphic { return graphic; }\r\n\r\n /** Create a graphic that can contain [[GraphicLayer]]s.\r\n * @internal\r\n */\r\n public createGraphicLayerContainer(graphic: RenderGraphic, _drawAsOverlay: boolean, _transparency: number, _elevation: number): RenderGraphic { return graphic; }\r\n\r\n /** Find a previously-created [[RenderTexture]] by its key.\r\n * @param _key The unique key of the texture within the context of the IModelConnection. Typically an element Id.\r\n * @param _imodel The IModelConnection with which the texture is associated.\r\n * @returns A previously-created texture matching the specified key, or undefined if no such texture exists.\r\n */\r\n public findTexture(_key: TextureCacheKey, _imodel: IModelConnection): RenderTexture | undefined {\r\n return undefined;\r\n }\r\n\r\n /** Find or create a [[RenderTexture]] from a persistent texture element.\r\n * @param id The ID of the texture element.\r\n * @param iModel The IModel containing the texture element.\r\n * @returns A Promise resolving to the created RenderTexture or to undefined if the texture could not be created.\r\n * @note If the texture is successfully created, it will be cached on the IModelConnection such that it can later be retrieved by its ID using [[RenderSystem.findTexture]].\r\n * @see [[RenderSystem.loadTextureImage]].\r\n * @internal\r\n */\r\n public async loadTexture(id: Id64String, iModel: IModelConnection): Promise<RenderTexture | undefined> {\r\n let texture = this.findTexture(id.toString(), iModel);\r\n if (undefined === texture) {\r\n const image = await this.loadTextureImage(id, iModel);\r\n if (undefined !== image) {\r\n // This will return a pre-existing RenderTexture if somebody else loaded it while we were awaiting the image.\r\n texture = this.createTexture({\r\n type: RenderTexture.Type.Normal,\r\n ownership: { key: id, iModel },\r\n image: {\r\n source: image.image,\r\n transparency: ImageSourceFormat.Png === image.format ? TextureTransparency.Translucent : TextureTransparency.Opaque,\r\n },\r\n });\r\n }\r\n }\r\n\r\n return texture;\r\n }\r\n\r\n /**\r\n * Load a texture image given the ID of a texture element.\r\n * @param id The ID of the texture element.\r\n * @param iModel The IModel containing the texture element.\r\n * @returns A Promise resolving to a TextureImage created from the texture element's data, or to undefined if the TextureImage could not be created.\r\n * @see [[RenderSystem.loadTexture]]\r\n * @internal\r\n */\r\n public async loadTextureImage(id: Id64String, iModel: IModelConnection): Promise<OldTextureImage | undefined> {\r\n const elemProps = await iModel.elements.getProps(id);\r\n if (1 !== elemProps.length)\r\n return undefined;\r\n\r\n const textureProps = elemProps[0] as TextureProps;\r\n if (undefined === textureProps.data || \"string\" !== typeof (textureProps.data) || undefined === textureProps.format || \"number\" !== typeof (textureProps.format))\r\n return undefined;\r\n\r\n const format = textureProps.format;\r\n if (!isValidImageSourceFormat(format))\r\n return undefined;\r\n\r\n const imageSource = new ImageSource(base64StringToUint8Array(textureProps.data), format);\r\n const image = await imageElementFromImageSource(imageSource);\r\n return { image, format };\r\n }\r\n\r\n /** Obtain a texture created from a gradient.\r\n * @param _symb The description of the gradient.\r\n * @param _imodel The IModelConnection with which the texture is associated.\r\n * @returns A texture created from the gradient image, or undefined if the texture could not be created.\r\n * @note If a texture matching the specified gradient is already cached on the iModel, it will be returned.\r\n * Otherwise, if an iModel is supplied, the newly-created texture will be cached on the iModel such that subsequent calls with an equivalent gradient and the\r\n * same iModel will return the cached texture instead of creating a new one.\r\n */\r\n public getGradientTexture(_symb: Gradient.Symb, _imodel?: IModelConnection): RenderTexture | undefined {\r\n return undefined;\r\n }\r\n\r\n /** Create a new texture from an [[ImageBuffer]].\r\n * @deprecated Use [[createTexture]].\r\n */\r\n // eslint-disable-next-line deprecation/deprecation\r\n public createTextureFromImageBuffer(image: ImageBuffer, iModel: IModelConnection, params: RenderTexture.Params): RenderTexture | undefined {\r\n const ownership = params.key ? { key: params.key, iModel } : (params.isOwned ? \"external\" : undefined);\r\n return this.createTexture({\r\n type: params.type,\r\n ownership,\r\n image: {\r\n source: image,\r\n transparency: ImageBufferFormat.Rgba === image.format ? TextureTransparency.Translucent : TextureTransparency.Opaque,\r\n },\r\n });\r\n }\r\n\r\n /** Create a new texture from an HTML image. Typically the image was extracted from a binary representation of a jpeg or png via [[imageElementFromImageSource]].\r\n * @deprecated Use [[createTexture]].\r\n */\r\n // eslint-disable-next-line deprecation/deprecation\r\n public createTextureFromImage(image: HTMLImageElement, hasAlpha: boolean, iModel: IModelConnection | undefined, params: RenderTexture.Params): RenderTexture | undefined {\r\n const ownership = params.key && iModel ? { key: params.key, iModel } : (params.isOwned ? \"external\" : undefined);\r\n return this.createTexture({\r\n type: params.type,\r\n ownership,\r\n image: {\r\n source: image,\r\n transparency: hasAlpha ? TextureTransparency.Translucent : TextureTransparency.Opaque,\r\n },\r\n });\r\n }\r\n\r\n /** Create a new texture from an ImageSource.\r\n * @deprecated Use RenderSystem.createTextureFromSource.\r\n */\r\n // eslint-disable-next-line deprecation/deprecation\r\n public async createTextureFromImageSource(source: ImageSource, iModel: IModelConnection | undefined, params: RenderTexture.Params): Promise<RenderTexture | undefined> {\r\n const ownership = iModel && params.key ? { iModel, key: params.key } : (params.isOwned ? \"external\" : undefined);\r\n return this.createTextureFromSource({\r\n type: params.type,\r\n source,\r\n ownership,\r\n transparency: source.format === ImageSourceFormat.Jpeg ? TextureTransparency.Opaque : TextureTransparency.Translucent,\r\n });\r\n }\r\n\r\n /** Create a texture from an ImageSource. */\r\n public async createTextureFromSource(args: CreateTextureFromSourceArgs): Promise<RenderTexture | undefined> {\r\n try {\r\n // JPEGs don't support transparency.\r\n const transparency = ImageSourceFormat.Jpeg === args.source.format ? TextureTransparency.Opaque : (args.transparency ?? TextureTransparency.Translucent);\r\n const image = await imageElementFromImageSource(args.source);\r\n if (!IModelApp.hasRenderSystem)\r\n return undefined;\r\n\r\n return this.createTexture({\r\n type: args.type,\r\n ownership: args.ownership,\r\n image: {\r\n source: image,\r\n transparency,\r\n },\r\n });\r\n } catch {\r\n return undefined;\r\n }\r\n }\r\n\r\n /** Create a new texture by its element ID. This texture will be retrieved asynchronously from the backend. A placeholder image will be associated with the texture until the requested image data loads. */\r\n // eslint-disable-next-line deprecation/deprecation\r\n public createTextureFromElement(_id: Id64String, _imodel: IModelConnection, _params: RenderTexture.Params, _format: ImageSourceFormat): RenderTexture | undefined {\r\n return undefined;\r\n }\r\n\r\n public createTexture(_args: CreateTextureArgs): RenderTexture | undefined {\r\n return undefined;\r\n }\r\n\r\n /** Create a new texture from a cube of HTML images.\r\n * @internal\r\n */\r\n // eslint-disable-next-line deprecation/deprecation\r\n public createTextureFromCubeImages(_posX: HTMLImageElement, _negX: HTMLImageElement, _posY: HTMLImageElement, _negY: HTMLImageElement, _posZ: HTMLImageElement, _negZ: HTMLImageElement, _imodel: IModelConnection, _params: RenderTexture.Params): RenderTexture | undefined {\r\n return undefined;\r\n }\r\n\r\n /** @internal */\r\n public onInitialized(): void { }\r\n\r\n /** @internal */\r\n public enableDiagnostics(_enable: RenderDiagnostics): void { }\r\n\r\n /** @internal */\r\n public get supportsLogZBuffer(): boolean { return false !== this.options.logarithmicDepthBuffer; }\r\n\r\n /** Obtain an object that can be used to control various debugging features. Returns `undefined` if debugging features are unavailable for this `RenderSystem`.\r\n * @beta\r\n */\r\n public get debugControl(): RenderSystemDebugControl | undefined { return undefined; }\r\n\r\n /** @internal */\r\n public collectStatistics(_stats: RenderMemory.Statistics): void { }\r\n\r\n /** A function that is invoked after the WebGL context is lost. Context loss is almost always caused by excessive consumption of GPU memory.\r\n * After context loss occurs, the RenderSystem will be unable to interact with WebGL by rendering viewports, creating graphics and textures, etc.\r\n * By default, this function invokes [[ToolAdmin.exceptionHandler]] with a brief message describing what occurred.\r\n * An application can override this behavior as follows:\r\n * ```ts\r\n * RenderSystem.contextLossHandler = (): Promise<any> => {\r\n * // your implementation here.\r\n * }\r\n * ```\r\n * @note Context loss is reported by the browser some short time *after* it has occurred. It is not possible to determine the specific cause.\r\n * @see [[TileAdmin.gpuMemoryLimit]] to limit the amount of GPU memory consumed thereby reducing the likelihood of context loss.\r\n * @see [[TileAdmin.totalTileContentBytes]] for the amount of GPU memory allocated for tile graphics.\r\n */\r\n public static async contextLossHandler(): Promise<any> {\r\n const msg = IModelApp.localization.getLocalizedString(\"iModelJs:Errors.WebGLContextLost\");\r\n return ToolAdmin.exceptionHandler(msg);\r\n }\r\n}\r\n\r\n/** A RenderSystem provides access to resources used by the internal WebGL-based rendering system.\r\n * An application rarely interacts directly with the RenderSystem; instead it interacts with types like [[Viewport]] which\r\n * coordinate with the RenderSystem on the application's behalf.\r\n * @see [[IModelApp.renderSystem]].\r\n * @public\r\n */\r\nexport namespace RenderSystem { // eslint-disable-line no-redeclare\r\n /** Options passed to [[IModelApp.supplyRenderSystem]] to configure the [[RenderSystem]] on startup. Many of these options serve as \"feature flags\" used to enable newer, experimental features. As such they typically begin life tagged as \"alpha\" or \"beta\" and are subsequently deprecated when the feature is declared stable.\r\n *\r\n * @public\r\n */\r\n export interface Options {\r\n /** WebGL extensions to be explicitly disabled, regardless of whether or not the WebGL implementation supports them.\r\n * This is chiefly useful for testing code that only executes in the absence of particular extensions, while running on a system that supports those extensions.\r\n *\r\n * Default value: undefined\r\n *\r\n * @public\r\n */\r\n disabledExtensions?: WebGLExtensionName[];\r\n\r\n /** If true, preserve the shader source code as internal strings, useful for debugging purposes.\r\n *\r\n * Default value: false\r\n *\r\n * @public\r\n */\r\n preserveShaderSourceCode?: boolean;\r\n\r\n /** If true, display solar shadows when enabled by [ViewFlags.shadows]($common).\r\n *\r\n * Default value: true\r\n *\r\n * @beta\r\n */\r\n displaySolarShadows?: boolean;\r\n\r\n /** If the view frustum is sufficiently large, and the EXT_frag_depth WebGL extension is available, use a logarithmic depth buffer to improve depth buffer resolution. Framerate may degrade to an extent while the logarithmic depth buffer is in use. If this option is disabled, or the extension is not supported, the near and far planes of very large view frustums will instead be moved to reduce the draw distance.\r\n *\r\n * Default value: true\r\n *\r\n * @public\r\n */\r\n logarithmicDepthBuffer?: boolean;\r\n\r\n /** ###TODO this appears to do nothing. @internal */\r\n filterMapTextures?: boolean;\r\n /** ###TODO this appears to do nothing. @internal */\r\n filterMapDrapeTextures?: boolean;\r\n\r\n /** If true, [[ScreenViewport]]s will respect the DPI of the display. See [[Viewport.devicePixelRatio]] and [[Viewport.cssPixelsToDevicePixels]].\r\n * @see [[dpiAwareLOD]] to control whether device pixel ratio affects the level of detail for tile graphics and decorations.\r\n * @see [[Viewport.cssPixelsToDevicePixels]] to convert CSS pixels to device pixels.\r\n * @see [[Viewport.devicePixelRatio]].\r\n *\r\n * Default value: true\r\n *\r\n * @public\r\n */\r\n dpiAwareViewports?: boolean;\r\n\r\n /** If defined, this will be used as the device pixel ratio instead of the system's actual device pixel ratio.\r\n * This can be helpful for situations like running in the iOS Simulator where forcing a lower resolution by setting a sub-1 device pixel ratio would increase performance.\r\n * @note If this setting is used to decrease the effective device pixel ratio, the view will appear pixelated.\r\n * @note This setting should only be used to increase performance in situations like the iOS Simulator for testing purposes only. It should not be used in a production situation.\r\n * @note This setting has no effect if [[dpiAwareViewports]] is `false`.\r\n *\r\n * Default value: undefined\r\n *\r\n * @public\r\n */\r\n devicePixelRatioOverride?: number;\r\n\r\n /** If true, [[ScreenViewport]]s will take into account the DPI of the display when computing the level of detail for tile graphics and decorations.\r\n * This can result in sharper-looking images on high-DPI devices like mobile phones, but may reduce performance on such devices.\r\n * @note This setting has no effect if [[dpiAwareViewports]] is `false`.\r\n * @see [[Viewport.devicePixelRatio]].\r\n *\r\n * Default value: false\r\n *\r\n * @public\r\n */\r\n dpiAwareLOD?: boolean;\r\n\r\n /** If true will attempt to create a WebGL2 context, falling back to WebGL1 if WebGL2 is not supported.\r\n *\r\n * Default value: true\r\n *\r\n * @public\r\n */\r\n useWebGL2?: boolean;\r\n\r\n /** If true, plan projection models will be rendered using [PlanProjectionSettings]($common) defined by the [[DisplayStyle3dState]].\r\n * Default value: true\r\n * @public\r\n */\r\n planProjections?: boolean;\r\n\r\n /** To help prevent delays when a user interacts with a [[Viewport]], the WebGL render system can precompile shader programs before any Viewport is opened.\r\n * This particularly helps applications when they do not open a Viewport immediately upon startup - for example, if the user is first expected to select an iModel and a view through the user interface.\r\n * Shader precompilation will cease once all shader programs have been compiled, or when a Viewport is opened (registered with the [[ViewManager]]).\r\n * @note Enabling this feature can slow UI interactions before a [[Viewport]] is opened.\r\n * To enable this feature, set this to `true`.\r\n *\r\n * Default value: false\r\n *\r\n * @beta\r\n */\r\n doIdleWork?: boolean;\r\n\r\n /** WebGL context attributes to explicitly set when initializing [[IModelApp.renderSystem]].\r\n * Exposed chiefly for OpenCities Planner.\r\n * @internal\r\n */\r\n contextAttributes?: WebGLContextAttributes;\r\n\r\n /** If true, and the `WEBGL_debug_shaders` extension is available, accumulate debug information during shader compilation.\r\n * This information can be accessed via `RenderSystemDebugControl.debugShaderFiles`.\r\n * Default value: false\r\n * @internal\r\n */\r\n debugShaders?: boolean;\r\n\r\n /** Initial antialias setting\r\n * If > 1, and a WebGL2 context is being used, will turn on antialiasing using that many samples.\r\n * Default value: 1\r\n * @public\r\n */\r\n antialiasSamples?: number;\r\n }\r\n}\r\n"]}
@@ -50,7 +50,7 @@ export class B3dmReader extends GltfReader {
50
50
  }
51
51
  if (undefined !== returnToCenterTransform)
52
52
  transformToRoot = transformToRoot ? transformToRoot.multiplyTransformTransform(returnToCenterTransform) : returnToCenterTransform;
53
- const props = GltfReaderProps.create(stream, yAxisUp);
53
+ const props = GltfReaderProps.create(stream.nextBytes(header.length - stream.curPos), yAxisUp);
54
54
  const batchTableLength = header.featureTableJson ? JsonUtils.asInt(header.featureTableJson.BATCH_LENGTH, 0) : 0;
55
55
  return undefined !== props ? new B3dmReader(props, iModel, modelId, is3d, system, range, isLeaf, batchTableLength, transformToRoot, header.batchTableJson, isCanceled, idMap, pseudoRtcBias, deduplicateVertices) : undefined;
56
56
  }
@@ -124,7 +124,7 @@ export class B3dmReader extends GltfReader {
124
124
  const feature = new Feature(this._modelId);
125
125
  featureTable.insert(feature);
126
126
  }
127
- await this.loadTextures();
127
+ await this.resolveResources();
128
128
  if (this._isCanceled)
129
129
  return { readStatus: TileReadStatus.Canceled, isLeaf: this._isLeaf };
130
130
  return this.readGltfAndCreateGraphics(this._isLeaf, featureTable, this._range, this._transformToRoot, this._pseudoRtcBias);
@@ -1 +1 @@
1
- {"version":3,"file":"B3dmReader.js","sourceRoot":"","sources":["../../../src/tile/B3dmReader.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAA0B,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAW,SAAS,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAuB,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAItH,OAAO,EAC6B,YAAY,EAAE,UAAU,EAAE,eAAe,GAC5E,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,MAAM,OAAO,UAAW,SAAQ,UAAU;IAqCxC,YAAoB,KAAsB,EAAE,MAAwB,EAAE,OAAmB,EAAE,IAAa,EAAE,MAAoB,EACpH,MAA2B,EAAU,OAAgB,EAAU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AK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;wBACvC,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;wBACjD,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;wBAChD,OAAO,CAAC,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;wBAClD,IAAI,UAAU;4BACZ,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;qBACpC;oBACD,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;iBAEnC;aACF;iBAAM;gBACL,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;aAClD;SACF;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { ByteStream, Id64String, JsonUtils } from \"@itwin/core-bentley\";\r\nimport { Point3d, Transform, Vector3d } from \"@itwin/core-geometry\";\r\nimport { B3dmHeader, ColorDef, ElementAlignedBox3d, Feature, FeatureTable, TileReadStatus } from \"@itwin/core-common\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { Mesh } from \"../render/primitives/mesh/MeshPrimitives\";\r\nimport { RenderSystem } from \"../render/RenderSystem\";\r\nimport {\r\n BatchedTileIdMap, GltfBufferData, GltfDataType, GltfReader, GltfReaderProps, GltfReaderResult, ShouldAbortReadGltf,\r\n} from \"./internal\";\r\n\r\n/**\r\n * Deserializes a tile in [b3dm](https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification/TileFormats/Batched3DModel) format.\r\n * @internal\r\n */\r\nexport class B3dmReader extends GltfReader {\r\n private _batchIdRemap = new Map<number, number>();\r\n private _colors?: Array<number>;\r\n private readonly _modelId: Id64String;\r\n\r\n public static create(stream: ByteStream, iModel: IModelConnection, modelId: Id64String, is3d: boolean, range: ElementAlignedBox3d,\r\n system: RenderSystem, yAxisUp: boolean, isLeaf: boolean, tileCenter: Point3d, transformToRoot?: Transform,\r\n isCanceled?: ShouldAbortReadGltf, idMap?: BatchedTileIdMap, deduplicateVertices=false): B3dmReader | undefined {\r\n const header = new B3dmHeader(stream);\r\n if (!header.isValid)\r\n return undefined;\r\n\r\n let returnToCenterTransform, pseudoRtcBias;\r\n if (header.featureTableJson && Array.isArray(header.featureTableJson.RTC_CENTER)) {\r\n returnToCenterTransform = Transform.createTranslationXYZ(header.featureTableJson.RTC_CENTER[0], header.featureTableJson.RTC_CENTER[1], header.featureTableJson.RTC_CENTER[2]);\r\n } else {\r\n /**\r\n * This is a workaround for tiles generated by\r\n * context capture which have a large offset from the tileset origin that exceeds the\r\n * capacity of 32 bit integers. It is essentially an ad hoc RTC applied at read time only if the tile is far from the\r\n * origin and there is no RTC supplied either with the B3DM of the GLTF.\r\n * as the vertices are supplied in a quantized format, applying the RTC bias to\r\n * quantization origin will make these tiles work correctly.\r\n */\r\n pseudoRtcBias = Vector3d.create(tileCenter.x, tileCenter.y, tileCenter.z);\r\n }\r\n\r\n if (undefined !== returnToCenterTransform)\r\n transformToRoot = transformToRoot ? transformToRoot.multiplyTransformTransform(returnToCenterTransform) : returnToCenterTransform;\r\n\r\n const props = GltfReaderProps.create(stream, yAxisUp);\r\n const batchTableLength = header.featureTableJson ? JsonUtils.asInt(header.featureTableJson.BATCH_LENGTH, 0) : 0;\r\n\r\n return undefined !== props ? new B3dmReader(props, iModel, modelId, is3d, system, range, isLeaf, batchTableLength,\r\n transformToRoot, header.batchTableJson, isCanceled, idMap, pseudoRtcBias, deduplicateVertices) : undefined;\r\n }\r\n\r\n private constructor(props: GltfReaderProps, iModel: IModelConnection, modelId: Id64String, is3d: boolean, system: RenderSystem,\r\n private _range: ElementAlignedBox3d, private _isLeaf: boolean, private _batchTableLength: number, private _transformToRoot?: Transform, private _batchTableJson?: any\r\n , shouldAbort?: ShouldAbortReadGltf, private _idMap?: BatchedTileIdMap, private _pseudoRtcBias?: Vector3d, deduplicateVertices=false) {\r\n super({\r\n props, iModel, system, shouldAbort, deduplicateVertices,\r\n is2d: !is3d,\r\n });\r\n this._modelId = modelId;\r\n }\r\n\r\n public async read(): Promise<GltfReaderResult> {\r\n // NB: For reality models with no batch table, we want the model ID in the feature table\r\n const featureTable: FeatureTable = new FeatureTable(this._batchTableLength ? this._batchTableLength : 1, this._modelId, this._type);\r\n if (this._batchTableLength > 0 && this._idMap !== undefined && this._batchTableJson !== undefined) {\r\n if (this._batchTableJson.extensions && this._batchTableJson.extensions[\"3DTILES_batch_table_hierarchy\"]) {\r\n const hierarchy = this._batchTableJson.extensions[\"3DTILES_batch_table_hierarchy\"];\r\n const { classIds, classes, parentIds, parentCounts, instancesLength } = hierarchy;\r\n if (classes !== undefined && classIds !== undefined && instancesLength !== 0) {\r\n const classCounts = new Array<number>(classes.length);\r\n classCounts.fill(0);\r\n const classIndexes = new Uint16Array(instancesLength);\r\n for (let i = 0; i < instancesLength; ++i) {\r\n const classId = classIds[i];\r\n classIndexes[i] = classCounts[classId]++;\r\n }\r\n\r\n let parentMap: [][] | undefined;\r\n if (parentIds) {\r\n parentMap = new Array<[]>();\r\n for (let i = 0, parentIndex = 0; i < instancesLength; i++) {\r\n const parentCount = parentCounts === undefined ? 1 : parentCounts[i];\r\n parentMap[i] = parentIds.slice(parentIndex, parentIndex += parentCount);\r\n }\r\n }\r\n\r\n const getProperties = (instance: any, instanceIndex: number) => {\r\n const classId = classIds[instanceIndex];\r\n const instanceClass = classes[classId];\r\n const instances = instanceClass.instances;\r\n const indexInClass = classIndexes[instanceIndex];\r\n for (const key in instances) { // eslint-disable-line guard-for-in\r\n const value = instances[key][indexInClass];\r\n if (value !== undefined && value !== null)\r\n instance[key] = value;\r\n }\r\n if (parentIds !== undefined) {\r\n const thisParents = parentMap![instanceIndex];\r\n for (const parentId of thisParents) {\r\n if (parentId !== instanceIndex)\r\n getProperties(instance, parentId);\r\n }\r\n }\r\n };\r\n for (let batchId = 0; batchId < instancesLength; batchId++) {\r\n const instance: any = {};\r\n getProperties(instance, batchId);\r\n this._batchIdRemap.set(batchId, featureTable.insert(new Feature(this._idMap.getBatchId(instance))));\r\n const cesiumColor = instance[\"cesium#color\"];\r\n if (undefined !== cesiumColor) {\r\n if (!this._colors) {\r\n this._colors = new Array<number>(instancesLength);\r\n this._colors.fill(ColorDef.white.tbgr);\r\n }\r\n this._colors[batchId] = ColorDef.create(cesiumColor).tbgr;\r\n }\r\n }\r\n }\r\n } else {\r\n for (let i = 0; i < this._batchTableLength; i++) {\r\n const feature: any = {};\r\n for (const key in this._batchTableJson) // eslint-disable-line guard-for-in\r\n feature[key] = this._batchTableJson[key][i];\r\n\r\n this._batchIdRemap.set(i, featureTable.insert(new Feature(this._idMap.getBatchId(feature))));\r\n }\r\n }\r\n }\r\n\r\n if (featureTable.isEmpty) {\r\n this._batchIdRemap.set(0, 0);\r\n const feature = new Feature(this._modelId);\r\n featureTable.insert(feature);\r\n }\r\n\r\n await this.loadTextures();\r\n if (this._isCanceled)\r\n return { readStatus: TileReadStatus.Canceled, isLeaf: this._isLeaf };\r\n\r\n return this.readGltfAndCreateGraphics(this._isLeaf, featureTable, this._range, this._transformToRoot, this._pseudoRtcBias);\r\n }\r\n\r\n protected override readBatchTable(mesh: Mesh, json: any) {\r\n if (mesh.features !== undefined) {\r\n if (this._batchTableLength > 0 && undefined !== this._batchTableJson && undefined !== json.attributes) {\r\n const view = this.getBufferView(json.attributes, \"_BATCHID\");\r\n let batchIds: undefined | GltfBufferData;\r\n if (undefined !== view && (undefined !== (batchIds = view.toBufferData(GltfDataType.UInt32)) || undefined !== (batchIds = view.toBufferData(GltfDataType.Float)))) {\r\n const indices = [];\r\n const { colors, colorMap } = mesh;\r\n let colorRemap: Uint32Array | undefined;\r\n if (this._colors && this._colors.length === this._batchTableLength) {\r\n colorRemap = new Uint32Array(this._batchTableLength);\r\n\r\n for (let i = 0; i < this._batchTableLength; i++)\r\n colorRemap[i] = colorMap.insert(this._colors[i]);\r\n }\r\n\r\n for (let i = 0; i < batchIds.count; i++) {\r\n const batchId = batchIds.buffer[i * view.stride];\r\n const remapId = this._batchIdRemap.get(batchId);\r\n indices.push(remapId === undefined ? 0 : remapId);\r\n if (colorRemap)\r\n colors.push(colorRemap[batchId]);\r\n }\r\n mesh.features.setIndices(indices);\r\n\r\n }\r\n } else {\r\n mesh.features.add(new Feature(this._modelId), 1);\r\n }\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"B3dmReader.js","sourceRoot":"","sources":["../../../src/tile/B3dmReader.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAA0B,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAW,SAAS,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAuB,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAItH,OAAO,EAC6B,YAAY,EAAE,UAAU,EAAE,eAAe,GAC5E,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,MAAM,OAAO,UAAW,SAAQ,UAAU;IAqCxC,YAAoB,KAAsB,EAAE,MAAwB,EAAE,OAAmB,EAAE,IAAa,EAAE,MAAoB,EACpH,MAA2B,EAAU,OAAgB,EAAU,iBAAyB,EAAU,gBAA4B,EAAU,eAAqB,EACnK,WAAiC,EAAU,MAAyB,EAAU,cAAyB,EAAE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AC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;wBACvC,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;wBACjD,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;wBAChD,OAAO,CAAC,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;wBAClD,IAAI,UAAU;4BACZ,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;qBACpC;oBACD,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;iBAEnC;aACF;iBAAM;gBACL,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;aAClD;SACF;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { ByteStream, Id64String, JsonUtils } from \"@itwin/core-bentley\";\r\nimport { Point3d, Transform, Vector3d } from \"@itwin/core-geometry\";\r\nimport { B3dmHeader, ColorDef, ElementAlignedBox3d, Feature, FeatureTable, TileReadStatus } from \"@itwin/core-common\";\r\nimport { IModelConnection } from \"../IModelConnection\";\r\nimport { Mesh } from \"../render/primitives/mesh/MeshPrimitives\";\r\nimport { RenderSystem } from \"../render/RenderSystem\";\r\nimport {\r\n BatchedTileIdMap, GltfBufferData, GltfDataType, GltfReader, GltfReaderProps, GltfReaderResult, ShouldAbortReadGltf,\r\n} from \"./internal\";\r\n\r\n/**\r\n * Deserializes a tile in [b3dm](https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification/TileFormats/Batched3DModel) format.\r\n * @internal\r\n */\r\nexport class B3dmReader extends GltfReader {\r\n private _batchIdRemap = new Map<number, number>();\r\n private _colors?: Array<number>;\r\n private readonly _modelId: Id64String;\r\n\r\n public static create(stream: ByteStream, iModel: IModelConnection, modelId: Id64String, is3d: boolean, range: ElementAlignedBox3d,\r\n system: RenderSystem, yAxisUp: boolean, isLeaf: boolean, tileCenter: Point3d, transformToRoot?: Transform,\r\n isCanceled?: ShouldAbortReadGltf, idMap?: BatchedTileIdMap, deduplicateVertices=false): B3dmReader | undefined {\r\n const header = new B3dmHeader(stream);\r\n if (!header.isValid)\r\n return undefined;\r\n\r\n let returnToCenterTransform, pseudoRtcBias;\r\n if (header.featureTableJson && Array.isArray(header.featureTableJson.RTC_CENTER)) {\r\n returnToCenterTransform = Transform.createTranslationXYZ(header.featureTableJson.RTC_CENTER[0], header.featureTableJson.RTC_CENTER[1], header.featureTableJson.RTC_CENTER[2]);\r\n } else {\r\n /**\r\n * This is a workaround for tiles generated by\r\n * context capture which have a large offset from the tileset origin that exceeds the\r\n * capacity of 32 bit integers. It is essentially an ad hoc RTC applied at read time only if the tile is far from the\r\n * origin and there is no RTC supplied either with the B3DM of the GLTF.\r\n * as the vertices are supplied in a quantized format, applying the RTC bias to\r\n * quantization origin will make these tiles work correctly.\r\n */\r\n pseudoRtcBias = Vector3d.create(tileCenter.x, tileCenter.y, tileCenter.z);\r\n }\r\n\r\n if (undefined !== returnToCenterTransform)\r\n transformToRoot = transformToRoot ? transformToRoot.multiplyTransformTransform(returnToCenterTransform) : returnToCenterTransform;\r\n\r\n const props = GltfReaderProps.create(stream.nextBytes(header.length - stream.curPos), yAxisUp);\r\n const batchTableLength = header.featureTableJson ? JsonUtils.asInt(header.featureTableJson.BATCH_LENGTH, 0) : 0;\r\n\r\n return undefined !== props ? new B3dmReader(props, iModel, modelId, is3d, system, range, isLeaf, batchTableLength,\r\n transformToRoot, header.batchTableJson, isCanceled, idMap, pseudoRtcBias, deduplicateVertices) : undefined;\r\n }\r\n\r\n private constructor(props: GltfReaderProps, iModel: IModelConnection, modelId: Id64String, is3d: boolean, system: RenderSystem,\r\n private _range: ElementAlignedBox3d, private _isLeaf: boolean, private _batchTableLength: number, private _transformToRoot?: Transform, private _batchTableJson?: any\r\n , shouldAbort?: ShouldAbortReadGltf, private _idMap?: BatchedTileIdMap, private _pseudoRtcBias?: Vector3d, deduplicateVertices=false) {\r\n super({\r\n props, iModel, system, shouldAbort, deduplicateVertices,\r\n is2d: !is3d,\r\n });\r\n this._modelId = modelId;\r\n }\r\n\r\n public async read(): Promise<GltfReaderResult> {\r\n // NB: For reality models with no batch table, we want the model ID in the feature table\r\n const featureTable: FeatureTable = new FeatureTable(this._batchTableLength ? this._batchTableLength : 1, this._modelId, this._type);\r\n if (this._batchTableLength > 0 && this._idMap !== undefined && this._batchTableJson !== undefined) {\r\n if (this._batchTableJson.extensions && this._batchTableJson.extensions[\"3DTILES_batch_table_hierarchy\"]) {\r\n const hierarchy = this._batchTableJson.extensions[\"3DTILES_batch_table_hierarchy\"];\r\n const { classIds, classes, parentIds, parentCounts, instancesLength } = hierarchy;\r\n if (classes !== undefined && classIds !== undefined && instancesLength !== 0) {\r\n const classCounts = new Array<number>(classes.length);\r\n classCounts.fill(0);\r\n const classIndexes = new Uint16Array(instancesLength);\r\n for (let i = 0; i < instancesLength; ++i) {\r\n const classId = classIds[i];\r\n classIndexes[i] = classCounts[classId]++;\r\n }\r\n\r\n let parentMap: [][] | undefined;\r\n if (parentIds) {\r\n parentMap = new Array<[]>();\r\n for (let i = 0, parentIndex = 0; i < instancesLength; i++) {\r\n const parentCount = parentCounts === undefined ? 1 : parentCounts[i];\r\n parentMap[i] = parentIds.slice(parentIndex, parentIndex += parentCount);\r\n }\r\n }\r\n\r\n const getProperties = (instance: any, instanceIndex: number) => {\r\n const classId = classIds[instanceIndex];\r\n const instanceClass = classes[classId];\r\n const instances = instanceClass.instances;\r\n const indexInClass = classIndexes[instanceIndex];\r\n for (const key in instances) { // eslint-disable-line guard-for-in\r\n const value = instances[key][indexInClass];\r\n if (value !== undefined && value !== null)\r\n instance[key] = value;\r\n }\r\n if (parentIds !== undefined) {\r\n const thisParents = parentMap![instanceIndex];\r\n for (const parentId of thisParents) {\r\n if (parentId !== instanceIndex)\r\n getProperties(instance, parentId);\r\n }\r\n }\r\n };\r\n for (let batchId = 0; batchId < instancesLength; batchId++) {\r\n const instance: any = {};\r\n getProperties(instance, batchId);\r\n this._batchIdRemap.set(batchId, featureTable.insert(new Feature(this._idMap.getBatchId(instance))));\r\n const cesiumColor = instance[\"cesium#color\"];\r\n if (undefined !== cesiumColor) {\r\n if (!this._colors) {\r\n this._colors = new Array<number>(instancesLength);\r\n this._colors.fill(ColorDef.white.tbgr);\r\n }\r\n this._colors[batchId] = ColorDef.create(cesiumColor).tbgr;\r\n }\r\n }\r\n }\r\n } else {\r\n for (let i = 0; i < this._batchTableLength; i++) {\r\n const feature: any = {};\r\n for (const key in this._batchTableJson) // eslint-disable-line guard-for-in\r\n feature[key] = this._batchTableJson[key][i];\r\n\r\n this._batchIdRemap.set(i, featureTable.insert(new Feature(this._idMap.getBatchId(feature))));\r\n }\r\n }\r\n }\r\n\r\n if (featureTable.isEmpty) {\r\n this._batchIdRemap.set(0, 0);\r\n const feature = new Feature(this._modelId);\r\n featureTable.insert(feature);\r\n }\r\n\r\n await this.resolveResources();\r\n if (this._isCanceled)\r\n return { readStatus: TileReadStatus.Canceled, isLeaf: this._isLeaf };\r\n\r\n return this.readGltfAndCreateGraphics(this._isLeaf, featureTable, this._range, this._transformToRoot, this._pseudoRtcBias);\r\n }\r\n\r\n protected override readBatchTable(mesh: Mesh, json: any) {\r\n if (mesh.features !== undefined) {\r\n if (this._batchTableLength > 0 && undefined !== this._batchTableJson && undefined !== json.attributes) {\r\n const view = this.getBufferView(json.attributes, \"_BATCHID\");\r\n let batchIds: undefined | GltfBufferData;\r\n if (undefined !== view && (undefined !== (batchIds = view.toBufferData(GltfDataType.UInt32)) || undefined !== (batchIds = view.toBufferData(GltfDataType.Float)))) {\r\n const indices = [];\r\n const { colors, colorMap } = mesh;\r\n let colorRemap: Uint32Array | undefined;\r\n if (this._colors && this._colors.length === this._batchTableLength) {\r\n colorRemap = new Uint32Array(this._batchTableLength);\r\n\r\n for (let i = 0; i < this._batchTableLength; i++)\r\n colorRemap[i] = colorMap.insert(this._colors[i]);\r\n }\r\n\r\n for (let i = 0; i < batchIds.count; i++) {\r\n const batchId = batchIds.buffer[i * view.stride];\r\n const remapId = this._batchIdRemap.get(batchId);\r\n indices.push(remapId === undefined ? 0 : remapId);\r\n if (colorRemap)\r\n colors.push(colorRemap[batchId]);\r\n }\r\n mesh.features.setIndices(indices);\r\n\r\n }\r\n } else {\r\n mesh.features.add(new Feature(this._modelId), 1);\r\n }\r\n }\r\n }\r\n}\r\n"]}
@@ -281,7 +281,7 @@ class GraphicsTile extends Tile {
281
281
  if (undefined === isCanceled)
282
282
  isCanceled = () => !this.isLoading;
283
283
  assert(data instanceof Uint8Array);
284
- const stream = new ByteStream(data.buffer);
284
+ const stream = ByteStream.fromUint8Array(data);
285
285
  const position = stream.curPos;
286
286
  const format = stream.nextUint32;
287
287
  stream.curPos = position;
@@ -1 +1 @@
1
- {"version":3,"file":"DynamicIModelTile.js","sourceRoot":"","sources":["../../../src/tile/DynamicIModelTile.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EACL,MAAM,EAAe,UAAU,EAAE,cAAc,EAAE,QAAQ,EAAE,IAAI,EAAyB,cAAc,EAAE,WAAW,GACpH,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAa,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EACgJ,UAAU,GAChK,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC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AC;QAEH,IAAI,OAAO,GAAgB,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QAC5C,IAAI,MAAM,EAAE;YACV,IAAI;gBACF,OAAO,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;aAC/B;YAAC,MAAM;gBACN,EAAE;aACH;SACF;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","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 {\r\n assert, BeTimePoint, ByteStream, compareStrings, DbOpcode, Id64, Id64Array, Id64String, partitionArray, SortedArray,\r\n} from \"@itwin/core-bentley\";\r\nimport { Range3d, Transform } from \"@itwin/core-geometry\";\r\nimport {\r\n BatchType, ElementGeometryChange, ElementGraphicsRequestProps, FeatureAppearance, FeatureAppearanceProvider, FeatureAppearanceSource, GeometryClass, TileFormat,\r\n} from \"@itwin/core-common\";\r\nimport { RenderSystem } from \"../render/RenderSystem\";\r\nimport { Viewport } from \"../Viewport\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport {\r\n ImdlReader, IModelTileTree, RootIModelTile, Tile, TileContent, TileDrawArgs, TileParams, TileRequest, TileRequestChannel, TileTree,\r\n} from \"./internal\";\r\n\r\n/** The root tile for the branch of an [[IModelTileTree]] containing graphics for elements that have been modified during the current\r\n * Not intended for direct consumption - exported for use by [[IModelTileTree]].\r\n * [[GraphicalEditingScope]].\r\n * @internal\r\n */\r\nexport abstract class DynamicIModelTile extends Tile {\r\n protected constructor(params: TileParams, tree: TileTree) {\r\n super(params, tree);\r\n }\r\n\r\n public static create(root: RootIModelTile, elements: Iterable<ElementGeometryChange>): DynamicIModelTile {\r\n return new RootTile(root, elements);\r\n }\r\n\r\n /** Updates the tiles when elements are modified during the editing scope. */\r\n public abstract handleGeometryChanges(changes: Iterable<ElementGeometryChange>): void;\r\n\r\n /** Overrides symbology of the *static* [[IModelTile]]s to hide elements that have been deleted or modified. */\r\n public abstract get appearanceProvider(): FeatureAppearanceProvider;\r\n\r\n /** Exposed strictly for tests. */\r\n public abstract get hiddenElements(): Id64Array;\r\n\r\n /** Select tiles for display, requesting content for tiles as necessary. */\r\n public abstract selectTiles(selected: Tile[], args: TileDrawArgs): void;\r\n\r\n /** Discard tiles that have not been used since the specified time point. */\r\n public abstract pruneChildren(olderThan: BeTimePoint): void;\r\n}\r\n\r\n/** The child tiles of the root tile, representing inserted or modified elements and sorted by element Id. */\r\nclass ElementTiles extends SortedArray<ElementTile> {\r\n public constructor() {\r\n super((lhs, rhs) => compareStrings(lhs.contentId, rhs.contentId));\r\n }\r\n\r\n public get array(): ElementTile[] {\r\n return this._array;\r\n }\r\n}\r\n\r\n/** The root tile. Each of its children represent a newly-inserted or modified element. */\r\nclass RootTile extends DynamicIModelTile implements FeatureAppearanceProvider {\r\n private readonly _hiddenElements: Id64.Uint32Set;\r\n public readonly transformToTree: Transform;\r\n private readonly _elements: ElementTiles;\r\n\r\n private get _imodelRoot() { return this.parent as RootIModelTile; }\r\n\r\n private get _elementChildren(): ElementTile[] {\r\n assert(undefined !== this.children);\r\n assert(this.children === this._elements.array);\r\n return this._elements.array;\r\n }\r\n\r\n public constructor(parent: RootIModelTile, elements: Iterable<ElementGeometryChange>) {\r\n const params: TileParams = {\r\n parent,\r\n isLeaf: false,\r\n contentId: \"dynamic\",\r\n range: Range3d.createNull(),\r\n maximumSize: parent.tileScreenSize,\r\n };\r\n\r\n super(params, parent.tree);\r\n\r\n this._hiddenElements = new Id64.Uint32Set();\r\n\r\n const inverseTransform = parent.tree.iModelTransform.inverse();\r\n assert(undefined !== inverseTransform);\r\n this.transformToTree = inverseTransform;\r\n\r\n this._elements = new ElementTiles();\r\n this.loadChildren(); // initially empty.\r\n assert(undefined !== this.children);\r\n\r\n this.setIsReady();\r\n this.handleGeometryChanges(elements);\r\n }\r\n\r\n public get hiddenElements(): Id64Array {\r\n return this._hiddenElements.toId64Array();\r\n }\r\n\r\n public get appearanceProvider(): FeatureAppearanceProvider {\r\n return this;\r\n }\r\n\r\n public getFeatureAppearance(source: FeatureAppearanceSource, elemLo: number, elemHi: number, subcatLo: number, subcatHi: number, geomClass: GeometryClass, modelLo: number, modelHi: number, type: BatchType, animationNodeId: number): FeatureAppearance | undefined {\r\n if (this._hiddenElements.has(elemLo, elemHi))\r\n return undefined;\r\n\r\n return source.getAppearance(elemLo, elemHi, subcatLo, subcatHi, geomClass, modelLo, modelHi, type, animationNodeId);\r\n }\r\n\r\n public handleGeometryChanges(changes: Iterable<ElementGeometryChange>): void {\r\n assert(undefined !== this.children);\r\n\r\n for (const change of changes) {\r\n if (change.type !== DbOpcode.Insert)\r\n this._hiddenElements.addId(change.id);\r\n\r\n let tile = this._elements.findEquivalent((t: ElementTile) => compareStrings(t.contentId, change.id));\r\n if (change.type === DbOpcode.Delete) {\r\n if (tile) {\r\n tile.dispose();\r\n this._elements.remove(tile);\r\n }\r\n } else {\r\n const range = change.range.isNull ? change.range.clone() : this.transformToTree.multiplyRange(change.range);\r\n if (tile)\r\n tile.update(range);\r\n else\r\n this._elements.insert(tile = new ElementTile(this, change.id, range));\r\n }\r\n }\r\n\r\n // Recompute range.\r\n this.range.setNull();\r\n for (const element of this._elements)\r\n this.range.extendRange(element.range);\r\n\r\n this._imodelRoot.updateDynamicRange(this);\r\n }\r\n\r\n protected _loadChildren(resolve: (children: Tile[] | undefined) => void, _reject: (errpr: Error) => void): void {\r\n // This is invoked from constructor. We will add a child per element later - for now just mark the children as having been loaded.\r\n resolve(this._elements.array);\r\n }\r\n\r\n public get channel(): TileRequestChannel {\r\n throw new Error(\"Root dynamic tile has no content\");\r\n }\r\n\r\n public async requestContent(): Promise<TileRequest.Response> {\r\n assert(false, \"Root dynamic tile has no content\");\r\n return undefined;\r\n }\r\n\r\n public async readContent(_data: TileRequest.ResponseData, _system: RenderSystem, _isCanceled: () => boolean): Promise<TileContent> {\r\n throw new Error(\"Root dynamic tile has no content\");\r\n }\r\n\r\n public selectTiles(selected: Tile[], args: TileDrawArgs): void {\r\n for (const child of this._elementChildren)\r\n child.selectTiles(selected, args);\r\n }\r\n\r\n public pruneChildren(olderThan: BeTimePoint): void {\r\n // Never discard ElementTiles - do discard not-recently-used graphics.\r\n for (const child of this._elementChildren)\r\n child.pruneChildren(olderThan);\r\n }\r\n}\r\n\r\n/** Represents a single element that has been inserted or had its geometric properties modified during the current [[GraphicalEditingScope]].\r\n * It has no graphics of its own; it has any number of child tiles, each of which have graphics of a different level of detail.\r\n * Its contentId is the element's Id.\r\n */\r\nclass ElementTile extends Tile {\r\n public constructor(parent: RootTile, elementId: Id64String, range: Range3d) {\r\n super({\r\n parent,\r\n isLeaf: false,\r\n contentId: elementId,\r\n range,\r\n maximumSize: parent.maximumSize,\r\n }, parent.tree);\r\n\r\n this.loadChildren();\r\n this.setIsReady();\r\n }\r\n\r\n protected _loadChildren(resolve: (children: Tile[] | undefined) => void, _reject: (error: Error) => void): void {\r\n // Invoked from constructor. We'll add child tiles later as needed.\r\n resolve([]);\r\n }\r\n\r\n public get channel(): TileRequestChannel {\r\n throw new Error(\"ElementTile has no content\");\r\n }\r\n\r\n public async requestContent(_isCanceled: () => boolean): Promise<TileRequest.Response> {\r\n assert(false, \"ElementTile has no content\");\r\n return undefined;\r\n }\r\n\r\n public async readContent(_data: TileRequest.ResponseData, _system: RenderSystem, _isCanceled: () => boolean): Promise<TileContent> {\r\n throw new Error(\"ElementTile has no content\");\r\n }\r\n\r\n public pruneChildren(olderThan: BeTimePoint): void {\r\n const children = this.children as GraphicsTile[];\r\n assert(undefined !== children);\r\n\r\n const partitionIndex = partitionArray(children, (child) => !child.usageMarker.isExpired(olderThan));\r\n\r\n // Remove expired children.\r\n if (partitionIndex < children.length) {\r\n const expired = children.splice(partitionIndex);\r\n for (const child of expired)\r\n child.dispose();\r\n }\r\n\r\n // Restore ordering.\r\n children.sort((x, y) => y.toleranceLog10 - x.toleranceLog10);\r\n }\r\n\r\n public selectTiles(selected: Tile[], args: TileDrawArgs): void {\r\n assert(undefined !== this.children);\r\n if (this.isRegionCulled(args))\r\n return;\r\n\r\n args.markUsed(this);\r\n\r\n // ###TODO: Test content range culled.\r\n\r\n // Compute the ideal chord tolerance.\r\n assert(this.maximumSize > 0);\r\n const pixelSize = args.getPixelSizeInMetersAtClosestPoint(this);\r\n assert(pixelSize > 0);\r\n\r\n // Round down to the nearest power of ten.\r\n const toleranceLog10 = Math.floor(Math.log10(pixelSize));\r\n\r\n // Find (or create) a child tile of desired tolerance. Also find a child tile that can be substituted for the desired tile if that tile's content is not yet loaded.\r\n // NB: Children are sorted in descending order by log10(tolerance)\r\n const children = this.children as GraphicsTile[];\r\n let closestMatch: GraphicsTile | undefined;\r\n let exactMatch: GraphicsTile | undefined;\r\n for (let i = 0; i < children.length; i++) {\r\n const child = children[i];\r\n const tol = child.toleranceLog10;\r\n if (tol > toleranceLog10) {\r\n assert(undefined === exactMatch);\r\n if (child.hasGraphics)\r\n closestMatch = child;\r\n } else if (tol === toleranceLog10) {\r\n exactMatch = child;\r\n } else if (tol < toleranceLog10) {\r\n if (!exactMatch)\r\n children.splice(i++, 0, exactMatch = new GraphicsTile(this, toleranceLog10));\r\n\r\n if (child.hasGraphics && (!closestMatch || closestMatch.toleranceLog10 > toleranceLog10))\r\n closestMatch = child;\r\n }\r\n }\r\n\r\n if (!exactMatch) {\r\n assert(children.length === 0 || children[children.length - 1].toleranceLog10 > toleranceLog10);\r\n children.push(exactMatch = new GraphicsTile(this, toleranceLog10));\r\n }\r\n\r\n if (!exactMatch.isReady) {\r\n args.insertMissing(exactMatch);\r\n if (closestMatch) {\r\n selected.push(closestMatch);\r\n args.markUsed(closestMatch);\r\n }\r\n } else if (exactMatch.hasGraphics) {\r\n selected.push(exactMatch);\r\n args.markUsed(exactMatch);\r\n }\r\n }\r\n\r\n public update(range: Range3d): void {\r\n range.clone(this.range);\r\n\r\n // Discard out-dated graphics.\r\n assert(undefined !== this.children);\r\n for (const child of this.children)\r\n child.dispose();\r\n\r\n this.children.length = 0;\r\n }\r\n}\r\n\r\nfunction* makeIdSequence() {\r\n let current = 0;\r\n while (true) {\r\n if (current >= Number.MAX_SAFE_INTEGER)\r\n current = 0;\r\n\r\n yield ++current;\r\n }\r\n}\r\n\r\nconst requestIdSequence = makeIdSequence();\r\n\r\n/** Supplies graphics of a specific LOD for a single element. */\r\nclass GraphicsTile extends Tile {\r\n public readonly toleranceLog10: number;\r\n public readonly tolerance: number;\r\n\r\n public constructor(parent: ElementTile, toleranceLog10: number) {\r\n assert(Math.round(toleranceLog10) === toleranceLog10);\r\n super({\r\n parent,\r\n isLeaf: true,\r\n contentId: `${parent.contentId}_${toleranceLog10}`,\r\n range: parent.range,\r\n maximumSize: parent.maximumSize,\r\n }, parent.tree);\r\n\r\n this.toleranceLog10 = toleranceLog10;\r\n this.tolerance = 10 ** toleranceLog10;\r\n }\r\n\r\n public override computeLoadPriority(_viewports: Iterable<Viewport>): number {\r\n // We want the element's graphics to be updated as soon as possible\r\n return 0;\r\n }\r\n\r\n protected _loadChildren(resolve: (children: Tile[] | undefined) => void, _reject: (error: Error) => void): void {\r\n resolve(undefined);\r\n }\r\n\r\n public get channel(): TileRequestChannel {\r\n return IModelApp.tileAdmin.channels.elementGraphicsRpc;\r\n }\r\n\r\n public async requestContent(_isCanceled: () => boolean): Promise<TileRequest.Response> {\r\n // ###TODO tree flags (enforce display priority)\r\n // ###TODO classifiers, animation\r\n\r\n assert(undefined !== this.parent);\r\n\r\n const requestId = requestIdSequence.next();\r\n assert(!requestId.done);\r\n\r\n assert(this.tree instanceof IModelTileTree);\r\n const idProvider = this.tree.contentIdProvider;\r\n\r\n const props: ElementGraphicsRequestProps = {\r\n id: requestId.value.toString(16),\r\n elementId: this.parent.contentId,\r\n toleranceLog10: this.toleranceLog10,\r\n formatVersion: idProvider.majorFormatVersion,\r\n location: this.tree.iModelTransform.toJSON(),\r\n contentFlags: idProvider.contentFlags,\r\n omitEdges: !this.tree.hasEdges,\r\n clipToProjectExtents: true,\r\n sectionCut: this.tree.stringifiedSectionClip,\r\n };\r\n\r\n return IModelApp.tileAdmin.requestElementGraphics(this.tree.iModel, props);\r\n }\r\n\r\n public async readContent(data: TileRequest.ResponseData, system: RenderSystem, isCanceled: () => boolean): Promise<TileContent> {\r\n if (undefined === isCanceled)\r\n isCanceled = () => !this.isLoading;\r\n\r\n assert(data instanceof Uint8Array);\r\n const stream = new ByteStream(data.buffer);\r\n\r\n const position = stream.curPos;\r\n const format = stream.nextUint32;\r\n stream.curPos = position;\r\n\r\n // ###TODO: IModelGraphics format wraps IModel format.\r\n assert(TileFormat.IModel === format);\r\n\r\n const tree = this.tree;\r\n assert(tree instanceof IModelTileTree);\r\n const { iModel, modelId, is3d, containsTransformNodes } = tree;\r\n const reader = ImdlReader.create({\r\n stream, iModel, modelId, is3d, system, isCanceled, containsTransformNodes,\r\n type: tree.batchType,\r\n loadEdges: tree.hasEdges,\r\n options: { tileId: this.contentId },\r\n });\r\n\r\n let content: TileContent = { isLeaf: true };\r\n if (reader) {\r\n try {\r\n content = await reader.read();\r\n } catch {\r\n //\r\n }\r\n }\r\n\r\n return content;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"DynamicIModelTile.js","sourceRoot":"","sources":["../../../src/tile/DynamicIModelTile.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EACL,MAAM,EAAe,UAAU,EAAE,cAAc,EAAE,QAAQ,EAAE,IAAI,EAAyB,cAAc,EAAE,WAAW,GACpH,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAa,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EACgJ,UAAU,GAChK,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EACL,UAAU,EAAE,cAAc,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AAE,IAAI,EAAE,CAAC;QAC5C,IAAI,MAAM,EAAE;YACV,IAAI;gBACF,OAAO,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;aAC/B;YAAC,MAAM;gBACN,EAAE;aACH;SACF;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","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 {\r\n assert, BeTimePoint, ByteStream, compareStrings, DbOpcode, Id64, Id64Array, Id64String, partitionArray, SortedArray,\r\n} from \"@itwin/core-bentley\";\r\nimport { Range3d, Transform } from \"@itwin/core-geometry\";\r\nimport {\r\n BatchType, ElementGeometryChange, ElementGraphicsRequestProps, FeatureAppearance, FeatureAppearanceProvider, FeatureAppearanceSource, GeometryClass, TileFormat,\r\n} from \"@itwin/core-common\";\r\nimport { RenderSystem } from \"../render/RenderSystem\";\r\nimport { Viewport } from \"../Viewport\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport {\r\n ImdlReader, IModelTileTree, RootIModelTile, Tile, TileContent, TileDrawArgs, TileParams, TileRequest, TileRequestChannel, TileTree,\r\n} from \"./internal\";\r\n\r\n/** The root tile for the branch of an [[IModelTileTree]] containing graphics for elements that have been modified during the current\r\n * Not intended for direct consumption - exported for use by [[IModelTileTree]].\r\n * [[GraphicalEditingScope]].\r\n * @internal\r\n */\r\nexport abstract class DynamicIModelTile extends Tile {\r\n protected constructor(params: TileParams, tree: TileTree) {\r\n super(params, tree);\r\n }\r\n\r\n public static create(root: RootIModelTile, elements: Iterable<ElementGeometryChange>): DynamicIModelTile {\r\n return new RootTile(root, elements);\r\n }\r\n\r\n /** Updates the tiles when elements are modified during the editing scope. */\r\n public abstract handleGeometryChanges(changes: Iterable<ElementGeometryChange>): void;\r\n\r\n /** Overrides symbology of the *static* [[IModelTile]]s to hide elements that have been deleted or modified. */\r\n public abstract get appearanceProvider(): FeatureAppearanceProvider;\r\n\r\n /** Exposed strictly for tests. */\r\n public abstract get hiddenElements(): Id64Array;\r\n\r\n /** Select tiles for display, requesting content for tiles as necessary. */\r\n public abstract selectTiles(selected: Tile[], args: TileDrawArgs): void;\r\n\r\n /** Discard tiles that have not been used since the specified time point. */\r\n public abstract pruneChildren(olderThan: BeTimePoint): void;\r\n}\r\n\r\n/** The child tiles of the root tile, representing inserted or modified elements and sorted by element Id. */\r\nclass ElementTiles extends SortedArray<ElementTile> {\r\n public constructor() {\r\n super((lhs, rhs) => compareStrings(lhs.contentId, rhs.contentId));\r\n }\r\n\r\n public get array(): ElementTile[] {\r\n return this._array;\r\n }\r\n}\r\n\r\n/** The root tile. Each of its children represent a newly-inserted or modified element. */\r\nclass RootTile extends DynamicIModelTile implements FeatureAppearanceProvider {\r\n private readonly _hiddenElements: Id64.Uint32Set;\r\n public readonly transformToTree: Transform;\r\n private readonly _elements: ElementTiles;\r\n\r\n private get _imodelRoot() { return this.parent as RootIModelTile; }\r\n\r\n private get _elementChildren(): ElementTile[] {\r\n assert(undefined !== this.children);\r\n assert(this.children === this._elements.array);\r\n return this._elements.array;\r\n }\r\n\r\n public constructor(parent: RootIModelTile, elements: Iterable<ElementGeometryChange>) {\r\n const params: TileParams = {\r\n parent,\r\n isLeaf: false,\r\n contentId: \"dynamic\",\r\n range: Range3d.createNull(),\r\n maximumSize: parent.tileScreenSize,\r\n };\r\n\r\n super(params, parent.tree);\r\n\r\n this._hiddenElements = new Id64.Uint32Set();\r\n\r\n const inverseTransform = parent.tree.iModelTransform.inverse();\r\n assert(undefined !== inverseTransform);\r\n this.transformToTree = inverseTransform;\r\n\r\n this._elements = new ElementTiles();\r\n this.loadChildren(); // initially empty.\r\n assert(undefined !== this.children);\r\n\r\n this.setIsReady();\r\n this.handleGeometryChanges(elements);\r\n }\r\n\r\n public get hiddenElements(): Id64Array {\r\n return this._hiddenElements.toId64Array();\r\n }\r\n\r\n public get appearanceProvider(): FeatureAppearanceProvider {\r\n return this;\r\n }\r\n\r\n public getFeatureAppearance(source: FeatureAppearanceSource, elemLo: number, elemHi: number, subcatLo: number, subcatHi: number, geomClass: GeometryClass, modelLo: number, modelHi: number, type: BatchType, animationNodeId: number): FeatureAppearance | undefined {\r\n if (this._hiddenElements.has(elemLo, elemHi))\r\n return undefined;\r\n\r\n return source.getAppearance(elemLo, elemHi, subcatLo, subcatHi, geomClass, modelLo, modelHi, type, animationNodeId);\r\n }\r\n\r\n public handleGeometryChanges(changes: Iterable<ElementGeometryChange>): void {\r\n assert(undefined !== this.children);\r\n\r\n for (const change of changes) {\r\n if (change.type !== DbOpcode.Insert)\r\n this._hiddenElements.addId(change.id);\r\n\r\n let tile = this._elements.findEquivalent((t: ElementTile) => compareStrings(t.contentId, change.id));\r\n if (change.type === DbOpcode.Delete) {\r\n if (tile) {\r\n tile.dispose();\r\n this._elements.remove(tile);\r\n }\r\n } else {\r\n const range = change.range.isNull ? change.range.clone() : this.transformToTree.multiplyRange(change.range);\r\n if (tile)\r\n tile.update(range);\r\n else\r\n this._elements.insert(tile = new ElementTile(this, change.id, range));\r\n }\r\n }\r\n\r\n // Recompute range.\r\n this.range.setNull();\r\n for (const element of this._elements)\r\n this.range.extendRange(element.range);\r\n\r\n this._imodelRoot.updateDynamicRange(this);\r\n }\r\n\r\n protected _loadChildren(resolve: (children: Tile[] | undefined) => void, _reject: (errpr: Error) => void): void {\r\n // This is invoked from constructor. We will add a child per element later - for now just mark the children as having been loaded.\r\n resolve(this._elements.array);\r\n }\r\n\r\n public get channel(): TileRequestChannel {\r\n throw new Error(\"Root dynamic tile has no content\");\r\n }\r\n\r\n public async requestContent(): Promise<TileRequest.Response> {\r\n assert(false, \"Root dynamic tile has no content\");\r\n return undefined;\r\n }\r\n\r\n public async readContent(_data: TileRequest.ResponseData, _system: RenderSystem, _isCanceled: () => boolean): Promise<TileContent> {\r\n throw new Error(\"Root dynamic tile has no content\");\r\n }\r\n\r\n public selectTiles(selected: Tile[], args: TileDrawArgs): void {\r\n for (const child of this._elementChildren)\r\n child.selectTiles(selected, args);\r\n }\r\n\r\n public pruneChildren(olderThan: BeTimePoint): void {\r\n // Never discard ElementTiles - do discard not-recently-used graphics.\r\n for (const child of this._elementChildren)\r\n child.pruneChildren(olderThan);\r\n }\r\n}\r\n\r\n/** Represents a single element that has been inserted or had its geometric properties modified during the current [[GraphicalEditingScope]].\r\n * It has no graphics of its own; it has any number of child tiles, each of which have graphics of a different level of detail.\r\n * Its contentId is the element's Id.\r\n */\r\nclass ElementTile extends Tile {\r\n public constructor(parent: RootTile, elementId: Id64String, range: Range3d) {\r\n super({\r\n parent,\r\n isLeaf: false,\r\n contentId: elementId,\r\n range,\r\n maximumSize: parent.maximumSize,\r\n }, parent.tree);\r\n\r\n this.loadChildren();\r\n this.setIsReady();\r\n }\r\n\r\n protected _loadChildren(resolve: (children: Tile[] | undefined) => void, _reject: (error: Error) => void): void {\r\n // Invoked from constructor. We'll add child tiles later as needed.\r\n resolve([]);\r\n }\r\n\r\n public get channel(): TileRequestChannel {\r\n throw new Error(\"ElementTile has no content\");\r\n }\r\n\r\n public async requestContent(_isCanceled: () => boolean): Promise<TileRequest.Response> {\r\n assert(false, \"ElementTile has no content\");\r\n return undefined;\r\n }\r\n\r\n public async readContent(_data: TileRequest.ResponseData, _system: RenderSystem, _isCanceled: () => boolean): Promise<TileContent> {\r\n throw new Error(\"ElementTile has no content\");\r\n }\r\n\r\n public pruneChildren(olderThan: BeTimePoint): void {\r\n const children = this.children as GraphicsTile[];\r\n assert(undefined !== children);\r\n\r\n const partitionIndex = partitionArray(children, (child) => !child.usageMarker.isExpired(olderThan));\r\n\r\n // Remove expired children.\r\n if (partitionIndex < children.length) {\r\n const expired = children.splice(partitionIndex);\r\n for (const child of expired)\r\n child.dispose();\r\n }\r\n\r\n // Restore ordering.\r\n children.sort((x, y) => y.toleranceLog10 - x.toleranceLog10);\r\n }\r\n\r\n public selectTiles(selected: Tile[], args: TileDrawArgs): void {\r\n assert(undefined !== this.children);\r\n if (this.isRegionCulled(args))\r\n return;\r\n\r\n args.markUsed(this);\r\n\r\n // ###TODO: Test content range culled.\r\n\r\n // Compute the ideal chord tolerance.\r\n assert(this.maximumSize > 0);\r\n const pixelSize = args.getPixelSizeInMetersAtClosestPoint(this);\r\n assert(pixelSize > 0);\r\n\r\n // Round down to the nearest power of ten.\r\n const toleranceLog10 = Math.floor(Math.log10(pixelSize));\r\n\r\n // Find (or create) a child tile of desired tolerance. Also find a child tile that can be substituted for the desired tile if that tile's content is not yet loaded.\r\n // NB: Children are sorted in descending order by log10(tolerance)\r\n const children = this.children as GraphicsTile[];\r\n let closestMatch: GraphicsTile | undefined;\r\n let exactMatch: GraphicsTile | undefined;\r\n for (let i = 0; i < children.length; i++) {\r\n const child = children[i];\r\n const tol = child.toleranceLog10;\r\n if (tol > toleranceLog10) {\r\n assert(undefined === exactMatch);\r\n if (child.hasGraphics)\r\n closestMatch = child;\r\n } else if (tol === toleranceLog10) {\r\n exactMatch = child;\r\n } else if (tol < toleranceLog10) {\r\n if (!exactMatch)\r\n children.splice(i++, 0, exactMatch = new GraphicsTile(this, toleranceLog10));\r\n\r\n if (child.hasGraphics && (!closestMatch || closestMatch.toleranceLog10 > toleranceLog10))\r\n closestMatch = child;\r\n }\r\n }\r\n\r\n if (!exactMatch) {\r\n assert(children.length === 0 || children[children.length - 1].toleranceLog10 > toleranceLog10);\r\n children.push(exactMatch = new GraphicsTile(this, toleranceLog10));\r\n }\r\n\r\n if (!exactMatch.isReady) {\r\n args.insertMissing(exactMatch);\r\n if (closestMatch) {\r\n selected.push(closestMatch);\r\n args.markUsed(closestMatch);\r\n }\r\n } else if (exactMatch.hasGraphics) {\r\n selected.push(exactMatch);\r\n args.markUsed(exactMatch);\r\n }\r\n }\r\n\r\n public update(range: Range3d): void {\r\n range.clone(this.range);\r\n\r\n // Discard out-dated graphics.\r\n assert(undefined !== this.children);\r\n for (const child of this.children)\r\n child.dispose();\r\n\r\n this.children.length = 0;\r\n }\r\n}\r\n\r\nfunction* makeIdSequence() {\r\n let current = 0;\r\n while (true) {\r\n if (current >= Number.MAX_SAFE_INTEGER)\r\n current = 0;\r\n\r\n yield ++current;\r\n }\r\n}\r\n\r\nconst requestIdSequence = makeIdSequence();\r\n\r\n/** Supplies graphics of a specific LOD for a single element. */\r\nclass GraphicsTile extends Tile {\r\n public readonly toleranceLog10: number;\r\n public readonly tolerance: number;\r\n\r\n public constructor(parent: ElementTile, toleranceLog10: number) {\r\n assert(Math.round(toleranceLog10) === toleranceLog10);\r\n super({\r\n parent,\r\n isLeaf: true,\r\n contentId: `${parent.contentId}_${toleranceLog10}`,\r\n range: parent.range,\r\n maximumSize: parent.maximumSize,\r\n }, parent.tree);\r\n\r\n this.toleranceLog10 = toleranceLog10;\r\n this.tolerance = 10 ** toleranceLog10;\r\n }\r\n\r\n public override computeLoadPriority(_viewports: Iterable<Viewport>): number {\r\n // We want the element's graphics to be updated as soon as possible\r\n return 0;\r\n }\r\n\r\n protected _loadChildren(resolve: (children: Tile[] | undefined) => void, _reject: (error: Error) => void): void {\r\n resolve(undefined);\r\n }\r\n\r\n public get channel(): TileRequestChannel {\r\n return IModelApp.tileAdmin.channels.elementGraphicsRpc;\r\n }\r\n\r\n public async requestContent(_isCanceled: () => boolean): Promise<TileRequest.Response> {\r\n // ###TODO tree flags (enforce display priority)\r\n // ###TODO classifiers, animation\r\n\r\n assert(undefined !== this.parent);\r\n\r\n const requestId = requestIdSequence.next();\r\n assert(!requestId.done);\r\n\r\n assert(this.tree instanceof IModelTileTree);\r\n const idProvider = this.tree.contentIdProvider;\r\n\r\n const props: ElementGraphicsRequestProps = {\r\n id: requestId.value.toString(16),\r\n elementId: this.parent.contentId,\r\n toleranceLog10: this.toleranceLog10,\r\n formatVersion: idProvider.majorFormatVersion,\r\n location: this.tree.iModelTransform.toJSON(),\r\n contentFlags: idProvider.contentFlags,\r\n omitEdges: !this.tree.hasEdges,\r\n clipToProjectExtents: true,\r\n sectionCut: this.tree.stringifiedSectionClip,\r\n };\r\n\r\n return IModelApp.tileAdmin.requestElementGraphics(this.tree.iModel, props);\r\n }\r\n\r\n public async readContent(data: TileRequest.ResponseData, system: RenderSystem, isCanceled: () => boolean): Promise<TileContent> {\r\n if (undefined === isCanceled)\r\n isCanceled = () => !this.isLoading;\r\n\r\n assert(data instanceof Uint8Array);\r\n const stream = ByteStream.fromUint8Array(data);\r\n\r\n const position = stream.curPos;\r\n const format = stream.nextUint32;\r\n stream.curPos = position;\r\n\r\n // ###TODO: IModelGraphics format wraps IModel format.\r\n assert(TileFormat.IModel === format);\r\n\r\n const tree = this.tree;\r\n assert(tree instanceof IModelTileTree);\r\n const { iModel, modelId, is3d, containsTransformNodes } = tree;\r\n const reader = ImdlReader.create({\r\n stream, iModel, modelId, is3d, system, isCanceled, containsTransformNodes,\r\n type: tree.batchType,\r\n loadEdges: tree.hasEdges,\r\n options: { tileId: this.contentId },\r\n });\r\n\r\n let content: TileContent = { isLeaf: true };\r\n if (reader) {\r\n try {\r\n content = await reader.read();\r\n } catch {\r\n //\r\n }\r\n }\r\n\r\n return content;\r\n }\r\n}\r\n"]}