@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
@@ -13,6 +13,14 @@ export var AmbientOcclusion;
13
13
  (function (AmbientOcclusion) {
14
14
  /** Describes the properties with which ambient occlusion should be drawn. These properties correspond to a horizon-based ambient occlusion approach. */
15
15
  class Settings {
16
+ static { this._defaultBias = 0.25; }
17
+ static { this._defaultZLengthCap = 0.0025; }
18
+ static { this._defaultMaxDistance = 10000.0; }
19
+ static { this._defaultIntensity = 1.0; }
20
+ static { this._defaultTexelStepSize = 1; }
21
+ static { this._defaultBlurDelta = 1.0; }
22
+ static { this._defaultBlurSigma = 2.0; }
23
+ static { this._defaultBlurTexelStepSize = 1.0; }
16
24
  constructor(json) {
17
25
  if (undefined === json)
18
26
  json = {};
@@ -25,6 +33,7 @@ export var AmbientOcclusion;
25
33
  this.blurSigma = JsonUtils.asDouble(json.blurSigma, Settings._defaultBlurSigma);
26
34
  this.blurTexelStepSize = JsonUtils.asDouble(json.blurTexelStepSize, Settings._defaultBlurTexelStepSize);
27
35
  }
36
+ static { this.defaults = new Settings({}); }
28
37
  static fromJSON(json) { return undefined !== json ? new Settings(json) : this.defaults; }
29
38
  toJSON() {
30
39
  return {
@@ -39,15 +48,6 @@ export var AmbientOcclusion;
39
48
  };
40
49
  }
41
50
  }
42
- Settings._defaultBias = 0.25;
43
- Settings._defaultZLengthCap = 0.0025;
44
- Settings._defaultMaxDistance = 10000.0;
45
- Settings._defaultIntensity = 1.0;
46
- Settings._defaultTexelStepSize = 1;
47
- Settings._defaultBlurDelta = 1.0;
48
- Settings._defaultBlurSigma = 2.0;
49
- Settings._defaultBlurTexelStepSize = 1.0;
50
- Settings.defaults = new Settings({});
51
51
  AmbientOcclusion.Settings = Settings;
52
52
  })(AmbientOcclusion || (AmbientOcclusion = {}));
53
53
  //# sourceMappingURL=AmbientOcclusion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AmbientOcclusion.js","sourceRoot":"","sources":["../../src/AmbientOcclusion.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD;;GAEG;AACH,MAAM,KAAW,gBAAgB,CAwEhC;AAxED,WAAiB,gBAAgB;IAqB/B,wJAAwJ;IACxJ,MAAa,QAAQ;QAmBnB,YAAoB,IAAY;YAC9B,IAAI,SAAS,KAAK,IAAI;gBACpB,IAAI,GAAG,EAAE,CAAC;YAEZ,IAAI,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/B,yBAAQ,WAiDpB,CAAA;AACH,CAAC,EAxEgB,gBAAgB,KAAhB,gBAAgB,QAwEhC","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 { JsonUtils } from \"@itwin/core-bentley\";\n\n/** Namespace containing types controlling how ambient occlusion should be drawn.\n * @public\n */\nexport namespace AmbientOcclusion {\n /** Describes the properties with which ambient occlusion should be drawn. These properties correspond to a horizon-based ambient occlusion approach. */\n export interface Props {\n /** If defined, represents an angle in radians. If the dot product between the normal of the sample and the vector to the camera is less than this value, sampling stops in the current direction. This is used to remove shadows from near planar edges. If undefined, the bias defaults to 0.25. */\n readonly bias?: number;\n /** If defined, if the distance in linear depth from the current sample to first sample is greater than this value, sampling stops in the current direction. If undefined, the zLengthCap defaults to 0.0025. The full range of linear depth is 0 to 1. */\n readonly zLengthCap?: number;\n /** If defined, the maximum distance from the camera's near plane in meters at which ambient occlusion will be applied. If undefined, the maximum distance defaults to 10000. */\n readonly maxDistance?: number;\n /** If defined, raise the final ambient occlusion to the power of this value. Larger values make the ambient shadows darker. If undefined, the intensity defaults to 2.0. */\n readonly intensity?: number;\n /** If defined, indicates the texel distance to step toward the next texel sample in the current direction. For portions of geometry close to the near plane, this value will be what is used. As portions of geometry extend away from the near plane, this value will gradually reduce until it reaches a minimum value of 1.0 at the far plane. If undefined, texelStepSize defaults to 1.95. */\n readonly texelStepSize?: number;\n /** If defined, blurDelta is used to compute the weight of a Gaussian filter. The equation is exp((-0.5 * blurDelta * blurDelta) / (blurSigma * blurSigma)). If undefined, blurDelta defaults to 1.0. */\n readonly blurDelta?: number;\n /** If defined, blurSigma is used to compute the weight of a Gaussian filter. The equation is exp((-0.5 * blurDelta * blurDelta) / (blurSigma * blurSigma)). If undefined, blurSigma defaults to 2.0. */\n readonly blurSigma?: number;\n /* If defined, blurTexelStepSize indicates the distance to the next texel for blurring. If undefined, blurTexelStepSize defaults to 1.0. */\n readonly blurTexelStepSize?: number;\n }\n\n /** Describes the properties with which ambient occlusion should be drawn. These properties correspond to a horizon-based ambient occlusion approach. */\n export class Settings implements Props {\n private static _defaultBias: number = 0.25;\n private static _defaultZLengthCap: number = 0.0025;\n private static _defaultMaxDistance: number = 10000.0;\n private static _defaultIntensity: number = 1.0;\n private static _defaultTexelStepSize: number = 1;\n private static _defaultBlurDelta: number = 1.0;\n private static _defaultBlurSigma: number = 2.0;\n private static _defaultBlurTexelStepSize: number = 1.0;\n\n public readonly bias: number;\n public readonly zLengthCap: number;\n public readonly maxDistance: number;\n public readonly intensity: number;\n public readonly texelStepSize: number;\n public readonly blurDelta: number;\n public readonly blurSigma: number;\n public readonly blurTexelStepSize: number;\n\n private constructor(json?: Props) {\n if (undefined === json)\n json = {};\n\n this.bias = JsonUtils.asDouble(json.bias, Settings._defaultBias);\n this.zLengthCap = JsonUtils.asDouble(json.zLengthCap, Settings._defaultZLengthCap);\n this.maxDistance = JsonUtils.asDouble(json.maxDistance, Settings._defaultMaxDistance);\n this.intensity = JsonUtils.asDouble(json.intensity, Settings._defaultIntensity);\n this.texelStepSize = JsonUtils.asDouble(json.texelStepSize, Settings._defaultTexelStepSize);\n this.blurDelta = JsonUtils.asDouble(json.blurDelta, Settings._defaultBlurDelta);\n this.blurSigma = JsonUtils.asDouble(json.blurSigma, Settings._defaultBlurSigma);\n this.blurTexelStepSize = JsonUtils.asDouble(json.blurTexelStepSize, Settings._defaultBlurTexelStepSize);\n }\n\n public static defaults = new Settings({});\n\n public static fromJSON(json?: Props): Settings { return undefined !== json ? new Settings(json) : this.defaults; }\n\n public toJSON(): Props {\n return {\n bias: this.bias !== Settings._defaultBias ? this.bias : undefined,\n zLengthCap: this.zLengthCap !== Settings._defaultZLengthCap ? this.zLengthCap : undefined,\n maxDistance: this.maxDistance !== Settings._defaultMaxDistance ? this.maxDistance : undefined,\n intensity: this.intensity !== Settings._defaultIntensity ? this.intensity : undefined,\n texelStepSize: this.texelStepSize !== Settings._defaultTexelStepSize ? this.texelStepSize : undefined,\n blurDelta: this.blurDelta !== Settings._defaultBlurDelta ? this.blurDelta : undefined,\n blurSigma: this.blurSigma !== Settings._defaultBlurSigma ? this.blurSigma : undefined,\n blurTexelStepSize: this.blurTexelStepSize !== Settings._defaultBlurTexelStepSize ? this.blurTexelStepSize : undefined,\n };\n }\n }\n}\n"]}
1
+ {"version":3,"file":"AmbientOcclusion.js","sourceRoot":"","sources":["../../src/AmbientOcclusion.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD;;GAEG;AACH,MAAM,KAAW,gBAAgB,CAwEhC;AAxED,WAAiB,gBAAgB;IAqB/B,wJAAwJ;IACxJ,MAAa,QAAQ;iBACJ,iBAAY,GAAW,IAAI,CAAC;iBAC5B,uBAAkB,GAAW,MAAM,CAAC;iBACpC,wBAAmB,GAAW,OAAO,CAAC;iBACtC,sBAAiB,GAAW,GAAG,CAAC;iBAChC,0BAAqB,GAAW,CAAC,CAAC;iBAClC,sBAAiB,GAAW,GAAG,CAAC;iBAChC,sBAAiB,GAAW,GAAG,CAAC;iBAChC,8BAAyB,GAAW,GAAG,CAAC;QAWvD,YAAoB,IAAY;YAC9B,IAAI,SAAS,KAAK,IAAI;gBACpB,IAAI,GAAG,EAAE,CAAC;YAEZ,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;YACjE,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAAC;YACnF,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE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C,CAAC,SAAS;gBAC7F,SAAS,EAAE,IAAI,CAAC,SAAS,KAAK,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;gBACrF,aAAa,EAAE,IAAI,CAAC,aAAa,KAAK,QAAQ,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS;gBACrG,SAAS,EAAE,IAAI,CAAC,SAAS,KAAK,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;gBACrF,SAAS,EAAE,IAAI,CAAC,SAAS,KAAK,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;gBACrF,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,KAAK,QAAQ,CAAC,yBAAyB,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS;aACtH,CAAC;QACJ,CAAC;;IAhDU,yBAAQ,WAiDpB,CAAA;AACH,CAAC,EAxEgB,gBAAgB,KAAhB,gBAAgB,QAwEhC","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 { JsonUtils } from \"@itwin/core-bentley\";\n\n/** Namespace containing types controlling how ambient occlusion should be drawn.\n * @public\n */\nexport namespace AmbientOcclusion {\n /** Describes the properties with which ambient occlusion should be drawn. These properties correspond to a horizon-based ambient occlusion approach. */\n export interface Props {\n /** If defined, represents an angle in radians. If the dot product between the normal of the sample and the vector to the camera is less than this value, sampling stops in the current direction. This is used to remove shadows from near planar edges. If undefined, the bias defaults to 0.25. */\n readonly bias?: number;\n /** If defined, if the distance in linear depth from the current sample to first sample is greater than this value, sampling stops in the current direction. If undefined, the zLengthCap defaults to 0.0025. The full range of linear depth is 0 to 1. */\n readonly zLengthCap?: number;\n /** If defined, the maximum distance from the camera's near plane in meters at which ambient occlusion will be applied. If undefined, the maximum distance defaults to 10000. */\n readonly maxDistance?: number;\n /** If defined, raise the final ambient occlusion to the power of this value. Larger values make the ambient shadows darker. If undefined, the intensity defaults to 2.0. */\n readonly intensity?: number;\n /** If defined, indicates the texel distance to step toward the next texel sample in the current direction. For portions of geometry close to the near plane, this value will be what is used. As portions of geometry extend away from the near plane, this value will gradually reduce until it reaches a minimum value of 1.0 at the far plane. If undefined, texelStepSize defaults to 1.95. */\n readonly texelStepSize?: number;\n /** If defined, blurDelta is used to compute the weight of a Gaussian filter. The equation is exp((-0.5 * blurDelta * blurDelta) / (blurSigma * blurSigma)). If undefined, blurDelta defaults to 1.0. */\n readonly blurDelta?: number;\n /** If defined, blurSigma is used to compute the weight of a Gaussian filter. The equation is exp((-0.5 * blurDelta * blurDelta) / (blurSigma * blurSigma)). If undefined, blurSigma defaults to 2.0. */\n readonly blurSigma?: number;\n /* If defined, blurTexelStepSize indicates the distance to the next texel for blurring. If undefined, blurTexelStepSize defaults to 1.0. */\n readonly blurTexelStepSize?: number;\n }\n\n /** Describes the properties with which ambient occlusion should be drawn. These properties correspond to a horizon-based ambient occlusion approach. */\n export class Settings implements Props {\n private static _defaultBias: number = 0.25;\n private static _defaultZLengthCap: number = 0.0025;\n private static _defaultMaxDistance: number = 10000.0;\n private static _defaultIntensity: number = 1.0;\n private static _defaultTexelStepSize: number = 1;\n private static _defaultBlurDelta: number = 1.0;\n private static _defaultBlurSigma: number = 2.0;\n private static _defaultBlurTexelStepSize: number = 1.0;\n\n public readonly bias: number;\n public readonly zLengthCap: number;\n public readonly maxDistance: number;\n public readonly intensity: number;\n public readonly texelStepSize: number;\n public readonly blurDelta: number;\n public readonly blurSigma: number;\n public readonly blurTexelStepSize: number;\n\n private constructor(json?: Props) {\n if (undefined === json)\n json = {};\n\n this.bias = JsonUtils.asDouble(json.bias, Settings._defaultBias);\n this.zLengthCap = JsonUtils.asDouble(json.zLengthCap, Settings._defaultZLengthCap);\n this.maxDistance = JsonUtils.asDouble(json.maxDistance, Settings._defaultMaxDistance);\n this.intensity = JsonUtils.asDouble(json.intensity, Settings._defaultIntensity);\n this.texelStepSize = JsonUtils.asDouble(json.texelStepSize, Settings._defaultTexelStepSize);\n this.blurDelta = JsonUtils.asDouble(json.blurDelta, Settings._defaultBlurDelta);\n this.blurSigma = JsonUtils.asDouble(json.blurSigma, Settings._defaultBlurSigma);\n this.blurTexelStepSize = JsonUtils.asDouble(json.blurTexelStepSize, Settings._defaultBlurTexelStepSize);\n }\n\n public static defaults = new Settings({});\n\n public static fromJSON(json?: Props): Settings { return undefined !== json ? new Settings(json) : this.defaults; }\n\n public toJSON(): Props {\n return {\n bias: this.bias !== Settings._defaultBias ? this.bias : undefined,\n zLengthCap: this.zLengthCap !== Settings._defaultZLengthCap ? this.zLengthCap : undefined,\n maxDistance: this.maxDistance !== Settings._defaultMaxDistance ? this.maxDistance : undefined,\n intensity: this.intensity !== Settings._defaultIntensity ? this.intensity : undefined,\n texelStepSize: this.texelStepSize !== Settings._defaultTexelStepSize ? this.texelStepSize : undefined,\n blurDelta: this.blurDelta !== Settings._defaultBlurDelta ? this.blurDelta : undefined,\n blurSigma: this.blurSigma !== Settings._defaultBlurSigma ? this.blurSigma : undefined,\n blurTexelStepSize: this.blurTexelStepSize !== Settings._defaultBlurTexelStepSize ? this.blurTexelStepSize : undefined,\n };\n }\n }\n}\n"]}
@@ -155,6 +155,6 @@ export class AnalysisStyle {
155
155
  return false;
156
156
  return undefined === this.thematic || this.thematic.equals(other.thematic);
157
157
  }
158
+ static { this.defaults = new AnalysisStyle({}); }
158
159
  }
159
- AnalysisStyle.defaults = new AnalysisStyle({});
160
160
  //# sourceMappingURL=AnalysisStyle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnalysisStyle.js","sourceRoot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C;YAClE,OAAO,KAAK,CAAC;QAEf,OAAO,SAAS,KAAK,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,QAAS,CAAC,CAAC;IAC9E,CAAC;;AAEsB,sBAAQ,GAAG,IAAI,aAAa,CAAC,EAAE,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 { Range1d, Range1dProps } from \"@itwin/core-geometry\";\nimport { ThematicGradientSettings, ThematicGradientSettingsProps } from \"./ThematicDisplay\";\nimport { Gradient } from \"./Gradient\";\n\n/** JSON representation of an [[AnalysisStyleDisplacement]].\n * @see [[AnalysisStyleProps.displacement]].\n * @public\n * @extensions\n */\nexport interface AnalysisStyleDisplacementProps {\n /** See [[AnalysisStyleDisplacement.channelName]]. */\n channelName: string;\n /** See [[AnalysisStyleDisplacement.scale]].\n * Default value: 1.\n */\n scale?: number;\n}\n\n/** Describes how an [[AnalysisStyle]] deforms a [Polyface]($core-geometry) by applying translation to its vertices.\n * @see [[AnalysisStyle.displacement]].\n * @public\n */\nexport class AnalysisStyleDisplacement {\n /** The name of the [AuxChannel]($core-geometry) supplying the displacements to be applied to the vertices. */\n public readonly channelName: string;\n /** A scale applied to the displacements to adjust the magnitude of the effect.\n * Default value: 1.\n */\n public readonly scale: number;\n\n /** @internal */\n private constructor(channelName: string, scale = 1) {\n this.channelName = channelName;\n this.scale = scale;\n }\n\n /** Create from JSON representation. */\n public static fromJSON(props: AnalysisStyleDisplacementProps): AnalysisStyleDisplacement {\n return new this(props.channelName, props.scale);\n }\n\n /** Convert to JSON representation. */\n public toJSON(): AnalysisStyleDisplacementProps {\n const props: AnalysisStyleDisplacementProps = { channelName: this.channelName };\n if (this.scale !== 1)\n props.scale = this.scale;\n\n return props;\n }\n\n /** Return true if `this` is equivalent to `other`. */\n public equals(other: AnalysisStyleDisplacement): boolean {\n return this.channelName === other.channelName && this.scale === other.scale;\n }\n}\n\n/** JSON representation of an [[AnalysisStyleThematic]].\n * @see [[AnalysisStyleProps.scalar]].\n * @public\n * @extensions\n */\nexport interface AnalysisStyleThematicProps {\n /** See [[AnalysisStyleThematic.channelName]]. */\n channelName: string;\n /** See [[AnalysisStyleThematic.range]]. */\n range: Range1dProps;\n /** See [[AnalysisStyleThematic.thematicSettings]].\n * Default value: [[ThematicGradientSettings.defaults]].\n */\n thematicSettings?: ThematicGradientSettingsProps;\n}\n\n/** Describes how an [[AnalysisStyle]] recolors [Polyface]($core-geometry) vertices by mapping values of type\n * [AuxChannelDataType.Scalar]($core-geometry) or [AuxChannelDataType.Distance]($core-geometry) supplied\n * by an [AuxChannel]($core-geometry) to colors supplied by a [[Gradient]] image.\n * @see [[AnalysisStyle.thematic]].\n * @public\n */\nexport class AnalysisStyleThematic {\n /** The name of the [AuxChannel]($core-geometry) supplying the values from which the vertex colors are computed. */\n public readonly channelName: string;\n /** The minimum and maximum values that map to colors in the [[Gradient]] image. Vertices with values outside of\n * this range are displayed with the gradient's margin color.\n */\n public readonly range: Readonly<Range1d>;\n /** Settings used to produce the [[Gradient]] image. */\n public readonly thematicSettings: ThematicGradientSettings;\n private _gradient?: Gradient.Symb;\n\n /** @internal */\n private constructor(props: AnalysisStyleThematicProps) {\n this.channelName = props.channelName;\n this.range = Range1d.fromJSON(props.range);\n this.thematicSettings = ThematicGradientSettings.fromJSON(props.thematicSettings);\n }\n\n /** Create from JSON representation. */\n public static fromJSON(props: AnalysisStyleThematicProps): AnalysisStyleThematic {\n return new this(props);\n }\n\n /** Convert to JSON representation. */\n public toJSON(): AnalysisStyleThematicProps {\n const props: AnalysisStyleThematicProps = {\n channelName: this.channelName,\n range: this.range.toJSON(),\n };\n\n if (!this.thematicSettings.equals(ThematicGradientSettings.defaults))\n props.thematicSettings = this.thematicSettings.toJSON();\n\n return props;\n }\n\n /** The gradient computed from [[thematicSettings]]. */\n public get gradient(): Gradient.Symb {\n if (!this._gradient)\n this._gradient = Gradient.Symb.createThematic(this.thematicSettings);\n\n return this._gradient;\n }\n\n /** Return true if `this` is equivalent to `other`. */\n public equals(other: AnalysisStyleThematic): boolean {\n return this.channelName === other.channelName && this.range.isAlmostEqual(other.range) && this.thematicSettings.equals(other.thematicSettings);\n }\n}\n\n/** JSON representation of an [[AnalysisStyle]].\n * @public\n * @extensions\n */\nexport interface AnalysisStyleProps {\n /** See [[AnalysisStyle.displacement]]. */\n displacement?: AnalysisStyleDisplacementProps;\n /** JSON representation of [[AnalysisStyle.thematic]].\n * @note The name \"scalar\" is used instead of \"thematic\" for backwards compatibility.\n */\n scalar?: AnalysisStyleThematicProps;\n /** See [[AnalysisStyle.normalChannelName]]. */\n normalChannelName?: string;\n}\n\n/** At time of writing, the only iModel in existence that uses AnalysisStyle is the one created by the analysis-importer test app.\n * To avoid breaking existing saved views of that iModel, AnalysisStyle.fromJSON() continues to accept the old JSON representation -\n * but that representation is not part of the public API.\n * @internal exported strictly for tests.\n */\nexport interface LegacyAnalysisStyleProps {\n displacementChannelName?: string;\n scalarChannelName?: string;\n normalChannelName?: string;\n displacementScale?: number;\n scalarRange?: Range1dProps;\n scalarThematicSettings?: ThematicGradientSettingsProps;\n}\n\nfunction tryConvertLegacyProps(input: AnalysisStyleProps): AnalysisStyleProps {\n if (input.displacement || input.scalar)\n return input;\n\n const legacy = input as LegacyAnalysisStyleProps;\n if (undefined === legacy.displacementChannelName && undefined === legacy.scalarChannelName)\n return input;\n\n const output: AnalysisStyleProps = {\n normalChannelName: input.normalChannelName,\n };\n\n if (undefined !== legacy.displacementChannelName) {\n output.displacement = {\n channelName: legacy.displacementChannelName,\n scale: legacy.displacementScale,\n };\n }\n\n if (undefined !== legacy.scalarChannelName && undefined !== legacy.scalarRange) {\n output.scalar = {\n channelName: legacy.scalarChannelName,\n range: legacy.scalarRange,\n thematicSettings: legacy.scalarThematicSettings,\n };\n }\n\n return output;\n}\n\n/** As part of a [[DisplayStyleSettings]], describes how to animate meshes in the view that have been augmented with\n * [PolyfaceAuxData]($core-geometry). The style specifies which channels to use, and can deform the meshes by\n * translating vertices and/or recolor vertices using [[ThematicDisplay]].\n * @see [[DisplayStyleSettings.analysisStyle]] to define the analysis style for a [DisplayStyle]($backend).\n * @see [[DisplayStyleSettings.analysisFraction]] to control playback of the animation.\n * @public\n */\nexport class AnalysisStyle {\n public readonly displacement?: AnalysisStyleDisplacement;\n public readonly thematic?: AnalysisStyleThematic;\n /** If defined, the name of the [AuxChannel]($core-geometry) from which to obtain normal vectors for the vertices. */\n public readonly normalChannelName?: string;\n\n /** Create an analysis style from its JSON representation.\n * @note AnalysisStyle is an immutable type - use [[clone]] to produce a modified copy.\n */\n public static fromJSON(props?: AnalysisStyleProps): AnalysisStyle {\n if (!props)\n return this.defaults;\n\n props = tryConvertLegacyProps(props);\n if (!props.displacement && !props.scalar && undefined === props.normalChannelName)\n return this.defaults;\n\n return new AnalysisStyle(props);\n }\n\n /** @internal */\n private constructor(props: AnalysisStyleProps) {\n this.normalChannelName = props.normalChannelName;\n if (props.displacement)\n this.displacement = AnalysisStyleDisplacement.fromJSON(props.displacement);\n\n if (props.scalar)\n this.thematic = AnalysisStyleThematic.fromJSON(props.scalar);\n }\n\n /** Convert this style to its JSON representation. */\n public toJSON(): AnalysisStyleProps {\n const props: AnalysisStyleProps = {};\n if (this === AnalysisStyle.defaults)\n return props;\n\n if (this.displacement)\n props.displacement = this.displacement.toJSON();\n\n if (this.thematic)\n props.scalar = this.thematic.toJSON();\n\n if (undefined !== this.normalChannelName)\n props.normalChannelName = this.normalChannelName;\n\n return props;\n }\n\n /** Produce a copy of this style identical except for properties explicitly specified by `changedProps`. */\n public clone(changedProps: AnalysisStyleProps): AnalysisStyle {\n return AnalysisStyle.fromJSON({\n ...this.toJSON(),\n ...changedProps,\n });\n }\n\n /** Return true if this style is equivalent to `other`. */\n public equals(other: AnalysisStyle): boolean {\n if (this.normalChannelName !== other.normalChannelName)\n return false;\n\n if ((undefined === this.displacement) !== (undefined === other.displacement))\n return false;\n else if (this.displacement && !this.displacement.equals(other.displacement!))\n return false;\n\n if ((undefined === this.thematic) !== (undefined === other.thematic))\n return false;\n\n return undefined === this.thematic || this.thematic.equals(other.thematic!);\n }\n\n public static readonly defaults = new AnalysisStyle({});\n}\n"]}
1
+ {"version":3,"file":"AnalysisStyle.js","sourceRoot":"","sources":["../../src/AnalysisStyle.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAgB,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,wBAAwB,EAAiC,MAAM,mBAAmB,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAgBtC;;;GAGG;AACH,MAAM,OAAO,yBAAyB;IAQpC,gBAAgB;IAChB,YAAoB,WAAmB,EAAE,KAAK,GAAG,CAAC;QAChD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,uCAAuC;IAChC,MAAM,CAAC,QAAQ,CAAC,KAAqC;QAC1D,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IAClD,CAAC;IAED,sCAAsC;IAC/B,MAAM;QACX,MAAM,KAAK,GAAmC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;QAChF,IAAI,IAAI,CAAC,KAAK,KAAK,CAAC;YAClB,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAE3B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,sDAAsD;IAC/C,MAAM,CAAC,KAAgC;QAC5C,OAAO,IAAI,CAAC,WAAW,KAAK,KAAK,CAAC,WAAW,IAAI,IAAI,CAAC,KAAK,KAA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K,CAAC,SAAS,KAAK,KAAK,CAAC,YAAY,CAAC;YAC1E,OAAO,KAAK,CAAC;aACV,IAAI,IAAI,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,YAAa,CAAC;YAC1E,OAAO,KAAK,CAAC;QAEf,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,KAAK,KAAK,CAAC,QAAQ,CAAC;YAClE,OAAO,KAAK,CAAC;QAEf,OAAO,SAAS,KAAK,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,QAAS,CAAC,CAAC;IAC9E,CAAC;aAEsB,aAAQ,GAAG,IAAI,aAAa,CAAC,EAAE,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 { Range1d, Range1dProps } from \"@itwin/core-geometry\";\nimport { ThematicGradientSettings, ThematicGradientSettingsProps } from \"./ThematicDisplay\";\nimport { Gradient } from \"./Gradient\";\n\n/** JSON representation of an [[AnalysisStyleDisplacement]].\n * @see [[AnalysisStyleProps.displacement]].\n * @public\n * @extensions\n */\nexport interface AnalysisStyleDisplacementProps {\n /** See [[AnalysisStyleDisplacement.channelName]]. */\n channelName: string;\n /** See [[AnalysisStyleDisplacement.scale]].\n * Default value: 1.\n */\n scale?: number;\n}\n\n/** Describes how an [[AnalysisStyle]] deforms a [Polyface]($core-geometry) by applying translation to its vertices.\n * @see [[AnalysisStyle.displacement]].\n * @public\n */\nexport class AnalysisStyleDisplacement {\n /** The name of the [AuxChannel]($core-geometry) supplying the displacements to be applied to the vertices. */\n public readonly channelName: string;\n /** A scale applied to the displacements to adjust the magnitude of the effect.\n * Default value: 1.\n */\n public readonly scale: number;\n\n /** @internal */\n private constructor(channelName: string, scale = 1) {\n this.channelName = channelName;\n this.scale = scale;\n }\n\n /** Create from JSON representation. */\n public static fromJSON(props: AnalysisStyleDisplacementProps): AnalysisStyleDisplacement {\n return new this(props.channelName, props.scale);\n }\n\n /** Convert to JSON representation. */\n public toJSON(): AnalysisStyleDisplacementProps {\n const props: AnalysisStyleDisplacementProps = { channelName: this.channelName };\n if (this.scale !== 1)\n props.scale = this.scale;\n\n return props;\n }\n\n /** Return true if `this` is equivalent to `other`. */\n public equals(other: AnalysisStyleDisplacement): boolean {\n return this.channelName === other.channelName && this.scale === other.scale;\n }\n}\n\n/** JSON representation of an [[AnalysisStyleThematic]].\n * @see [[AnalysisStyleProps.scalar]].\n * @public\n * @extensions\n */\nexport interface AnalysisStyleThematicProps {\n /** See [[AnalysisStyleThematic.channelName]]. */\n channelName: string;\n /** See [[AnalysisStyleThematic.range]]. */\n range: Range1dProps;\n /** See [[AnalysisStyleThematic.thematicSettings]].\n * Default value: [[ThematicGradientSettings.defaults]].\n */\n thematicSettings?: ThematicGradientSettingsProps;\n}\n\n/** Describes how an [[AnalysisStyle]] recolors [Polyface]($core-geometry) vertices by mapping values of type\n * [AuxChannelDataType.Scalar]($core-geometry) or [AuxChannelDataType.Distance]($core-geometry) supplied\n * by an [AuxChannel]($core-geometry) to colors supplied by a [[Gradient]] image.\n * @see [[AnalysisStyle.thematic]].\n * @public\n */\nexport class AnalysisStyleThematic {\n /** The name of the [AuxChannel]($core-geometry) supplying the values from which the vertex colors are computed. */\n public readonly channelName: string;\n /** The minimum and maximum values that map to colors in the [[Gradient]] image. Vertices with values outside of\n * this range are displayed with the gradient's margin color.\n */\n public readonly range: Readonly<Range1d>;\n /** Settings used to produce the [[Gradient]] image. */\n public readonly thematicSettings: ThematicGradientSettings;\n private _gradient?: Gradient.Symb;\n\n /** @internal */\n private constructor(props: AnalysisStyleThematicProps) {\n this.channelName = props.channelName;\n this.range = Range1d.fromJSON(props.range);\n this.thematicSettings = ThematicGradientSettings.fromJSON(props.thematicSettings);\n }\n\n /** Create from JSON representation. */\n public static fromJSON(props: AnalysisStyleThematicProps): AnalysisStyleThematic {\n return new this(props);\n }\n\n /** Convert to JSON representation. */\n public toJSON(): AnalysisStyleThematicProps {\n const props: AnalysisStyleThematicProps = {\n channelName: this.channelName,\n range: this.range.toJSON(),\n };\n\n if (!this.thematicSettings.equals(ThematicGradientSettings.defaults))\n props.thematicSettings = this.thematicSettings.toJSON();\n\n return props;\n }\n\n /** The gradient computed from [[thematicSettings]]. */\n public get gradient(): Gradient.Symb {\n if (!this._gradient)\n this._gradient = Gradient.Symb.createThematic(this.thematicSettings);\n\n return this._gradient;\n }\n\n /** Return true if `this` is equivalent to `other`. */\n public equals(other: AnalysisStyleThematic): boolean {\n return this.channelName === other.channelName && this.range.isAlmostEqual(other.range) && this.thematicSettings.equals(other.thematicSettings);\n }\n}\n\n/** JSON representation of an [[AnalysisStyle]].\n * @public\n * @extensions\n */\nexport interface AnalysisStyleProps {\n /** See [[AnalysisStyle.displacement]]. */\n displacement?: AnalysisStyleDisplacementProps;\n /** JSON representation of [[AnalysisStyle.thematic]].\n * @note The name \"scalar\" is used instead of \"thematic\" for backwards compatibility.\n */\n scalar?: AnalysisStyleThematicProps;\n /** See [[AnalysisStyle.normalChannelName]]. */\n normalChannelName?: string;\n}\n\n/** At time of writing, the only iModel in existence that uses AnalysisStyle is the one created by the analysis-importer test app.\n * To avoid breaking existing saved views of that iModel, AnalysisStyle.fromJSON() continues to accept the old JSON representation -\n * but that representation is not part of the public API.\n * @internal exported strictly for tests.\n */\nexport interface LegacyAnalysisStyleProps {\n displacementChannelName?: string;\n scalarChannelName?: string;\n normalChannelName?: string;\n displacementScale?: number;\n scalarRange?: Range1dProps;\n scalarThematicSettings?: ThematicGradientSettingsProps;\n}\n\nfunction tryConvertLegacyProps(input: AnalysisStyleProps): AnalysisStyleProps {\n if (input.displacement || input.scalar)\n return input;\n\n const legacy = input as LegacyAnalysisStyleProps;\n if (undefined === legacy.displacementChannelName && undefined === legacy.scalarChannelName)\n return input;\n\n const output: AnalysisStyleProps = {\n normalChannelName: input.normalChannelName,\n };\n\n if (undefined !== legacy.displacementChannelName) {\n output.displacement = {\n channelName: legacy.displacementChannelName,\n scale: legacy.displacementScale,\n };\n }\n\n if (undefined !== legacy.scalarChannelName && undefined !== legacy.scalarRange) {\n output.scalar = {\n channelName: legacy.scalarChannelName,\n range: legacy.scalarRange,\n thematicSettings: legacy.scalarThematicSettings,\n };\n }\n\n return output;\n}\n\n/** As part of a [[DisplayStyleSettings]], describes how to animate meshes in the view that have been augmented with\n * [PolyfaceAuxData]($core-geometry). The style specifies which channels to use, and can deform the meshes by\n * translating vertices and/or recolor vertices using [[ThematicDisplay]].\n * @see [[DisplayStyleSettings.analysisStyle]] to define the analysis style for a [DisplayStyle]($backend).\n * @see [[DisplayStyleSettings.analysisFraction]] to control playback of the animation.\n * @public\n */\nexport class AnalysisStyle {\n public readonly displacement?: AnalysisStyleDisplacement;\n public readonly thematic?: AnalysisStyleThematic;\n /** If defined, the name of the [AuxChannel]($core-geometry) from which to obtain normal vectors for the vertices. */\n public readonly normalChannelName?: string;\n\n /** Create an analysis style from its JSON representation.\n * @note AnalysisStyle is an immutable type - use [[clone]] to produce a modified copy.\n */\n public static fromJSON(props?: AnalysisStyleProps): AnalysisStyle {\n if (!props)\n return this.defaults;\n\n props = tryConvertLegacyProps(props);\n if (!props.displacement && !props.scalar && undefined === props.normalChannelName)\n return this.defaults;\n\n return new AnalysisStyle(props);\n }\n\n /** @internal */\n private constructor(props: AnalysisStyleProps) {\n this.normalChannelName = props.normalChannelName;\n if (props.displacement)\n this.displacement = AnalysisStyleDisplacement.fromJSON(props.displacement);\n\n if (props.scalar)\n this.thematic = AnalysisStyleThematic.fromJSON(props.scalar);\n }\n\n /** Convert this style to its JSON representation. */\n public toJSON(): AnalysisStyleProps {\n const props: AnalysisStyleProps = {};\n if (this === AnalysisStyle.defaults)\n return props;\n\n if (this.displacement)\n props.displacement = this.displacement.toJSON();\n\n if (this.thematic)\n props.scalar = this.thematic.toJSON();\n\n if (undefined !== this.normalChannelName)\n props.normalChannelName = this.normalChannelName;\n\n return props;\n }\n\n /** Produce a copy of this style identical except for properties explicitly specified by `changedProps`. */\n public clone(changedProps: AnalysisStyleProps): AnalysisStyle {\n return AnalysisStyle.fromJSON({\n ...this.toJSON(),\n ...changedProps,\n });\n }\n\n /** Return true if this style is equivalent to `other`. */\n public equals(other: AnalysisStyle): boolean {\n if (this.normalChannelName !== other.normalChannelName)\n return false;\n\n if ((undefined === this.displacement) !== (undefined === other.displacement))\n return false;\n else if (this.displacement && !this.displacement.equals(other.displacement!))\n return false;\n\n if ((undefined === this.thematic) !== (undefined === other.thematic))\n return false;\n\n return undefined === this.thematic || this.thematic.equals(other.thematic!);\n }\n\n public static readonly defaults = new AnalysisStyle({});\n}\n"]}
@@ -28,7 +28,6 @@ import { JsonUtils } from "@itwin/core-bentley";
28
28
  */
29
29
  export var Atmosphere;
30
30
  (function (Atmosphere) {
31
- var _a;
32
31
  /** @internal An immutable container of wavelength values for the red, green and blue pixel components. Values are in nanometers. */
33
32
  class Wavelengths {
34
33
  /** Constructs from red, green, and blue wavelength values.
@@ -65,6 +64,16 @@ export var Atmosphere;
65
64
  Atmosphere.Wavelengths = Wavelengths;
66
65
  /** Describes the properties with which the atmospheric scattering effect should be drawn. Theses properties correspond to a physics-based approximation of atmospheric scattering phenomenons. */
67
66
  class Settings {
67
+ static { this._defaultAtmosphereHeightAboveEarth = 100000.0; }
68
+ static { this._defaultExposure = 2.0; }
69
+ static { this._defaultDensityFalloff = 10.0; }
70
+ static { this._defaultScatteringStrength = 100; }
71
+ static { this._defaultWavelengths = new Wavelengths({ r: 700.0, g: 530.0, b: 440.0 }); }
72
+ static { this._defaultNumViewRaySamples = 10; }
73
+ static { this._highQualityNumViewRaySamples = 20; }
74
+ static { this._defaultNumSunRaySamples = 5; }
75
+ static { this.defaults = new Settings({}); }
76
+ static { this.highQuality = new Settings({ numViewRaySamples: this._highQualityNumViewRaySamples }); }
68
77
  equals(other) {
69
78
  if (this.atmosphereHeightAboveEarth !== other.atmosphereHeightAboveEarth)
70
79
  return false;
@@ -85,19 +94,19 @@ export var Atmosphere;
85
94
  return true;
86
95
  }
87
96
  constructor(json) {
88
- this.atmosphereHeightAboveEarth = JsonUtils.asDouble(json.atmosphereHeightAboveEarth, _a._defaultAtmosphereHeightAboveEarth);
89
- this.exposure = JsonUtils.asDouble(json.exposure, _a._defaultExposure);
90
- this.densityFalloff = JsonUtils.asDouble(json.densityFalloff, _a._defaultDensityFalloff);
91
- this.depthBelowEarthForMaxDensity = JsonUtils.asDouble(json.depthBelowEarthForMaxDensity, _a._defaultMinDensityHeightBelowEarth);
92
- this.numViewRaySamples = JsonUtils.asDouble(json.numViewRaySamples, _a._defaultNumViewRaySamples);
93
- this.numSunRaySamples = JsonUtils.asDouble(json.numSunRaySamples, _a._defaultNumSunRaySamples);
94
- this.scatteringStrength = JsonUtils.asDouble(json.scatteringStrength, _a._defaultScatteringStrength);
95
- this.wavelengths = Wavelengths.fromJSON(JsonUtils.asObject(json.wavelengths) ?? _a._defaultWavelengths);
97
+ this.atmosphereHeightAboveEarth = JsonUtils.asDouble(json.atmosphereHeightAboveEarth, Settings._defaultAtmosphereHeightAboveEarth);
98
+ this.exposure = JsonUtils.asDouble(json.exposure, Settings._defaultExposure);
99
+ this.densityFalloff = JsonUtils.asDouble(json.densityFalloff, Settings._defaultDensityFalloff);
100
+ this.depthBelowEarthForMaxDensity = JsonUtils.asDouble(json.depthBelowEarthForMaxDensity, Settings._defaultMinDensityHeightBelowEarth);
101
+ this.numViewRaySamples = JsonUtils.asDouble(json.numViewRaySamples, Settings._defaultNumViewRaySamples);
102
+ this.numSunRaySamples = JsonUtils.asDouble(json.numSunRaySamples, Settings._defaultNumSunRaySamples);
103
+ this.scatteringStrength = JsonUtils.asDouble(json.scatteringStrength, Settings._defaultScatteringStrength);
104
+ this.wavelengths = Wavelengths.fromJSON(JsonUtils.asObject(json.wavelengths) ?? Settings._defaultWavelengths);
96
105
  }
97
106
  static fromJSON(json) {
98
107
  if (undefined === json)
99
108
  return this.defaults;
100
- return new _a(json);
109
+ return new Settings(json);
101
110
  }
102
111
  toJSON(display) {
103
112
  const json = {
@@ -115,17 +124,6 @@ export var Atmosphere;
115
124
  return json;
116
125
  }
117
126
  }
118
- _a = Settings;
119
- Settings._defaultAtmosphereHeightAboveEarth = 100000.0;
120
- Settings._defaultExposure = 2.0;
121
- Settings._defaultDensityFalloff = 10.0;
122
- Settings._defaultScatteringStrength = 100;
123
- Settings._defaultWavelengths = new Wavelengths({ r: 700.0, g: 530.0, b: 440.0 });
124
- Settings._defaultNumViewRaySamples = 10;
125
- Settings._highQualityNumViewRaySamples = 20;
126
- Settings._defaultNumSunRaySamples = 5;
127
- Settings.defaults = new _a({});
128
- Settings.highQuality = new _a({ numViewRaySamples: _a._highQualityNumViewRaySamples });
129
127
  Atmosphere.Settings = Settings;
130
128
  })(Atmosphere || (Atmosphere = {}));
131
129
  //# sourceMappingURL=Atmosphere.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Atmosphere.js","sourceRoot":"","sources":["../../src/Atmosphere.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,KAAW,UAAU,CAgK1B;AAhKD,WAAiB,UAAU;;IASzB,oIAAoI;IACpI,MAAa,WAAW;QAKtB;;;;WAIG;QACH,YAAY,KAAuB;YACjC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;YAC9B,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;YAC9B,IAAI,CAAC,CAAC,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WAAW,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,AAAjE,CAAkE;IAErF,kCAAyB,GAAW,EAAE,AAAb,CAAc;IACvC,sCAA6B,GAAW,EAAE,AAAb,CAAc;IAC3C,iCAAwB,GAAW,CAAC,AAAZ,CAAa;IAE7B,iBAAQ,GAAG,IAAI,EAAQ,CAAC,EAAE,CAAC,AAAnB,CAAoB;IAC5B,oBAAW,GAAG,IAAI,EAAQ,CAAC,EAAE,iBAAiB,EAAE,EAAI,CAAC,6BAA6B,EAAE,CAAC,AAA1E,CAA2E;IAblG,mBAAQ,WAsFpB,CAAA;AACH,CAAC,EAhKgB,UAAU,KAAV,UAAU,QAgK1B","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 */\nimport { JsonUtils } from \"@itwin/core-bentley\";\n\n/** Namespace containing types controlling how atmospheric scattering should be rendered.\n * @beta\n * The techniques used to render the atmosphere approximate the physical behavior of light when interacting with particles in the air (Rayleigh Scattering and Mie Scattering)\n * Presently, only Rayleigh Scattering is implemented here\n *\n * In a nutshell, this implementation samples atmospheric density along rays cast from the view and uses the samples to simulate the scattering of light toward the camera.\n * The amount of light scattered toward the camera is dependent on the amount of light scattered away from its original path from the sun, so rays must also be cast from the sample points to the sun.\n *\n * The effect can be computed on vertices (the default for the background map) and fragments (the default for the skybox, which is a ViewportQuad).\n * All coordinates are in view space.\n *\n * This implementation is adapted from equations outlined in \"Display of Clouds Taking into Account Multiple Anisotropic Scattering and Sky Light\", Nishita et al. 1993\n * which are further refined for use in GPU shaders in \"Photorealistic Real-Time Outdoor Light Scattering\", Hoffman and Preetham 2002.\n * These sources are also compiled in Chapter 16 of NVIDIA's \"GPU Gems 2\", which can be found online here:\n * https://developer.nvidia.com/gpugems/gpugems2/part-ii-shading-lighting-and-shadows/chapter-16-accurate-atmospheric-scattering\n *\n * This implementation is also highly inspired by Sebastian Lague's Solar System project: https://github.com/SebLague/Solar-System/ and video: https://www.youtube.com/watch?v=DxfEbulyFcY\n * along with this ShaderToy replica: https://www.shadertoy.com/view/fltXD2.\n * Both of which are inspired by this Nvidia article on atmospheric scattering: https://developer.nvidia.com/gpugems/gpugems2/part-ii-shading-lighting-and-shadows/chapter-16-accurate-atmospheric-scattering.\n */\nexport namespace Atmosphere {\n\n /** @internal JSON representation of a [[Wavelengths]] object */\n export interface WavelengthsProps {\n r: number;\n g: number;\n b: number;\n }\n\n /** @internal An immutable container of wavelength values for the red, green and blue pixel components. Values are in nanometers. */\n export class Wavelengths {\n public readonly r: number;\n public readonly g: number;\n public readonly b: number;\n\n /** Constructs from red, green, and blue wavelength values.\n * @param r Wavelength value for red\n * @param g Wavelength value for green\n * @param b Wavelength value for blue\n */\n constructor(props: WavelengthsProps) {\n this.r = Math.max(0, props.r);\n this.g = Math.max(0, props.g);\n this.b = Math.max(0, props.b);\n }\n\n public equals(other: Wavelengths): boolean {\n return this.r === other.r && this.g === other.g && this.b === other.b;\n }\n\n public toJSON(): WavelengthsProps {\n return { r: this.r, g: this.g, b: this.b };\n }\n\n public static fromJSON(json: WavelengthsProps | undefined): Wavelengths {\n let r = 0;\n let g = 0;\n let b = 0;\n if (undefined !== json) {\n if (typeof json.r === \"number\")\n r = json.r;\n if (typeof json.g === \"number\")\n g = json.g;\n if (typeof json.b === \"number\")\n b = json.b;\n }\n return new Wavelengths({ r, g, b });\n }\n }\n\n /** Describes the properties with which the atmospheric scattering effect should be drawn. Theses properties correspond to a physics-based approximation of atmospheric scattering phenomenons. */\n export interface Props {\n /** Whether the ground plane should be displayed. Defaults to false. */\n display?: boolean;\n /** @internal See [[Settings.atmosphereHeightAboveEarth]] */\n atmosphereHeightAboveEarth?: number;\n /** See [[Settings.exposure]] */\n exposure?: number;\n /** @internal See [[Settings.densityFalloff]] */\n densityFalloff?: number;\n /** @internal See [[Settings.minDensityHeightBelowEarth]] */\n depthBelowEarthForMaxDensity?: number;\n /** See [[Settings.numViewRaySamples]] */\n numViewRaySamples?: number;\n /** See [[Settings.numSunRaySamples]] */\n numSunRaySamples?: number;\n /** @internal See [[Settings.scatteringStrength]] */\n scatteringStrength?: number;\n /** @internal See [[Settings.wavelengths]] */\n wavelengths?: WavelengthsProps;\n }\n\n /** Describes the properties with which the atmospheric scattering effect should be drawn. Theses properties correspond to a physics-based approximation of atmospheric scattering phenomenons. */\n export class Settings {\n private static _defaultAtmosphereHeightAboveEarth: number = 100000.0;\n private static _defaultExposure: number = 2.0;\n private static _defaultDensityFalloff: number = 10.0;\n private static _defaultMinDensityHeightBelowEarth: 0.0;\n private static _defaultScatteringStrength: number = 100;\n private static _defaultWavelengths: Wavelengths = new Wavelengths({ r: 700.0, g: 530.0, b: 440.0 });\n\n private static _defaultNumViewRaySamples: number = 10;\n private static _highQualityNumViewRaySamples: number = 20;\n private static _defaultNumSunRaySamples: number = 5;\n\n public static readonly defaults = new Settings({});\n public static readonly highQuality = new Settings({ numViewRaySamples: this._highQualityNumViewRaySamples });\n\n /** @internal If defined, corresponds to the height in meters above the earth's pole at which the atmosphere terminates. Physically, this is the point at which there are no more air molecules to interfere with light transmission. Defaults to 100_000.0. */\n public readonly atmosphereHeightAboveEarth: number;\n /** If defined, this value is used to simulate the aperture of a camera. Higher values allow more light in. This value might need to be adjusted slightly in situations without much sunlight (like sunset) to brighten the image. Defaults to 2.0 */\n public readonly exposure: number;\n /** @internal If defined, controls the rate at which the air density decreases between the point it is the highest and the point is is the lowest. A higher value means a faster decrease in air density. Defaults to 10.0. */\n public readonly densityFalloff: number;\n /** @internal If defined, corresponds to the height in meters below the earth's pole at which the atmosphere is at its densest. Physically, this is the point at which there is the most air molecules to interfere with light transmission. Defaults to 0.0. */\n public readonly depthBelowEarthForMaxDensity: number;\n /** If defined, corresponds to the number of atmospheric density samples used to compute the amount of light scattered along each view ray. For each sample point, another ray will be cast toward the sun to compute the amount of light reaching the sample point. Higher values increase fidelity, but greatly decrease performance because sun rays must be cast from each additional sample point. The range is 1 to 40. Defaults to 10. */\n public readonly numViewRaySamples: number;\n /** If defined, corresponds to the number of atmospheric density samples uses to compute the amount of light scattered along each sun ray. Higher values increase fidelity slightly but greatly decrease performance. Minimal improvement is observable with values above 5. The range is 1 to 40. Defaults to 5. */\n public readonly numSunRaySamples: number;\n /** @internal If defined, controls how strongly the atmosphere's air diverts light. Higher values increase scattering intensity. Defaults to 100.0. */\n public readonly scatteringStrength: number;\n /** @internal If defined, corresponds the wavelengths of the red, green and blue color components in nanometers used to simulate how the atmosphere's air molecules affects light transmission. (See Rayleigh Scattering) Thus, a value of 470 for the red wavelength will make the red light component scatter as if it physically were a cyan light ray. The default value is {r:700.0, g:530.0, b:440.0}. */\n public readonly wavelengths: Wavelengths;\n\n public equals(other: Settings): boolean {\n if (this.atmosphereHeightAboveEarth !== other.atmosphereHeightAboveEarth)\n return false;\n if (this.exposure !== other.exposure)\n return false;\n if (this.densityFalloff !== other.densityFalloff)\n return false;\n if (this.depthBelowEarthForMaxDensity !== other.depthBelowEarthForMaxDensity)\n return false;\n if (this.numViewRaySamples !== other.numViewRaySamples)\n return false;\n if (this.numSunRaySamples !== other.numSunRaySamples)\n return false;\n if (this.scatteringStrength !== other.scatteringStrength)\n return false;\n if (!this.wavelengths.equals(other.wavelengths))\n return false;\n return true;\n }\n\n private constructor(json: Props) {\n this.atmosphereHeightAboveEarth = JsonUtils.asDouble(json.atmosphereHeightAboveEarth, Settings._defaultAtmosphereHeightAboveEarth);\n this.exposure = JsonUtils.asDouble(json.exposure, Settings._defaultExposure);\n this.densityFalloff = JsonUtils.asDouble(json.densityFalloff, Settings._defaultDensityFalloff);\n this.depthBelowEarthForMaxDensity = JsonUtils.asDouble(json.depthBelowEarthForMaxDensity, Settings._defaultMinDensityHeightBelowEarth);\n this.numViewRaySamples = JsonUtils.asDouble(json.numViewRaySamples, Settings._defaultNumViewRaySamples);\n this.numSunRaySamples = JsonUtils.asDouble(json.numSunRaySamples, Settings._defaultNumSunRaySamples);\n this.scatteringStrength = JsonUtils.asDouble(json.scatteringStrength, Settings._defaultScatteringStrength);\n this.wavelengths = Wavelengths.fromJSON(JsonUtils.asObject(json.wavelengths) ?? Settings._defaultWavelengths);\n }\n\n public static fromJSON(json?: Props) {\n if (undefined === json)\n return this.defaults;\n return new Settings(json);\n }\n\n public toJSON(display?: boolean): Props {\n const json: Props = {\n atmosphereHeightAboveEarth: this.atmosphereHeightAboveEarth,\n exposure: this.exposure,\n densityFalloff: this.densityFalloff,\n depthBelowEarthForMaxDensity: this.depthBelowEarthForMaxDensity,\n numViewRaySamples: this.numViewRaySamples,\n numSunRaySamples: this.numSunRaySamples,\n scatteringStrength: this.scatteringStrength,\n wavelengths: this.wavelengths.toJSON(),\n };\n\n if (undefined !== display)\n json.display = display;\n\n return json;\n }\n }\n}\n"]}
1
+ {"version":3,"file":"Atmosphere.js","sourceRoot":"","sources":["../../src/Atmosphere.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,KAAW,UAAU,CAgK1B;AAhKD,WAAiB,UAAU;IASzB,oIAAoI;IACpI,MAAa,WAAW;QAKtB;;;;WAIG;QACH,YAAY,KAAuB;YACjC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;YAC9B,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;YAC9B,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;QAChC,CAAC;QAEM,MAAM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AE,IAAI,CAAC,gBAAgB;gBACvC,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;gBAC3C,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE;aACvC,CAAC;YAEF,IAAI,SAAS,KAAK,OAAO;gBACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;YAEzB,OAAO,IAAI,CAAC;QACd,CAAC;;IArFU,mBAAQ,WAsFpB,CAAA;AACH,CAAC,EAhKgB,UAAU,KAAV,UAAU,QAgK1B","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 */\nimport { JsonUtils } from \"@itwin/core-bentley\";\n\n/** Namespace containing types controlling how atmospheric scattering should be rendered.\n * @beta\n * The techniques used to render the atmosphere approximate the physical behavior of light when interacting with particles in the air (Rayleigh Scattering and Mie Scattering)\n * Presently, only Rayleigh Scattering is implemented here\n *\n * In a nutshell, this implementation samples atmospheric density along rays cast from the view and uses the samples to simulate the scattering of light toward the camera.\n * The amount of light scattered toward the camera is dependent on the amount of light scattered away from its original path from the sun, so rays must also be cast from the sample points to the sun.\n *\n * The effect can be computed on vertices (the default for the background map) and fragments (the default for the skybox, which is a ViewportQuad).\n * All coordinates are in view space.\n *\n * This implementation is adapted from equations outlined in \"Display of Clouds Taking into Account Multiple Anisotropic Scattering and Sky Light\", Nishita et al. 1993\n * which are further refined for use in GPU shaders in \"Photorealistic Real-Time Outdoor Light Scattering\", Hoffman and Preetham 2002.\n * These sources are also compiled in Chapter 16 of NVIDIA's \"GPU Gems 2\", which can be found online here:\n * https://developer.nvidia.com/gpugems/gpugems2/part-ii-shading-lighting-and-shadows/chapter-16-accurate-atmospheric-scattering\n *\n * This implementation is also highly inspired by Sebastian Lague's Solar System project: https://github.com/SebLague/Solar-System/ and video: https://www.youtube.com/watch?v=DxfEbulyFcY\n * along with this ShaderToy replica: https://www.shadertoy.com/view/fltXD2.\n * Both of which are inspired by this Nvidia article on atmospheric scattering: https://developer.nvidia.com/gpugems/gpugems2/part-ii-shading-lighting-and-shadows/chapter-16-accurate-atmospheric-scattering.\n */\nexport namespace Atmosphere {\n\n /** @internal JSON representation of a [[Wavelengths]] object */\n export interface WavelengthsProps {\n r: number;\n g: number;\n b: number;\n }\n\n /** @internal An immutable container of wavelength values for the red, green and blue pixel components. Values are in nanometers. */\n export class Wavelengths {\n public readonly r: number;\n public readonly g: number;\n public readonly b: number;\n\n /** Constructs from red, green, and blue wavelength values.\n * @param r Wavelength value for red\n * @param g Wavelength value for green\n * @param b Wavelength value for blue\n */\n constructor(props: WavelengthsProps) {\n this.r = Math.max(0, props.r);\n this.g = Math.max(0, props.g);\n this.b = Math.max(0, props.b);\n }\n\n public equals(other: Wavelengths): boolean {\n return this.r === other.r && this.g === other.g && this.b === other.b;\n }\n\n public toJSON(): WavelengthsProps {\n return { r: this.r, g: this.g, b: this.b };\n }\n\n public static fromJSON(json: WavelengthsProps | undefined): Wavelengths {\n let r = 0;\n let g = 0;\n let b = 0;\n if (undefined !== json) {\n if (typeof json.r === \"number\")\n r = json.r;\n if (typeof json.g === \"number\")\n g = json.g;\n if (typeof json.b === \"number\")\n b = json.b;\n }\n return new Wavelengths({ r, g, b });\n }\n }\n\n /** Describes the properties with which the atmospheric scattering effect should be drawn. Theses properties correspond to a physics-based approximation of atmospheric scattering phenomenons. */\n export interface Props {\n /** Whether the ground plane should be displayed. Defaults to false. */\n display?: boolean;\n /** @internal See [[Settings.atmosphereHeightAboveEarth]] */\n atmosphereHeightAboveEarth?: number;\n /** See [[Settings.exposure]] */\n exposure?: number;\n /** @internal See [[Settings.densityFalloff]] */\n densityFalloff?: number;\n /** @internal See [[Settings.minDensityHeightBelowEarth]] */\n depthBelowEarthForMaxDensity?: number;\n /** See [[Settings.numViewRaySamples]] */\n numViewRaySamples?: number;\n /** See [[Settings.numSunRaySamples]] */\n numSunRaySamples?: number;\n /** @internal See [[Settings.scatteringStrength]] */\n scatteringStrength?: number;\n /** @internal See [[Settings.wavelengths]] */\n wavelengths?: WavelengthsProps;\n }\n\n /** Describes the properties with which the atmospheric scattering effect should be drawn. Theses properties correspond to a physics-based approximation of atmospheric scattering phenomenons. */\n export class Settings {\n private static _defaultAtmosphereHeightAboveEarth: number = 100000.0;\n private static _defaultExposure: number = 2.0;\n private static _defaultDensityFalloff: number = 10.0;\n private static _defaultMinDensityHeightBelowEarth: 0.0;\n private static _defaultScatteringStrength: number = 100;\n private static _defaultWavelengths: Wavelengths = new Wavelengths({ r: 700.0, g: 530.0, b: 440.0 });\n\n private static _defaultNumViewRaySamples: number = 10;\n private static _highQualityNumViewRaySamples: number = 20;\n private static _defaultNumSunRaySamples: number = 5;\n\n public static readonly defaults = new Settings({});\n public static readonly highQuality = new Settings({ numViewRaySamples: this._highQualityNumViewRaySamples });\n\n /** @internal If defined, corresponds to the height in meters above the earth's pole at which the atmosphere terminates. Physically, this is the point at which there are no more air molecules to interfere with light transmission. Defaults to 100_000.0. */\n public readonly atmosphereHeightAboveEarth: number;\n /** If defined, this value is used to simulate the aperture of a camera. Higher values allow more light in. This value might need to be adjusted slightly in situations without much sunlight (like sunset) to brighten the image. Defaults to 2.0 */\n public readonly exposure: number;\n /** @internal If defined, controls the rate at which the air density decreases between the point it is the highest and the point is is the lowest. A higher value means a faster decrease in air density. Defaults to 10.0. */\n public readonly densityFalloff: number;\n /** @internal If defined, corresponds to the height in meters below the earth's pole at which the atmosphere is at its densest. Physically, this is the point at which there is the most air molecules to interfere with light transmission. Defaults to 0.0. */\n public readonly depthBelowEarthForMaxDensity: number;\n /** If defined, corresponds to the number of atmospheric density samples used to compute the amount of light scattered along each view ray. For each sample point, another ray will be cast toward the sun to compute the amount of light reaching the sample point. Higher values increase fidelity, but greatly decrease performance because sun rays must be cast from each additional sample point. The range is 1 to 40. Defaults to 10. */\n public readonly numViewRaySamples: number;\n /** If defined, corresponds to the number of atmospheric density samples uses to compute the amount of light scattered along each sun ray. Higher values increase fidelity slightly but greatly decrease performance. Minimal improvement is observable with values above 5. The range is 1 to 40. Defaults to 5. */\n public readonly numSunRaySamples: number;\n /** @internal If defined, controls how strongly the atmosphere's air diverts light. Higher values increase scattering intensity. Defaults to 100.0. */\n public readonly scatteringStrength: number;\n /** @internal If defined, corresponds the wavelengths of the red, green and blue color components in nanometers used to simulate how the atmosphere's air molecules affects light transmission. (See Rayleigh Scattering) Thus, a value of 470 for the red wavelength will make the red light component scatter as if it physically were a cyan light ray. The default value is {r:700.0, g:530.0, b:440.0}. */\n public readonly wavelengths: Wavelengths;\n\n public equals(other: Settings): boolean {\n if (this.atmosphereHeightAboveEarth !== other.atmosphereHeightAboveEarth)\n return false;\n if (this.exposure !== other.exposure)\n return false;\n if (this.densityFalloff !== other.densityFalloff)\n return false;\n if (this.depthBelowEarthForMaxDensity !== other.depthBelowEarthForMaxDensity)\n return false;\n if (this.numViewRaySamples !== other.numViewRaySamples)\n return false;\n if (this.numSunRaySamples !== other.numSunRaySamples)\n return false;\n if (this.scatteringStrength !== other.scatteringStrength)\n return false;\n if (!this.wavelengths.equals(other.wavelengths))\n return false;\n return true;\n }\n\n private constructor(json: Props) {\n this.atmosphereHeightAboveEarth = JsonUtils.asDouble(json.atmosphereHeightAboveEarth, Settings._defaultAtmosphereHeightAboveEarth);\n this.exposure = JsonUtils.asDouble(json.exposure, Settings._defaultExposure);\n this.densityFalloff = JsonUtils.asDouble(json.densityFalloff, Settings._defaultDensityFalloff);\n this.depthBelowEarthForMaxDensity = JsonUtils.asDouble(json.depthBelowEarthForMaxDensity, Settings._defaultMinDensityHeightBelowEarth);\n this.numViewRaySamples = JsonUtils.asDouble(json.numViewRaySamples, Settings._defaultNumViewRaySamples);\n this.numSunRaySamples = JsonUtils.asDouble(json.numSunRaySamples, Settings._defaultNumSunRaySamples);\n this.scatteringStrength = JsonUtils.asDouble(json.scatteringStrength, Settings._defaultScatteringStrength);\n this.wavelengths = Wavelengths.fromJSON(JsonUtils.asObject(json.wavelengths) ?? Settings._defaultWavelengths);\n }\n\n public static fromJSON(json?: Props) {\n if (undefined === json)\n return this.defaults;\n return new Settings(json);\n }\n\n public toJSON(display?: boolean): Props {\n const json: Props = {\n atmosphereHeightAboveEarth: this.atmosphereHeightAboveEarth,\n exposure: this.exposure,\n densityFalloff: this.densityFalloff,\n depthBelowEarthForMaxDensity: this.depthBelowEarthForMaxDensity,\n numViewRaySamples: this.numViewRaySamples,\n numSunRaySamples: this.numSunRaySamples,\n scatteringStrength: this.scatteringStrength,\n wavelengths: this.wavelengths.toJSON(),\n };\n\n if (undefined !== display)\n json.display = display;\n\n return json;\n }\n }\n}\n"]}
@@ -15,6 +15,8 @@ import { ColorDef } from "./ColorDef";
15
15
  * @public
16
16
  */
17
17
  export class CutStyle {
18
+ /** The default CutStyle, configured to draw the section-cut graphics using the view's settings, with no overrides. */
19
+ static { this.defaults = new CutStyle(); }
18
20
  constructor(viewflags, hiddenLine, appearance) {
19
21
  this.viewflags = viewflags ?? {};
20
22
  if (hiddenLine && !hiddenLine.matchesDefaults)
@@ -59,8 +61,6 @@ export class CutStyle {
59
61
  return !JsonUtils.isNonEmptyObject(this.viewflags) && (!this.hiddenLine || this.hiddenLine.matchesDefaults) && (!this.appearance || this.appearance.matchesDefaults);
60
62
  }
61
63
  }
62
- /** The default CutStyle, configured to draw the section-cut graphics using the view's settings, with no overrides. */
63
- CutStyle.defaults = new CutStyle();
64
64
  /** As part of a [[ClipStyle]], describes how to colorize geometry intersecting the clip planes.
65
65
  * @note Edges are highlighted only if [[ClipStyle.ClipIntersectionStyle]] is `true`.
66
66
  * @public
@@ -77,6 +77,7 @@ export class ClipIntersectionStyle {
77
77
  return this.defaults;
78
78
  return new ClipIntersectionStyle(color, width);
79
79
  }
80
+ static { this.defaults = new ClipIntersectionStyle(); }
80
81
  static fromJSON(props) {
81
82
  if (props === undefined) {
82
83
  return ClipIntersectionStyle.defaults;
@@ -103,12 +104,13 @@ export class ClipIntersectionStyle {
103
104
  return !this.color && !this.width;
104
105
  }
105
106
  }
106
- ClipIntersectionStyle.defaults = new ClipIntersectionStyle();
107
107
  /** Describes symbology and behavior applied to a [ClipVector]($core-geometry) when applied to a [ViewState]($frontend) or [[ModelClipGroup]].
108
108
  * @see [[DisplayStyleSettings.clipStyle]].
109
109
  * @public
110
110
  */
111
111
  export class ClipStyle {
112
+ /** The default style, which overrides none of the view's settings. */
113
+ static { this.defaults = new ClipStyle(false, false, CutStyle.defaults, undefined, undefined, undefined); }
112
114
  constructor(produceCutGeometry, colorizeIntersection, cutStyle, inside, outside, intersectionStyle) {
113
115
  this.produceCutGeometry = produceCutGeometry;
114
116
  this.colorizeIntersection = colorizeIntersection;
@@ -175,6 +177,4 @@ export class ClipStyle {
175
177
  return !this.produceCutGeometry && !this.colorizeIntersection && !this.insideColor && !this.outsideColor && this.cutStyle.matchesDefaults && !this.intersectionStyle;
176
178
  }
177
179
  }
178
- /** The default style, which overrides none of the view's settings. */
179
- ClipStyle.defaults = new ClipStyle(false, false, CutStyle.defaults, undefined, undefined, undefined);
180
180
  //# sourceMappingURL=ClipStyle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClipStyle.js","sourceRoot":"","sources":["../../src/ClipStyle.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAA0B,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAgBtC;;;GAGG;AACH,MAAM,OAAO,QAAQ;IAWnB,YAAoB,SAAuC,EAAE,UAAgC,EAAE,UAA8B;QAC3H,IAAI,CAAC,SAAS,GAAG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,SAAS,CAAC,QAAQ;YAC7B,OAAO,IAAI,CAAC;QAEd,OAAO,CAAC,IAAI,CAAC,kBAAkB,IAAI,CAAC,IAAI,CAAC,oBAAoB,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,QAAQ,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC;IACvK,CAAC;;AA7FD,sEAAsE;AAC/C,kBAAQ,GAAG,IAAI,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,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 Views\n */\n\nimport { assert, JsonUtils } from \"@itwin/core-bentley\";\nimport { ViewFlagOverrides } from \"./ViewFlags\";\nimport { RgbColor, RgbColorProps } from \"./RgbColor\";\nimport { HiddenLine } from \"./HiddenLine\";\nimport { FeatureAppearance, FeatureAppearanceProps } from \"./FeatureSymbology\";\nimport { ColorDef } from \"./ColorDef\";\n\n/** Wire format describing a [[CutStyle]] applied to section-cut geometry produced at intersections with a view's [ClipVector]($core-geometry).\n * @see [[ClipStyleProps.cutStyle]].\n * @public\n * @extensions\n */\nexport interface CutStyleProps {\n /** If defined, overrides aspects of the view's [[ViewFlags]] when drawing the cut geometry. */\n viewflags?: ViewFlagOverrides;\n /** If defined, overrides the view's [[HiddenLine.Settings]] when drawing the cut geometry. */\n hiddenLine?: HiddenLine.SettingsProps;\n /** If defined, overrides aspects of the cut geometry's symbology. */\n appearance?: FeatureAppearanceProps;\n}\n\n/** As part of a [[ClipStyle]], describes how section-cut graphics should be displayed.\n * @note Section-cut graphics are only produced if [[ClipStyle.produceCutGeometry]] is `true`.\n * @public\n */\nexport class CutStyle {\n /** Selectively overrides some of the view's [[ViewFlags]] when drawing the section-cut graphics. */\n public readonly viewflags: Readonly<ViewFlagOverrides>;\n /** If defined, overrides the settings the view uses to draw the edges of the section-cut graphics. */\n public readonly hiddenLine?: HiddenLine.Settings;\n /** If defined, overrides aspects of the symbology of the section-cut graphics. */\n public readonly appearance?: FeatureAppearance;\n\n /** The default CutStyle, configured to draw the section-cut graphics using the view's settings, with no overrides. */\n public static readonly defaults = new CutStyle();\n\n private constructor(viewflags?: Readonly<ViewFlagOverrides>, hiddenLine?: HiddenLine.Settings, appearance?: FeatureAppearance) {\n this.viewflags = viewflags ?? {};\n if (hiddenLine && !hiddenLine.matchesDefaults)\n this.hiddenLine = hiddenLine;\n\n if (appearance && !appearance.matchesDefaults)\n this.appearance = appearance;\n }\n\n /** Create a CutStyle from its components. */\n public static create(viewflags?: Readonly<ViewFlagOverrides>, hiddenLine?: HiddenLine.Settings, appearance?: FeatureAppearance): CutStyle {\n if ((viewflags && JsonUtils.isNonEmptyObject(viewflags)) || (hiddenLine && !hiddenLine.matchesDefaults) || (appearance && !appearance.matchesDefaults))\n return new CutStyle(viewflags, hiddenLine, appearance);\n\n return this.defaults;\n }\n\n public static fromJSON(props?: CutStyleProps): CutStyle {\n if (JsonUtils.isNonEmptyObject(props)) {\n const viewflags = { ...props?.viewflags };\n const hiddenLine = props?.hiddenLine ? HiddenLine.Settings.fromJSON(props.hiddenLine) : undefined;\n const appearance = props?.appearance ? FeatureAppearance.fromJSON(props.appearance) : undefined;\n\n return this.create(viewflags, hiddenLine, appearance);\n } else {\n return this.defaults;\n }\n }\n\n /** Return JSON representation. The representation is `undefined` if this style matches the default style. */\n public toJSON(): CutStyleProps | undefined {\n if (this.matchesDefaults)\n return undefined;\n\n const props: CutStyleProps = {};\n if (JsonUtils.isNonEmptyObject(this.viewflags))\n props.viewflags = this.viewflags;\n\n if (this.hiddenLine && !this.hiddenLine.matchesDefaults)\n props.hiddenLine = this.hiddenLine?.toJSON();\n\n if (this.appearance && !this.appearance.matchesDefaults)\n props.appearance = this.appearance.toJSON();\n\n return props;\n }\n\n /** Returns true if this style matches the default style - that is, it overrides none of the view's settings. */\n public get matchesDefaults(): boolean {\n if (this === CutStyle.defaults)\n return true;\n\n return !JsonUtils.isNonEmptyObject(this.viewflags) && (!this.hiddenLine || this.hiddenLine.matchesDefaults) && (!this.appearance || this.appearance.matchesDefaults);\n }\n}\n\n/** Wire format describing a [[ClipIntersectionStyle]].\n * @see [[ClipStyleProps.ClipIntersectionStyle]].\n * @public\n * @extensions\n */\nexport interface ClipIntersectionStyleProps {\n /** Color to apply to intersection of geometry and clip planes, default white */\n color?: RgbColorProps;\n /** Number of pixels to be considered intersecting the clip plane, default 1 */\n width?: number;\n}\n\n/** As part of a [[ClipStyle]], describes how to colorize geometry intersecting the clip planes.\n * @note Edges are highlighted only if [[ClipStyle.ClipIntersectionStyle]] is `true`.\n * @public\n * @extensions\n */\nexport class ClipIntersectionStyle {\n /** Color to apply to intersection of geometry and clip planes, default white */\n public readonly color: RgbColor;\n /** Number of pixels to be considered intersecting the clip plane, default 1 */\n public readonly width: number;\n\n private constructor(color: RgbColor = RgbColor.fromColorDef(ColorDef.white), width: number = 1) {\n this.color = color;\n this.width = width;\n }\n /** Create a highlight from its components. */\n public static create(color?: RgbColor, width?: number): ClipIntersectionStyle {\n if (!color && !width)\n return this.defaults;\n\n return new ClipIntersectionStyle(color, width);\n }\n\n public static readonly defaults = new ClipIntersectionStyle();\n\n public static fromJSON(props?: ClipIntersectionStyleProps): ClipIntersectionStyle {\n if (props === undefined) {\n return ClipIntersectionStyle.defaults;\n }\n\n const color = props.color ? RgbColor.fromJSON(props.color) : RgbColor.fromColorDef(ColorDef.white);\n const width = props.width ? props.width : 1;\n return new ClipIntersectionStyle(color, width);\n }\n\n /** The JSON representation of this style. It is `undefined` if this style matches the defaults. */\n public toJSON(): ClipIntersectionStyleProps | undefined {\n const props: ClipIntersectionStyleProps = {};\n\n if (this.matchesDefaults) {\n return undefined;\n }\n\n if (this.color)\n props.color = this.color.toJSON();\n\n if (this.width)\n props.width = this.width;\n\n return props;\n }\n\n public get matchesDefaults(): boolean {\n if (this === ClipIntersectionStyle.defaults)\n return true;\n\n return !this.color && !this.width;\n }\n}\n\n/** Arguments supplied to [[ClipStyle.create]].\n * @public\n * @extensions\n */\nexport interface ClipStyleCreateArgs {\n /** If `true`, geometry will be produced at the clip planes in a 3d view.\n * - Solids (closed volumes) will produce facets on the clip planes.\n * - Other surfaces will produce line strings representing the edges of the surface at the clip planes.\n * @note Cut geometry will only be produced for element geometry - not for, e.g., terrain or reality models.\n */\n produceCutGeometry?: boolean;\n /** If `true`, intersection of geometry and clip planes will be colorized */\n colorizeIntersection?: boolean;\n /** Controls aspects of how the cut geometry is displayed, if [[produceCutGeometry]] is `true`. */\n cutStyle?: CutStyle;\n /** If defined, geometry inside the clip planes will be drawn in this color. */\n insideColor?: RgbColor;\n /** If defined, geometry outside of the clip planes will be drawn in this color instead of being clipped. */\n outsideColor?: RgbColor;\n /** Controls the style of the intersection of geometry and clip planes */\n intersectionStyle?: ClipIntersectionStyle;\n}\n\n/** Wire format describing a [[ClipStyle]].\n * @see [[DisplayStyleSettingsProps.clipStyle]].\n * @public\n * @extensions\n */\nexport interface ClipStyleProps {\n /** If `true`, geometry will be produced at the clip planes in a 3d view.\n * - Solids (closed volumes) will produce facets on the clip planes.\n * - Other surfaces will produce line strings representing the edges of the surface at the clip planes.\n * @note Cut geometry will only be produced for element geometry - not for, e.g., terrain or reality models.\n */\n produceCutGeometry?: boolean;\n /** If 'true', intersection of geometry and clip planes will be colorized */\n colorizeIntersection?: boolean;\n /** Controls aspects of how the cut geometry is displayed, if [[produceCutGeometry]] is `true`. */\n cutStyle?: CutStyleProps;\n /** If defined, geometry inside the clip planes will be drawn in this color. */\n insideColor?: RgbColorProps;\n /** If defined, geometry outside of the clip planes will be drawn in this color instead of being clipped. */\n outsideColor?: RgbColorProps;\n /** Controls the style of the intersection of geometry and clip planes */\n intersectionStyle?: ClipIntersectionStyleProps;\n}\n\n/** Describes symbology and behavior applied to a [ClipVector]($core-geometry) when applied to a [ViewState]($frontend) or [[ModelClipGroup]].\n * @see [[DisplayStyleSettings.clipStyle]].\n * @public\n */\nexport class ClipStyle {\n /** If `true`, geometry will be produced at the clip planes.\n * - Solids (closed volumes) will produce facets on the clip planes.\n * - Other surfaces will produce line strings representing the edges of the surface at the clip planes.\n * @note Cut geometry will only be produced for element geometry - not for, e.g., terrain or reality models.\n */\n public readonly produceCutGeometry: boolean;\n /** If 'true', intersection of geometry and clip planes will be colorized */\n public readonly colorizeIntersection: boolean;\n /** Controls aspects of how the cut geometry is displayed, if [[produceCutGeometry]] is `true`. */\n public readonly cutStyle: CutStyle;\n /** If defined, geometry inside the clip planes will be drawn in this color. */\n public readonly insideColor?: RgbColor;\n /** If defined, geometry outside of the clip planes will be drawn in this color instead of being clipped. */\n public readonly outsideColor?: RgbColor;\n /** Controls the style of the intersection of geometry and clip planes */\n public readonly intersectionStyle?: ClipIntersectionStyle;\n\n /** The default style, which overrides none of the view's settings. */\n public static readonly defaults = new ClipStyle(false, false, CutStyle.defaults, undefined, undefined, undefined);\n\n private constructor(produceCutGeometry: boolean, colorizeIntersection: boolean, cutStyle: CutStyle, inside: RgbColor | undefined, outside: RgbColor | undefined, intersectionStyle: ClipIntersectionStyle | undefined) {\n this.produceCutGeometry = produceCutGeometry;\n this.colorizeIntersection = colorizeIntersection;\n this.cutStyle = cutStyle;\n this.insideColor = inside;\n this.outsideColor = outside;\n this.intersectionStyle = intersectionStyle;\n }\n\n /** @deprecated in 4.x. Use [[create(style: ClipStyleCreateArgs]] */\n public static create(produceCutGeometry: boolean, cutStyle: CutStyle, insideColor?: RgbColor, outsideColor?: RgbColor): ClipStyle;\n\n /** Create a style from its components. */\n public static create(style: ClipStyleCreateArgs): ClipStyle;\n\n /** @internal */\n public static create(styleOrProduceCutGeometry: ClipStyleCreateArgs | boolean, cutStyle?: CutStyle, insideColor?: RgbColor, outsideColor?: RgbColor): ClipStyle {\n\n if (typeof styleOrProduceCutGeometry === \"boolean\") {\n cutStyle = cutStyle === undefined ? CutStyle.defaults : cutStyle;\n\n if (!styleOrProduceCutGeometry && cutStyle.matchesDefaults && !insideColor && !outsideColor) {\n return this.defaults;\n }\n\n return new ClipStyle(styleOrProduceCutGeometry, false, cutStyle, insideColor, outsideColor, undefined);\n }\n\n const style = styleOrProduceCutGeometry;\n if (!style.produceCutGeometry && !style.colorizeIntersection && (!style.cutStyle || style.cutStyle.matchesDefaults) && !style.insideColor && !style.outsideColor && !style.intersectionStyle)\n return this.defaults;\n\n const produceCutGeometry = style.produceCutGeometry ? true : false;\n const colorizeIntersection = style.colorizeIntersection ? true : false;\n cutStyle = style.cutStyle === undefined ? CutStyle.defaults : style.cutStyle;\n\n return new ClipStyle(produceCutGeometry, colorizeIntersection, cutStyle, style.insideColor, style.outsideColor, style.intersectionStyle);\n }\n\n public static fromJSON(props?: ClipStyleProps): ClipStyle {\n if (JsonUtils.isNonEmptyObject(props)) {\n const produceCutGeometry = props.produceCutGeometry ?? false;\n const colorizeIntersection = props.colorizeIntersection ? true : false;\n const cutStyle = CutStyle.fromJSON(props.cutStyle);\n const insideColor = props.insideColor ? RgbColor.fromJSON(props.insideColor) : undefined;\n const outsideColor = props.outsideColor ? RgbColor.fromJSON(props.outsideColor) : undefined;\n const intersectionStyle = props.intersectionStyle ? ClipIntersectionStyle.fromJSON(props.intersectionStyle) : undefined;\n\n return this.create({produceCutGeometry, colorizeIntersection, cutStyle, insideColor, outsideColor, intersectionStyle});\n }\n\n return this.defaults;\n }\n\n /** The JSON representation of this style. It is `undefined` if this style matches the defaults. */\n public toJSON(): ClipStyleProps | undefined {\n if (this.matchesDefaults)\n return undefined;\n\n const props: ClipStyleProps = {};\n if (this.produceCutGeometry)\n props.produceCutGeometry = true;\n\n if (this.colorizeIntersection)\n props.colorizeIntersection = true;\n\n const cutStyle = this.cutStyle.toJSON();\n if (cutStyle) {\n assert(!this.cutStyle.matchesDefaults);\n props.cutStyle = cutStyle;\n }\n\n if (this.insideColor)\n props.insideColor = this.insideColor.toJSON();\n\n if (this.outsideColor)\n props.outsideColor = this.outsideColor.toJSON();\n\n if (this.intersectionStyle)\n props.intersectionStyle = this.intersectionStyle.toJSON();\n\n return props;\n }\n\n /** Returns true if this style matches the [[ClipStyle.defaults]] - that is, it overrides no settings from the view. */\n public get matchesDefaults(): boolean {\n if (this === ClipStyle.defaults)\n return true;\n\n return !this.produceCutGeometry && !this.colorizeIntersection && !this.insideColor && !this.outsideColor && this.cutStyle.matchesDefaults && !this.intersectionStyle;\n }\n}\n"]}
1
+ {"version":3,"file":"ClipStyle.js","sourceRoot":"","sources":["../../src/ClipStyle.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAA0B,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAgBtC;;;GAGG;AACH,MAAM,OAAO,QAAQ;IAQnB,sHAAsH;aAC/F,aAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;IAEjD,YAAoB,SAAuC,EAAE,UAAgC,EAAE,UAA8B;QAC3H,IAAI,CAAC,SAAS,GAAG,SAAS,IAAI,EAAE,CAAC;QACjC,IAAI,UAAU,IAAI,CAAC,UAAU,CAAC,eAAe;YAC3C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAE/B,IAAI,UAAU,IAAI,CAAC,UAAU,CAAC,eAAe;YAC3C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;IAED,6CAA6C;IACtC,MAAM,CAAC,MAAM,CAAC,SAAuC,EAAE,UAAgC,EAAE,UAA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AI,CAAC,IAAI,CAAC,iBAAiB,CAAC;IACvK,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 Views\n */\n\nimport { assert, JsonUtils } from \"@itwin/core-bentley\";\nimport { ViewFlagOverrides } from \"./ViewFlags\";\nimport { RgbColor, RgbColorProps } from \"./RgbColor\";\nimport { HiddenLine } from \"./HiddenLine\";\nimport { FeatureAppearance, FeatureAppearanceProps } from \"./FeatureSymbology\";\nimport { ColorDef } from \"./ColorDef\";\n\n/** Wire format describing a [[CutStyle]] applied to section-cut geometry produced at intersections with a view's [ClipVector]($core-geometry).\n * @see [[ClipStyleProps.cutStyle]].\n * @public\n * @extensions\n */\nexport interface CutStyleProps {\n /** If defined, overrides aspects of the view's [[ViewFlags]] when drawing the cut geometry. */\n viewflags?: ViewFlagOverrides;\n /** If defined, overrides the view's [[HiddenLine.Settings]] when drawing the cut geometry. */\n hiddenLine?: HiddenLine.SettingsProps;\n /** If defined, overrides aspects of the cut geometry's symbology. */\n appearance?: FeatureAppearanceProps;\n}\n\n/** As part of a [[ClipStyle]], describes how section-cut graphics should be displayed.\n * @note Section-cut graphics are only produced if [[ClipStyle.produceCutGeometry]] is `true`.\n * @public\n */\nexport class CutStyle {\n /** Selectively overrides some of the view's [[ViewFlags]] when drawing the section-cut graphics. */\n public readonly viewflags: Readonly<ViewFlagOverrides>;\n /** If defined, overrides the settings the view uses to draw the edges of the section-cut graphics. */\n public readonly hiddenLine?: HiddenLine.Settings;\n /** If defined, overrides aspects of the symbology of the section-cut graphics. */\n public readonly appearance?: FeatureAppearance;\n\n /** The default CutStyle, configured to draw the section-cut graphics using the view's settings, with no overrides. */\n public static readonly defaults = new CutStyle();\n\n private constructor(viewflags?: Readonly<ViewFlagOverrides>, hiddenLine?: HiddenLine.Settings, appearance?: FeatureAppearance) {\n this.viewflags = viewflags ?? {};\n if (hiddenLine && !hiddenLine.matchesDefaults)\n this.hiddenLine = hiddenLine;\n\n if (appearance && !appearance.matchesDefaults)\n this.appearance = appearance;\n }\n\n /** Create a CutStyle from its components. */\n public static create(viewflags?: Readonly<ViewFlagOverrides>, hiddenLine?: HiddenLine.Settings, appearance?: FeatureAppearance): CutStyle {\n if ((viewflags && JsonUtils.isNonEmptyObject(viewflags)) || (hiddenLine && !hiddenLine.matchesDefaults) || (appearance && !appearance.matchesDefaults))\n return new CutStyle(viewflags, hiddenLine, appearance);\n\n return this.defaults;\n }\n\n public static fromJSON(props?: CutStyleProps): CutStyle {\n if (JsonUtils.isNonEmptyObject(props)) {\n const viewflags = { ...props?.viewflags };\n const hiddenLine = props?.hiddenLine ? HiddenLine.Settings.fromJSON(props.hiddenLine) : undefined;\n const appearance = props?.appearance ? FeatureAppearance.fromJSON(props.appearance) : undefined;\n\n return this.create(viewflags, hiddenLine, appearance);\n } else {\n return this.defaults;\n }\n }\n\n /** Return JSON representation. The representation is `undefined` if this style matches the default style. */\n public toJSON(): CutStyleProps | undefined {\n if (this.matchesDefaults)\n return undefined;\n\n const props: CutStyleProps = {};\n if (JsonUtils.isNonEmptyObject(this.viewflags))\n props.viewflags = this.viewflags;\n\n if (this.hiddenLine && !this.hiddenLine.matchesDefaults)\n props.hiddenLine = this.hiddenLine?.toJSON();\n\n if (this.appearance && !this.appearance.matchesDefaults)\n props.appearance = this.appearance.toJSON();\n\n return props;\n }\n\n /** Returns true if this style matches the default style - that is, it overrides none of the view's settings. */\n public get matchesDefaults(): boolean {\n if (this === CutStyle.defaults)\n return true;\n\n return !JsonUtils.isNonEmptyObject(this.viewflags) && (!this.hiddenLine || this.hiddenLine.matchesDefaults) && (!this.appearance || this.appearance.matchesDefaults);\n }\n}\n\n/** Wire format describing a [[ClipIntersectionStyle]].\n * @see [[ClipStyleProps.ClipIntersectionStyle]].\n * @public\n * @extensions\n */\nexport interface ClipIntersectionStyleProps {\n /** Color to apply to intersection of geometry and clip planes, default white */\n color?: RgbColorProps;\n /** Number of pixels to be considered intersecting the clip plane, default 1 */\n width?: number;\n}\n\n/** As part of a [[ClipStyle]], describes how to colorize geometry intersecting the clip planes.\n * @note Edges are highlighted only if [[ClipStyle.ClipIntersectionStyle]] is `true`.\n * @public\n * @extensions\n */\nexport class ClipIntersectionStyle {\n /** Color to apply to intersection of geometry and clip planes, default white */\n public readonly color: RgbColor;\n /** Number of pixels to be considered intersecting the clip plane, default 1 */\n public readonly width: number;\n\n private constructor(color: RgbColor = RgbColor.fromColorDef(ColorDef.white), width: number = 1) {\n this.color = color;\n this.width = width;\n }\n /** Create a highlight from its components. */\n public static create(color?: RgbColor, width?: number): ClipIntersectionStyle {\n if (!color && !width)\n return this.defaults;\n\n return new ClipIntersectionStyle(color, width);\n }\n\n public static readonly defaults = new ClipIntersectionStyle();\n\n public static fromJSON(props?: ClipIntersectionStyleProps): ClipIntersectionStyle {\n if (props === undefined) {\n return ClipIntersectionStyle.defaults;\n }\n\n const color = props.color ? RgbColor.fromJSON(props.color) : RgbColor.fromColorDef(ColorDef.white);\n const width = props.width ? props.width : 1;\n return new ClipIntersectionStyle(color, width);\n }\n\n /** The JSON representation of this style. It is `undefined` if this style matches the defaults. */\n public toJSON(): ClipIntersectionStyleProps | undefined {\n const props: ClipIntersectionStyleProps = {};\n\n if (this.matchesDefaults) {\n return undefined;\n }\n\n if (this.color)\n props.color = this.color.toJSON();\n\n if (this.width)\n props.width = this.width;\n\n return props;\n }\n\n public get matchesDefaults(): boolean {\n if (this === ClipIntersectionStyle.defaults)\n return true;\n\n return !this.color && !this.width;\n }\n}\n\n/** Arguments supplied to [[ClipStyle.create]].\n * @public\n * @extensions\n */\nexport interface ClipStyleCreateArgs {\n /** If `true`, geometry will be produced at the clip planes in a 3d view.\n * - Solids (closed volumes) will produce facets on the clip planes.\n * - Other surfaces will produce line strings representing the edges of the surface at the clip planes.\n * @note Cut geometry will only be produced for element geometry - not for, e.g., terrain or reality models.\n */\n produceCutGeometry?: boolean;\n /** If `true`, intersection of geometry and clip planes will be colorized */\n colorizeIntersection?: boolean;\n /** Controls aspects of how the cut geometry is displayed, if [[produceCutGeometry]] is `true`. */\n cutStyle?: CutStyle;\n /** If defined, geometry inside the clip planes will be drawn in this color. */\n insideColor?: RgbColor;\n /** If defined, geometry outside of the clip planes will be drawn in this color instead of being clipped. */\n outsideColor?: RgbColor;\n /** Controls the style of the intersection of geometry and clip planes */\n intersectionStyle?: ClipIntersectionStyle;\n}\n\n/** Wire format describing a [[ClipStyle]].\n * @see [[DisplayStyleSettingsProps.clipStyle]].\n * @public\n * @extensions\n */\nexport interface ClipStyleProps {\n /** If `true`, geometry will be produced at the clip planes in a 3d view.\n * - Solids (closed volumes) will produce facets on the clip planes.\n * - Other surfaces will produce line strings representing the edges of the surface at the clip planes.\n * @note Cut geometry will only be produced for element geometry - not for, e.g., terrain or reality models.\n */\n produceCutGeometry?: boolean;\n /** If 'true', intersection of geometry and clip planes will be colorized */\n colorizeIntersection?: boolean;\n /** Controls aspects of how the cut geometry is displayed, if [[produceCutGeometry]] is `true`. */\n cutStyle?: CutStyleProps;\n /** If defined, geometry inside the clip planes will be drawn in this color. */\n insideColor?: RgbColorProps;\n /** If defined, geometry outside of the clip planes will be drawn in this color instead of being clipped. */\n outsideColor?: RgbColorProps;\n /** Controls the style of the intersection of geometry and clip planes */\n intersectionStyle?: ClipIntersectionStyleProps;\n}\n\n/** Describes symbology and behavior applied to a [ClipVector]($core-geometry) when applied to a [ViewState]($frontend) or [[ModelClipGroup]].\n * @see [[DisplayStyleSettings.clipStyle]].\n * @public\n */\nexport class ClipStyle {\n /** If `true`, geometry will be produced at the clip planes.\n * - Solids (closed volumes) will produce facets on the clip planes.\n * - Other surfaces will produce line strings representing the edges of the surface at the clip planes.\n * @note Cut geometry will only be produced for element geometry - not for, e.g., terrain or reality models.\n */\n public readonly produceCutGeometry: boolean;\n /** If 'true', intersection of geometry and clip planes will be colorized */\n public readonly colorizeIntersection: boolean;\n /** Controls aspects of how the cut geometry is displayed, if [[produceCutGeometry]] is `true`. */\n public readonly cutStyle: CutStyle;\n /** If defined, geometry inside the clip planes will be drawn in this color. */\n public readonly insideColor?: RgbColor;\n /** If defined, geometry outside of the clip planes will be drawn in this color instead of being clipped. */\n public readonly outsideColor?: RgbColor;\n /** Controls the style of the intersection of geometry and clip planes */\n public readonly intersectionStyle?: ClipIntersectionStyle;\n\n /** The default style, which overrides none of the view's settings. */\n public static readonly defaults = new ClipStyle(false, false, CutStyle.defaults, undefined, undefined, undefined);\n\n private constructor(produceCutGeometry: boolean, colorizeIntersection: boolean, cutStyle: CutStyle, inside: RgbColor | undefined, outside: RgbColor | undefined, intersectionStyle: ClipIntersectionStyle | undefined) {\n this.produceCutGeometry = produceCutGeometry;\n this.colorizeIntersection = colorizeIntersection;\n this.cutStyle = cutStyle;\n this.insideColor = inside;\n this.outsideColor = outside;\n this.intersectionStyle = intersectionStyle;\n }\n\n /** @deprecated in 4.x. Use [[create(style: ClipStyleCreateArgs]] */\n public static create(produceCutGeometry: boolean, cutStyle: CutStyle, insideColor?: RgbColor, outsideColor?: RgbColor): ClipStyle;\n\n /** Create a style from its components. */\n public static create(style: ClipStyleCreateArgs): ClipStyle;\n\n /** @internal */\n public static create(styleOrProduceCutGeometry: ClipStyleCreateArgs | boolean, cutStyle?: CutStyle, insideColor?: RgbColor, outsideColor?: RgbColor): ClipStyle {\n\n if (typeof styleOrProduceCutGeometry === \"boolean\") {\n cutStyle = cutStyle === undefined ? CutStyle.defaults : cutStyle;\n\n if (!styleOrProduceCutGeometry && cutStyle.matchesDefaults && !insideColor && !outsideColor) {\n return this.defaults;\n }\n\n return new ClipStyle(styleOrProduceCutGeometry, false, cutStyle, insideColor, outsideColor, undefined);\n }\n\n const style = styleOrProduceCutGeometry;\n if (!style.produceCutGeometry && !style.colorizeIntersection && (!style.cutStyle || style.cutStyle.matchesDefaults) && !style.insideColor && !style.outsideColor && !style.intersectionStyle)\n return this.defaults;\n\n const produceCutGeometry = style.produceCutGeometry ? true : false;\n const colorizeIntersection = style.colorizeIntersection ? true : false;\n cutStyle = style.cutStyle === undefined ? CutStyle.defaults : style.cutStyle;\n\n return new ClipStyle(produceCutGeometry, colorizeIntersection, cutStyle, style.insideColor, style.outsideColor, style.intersectionStyle);\n }\n\n public static fromJSON(props?: ClipStyleProps): ClipStyle {\n if (JsonUtils.isNonEmptyObject(props)) {\n const produceCutGeometry = props.produceCutGeometry ?? false;\n const colorizeIntersection = props.colorizeIntersection ? true : false;\n const cutStyle = CutStyle.fromJSON(props.cutStyle);\n const insideColor = props.insideColor ? RgbColor.fromJSON(props.insideColor) : undefined;\n const outsideColor = props.outsideColor ? RgbColor.fromJSON(props.outsideColor) : undefined;\n const intersectionStyle = props.intersectionStyle ? ClipIntersectionStyle.fromJSON(props.intersectionStyle) : undefined;\n\n return this.create({produceCutGeometry, colorizeIntersection, cutStyle, insideColor, outsideColor, intersectionStyle});\n }\n\n return this.defaults;\n }\n\n /** The JSON representation of this style. It is `undefined` if this style matches the defaults. */\n public toJSON(): ClipStyleProps | undefined {\n if (this.matchesDefaults)\n return undefined;\n\n const props: ClipStyleProps = {};\n if (this.produceCutGeometry)\n props.produceCutGeometry = true;\n\n if (this.colorizeIntersection)\n props.colorizeIntersection = true;\n\n const cutStyle = this.cutStyle.toJSON();\n if (cutStyle) {\n assert(!this.cutStyle.matchesDefaults);\n props.cutStyle = cutStyle;\n }\n\n if (this.insideColor)\n props.insideColor = this.insideColor.toJSON();\n\n if (this.outsideColor)\n props.outsideColor = this.outsideColor.toJSON();\n\n if (this.intersectionStyle)\n props.intersectionStyle = this.intersectionStyle.toJSON();\n\n return props;\n }\n\n /** Returns true if this style matches the [[ClipStyle.defaults]] - that is, it overrides no settings from the view. */\n public get matchesDefaults(): boolean {\n if (this === ClipStyle.defaults)\n return true;\n\n return !this.produceCutGeometry && !this.colorizeIntersection && !this.insideColor && !this.outsideColor && this.cutStyle.matchesDefaults && !this.intersectionStyle;\n }\n}\n"]}
@@ -552,15 +552,15 @@ export class ColorDef {
552
552
  equals(other) {
553
553
  return this._tbgr === other._tbgr;
554
554
  }
555
+ /** pure black */
556
+ static { this.black = new ColorDef(ColorByName.black); }
557
+ /** pure white */
558
+ static { this.white = new ColorDef(ColorByName.white); }
559
+ /** pure red */
560
+ static { this.red = new ColorDef(ColorByName.red); }
561
+ /** pure green */
562
+ static { this.green = new ColorDef(ColorByName.green); }
563
+ /** pure blue */
564
+ static { this.blue = new ColorDef(ColorByName.blue); }
555
565
  }
556
- /** pure black */
557
- ColorDef.black = new ColorDef(ColorByName.black);
558
- /** pure white */
559
- ColorDef.white = new ColorDef(ColorByName.white);
560
- /** pure red */
561
- ColorDef.red = new ColorDef(ColorByName.red);
562
- /** pure green */
563
- ColorDef.green = new ColorDef(ColorByName.green);
564
- /** pure blue */
565
- ColorDef.blue = new ColorDef(ColorByName.blue);
566
566
  //# sourceMappingURL=ColorDef.js.map