@itwin/core-common 5.0.0-dev.32 → 5.0.0-dev.34

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 (193) hide show
  1. package/lib/cjs/AmbientOcclusion.js +9 -9
  2. package/lib/cjs/AmbientOcclusion.js.map +1 -1
  3. package/lib/cjs/AnalysisStyle.js +1 -1
  4. package/lib/cjs/AnalysisStyle.js.map +1 -1
  5. package/lib/cjs/Atmosphere.js +19 -21
  6. package/lib/cjs/Atmosphere.js.map +1 -1
  7. package/lib/cjs/ClipStyle.js +5 -5
  8. package/lib/cjs/ClipStyle.js.map +1 -1
  9. package/lib/cjs/ColorDef.js +10 -10
  10. package/lib/cjs/ColorDef.js.map +1 -1
  11. package/lib/cjs/ContourDisplay.js +5 -5
  12. package/lib/cjs/ContourDisplay.js.map +1 -1
  13. package/lib/cjs/ECSqlReader.js +1 -1
  14. package/lib/cjs/ECSqlReader.js.map +1 -1
  15. package/lib/cjs/ElementProps.js +2 -2
  16. package/lib/cjs/ElementProps.js.map +1 -1
  17. package/lib/cjs/Environment.js +2 -2
  18. package/lib/cjs/Environment.js.map +1 -1
  19. package/lib/cjs/FeatureSymbology.js +3 -3
  20. package/lib/cjs/FeatureSymbology.js.map +1 -1
  21. package/lib/cjs/Gradient.js +9 -9
  22. package/lib/cjs/Gradient.js.map +1 -1
  23. package/lib/cjs/GroundPlane.js +2 -2
  24. package/lib/cjs/GroundPlane.js.map +1 -1
  25. package/lib/cjs/HiddenLine.js +4 -4
  26. package/lib/cjs/HiddenLine.js.map +1 -1
  27. package/lib/cjs/IModel.js +6 -6
  28. package/lib/cjs/IModel.js.map +1 -1
  29. package/lib/cjs/LightSettings.js +1 -1
  30. package/lib/cjs/LightSettings.js.map +1 -1
  31. package/lib/cjs/PlanarClipMask.js +2 -2
  32. package/lib/cjs/PlanarClipMask.js.map +1 -1
  33. package/lib/cjs/RealityModelDisplaySettings.js +4 -4
  34. package/lib/cjs/RealityModelDisplaySettings.js.map +1 -1
  35. package/lib/cjs/RenderMaterial.js +3 -3
  36. package/lib/cjs/RenderMaterial.js.map +1 -1
  37. package/lib/cjs/SkyBox.js +4 -4
  38. package/lib/cjs/SkyBox.js.map +1 -1
  39. package/lib/cjs/SolarShadows.js +1 -1
  40. package/lib/cjs/SolarShadows.js.map +1 -1
  41. package/lib/cjs/SubCategoryAppearance.js +1 -1
  42. package/lib/cjs/SubCategoryAppearance.js.map +1 -1
  43. package/lib/cjs/SubCategoryOverride.js +2 -2
  44. package/lib/cjs/SubCategoryOverride.js.map +1 -1
  45. package/lib/cjs/TextureMapping.js +2 -2
  46. package/lib/cjs/TextureMapping.js.map +1 -1
  47. package/lib/cjs/ThematicDisplay.js +2 -2
  48. package/lib/cjs/ThematicDisplay.js.map +1 -1
  49. package/lib/cjs/ViewDetails.js +2 -2
  50. package/lib/cjs/ViewDetails.js.map +1 -1
  51. package/lib/cjs/ViewFlags.js +2 -2
  52. package/lib/cjs/ViewFlags.js.map +1 -1
  53. package/lib/cjs/WhiteOnWhiteReversalSettings.js +2 -2
  54. package/lib/cjs/WhiteOnWhiteReversalSettings.js.map +1 -1
  55. package/lib/cjs/annotation/TextStyle.js +19 -19
  56. package/lib/cjs/annotation/TextStyle.js.map +1 -1
  57. package/lib/cjs/geometry/Cartographic.js +13 -13
  58. package/lib/cjs/geometry/Cartographic.js.map +1 -1
  59. package/lib/cjs/ipc/IpcWebSocket.js +1 -1
  60. package/lib/cjs/ipc/IpcWebSocket.js.map +1 -1
  61. package/lib/cjs/ipc/IpcWebSocketTransport.js +1 -1
  62. package/lib/cjs/ipc/IpcWebSocketTransport.js.map +1 -1
  63. package/lib/cjs/rpc/DevToolsRpcInterface.js +6 -6
  64. package/lib/cjs/rpc/DevToolsRpcInterface.js.map +1 -1
  65. package/lib/cjs/rpc/IModelReadRpcInterface.js +4 -4
  66. package/lib/cjs/rpc/IModelReadRpcInterface.js.map +1 -1
  67. package/lib/cjs/rpc/IModelTileRpcInterface.js +4 -4
  68. package/lib/cjs/rpc/IModelTileRpcInterface.js.map +1 -1
  69. package/lib/cjs/rpc/SnapshotIModelRpcInterface.js +4 -4
  70. package/lib/cjs/rpc/SnapshotIModelRpcInterface.js.map +1 -1
  71. package/lib/cjs/rpc/core/RpcConfiguration.js +32 -34
  72. package/lib/cjs/rpc/core/RpcConfiguration.js.map +1 -1
  73. package/lib/cjs/rpc/core/RpcControl.js +8 -15
  74. package/lib/cjs/rpc/core/RpcControl.js.map +1 -1
  75. package/lib/cjs/rpc/core/RpcInvocation.js +3 -5
  76. package/lib/cjs/rpc/core/RpcInvocation.js.map +1 -1
  77. package/lib/cjs/rpc/core/RpcOperation.js +2 -2
  78. package/lib/cjs/rpc/core/RpcOperation.js.map +1 -1
  79. package/lib/cjs/rpc/core/RpcProtocol.js +4 -4
  80. package/lib/cjs/rpc/core/RpcProtocol.js.map +1 -1
  81. package/lib/cjs/rpc/core/RpcPush.js +5 -5
  82. package/lib/cjs/rpc/core/RpcPush.js.map +1 -1
  83. package/lib/cjs/rpc/core/RpcRequest.js +5 -5
  84. package/lib/cjs/rpc/core/RpcRequest.js.map +1 -1
  85. package/lib/cjs/rpc/core/RpcRoutingToken.js +2 -2
  86. package/lib/cjs/rpc/core/RpcRoutingToken.js.map +1 -1
  87. package/lib/cjs/rpc/core/RpcSessionInvocation.js +1 -1
  88. package/lib/cjs/rpc/core/RpcSessionInvocation.js.map +1 -1
  89. package/lib/cjs/rpc/web/BentleyCloudRpcManager.js +6 -6
  90. package/lib/cjs/rpc/web/BentleyCloudRpcManager.js.map +1 -1
  91. package/lib/cjs/rpc/web/RpcMultipart.js +12 -12
  92. package/lib/cjs/rpc/web/RpcMultipart.js.map +1 -1
  93. package/lib/cjs/rpc/web/WebAppRpcRequest.js +17 -19
  94. package/lib/cjs/rpc/web/WebAppRpcRequest.js.map +1 -1
  95. package/lib/cjs/tile/IModelTileIO.js +1 -1
  96. package/lib/cjs/tile/IModelTileIO.js.map +1 -1
  97. package/lib/esm/AmbientOcclusion.js +9 -9
  98. package/lib/esm/AmbientOcclusion.js.map +1 -1
  99. package/lib/esm/AnalysisStyle.js +1 -1
  100. package/lib/esm/AnalysisStyle.js.map +1 -1
  101. package/lib/esm/Atmosphere.js +19 -21
  102. package/lib/esm/Atmosphere.js.map +1 -1
  103. package/lib/esm/ClipStyle.js +5 -5
  104. package/lib/esm/ClipStyle.js.map +1 -1
  105. package/lib/esm/ColorDef.js +10 -10
  106. package/lib/esm/ColorDef.js.map +1 -1
  107. package/lib/esm/ContourDisplay.js +5 -5
  108. package/lib/esm/ContourDisplay.js.map +1 -1
  109. package/lib/esm/ECSqlReader.js +1 -1
  110. package/lib/esm/ECSqlReader.js.map +1 -1
  111. package/lib/esm/ElementProps.js +2 -2
  112. package/lib/esm/ElementProps.js.map +1 -1
  113. package/lib/esm/Environment.js +2 -2
  114. package/lib/esm/Environment.js.map +1 -1
  115. package/lib/esm/FeatureSymbology.js +3 -3
  116. package/lib/esm/FeatureSymbology.js.map +1 -1
  117. package/lib/esm/Gradient.js +9 -9
  118. package/lib/esm/Gradient.js.map +1 -1
  119. package/lib/esm/GroundPlane.js +2 -2
  120. package/lib/esm/GroundPlane.js.map +1 -1
  121. package/lib/esm/HiddenLine.js +4 -4
  122. package/lib/esm/HiddenLine.js.map +1 -1
  123. package/lib/esm/IModel.js +6 -6
  124. package/lib/esm/IModel.js.map +1 -1
  125. package/lib/esm/LightSettings.js +1 -1
  126. package/lib/esm/LightSettings.js.map +1 -1
  127. package/lib/esm/PlanarClipMask.js +2 -2
  128. package/lib/esm/PlanarClipMask.js.map +1 -1
  129. package/lib/esm/RealityModelDisplaySettings.js +4 -4
  130. package/lib/esm/RealityModelDisplaySettings.js.map +1 -1
  131. package/lib/esm/RenderMaterial.js +3 -3
  132. package/lib/esm/RenderMaterial.js.map +1 -1
  133. package/lib/esm/SkyBox.js +4 -4
  134. package/lib/esm/SkyBox.js.map +1 -1
  135. package/lib/esm/SolarShadows.js +1 -1
  136. package/lib/esm/SolarShadows.js.map +1 -1
  137. package/lib/esm/SubCategoryAppearance.js +1 -1
  138. package/lib/esm/SubCategoryAppearance.js.map +1 -1
  139. package/lib/esm/SubCategoryOverride.js +2 -2
  140. package/lib/esm/SubCategoryOverride.js.map +1 -1
  141. package/lib/esm/TextureMapping.js +2 -2
  142. package/lib/esm/TextureMapping.js.map +1 -1
  143. package/lib/esm/ThematicDisplay.js +2 -2
  144. package/lib/esm/ThematicDisplay.js.map +1 -1
  145. package/lib/esm/ViewDetails.js +2 -2
  146. package/lib/esm/ViewDetails.js.map +1 -1
  147. package/lib/esm/ViewFlags.js +2 -2
  148. package/lib/esm/ViewFlags.js.map +1 -1
  149. package/lib/esm/WhiteOnWhiteReversalSettings.js +2 -2
  150. package/lib/esm/WhiteOnWhiteReversalSettings.js.map +1 -1
  151. package/lib/esm/annotation/TextStyle.js +19 -19
  152. package/lib/esm/annotation/TextStyle.js.map +1 -1
  153. package/lib/esm/geometry/Cartographic.js +13 -13
  154. package/lib/esm/geometry/Cartographic.js.map +1 -1
  155. package/lib/esm/ipc/IpcWebSocket.js +1 -1
  156. package/lib/esm/ipc/IpcWebSocket.js.map +1 -1
  157. package/lib/esm/ipc/IpcWebSocketTransport.js +1 -1
  158. package/lib/esm/ipc/IpcWebSocketTransport.js.map +1 -1
  159. package/lib/esm/rpc/DevToolsRpcInterface.js +6 -6
  160. package/lib/esm/rpc/DevToolsRpcInterface.js.map +1 -1
  161. package/lib/esm/rpc/IModelReadRpcInterface.js +4 -4
  162. package/lib/esm/rpc/IModelReadRpcInterface.js.map +1 -1
  163. package/lib/esm/rpc/IModelTileRpcInterface.js +4 -4
  164. package/lib/esm/rpc/IModelTileRpcInterface.js.map +1 -1
  165. package/lib/esm/rpc/SnapshotIModelRpcInterface.js +4 -4
  166. package/lib/esm/rpc/SnapshotIModelRpcInterface.js.map +1 -1
  167. package/lib/esm/rpc/core/RpcConfiguration.js +32 -34
  168. package/lib/esm/rpc/core/RpcConfiguration.js.map +1 -1
  169. package/lib/esm/rpc/core/RpcControl.js +8 -15
  170. package/lib/esm/rpc/core/RpcControl.js.map +1 -1
  171. package/lib/esm/rpc/core/RpcInvocation.js +3 -5
  172. package/lib/esm/rpc/core/RpcInvocation.js.map +1 -1
  173. package/lib/esm/rpc/core/RpcOperation.js +2 -2
  174. package/lib/esm/rpc/core/RpcOperation.js.map +1 -1
  175. package/lib/esm/rpc/core/RpcProtocol.js +4 -4
  176. package/lib/esm/rpc/core/RpcProtocol.js.map +1 -1
  177. package/lib/esm/rpc/core/RpcPush.js +5 -5
  178. package/lib/esm/rpc/core/RpcPush.js.map +1 -1
  179. package/lib/esm/rpc/core/RpcRequest.js +5 -5
  180. package/lib/esm/rpc/core/RpcRequest.js.map +1 -1
  181. package/lib/esm/rpc/core/RpcRoutingToken.js +2 -2
  182. package/lib/esm/rpc/core/RpcRoutingToken.js.map +1 -1
  183. package/lib/esm/rpc/core/RpcSessionInvocation.js +1 -1
  184. package/lib/esm/rpc/core/RpcSessionInvocation.js.map +1 -1
  185. package/lib/esm/rpc/web/BentleyCloudRpcManager.js +6 -6
  186. package/lib/esm/rpc/web/BentleyCloudRpcManager.js.map +1 -1
  187. package/lib/esm/rpc/web/RpcMultipart.js +12 -12
  188. package/lib/esm/rpc/web/RpcMultipart.js.map +1 -1
  189. package/lib/esm/rpc/web/WebAppRpcRequest.js +17 -19
  190. package/lib/esm/rpc/web/WebAppRpcRequest.js.map +1 -1
  191. package/lib/esm/tile/IModelTileIO.js +1 -1
  192. package/lib/esm/tile/IModelTileIO.js.map +1 -1
  193. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"LightSettings.js","sourceRoot":"","sources":["../../src/LightSettings.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAwD;AACxD,wDAA0D;AAC1D,yCAAqD;AAErD,SAAS,gBAAgB,CAAC,KAAyB,EAAE,YAAoB;IACvE,MAAM,YAAY,GAAG,CAAC,CAAC;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AE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC7F,CAAC;IAEM,MAAM,CAAC,GAAkB;QAC9B,IAAI,IAAI,KAAK,GAAG;YACd,OAAO,IAAI,CAAC;QAEd,OAAO,IAAI,CAAC,iBAAiB,KAAK,GAAG,CAAC,iBAAiB,IAAI,IAAI,CAAC,iBAAiB,KAAK,GAAG,CAAC,iBAAiB,IAAI,IAAI,CAAC,OAAO,KAAK,GAAG,CAAC,OAAO;eACtI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACtJ,CAAC;CACF;AAlGD,sCAkGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module DisplayStyles\n */\n\nimport { assert, JsonUtils } from \"@itwin/core-bentley\";\nimport { Vector3d, XYZProps } from \"@itwin/core-geometry\";\nimport { RgbColor, RgbColorProps } from \"./RgbColor\";\n\nfunction extractIntensity(value: number | undefined, defaultValue: number) {\n const maxIntensity = 5;\n return typeof value === \"number\" ? Math.max(0, Math.min(maxIntensity, value)) : defaultValue;\n}\n\n/** Wire format for the solar directional light associated with a [[LightSettingsProps]].\n * The light is colored white and oriented in any direction in world coordinates.\n * It will cast shadows if it is above the world XY plane and if the shadows view flag is enabled for the view.\n * By default, the solar light is only applied when shadows are enabled, but can be set to be applied unconditionally.\n * @public\n * @extensions\n */\nexport interface SolarLightProps {\n /** Intensity of the light, typically in [0..1] but can range up to 5. Default: 1.0 */\n intensity?: number;\n /** Direction of the light in world coordinates. Defaults to a vector looking down on the scene at a 45 degree angle mostly along the Y axis. */\n direction?: XYZProps;\n /** If true, the light will be applied even when shadows are turned off for the view.\n * If false, a roughly overhead light of the same intensity oriented in view space will be used instead.\n * Default: false.\n */\n alwaysEnabled?: boolean;\n /** If defined, the time in UNIX milliseconds from which [[direction]] was calculated.\n * @see [[DisplayStyleSettings.setSunTime]] to compute the solar direction from a point in time.\n */\n timePoint?: number;\n}\n\nconst defaultSolarDirection = Vector3d.create(0.272166, 0.680414, 0.680414);\n\n/** Describes the solar directional light associated with a [[LightSettings]].\n * @see [[SolarLightProps]].\n * @public\n */\nexport class SolarLight {\n /** Direction of the light in world coordinates. Defaults to a vector looking down on the scene at a 45 degree angle mostly along the Y axis. */\n public readonly direction: Readonly<Vector3d>;\n /** Intensity of the light, typically in [0..1] but can range up to 5. Default: 1.0 */\n public readonly intensity: number;\n /** If true, the light will be applied even when shadows are turned off for the view.\n * If false, a roughly overhead light of the same intensity oriented in view space will be used instead.\n * Default: false.\n */\n public readonly alwaysEnabled: boolean;\n /** If defined, the time in UNIX milliseconds from which [[direction]] was calculated.\n * @see [[DisplayStyleSettings.setSunTime]] to compute the solar direction from a point in time.\n */\n public readonly timePoint?: number;\n\n public constructor(json?: SolarLightProps) {\n json = json || {};\n this.intensity = extractIntensity(json.intensity, 1);\n this.alwaysEnabled = JsonUtils.asBool(json.alwaysEnabled);\n\n if (json.direction)\n this.direction = Vector3d.fromJSON(json.direction);\n else\n this.direction = defaultSolarDirection.clone();\n\n if (typeof json.timePoint === \"number\")\n this.timePoint = json.timePoint;\n }\n\n public toJSON(): SolarLightProps | undefined {\n const direction = this.direction.isAlmostEqual(defaultSolarDirection) ? undefined : this.direction.toJSON();\n const intensity = this.intensity !== 1 ? this.intensity : undefined;\n const alwaysEnabled = this.alwaysEnabled ? true : undefined;\n const timePoint = this.timePoint;\n\n if (undefined === direction && undefined === intensity && undefined === alwaysEnabled && undefined === timePoint)\n return undefined;\n\n const json: SolarLightProps = {};\n if (direction)\n json.direction = direction;\n\n if (undefined !== intensity)\n json.intensity = intensity;\n\n if (undefined !== alwaysEnabled)\n json.alwaysEnabled = alwaysEnabled;\n\n if (undefined !== timePoint)\n json.timePoint = timePoint;\n\n return json;\n }\n\n /** Create a copy of this SolarLight, identical except in any properties explicitly specified by `changedProps`, with a possible exception for [[timePoint]].\n * If `this.timePoint` is defined and `changedProps` defines `direction` but **doesn't** define `timePoint`, the time point will only be preserved in the\n * copy if `changesProps.direction` is equal to `this.direction`.\n */\n public clone(changedProps?: SolarLightProps): SolarLight {\n if (!changedProps)\n return this;\n\n const props = this.toJSON() ?? {};\n if (undefined !== changedProps.direction)\n props.direction = changedProps.direction;\n\n if (undefined !== changedProps.intensity)\n props.intensity = changedProps.intensity;\n\n if (undefined !== changedProps.alwaysEnabled)\n props.alwaysEnabled = changedProps.alwaysEnabled;\n\n if (undefined !== changedProps.timePoint)\n props.timePoint = changedProps.timePoint;\n\n // If our direction was computed from a time point and the caller only supplies a direction, invalidate the time point unless the input direction matches our direction.\n // If caller explicitly supplied a timePoint, trust it.\n if (undefined !== this.timePoint && undefined === changedProps.timePoint && undefined !== changedProps.direction) {\n const newDirection = Vector3d.fromJSON(changedProps.direction);\n if (!newDirection.isAlmostEqual(this.direction))\n props.timePoint = undefined;\n }\n\n return new SolarLight(props);\n }\n\n public equals(rhs: SolarLight): boolean {\n return this.intensity === rhs.intensity && this.alwaysEnabled === rhs.alwaysEnabled && this.direction.isExactEqual(rhs.direction) && this.timePoint === rhs.timePoint;\n }\n}\n\n/** Wire format for the ambient light associated with a [[LightSettingsProps]].\n * Ambient light applies equally to all surfaces in the scene.\n * @public\n * @extensions\n */\nexport interface AmbientLightProps {\n /** The color of the light. Black is treated as a special case, indicating that the surface's own diffuse color should be used. */\n color?: RgbColorProps;\n /** The intensity of the light. Default: 0.2. */\n intensity?: number;\n}\n\n/** Describes the ambient light associated with a [[LightSettings]].\n * @see [[AmbientLightProps]]\n * @public\n */\nexport class AmbientLight {\n public readonly color: RgbColor;\n public readonly intensity: number;\n\n public constructor(json?: AmbientLightProps) {\n json = json || {};\n this.intensity = extractIntensity(json.intensity, 0.2);\n this.color = json.color ? RgbColor.fromJSON(json.color) : new RgbColor(0, 0, 0);\n }\n\n public toJSON(): AmbientLightProps | undefined {\n const color = this.color.r !== 0 || this.color.g !== 0 || this.color.b !== 0 ? this.color.toJSON() : undefined;\n const intensity = 0.2 !== this.intensity ? this.intensity : undefined;\n if (undefined === color && undefined === intensity)\n return undefined;\n\n const json: AmbientLightProps = {};\n if (color)\n json.color = color;\n\n if (undefined !== intensity)\n json.intensity = intensity;\n\n return json;\n }\n\n /** Create a copy of this light, identical except for any properties explicitly specified by `changed`. */\n public clone(changed?: AmbientLightProps): AmbientLight {\n if (!changed)\n return this;\n\n const props = this.toJSON() ?? {};\n if (undefined !== changed.intensity)\n props.intensity = changed.intensity;\n\n if (undefined !== changed.color)\n props.color = changed.color;\n\n return new AmbientLight(props);\n }\n\n public equals(rhs: AmbientLight): boolean {\n return this.intensity === rhs.intensity && this.color.equals(rhs.color);\n }\n}\n\n/** Wire format for a pair of hemisphere lights associated with a [[LightSettingsProps]].\n * Hemisphere lights are oriented in opposite directions along the world Z axis. Each has its own color; they share one intensity.\n * They are often used to simulate outdoor reflection of light from the ground and sky, so the colors often match the ground and sky colors\n * of the [[SkyBox]].\n * @public\n * @extensions\n */\nexport interface HemisphereLightsProps {\n /** The color of the downward-facing light. Default: (143, 205, 255). */\n upperColor?: RgbColorProps;\n /** The color of the upward-facing light. Default: (120, 143, 125). */\n lowerColor?: RgbColorProps;\n /** Intensity of the lights. Default: 0. */\n intensity?: number;\n}\n\nconst defaultUpperHemisphereColor = new RgbColor(143, 205, 255);\nconst defaultLowerHemisphereColor = new RgbColor(120, 143, 125);\n\n/** Describes a pair of hemisphere lights associated with a [[LightSettings]].\n * @see [[HemisphereLightsProps]]\n * @public\n */\nexport class HemisphereLights {\n public readonly upperColor: RgbColor;\n public readonly lowerColor: RgbColor;\n public readonly intensity: number;\n\n public constructor(json?: HemisphereLightsProps) {\n json = json || {};\n this.intensity = extractIntensity(json.intensity, 0);\n this.upperColor = json.upperColor ? RgbColor.fromJSON(json.upperColor) : defaultUpperHemisphereColor;\n this.lowerColor = json.lowerColor ? RgbColor.fromJSON(json.lowerColor) : defaultLowerHemisphereColor;\n }\n\n public toJSON(): HemisphereLightsProps | undefined {\n const upperColor = this.upperColor.equals(defaultUpperHemisphereColor) ? undefined : this.upperColor.toJSON();\n const lowerColor = this.lowerColor.equals(defaultLowerHemisphereColor) ? undefined : this.lowerColor.toJSON();\n const intensity = 0 === this.intensity ? undefined : this.intensity;\n\n if (undefined === upperColor && undefined === lowerColor && undefined === intensity)\n return undefined;\n\n const json: HemisphereLightsProps = {};\n if (upperColor)\n json.upperColor = upperColor;\n\n if (lowerColor)\n json.lowerColor = lowerColor;\n\n if (undefined !== intensity)\n json.intensity = intensity;\n\n return json;\n }\n\n /** Create a copy of these lights, identical except for any properties explicitly specified by `changed`. */\n public clone(changed?: HemisphereLightsProps): HemisphereLights {\n if (!changed)\n return this;\n\n const props = this.toJSON() || {};\n if (undefined !== changed.upperColor)\n props.upperColor = changed.upperColor;\n\n if (undefined !== changed.lowerColor)\n props.lowerColor = changed.lowerColor;\n\n if (undefined !== changed.intensity)\n props.intensity = changed.intensity;\n\n return new HemisphereLights(props);\n }\n\n public equals(rhs: HemisphereLights): boolean {\n return this.intensity === rhs.intensity && this.upperColor.equals(rhs.upperColor) && this.lowerColor.equals(rhs.lowerColor);\n }\n}\n\n/** JSON representation of a [[FresnelSettings]].\n * @public\n * @extensions\n */\nexport interface FresnelSettingsProps {\n /** See [[FresnelSettings.intensity]].\n * Default value: 0\n */\n intensity?: number;\n\n /** See [[FresnelSettings.invert]].\n * Default value: false\n */\n invert?: boolean;\n}\n\nfunction clampIntensity(intensity = 0): number {\n return Math.max(intensity, 0);\n}\n\n/** As part of a [[LightSettings]], describes how to apply a Fresnel effect to the contents of the view.\n * The \"Fresnel effect\" is based on the observation that the reflectivity of a surface varies based on the angle between the surface and\n * the viewer's line of sight. For example, a flat surface will appear more reflective when viewed at a glancing angle than it will when\n * viewed from above; and a sphere will appear more reflective around its edges than at its center.\n *\n * This principle can be used to improve photorealism, but the implementation provided here is intended to produce non-realistic but\n * aesthetically-pleasing results.\n * @see [[LightSettings.fresnel]].\n * @public\n */\nexport class FresnelSettings {\n /** The strength of the effect in terms of how much brighter the surface becomes. The intensity at a given point on the surface is determined by\n * the angle between the viewer's line of sight and the vector from the viewer to that point. Maximum intensity is produced when those vectors are\n * perpendicular, and zero intensity is produced when those vectors are parallel (unless [[invert]] is `true`).\n *\n * A value of zero turns off the effect. Values less than zero are clamped to zero. Typical values range between 0 and 1.\n */\n public readonly intensity: number;\n /** If true, inverts the effect's [[intensity]] such that maximum intensity is produced when the viewer's line of sight is parallel to the vector between\n * the viewer and the point on the surface, and zero intensity is produced when the viewer's line of sight is perpendicular to that vector.\n */\n public readonly invert: boolean;\n\n private constructor(intensity: number, invert: boolean) {\n assert(intensity >= 0);\n this.intensity = intensity;\n this.invert = invert;\n }\n\n private static readonly _defaults = new FresnelSettings(0, false);\n\n /** Create from JSON representation, using default values for any unspecified or `undefined` properties. */\n public static fromJSON(props?: FresnelSettingsProps): FresnelSettings {\n const intensity = clampIntensity(JsonUtils.asDouble(props?.intensity));\n const invert = JsonUtils.asBool(props?.invert);\n if (0 === intensity && !invert)\n return this._defaults;\n\n return new this(intensity, invert);\n }\n\n /** Create a new FresnelSettings.\n * @note Intensity values less than zero will be set to zero.\n */\n public static create(intensity = 0, invert = false): FresnelSettings {\n return this.fromJSON({ intensity, invert });\n }\n\n /** Convert to JSON representation.\n * @note If all settings match the default values, `undefined` will be returned.\n */\n public toJSON(): FresnelSettingsProps | undefined {\n if (0 === this.intensity && !this.invert)\n return undefined;\n\n const props: FresnelSettingsProps = {};\n if (0 !== this.intensity)\n props.intensity = this.intensity;\n\n if (this.invert)\n props.invert = true;\n\n return props;\n }\n\n /** Create a copy of these settings, modified to match any properties explicitly specified by `changedProps`. */\n public clone(changedProps?: FresnelSettingsProps): FresnelSettings {\n if ((undefined === changedProps?.intensity || changedProps.intensity === this.intensity)\n && (undefined === changedProps?.invert || changedProps.invert === this.invert))\n return this;\n\n const intensity = changedProps?.intensity ?? this.intensity;\n const invert = changedProps?.invert ?? this.invert;\n return FresnelSettings.fromJSON({ intensity, invert });\n }\n\n /** Return true if these settings are equivalent to `rhs`. */\n public equals(rhs: FresnelSettings): boolean {\n return this === rhs || (this.intensity === rhs.intensity && this.invert === rhs.invert);\n }\n}\n\n/** Wire format for a [[LightSettings]] describing lighting for a 3d scene.\n * 3d lighting provides the following lights, all of which are optional:\n * - A \"portrait\" light affixed to the camera and pointing directly forward into the scene. Color: white.\n * - A second directional light. Color: white.\n * - This can be a solar shadow-casting light, or (when shadows are disabled) a roughly overhead light oriented in view space.\n * - A pair of hemisphere lights pointing in opposite directions along the world Z axis. Each has its own customizable color.\n * - An ambient light of any color applied equally to all surfaces.\n * Specular intensity of all lights is controlled separately.\n * Light intensities are typically expressed in [0..1] but can be as large as 5.\n * @see [[DisplayStyle3dSettingsProps]]\n * @public\n * @extensions\n */\nexport interface LightSettingsProps {\n /** A white portrait light affixed to the camera and pointing directly forward into the scene. */\n portrait?: {\n /** Intensity, typically in [0..1], maximum 5. Default: 0.3. */\n intensity?: number;\n };\n /** Solar light settings. */\n solar?: SolarLightProps;\n /** Hemisphere light settings. */\n hemisphere?: HemisphereLightsProps;\n /** Ambient light settings. */\n ambient?: AmbientLightProps;\n /** Specular intensity applied to all lights. */\n specularIntensity?: number;\n /** Applies a [cel-shaded](https://en.wikipedia.org/wiki/Cel_shading) effect. If greater than zero, specifies the number of cels. Continuous lighting intensities\n * are computed, then quantized to the specified number of cels. Values greater than 254 have no visible effect.\n * Typically a value of 2 is appropriate if specular intensity is close to zero; 3 if specular intensity is larger.\n * Cel-shading is often combined with thick, dark visible edges for a cartoon or comic book effect.\n * Default: 0\n */\n numCels?: number;\n\n /** Fresnel settings.\n * @see [[FresnelSettings]].\n */\n fresnel?: FresnelSettingsProps;\n}\n\n/** Describes the lighting for a 3d scene, associated with a [[DisplayStyle3dSettings]] in turn associated with a [DisplayStyle3d]($backend) or [DisplayStyle3dState]($frontend).\n * @see [[LightSettingsProps]]\n * @public\n */\nexport class LightSettings {\n public readonly solar: SolarLight;\n public readonly ambient: AmbientLight;\n public readonly hemisphere: HemisphereLights;\n /** See [[LightSettingsProps.portrait]]. */\n public readonly portraitIntensity: number;\n public readonly specularIntensity: number;\n /** See [[LightSettingsProps.numCels]]. */\n public readonly numCels: number;\n public readonly fresnel: FresnelSettings;\n\n private constructor(solar: SolarLight, ambient: AmbientLight, hemisphere: HemisphereLights, portraitIntensity: number, specularIntensity: number, numCels: number,\n fresnel: FresnelSettings) {\n this.solar = solar;\n this.ambient = ambient;\n this.hemisphere = hemisphere;\n this.portraitIntensity = portraitIntensity;\n this.specularIntensity = specularIntensity;\n this.numCels = numCels;\n this.fresnel = fresnel;\n }\n\n public static fromJSON(props?: LightSettingsProps): LightSettings {\n const solar = new SolarLight(props?.solar);\n const ambient = new AmbientLight(props?.ambient);\n const hemisphere = new HemisphereLights(props?.hemisphere);\n const portraitIntensity = extractIntensity(props?.portrait?.intensity, 0.3);\n const specularIntensity = extractIntensity(props?.specularIntensity, 1.0);\n const numCels = JsonUtils.asInt(props?.numCels, 0);\n const fresnel = FresnelSettings.fromJSON(props?.fresnel);\n\n return new LightSettings(solar, ambient, hemisphere, portraitIntensity, specularIntensity, numCels, fresnel);\n }\n\n public toJSON(): LightSettingsProps | undefined {\n const solar = this.solar.toJSON();\n const ambient = this.ambient.toJSON();\n const hemisphere = this.hemisphere.toJSON();\n const portrait = 0.3 !== this.portraitIntensity ? { intensity: this.portraitIntensity } : undefined;\n const specularIntensity = 1 !== this.specularIntensity ? this.specularIntensity : undefined;\n const numCels = 0 !== this.numCels ? this.numCels : undefined;\n const fresnel = this.fresnel.toJSON();\n\n if (!solar && !ambient && !hemisphere && !portrait && undefined === specularIntensity && undefined === numCels && undefined === fresnel)\n return undefined;\n\n const json: LightSettingsProps = {};\n if (solar)\n json.solar = solar;\n\n if (ambient)\n json.ambient = ambient;\n\n if (hemisphere)\n json.hemisphere = hemisphere;\n\n if (portrait)\n json.portrait = portrait;\n\n if (undefined !== specularIntensity)\n json.specularIntensity = specularIntensity;\n\n if (undefined !== numCels)\n json.numCels = numCels;\n\n if (fresnel)\n json.fresnel = fresnel;\n\n return json;\n }\n\n /** Create a copy of these light settings, identical except for any properties explicitly specified by `changed`.\n * Note that the solar, ambient, and hemisphere lights will also be cloned using their own `clone` methods - so for example, the following:\n * ` clone({ ambient: { intensity: 0.5 } })`\n * will overwrite the ambient light's intensity but preserve its current color, rather than replacing the color with the default color.\n */\n public clone(changed?: LightSettingsProps): LightSettings {\n if (!changed)\n return this;\n\n const solar = this.solar.clone(changed.solar);\n const ambient = this.ambient.clone(changed.ambient);\n const hemisphere = this.hemisphere.clone(changed.hemisphere);\n const portrait = changed.portrait?.intensity ?? this.portraitIntensity;\n const specular = changed.specularIntensity ?? this.specularIntensity;\n const numCels = changed.numCels ?? this.numCels;\n const fresnel = this.fresnel.clone(changed.fresnel);\n\n return new LightSettings(solar, ambient, hemisphere, portrait, specular, numCels, fresnel);\n }\n\n public equals(rhs: LightSettings): boolean {\n if (this === rhs)\n return true;\n\n return this.portraitIntensity === rhs.portraitIntensity && this.specularIntensity === rhs.specularIntensity && this.numCels === rhs.numCels\n && this.ambient.equals(rhs.ambient) && this.solar.equals(rhs.solar) && this.hemisphere.equals(rhs.hemisphere) && this.fresnel.equals(rhs.fresnel);\n }\n}\n"]}
1
+ {"version":3,"file":"LightSettings.js","sourceRoot":"","sources":["../../src/LightSettings.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAwD;AACxD,wDAA0D;AAC1D,yCAAqD;AAErD,SAAS,gBAAgB,CAA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AAC;QAEpD,OAAO,IAAI,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC7F,CAAC;IAEM,MAAM,CAAC,GAAkB;QAC9B,IAAI,IAAI,KAAK,GAAG;YACd,OAAO,IAAI,CAAC;QAEd,OAAO,IAAI,CAAC,iBAAiB,KAAK,GAAG,CAAC,iBAAiB,IAAI,IAAI,CAAC,iBAAiB,KAAK,GAAG,CAAC,iBAAiB,IAAI,IAAI,CAAC,OAAO,KAAK,GAAG,CAAC,OAAO;eACtI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACtJ,CAAC;CACF;AAlGD,sCAkGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module DisplayStyles\n */\n\nimport { assert, JsonUtils } from \"@itwin/core-bentley\";\nimport { Vector3d, XYZProps } from \"@itwin/core-geometry\";\nimport { RgbColor, RgbColorProps } from \"./RgbColor\";\n\nfunction extractIntensity(value: number | undefined, defaultValue: number) {\n const maxIntensity = 5;\n return typeof value === \"number\" ? Math.max(0, Math.min(maxIntensity, value)) : defaultValue;\n}\n\n/** Wire format for the solar directional light associated with a [[LightSettingsProps]].\n * The light is colored white and oriented in any direction in world coordinates.\n * It will cast shadows if it is above the world XY plane and if the shadows view flag is enabled for the view.\n * By default, the solar light is only applied when shadows are enabled, but can be set to be applied unconditionally.\n * @public\n * @extensions\n */\nexport interface SolarLightProps {\n /** Intensity of the light, typically in [0..1] but can range up to 5. Default: 1.0 */\n intensity?: number;\n /** Direction of the light in world coordinates. Defaults to a vector looking down on the scene at a 45 degree angle mostly along the Y axis. */\n direction?: XYZProps;\n /** If true, the light will be applied even when shadows are turned off for the view.\n * If false, a roughly overhead light of the same intensity oriented in view space will be used instead.\n * Default: false.\n */\n alwaysEnabled?: boolean;\n /** If defined, the time in UNIX milliseconds from which [[direction]] was calculated.\n * @see [[DisplayStyleSettings.setSunTime]] to compute the solar direction from a point in time.\n */\n timePoint?: number;\n}\n\nconst defaultSolarDirection = Vector3d.create(0.272166, 0.680414, 0.680414);\n\n/** Describes the solar directional light associated with a [[LightSettings]].\n * @see [[SolarLightProps]].\n * @public\n */\nexport class SolarLight {\n /** Direction of the light in world coordinates. Defaults to a vector looking down on the scene at a 45 degree angle mostly along the Y axis. */\n public readonly direction: Readonly<Vector3d>;\n /** Intensity of the light, typically in [0..1] but can range up to 5. Default: 1.0 */\n public readonly intensity: number;\n /** If true, the light will be applied even when shadows are turned off for the view.\n * If false, a roughly overhead light of the same intensity oriented in view space will be used instead.\n * Default: false.\n */\n public readonly alwaysEnabled: boolean;\n /** If defined, the time in UNIX milliseconds from which [[direction]] was calculated.\n * @see [[DisplayStyleSettings.setSunTime]] to compute the solar direction from a point in time.\n */\n public readonly timePoint?: number;\n\n public constructor(json?: SolarLightProps) {\n json = json || {};\n this.intensity = extractIntensity(json.intensity, 1);\n this.alwaysEnabled = JsonUtils.asBool(json.alwaysEnabled);\n\n if (json.direction)\n this.direction = Vector3d.fromJSON(json.direction);\n else\n this.direction = defaultSolarDirection.clone();\n\n if (typeof json.timePoint === \"number\")\n this.timePoint = json.timePoint;\n }\n\n public toJSON(): SolarLightProps | undefined {\n const direction = this.direction.isAlmostEqual(defaultSolarDirection) ? undefined : this.direction.toJSON();\n const intensity = this.intensity !== 1 ? this.intensity : undefined;\n const alwaysEnabled = this.alwaysEnabled ? true : undefined;\n const timePoint = this.timePoint;\n\n if (undefined === direction && undefined === intensity && undefined === alwaysEnabled && undefined === timePoint)\n return undefined;\n\n const json: SolarLightProps = {};\n if (direction)\n json.direction = direction;\n\n if (undefined !== intensity)\n json.intensity = intensity;\n\n if (undefined !== alwaysEnabled)\n json.alwaysEnabled = alwaysEnabled;\n\n if (undefined !== timePoint)\n json.timePoint = timePoint;\n\n return json;\n }\n\n /** Create a copy of this SolarLight, identical except in any properties explicitly specified by `changedProps`, with a possible exception for [[timePoint]].\n * If `this.timePoint` is defined and `changedProps` defines `direction` but **doesn't** define `timePoint`, the time point will only be preserved in the\n * copy if `changesProps.direction` is equal to `this.direction`.\n */\n public clone(changedProps?: SolarLightProps): SolarLight {\n if (!changedProps)\n return this;\n\n const props = this.toJSON() ?? {};\n if (undefined !== changedProps.direction)\n props.direction = changedProps.direction;\n\n if (undefined !== changedProps.intensity)\n props.intensity = changedProps.intensity;\n\n if (undefined !== changedProps.alwaysEnabled)\n props.alwaysEnabled = changedProps.alwaysEnabled;\n\n if (undefined !== changedProps.timePoint)\n props.timePoint = changedProps.timePoint;\n\n // If our direction was computed from a time point and the caller only supplies a direction, invalidate the time point unless the input direction matches our direction.\n // If caller explicitly supplied a timePoint, trust it.\n if (undefined !== this.timePoint && undefined === changedProps.timePoint && undefined !== changedProps.direction) {\n const newDirection = Vector3d.fromJSON(changedProps.direction);\n if (!newDirection.isAlmostEqual(this.direction))\n props.timePoint = undefined;\n }\n\n return new SolarLight(props);\n }\n\n public equals(rhs: SolarLight): boolean {\n return this.intensity === rhs.intensity && this.alwaysEnabled === rhs.alwaysEnabled && this.direction.isExactEqual(rhs.direction) && this.timePoint === rhs.timePoint;\n }\n}\n\n/** Wire format for the ambient light associated with a [[LightSettingsProps]].\n * Ambient light applies equally to all surfaces in the scene.\n * @public\n * @extensions\n */\nexport interface AmbientLightProps {\n /** The color of the light. Black is treated as a special case, indicating that the surface's own diffuse color should be used. */\n color?: RgbColorProps;\n /** The intensity of the light. Default: 0.2. */\n intensity?: number;\n}\n\n/** Describes the ambient light associated with a [[LightSettings]].\n * @see [[AmbientLightProps]]\n * @public\n */\nexport class AmbientLight {\n public readonly color: RgbColor;\n public readonly intensity: number;\n\n public constructor(json?: AmbientLightProps) {\n json = json || {};\n this.intensity = extractIntensity(json.intensity, 0.2);\n this.color = json.color ? RgbColor.fromJSON(json.color) : new RgbColor(0, 0, 0);\n }\n\n public toJSON(): AmbientLightProps | undefined {\n const color = this.color.r !== 0 || this.color.g !== 0 || this.color.b !== 0 ? this.color.toJSON() : undefined;\n const intensity = 0.2 !== this.intensity ? this.intensity : undefined;\n if (undefined === color && undefined === intensity)\n return undefined;\n\n const json: AmbientLightProps = {};\n if (color)\n json.color = color;\n\n if (undefined !== intensity)\n json.intensity = intensity;\n\n return json;\n }\n\n /** Create a copy of this light, identical except for any properties explicitly specified by `changed`. */\n public clone(changed?: AmbientLightProps): AmbientLight {\n if (!changed)\n return this;\n\n const props = this.toJSON() ?? {};\n if (undefined !== changed.intensity)\n props.intensity = changed.intensity;\n\n if (undefined !== changed.color)\n props.color = changed.color;\n\n return new AmbientLight(props);\n }\n\n public equals(rhs: AmbientLight): boolean {\n return this.intensity === rhs.intensity && this.color.equals(rhs.color);\n }\n}\n\n/** Wire format for a pair of hemisphere lights associated with a [[LightSettingsProps]].\n * Hemisphere lights are oriented in opposite directions along the world Z axis. Each has its own color; they share one intensity.\n * They are often used to simulate outdoor reflection of light from the ground and sky, so the colors often match the ground and sky colors\n * of the [[SkyBox]].\n * @public\n * @extensions\n */\nexport interface HemisphereLightsProps {\n /** The color of the downward-facing light. Default: (143, 205, 255). */\n upperColor?: RgbColorProps;\n /** The color of the upward-facing light. Default: (120, 143, 125). */\n lowerColor?: RgbColorProps;\n /** Intensity of the lights. Default: 0. */\n intensity?: number;\n}\n\nconst defaultUpperHemisphereColor = new RgbColor(143, 205, 255);\nconst defaultLowerHemisphereColor = new RgbColor(120, 143, 125);\n\n/** Describes a pair of hemisphere lights associated with a [[LightSettings]].\n * @see [[HemisphereLightsProps]]\n * @public\n */\nexport class HemisphereLights {\n public readonly upperColor: RgbColor;\n public readonly lowerColor: RgbColor;\n public readonly intensity: number;\n\n public constructor(json?: HemisphereLightsProps) {\n json = json || {};\n this.intensity = extractIntensity(json.intensity, 0);\n this.upperColor = json.upperColor ? RgbColor.fromJSON(json.upperColor) : defaultUpperHemisphereColor;\n this.lowerColor = json.lowerColor ? RgbColor.fromJSON(json.lowerColor) : defaultLowerHemisphereColor;\n }\n\n public toJSON(): HemisphereLightsProps | undefined {\n const upperColor = this.upperColor.equals(defaultUpperHemisphereColor) ? undefined : this.upperColor.toJSON();\n const lowerColor = this.lowerColor.equals(defaultLowerHemisphereColor) ? undefined : this.lowerColor.toJSON();\n const intensity = 0 === this.intensity ? undefined : this.intensity;\n\n if (undefined === upperColor && undefined === lowerColor && undefined === intensity)\n return undefined;\n\n const json: HemisphereLightsProps = {};\n if (upperColor)\n json.upperColor = upperColor;\n\n if (lowerColor)\n json.lowerColor = lowerColor;\n\n if (undefined !== intensity)\n json.intensity = intensity;\n\n return json;\n }\n\n /** Create a copy of these lights, identical except for any properties explicitly specified by `changed`. */\n public clone(changed?: HemisphereLightsProps): HemisphereLights {\n if (!changed)\n return this;\n\n const props = this.toJSON() || {};\n if (undefined !== changed.upperColor)\n props.upperColor = changed.upperColor;\n\n if (undefined !== changed.lowerColor)\n props.lowerColor = changed.lowerColor;\n\n if (undefined !== changed.intensity)\n props.intensity = changed.intensity;\n\n return new HemisphereLights(props);\n }\n\n public equals(rhs: HemisphereLights): boolean {\n return this.intensity === rhs.intensity && this.upperColor.equals(rhs.upperColor) && this.lowerColor.equals(rhs.lowerColor);\n }\n}\n\n/** JSON representation of a [[FresnelSettings]].\n * @public\n * @extensions\n */\nexport interface FresnelSettingsProps {\n /** See [[FresnelSettings.intensity]].\n * Default value: 0\n */\n intensity?: number;\n\n /** See [[FresnelSettings.invert]].\n * Default value: false\n */\n invert?: boolean;\n}\n\nfunction clampIntensity(intensity = 0): number {\n return Math.max(intensity, 0);\n}\n\n/** As part of a [[LightSettings]], describes how to apply a Fresnel effect to the contents of the view.\n * The \"Fresnel effect\" is based on the observation that the reflectivity of a surface varies based on the angle between the surface and\n * the viewer's line of sight. For example, a flat surface will appear more reflective when viewed at a glancing angle than it will when\n * viewed from above; and a sphere will appear more reflective around its edges than at its center.\n *\n * This principle can be used to improve photorealism, but the implementation provided here is intended to produce non-realistic but\n * aesthetically-pleasing results.\n * @see [[LightSettings.fresnel]].\n * @public\n */\nexport class FresnelSettings {\n /** The strength of the effect in terms of how much brighter the surface becomes. The intensity at a given point on the surface is determined by\n * the angle between the viewer's line of sight and the vector from the viewer to that point. Maximum intensity is produced when those vectors are\n * perpendicular, and zero intensity is produced when those vectors are parallel (unless [[invert]] is `true`).\n *\n * A value of zero turns off the effect. Values less than zero are clamped to zero. Typical values range between 0 and 1.\n */\n public readonly intensity: number;\n /** If true, inverts the effect's [[intensity]] such that maximum intensity is produced when the viewer's line of sight is parallel to the vector between\n * the viewer and the point on the surface, and zero intensity is produced when the viewer's line of sight is perpendicular to that vector.\n */\n public readonly invert: boolean;\n\n private constructor(intensity: number, invert: boolean) {\n assert(intensity >= 0);\n this.intensity = intensity;\n this.invert = invert;\n }\n\n private static readonly _defaults = new FresnelSettings(0, false);\n\n /** Create from JSON representation, using default values for any unspecified or `undefined` properties. */\n public static fromJSON(props?: FresnelSettingsProps): FresnelSettings {\n const intensity = clampIntensity(JsonUtils.asDouble(props?.intensity));\n const invert = JsonUtils.asBool(props?.invert);\n if (0 === intensity && !invert)\n return this._defaults;\n\n return new this(intensity, invert);\n }\n\n /** Create a new FresnelSettings.\n * @note Intensity values less than zero will be set to zero.\n */\n public static create(intensity = 0, invert = false): FresnelSettings {\n return this.fromJSON({ intensity, invert });\n }\n\n /** Convert to JSON representation.\n * @note If all settings match the default values, `undefined` will be returned.\n */\n public toJSON(): FresnelSettingsProps | undefined {\n if (0 === this.intensity && !this.invert)\n return undefined;\n\n const props: FresnelSettingsProps = {};\n if (0 !== this.intensity)\n props.intensity = this.intensity;\n\n if (this.invert)\n props.invert = true;\n\n return props;\n }\n\n /** Create a copy of these settings, modified to match any properties explicitly specified by `changedProps`. */\n public clone(changedProps?: FresnelSettingsProps): FresnelSettings {\n if ((undefined === changedProps?.intensity || changedProps.intensity === this.intensity)\n && (undefined === changedProps?.invert || changedProps.invert === this.invert))\n return this;\n\n const intensity = changedProps?.intensity ?? this.intensity;\n const invert = changedProps?.invert ?? this.invert;\n return FresnelSettings.fromJSON({ intensity, invert });\n }\n\n /** Return true if these settings are equivalent to `rhs`. */\n public equals(rhs: FresnelSettings): boolean {\n return this === rhs || (this.intensity === rhs.intensity && this.invert === rhs.invert);\n }\n}\n\n/** Wire format for a [[LightSettings]] describing lighting for a 3d scene.\n * 3d lighting provides the following lights, all of which are optional:\n * - A \"portrait\" light affixed to the camera and pointing directly forward into the scene. Color: white.\n * - A second directional light. Color: white.\n * - This can be a solar shadow-casting light, or (when shadows are disabled) a roughly overhead light oriented in view space.\n * - A pair of hemisphere lights pointing in opposite directions along the world Z axis. Each has its own customizable color.\n * - An ambient light of any color applied equally to all surfaces.\n * Specular intensity of all lights is controlled separately.\n * Light intensities are typically expressed in [0..1] but can be as large as 5.\n * @see [[DisplayStyle3dSettingsProps]]\n * @public\n * @extensions\n */\nexport interface LightSettingsProps {\n /** A white portrait light affixed to the camera and pointing directly forward into the scene. */\n portrait?: {\n /** Intensity, typically in [0..1], maximum 5. Default: 0.3. */\n intensity?: number;\n };\n /** Solar light settings. */\n solar?: SolarLightProps;\n /** Hemisphere light settings. */\n hemisphere?: HemisphereLightsProps;\n /** Ambient light settings. */\n ambient?: AmbientLightProps;\n /** Specular intensity applied to all lights. */\n specularIntensity?: number;\n /** Applies a [cel-shaded](https://en.wikipedia.org/wiki/Cel_shading) effect. If greater than zero, specifies the number of cels. Continuous lighting intensities\n * are computed, then quantized to the specified number of cels. Values greater than 254 have no visible effect.\n * Typically a value of 2 is appropriate if specular intensity is close to zero; 3 if specular intensity is larger.\n * Cel-shading is often combined with thick, dark visible edges for a cartoon or comic book effect.\n * Default: 0\n */\n numCels?: number;\n\n /** Fresnel settings.\n * @see [[FresnelSettings]].\n */\n fresnel?: FresnelSettingsProps;\n}\n\n/** Describes the lighting for a 3d scene, associated with a [[DisplayStyle3dSettings]] in turn associated with a [DisplayStyle3d]($backend) or [DisplayStyle3dState]($frontend).\n * @see [[LightSettingsProps]]\n * @public\n */\nexport class LightSettings {\n public readonly solar: SolarLight;\n public readonly ambient: AmbientLight;\n public readonly hemisphere: HemisphereLights;\n /** See [[LightSettingsProps.portrait]]. */\n public readonly portraitIntensity: number;\n public readonly specularIntensity: number;\n /** See [[LightSettingsProps.numCels]]. */\n public readonly numCels: number;\n public readonly fresnel: FresnelSettings;\n\n private constructor(solar: SolarLight, ambient: AmbientLight, hemisphere: HemisphereLights, portraitIntensity: number, specularIntensity: number, numCels: number,\n fresnel: FresnelSettings) {\n this.solar = solar;\n this.ambient = ambient;\n this.hemisphere = hemisphere;\n this.portraitIntensity = portraitIntensity;\n this.specularIntensity = specularIntensity;\n this.numCels = numCels;\n this.fresnel = fresnel;\n }\n\n public static fromJSON(props?: LightSettingsProps): LightSettings {\n const solar = new SolarLight(props?.solar);\n const ambient = new AmbientLight(props?.ambient);\n const hemisphere = new HemisphereLights(props?.hemisphere);\n const portraitIntensity = extractIntensity(props?.portrait?.intensity, 0.3);\n const specularIntensity = extractIntensity(props?.specularIntensity, 1.0);\n const numCels = JsonUtils.asInt(props?.numCels, 0);\n const fresnel = FresnelSettings.fromJSON(props?.fresnel);\n\n return new LightSettings(solar, ambient, hemisphere, portraitIntensity, specularIntensity, numCels, fresnel);\n }\n\n public toJSON(): LightSettingsProps | undefined {\n const solar = this.solar.toJSON();\n const ambient = this.ambient.toJSON();\n const hemisphere = this.hemisphere.toJSON();\n const portrait = 0.3 !== this.portraitIntensity ? { intensity: this.portraitIntensity } : undefined;\n const specularIntensity = 1 !== this.specularIntensity ? this.specularIntensity : undefined;\n const numCels = 0 !== this.numCels ? this.numCels : undefined;\n const fresnel = this.fresnel.toJSON();\n\n if (!solar && !ambient && !hemisphere && !portrait && undefined === specularIntensity && undefined === numCels && undefined === fresnel)\n return undefined;\n\n const json: LightSettingsProps = {};\n if (solar)\n json.solar = solar;\n\n if (ambient)\n json.ambient = ambient;\n\n if (hemisphere)\n json.hemisphere = hemisphere;\n\n if (portrait)\n json.portrait = portrait;\n\n if (undefined !== specularIntensity)\n json.specularIntensity = specularIntensity;\n\n if (undefined !== numCels)\n json.numCels = numCels;\n\n if (fresnel)\n json.fresnel = fresnel;\n\n return json;\n }\n\n /** Create a copy of these light settings, identical except for any properties explicitly specified by `changed`.\n * Note that the solar, ambient, and hemisphere lights will also be cloned using their own `clone` methods - so for example, the following:\n * ` clone({ ambient: { intensity: 0.5 } })`\n * will overwrite the ambient light's intensity but preserve its current color, rather than replacing the color with the default color.\n */\n public clone(changed?: LightSettingsProps): LightSettings {\n if (!changed)\n return this;\n\n const solar = this.solar.clone(changed.solar);\n const ambient = this.ambient.clone(changed.ambient);\n const hemisphere = this.hemisphere.clone(changed.hemisphere);\n const portrait = changed.portrait?.intensity ?? this.portraitIntensity;\n const specular = changed.specularIntensity ?? this.specularIntensity;\n const numCels = changed.numCels ?? this.numCels;\n const fresnel = this.fresnel.clone(changed.fresnel);\n\n return new LightSettings(solar, ambient, hemisphere, portrait, specular, numCels, fresnel);\n }\n\n public equals(rhs: LightSettings): boolean {\n if (this === rhs)\n return true;\n\n return this.portraitIntensity === rhs.portraitIntensity && this.specularIntensity === rhs.specularIntensity && this.numCels === rhs.numCels\n && this.ambient.equals(rhs.ambient) && this.solar.equals(rhs.solar) && this.hemisphere.equals(rhs.hemisphere) && this.fresnel.equals(rhs.fresnel);\n }\n}\n"]}
@@ -139,8 +139,8 @@ class PlanarClipMaskSettings {
139
139
  if (subCategoryOrElementIds)
140
140
  this.subCategoryOrElementIds = core_bentley_1.CompressedId64Set.iterable(subCategoryOrElementIds);
141
141
  }
142
+ /** A default PlanarClipMask which masks nothing. */
143
+ static { this.defaults = new PlanarClipMaskSettings(PlanarClipMaskMode.None); }
142
144
  }
143
145
  exports.PlanarClipMaskSettings = PlanarClipMaskSettings;
144
- /** A default PlanarClipMask which masks nothing. */
145
- PlanarClipMaskSettings.defaults = new PlanarClipMaskSettings(PlanarClipMaskMode.None);
146
146
  //# sourceMappingURL=PlanarClipMask.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlanarClipMask.js","sourceRoot":"","sources":["../../src/PlanarClipMask.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAyF;AAEzF;;;GAGG;AACH,IAAY,kBAyBX;AAzBD,WAAY,kBAAkB;IAC5B,kBAAkB;IAClB,2DAAQ,CAAA;IACR;;;;OAIG;IACH,mEAAY,CAAA;IACZ;;OAEG;IACH,+DAAU,CAAA;IACV;;OAEG;IACH,2FAAwB,CAAA;IACxB;;OAEG;IACH,iFAAmB,CAAA;IACnB;;OAEG;IACH,iFAAmB,CAAA;AACrB,CAAC,EAzBW,kBAAkB,kCAAlB,kBAAkB,QAyB7B;AAED;;;;GAIG;AACH,IAAY,sBASX;AATD,WAAY,sBAAsB;IAChC,sBAAsB;IACtB,yFAAqB,CAAA;IACrB,6EAA6E;IAC7E,mGAA0B,CAAA;IAC1B,4CAA4C;IAC5C,mFAAgB,CAAA;IAChB,yDAAyD;IACzD,oFAAkB,CAAA;AACpB,CAAC,EATW,sBAAsB,sCAAtB,sBAAsB,QASjC;AA8FD;;;;;;;;GAQG;AACH,MAAa,sBAAsB;IAwBjC,qDAAqD;IACrD,IAAW,kBAAkB;QAC3B,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,mFAAmF;IAC5E,MAAM,CAAC,QAAQ,CAAC,IAA0B;QAC/C,IAAI,CAAC,IAAI,IAAI,SAAS,KAAK,IAAI,CAAC,IAAI;YAClC,OAAO,IAAI,CAAC,QAAQ,C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C5B,OAAO,IAAI,CAAC;QAEd,OAAO,sBAAsB,CAAC,QAAQ,CAAC;YACrC,GAAG,IAAI,CAAC,MAAM,EAAE;YAChB,GAAG,YAAY;SAChB,CAAC,CAAC;IACL,CAAC;IAED,YAAoB,IAAwB,EAAE,YAAqB,EAAE,QAA4B,EAAE,uBAA2C,EAAE,QAAiB,EAAE,MAAgB;QACjL,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,wBAAwB,GAAG,uBAAuB,CAAC;QACxD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,IAAI,KAAK,MAAM,CAAC;QAC9B,IAAI,CAAC,YAAY,GAAG,SAAS,KAAK,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAEpG,IAAI,QAAQ;YACV,IAAI,CAAC,QAAQ,GAAG,gCAAiB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAEvD,IAAI,uBAAuB;YACzB,IAAI,CAAC,uBAAuB,GAAG,gCAAiB,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC;IACvF,CAAC;;AAhHH,wDAoHC;AAFC,oDAAoD;AACtC,+BAAQ,GAAG,IAAI,sBAAsB,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module DisplayStyles\n */\n\nimport { CompressedId64Set, Id64String, OrderedId64Iterable } from \"@itwin/core-bentley\";\n\n/** The different modes by which a [[PlanarClipMaskSettings]] collects the geometry used to mask a model.\n * @public\n * @extensions\n */\nexport enum PlanarClipMaskMode {\n /** No masking. */\n None = 0,\n /** Mask based on priority. Different types of models have different default priorities as enumerated by [[PlanarClipMaskPriority]].\n * For example, background maps have the lowest priority, so they are masked by all other types, while design models have the highest priority and are therefore never masked.\n * The priority of a reality model can be overridden by [[PlanarClipMaskSettings.priority]]. This is useful to allow one reality model to mask another overlapping one.\n * Everything visible in the view creates the mask, so turning off models, categories, or elements (via fully transparent overrides) will make things not be in the mask.\n */\n Priority = 1,\n /** Indicates that masks should be produced from the geometry in a set of [GeometricModel]($backend)s, regardless of what model is on or off in the view.\n * However, things that are off from category settings or element feature overrides in the view will not be in the mask for these models.\n */\n Models = 2,\n /** Indicates that masks should be produced from geometry belonging to a set of subcategories.\n * View settings do not affect what is in the mask, unless [[PlanarClipMaskSettings.subCategoryOrElementIds]] is undefined, in which case it behaves like Models mode.\n */\n IncludeSubCategories = 3,\n /** Indicates that masks should be produced from the geometry of a set of [GeometricElement]($backend)s.\n * View settings do not affect what is in the mask, unless [[PlanarClipMaskSettings.subCategoryOrElementIds]] is undefined, in which case it behaves like Models mode.\n */\n IncludeElements = 4,\n /** Indicates that masks should be produced from the geometry of all [GeometricElement]($backend)s in a view, **except** for a specified set of excluded elements.\n * View settings do not affect what is in the mask, unless [[PlanarClipMaskSettings.subCategoryOrElementIds]] is undefined, in which case it behaves like Models mode.\n */\n ExcludeElements = 5,\n}\n\n/** The default priority values for a [[PlanarClipMaskSettings]], based on model type. Models with a lower priority are masked by models with a higher priority.\n * The default can be overridden by [[PlanarClipMaskSettings.priority]].\n * @public\n * @extensions\n */\nexport enum PlanarClipMaskPriority {\n /** Background map. */\n BackgroundMap = -2048,\n /** A reality model that spans the globe - e.g., OpenStreetMaps Buildings. */\n GlobalRealityModel = -1024,\n /** A reality model with a bounded range. */\n RealityModel = 0,\n /** A design model stored in the [IModelDb]($backend). */\n DesignModel = 2048,\n}\n\n/** JSON representation of a [[PlanarClipMaskSettings]].\n * @see [[DisplayStyleSettingsProps.planarClipOvr]] and [[ContextRealityModelProps.planarClipMask]].\n * @public\n * @extensions\n */\nexport interface PlanarClipMaskProps {\n /** Controls how the mask geometry is collected */\n mode: PlanarClipMaskMode;\n /** See [[PlanarClipMaskSettings.modelIds]]. */\n modelIds?: CompressedId64Set;\n /** See [[PlanarClipMaskSettings.subCategoryOrElementIds]]. */\n subCategoryOrElementIds?: CompressedId64Set;\n /** See [[PlanarClipMaskSettings.priority]]. */\n priority?: number;\n /** See [[PlanarClipMaskSettings.transparency]]. */\n transparency?: number;\n /** See PlanarClipMaskSettings.invert */\n invert?: boolean;\n}\n\n/** Basic arguments supplied to [[PlanarClipMaskSettings.create]].\n * @public\n */\nexport interface BasicPlanarClipMaskArgs {\n /** See [[PlanarClipMaskSettings.transparency]]. */\n transparency?: number;\n /** See [[PlanarClipMaskSettings.invert]]. */\n invert?: boolean;\n}\n\n/** Arguments supplied to [[PlanarClipMaskSettings.create]] to create a mask of [[PlanarClipMaskMode.Models]].\n * @public\n */\nexport interface ModelPlanarClipMaskArgs extends BasicPlanarClipMaskArgs {\n /** See [[PlanarClipMaskSettings.modelIds]]. */\n modelIds?: Iterable<Id64String>;\n /** @internal */\n exclude?: never;\n /** @internal */\n elementIds?: never;\n /** @internal */\n subCategoryIds?: never;\n /** @internal */\n priority?: never;\n}\n\n/** Arguments supplied to [[PlanarClipMaskSettings.create]] to create a mask of [[PlanarClipMaskMode.IncludeElements]] or [[PlanarClipMaskMode.ExcludeElements]].\n * @public\n */\nexport interface ElementPlanarClipMaskArgs extends BasicPlanarClipMaskArgs {\n /** See [[PlanarClipMaskSettings.modelIds]]. */\n modelIds?: Iterable<Id64String>;\n /** The elements used by the mask. @see [[PlanarClipMaskSettings.subCategoryOrElementIds]]. */\n elementIds: Iterable<Id64String>;\n /** If true, creates a mask of [[PlanarClipMaskMode.ExcludeElements]]; otherwise, [[PlanarClipMaskMode.IncludeElements]]. */\n exclude?: boolean;\n /** @internal */\n subCategoryIds?: never;\n /** @internal */\n priority?: never;\n}\n\n/** Arguments supplied to [[PlanarClipMaskSettings.create]] to create a mask of [[PlanarClipMaskMode.IncludeSubCategories]].\n * @public\n */\nexport interface SubCategoryPlanarClipMaskArgs extends BasicPlanarClipMaskArgs {\n /** See [[PlanarClipMaskSettings.modelIds]]. */\n modelIds?: Iterable<Id64String>;\n /** The subcategories used by the mask. @see [[PlanarClipMaskSettings.subCategoryOrElementIds]]. */\n subCategoryIds: Iterable<Id64String>;\n /** @internal */\n exclude?: never;\n /** @internal */\n elementIds?: never;\n /** @internal */\n priority?: never;\n}\n\n/** Arguments supplied to [[PlanarClipMaskSettings.create]] to create a mask of [[PlanarClipMaskMode.Priority]].\n * @public\n */\nexport interface PriorityPlanarClipMaskArgs extends BasicPlanarClipMaskArgs {\n /** See [[PlanarClipMaskSettings.priority]]. */\n priority: number;\n /** @internal */\n exclude?: never;\n /** @internal */\n elementIds?: never;\n /** @internal */\n modelIds?: never;\n}\n\n/** Describes how to mask the geometry of one [GeometricModel]($backend) for display. The mask is produced by projecting geometry from any number of other models -\n * optionally filtered by [SubCategory]($backend) or by a set of specific [GeometricElement]($backend)s - onto a plane. Regions of the masked model that intersect the\n * mask are rendered partially or completely transparent. This is useful for, e.g., making subsurface geometry visible below the background map, or clipping out portions\n * of a reality model that intersect a design model.\n * @note Currently reality models (including background maps and terrain) can be masked, but design models can only produce masks.\n * @see [[DisplayStyleSettings.planarClipMasks]] to define clip masks for a [DisplayStyle]($backend).\n * @see [[ContextRealityModel.planarClipMaskSettings]] to apply a clip mask to a context reality model.\n * @public\n */\nexport class PlanarClipMaskSettings {\n /** Specifies how the mask geometry is produced. */\n public readonly mode: PlanarClipMaskMode;\n /** For any mode other than [[PlanarClipMaskMode.Priority]], the Ids of the [GeometricModel]($backend)s containing the geometry used to produce the mask,\n * and if `undefined`, no mask geometry will be created.\n * The mask geometry can be filtered by [[subCategoryOrElementIds]].\n */\n public readonly modelIds?: OrderedId64Iterable;\n /** For [[PlanarClipMaskMode.IncludeElements]] or [[PlanarClipMaskMode.ExcludedElements]], the Ids of the [GeometricElement]($backend)s to include or exclude from masking;\n * for [[PlanarClipMaskMode.IncludeSubCategories]], the Ids of the subcategories whose geometry contributes to the mask.\n * If undefined, Modes IncludeSubCategories, IncludeElements, and ExcludeElements behave like Models mode.\n */\n public readonly subCategoryOrElementIds?: OrderedId64Iterable;\n /** For [[PlanarClipMaskMode.Priority]], the priority value. */\n public readonly priority?: number;\n /** A value between 0 and 1 indicating an override for mask transparency. A transparency of 0 indicates complete masking. 1 is completely transparent (no masking).\n If no transparency is defined then the transparencies of the mask elements are used.\n */\n public readonly transparency?: number;\n /** A value of true indicates that the mask should be inverted and only content within the mask should be displayed, in other words the area inside the mask is displayed rather than outside. */\n public readonly invert: boolean;\n private readonly _modelIds?: CompressedId64Set;\n private readonly _subCategoryOrElementIds?: CompressedId64Set;\n\n /** The compressed representation of [[modelIds]]. */\n public get compressedModelIds(): CompressedId64Set | undefined {\n return this._modelIds;\n }\n\n /** Create a new [[PlanarClipMaskSettings]] object from its JSON representation. */\n public static fromJSON(json?: PlanarClipMaskProps): PlanarClipMaskSettings {\n if (!json || undefined === json.mode)\n return this.defaults;\n\n return new PlanarClipMaskSettings(json.mode, json.transparency, json.modelIds, json.subCategoryOrElementIds, json.priority, json.invert);\n }\n\n /** Create a new PlanarClipMaskSettings. */\n public static create(args: ModelPlanarClipMaskArgs | ElementPlanarClipMaskArgs | SubCategoryPlanarClipMaskArgs | PriorityPlanarClipMaskArgs): PlanarClipMaskSettings {\n const modelIds = args.modelIds ? CompressedId64Set.sortAndCompress(args.modelIds) : undefined;\n if (undefined !== args.priority)\n return new PlanarClipMaskSettings(PlanarClipMaskMode.Priority, args.transparency, undefined, undefined, args.priority, args.invert);\n else if (undefined !== args.subCategoryIds)\n return new PlanarClipMaskSettings(PlanarClipMaskMode.IncludeSubCategories, args.transparency, modelIds, CompressedId64Set.sortAndCompress(args.subCategoryIds), undefined, args.invert);\n else if (undefined !== args.elementIds)\n return new PlanarClipMaskSettings(args.exclude ? PlanarClipMaskMode.ExcludeElements : PlanarClipMaskMode.IncludeElements, args.transparency, modelIds, CompressedId64Set.sortAndCompress(args.elementIds), undefined, args.invert);\n else\n return new PlanarClipMaskSettings(PlanarClipMaskMode.Models, args.transparency, modelIds, undefined, undefined, args.invert);\n }\n\n /** Create JSON object representing this [[PlanarClipMaskSettings]] */\n public toJSON(): PlanarClipMaskProps {\n const props: PlanarClipMaskProps = { mode: this.mode };\n if (undefined !== this._modelIds)\n props.modelIds = this._modelIds;\n\n if (undefined !== this._subCategoryOrElementIds)\n props.subCategoryOrElementIds = this._subCategoryOrElementIds;\n\n if (undefined !== this.priority)\n props.priority = this.priority;\n\n if (undefined !== this.transparency)\n props.transparency = this.transparency;\n\n if (this.invert)\n props.invert = true;\n\n return props;\n }\n\n /** Returns true if masking is enabled. */\n public get isValid(): boolean {\n return this.mode !== PlanarClipMaskMode.None;\n }\n\n public equals(other: PlanarClipMaskSettings): boolean {\n return this.mode === other.mode &&\n this.priority === other.priority &&\n this.transparency === other.transparency &&\n this.invert === other.invert &&\n this._modelIds === other._modelIds &&\n this._subCategoryOrElementIds === other._subCategoryOrElementIds;\n }\n\n /** Create a copy of this TerrainSettings, optionally modifying some of its properties.\n * @param changedProps JSON representation of the properties to change.\n * @returns A PlanarClipMaskSettings with all of its properties set to match those of`this`, except those explicitly defined in `changedProps`.\n */\n public clone(changedProps?: PlanarClipMaskProps): PlanarClipMaskSettings {\n if (undefined === changedProps)\n return this;\n\n return PlanarClipMaskSettings.fromJSON({\n ...this.toJSON(),\n ...changedProps,\n });\n }\n\n private constructor(mode: PlanarClipMaskMode, transparency?: number, modelIds?: CompressedId64Set, subCategoryOrElementIds?: CompressedId64Set, priority?: number, invert?: boolean) {\n this.mode = mode;\n this._modelIds = modelIds;\n this._subCategoryOrElementIds = subCategoryOrElementIds;\n this.priority = priority;\n this.invert = true === invert;\n this.transparency = undefined !== transparency ? Math.max(0, Math.min(1, transparency)) : undefined;\n\n if (modelIds)\n this.modelIds = CompressedId64Set.iterable(modelIds);\n\n if (subCategoryOrElementIds)\n this.subCategoryOrElementIds = CompressedId64Set.iterable(subCategoryOrElementIds);\n }\n\n /** A default PlanarClipMask which masks nothing. */\n public static defaults = new PlanarClipMaskSettings(PlanarClipMaskMode.None);\n}\n"]}
1
+ {"version":3,"file":"PlanarClipMask.js","sourceRoot":"","sources":["../../src/PlanarClipMask.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAyF;AAEzF;;;GAGG;AACH,IAAY,kBAyBX;AAzBD,WAAY,kBAAkB;IAC5B,kBAAkB;IAClB,2DAAQ,CAAA;IACR;;;;OAIG;IACH,mEAAY,CAAA;IACZ;;OAEG;IACH,+DAAU,CAAA;IACV;;OAEG;IACH,2FAAwB,CAAA;IACxB;;OAEG;IACH,iFAAmB,CAAA;IACnB;;OAEG;IACH,iFAAmB,CAAA;AACrB,CAAC,EAzBW,kBAAkB,kCAAlB,kBAAkB,QAyB7B;AAED;;;;GAIG;AACH,IAAY,sBASX;AATD,WAAY,sBAAsB;IAChC,sBAAsB;IACtB,yFAAqB,CAAA;IACrB,6EAA6E;IAC7E,mGAA0B,CAAA;IAC1B,4CAA4C;IAC5C,mFAAgB,CAAA;IAChB,yDAAyD;IACzD,oFAAkB,CAAA;AACpB,CAAC,EATW,sBAAsB,sCAAtB,sBAAsB,QASjC;AA8FD;;;;;;;;GAQG;AACH,MAAa,sBAAsB;IAwBjC,qDAAqD;IACrD,IAAW,kBAAkB;QAC3B,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,mFAAmF;IAC5E,MAAM,CAAC,QAAQ,CAAC,IAA0B;QAC/C,IAAI,CAAC,IAAI,IAAI,SAAS,KAAK,IAAI,CAAC,IAAI;YAClC,OAAO,IAAI,CAAC,QAAQ,CAAC;QAEvB,OAAO,IAAI,sBAAsB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,YA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AI,CAAC,MAAM,EAAE;YAChB,GAAG,YAAY;SAChB,CAAC,CAAC;IACL,CAAC;IAED,YAAoB,IAAwB,EAAE,YAAqB,EAAE,QAA4B,EAAE,uBAA2C,EAAE,QAAiB,EAAE,MAAgB;QACjL,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,wBAAwB,GAAG,uBAAuB,CAAC;QACxD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,IAAI,KAAK,MAAM,CAAC;QAC9B,IAAI,CAAC,YAAY,GAAG,SAAS,KAAK,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAEpG,IAAI,QAAQ;YACV,IAAI,CAAC,QAAQ,GAAG,gCAAiB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAEvD,IAAI,uBAAuB;YACzB,IAAI,CAAC,uBAAuB,GAAG,gCAAiB,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC;IACvF,CAAC;IAED,oDAAoD;aACtC,aAAQ,GAAG,IAAI,sBAAsB,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;;AAnH/E,wDAoHC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module DisplayStyles\n */\n\nimport { CompressedId64Set, Id64String, OrderedId64Iterable } from \"@itwin/core-bentley\";\n\n/** The different modes by which a [[PlanarClipMaskSettings]] collects the geometry used to mask a model.\n * @public\n * @extensions\n */\nexport enum PlanarClipMaskMode {\n /** No masking. */\n None = 0,\n /** Mask based on priority. Different types of models have different default priorities as enumerated by [[PlanarClipMaskPriority]].\n * For example, background maps have the lowest priority, so they are masked by all other types, while design models have the highest priority and are therefore never masked.\n * The priority of a reality model can be overridden by [[PlanarClipMaskSettings.priority]]. This is useful to allow one reality model to mask another overlapping one.\n * Everything visible in the view creates the mask, so turning off models, categories, or elements (via fully transparent overrides) will make things not be in the mask.\n */\n Priority = 1,\n /** Indicates that masks should be produced from the geometry in a set of [GeometricModel]($backend)s, regardless of what model is on or off in the view.\n * However, things that are off from category settings or element feature overrides in the view will not be in the mask for these models.\n */\n Models = 2,\n /** Indicates that masks should be produced from geometry belonging to a set of subcategories.\n * View settings do not affect what is in the mask, unless [[PlanarClipMaskSettings.subCategoryOrElementIds]] is undefined, in which case it behaves like Models mode.\n */\n IncludeSubCategories = 3,\n /** Indicates that masks should be produced from the geometry of a set of [GeometricElement]($backend)s.\n * View settings do not affect what is in the mask, unless [[PlanarClipMaskSettings.subCategoryOrElementIds]] is undefined, in which case it behaves like Models mode.\n */\n IncludeElements = 4,\n /** Indicates that masks should be produced from the geometry of all [GeometricElement]($backend)s in a view, **except** for a specified set of excluded elements.\n * View settings do not affect what is in the mask, unless [[PlanarClipMaskSettings.subCategoryOrElementIds]] is undefined, in which case it behaves like Models mode.\n */\n ExcludeElements = 5,\n}\n\n/** The default priority values for a [[PlanarClipMaskSettings]], based on model type. Models with a lower priority are masked by models with a higher priority.\n * The default can be overridden by [[PlanarClipMaskSettings.priority]].\n * @public\n * @extensions\n */\nexport enum PlanarClipMaskPriority {\n /** Background map. */\n BackgroundMap = -2048,\n /** A reality model that spans the globe - e.g., OpenStreetMaps Buildings. */\n GlobalRealityModel = -1024,\n /** A reality model with a bounded range. */\n RealityModel = 0,\n /** A design model stored in the [IModelDb]($backend). */\n DesignModel = 2048,\n}\n\n/** JSON representation of a [[PlanarClipMaskSettings]].\n * @see [[DisplayStyleSettingsProps.planarClipOvr]] and [[ContextRealityModelProps.planarClipMask]].\n * @public\n * @extensions\n */\nexport interface PlanarClipMaskProps {\n /** Controls how the mask geometry is collected */\n mode: PlanarClipMaskMode;\n /** See [[PlanarClipMaskSettings.modelIds]]. */\n modelIds?: CompressedId64Set;\n /** See [[PlanarClipMaskSettings.subCategoryOrElementIds]]. */\n subCategoryOrElementIds?: CompressedId64Set;\n /** See [[PlanarClipMaskSettings.priority]]. */\n priority?: number;\n /** See [[PlanarClipMaskSettings.transparency]]. */\n transparency?: number;\n /** See PlanarClipMaskSettings.invert */\n invert?: boolean;\n}\n\n/** Basic arguments supplied to [[PlanarClipMaskSettings.create]].\n * @public\n */\nexport interface BasicPlanarClipMaskArgs {\n /** See [[PlanarClipMaskSettings.transparency]]. */\n transparency?: number;\n /** See [[PlanarClipMaskSettings.invert]]. */\n invert?: boolean;\n}\n\n/** Arguments supplied to [[PlanarClipMaskSettings.create]] to create a mask of [[PlanarClipMaskMode.Models]].\n * @public\n */\nexport interface ModelPlanarClipMaskArgs extends BasicPlanarClipMaskArgs {\n /** See [[PlanarClipMaskSettings.modelIds]]. */\n modelIds?: Iterable<Id64String>;\n /** @internal */\n exclude?: never;\n /** @internal */\n elementIds?: never;\n /** @internal */\n subCategoryIds?: never;\n /** @internal */\n priority?: never;\n}\n\n/** Arguments supplied to [[PlanarClipMaskSettings.create]] to create a mask of [[PlanarClipMaskMode.IncludeElements]] or [[PlanarClipMaskMode.ExcludeElements]].\n * @public\n */\nexport interface ElementPlanarClipMaskArgs extends BasicPlanarClipMaskArgs {\n /** See [[PlanarClipMaskSettings.modelIds]]. */\n modelIds?: Iterable<Id64String>;\n /** The elements used by the mask. @see [[PlanarClipMaskSettings.subCategoryOrElementIds]]. */\n elementIds: Iterable<Id64String>;\n /** If true, creates a mask of [[PlanarClipMaskMode.ExcludeElements]]; otherwise, [[PlanarClipMaskMode.IncludeElements]]. */\n exclude?: boolean;\n /** @internal */\n subCategoryIds?: never;\n /** @internal */\n priority?: never;\n}\n\n/** Arguments supplied to [[PlanarClipMaskSettings.create]] to create a mask of [[PlanarClipMaskMode.IncludeSubCategories]].\n * @public\n */\nexport interface SubCategoryPlanarClipMaskArgs extends BasicPlanarClipMaskArgs {\n /** See [[PlanarClipMaskSettings.modelIds]]. */\n modelIds?: Iterable<Id64String>;\n /** The subcategories used by the mask. @see [[PlanarClipMaskSettings.subCategoryOrElementIds]]. */\n subCategoryIds: Iterable<Id64String>;\n /** @internal */\n exclude?: never;\n /** @internal */\n elementIds?: never;\n /** @internal */\n priority?: never;\n}\n\n/** Arguments supplied to [[PlanarClipMaskSettings.create]] to create a mask of [[PlanarClipMaskMode.Priority]].\n * @public\n */\nexport interface PriorityPlanarClipMaskArgs extends BasicPlanarClipMaskArgs {\n /** See [[PlanarClipMaskSettings.priority]]. */\n priority: number;\n /** @internal */\n exclude?: never;\n /** @internal */\n elementIds?: never;\n /** @internal */\n modelIds?: never;\n}\n\n/** Describes how to mask the geometry of one [GeometricModel]($backend) for display. The mask is produced by projecting geometry from any number of other models -\n * optionally filtered by [SubCategory]($backend) or by a set of specific [GeometricElement]($backend)s - onto a plane. Regions of the masked model that intersect the\n * mask are rendered partially or completely transparent. This is useful for, e.g., making subsurface geometry visible below the background map, or clipping out portions\n * of a reality model that intersect a design model.\n * @note Currently reality models (including background maps and terrain) can be masked, but design models can only produce masks.\n * @see [[DisplayStyleSettings.planarClipMasks]] to define clip masks for a [DisplayStyle]($backend).\n * @see [[ContextRealityModel.planarClipMaskSettings]] to apply a clip mask to a context reality model.\n * @public\n */\nexport class PlanarClipMaskSettings {\n /** Specifies how the mask geometry is produced. */\n public readonly mode: PlanarClipMaskMode;\n /** For any mode other than [[PlanarClipMaskMode.Priority]], the Ids of the [GeometricModel]($backend)s containing the geometry used to produce the mask,\n * and if `undefined`, no mask geometry will be created.\n * The mask geometry can be filtered by [[subCategoryOrElementIds]].\n */\n public readonly modelIds?: OrderedId64Iterable;\n /** For [[PlanarClipMaskMode.IncludeElements]] or [[PlanarClipMaskMode.ExcludedElements]], the Ids of the [GeometricElement]($backend)s to include or exclude from masking;\n * for [[PlanarClipMaskMode.IncludeSubCategories]], the Ids of the subcategories whose geometry contributes to the mask.\n * If undefined, Modes IncludeSubCategories, IncludeElements, and ExcludeElements behave like Models mode.\n */\n public readonly subCategoryOrElementIds?: OrderedId64Iterable;\n /** For [[PlanarClipMaskMode.Priority]], the priority value. */\n public readonly priority?: number;\n /** A value between 0 and 1 indicating an override for mask transparency. A transparency of 0 indicates complete masking. 1 is completely transparent (no masking).\n If no transparency is defined then the transparencies of the mask elements are used.\n */\n public readonly transparency?: number;\n /** A value of true indicates that the mask should be inverted and only content within the mask should be displayed, in other words the area inside the mask is displayed rather than outside. */\n public readonly invert: boolean;\n private readonly _modelIds?: CompressedId64Set;\n private readonly _subCategoryOrElementIds?: CompressedId64Set;\n\n /** The compressed representation of [[modelIds]]. */\n public get compressedModelIds(): CompressedId64Set | undefined {\n return this._modelIds;\n }\n\n /** Create a new [[PlanarClipMaskSettings]] object from its JSON representation. */\n public static fromJSON(json?: PlanarClipMaskProps): PlanarClipMaskSettings {\n if (!json || undefined === json.mode)\n return this.defaults;\n\n return new PlanarClipMaskSettings(json.mode, json.transparency, json.modelIds, json.subCategoryOrElementIds, json.priority, json.invert);\n }\n\n /** Create a new PlanarClipMaskSettings. */\n public static create(args: ModelPlanarClipMaskArgs | ElementPlanarClipMaskArgs | SubCategoryPlanarClipMaskArgs | PriorityPlanarClipMaskArgs): PlanarClipMaskSettings {\n const modelIds = args.modelIds ? CompressedId64Set.sortAndCompress(args.modelIds) : undefined;\n if (undefined !== args.priority)\n return new PlanarClipMaskSettings(PlanarClipMaskMode.Priority, args.transparency, undefined, undefined, args.priority, args.invert);\n else if (undefined !== args.subCategoryIds)\n return new PlanarClipMaskSettings(PlanarClipMaskMode.IncludeSubCategories, args.transparency, modelIds, CompressedId64Set.sortAndCompress(args.subCategoryIds), undefined, args.invert);\n else if (undefined !== args.elementIds)\n return new PlanarClipMaskSettings(args.exclude ? PlanarClipMaskMode.ExcludeElements : PlanarClipMaskMode.IncludeElements, args.transparency, modelIds, CompressedId64Set.sortAndCompress(args.elementIds), undefined, args.invert);\n else\n return new PlanarClipMaskSettings(PlanarClipMaskMode.Models, args.transparency, modelIds, undefined, undefined, args.invert);\n }\n\n /** Create JSON object representing this [[PlanarClipMaskSettings]] */\n public toJSON(): PlanarClipMaskProps {\n const props: PlanarClipMaskProps = { mode: this.mode };\n if (undefined !== this._modelIds)\n props.modelIds = this._modelIds;\n\n if (undefined !== this._subCategoryOrElementIds)\n props.subCategoryOrElementIds = this._subCategoryOrElementIds;\n\n if (undefined !== this.priority)\n props.priority = this.priority;\n\n if (undefined !== this.transparency)\n props.transparency = this.transparency;\n\n if (this.invert)\n props.invert = true;\n\n return props;\n }\n\n /** Returns true if masking is enabled. */\n public get isValid(): boolean {\n return this.mode !== PlanarClipMaskMode.None;\n }\n\n public equals(other: PlanarClipMaskSettings): boolean {\n return this.mode === other.mode &&\n this.priority === other.priority &&\n this.transparency === other.transparency &&\n this.invert === other.invert &&\n this._modelIds === other._modelIds &&\n this._subCategoryOrElementIds === other._subCategoryOrElementIds;\n }\n\n /** Create a copy of this TerrainSettings, optionally modifying some of its properties.\n * @param changedProps JSON representation of the properties to change.\n * @returns A PlanarClipMaskSettings with all of its properties set to match those of`this`, except those explicitly defined in `changedProps`.\n */\n public clone(changedProps?: PlanarClipMaskProps): PlanarClipMaskSettings {\n if (undefined === changedProps)\n return this;\n\n return PlanarClipMaskSettings.fromJSON({\n ...this.toJSON(),\n ...changedProps,\n });\n }\n\n private constructor(mode: PlanarClipMaskMode, transparency?: number, modelIds?: CompressedId64Set, subCategoryOrElementIds?: CompressedId64Set, priority?: number, invert?: boolean) {\n this.mode = mode;\n this._modelIds = modelIds;\n this._subCategoryOrElementIds = subCategoryOrElementIds;\n this.priority = priority;\n this.invert = true === invert;\n this.transparency = undefined !== transparency ? Math.max(0, Math.min(1, transparency)) : undefined;\n\n if (modelIds)\n this.modelIds = CompressedId64Set.iterable(modelIds);\n\n if (subCategoryOrElementIds)\n this.subCategoryOrElementIds = CompressedId64Set.iterable(subCategoryOrElementIds);\n }\n\n /** A default PlanarClipMask which masks nothing. */\n public static defaults = new PlanarClipMaskSettings(PlanarClipMaskMode.None);\n}\n"]}
@@ -18,6 +18,8 @@ exports.RealityModelDisplaySettings = exports.PointCloudDisplaySettings = void 0
18
18
  * @beta
19
19
  */
20
20
  class PointCloudDisplaySettings {
21
+ /** Settings with all properties initialized to their default values. */
22
+ static { this.defaults = new PointCloudDisplaySettings(); }
21
23
  constructor(props) {
22
24
  this.shape = props?.shape ?? "round";
23
25
  this.sizeMode = props?.sizeMode ?? "voxel";
@@ -91,8 +93,6 @@ class PointCloudDisplaySettings {
91
93
  }
92
94
  }
93
95
  exports.PointCloudDisplaySettings = PointCloudDisplaySettings;
94
- /** Settings with all properties initialized to their default values. */
95
- PointCloudDisplaySettings.defaults = new PointCloudDisplaySettings();
96
96
  /** Settings that control how a reality model - whether a [[ContextRealityModel]] or a persistent reality [Model]($backend) - is displayed within a [Viewport]($frontend).
97
97
  * @see [[ContextRealityModel.displaySettings]] to apply these settings to a context reality model.
98
98
  * @see [[DisplayStyleSettings.setRealityModelDisplaySettings]] to apply these settings to a persistent reality model.
@@ -100,6 +100,8 @@ PointCloudDisplaySettings.defaults = new PointCloudDisplaySettings();
100
100
  * @beta
101
101
  */
102
102
  class RealityModelDisplaySettings {
103
+ /** Settings with all properties initialized to their default values. */
104
+ static { this.defaults = new RealityModelDisplaySettings(undefined, PointCloudDisplaySettings.defaults); }
103
105
  constructor(overrideColorRatio, pointCloud) {
104
106
  this.overrideColorRatio = overrideColorRatio ?? 0.5;
105
107
  this.pointCloud = pointCloud;
@@ -137,6 +139,4 @@ class RealityModelDisplaySettings {
137
139
  }
138
140
  }
139
141
  exports.RealityModelDisplaySettings = RealityModelDisplaySettings;
140
- /** Settings with all properties initialized to their default values. */
141
- RealityModelDisplaySettings.defaults = new RealityModelDisplaySettings(undefined, PointCloudDisplaySettings.defaults);
142
142
  //# sourceMappingURL=RealityModelD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EhD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,+DAA+D;IACxD,MAAM,CAAC,KAAkC;QAC9C,IAAI,IAAI,KAAK,KAAK;YAChB,OAAO,IAAI,CAAC;QAEd,OAAO,IAAI,CAAC,kBAAkB,KAAK,KAAK,CAAC,kBAAkB,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAC1G,CAAC;IAED,mHAAmH;IAC5G,KAAK,CAAC,YAAsC;QACjD,MAAM,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC;QAC9G,MAAM,UAAU,GAAG,YAAY,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC;QACjI,OAAO,IAAI,2BAA2B,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACjE,CAAC;;AA3DH,kEA4DC;AAhDC,wEAAwE;AAC1D,oCAAQ,GAAG,IAAI,2BAA2B,CAAC,SAAS,EAAE,yBAAyB,CAAC,QAAQ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module DisplayStyles\n */\n\n/** Specifies how the sizes of the individual points within a point cloud are computed.\n * - \"pixel\": Each point is an exact number of pixels in diameter, as specified by [[PointCloudDisplaySettings.pixelSize]].\n * - \"voxel\": Each point is the size of a \"voxel\" in meters, as specified by the [Tile]($frontend) to which the point belongs.\n * @see [[PointCloudDisplaySettings.sizeMode]].\n * @beta\n */\nexport type PointCloudSizeMode = \"voxel\" | \"pixel\";\n\n/** Specifies the shape drawn for each individual point within a point cloud.\n * - \"round\": Each point is drawn as a circle.\n * - \"square\": Each point is drawn as a square.\n * @see [[PointCloudDisplaySettings.shape]].\n * @beta\n */\nexport type PointCloudShape = \"square\" | \"round\";\n\n/** Specifies the Eye-Dome Lighting mode used for a point cloud.\n * - \"off\": EDL is not calculated\n * - \"on\": EDL is calculated using a single pass.\n * - \"full\" EDL is calculated with full algorithm including optional filtering\n * @see [[PointCloudDisplaySettings.edlMode]].\n * @beta\n */\nexport type PointCloudEDLMode = \"off\" | \"on\" | \"full\";\n\n/** The JSON representation of [[PointCloudDisplaySettings]].\n * @beta\n */\nexport interface PointCloudDisplayProps {\n /** See [[PointCloudDisplaySettings.sizeMode]]. */\n sizeMode?: PointCloudSizeMode;\n /** See [[PointCloudDisplaySettings.voxelScale]]. */\n voxelScale?: number;\n /** See [[PointCloudDisplaySettings.minPixelsPerVoxel]]. */\n minPixelsPerVoxel?: number;\n /** See [[PointCloudDisplaySettings.maxPixelsPerVoxel]]. */\n maxPixelsPerVoxel?: number;\n /** See [[PointCloudDisplaySettings.pixelSize]]. */\n pixelSize?: number;\n /** See [[PointCloudDisplaySettings.shape]]. */\n shape?: PointCloudShape;\n /** See [[PointCloudDisplaySettings.edlMode]]. */\n edlMode?: PointCloudEDLMode;\n /** See [[PointCloudDisplaySettings.edlStrength]]. */\n edlStrength?: number;\n /** See [[PointCloudDisplaySettings.edlRadius]]. */\n edlRadius?: number;\n /** See [[PointCloudDisplaySettings.edlFilter]]. */\n edlFilter?: number;\n /** See [[PointCloudDisplaySettings.edlMixWts1]]. */\n edlMixWts1?: number;\n /** See [[PointCloudDisplaySettings.edlMixWts2]]. */\n edlMixWts2?: number;\n /** See [[PointCloudDisplaySettings.edlMixWts4]]. */\n edlMixWts4?: number;\n}\n\n/** The JSON representation of [[RealityModelDisplaySettings]].\n * @beta\n */\nexport interface RealityModelDisplayProps {\n /** See [[RealityModelDisplaySettings.pointCloud]]. */\n pointCloud?: PointCloudDisplayProps;\n /** See [[RealityModelDisplaySettings.overrideColorRatio]]. */\n overrideColorRatio?: number;\n // ###TODO when we need it: mesh?: RealityMeshDisplayProps;\n}\n\n/** Settings that control how a point cloud reality model is displayed within a [Viewport]($frontend).\n * @note This is an immutable type - to modify its properties, use [[clone]].\n * Eye-Dome Lighting (EDL) is a non-photorealistic, image-based shading technique that was designed to improve depth\n * perception in scientific visualization. It is particularly useful for visualizing monochrome point cloud data, but\n * also can be useful for point clouds with color information.\n * @note EDL mode is ignored (off) if the view is not perspective (camera is off)\n * @see [[RealityModelDisplaySettings.pointCloud]].\n * @beta\n */\nexport class PointCloudDisplaySettings {\n /** The shape drawn for each point in the cloud.\n * Default: \"round\".\n */\n public readonly shape: PointCloudShape;\n /** The method by which the size of each individual point is computed.\n * Default: \"voxel\".\n * @see [[pixelSize]] to configure the size for \"pixel\" mode.\n * @see [[voxelScale]], [[minPixelsPerVoxel]], and [[maxPixelsPerVoxel]] to configure the size for \"voxel\" mode.\n */\n public readonly sizeMode: PointCloudSizeMode;\n /** The radius of each point in pixels, when [[sizeMode]] is \"pixel\".\n * The size is expected to be a positive integer. The maximum size will vary based on the graphics hardware in use, but typically is limited to 32 or 64 pixels.\n * Default: 1\n */\n public readonly pixelSize: number;\n /** A scale factor applied to the size of each point, when [[sizeMode]] is \"voxel\".\n * The scale is expected to be a positive floating point number.\n * Default: 1.0\n */\n public readonly voxelScale: number;\n /** If [[sizeMode]] is \"voxel\", the minimum radius of each point in pixels. It is expected to be a positive integer no greater than [[maxPixelsPerVoxel]].\n * Default: 2\n */\n public readonly minPixelsPerVoxel: number;\n /** If [[sizeMode]] is \"voxel\", the maximum radius of each point in pixels. It is expected to be a positive integer no less than [[minPixelsPerVoxel]].\n * Default: 20.\n */\n public readonly maxPixelsPerVoxel: number;\n /** The mode for the Eye-Dome Lighting (EDL) effect.\n * Default: \"off\"\n * @note EDL mode is ignored (off) if the view is not perspective (camera is off)\n */\n public readonly edlMode: PointCloudEDLMode;\n /** A strength value for the Eye Dome Lighting (EDL) effect.\n * The strength is expected to be a positive floating point number.\n * Default: 5.0\n */\n public readonly edlStrength: number;\n /** A radius value for the Eye Dome Lighting (EDL) effect.\n * The radius is expected to be a positive floating point number\n * It is used to deterimine how far away in pixels to sample for depth change\n * Default: 2.0\n */\n public readonly edlRadius: number;\n /** A flag for whether or not to apply filtering pass in the Eye Dome Lighting (EDL) effect.\n * It only applies if edlMode is \"full\"\n * Default: 1.0\n */\n public readonly edlFilter?: number;\n /** A weighting value to apply to the full image when combining it with the half and quarter sized ones\n * It only applies if edlMode is \"full\"\n * The strength is expected to be a floating point number between 0 and 1 inclusive.\n * Default: 1.0\n */\n public readonly edlMixWts1?: number;\n /** A weighting value to apply to the half sized image when combining it with the full and quarter sized ones\n * It only applies if edlMode is \"full\"\n * The strength is expected to be a floating point number between 0 and 1 inclusive.\n * Default: 0.5\n */\n public readonly edlMixWts2?: number;\n /** A weighting value to apply to the quarter sized image when combining it with the full and half sized ones\n * It only applies if edlMode is \"full\"\n * The strength is expected to be a floating point number between 0 and 1 inclusive.\n * Default: 0.25\n */\n public readonly edlMixWts4?: number;\n\n /** Settings with all properties initialized to their default values. */\n public static defaults = new PointCloudDisplaySettings();\n\n private constructor(props?: PointCloudDisplayProps) {\n this.shape = props?.shape ?? \"round\";\n this.sizeMode = props?.sizeMode ?? \"voxel\";\n\n // No sanity checks here - e.g., min < max, pixelSize and voxelScale > 0, etc.\n this.pixelSize = props?.pixelSize ?? 1;\n this.voxelScale = props?.voxelScale ?? 1;\n this.minPixelsPerVoxel = props?.minPixelsPerVoxel ?? 2;\n this.maxPixelsPerVoxel = props?.maxPixelsPerVoxel ?? 20;\n this.edlMode = props?.edlMode ?? \"off\";\n this.edlStrength = props?.edlStrength ?? 5;\n this.edlRadius = props?.edlRadius ?? 2;\n this.edlFilter = props?.edlFilter ?? 1;\n this.edlMixWts1 = props?.edlMixWts1 ?? 1.0;\n this.edlMixWts2 = props?.edlMixWts2 ?? 0.5;\n this.edlMixWts4 = props?.edlMixWts4 ?? 0.25;\n }\n\n /** Create display settings from their JSON representation. If `props` is `undefined`, the default settings are returned. */\n public static fromJSON(props?: PointCloudDisplayProps): PointCloudDisplaySettings {\n return props ? new PointCloudDisplaySettings(props) : this.defaults;\n }\n\n /** Convert these settings to their JSON representation. */\n public toJSON(): PointCloudDisplayProps | undefined {\n const defs = PointCloudDisplaySettings.defaults;\n if (this.equals(defs))\n return undefined;\n\n const props: PointCloudDisplayProps = { };\n if (this.shape !== defs.shape)\n props.shape = this.shape;\n\n if (this.sizeMode !== defs.sizeMode)\n props.sizeMode = this.sizeMode;\n\n if (this.pixelSize !== defs.pixelSize)\n props.pixelSize = this.pixelSize;\n\n if (this.voxelScale !== defs.voxelScale)\n props.voxelScale = this.voxelScale;\n\n if (this.minPixelsPerVoxel !== defs.minPixelsPerVoxel)\n props.minPixelsPerVoxel = this.minPixelsPerVoxel;\n\n if (this.maxPixelsPerVoxel !== defs.maxPixelsPerVoxel)\n props.maxPixelsPerVoxel = this.maxPixelsPerVoxel;\n\n if (this.edlMode !== defs.edlMode)\n props.edlMode = this.edlMode;\n\n if (this.edlStrength !== defs.edlStrength)\n props.edlStrength = this.edlStrength;\n\n if (this.edlRadius !== defs.edlRadius)\n props.edlRadius = this.edlRadius;\n\n if (this.edlFilter !== defs.edlFilter)\n props.edlFilter = this.edlFilter;\n\n if (this.edlMixWts1 !== defs.edlMixWts1)\n props.edlMixWts1 = this.edlMixWts1;\n\n if (this.edlMixWts2 !== defs.edlMixWts2)\n props.edlMixWts2 = this.edlMixWts2;\n\n if (this.edlMixWts4 !== defs.edlMixWts4)\n props.edlMixWts4 = this.edlMixWts4;\n\n return props;\n }\n\n /** Create a copy of these settings, identical except for any properties explicitly specified by `changedProps`. */\n public clone(changedProps: PointCloudDisplayProps): PointCloudDisplaySettings {\n return PointCloudDisplaySettings.fromJSON({\n ...this.toJSON(),\n ...changedProps,\n });\n }\n\n /** Returns true if these settings are identical to `other`. */\n public equals(other: PointCloudDisplaySettings): boolean {\n if (this === other)\n return true;\n\n return this.shape === other.shape && this.sizeMode === other.sizeMode && this.pixelSize === other.pixelSize\n && this.voxelScale === other.voxelScale && this.minPixelsPerVoxel === other.minPixelsPerVoxel && this.maxPixelsPerVoxel === other.maxPixelsPerVoxel\n && this.edlMode === other.edlMode && this.edlStrength === other.edlStrength && this.edlRadius === other.edlRadius\n && this.edlFilter === other.edlFilter\n && this.edlMixWts1 === other.edlMixWts1 && this.edlMixWts2 === other.edlMixWts2 && this.edlMixWts4 === other.edlMixWts4\n ;\n }\n}\n\n/** Settings that control how a reality model - whether a [[ContextRealityModel]] or a persistent reality [Model]($backend) - is displayed within a [Viewport]($frontend).\n * @see [[ContextRealityModel.displaySettings]] to apply these settings to a context reality model.\n * @see [[DisplayStyleSettings.setRealityModelDisplaySettings]] to apply these settings to a persistent reality model.\n * @note This is an immutable type - to modify its properties, use [[clone]].\n * @beta\n */\nexport class RealityModelDisplaySettings {\n /** If the reality model's color is overridden with another color, a ratio in [0..1] with which to mix the two colors together.\n * A ratio of 0 uses only the reality model's color, a ratio of 1 uses only the override color, and a ratio of 0.5 mixes the two colors equally.\n * The color may be overridden using [[FeatureOverrides]] such as those supplied by a [FeatureOverrideProvider]($frontend), or by applying a [[SpatialClassifier]].\n * Default: 0.5\n */\n public readonly overrideColorRatio: number;\n /** Settings that apply specifically to point cloud reality models.\n * Default: [[PointCloudDisplaySettings.defaults]].\n */\n public readonly pointCloud: PointCloudDisplaySettings;\n\n /** Settings with all properties initialized to their default values. */\n public static defaults = new RealityModelDisplaySettings(undefined, PointCloudDisplaySettings.defaults);\n\n private constructor(overrideColorRatio: number | undefined, pointCloud: PointCloudDisplaySettings) {\n this.overrideColorRatio = overrideColorRatio ?? 0.5;\n this.pointCloud = pointCloud;\n }\n\n /** Create display settings from their JSON representation. If `props` is `undefined`, the default settings are returned. */\n public static fromJSON(props?: RealityModelDisplayProps): RealityModelDisplaySettings {\n if (!props)\n return this.defaults;\n\n return new RealityModelDisplaySettings(props.overrideColorRatio, PointCloudDisplaySettings.fromJSON(props.pointCloud));\n }\n\n /** Convert these settings to their JSON representation, which is `undefined` if all of their properties match the default settings. */\n public toJSON(): RealityModelDisplayProps | undefined {\n const pointCloud = this.pointCloud.toJSON();\n const overrideColorRatio = this.overrideColorRatio === RealityModelDisplaySettings.defaults.overrideColorRatio ? undefined : this.overrideColorRatio;\n\n if (undefined === pointCloud && undefined === overrideColorRatio)\n return undefined;\n\n const props: RealityModelDisplayProps = { };\n if (undefined !== pointCloud)\n props.pointCloud = pointCloud;\n\n if (undefined !== overrideColorRatio)\n props.overrideColorRatio = overrideColorRatio;\n\n return props;\n }\n\n /** Returns true if these settings are identical to `other`. */\n public equals(other: RealityModelDisplaySettings): boolean {\n if (this === other)\n return true;\n\n return this.overrideColorRatio === other.overrideColorRatio && this.pointCloud.equals(other.pointCloud);\n }\n\n /** Create a copy of these settings, identical except for any properties explicitly specified by `changedProps`. */\n public clone(changedProps: RealityModelDisplayProps): RealityModelDisplaySettings {\n const pointCloud = changedProps.pointCloud ? this.pointCloud.clone(changedProps.pointCloud) : this.pointCloud;\n const colorRatio = changedProps.hasOwnProperty(\"overrideColorRatio\") ? changedProps.overrideColorRatio : this.overrideColorRatio;\n return new RealityModelDisplaySettings(colorRatio, pointCloud);\n }\n}\n"]}
1
+ {"version":3,"file":"RealityModelDisplaySettings.js","sourceRoot":"","sources":["../../src/RealityModelDisplaySettings.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAsEH;;;;;;;;GAQG;AACH,MAAa,yBAAyB;IAqEpC,wEAAwE;aAC1D,aAAQ,GAAG,IAAI,yBAAyB,EAAE,CAAC;IAEzD,YAAoB,KAA8B;QAChD,IAAI,CAAC,KAAK,GAAG,KAAK,EAAE,KAAK,IAAI,OAAO,CAAC;QACrC,IAAI,CAAC,QAAQ,GAAG,KAAK,EAAE,QAAQ,IAAI,OAAO,CAAC;QAE3C,8EAA8E;QAC9E,IAAI,CAAC,SAA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U,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC;QAC9G,MAAM,UAAU,GAAG,YAAY,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC;QACjI,OAAO,IAAI,2BAA2B,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACjE,CAAC;;AA3DH,kEA4DC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module DisplayStyles\n */\n\n/** Specifies how the sizes of the individual points within a point cloud are computed.\n * - \"pixel\": Each point is an exact number of pixels in diameter, as specified by [[PointCloudDisplaySettings.pixelSize]].\n * - \"voxel\": Each point is the size of a \"voxel\" in meters, as specified by the [Tile]($frontend) to which the point belongs.\n * @see [[PointCloudDisplaySettings.sizeMode]].\n * @beta\n */\nexport type PointCloudSizeMode = \"voxel\" | \"pixel\";\n\n/** Specifies the shape drawn for each individual point within a point cloud.\n * - \"round\": Each point is drawn as a circle.\n * - \"square\": Each point is drawn as a square.\n * @see [[PointCloudDisplaySettings.shape]].\n * @beta\n */\nexport type PointCloudShape = \"square\" | \"round\";\n\n/** Specifies the Eye-Dome Lighting mode used for a point cloud.\n * - \"off\": EDL is not calculated\n * - \"on\": EDL is calculated using a single pass.\n * - \"full\" EDL is calculated with full algorithm including optional filtering\n * @see [[PointCloudDisplaySettings.edlMode]].\n * @beta\n */\nexport type PointCloudEDLMode = \"off\" | \"on\" | \"full\";\n\n/** The JSON representation of [[PointCloudDisplaySettings]].\n * @beta\n */\nexport interface PointCloudDisplayProps {\n /** See [[PointCloudDisplaySettings.sizeMode]]. */\n sizeMode?: PointCloudSizeMode;\n /** See [[PointCloudDisplaySettings.voxelScale]]. */\n voxelScale?: number;\n /** See [[PointCloudDisplaySettings.minPixelsPerVoxel]]. */\n minPixelsPerVoxel?: number;\n /** See [[PointCloudDisplaySettings.maxPixelsPerVoxel]]. */\n maxPixelsPerVoxel?: number;\n /** See [[PointCloudDisplaySettings.pixelSize]]. */\n pixelSize?: number;\n /** See [[PointCloudDisplaySettings.shape]]. */\n shape?: PointCloudShape;\n /** See [[PointCloudDisplaySettings.edlMode]]. */\n edlMode?: PointCloudEDLMode;\n /** See [[PointCloudDisplaySettings.edlStrength]]. */\n edlStrength?: number;\n /** See [[PointCloudDisplaySettings.edlRadius]]. */\n edlRadius?: number;\n /** See [[PointCloudDisplaySettings.edlFilter]]. */\n edlFilter?: number;\n /** See [[PointCloudDisplaySettings.edlMixWts1]]. */\n edlMixWts1?: number;\n /** See [[PointCloudDisplaySettings.edlMixWts2]]. */\n edlMixWts2?: number;\n /** See [[PointCloudDisplaySettings.edlMixWts4]]. */\n edlMixWts4?: number;\n}\n\n/** The JSON representation of [[RealityModelDisplaySettings]].\n * @beta\n */\nexport interface RealityModelDisplayProps {\n /** See [[RealityModelDisplaySettings.pointCloud]]. */\n pointCloud?: PointCloudDisplayProps;\n /** See [[RealityModelDisplaySettings.overrideColorRatio]]. */\n overrideColorRatio?: number;\n // ###TODO when we need it: mesh?: RealityMeshDisplayProps;\n}\n\n/** Settings that control how a point cloud reality model is displayed within a [Viewport]($frontend).\n * @note This is an immutable type - to modify its properties, use [[clone]].\n * Eye-Dome Lighting (EDL) is a non-photorealistic, image-based shading technique that was designed to improve depth\n * perception in scientific visualization. It is particularly useful for visualizing monochrome point cloud data, but\n * also can be useful for point clouds with color information.\n * @note EDL mode is ignored (off) if the view is not perspective (camera is off)\n * @see [[RealityModelDisplaySettings.pointCloud]].\n * @beta\n */\nexport class PointCloudDisplaySettings {\n /** The shape drawn for each point in the cloud.\n * Default: \"round\".\n */\n public readonly shape: PointCloudShape;\n /** The method by which the size of each individual point is computed.\n * Default: \"voxel\".\n * @see [[pixelSize]] to configure the size for \"pixel\" mode.\n * @see [[voxelScale]], [[minPixelsPerVoxel]], and [[maxPixelsPerVoxel]] to configure the size for \"voxel\" mode.\n */\n public readonly sizeMode: PointCloudSizeMode;\n /** The radius of each point in pixels, when [[sizeMode]] is \"pixel\".\n * The size is expected to be a positive integer. The maximum size will vary based on the graphics hardware in use, but typically is limited to 32 or 64 pixels.\n * Default: 1\n */\n public readonly pixelSize: number;\n /** A scale factor applied to the size of each point, when [[sizeMode]] is \"voxel\".\n * The scale is expected to be a positive floating point number.\n * Default: 1.0\n */\n public readonly voxelScale: number;\n /** If [[sizeMode]] is \"voxel\", the minimum radius of each point in pixels. It is expected to be a positive integer no greater than [[maxPixelsPerVoxel]].\n * Default: 2\n */\n public readonly minPixelsPerVoxel: number;\n /** If [[sizeMode]] is \"voxel\", the maximum radius of each point in pixels. It is expected to be a positive integer no less than [[minPixelsPerVoxel]].\n * Default: 20.\n */\n public readonly maxPixelsPerVoxel: number;\n /** The mode for the Eye-Dome Lighting (EDL) effect.\n * Default: \"off\"\n * @note EDL mode is ignored (off) if the view is not perspective (camera is off)\n */\n public readonly edlMode: PointCloudEDLMode;\n /** A strength value for the Eye Dome Lighting (EDL) effect.\n * The strength is expected to be a positive floating point number.\n * Default: 5.0\n */\n public readonly edlStrength: number;\n /** A radius value for the Eye Dome Lighting (EDL) effect.\n * The radius is expected to be a positive floating point number\n * It is used to deterimine how far away in pixels to sample for depth change\n * Default: 2.0\n */\n public readonly edlRadius: number;\n /** A flag for whether or not to apply filtering pass in the Eye Dome Lighting (EDL) effect.\n * It only applies if edlMode is \"full\"\n * Default: 1.0\n */\n public readonly edlFilter?: number;\n /** A weighting value to apply to the full image when combining it with the half and quarter sized ones\n * It only applies if edlMode is \"full\"\n * The strength is expected to be a floating point number between 0 and 1 inclusive.\n * Default: 1.0\n */\n public readonly edlMixWts1?: number;\n /** A weighting value to apply to the half sized image when combining it with the full and quarter sized ones\n * It only applies if edlMode is \"full\"\n * The strength is expected to be a floating point number between 0 and 1 inclusive.\n * Default: 0.5\n */\n public readonly edlMixWts2?: number;\n /** A weighting value to apply to the quarter sized image when combining it with the full and half sized ones\n * It only applies if edlMode is \"full\"\n * The strength is expected to be a floating point number between 0 and 1 inclusive.\n * Default: 0.25\n */\n public readonly edlMixWts4?: number;\n\n /** Settings with all properties initialized to their default values. */\n public static defaults = new PointCloudDisplaySettings();\n\n private constructor(props?: PointCloudDisplayProps) {\n this.shape = props?.shape ?? \"round\";\n this.sizeMode = props?.sizeMode ?? \"voxel\";\n\n // No sanity checks here - e.g., min < max, pixelSize and voxelScale > 0, etc.\n this.pixelSize = props?.pixelSize ?? 1;\n this.voxelScale = props?.voxelScale ?? 1;\n this.minPixelsPerVoxel = props?.minPixelsPerVoxel ?? 2;\n this.maxPixelsPerVoxel = props?.maxPixelsPerVoxel ?? 20;\n this.edlMode = props?.edlMode ?? \"off\";\n this.edlStrength = props?.edlStrength ?? 5;\n this.edlRadius = props?.edlRadius ?? 2;\n this.edlFilter = props?.edlFilter ?? 1;\n this.edlMixWts1 = props?.edlMixWts1 ?? 1.0;\n this.edlMixWts2 = props?.edlMixWts2 ?? 0.5;\n this.edlMixWts4 = props?.edlMixWts4 ?? 0.25;\n }\n\n /** Create display settings from their JSON representation. If `props` is `undefined`, the default settings are returned. */\n public static fromJSON(props?: PointCloudDisplayProps): PointCloudDisplaySettings {\n return props ? new PointCloudDisplaySettings(props) : this.defaults;\n }\n\n /** Convert these settings to their JSON representation. */\n public toJSON(): PointCloudDisplayProps | undefined {\n const defs = PointCloudDisplaySettings.defaults;\n if (this.equals(defs))\n return undefined;\n\n const props: PointCloudDisplayProps = { };\n if (this.shape !== defs.shape)\n props.shape = this.shape;\n\n if (this.sizeMode !== defs.sizeMode)\n props.sizeMode = this.sizeMode;\n\n if (this.pixelSize !== defs.pixelSize)\n props.pixelSize = this.pixelSize;\n\n if (this.voxelScale !== defs.voxelScale)\n props.voxelScale = this.voxelScale;\n\n if (this.minPixelsPerVoxel !== defs.minPixelsPerVoxel)\n props.minPixelsPerVoxel = this.minPixelsPerVoxel;\n\n if (this.maxPixelsPerVoxel !== defs.maxPixelsPerVoxel)\n props.maxPixelsPerVoxel = this.maxPixelsPerVoxel;\n\n if (this.edlMode !== defs.edlMode)\n props.edlMode = this.edlMode;\n\n if (this.edlStrength !== defs.edlStrength)\n props.edlStrength = this.edlStrength;\n\n if (this.edlRadius !== defs.edlRadius)\n props.edlRadius = this.edlRadius;\n\n if (this.edlFilter !== defs.edlFilter)\n props.edlFilter = this.edlFilter;\n\n if (this.edlMixWts1 !== defs.edlMixWts1)\n props.edlMixWts1 = this.edlMixWts1;\n\n if (this.edlMixWts2 !== defs.edlMixWts2)\n props.edlMixWts2 = this.edlMixWts2;\n\n if (this.edlMixWts4 !== defs.edlMixWts4)\n props.edlMixWts4 = this.edlMixWts4;\n\n return props;\n }\n\n /** Create a copy of these settings, identical except for any properties explicitly specified by `changedProps`. */\n public clone(changedProps: PointCloudDisplayProps): PointCloudDisplaySettings {\n return PointCloudDisplaySettings.fromJSON({\n ...this.toJSON(),\n ...changedProps,\n });\n }\n\n /** Returns true if these settings are identical to `other`. */\n public equals(other: PointCloudDisplaySettings): boolean {\n if (this === other)\n return true;\n\n return this.shape === other.shape && this.sizeMode === other.sizeMode && this.pixelSize === other.pixelSize\n && this.voxelScale === other.voxelScale && this.minPixelsPerVoxel === other.minPixelsPerVoxel && this.maxPixelsPerVoxel === other.maxPixelsPerVoxel\n && this.edlMode === other.edlMode && this.edlStrength === other.edlStrength && this.edlRadius === other.edlRadius\n && this.edlFilter === other.edlFilter\n && this.edlMixWts1 === other.edlMixWts1 && this.edlMixWts2 === other.edlMixWts2 && this.edlMixWts4 === other.edlMixWts4\n ;\n }\n}\n\n/** Settings that control how a reality model - whether a [[ContextRealityModel]] or a persistent reality [Model]($backend) - is displayed within a [Viewport]($frontend).\n * @see [[ContextRealityModel.displaySettings]] to apply these settings to a context reality model.\n * @see [[DisplayStyleSettings.setRealityModelDisplaySettings]] to apply these settings to a persistent reality model.\n * @note This is an immutable type - to modify its properties, use [[clone]].\n * @beta\n */\nexport class RealityModelDisplaySettings {\n /** If the reality model's color is overridden with another color, a ratio in [0..1] with which to mix the two colors together.\n * A ratio of 0 uses only the reality model's color, a ratio of 1 uses only the override color, and a ratio of 0.5 mixes the two colors equally.\n * The color may be overridden using [[FeatureOverrides]] such as those supplied by a [FeatureOverrideProvider]($frontend), or by applying a [[SpatialClassifier]].\n * Default: 0.5\n */\n public readonly overrideColorRatio: number;\n /** Settings that apply specifically to point cloud reality models.\n * Default: [[PointCloudDisplaySettings.defaults]].\n */\n public readonly pointCloud: PointCloudDisplaySettings;\n\n /** Settings with all properties initialized to their default values. */\n public static defaults = new RealityModelDisplaySettings(undefined, PointCloudDisplaySettings.defaults);\n\n private constructor(overrideColorRatio: number | undefined, pointCloud: PointCloudDisplaySettings) {\n this.overrideColorRatio = overrideColorRatio ?? 0.5;\n this.pointCloud = pointCloud;\n }\n\n /** Create display settings from their JSON representation. If `props` is `undefined`, the default settings are returned. */\n public static fromJSON(props?: RealityModelDisplayProps): RealityModelDisplaySettings {\n if (!props)\n return this.defaults;\n\n return new RealityModelDisplaySettings(props.overrideColorRatio, PointCloudDisplaySettings.fromJSON(props.pointCloud));\n }\n\n /** Convert these settings to their JSON representation, which is `undefined` if all of their properties match the default settings. */\n public toJSON(): RealityModelDisplayProps | undefined {\n const pointCloud = this.pointCloud.toJSON();\n const overrideColorRatio = this.overrideColorRatio === RealityModelDisplaySettings.defaults.overrideColorRatio ? undefined : this.overrideColorRatio;\n\n if (undefined === pointCloud && undefined === overrideColorRatio)\n return undefined;\n\n const props: RealityModelDisplayProps = { };\n if (undefined !== pointCloud)\n props.pointCloud = pointCloud;\n\n if (undefined !== overrideColorRatio)\n props.overrideColorRatio = overrideColorRatio;\n\n return props;\n }\n\n /** Returns true if these settings are identical to `other`. */\n public equals(other: RealityModelDisplaySettings): boolean {\n if (this === other)\n return true;\n\n return this.overrideColorRatio === other.overrideColorRatio && this.pointCloud.equals(other.pointCloud);\n }\n\n /** Create a copy of these settings, identical except for any properties explicitly specified by `changedProps`. */\n public clone(changedProps: RealityModelDisplayProps): RealityModelDisplaySettings {\n const pointCloud = changedProps.pointCloud ? this.pointCloud.clone(changedProps.pointCloud) : this.pointCloud;\n const colorRatio = changedProps.hasOwnProperty(\"overrideColorRatio\") ? changedProps.overrideColorRatio : this.overrideColorRatio;\n return new RealityModelDisplaySettings(colorRatio, pointCloud);\n }\n}\n"]}
@@ -50,6 +50,9 @@ exports.RenderMaterial = RenderMaterial;
50
50
  this.shadows = true;
51
51
  this.key = key;
52
52
  }
53
+ /** Obtain an immutable instance of a RenderMaterial with all default properties. */
54
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
55
+ static { this.defaults = new Params(); }
53
56
  /** A value from 0.0 (fully-transparent) to 1.0 (fully-opaque) controlling the transparency of surfaces to which this material is applied;
54
57
  * or undefined if this material does not override surface transparency.
55
58
  */
@@ -71,9 +74,6 @@ exports.RenderMaterial = RenderMaterial;
71
74
  return materialParams;
72
75
  }
73
76
  }
74
- /** Obtain an immutable instance of a RenderMaterial with all default properties. */
75
- // eslint-disable-next-line @typescript-eslint/no-deprecated
76
- Params.defaults = new Params();
77
77
  RenderMaterial.Params = Params;
78
78
  })(RenderMaterial || (exports.RenderMaterial = RenderMaterial = {}));
79
79
  // eslint-disable-next-line @typescript-eslint/no-deprecated
@@ -1 +1 @@
1
- {"version":3,"file":"RenderMaterial.js","sourceRoot":"","sources":["../../src/RenderMaterial.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAuE;AAIvE;;GAEG;AACH,MAAsB,cAAc;IAQlC,YAAsB,MAAyD;QAC7E,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;QACtB,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;QAC5C,IA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AuB,EAAE,aAAwB,EAAE,aAAwB,EAAE,YAAuB,EAAE,UAA2B;YACtK,4DAA4D;YAC5D,MAAM,cAAc,GAAG,IAAI,MAAM,EAAE,CAAC;YACpC,cAAc,CAAC,GAAG,GAAG,GAAG,CAAC;YACzB,cAAc,CAAC,YAAY,GAAG,YAAY,CAAC;YAC3C,cAAc,CAAC,aAAa,GAAG,aAAa,CAAC;YAC7C,cAAc,CAAC,aAAa,GAAG,aAAa,CAAC;YAC7C,cAAc,CAAC,YAAY,GAAG,YAAY,CAAC;YAC3C,cAAc,CAAC,cAAc,GAAG,UAAU,CAAC;YAC3C,OAAO,cAAc,CAAC;QACxB,CAAC;;IAxBD,oFAAoF;IACpF,4DAA4D;IACrC,eAAQ,GAAG,IAAI,MAAM,EAAE,AAAf,CAAgB;IAhCpC,qBAAM,SAuDlB,CAAA;AACH,CAAC,EA9DgB,cAAc,8BAAd,cAAc,QA8D9B;AAED,4DAA4D;AAC5D,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Rendering\n */\n\nimport { compareStrings, Guid, GuidString } from \"@itwin/core-bentley\";\nimport { ColorDef } from \"./ColorDef\";\nimport { TextureMapping } from \"./TextureMapping\";\n\n/** Represents a material which can be applied to a surface to control aspects of its appearance such as color, reflectivity, texture, and so on.\n * @public\n */\nexport abstract class RenderMaterial {\n /** If the material originated from a Material element in the [[IModelDb]], the Id of that element. */\n public readonly key?: string;\n /** Describes how to map an image to a surface to which this material is applied. */\n public readonly textureMapping?: TextureMapping;\n /** Used for ordered comparisons, e.g. in DisplayParams.compareForMerge */\n private readonly _guid: GuidString;\n\n protected constructor(params: { key?: string, textureMapping?: TextureMapping }) {\n this.key = params.key;\n this.textureMapping = params.textureMapping;\n this._guid = Guid.createValue();\n }\n\n public get hasTexture(): boolean {\n return undefined !== this.textureMapping?.texture;\n }\n\n /** An [OrderedComparator]($bentley) that compares this material against `other`. */\n public compare(other: RenderMaterial): number {\n return compareStrings(this._guid, other._guid);\n }\n}\n\n/** @public */\nexport namespace RenderMaterial {\n function clampToNormalizedRange(value: number): number {\n return Math.max(0.0, Math.min(1.0, value));\n }\n\n /** @deprecated in 3.x. Use [CreateRenderMaterialArgs]($frontend). */\n export class Params {\n /** If the material originates from a Material element in the [[IModel]], the Id of that element. */\n public key?: string;\n /** Diffuse color, or undefined if this material does not override the surface's own color. */\n public diffuseColor?: ColorDef;\n /** Specular color. Defaults to white if undefined. */\n public specularColor?: ColorDef;\n /** Currently unused. @alpha */\n public emissiveColor?: ColorDef;\n /** Currently unused. @alpha */\n public reflectColor?: ColorDef;\n /** Optional pattern mapping applied to the surface. */\n public textureMapping?: TextureMapping;\n /** Diffuse weight in [0..1] */\n public diffuse: number = 0.6;\n /** Specular weight in [0..1] */\n public specular: number = 0.4;\n public specularExponent: number = 13.5;\n /** Currently unused. @alpha */\n public reflect: number = 0.0;\n /** Currently unused. @alpha */\n public refract: number = 1.0;\n /** Currently unused. @alpha */\n public ambient: number = .3;\n /** Currently unused. @alpha */\n public shadows = true;\n private _alpha?: number;\n\n public constructor(key?: string) { this.key = key; }\n\n /** Obtain an immutable instance of a RenderMaterial with all default properties. */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public static readonly defaults = new Params();\n\n /** A value from 0.0 (fully-transparent) to 1.0 (fully-opaque) controlling the transparency of surfaces to which this material is applied;\n * or undefined if this material does not override surface transparency.\n */\n public get alpha(): number | undefined { return this._alpha; }\n public set alpha(alpha: number | undefined) {\n this._alpha = undefined !== alpha ? clampToNormalizedRange(alpha) : undefined;\n }\n\n /** Create a RenderMaterial params object using specified key and ColorDef values, as well as an optional texture mapping. */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public static fromColors(key?: string, diffuseColor?: ColorDef, specularColor?: ColorDef, emissiveColor?: ColorDef, reflectColor?: ColorDef, textureMap?: TextureMapping): Params {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const materialParams = new Params();\n materialParams.key = key;\n materialParams.diffuseColor = diffuseColor;\n materialParams.specularColor = specularColor;\n materialParams.emissiveColor = emissiveColor;\n materialParams.reflectColor = reflectColor;\n materialParams.textureMapping = textureMap;\n return materialParams;\n }\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nObject.freeze(RenderMaterial.Params.defaults);\n"]}
1
+ {"version":3,"file":"RenderMaterial.js","sourceRoot":"","sources":["../../src/RenderMaterial.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAuE;AAIvE;;GAEG;AACH,MAAsB,cAAc;IAQlC,YAAsB,MAAyD;QAC7E,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;QACtB,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;QAC5C,IAAI,CAAC,KAAK,GAAG,mBAAI,CAAC,WAAW,EAAE,CAAC;IAClC,CAAC;IAED,IAAW,UAAU;QACnB,OAAO,SAAS,KAAK,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC;IACpD,CAAC;IAED,oFAAoF;IAC7E,OAAO,CAAC,KAAqB;QAClC,OAAO,IAAA,6BAAc,EAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;CACF;AAtBD,wCAsBC;AAED,cAAc;AACd,WAAiB,cAAc;IAC7B,SAAS,sBAAsB,CAAC,KAAa;QAC3C,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED,qEAAqE;IACrE,MAAa,MAAM;QA4BjB,YAAmB,GAAY;YAf/B,+BAA+B;YACxB,YAAO,GAAW,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A4D;AAC5D,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Rendering\n */\n\nimport { compareStrings, Guid, GuidString } from \"@itwin/core-bentley\";\nimport { ColorDef } from \"./ColorDef\";\nimport { TextureMapping } from \"./TextureMapping\";\n\n/** Represents a material which can be applied to a surface to control aspects of its appearance such as color, reflectivity, texture, and so on.\n * @public\n */\nexport abstract class RenderMaterial {\n /** If the material originated from a Material element in the [[IModelDb]], the Id of that element. */\n public readonly key?: string;\n /** Describes how to map an image to a surface to which this material is applied. */\n public readonly textureMapping?: TextureMapping;\n /** Used for ordered comparisons, e.g. in DisplayParams.compareForMerge */\n private readonly _guid: GuidString;\n\n protected constructor(params: { key?: string, textureMapping?: TextureMapping }) {\n this.key = params.key;\n this.textureMapping = params.textureMapping;\n this._guid = Guid.createValue();\n }\n\n public get hasTexture(): boolean {\n return undefined !== this.textureMapping?.texture;\n }\n\n /** An [OrderedComparator]($bentley) that compares this material against `other`. */\n public compare(other: RenderMaterial): number {\n return compareStrings(this._guid, other._guid);\n }\n}\n\n/** @public */\nexport namespace RenderMaterial {\n function clampToNormalizedRange(value: number): number {\n return Math.max(0.0, Math.min(1.0, value));\n }\n\n /** @deprecated in 3.x. Use [CreateRenderMaterialArgs]($frontend). */\n export class Params {\n /** If the material originates from a Material element in the [[IModel]], the Id of that element. */\n public key?: string;\n /** Diffuse color, or undefined if this material does not override the surface's own color. */\n public diffuseColor?: ColorDef;\n /** Specular color. Defaults to white if undefined. */\n public specularColor?: ColorDef;\n /** Currently unused. @alpha */\n public emissiveColor?: ColorDef;\n /** Currently unused. @alpha */\n public reflectColor?: ColorDef;\n /** Optional pattern mapping applied to the surface. */\n public textureMapping?: TextureMapping;\n /** Diffuse weight in [0..1] */\n public diffuse: number = 0.6;\n /** Specular weight in [0..1] */\n public specular: number = 0.4;\n public specularExponent: number = 13.5;\n /** Currently unused. @alpha */\n public reflect: number = 0.0;\n /** Currently unused. @alpha */\n public refract: number = 1.0;\n /** Currently unused. @alpha */\n public ambient: number = .3;\n /** Currently unused. @alpha */\n public shadows = true;\n private _alpha?: number;\n\n public constructor(key?: string) { this.key = key; }\n\n /** Obtain an immutable instance of a RenderMaterial with all default properties. */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public static readonly defaults = new Params();\n\n /** A value from 0.0 (fully-transparent) to 1.0 (fully-opaque) controlling the transparency of surfaces to which this material is applied;\n * or undefined if this material does not override surface transparency.\n */\n public get alpha(): number | undefined { return this._alpha; }\n public set alpha(alpha: number | undefined) {\n this._alpha = undefined !== alpha ? clampToNormalizedRange(alpha) : undefined;\n }\n\n /** Create a RenderMaterial params object using specified key and ColorDef values, as well as an optional texture mapping. */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public static fromColors(key?: string, diffuseColor?: ColorDef, specularColor?: ColorDef, emissiveColor?: ColorDef, reflectColor?: ColorDef, textureMap?: TextureMapping): Params {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const materialParams = new Params();\n materialParams.key = key;\n materialParams.diffuseColor = diffuseColor;\n materialParams.specularColor = specularColor;\n materialParams.emissiveColor = emissiveColor;\n materialParams.reflectColor = reflectColor;\n materialParams.textureMapping = textureMap;\n return materialParams;\n }\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nObject.freeze(RenderMaterial.Params.defaults);\n"]}
package/lib/cjs/SkyBox.js CHANGED
@@ -52,6 +52,8 @@ class SkyGradient {
52
52
  this.skyExponent = args.skyExponent ?? defaultExponent;
53
53
  this.groundExponent = args.groundExponent ?? defaultExponent;
54
54
  }
55
+ /** Default settings for a four-color gradient. */
56
+ static { this.defaults = new SkyGradient({}); }
55
57
  /** Create a new gradient. Any properties not specified by `props` are initialized to their default values. */
56
58
  static create(props) {
57
59
  return props ? new this(props) : this.defaults;
@@ -101,8 +103,6 @@ class SkyGradient {
101
103
  }
102
104
  }
103
105
  exports.SkyGradient = SkyGradient;
104
- /** Default settings for a four-color gradient. */
105
- SkyGradient.defaults = new SkyGradient({});
106
106
  /** Describes how to draw a representation of a sky, as part of an [[Environment]].
107
107
  * @see [[SkyBoxProps]].
108
108
  * @public
@@ -111,6 +111,8 @@ class SkyBox {
111
111
  constructor(gradient) {
112
112
  this.gradient = gradient;
113
113
  }
114
+ /** Default settings for a four-color gradient. */
115
+ static { this.defaults = new SkyBox(SkyGradient.defaults); }
114
116
  /** Create a skybox that displays the specified gradient, or the default gradient if none is supplied. */
115
117
  static createGradient(gradient) {
116
118
  return gradient ? new this(gradient) : this.defaults;
@@ -149,8 +151,6 @@ class SkyBox {
149
151
  }
150
152
  }
151
153
  exports.SkyBox = SkyBox;
152
- /** Default settings for a four-color gradient. */
153
- SkyBox.defaults = new SkyBox(SkyGradient.defaults);
154
154
  /** Describes how to draw a representation of a sky by mapping a single image to the interior of a sphere.
155
155
  * @public
156
156
  */
@@ -1 +1 @@
1
- {"version":3,"file":"SkyBox.js","sourceRoot":"","sources":["../../src/SkyBox.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAgF;AAChF,yCAAqD;AAGrD;;;;GAIG;AACH,IAAY,eAaX;AAbD,WAAY,eAAe;IACzB,kEAAkE;IAClE,qDAAQ,CAAA;IACR;;OAEG;IACH,+DAAa,CAAA;IACb,kCAAkC;IAClC,mEAAe,CAAA;IACf;;OAEG;IACH,qDAAQ,CAAA;AACV,CAAC,EAbW,eAAe,+BAAf,eAAe,QAa1B;AA4GD,MAAM,kBAAkB,GAAG,mBAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACxD,MAAM,kBAAkB,GAAG,mBAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,G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C;QAEF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,gBAAgB;IAChB,IAAoB,UAAU;QAC5B,OAAO,mBAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1D,CAAC;CACF;AA5BD,8BA4BC;AAED;;;GAGG;AACH,MAAa,OAAQ,SAAQ,MAAM;IAIjC;;;OAGG;IACH,YAAmB,MAAoB,EAAE,QAAsB;QAC7D,KAAK,CAAC,QAAQ,IAAI,WAAW,CAAC,QAAQ,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;IAC9B,CAAC;IAED,6BAA6B;IACb,MAAM,CAAC,OAAiB;QACtC,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACpC,KAAK,CAAC,KAAK,GAAG;YACZ,IAAI,EAAE,eAAe,CAAC,IAAI;YAC1B,QAAQ,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE;SAC7B,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,gBAAgB;IAChB,IAAoB,UAAU;QAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,mBAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAClH,CAAC;CACF;AA7BD,0BA6BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module DisplayStyles\n */\n\nimport { Id64, Id64String, NonFunctionPropertiesOf } from \"@itwin/core-bentley\";\nimport { ColorDef, ColorDefProps } from \"./ColorDef\";\nimport { TextureImageSpec } from \"./RenderTexture\";\n\n/** Supported types of [[SkyBox]] images.\n * @see [[SkyBoxImageProps]].\n * @public\n * @extensions\n */\nexport enum SkyBoxImageType {\n /** No image, indicating a [[SkyGradient]] should be displayed. */\n None = 0,\n /** A single image mapped to the surface of a sphere.\n * @see [[SkySphere]].\n */\n Spherical = 1,\n /** @internal not yet supported */\n Cylindrical = 2,\n /** Six images mapped to the faces of a cube.\n * @see [[SkyCube]].\n */\n Cube = 3,\n}\n\n/** JSON representation of the six images used by a [[SkyCube]].\n * Each property specifies the image for a face of the cube as either an image URL, or the Id of a [Texture]($backend) element.\n * Each image must be square and have the same dimensions as all the other images.\n * @public\n * @extensions\n */\nexport interface SkyCubeProps {\n front: TextureImageSpec;\n back: TextureImageSpec;\n top: TextureImageSpec;\n bottom: TextureImageSpec;\n right: TextureImageSpec;\n left: TextureImageSpec;\n}\n\n/** JSON representation of the image used for a [[SkySphere]].\n * @see [[SkyBoxProps.image]].\n * @public\n */\nexport interface SkySphereImageProps {\n type: SkyBoxImageType.Spherical;\n texture: TextureImageSpec;\n /** @internal */\n textures?: never;\n}\n\n/** JSON representation of the images used for a [[SkyCube]].\n * @see [[SkyBoxProps.image]].\n * @public\n */\nexport interface SkyCubeImageProps {\n type: SkyBoxImageType.Cube;\n textures: SkyCubeProps;\n /** @internal */\n texture?: never;\n}\n\n/** JSON representation of the image(s) to be mapped to the surfaces of a [[SkyBox]].\n * @see [[SkyBoxProps.image]].\n * @public\n * @extensions\n */\nexport type SkyBoxImageProps = SkySphereImageProps | SkyCubeImageProps | { type?: SkyBoxImageType, texture?: never, textures?: never };\n\n/** JSON representation of a [[SkyBox]] that can be drawn as the background of a [ViewState3d]($frontend).\n * An object of this type can describe one of several types of sky box:\n * - A cube with a texture image mapped to each face; or\n * - A sphere with a single texture image mapped to its surface; or\n * - A sphere with a two- or four-color vertical [[Gradient]] mapped to its surface.\n *\n * Whether cuboid or spherical, the skybox is drawn as if the viewer and the contents of the view are contained within its interior.\n *\n * For a two-color gradient, the gradient transitions smoothly from the nadir color at the bottom of the sphere to the zenith color at the top of the sphere.\n * The sky and ground colors are unused, as are the sky and ground exponents.\n *\n * For a four-color gradient, a \"horizon\" is produced on the equator of the sphere, where the ground color and sky color meet. The lower half of the sphere transitions\n * smoothly from the ground color at the equator to the nadir color at the bottom, and the upper half transitions from the sky color at the equator to the zenith color at\n * the top of the sphere.\n *\n * The color and exponent properties are unused if one or more texture images are supplied.\n *\n * The skybox is ignored entirely when an atmosphere is displayed.\n *\n * @see [[DisplayStyle3dSettings.environment]] to define the skybox for a display style.\n * @public\n * @extensions\n */\nexport interface SkyBoxProps {\n /** Whether or not the skybox should be displayed.\n * Default: false.\n */\n display?: boolean;\n /** For a [[SkyGradient]], if true, a 2-color gradient skybox is used instead of a 4-color.\n * Default: false.\n */\n twoColor?: boolean;\n /** The color of the sky at the horizon. Unused unless this is a four-color [[SkyGradient]].\n * Default: (143, 205, 255).\n */\n skyColor?: ColorDefProps;\n /** The color of the ground at the horizon. Unused unless this is a four-color [[SkyGradient]].\n * Default: (120, 143, 125).\n */\n groundColor?: ColorDefProps;\n /** The color of the top of the sphere.\n * Default: (54, 117, 255).\n */\n zenithColor?: ColorDefProps;\n /** The color of the bottom of the sphere.\n * Default: (40, 15, 0).\n */\n nadirColor?: ColorDefProps;\n /** For a 4-color [[SkyGradient]], controls speed of change from sky color to zenith color; otherwise unused.\n * Default: 4.0.\n */\n skyExponent?: number;\n /** For a 4-color [[SkyGradient]], controls speed of change from ground color to nadir color; otherwise unused.\n * Default: 4.0.\n */\n groundExponent?: number;\n /** The image(s), if any, to be mapped to the surfaces of the sphere or cube. If undefined, the skybox will be displayed as a gradient instead.\n * Default: undefined.\n */\n image?: SkyBoxImageProps;\n}\n\nconst defaultGroundColor = ColorDef.from(143, 205, 125);\nconst defaultZenithColor = ColorDef.from(54, 117, 255);\nconst defaultNadirColor = ColorDef.from(40, 125, 0);\nconst defaultSkyColor = ColorDef.from(142, 205, 255);\nconst defaultExponent = 4.0;\n\nfunction colorDefFromJson(props?: ColorDefProps): ColorDef | undefined {\n return undefined !== props ? ColorDef.fromJSON(props) : undefined;\n}\n\n/** A type containing all of the properties and none of the methods of [[SkyGradient]] with `readonly` modifiers removed.\n * @see [[SkyGradient.create]] and [[SkyGradient.clone]].\n * @public\n */\nexport type SkyGradientProperties = NonFunctionPropertiesOf<SkyGradient>;\n\n/** Describes how to map a two- or four-color [[Gradient]] to the interior of a sphere to produce a [[SkyBox]].\n * @see [[SkyBox.gradient]].\n * @public\n */\nexport class SkyGradient {\n public readonly twoColor: boolean;\n public readonly skyColor: ColorDef;\n public readonly groundColor: ColorDef;\n public readonly zenithColor: ColorDef;\n public readonly nadirColor: ColorDef;\n public readonly skyExponent: number;\n public readonly groundExponent: number;\n\n private constructor(args: Partial<SkyGradientProperties>) {\n this.twoColor = args.twoColor ?? false;\n this.skyColor = args.skyColor ?? defaultSkyColor;\n this.groundColor = args.groundColor ?? defaultGroundColor;\n this.nadirColor = args.nadirColor ?? defaultNadirColor;\n this.zenithColor = args.zenithColor ?? defaultZenithColor;\n this.skyExponent = args.skyExponent ?? defaultExponent;\n this.groundExponent = args.groundExponent ?? defaultExponent;\n }\n\n /** Default settings for a four-color gradient. */\n public static readonly defaults = new SkyGradient({});\n\n /** Create a new gradient. Any properties not specified by `props` are initialized to their default values. */\n public static create(props?: Partial<SkyGradientProperties>): SkyGradient {\n return props ? new this(props) : this.defaults;\n }\n\n /** Create from JSON representation. */\n public static fromJSON(props?: SkyBoxProps): SkyGradient {\n if (!props)\n return this.defaults;\n\n return new this({\n twoColor: props.twoColor,\n skyExponent: props.skyExponent,\n groundExponent: props.groundExponent,\n skyColor: colorDefFromJson(props.skyColor),\n groundColor: colorDefFromJson(props.groundColor),\n nadirColor: colorDefFromJson(props.nadirColor),\n zenithColor: colorDefFromJson(props.zenithColor),\n });\n }\n\n /** Create ea copy of this gradient, identical except for any properties explicitly specified by `changedProps`.\n * Any properties of `changedProps` explicitly set to `undefined` will be reset to their default values.\n */\n public clone(changedProps: SkyGradientProperties): SkyGradient {\n return new SkyGradient({ ...this, ...changedProps });\n }\n\n /** Convert to JSON representation. */\n public toJSON(): SkyBoxProps {\n const props: SkyBoxProps = {\n skyColor: this.skyColor.toJSON(),\n groundColor: this.groundColor.toJSON(),\n nadirColor: this.nadirColor.toJSON(),\n zenithColor: this.zenithColor.toJSON(),\n };\n\n if (this.groundExponent !== defaultExponent)\n props.groundExponent = this.groundExponent;\n\n if (this.skyExponent !== defaultExponent)\n props.skyExponent = this.skyExponent;\n\n if (this.twoColor)\n props.twoColor = this.twoColor;\n\n return props;\n }\n\n /** Returns true if this gradient is equivalent to the supplied gradient. */\n public equals(other: SkyGradient): boolean {\n if (this === other)\n return true;\n\n return this.twoColor === other.twoColor && this.skyColor.equals(other.skyColor) && this.groundColor.equals(other.groundColor) &&\n this.zenithColor.equals(other.zenithColor) && this.nadirColor.equals(other.nadirColor);\n }\n}\n\n/** Describes how to draw a representation of a sky, as part of an [[Environment]].\n * @see [[SkyBoxProps]].\n * @public\n */\nexport class SkyBox {\n /** The gradient settings, used if no cube or sphere images are supplied, or if the images cannot be loaded. */\n public readonly gradient: SkyGradient;\n\n protected constructor(gradient: SkyGradient) {\n this.gradient = gradient;\n }\n\n /** Default settings for a four-color gradient. */\n public static readonly defaults = new SkyBox(SkyGradient.defaults);\n\n /** Create a skybox that displays the specified gradient, or the default gradient if none is supplied. */\n public static createGradient(gradient?: SkyGradient): SkyBox {\n return gradient ? new this(gradient) : this.defaults;\n }\n\n /** Create from JSON representation. */\n public static fromJSON(props?: SkyBoxProps): SkyBox {\n const gradient = SkyGradient.fromJSON(props);\n\n if (props?.image) {\n switch (props.image.type) {\n case SkyBoxImageType.Spherical:\n if (undefined !== props.image.texture)\n return new SkySphere(props.image.texture, gradient);\n\n break;\n case SkyBoxImageType.Cube: {\n const tx = props.image.textures;\n if (tx && undefined !== tx.top && undefined !== tx.bottom && undefined !== tx.right && undefined !== tx.left && undefined !== tx.front && undefined !== tx.back)\n return new SkyCube(tx, gradient);\n\n break;\n }\n }\n }\n\n return this.createGradient(gradient);\n }\n\n /** Convert to JSON representation.\n * @param display If defined, the value to use for [[SkyBoxProps.display]]; otherwise, that property will be left undefined.\n */\n public toJSON(display?: boolean): SkyBoxProps {\n const props = this.gradient.toJSON();\n if (undefined !== display)\n props.display = display;\n\n return props;\n }\n\n /** @internal */\n public get textureIds(): Iterable<Id64String> {\n return [];\n }\n}\n\n/** Describes how to draw a representation of a sky by mapping a single image to the interior of a sphere.\n * @public\n */\nexport class SkySphere extends SkyBox {\n /** The image to map to the interior of the sphere. */\n public readonly image: TextureImageSpec;\n\n /** Create a new sky sphere using the specified image.\n * @param image The image to map to the interior of the sphere.\n * @param gradient Optionally overrides the default gradient settings used if the image cannot be obtained.\n */\n public constructor(image: TextureImageSpec, gradient?: SkyGradient) {\n super(gradient ?? SkyGradient.defaults);\n this.image = image;\n }\n\n /** See [[SkyBox.toJSON]]. */\n public override toJSON(display?: boolean): SkyBoxProps {\n const props = super.toJSON(display);\n props.image = {\n type: SkyBoxImageType.Spherical,\n texture: this.image,\n };\n\n return props;\n }\n\n /** @internal */\n public override get textureIds(): Iterable<Id64String> {\n return Id64.isValidId64(this.image) ? [this.image] : [];\n }\n}\n\n/** Describes how to draw a representation of a sky by mapping images to the interior faces of a cube.\n * The images are required to be *square*, and each image must have the same dimensions as the other images.\n * @public\n */\nexport class SkyCube extends SkyBox {\n /** The images to map to each face of the cube. */\n public readonly images: SkyCubeProps;\n\n /** Create a new sky cube using the specified images.\n * @param images The images to map to each face of the cube.\n * @param gradient Optionally overrides the default gradient settings used if the images cannot be obtained.\n */\n public constructor(images: SkyCubeProps, gradient?: SkyGradient) {\n super(gradient ?? SkyGradient.defaults);\n this.images = { ...images };\n }\n\n /** See [[SkyBox.toJSON]]. */\n public override toJSON(display?: boolean): SkyBoxProps {\n const props = super.toJSON(display);\n props.image = {\n type: SkyBoxImageType.Cube,\n textures: { ...this.images },\n };\n\n return props;\n }\n\n /** @internal */\n public override get textureIds(): Iterable<Id64String> {\n const imgs = this.images;\n return [imgs.front, imgs.back, imgs.top, imgs.bottom, imgs.left, imgs.right].filter((x) => Id64.isValidId64(x));\n }\n}\n"]}
1
+ {"version":3,"file":"SkyBox.js","sourceRoot":"","sources":["../../src/SkyBox.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAgF;AAChF,yCAAqD;AAGrD;;;;GAIG;AACH,IAAY,eAaX;AAbD,WAAY,eAAe;IACzB,kEAAkE;IAClE,qDAAQ,CAAA;IACR;;OAEG;IACH,+DAAa,CAAA;IACb,kCAAkC;IAClC,mEAAe,CAAA;IACf;;OAEG;IACH,qDAAQ,CAAA;AACV,CAAC,EAbW,eAAe,+BAAf,eAAe,QAa1B;AA4GD,MAAM,kBAAkB,GAAG,mBAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACxD,MAAM,kBAAkB,GAAG,mBAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACvD,MAAM,iBAAiB,GAAG,mBAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AACpD,MAAM,eAAe,GAAG,mBAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACrD,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,SAAS,gBAAgB,CAAC,KAAqB;IAC7C,OAAO,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,mBAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACpE,CAAC;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,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;IAC9B,CAAC;IAED,6BAA6B;IACb,MAAM,CAAC,OAAiB;QACtC,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACpC,KAAK,CAAC,KAAK,GAAG;YACZ,IAAI,EAAE,eAAe,CAAC,IAAI;YAC1B,QAAQ,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE;SAC7B,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,gBAAgB;IAChB,IAAoB,UAAU;QAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,mBAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAClH,CAAC;CACF;AA7BD,0BA6BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module DisplayStyles\n */\n\nimport { Id64, Id64String, NonFunctionPropertiesOf } from \"@itwin/core-bentley\";\nimport { ColorDef, ColorDefProps } from \"./ColorDef\";\nimport { TextureImageSpec } from \"./RenderTexture\";\n\n/** Supported types of [[SkyBox]] images.\n * @see [[SkyBoxImageProps]].\n * @public\n * @extensions\n */\nexport enum SkyBoxImageType {\n /** No image, indicating a [[SkyGradient]] should be displayed. */\n None = 0,\n /** A single image mapped to the surface of a sphere.\n * @see [[SkySphere]].\n */\n Spherical = 1,\n /** @internal not yet supported */\n Cylindrical = 2,\n /** Six images mapped to the faces of a cube.\n * @see [[SkyCube]].\n */\n Cube = 3,\n}\n\n/** JSON representation of the six images used by a [[SkyCube]].\n * Each property specifies the image for a face of the cube as either an image URL, or the Id of a [Texture]($backend) element.\n * Each image must be square and have the same dimensions as all the other images.\n * @public\n * @extensions\n */\nexport interface SkyCubeProps {\n front: TextureImageSpec;\n back: TextureImageSpec;\n top: TextureImageSpec;\n bottom: TextureImageSpec;\n right: TextureImageSpec;\n left: TextureImageSpec;\n}\n\n/** JSON representation of the image used for a [[SkySphere]].\n * @see [[SkyBoxProps.image]].\n * @public\n */\nexport interface SkySphereImageProps {\n type: SkyBoxImageType.Spherical;\n texture: TextureImageSpec;\n /** @internal */\n textures?: never;\n}\n\n/** JSON representation of the images used for a [[SkyCube]].\n * @see [[SkyBoxProps.image]].\n * @public\n */\nexport interface SkyCubeImageProps {\n type: SkyBoxImageType.Cube;\n textures: SkyCubeProps;\n /** @internal */\n texture?: never;\n}\n\n/** JSON representation of the image(s) to be mapped to the surfaces of a [[SkyBox]].\n * @see [[SkyBoxProps.image]].\n * @public\n * @extensions\n */\nexport type SkyBoxImageProps = SkySphereImageProps | SkyCubeImageProps | { type?: SkyBoxImageType, texture?: never, textures?: never };\n\n/** JSON representation of a [[SkyBox]] that can be drawn as the background of a [ViewState3d]($frontend).\n * An object of this type can describe one of several types of sky box:\n * - A cube with a texture image mapped to each face; or\n * - A sphere with a single texture image mapped to its surface; or\n * - A sphere with a two- or four-color vertical [[Gradient]] mapped to its surface.\n *\n * Whether cuboid or spherical, the skybox is drawn as if the viewer and the contents of the view are contained within its interior.\n *\n * For a two-color gradient, the gradient transitions smoothly from the nadir color at the bottom of the sphere to the zenith color at the top of the sphere.\n * The sky and ground colors are unused, as are the sky and ground exponents.\n *\n * For a four-color gradient, a \"horizon\" is produced on the equator of the sphere, where the ground color and sky color meet. The lower half of the sphere transitions\n * smoothly from the ground color at the equator to the nadir color at the bottom, and the upper half transitions from the sky color at the equator to the zenith color at\n * the top of the sphere.\n *\n * The color and exponent properties are unused if one or more texture images are supplied.\n *\n * The skybox is ignored entirely when an atmosphere is displayed.\n *\n * @see [[DisplayStyle3dSettings.environment]] to define the skybox for a display style.\n * @public\n * @extensions\n */\nexport interface SkyBoxProps {\n /** Whether or not the skybox should be displayed.\n * Default: false.\n */\n display?: boolean;\n /** For a [[SkyGradient]], if true, a 2-color gradient skybox is used instead of a 4-color.\n * Default: false.\n */\n twoColor?: boolean;\n /** The color of the sky at the horizon. Unused unless this is a four-color [[SkyGradient]].\n * Default: (143, 205, 255).\n */\n skyColor?: ColorDefProps;\n /** The color of the ground at the horizon. Unused unless this is a four-color [[SkyGradient]].\n * Default: (120, 143, 125).\n */\n groundColor?: ColorDefProps;\n /** The color of the top of the sphere.\n * Default: (54, 117, 255).\n */\n zenithColor?: ColorDefProps;\n /** The color of the bottom of the sphere.\n * Default: (40, 15, 0).\n */\n nadirColor?: ColorDefProps;\n /** For a 4-color [[SkyGradient]], controls speed of change from sky color to zenith color; otherwise unused.\n * Default: 4.0.\n */\n skyExponent?: number;\n /** For a 4-color [[SkyGradient]], controls speed of change from ground color to nadir color; otherwise unused.\n * Default: 4.0.\n */\n groundExponent?: number;\n /** The image(s), if any, to be mapped to the surfaces of the sphere or cube. If undefined, the skybox will be displayed as a gradient instead.\n * Default: undefined.\n */\n image?: SkyBoxImageProps;\n}\n\nconst defaultGroundColor = ColorDef.from(143, 205, 125);\nconst defaultZenithColor = ColorDef.from(54, 117, 255);\nconst defaultNadirColor = ColorDef.from(40, 125, 0);\nconst defaultSkyColor = ColorDef.from(142, 205, 255);\nconst defaultExponent = 4.0;\n\nfunction colorDefFromJson(props?: ColorDefProps): ColorDef | undefined {\n return undefined !== props ? ColorDef.fromJSON(props) : undefined;\n}\n\n/** A type containing all of the properties and none of the methods of [[SkyGradient]] with `readonly` modifiers removed.\n * @see [[SkyGradient.create]] and [[SkyGradient.clone]].\n * @public\n */\nexport type SkyGradientProperties = NonFunctionPropertiesOf<SkyGradient>;\n\n/** Describes how to map a two- or four-color [[Gradient]] to the interior of a sphere to produce a [[SkyBox]].\n * @see [[SkyBox.gradient]].\n * @public\n */\nexport class SkyGradient {\n public readonly twoColor: boolean;\n public readonly skyColor: ColorDef;\n public readonly groundColor: ColorDef;\n public readonly zenithColor: ColorDef;\n public readonly nadirColor: ColorDef;\n public readonly skyExponent: number;\n public readonly groundExponent: number;\n\n private constructor(args: Partial<SkyGradientProperties>) {\n this.twoColor = args.twoColor ?? false;\n this.skyColor = args.skyColor ?? defaultSkyColor;\n this.groundColor = args.groundColor ?? defaultGroundColor;\n this.nadirColor = args.nadirColor ?? defaultNadirColor;\n this.zenithColor = args.zenithColor ?? defaultZenithColor;\n this.skyExponent = args.skyExponent ?? defaultExponent;\n this.groundExponent = args.groundExponent ?? defaultExponent;\n }\n\n /** Default settings for a four-color gradient. */\n public static readonly defaults = new SkyGradient({});\n\n /** Create a new gradient. Any properties not specified by `props` are initialized to their default values. */\n public static create(props?: Partial<SkyGradientProperties>): SkyGradient {\n return props ? new this(props) : this.defaults;\n }\n\n /** Create from JSON representation. */\n public static fromJSON(props?: SkyBoxProps): SkyGradient {\n if (!props)\n return this.defaults;\n\n return new this({\n twoColor: props.twoColor,\n skyExponent: props.skyExponent,\n groundExponent: props.groundExponent,\n skyColor: colorDefFromJson(props.skyColor),\n groundColor: colorDefFromJson(props.groundColor),\n nadirColor: colorDefFromJson(props.nadirColor),\n zenithColor: colorDefFromJson(props.zenithColor),\n });\n }\n\n /** Create ea copy of this gradient, identical except for any properties explicitly specified by `changedProps`.\n * Any properties of `changedProps` explicitly set to `undefined` will be reset to their default values.\n */\n public clone(changedProps: SkyGradientProperties): SkyGradient {\n return new SkyGradient({ ...this, ...changedProps });\n }\n\n /** Convert to JSON representation. */\n public toJSON(): SkyBoxProps {\n const props: SkyBoxProps = {\n skyColor: this.skyColor.toJSON(),\n groundColor: this.groundColor.toJSON(),\n nadirColor: this.nadirColor.toJSON(),\n zenithColor: this.zenithColor.toJSON(),\n };\n\n if (this.groundExponent !== defaultExponent)\n props.groundExponent = this.groundExponent;\n\n if (this.skyExponent !== defaultExponent)\n props.skyExponent = this.skyExponent;\n\n if (this.twoColor)\n props.twoColor = this.twoColor;\n\n return props;\n }\n\n /** Returns true if this gradient is equivalent to the supplied gradient. */\n public equals(other: SkyGradient): boolean {\n if (this === other)\n return true;\n\n return this.twoColor === other.twoColor && this.skyColor.equals(other.skyColor) && this.groundColor.equals(other.groundColor) &&\n this.zenithColor.equals(other.zenithColor) && this.nadirColor.equals(other.nadirColor);\n }\n}\n\n/** Describes how to draw a representation of a sky, as part of an [[Environment]].\n * @see [[SkyBoxProps]].\n * @public\n */\nexport class SkyBox {\n /** The gradient settings, used if no cube or sphere images are supplied, or if the images cannot be loaded. */\n public readonly gradient: SkyGradient;\n\n protected constructor(gradient: SkyGradient) {\n this.gradient = gradient;\n }\n\n /** Default settings for a four-color gradient. */\n public static readonly defaults = new SkyBox(SkyGradient.defaults);\n\n /** Create a skybox that displays the specified gradient, or the default gradient if none is supplied. */\n public static createGradient(gradient?: SkyGradient): SkyBox {\n return gradient ? new this(gradient) : this.defaults;\n }\n\n /** Create from JSON representation. */\n public static fromJSON(props?: SkyBoxProps): SkyBox {\n const gradient = SkyGradient.fromJSON(props);\n\n if (props?.image) {\n switch (props.image.type) {\n case SkyBoxImageType.Spherical:\n if (undefined !== props.image.texture)\n return new SkySphere(props.image.texture, gradient);\n\n break;\n case SkyBoxImageType.Cube: {\n const tx = props.image.textures;\n if (tx && undefined !== tx.top && undefined !== tx.bottom && undefined !== tx.right && undefined !== tx.left && undefined !== tx.front && undefined !== tx.back)\n return new SkyCube(tx, gradient);\n\n break;\n }\n }\n }\n\n return this.createGradient(gradient);\n }\n\n /** Convert to JSON representation.\n * @param display If defined, the value to use for [[SkyBoxProps.display]]; otherwise, that property will be left undefined.\n */\n public toJSON(display?: boolean): SkyBoxProps {\n const props = this.gradient.toJSON();\n if (undefined !== display)\n props.display = display;\n\n return props;\n }\n\n /** @internal */\n public get textureIds(): Iterable<Id64String> {\n return [];\n }\n}\n\n/** Describes how to draw a representation of a sky by mapping a single image to the interior of a sphere.\n * @public\n */\nexport class SkySphere extends SkyBox {\n /** The image to map to the interior of the sphere. */\n public readonly image: TextureImageSpec;\n\n /** Create a new sky sphere using the specified image.\n * @param image The image to map to the interior of the sphere.\n * @param gradient Optionally overrides the default gradient settings used if the image cannot be obtained.\n */\n public constructor(image: TextureImageSpec, gradient?: SkyGradient) {\n super(gradient ?? SkyGradient.defaults);\n this.image = image;\n }\n\n /** See [[SkyBox.toJSON]]. */\n public override toJSON(display?: boolean): SkyBoxProps {\n const props = super.toJSON(display);\n props.image = {\n type: SkyBoxImageType.Spherical,\n texture: this.image,\n };\n\n return props;\n }\n\n /** @internal */\n public override get textureIds(): Iterable<Id64String> {\n return Id64.isValidId64(this.image) ? [this.image] : [];\n }\n}\n\n/** Describes how to draw a representation of a sky by mapping images to the interior faces of a cube.\n * The images are required to be *square*, and each image must have the same dimensions as the other images.\n * @public\n */\nexport class SkyCube extends SkyBox {\n /** The images to map to each face of the cube. */\n public readonly images: SkyCubeProps;\n\n /** Create a new sky cube using the specified images.\n * @param images The images to map to each face of the cube.\n * @param gradient Optionally overrides the default gradient settings used if the images cannot be obtained.\n */\n public constructor(images: SkyCubeProps, gradient?: SkyGradient) {\n super(gradient ?? SkyGradient.defaults);\n this.images = { ...images };\n }\n\n /** See [[SkyBox.toJSON]]. */\n public override toJSON(display?: boolean): SkyBoxProps {\n const props = super.toJSON(display);\n props.image = {\n type: SkyBoxImageType.Cube,\n textures: { ...this.images },\n };\n\n return props;\n }\n\n /** @internal */\n public override get textureIds(): Iterable<Id64String> {\n const imgs = this.images;\n return [imgs.front, imgs.back, imgs.top, imgs.bottom, imgs.left, imgs.right].filter((x) => Id64.isValidId64(x));\n }\n}\n"]}
@@ -25,6 +25,7 @@ class SolarShadowSettings {
25
25
  else
26
26
  this.color = RgbColor_1.RgbColor.fromColorDef(ColorDef_1.ColorDef.fromJSON(props.color));
27
27
  }
28
+ static { this.defaults = new SolarShadowSettings({}); }
28
29
  static fromJSON(props) {
29
30
  return props ? new SolarShadowSettings(props) : this.defaults;
30
31
  }
@@ -58,5 +59,4 @@ class SolarShadowSettings {
58
59
  }
59
60
  }
60
61
  exports.SolarShadowSettings = SolarShadowSettings;
61
- SolarShadowSettings.defaults = new SolarShadowSettings({});
62
62
  //# sourceMappingURL=SolarShadows.js.map