@itwin/core-common 5.0.0-dev.4 → 5.0.0-dev.40

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 (270) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/lib/cjs/AmbientOcclusion.js +9 -9
  3. package/lib/cjs/AmbientOcclusion.js.map +1 -1
  4. package/lib/cjs/AnalysisStyle.js +1 -1
  5. package/lib/cjs/AnalysisStyle.js.map +1 -1
  6. package/lib/cjs/Atmosphere.js +19 -21
  7. package/lib/cjs/Atmosphere.js.map +1 -1
  8. package/lib/cjs/BriefcaseTypes.d.ts +2 -2
  9. package/lib/cjs/BriefcaseTypes.d.ts.map +1 -1
  10. package/lib/cjs/BriefcaseTypes.js.map +1 -1
  11. package/lib/cjs/ClipStyle.js +5 -5
  12. package/lib/cjs/ClipStyle.js.map +1 -1
  13. package/lib/cjs/ColorDef.js +10 -10
  14. package/lib/cjs/ColorDef.js.map +1 -1
  15. package/lib/cjs/ConcurrentQuery.d.ts +5 -1
  16. package/lib/cjs/ConcurrentQuery.d.ts.map +1 -1
  17. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  18. package/lib/cjs/ContourDisplay.js +5 -5
  19. package/lib/cjs/ContourDisplay.js.map +1 -1
  20. package/lib/cjs/ECSqlReader.d.ts.map +1 -1
  21. package/lib/cjs/ECSqlReader.js +3 -1
  22. package/lib/cjs/ECSqlReader.js.map +1 -1
  23. package/lib/cjs/ElementProps.d.ts.map +1 -1
  24. package/lib/cjs/ElementProps.js +3 -3
  25. package/lib/cjs/ElementProps.js.map +1 -1
  26. package/lib/cjs/Environment.js +2 -2
  27. package/lib/cjs/Environment.js.map +1 -1
  28. package/lib/cjs/FeatureSymbology.js +3 -3
  29. package/lib/cjs/FeatureSymbology.js.map +1 -1
  30. package/lib/cjs/Fonts.d.ts +69 -11
  31. package/lib/cjs/Fonts.d.ts.map +1 -1
  32. package/lib/cjs/Fonts.js +20 -5
  33. package/lib/cjs/Fonts.js.map +1 -1
  34. package/lib/cjs/Gradient.js +9 -9
  35. package/lib/cjs/Gradient.js.map +1 -1
  36. package/lib/cjs/GroundPlane.js +2 -2
  37. package/lib/cjs/GroundPlane.js.map +1 -1
  38. package/lib/cjs/HiddenLine.js +4 -4
  39. package/lib/cjs/HiddenLine.js.map +1 -1
  40. package/lib/cjs/IModel.d.ts +3 -12
  41. package/lib/cjs/IModel.d.ts.map +1 -1
  42. package/lib/cjs/IModel.js +6 -6
  43. package/lib/cjs/IModel.js.map +1 -1
  44. package/lib/cjs/IModelError.d.ts +0 -2
  45. package/lib/cjs/IModelError.d.ts.map +1 -1
  46. package/lib/cjs/IModelError.js +1 -8
  47. package/lib/cjs/IModelError.js.map +1 -1
  48. package/lib/cjs/ITwinError.d.ts +1 -1
  49. package/lib/cjs/ITwinError.d.ts.map +1 -1
  50. package/lib/cjs/ITwinError.js +1 -1
  51. package/lib/cjs/ITwinError.js.map +1 -1
  52. package/lib/cjs/LightSettings.js +1 -1
  53. package/lib/cjs/LightSettings.js.map +1 -1
  54. package/lib/cjs/PlanarClipMask.js +2 -2
  55. package/lib/cjs/PlanarClipMask.js.map +1 -1
  56. package/lib/cjs/RealityModelDisplaySettings.js +4 -4
  57. package/lib/cjs/RealityModelDisplaySettings.js.map +1 -1
  58. package/lib/cjs/RenderMaterial.js +3 -3
  59. package/lib/cjs/RenderMaterial.js.map +1 -1
  60. package/lib/cjs/RpcInterface.js +1 -1
  61. package/lib/cjs/RpcInterface.js.map +1 -1
  62. package/lib/cjs/SkyBox.js +4 -4
  63. package/lib/cjs/SkyBox.js.map +1 -1
  64. package/lib/cjs/SolarShadows.js +1 -1
  65. package/lib/cjs/SolarShadows.js.map +1 -1
  66. package/lib/cjs/SubCategoryAppearance.js +1 -1
  67. package/lib/cjs/SubCategoryAppearance.js.map +1 -1
  68. package/lib/cjs/SubCategoryOverride.js +2 -2
  69. package/lib/cjs/SubCategoryOverride.js.map +1 -1
  70. package/lib/cjs/TextureMapping.js +2 -2
  71. package/lib/cjs/TextureMapping.js.map +1 -1
  72. package/lib/cjs/ThematicDisplay.js +2 -2
  73. package/lib/cjs/ThematicDisplay.js.map +1 -1
  74. package/lib/cjs/ViewDetails.js +2 -2
  75. package/lib/cjs/ViewDetails.js.map +1 -1
  76. package/lib/cjs/ViewFlags.js +2 -2
  77. package/lib/cjs/ViewFlags.js.map +1 -1
  78. package/lib/cjs/WhiteOnWhiteReversalSettings.js +2 -2
  79. package/lib/cjs/WhiteOnWhiteReversalSettings.js.map +1 -1
  80. package/lib/cjs/annotation/TextStyle.js +19 -19
  81. package/lib/cjs/annotation/TextStyle.js.map +1 -1
  82. package/lib/cjs/core-common.d.ts +0 -1
  83. package/lib/cjs/core-common.d.ts.map +1 -1
  84. package/lib/cjs/core-common.js +0 -1
  85. package/lib/cjs/core-common.js.map +1 -1
  86. package/lib/cjs/geometry/Cartographic.js +13 -13
  87. package/lib/cjs/geometry/Cartographic.js.map +1 -1
  88. package/lib/cjs/ipc/IpcWebSocket.js +1 -1
  89. package/lib/cjs/ipc/IpcWebSocket.js.map +1 -1
  90. package/lib/cjs/ipc/IpcWebSocketTransport.js +1 -1
  91. package/lib/cjs/ipc/IpcWebSocketTransport.js.map +1 -1
  92. package/lib/cjs/rpc/DevToolsRpcInterface.js +6 -6
  93. package/lib/cjs/rpc/DevToolsRpcInterface.js.map +1 -1
  94. package/lib/cjs/rpc/IModelReadRpcInterface.js +5 -5
  95. package/lib/cjs/rpc/IModelReadRpcInterface.js.map +1 -1
  96. package/lib/cjs/rpc/IModelTileRpcInterface.js +4 -4
  97. package/lib/cjs/rpc/IModelTileRpcInterface.js.map +1 -1
  98. package/lib/cjs/rpc/SnapshotIModelRpcInterface.js +4 -4
  99. package/lib/cjs/rpc/SnapshotIModelRpcInterface.js.map +1 -1
  100. package/lib/cjs/rpc/core/RpcConfiguration.js +32 -34
  101. package/lib/cjs/rpc/core/RpcConfiguration.js.map +1 -1
  102. package/lib/cjs/rpc/core/RpcControl.js +8 -15
  103. package/lib/cjs/rpc/core/RpcControl.js.map +1 -1
  104. package/lib/cjs/rpc/core/RpcInvocation.js +3 -5
  105. package/lib/cjs/rpc/core/RpcInvocation.js.map +1 -1
  106. package/lib/cjs/rpc/core/RpcMarshaling.d.ts +0 -3
  107. package/lib/cjs/rpc/core/RpcMarshaling.d.ts.map +1 -1
  108. package/lib/cjs/rpc/core/RpcMarshaling.js +5 -4
  109. package/lib/cjs/rpc/core/RpcMarshaling.js.map +1 -1
  110. package/lib/cjs/rpc/core/RpcOperation.js +2 -2
  111. package/lib/cjs/rpc/core/RpcOperation.js.map +1 -1
  112. package/lib/cjs/rpc/core/RpcProtocol.js +4 -4
  113. package/lib/cjs/rpc/core/RpcProtocol.js.map +1 -1
  114. package/lib/cjs/rpc/core/RpcPush.js +5 -5
  115. package/lib/cjs/rpc/core/RpcPush.js.map +1 -1
  116. package/lib/cjs/rpc/core/RpcRequest.js +5 -5
  117. package/lib/cjs/rpc/core/RpcRequest.js.map +1 -1
  118. package/lib/cjs/rpc/core/RpcRoutingToken.js +2 -2
  119. package/lib/cjs/rpc/core/RpcRoutingToken.js.map +1 -1
  120. package/lib/cjs/rpc/core/RpcSessionInvocation.js +1 -1
  121. package/lib/cjs/rpc/core/RpcSessionInvocation.js.map +1 -1
  122. package/lib/cjs/rpc/web/BentleyCloudRpcManager.js +6 -6
  123. package/lib/cjs/rpc/web/BentleyCloudRpcManager.js.map +1 -1
  124. package/lib/cjs/rpc/web/RpcMultipart.d.ts.map +1 -1
  125. package/lib/cjs/rpc/web/RpcMultipart.js +13 -12
  126. package/lib/cjs/rpc/web/RpcMultipart.js.map +1 -1
  127. package/lib/cjs/rpc/web/WebAppRpcRequest.js +17 -19
  128. package/lib/cjs/rpc/web/WebAppRpcRequest.js.map +1 -1
  129. package/lib/cjs/tile/IModelTileIO.d.ts +2 -2
  130. package/lib/cjs/tile/IModelTileIO.js +3 -3
  131. package/lib/cjs/tile/IModelTileIO.js.map +1 -1
  132. package/lib/esm/AmbientOcclusion.js +9 -9
  133. package/lib/esm/AmbientOcclusion.js.map +1 -1
  134. package/lib/esm/AnalysisStyle.js +1 -1
  135. package/lib/esm/AnalysisStyle.js.map +1 -1
  136. package/lib/esm/Atmosphere.js +19 -21
  137. package/lib/esm/Atmosphere.js.map +1 -1
  138. package/lib/esm/BriefcaseTypes.d.ts +2 -2
  139. package/lib/esm/BriefcaseTypes.d.ts.map +1 -1
  140. package/lib/esm/BriefcaseTypes.js.map +1 -1
  141. package/lib/esm/ClipStyle.js +5 -5
  142. package/lib/esm/ClipStyle.js.map +1 -1
  143. package/lib/esm/ColorDef.js +10 -10
  144. package/lib/esm/ColorDef.js.map +1 -1
  145. package/lib/esm/ConcurrentQuery.d.ts +5 -1
  146. package/lib/esm/ConcurrentQuery.d.ts.map +1 -1
  147. package/lib/esm/ConcurrentQuery.js.map +1 -1
  148. package/lib/esm/ContourDisplay.js +5 -5
  149. package/lib/esm/ContourDisplay.js.map +1 -1
  150. package/lib/esm/ECSqlReader.d.ts.map +1 -1
  151. package/lib/esm/ECSqlReader.js +3 -1
  152. package/lib/esm/ECSqlReader.js.map +1 -1
  153. package/lib/esm/ElementProps.d.ts.map +1 -1
  154. package/lib/esm/ElementProps.js +4 -4
  155. package/lib/esm/ElementProps.js.map +1 -1
  156. package/lib/esm/Environment.js +2 -2
  157. package/lib/esm/Environment.js.map +1 -1
  158. package/lib/esm/FeatureSymbology.js +3 -3
  159. package/lib/esm/FeatureSymbology.js.map +1 -1
  160. package/lib/esm/Fonts.d.ts +69 -11
  161. package/lib/esm/Fonts.d.ts.map +1 -1
  162. package/lib/esm/Fonts.js +20 -5
  163. package/lib/esm/Fonts.js.map +1 -1
  164. package/lib/esm/Gradient.js +9 -9
  165. package/lib/esm/Gradient.js.map +1 -1
  166. package/lib/esm/GroundPlane.js +2 -2
  167. package/lib/esm/GroundPlane.js.map +1 -1
  168. package/lib/esm/HiddenLine.js +4 -4
  169. package/lib/esm/HiddenLine.js.map +1 -1
  170. package/lib/esm/IModel.d.ts +3 -12
  171. package/lib/esm/IModel.d.ts.map +1 -1
  172. package/lib/esm/IModel.js +6 -6
  173. package/lib/esm/IModel.js.map +1 -1
  174. package/lib/esm/IModelError.d.ts +0 -2
  175. package/lib/esm/IModelError.d.ts.map +1 -1
  176. package/lib/esm/IModelError.js +0 -1
  177. package/lib/esm/IModelError.js.map +1 -1
  178. package/lib/esm/ITwinError.d.ts +1 -1
  179. package/lib/esm/ITwinError.d.ts.map +1 -1
  180. package/lib/esm/ITwinError.js +1 -1
  181. package/lib/esm/ITwinError.js.map +1 -1
  182. package/lib/esm/LightSettings.js +1 -1
  183. package/lib/esm/LightSettings.js.map +1 -1
  184. package/lib/esm/PlanarClipMask.js +2 -2
  185. package/lib/esm/PlanarClipMask.js.map +1 -1
  186. package/lib/esm/RealityModelDisplaySettings.js +4 -4
  187. package/lib/esm/RealityModelDisplaySettings.js.map +1 -1
  188. package/lib/esm/RenderMaterial.js +3 -3
  189. package/lib/esm/RenderMaterial.js.map +1 -1
  190. package/lib/esm/RpcInterface.js +2 -2
  191. package/lib/esm/RpcInterface.js.map +1 -1
  192. package/lib/esm/SkyBox.js +4 -4
  193. package/lib/esm/SkyBox.js.map +1 -1
  194. package/lib/esm/SolarShadows.js +1 -1
  195. package/lib/esm/SolarShadows.js.map +1 -1
  196. package/lib/esm/SubCategoryAppearance.js +1 -1
  197. package/lib/esm/SubCategoryAppearance.js.map +1 -1
  198. package/lib/esm/SubCategoryOverride.js +2 -2
  199. package/lib/esm/SubCategoryOverride.js.map +1 -1
  200. package/lib/esm/TextureMapping.js +2 -2
  201. package/lib/esm/TextureMapping.js.map +1 -1
  202. package/lib/esm/ThematicDisplay.js +2 -2
  203. package/lib/esm/ThematicDisplay.js.map +1 -1
  204. package/lib/esm/ViewDetails.js +2 -2
  205. package/lib/esm/ViewDetails.js.map +1 -1
  206. package/lib/esm/ViewFlags.js +2 -2
  207. package/lib/esm/ViewFlags.js.map +1 -1
  208. package/lib/esm/WhiteOnWhiteReversalSettings.js +2 -2
  209. package/lib/esm/WhiteOnWhiteReversalSettings.js.map +1 -1
  210. package/lib/esm/annotation/TextStyle.js +19 -19
  211. package/lib/esm/annotation/TextStyle.js.map +1 -1
  212. package/lib/esm/core-common.d.ts +0 -1
  213. package/lib/esm/core-common.d.ts.map +1 -1
  214. package/lib/esm/core-common.js +0 -1
  215. package/lib/esm/core-common.js.map +1 -1
  216. package/lib/esm/geometry/Cartographic.js +13 -13
  217. package/lib/esm/geometry/Cartographic.js.map +1 -1
  218. package/lib/esm/ipc/IpcWebSocket.js +1 -1
  219. package/lib/esm/ipc/IpcWebSocket.js.map +1 -1
  220. package/lib/esm/ipc/IpcWebSocketTransport.js +1 -1
  221. package/lib/esm/ipc/IpcWebSocketTransport.js.map +1 -1
  222. package/lib/esm/rpc/DevToolsRpcInterface.js +6 -6
  223. package/lib/esm/rpc/DevToolsRpcInterface.js.map +1 -1
  224. package/lib/esm/rpc/IModelReadRpcInterface.js +5 -5
  225. package/lib/esm/rpc/IModelReadRpcInterface.js.map +1 -1
  226. package/lib/esm/rpc/IModelTileRpcInterface.js +4 -4
  227. package/lib/esm/rpc/IModelTileRpcInterface.js.map +1 -1
  228. package/lib/esm/rpc/SnapshotIModelRpcInterface.js +4 -4
  229. package/lib/esm/rpc/SnapshotIModelRpcInterface.js.map +1 -1
  230. package/lib/esm/rpc/core/RpcConfiguration.js +32 -34
  231. package/lib/esm/rpc/core/RpcConfiguration.js.map +1 -1
  232. package/lib/esm/rpc/core/RpcControl.js +8 -15
  233. package/lib/esm/rpc/core/RpcControl.js.map +1 -1
  234. package/lib/esm/rpc/core/RpcInvocation.js +3 -5
  235. package/lib/esm/rpc/core/RpcInvocation.js.map +1 -1
  236. package/lib/esm/rpc/core/RpcMarshaling.d.ts +0 -3
  237. package/lib/esm/rpc/core/RpcMarshaling.d.ts.map +1 -1
  238. package/lib/esm/rpc/core/RpcMarshaling.js +2 -1
  239. package/lib/esm/rpc/core/RpcMarshaling.js.map +1 -1
  240. package/lib/esm/rpc/core/RpcOperation.js +2 -2
  241. package/lib/esm/rpc/core/RpcOperation.js.map +1 -1
  242. package/lib/esm/rpc/core/RpcProtocol.js +4 -4
  243. package/lib/esm/rpc/core/RpcProtocol.js.map +1 -1
  244. package/lib/esm/rpc/core/RpcPush.js +5 -5
  245. package/lib/esm/rpc/core/RpcPush.js.map +1 -1
  246. package/lib/esm/rpc/core/RpcRequest.js +5 -5
  247. package/lib/esm/rpc/core/RpcRequest.js.map +1 -1
  248. package/lib/esm/rpc/core/RpcRoutingToken.js +2 -2
  249. package/lib/esm/rpc/core/RpcRoutingToken.js.map +1 -1
  250. package/lib/esm/rpc/core/RpcSessionInvocation.js +1 -1
  251. package/lib/esm/rpc/core/RpcSessionInvocation.js.map +1 -1
  252. package/lib/esm/rpc/web/BentleyCloudRpcManager.js +6 -6
  253. package/lib/esm/rpc/web/BentleyCloudRpcManager.js.map +1 -1
  254. package/lib/esm/rpc/web/RpcMultipart.d.ts.map +1 -1
  255. package/lib/esm/rpc/web/RpcMultipart.js +14 -13
  256. package/lib/esm/rpc/web/RpcMultipart.js.map +1 -1
  257. package/lib/esm/rpc/web/WebAppRpcRequest.js +17 -19
  258. package/lib/esm/rpc/web/WebAppRpcRequest.js.map +1 -1
  259. package/lib/esm/tile/IModelTileIO.d.ts +2 -2
  260. package/lib/esm/tile/IModelTileIO.js +3 -3
  261. package/lib/esm/tile/IModelTileIO.js.map +1 -1
  262. package/package.json +9 -9
  263. package/lib/cjs/rpc/WipRpcInterface.d.ts +0 -31
  264. package/lib/cjs/rpc/WipRpcInterface.d.ts.map +0 -1
  265. package/lib/cjs/rpc/WipRpcInterface.js +0 -42
  266. package/lib/cjs/rpc/WipRpcInterface.js.map +0 -1
  267. package/lib/esm/rpc/WipRpcInterface.d.ts +0 -31
  268. package/lib/esm/rpc/WipRpcInterface.d.ts.map +0 -1
  269. package/lib/esm/rpc/WipRpcInterface.js +0 -38
  270. package/lib/esm/rpc/WipR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AI,EAAE,eAAe,CAAC,IAAI;YAC1B,QAAQ,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE;SAC7B,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,gBAAgB;IAChB,IAAoB,UAAU;QAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAClH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module DisplayStyles\n */\n\nimport { Id64, Id64String, NonFunctionPropertiesOf } from \"@itwin/core-bentley\";\nimport { ColorDef, ColorDefProps } from \"./ColorDef\";\nimport { TextureImageSpec } from \"./RenderTexture\";\n\n/** Supported types of [[SkyBox]] images.\n * @see [[SkyBoxImageProps]].\n * @public\n * @extensions\n */\nexport enum SkyBoxImageType {\n /** No image, indicating a [[SkyGradient]] should be displayed. */\n None = 0,\n /** A single image mapped to the surface of a sphere.\n * @see [[SkySphere]].\n */\n Spherical = 1,\n /** @internal not yet supported */\n Cylindrical = 2,\n /** Six images mapped to the faces of a cube.\n * @see [[SkyCube]].\n */\n Cube = 3,\n}\n\n/** JSON representation of the six images used by a [[SkyCube]].\n * Each property specifies the image for a face of the cube as either an image URL, or the Id of a [Texture]($backend) element.\n * Each image must be square and have the same dimensions as all the other images.\n * @public\n * @extensions\n */\nexport interface SkyCubeProps {\n front: TextureImageSpec;\n back: TextureImageSpec;\n top: TextureImageSpec;\n bottom: TextureImageSpec;\n right: TextureImageSpec;\n left: TextureImageSpec;\n}\n\n/** JSON representation of the image used for a [[SkySphere]].\n * @see [[SkyBoxProps.image]].\n * @public\n */\nexport interface SkySphereImageProps {\n type: SkyBoxImageType.Spherical;\n texture: TextureImageSpec;\n /** @internal */\n textures?: never;\n}\n\n/** JSON representation of the images used for a [[SkyCube]].\n * @see [[SkyBoxProps.image]].\n * @public\n */\nexport interface SkyCubeImageProps {\n type: SkyBoxImageType.Cube;\n textures: SkyCubeProps;\n /** @internal */\n texture?: never;\n}\n\n/** JSON representation of the image(s) to be mapped to the surfaces of a [[SkyBox]].\n * @see [[SkyBoxProps.image]].\n * @public\n * @extensions\n */\nexport type SkyBoxImageProps = SkySphereImageProps | SkyCubeImageProps | { type?: SkyBoxImageType, texture?: never, textures?: never };\n\n/** JSON representation of a [[SkyBox]] that can be drawn as the background of a [ViewState3d]($frontend).\n * An object of this type can describe one of several types of sky box:\n * - A cube with a texture image mapped to each face; or\n * - A sphere with a single texture image mapped to its surface; or\n * - A sphere with a two- or four-color vertical [[Gradient]] mapped to its surface.\n *\n * Whether cuboid or spherical, the skybox is drawn as if the viewer and the contents of the view are contained within its interior.\n *\n * For a two-color gradient, the gradient transitions smoothly from the nadir color at the bottom of the sphere to the zenith color at the top of the sphere.\n * The sky and ground colors are unused, as are the sky and ground exponents.\n *\n * For a four-color gradient, a \"horizon\" is produced on the equator of the sphere, where the ground color and sky color meet. The lower half of the sphere transitions\n * smoothly from the ground color at the equator to the nadir color at the bottom, and the upper half transitions from the sky color at the equator to the zenith color at\n * the top of the sphere.\n *\n * The color and exponent properties are unused if one or more texture images are supplied.\n *\n * The skybox is ignored entirely when an atmosphere is displayed.\n *\n * @see [[DisplayStyle3dSettings.environment]] to define the skybox for a display style.\n * @public\n * @extensions\n */\nexport interface SkyBoxProps {\n /** Whether or not the skybox should be displayed.\n * Default: false.\n */\n display?: boolean;\n /** For a [[SkyGradient]], if true, a 2-color gradient skybox is used instead of a 4-color.\n * Default: false.\n */\n twoColor?: boolean;\n /** The color of the sky at the horizon. Unused unless this is a four-color [[SkyGradient]].\n * Default: (143, 205, 255).\n */\n skyColor?: ColorDefProps;\n /** The color of the ground at the horizon. Unused unless this is a four-color [[SkyGradient]].\n * Default: (120, 143, 125).\n */\n groundColor?: ColorDefProps;\n /** The color of the top of the sphere.\n * Default: (54, 117, 255).\n */\n zenithColor?: ColorDefProps;\n /** The color of the bottom of the sphere.\n * Default: (40, 15, 0).\n */\n nadirColor?: ColorDefProps;\n /** For a 4-color [[SkyGradient]], controls speed of change from sky color to zenith color; otherwise unused.\n * Default: 4.0.\n */\n skyExponent?: number;\n /** For a 4-color [[SkyGradient]], controls speed of change from ground color to nadir color; otherwise unused.\n * Default: 4.0.\n */\n groundExponent?: number;\n /** The image(s), if any, to be mapped to the surfaces of the sphere or cube. If undefined, the skybox will be displayed as a gradient instead.\n * Default: undefined.\n */\n image?: SkyBoxImageProps;\n}\n\nconst defaultGroundColor = ColorDef.from(143, 205, 125);\nconst defaultZenithColor = ColorDef.from(54, 117, 255);\nconst defaultNadirColor = ColorDef.from(40, 125, 0);\nconst defaultSkyColor = ColorDef.from(142, 205, 255);\nconst defaultExponent = 4.0;\n\nfunction colorDefFromJson(props?: ColorDefProps): ColorDef | undefined {\n return undefined !== props ? ColorDef.fromJSON(props) : undefined;\n}\n\n/** A type containing all of the properties and none of the methods of [[SkyGradient]] with `readonly` modifiers removed.\n * @see [[SkyGradient.create]] and [[SkyGradient.clone]].\n * @public\n */\nexport type SkyGradientProperties = NonFunctionPropertiesOf<SkyGradient>;\n\n/** Describes how to map a two- or four-color [[Gradient]] to the interior of a sphere to produce a [[SkyBox]].\n * @see [[SkyBox.gradient]].\n * @public\n */\nexport class SkyGradient {\n public readonly twoColor: boolean;\n public readonly skyColor: ColorDef;\n public readonly groundColor: ColorDef;\n public readonly zenithColor: ColorDef;\n public readonly nadirColor: ColorDef;\n public readonly skyExponent: number;\n public readonly groundExponent: number;\n\n private constructor(args: Partial<SkyGradientProperties>) {\n this.twoColor = args.twoColor ?? false;\n this.skyColor = args.skyColor ?? defaultSkyColor;\n this.groundColor = args.groundColor ?? defaultGroundColor;\n this.nadirColor = args.nadirColor ?? defaultNadirColor;\n this.zenithColor = args.zenithColor ?? defaultZenithColor;\n this.skyExponent = args.skyExponent ?? defaultExponent;\n this.groundExponent = args.groundExponent ?? defaultExponent;\n }\n\n /** Default settings for a four-color gradient. */\n public static readonly defaults = new SkyGradient({});\n\n /** Create a new gradient. Any properties not specified by `props` are initialized to their default values. */\n public static create(props?: Partial<SkyGradientProperties>): SkyGradient {\n return props ? new this(props) : this.defaults;\n }\n\n /** Create from JSON representation. */\n public static fromJSON(props?: SkyBoxProps): SkyGradient {\n if (!props)\n return this.defaults;\n\n return new this({\n twoColor: props.twoColor,\n skyExponent: props.skyExponent,\n groundExponent: props.groundExponent,\n skyColor: colorDefFromJson(props.skyColor),\n groundColor: colorDefFromJson(props.groundColor),\n nadirColor: colorDefFromJson(props.nadirColor),\n zenithColor: colorDefFromJson(props.zenithColor),\n });\n }\n\n /** Create ea copy of this gradient, identical except for any properties explicitly specified by `changedProps`.\n * Any properties of `changedProps` explicitly set to `undefined` will be reset to their default values.\n */\n public clone(changedProps: SkyGradientProperties): SkyGradient {\n return new SkyGradient({ ...this, ...changedProps });\n }\n\n /** Convert to JSON representation. */\n public toJSON(): SkyBoxProps {\n const props: SkyBoxProps = {\n skyColor: this.skyColor.toJSON(),\n groundColor: this.groundColor.toJSON(),\n nadirColor: this.nadirColor.toJSON(),\n zenithColor: this.zenithColor.toJSON(),\n };\n\n if (this.groundExponent !== defaultExponent)\n props.groundExponent = this.groundExponent;\n\n if (this.skyExponent !== defaultExponent)\n props.skyExponent = this.skyExponent;\n\n if (this.twoColor)\n props.twoColor = this.twoColor;\n\n return props;\n }\n\n /** Returns true if this gradient is equivalent to the supplied gradient. */\n public equals(other: SkyGradient): boolean {\n if (this === other)\n return true;\n\n return this.twoColor === other.twoColor && this.skyColor.equals(other.skyColor) && this.groundColor.equals(other.groundColor) &&\n this.zenithColor.equals(other.zenithColor) && this.nadirColor.equals(other.nadirColor);\n }\n}\n\n/** Describes how to draw a representation of a sky, as part of an [[Environment]].\n * @see [[SkyBoxProps]].\n * @public\n */\nexport class SkyBox {\n /** The gradient settings, used if no cube or sphere images are supplied, or if the images cannot be loaded. */\n public readonly gradient: SkyGradient;\n\n protected constructor(gradient: SkyGradient) {\n this.gradient = gradient;\n }\n\n /** Default settings for a four-color gradient. */\n public static readonly defaults = new SkyBox(SkyGradient.defaults);\n\n /** Create a skybox that displays the specified gradient, or the default gradient if none is supplied. */\n public static createGradient(gradient?: SkyGradient): SkyBox {\n return gradient ? new this(gradient) : this.defaults;\n }\n\n /** Create from JSON representation. */\n public static fromJSON(props?: SkyBoxProps): SkyBox {\n const gradient = SkyGradient.fromJSON(props);\n\n if (props?.image) {\n switch (props.image.type) {\n case SkyBoxImageType.Spherical:\n if (undefined !== props.image.texture)\n return new SkySphere(props.image.texture, gradient);\n\n break;\n case SkyBoxImageType.Cube: {\n const tx = props.image.textures;\n if (tx && undefined !== tx.top && undefined !== tx.bottom && undefined !== tx.right && undefined !== tx.left && undefined !== tx.front && undefined !== tx.back)\n return new SkyCube(tx, gradient);\n\n break;\n }\n }\n }\n\n return this.createGradient(gradient);\n }\n\n /** Convert to JSON representation.\n * @param display If defined, the value to use for [[SkyBoxProps.display]]; otherwise, that property will be left undefined.\n */\n public toJSON(display?: boolean): SkyBoxProps {\n const props = this.gradient.toJSON();\n if (undefined !== display)\n props.display = display;\n\n return props;\n }\n\n /** @internal */\n public get textureIds(): Iterable<Id64String> {\n return [];\n }\n}\n\n/** Describes how to draw a representation of a sky by mapping a single image to the interior of a sphere.\n * @public\n */\nexport class SkySphere extends SkyBox {\n /** The image to map to the interior of the sphere. */\n public readonly image: TextureImageSpec;\n\n /** Create a new sky sphere using the specified image.\n * @param image The image to map to the interior of the sphere.\n * @param gradient Optionally overrides the default gradient settings used if the image cannot be obtained.\n */\n public constructor(image: TextureImageSpec, gradient?: SkyGradient) {\n super(gradient ?? SkyGradient.defaults);\n this.image = image;\n }\n\n /** See [[SkyBox.toJSON]]. */\n public override toJSON(display?: boolean): SkyBoxProps {\n const props = super.toJSON(display);\n props.image = {\n type: SkyBoxImageType.Spherical,\n texture: this.image,\n };\n\n return props;\n }\n\n /** @internal */\n public override get textureIds(): Iterable<Id64String> {\n return Id64.isValidId64(this.image) ? [this.image] : [];\n }\n}\n\n/** Describes how to draw a representation of a sky by mapping images to the interior faces of a cube.\n * The images are required to be *square*, and each image must have the same dimensions as the other images.\n * @public\n */\nexport class SkyCube extends SkyBox {\n /** The images to map to each face of the cube. */\n public readonly images: SkyCubeProps;\n\n /** Create a new sky cube using the specified images.\n * @param images The images to map to each face of the cube.\n * @param gradient Optionally overrides the default gradient settings used if the images cannot be obtained.\n */\n public constructor(images: SkyCubeProps, gradient?: SkyGradient) {\n super(gradient ?? SkyGradient.defaults);\n this.images = { ...images };\n }\n\n /** See [[SkyBox.toJSON]]. */\n public override toJSON(display?: boolean): SkyBoxProps {\n const props = super.toJSON(display);\n props.image = {\n type: SkyBoxImageType.Cube,\n textures: { ...this.images },\n };\n\n return props;\n }\n\n /** @internal */\n public override get textureIds(): Iterable<Id64String> {\n const imgs = this.images;\n return [imgs.front, imgs.back, imgs.top, imgs.bottom, imgs.left, imgs.right].filter((x) => Id64.isValidId64(x));\n }\n}\n"]}
1
+ {"version":3,"file":"SkyBox.js","sourceRoot":"","sources":["../../src/SkyBox.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAuC,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AAGrD;;;;GAIG;AACH,MAAM,CAAN,IAAY,eAaX;AAbD,WAAY,eAAe;IACzB,kEAAkE;IAClE,qDAAQ,CAAA;IACR;;OAEG;IACH,+DAAa,CAAA;IACb,k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C,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAClH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module DisplayStyles\n */\n\nimport { Id64, Id64String, NonFunctionPropertiesOf } from \"@itwin/core-bentley\";\nimport { ColorDef, ColorDefProps } from \"./ColorDef\";\nimport { TextureImageSpec } from \"./RenderTexture\";\n\n/** Supported types of [[SkyBox]] images.\n * @see [[SkyBoxImageProps]].\n * @public\n * @extensions\n */\nexport enum SkyBoxImageType {\n /** No image, indicating a [[SkyGradient]] should be displayed. */\n None = 0,\n /** A single image mapped to the surface of a sphere.\n * @see [[SkySphere]].\n */\n Spherical = 1,\n /** @internal not yet supported */\n Cylindrical = 2,\n /** Six images mapped to the faces of a cube.\n * @see [[SkyCube]].\n */\n Cube = 3,\n}\n\n/** JSON representation of the six images used by a [[SkyCube]].\n * Each property specifies the image for a face of the cube as either an image URL, or the Id of a [Texture]($backend) element.\n * Each image must be square and have the same dimensions as all the other images.\n * @public\n * @extensions\n */\nexport interface SkyCubeProps {\n front: TextureImageSpec;\n back: TextureImageSpec;\n top: TextureImageSpec;\n bottom: TextureImageSpec;\n right: TextureImageSpec;\n left: TextureImageSpec;\n}\n\n/** JSON representation of the image used for a [[SkySphere]].\n * @see [[SkyBoxProps.image]].\n * @public\n */\nexport interface SkySphereImageProps {\n type: SkyBoxImageType.Spherical;\n texture: TextureImageSpec;\n /** @internal */\n textures?: never;\n}\n\n/** JSON representation of the images used for a [[SkyCube]].\n * @see [[SkyBoxProps.image]].\n * @public\n */\nexport interface SkyCubeImageProps {\n type: SkyBoxImageType.Cube;\n textures: SkyCubeProps;\n /** @internal */\n texture?: never;\n}\n\n/** JSON representation of the image(s) to be mapped to the surfaces of a [[SkyBox]].\n * @see [[SkyBoxProps.image]].\n * @public\n * @extensions\n */\nexport type SkyBoxImageProps = SkySphereImageProps | SkyCubeImageProps | { type?: SkyBoxImageType, texture?: never, textures?: never };\n\n/** JSON representation of a [[SkyBox]] that can be drawn as the background of a [ViewState3d]($frontend).\n * An object of this type can describe one of several types of sky box:\n * - A cube with a texture image mapped to each face; or\n * - A sphere with a single texture image mapped to its surface; or\n * - A sphere with a two- or four-color vertical [[Gradient]] mapped to its surface.\n *\n * Whether cuboid or spherical, the skybox is drawn as if the viewer and the contents of the view are contained within its interior.\n *\n * For a two-color gradient, the gradient transitions smoothly from the nadir color at the bottom of the sphere to the zenith color at the top of the sphere.\n * The sky and ground colors are unused, as are the sky and ground exponents.\n *\n * For a four-color gradient, a \"horizon\" is produced on the equator of the sphere, where the ground color and sky color meet. The lower half of the sphere transitions\n * smoothly from the ground color at the equator to the nadir color at the bottom, and the upper half transitions from the sky color at the equator to the zenith color at\n * the top of the sphere.\n *\n * The color and exponent properties are unused if one or more texture images are supplied.\n *\n * The skybox is ignored entirely when an atmosphere is displayed.\n *\n * @see [[DisplayStyle3dSettings.environment]] to define the skybox for a display style.\n * @public\n * @extensions\n */\nexport interface SkyBoxProps {\n /** Whether or not the skybox should be displayed.\n * Default: false.\n */\n display?: boolean;\n /** For a [[SkyGradient]], if true, a 2-color gradient skybox is used instead of a 4-color.\n * Default: false.\n */\n twoColor?: boolean;\n /** The color of the sky at the horizon. Unused unless this is a four-color [[SkyGradient]].\n * Default: (143, 205, 255).\n */\n skyColor?: ColorDefProps;\n /** The color of the ground at the horizon. Unused unless this is a four-color [[SkyGradient]].\n * Default: (120, 143, 125).\n */\n groundColor?: ColorDefProps;\n /** The color of the top of the sphere.\n * Default: (54, 117, 255).\n */\n zenithColor?: ColorDefProps;\n /** The color of the bottom of the sphere.\n * Default: (40, 15, 0).\n */\n nadirColor?: ColorDefProps;\n /** For a 4-color [[SkyGradient]], controls speed of change from sky color to zenith color; otherwise unused.\n * Default: 4.0.\n */\n skyExponent?: number;\n /** For a 4-color [[SkyGradient]], controls speed of change from ground color to nadir color; otherwise unused.\n * Default: 4.0.\n */\n groundExponent?: number;\n /** The image(s), if any, to be mapped to the surfaces of the sphere or cube. If undefined, the skybox will be displayed as a gradient instead.\n * Default: undefined.\n */\n image?: SkyBoxImageProps;\n}\n\nconst defaultGroundColor = ColorDef.from(143, 205, 125);\nconst defaultZenithColor = ColorDef.from(54, 117, 255);\nconst defaultNadirColor = ColorDef.from(40, 125, 0);\nconst defaultSkyColor = ColorDef.from(142, 205, 255);\nconst defaultExponent = 4.0;\n\nfunction colorDefFromJson(props?: ColorDefProps): ColorDef | undefined {\n return undefined !== props ? ColorDef.fromJSON(props) : undefined;\n}\n\n/** A type containing all of the properties and none of the methods of [[SkyGradient]] with `readonly` modifiers removed.\n * @see [[SkyGradient.create]] and [[SkyGradient.clone]].\n * @public\n */\nexport type SkyGradientProperties = NonFunctionPropertiesOf<SkyGradient>;\n\n/** Describes how to map a two- or four-color [[Gradient]] to the interior of a sphere to produce a [[SkyBox]].\n * @see [[SkyBox.gradient]].\n * @public\n */\nexport class SkyGradient {\n public readonly twoColor: boolean;\n public readonly skyColor: ColorDef;\n public readonly groundColor: ColorDef;\n public readonly zenithColor: ColorDef;\n public readonly nadirColor: ColorDef;\n public readonly skyExponent: number;\n public readonly groundExponent: number;\n\n private constructor(args: Partial<SkyGradientProperties>) {\n this.twoColor = args.twoColor ?? false;\n this.skyColor = args.skyColor ?? defaultSkyColor;\n this.groundColor = args.groundColor ?? defaultGroundColor;\n this.nadirColor = args.nadirColor ?? defaultNadirColor;\n this.zenithColor = args.zenithColor ?? defaultZenithColor;\n this.skyExponent = args.skyExponent ?? defaultExponent;\n this.groundExponent = args.groundExponent ?? defaultExponent;\n }\n\n /** Default settings for a four-color gradient. */\n public static readonly defaults = new SkyGradient({});\n\n /** Create a new gradient. Any properties not specified by `props` are initialized to their default values. */\n public static create(props?: Partial<SkyGradientProperties>): SkyGradient {\n return props ? new this(props) : this.defaults;\n }\n\n /** Create from JSON representation. */\n public static fromJSON(props?: SkyBoxProps): SkyGradient {\n if (!props)\n return this.defaults;\n\n return new this({\n twoColor: props.twoColor,\n skyExponent: props.skyExponent,\n groundExponent: props.groundExponent,\n skyColor: colorDefFromJson(props.skyColor),\n groundColor: colorDefFromJson(props.groundColor),\n nadirColor: colorDefFromJson(props.nadirColor),\n zenithColor: colorDefFromJson(props.zenithColor),\n });\n }\n\n /** Create ea copy of this gradient, identical except for any properties explicitly specified by `changedProps`.\n * Any properties of `changedProps` explicitly set to `undefined` will be reset to their default values.\n */\n public clone(changedProps: SkyGradientProperties): SkyGradient {\n return new SkyGradient({ ...this, ...changedProps });\n }\n\n /** Convert to JSON representation. */\n public toJSON(): SkyBoxProps {\n const props: SkyBoxProps = {\n skyColor: this.skyColor.toJSON(),\n groundColor: this.groundColor.toJSON(),\n nadirColor: this.nadirColor.toJSON(),\n zenithColor: this.zenithColor.toJSON(),\n };\n\n if (this.groundExponent !== defaultExponent)\n props.groundExponent = this.groundExponent;\n\n if (this.skyExponent !== defaultExponent)\n props.skyExponent = this.skyExponent;\n\n if (this.twoColor)\n props.twoColor = this.twoColor;\n\n return props;\n }\n\n /** Returns true if this gradient is equivalent to the supplied gradient. */\n public equals(other: SkyGradient): boolean {\n if (this === other)\n return true;\n\n return this.twoColor === other.twoColor && this.skyColor.equals(other.skyColor) && this.groundColor.equals(other.groundColor) &&\n this.zenithColor.equals(other.zenithColor) && this.nadirColor.equals(other.nadirColor);\n }\n}\n\n/** Describes how to draw a representation of a sky, as part of an [[Environment]].\n * @see [[SkyBoxProps]].\n * @public\n */\nexport class SkyBox {\n /** The gradient settings, used if no cube or sphere images are supplied, or if the images cannot be loaded. */\n public readonly gradient: SkyGradient;\n\n protected constructor(gradient: SkyGradient) {\n this.gradient = gradient;\n }\n\n /** Default settings for a four-color gradient. */\n public static readonly defaults = new SkyBox(SkyGradient.defaults);\n\n /** Create a skybox that displays the specified gradient, or the default gradient if none is supplied. */\n public static createGradient(gradient?: SkyGradient): SkyBox {\n return gradient ? new this(gradient) : this.defaults;\n }\n\n /** Create from JSON representation. */\n public static fromJSON(props?: SkyBoxProps): SkyBox {\n const gradient = SkyGradient.fromJSON(props);\n\n if (props?.image) {\n switch (props.image.type) {\n case SkyBoxImageType.Spherical:\n if (undefined !== props.image.texture)\n return new SkySphere(props.image.texture, gradient);\n\n break;\n case SkyBoxImageType.Cube: {\n const tx = props.image.textures;\n if (tx && undefined !== tx.top && undefined !== tx.bottom && undefined !== tx.right && undefined !== tx.left && undefined !== tx.front && undefined !== tx.back)\n return new SkyCube(tx, gradient);\n\n break;\n }\n }\n }\n\n return this.createGradient(gradient);\n }\n\n /** Convert to JSON representation.\n * @param display If defined, the value to use for [[SkyBoxProps.display]]; otherwise, that property will be left undefined.\n */\n public toJSON(display?: boolean): SkyBoxProps {\n const props = this.gradient.toJSON();\n if (undefined !== display)\n props.display = display;\n\n return props;\n }\n\n /** @internal */\n public get textureIds(): Iterable<Id64String> {\n return [];\n }\n}\n\n/** Describes how to draw a representation of a sky by mapping a single image to the interior of a sphere.\n * @public\n */\nexport class SkySphere extends SkyBox {\n /** The image to map to the interior of the sphere. */\n public readonly image: TextureImageSpec;\n\n /** Create a new sky sphere using the specified image.\n * @param image The image to map to the interior of the sphere.\n * @param gradient Optionally overrides the default gradient settings used if the image cannot be obtained.\n */\n public constructor(image: TextureImageSpec, gradient?: SkyGradient) {\n super(gradient ?? SkyGradient.defaults);\n this.image = image;\n }\n\n /** See [[SkyBox.toJSON]]. */\n public override toJSON(display?: boolean): SkyBoxProps {\n const props = super.toJSON(display);\n props.image = {\n type: SkyBoxImageType.Spherical,\n texture: this.image,\n };\n\n return props;\n }\n\n /** @internal */\n public override get textureIds(): Iterable<Id64String> {\n return Id64.isValidId64(this.image) ? [this.image] : [];\n }\n}\n\n/** Describes how to draw a representation of a sky by mapping images to the interior faces of a cube.\n * The images are required to be *square*, and each image must have the same dimensions as the other images.\n * @public\n */\nexport class SkyCube extends SkyBox {\n /** The images to map to each face of the cube. */\n public readonly images: SkyCubeProps;\n\n /** Create a new sky cube using the specified images.\n * @param images The images to map to each face of the cube.\n * @param gradient Optionally overrides the default gradient settings used if the images cannot be obtained.\n */\n public constructor(images: SkyCubeProps, gradient?: SkyGradient) {\n super(gradient ?? SkyGradient.defaults);\n this.images = { ...images };\n }\n\n /** See [[SkyBox.toJSON]]. */\n public override toJSON(display?: boolean): SkyBoxProps {\n const props = super.toJSON(display);\n props.image = {\n type: SkyBoxImageType.Cube,\n textures: { ...this.images },\n };\n\n return props;\n }\n\n /** @internal */\n public override get textureIds(): Iterable<Id64String> {\n const imgs = this.images;\n return [imgs.front, imgs.back, imgs.top, imgs.bottom, imgs.left, imgs.right].filter((x) => Id64.isValidId64(x));\n }\n}\n"]}
@@ -22,6 +22,7 @@ export class SolarShadowSettings {
22
22
  else
23
23
  this.color = RgbColor.fromColorDef(ColorDef.fromJSON(props.color));
24
24
  }
25
+ static { this.defaults = new SolarShadowSettings({}); }
25
26
  static fromJSON(props) {
26
27
  return props ? new SolarShadowSettings(props) : this.defaults;
27
28
  }
@@ -54,5 +55,4 @@ export class SolarShadowSettings {
54
55
  return SolarShadowSettings.fromJSON(props);
55
56
  }
56
57
  }
57
- SolarShadowSettings.defaults = new SolarShadowSettings({});
58
58
  //# sourceMappingURL=SolarShadows.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SolarShadows.js","sourceRoot":"","sources":["../../src/SolarShadows.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAatC,MAAM,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC,QAAQ,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AC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,YAAuC;QAClD,IAAI,CAAC,YAAY;YACf,OAAO,IAAI,CAAC;QAEd,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;QAClC,IAAI,YAAY,CAAC,KAAK;YACpB,KAAK,CAAC,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC;QAEnC,IAAI,SAAS,KAAK,YAAY,CAAC,IAAI;YACjC,KAAK,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;QAEjC,OAAO,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;;AAzCa,4BAAQ,GAAG,IAAI,mBAAmB,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 { JsonUtils } from \"@itwin/core-bentley\";\nimport { ColorByName } from \"./ColorByName\";\nimport { ColorDef, ColorDefProps } from \"./ColorDef\";\nimport { RgbColor } from \"./RgbColor\";\n\n/** JSON representation of [[SolarShadowSettings]].\n * @public\n * @extensions\n */\nexport interface SolarShadowSettingsProps {\n /** Shadow color. Default: [[ColorByName.grey]]. */\n color?: ColorDefProps;\n /** @internal */\n bias?: number;\n}\n\nconst defaultColor = RgbColor.fromColorDef(ColorDef.fromTbgr(ColorByName.grey));\n\n/** Settings controlling display of solar shadows for a [[DisplayStyle3dSettings]].\n * Solar shadows are imposed as a color scaling on geometry occluded from solar lighting.\n * @public\n */\nexport class SolarShadowSettings {\n /** Shadow color. */\n public readonly color: RgbColor;\n /** @internal */\n public readonly bias: number;\n\n private constructor(props: SolarShadowSettingsProps) {\n this.bias = JsonUtils.asDouble(props.bias, 0.001);\n if (undefined === props.color || null === props.color)\n this.color = defaultColor;\n else\n this.color = RgbColor.fromColorDef(ColorDef.fromJSON(props.color));\n }\n\n public static defaults = new SolarShadowSettings({});\n\n public static fromJSON(props?: SolarShadowSettingsProps): SolarShadowSettings {\n return props ? new SolarShadowSettings(props) : this.defaults;\n }\n\n public toJSON(): SolarShadowSettingsProps | undefined {\n const defaults = SolarShadowSettings.defaults;\n if (this.equals(defaults))\n return undefined;\n\n const props: SolarShadowSettingsProps = {};\n if (!this.color.equals(defaults.color))\n props.color = this.color.toColorDef().toJSON();\n\n if (this.bias !== defaults.bias)\n props.bias = this.bias;\n\n return props;\n }\n\n public equals(rhs: SolarShadowSettings): boolean {\n return this.bias === rhs.bias && this.color.equals(rhs.color);\n }\n\n /** Create a copy of these settings.\n * @param changedProps Any property explicitly defined will be overridden in the copy.\n * @returns A settings object equivalent to this one except for any properties explicitly overridden by `changedProps`.\n */\n public clone(changedProps?: SolarShadowSettingsProps): SolarShadowSettings {\n if (!changedProps)\n return this;\n\n const props = this.toJSON() ?? {};\n if (changedProps.color)\n props.color = changedProps.color;\n\n if (undefined !== changedProps.bias)\n props.bias = changedProps.bias;\n\n return SolarShadowSettings.fromJSON(props);\n }\n}\n"]}
1
+ {"version":3,"file":"SolarShadows.js","sourceRoot":"","sources":["../../src/SolarShadows.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAatC,MAAM,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AAEhF;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAM9B,Y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IAChE,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,YAAuC;QAClD,IAAI,CAAC,YAAY;YACf,OAAO,IAAI,CAAC;QAEd,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;QAClC,IAAI,YAAY,CAAC,KAAK;YACpB,KAAK,CAAC,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC;QAEnC,IAAI,SAAS,KAAK,YAAY,CAAC,IAAI;YACjC,KAAK,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;QAEjC,OAAO,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7C,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 { JsonUtils } from \"@itwin/core-bentley\";\nimport { ColorByName } from \"./ColorByName\";\nimport { ColorDef, ColorDefProps } from \"./ColorDef\";\nimport { RgbColor } from \"./RgbColor\";\n\n/** JSON representation of [[SolarShadowSettings]].\n * @public\n * @extensions\n */\nexport interface SolarShadowSettingsProps {\n /** Shadow color. Default: [[ColorByName.grey]]. */\n color?: ColorDefProps;\n /** @internal */\n bias?: number;\n}\n\nconst defaultColor = RgbColor.fromColorDef(ColorDef.fromTbgr(ColorByName.grey));\n\n/** Settings controlling display of solar shadows for a [[DisplayStyle3dSettings]].\n * Solar shadows are imposed as a color scaling on geometry occluded from solar lighting.\n * @public\n */\nexport class SolarShadowSettings {\n /** Shadow color. */\n public readonly color: RgbColor;\n /** @internal */\n public readonly bias: number;\n\n private constructor(props: SolarShadowSettingsProps) {\n this.bias = JsonUtils.asDouble(props.bias, 0.001);\n if (undefined === props.color || null === props.color)\n this.color = defaultColor;\n else\n this.color = RgbColor.fromColorDef(ColorDef.fromJSON(props.color));\n }\n\n public static defaults = new SolarShadowSettings({});\n\n public static fromJSON(props?: SolarShadowSettingsProps): SolarShadowSettings {\n return props ? new SolarShadowSettings(props) : this.defaults;\n }\n\n public toJSON(): SolarShadowSettingsProps | undefined {\n const defaults = SolarShadowSettings.defaults;\n if (this.equals(defaults))\n return undefined;\n\n const props: SolarShadowSettingsProps = {};\n if (!this.color.equals(defaults.color))\n props.color = this.color.toColorDef().toJSON();\n\n if (this.bias !== defaults.bias)\n props.bias = this.bias;\n\n return props;\n }\n\n public equals(rhs: SolarShadowSettings): boolean {\n return this.bias === rhs.bias && this.color.equals(rhs.color);\n }\n\n /** Create a copy of these settings.\n * @param changedProps Any property explicitly defined will be overridden in the copy.\n * @returns A settings object equivalent to this one except for any properties explicitly overridden by `changedProps`.\n */\n public clone(changedProps?: SolarShadowSettingsProps): SolarShadowSettings {\n if (!changedProps)\n return this;\n\n const props = this.toJSON() ?? {};\n if (changedProps.color)\n props.color = changedProps.color;\n\n if (undefined !== changedProps.bias)\n props.bias = changedProps.bias;\n\n return SolarShadowSettings.fromJSON(props);\n }\n}\n"]}
@@ -88,6 +88,6 @@ export class SubCategoryAppearance {
88
88
  return val;
89
89
  }
90
90
  clone() { return new SubCategoryAppearance(this.toJSON()); }
91
+ static { this.defaults = new SubCategoryAppearance(); }
91
92
  }
92
- SubCategoryAppearance.defaults = new SubCategoryAppearance();
93
93
  //# sourceMappingURL=SubCategoryAppearance.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SubCategoryAppearance.js","sourceRoot":"","sources":["../../src/SubCategoryAppearance.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAc,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AAErD;;;;GAIG;AACH,MAAM,OAAO,qBAAqB;IAoChC;;;OAGG;IACH,IAAW,SAAS,KAAe,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC,UAAU,C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,OAAO,GAAG,CAAC;IACb,CAAC;IAEM,KAAK,KAA4B,OAAO,IAAI,qBAAqB,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;;AAE5E,8BAAQ,GAAG,IAAI,qBAAqB,EAAE,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 Symbology\n */\n\nimport { Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\nimport { ColorDef, ColorDefProps } from \"./ColorDef\";\n\n/** Parameters that define the way geometry on a [[SubCategory]] appears.\n * SubCategoryAppearance describes the intrinsic appearance of geometry belonging to that SubCategory, independent of a particular [[ViewState]].\n * Aspects of a SubCategory's appearance can be overridden in the context of a particular [[ViewState]] through the use of [[SubCategoryOverride]]s.\n * @public\n */\nexport class SubCategoryAppearance {\n /** The color of the geometry.\n * @note The transparency component of the color is ignored.\n * @see [[SubCategoryAppearance.transparency]].\n */\n public readonly color: ColorDef;\n /** The line width, in pixels.\n * @note The renderer will clamp values to the integer range [1, 32].\n */\n public readonly weight: number;\n /** The display priority used to control which geometry draws in front of other geometry within a 2D view.\n * The priority is a number in the range [-8388576,8388576].\n * Where two pieces of geometry overlap, the one with the larger priority value draws on top of the one with the smaller priority.\n * If they have equal priorities, the order in which they draw is undefined, and z-fighting may result.\n * @note This property has no effect in 3D views unless [[PlanProjectionSettings]] are in effect.\n */\n public readonly priority: number;\n /** A value in the range [0, 1] indicating the transparency of the geometry where 0.0 means \"fully opaque\" and 1.0 means \"fully transparent\". */\n public readonly transparency: number;\n /** If true, geometry belonging to this SubCategory is not drawn. */\n public readonly invisible: boolean;\n /** @internal */\n public readonly dontPlot: boolean;\n /** @internal */\n public readonly dontSnap: boolean;\n /** @internal */\n public readonly dontLocate: boolean;\n /** The element ID of the line style used to draw curves, or an invalid ID if no line style is specified. */\n public readonly styleId: Id64String;\n /** The element ID of the material applied to surfaces, or an invalid ID if no material is specified. */\n public readonly materialId: Id64String;\n /** @internal */\n protected readonly _fillColor?: ColorDef;\n /** @internal */\n protected readonly _fillTransparency?: number;\n\n /** The fill color of geometry marked as being filled.\n * @note The transparency component of the fill color is ignored.\n * @see [[SubCategoryAppearance.fillTransparency]].\n */\n public get fillColor(): ColorDef { return (undefined !== this._fillColor ? this._fillColor : this.color); }\n /** A value in the range [0, 1] indicating the fill transparency of the geometry where 0.0 means \"fully opaque\" and 1.0 means \"fully transparent\". */\n public get fillTransparency(): number { return (undefined !== this._fillTransparency ? this._fillTransparency : this.transparency); }\n\n constructor(props?: SubCategoryAppearance.Props) {\n if (!props) {\n this.color = ColorDef.black;\n this.weight = 0;\n this.priority = 0;\n this.transparency = 0;\n this.invisible = this.dontPlot = this.dontSnap = this.dontLocate = false;\n this.styleId = Id64.invalid;\n this.materialId = Id64.invalid;\n return;\n }\n\n this.invisible = JsonUtils.asBool(props.invisible);\n this.dontSnap = JsonUtils.asBool(props.dontSnap);\n this.dontLocate = JsonUtils.asBool(props.dontLocate);\n this.dontPlot = JsonUtils.asBool(props.dontPlot);\n this.color = ColorDef.fromJSON(props.color);\n this.weight = JsonUtils.asInt(props.weight);\n this.styleId = Id64.fromJSON(props.style);\n this.priority = JsonUtils.asInt(props.priority);\n this.materialId = Id64.fromJSON(props.material);\n this.transparency = JsonUtils.asDouble(props.transp);\n if (props.fill)\n this._fillColor = ColorDef.fromJSON(props.fill);\n if (props.transpFill)\n this._fillTransparency = JsonUtils.asDouble(props.transpFill);\n }\n\n public equals(other: SubCategoryAppearance): boolean {\n return this.invisible === other.invisible &&\n this.dontPlot === other.dontPlot &&\n this.dontSnap === other.dontSnap &&\n this.dontLocate === other.dontLocate &&\n this.color.equals(other.color) &&\n this.weight === other.weight &&\n this.priority === other.priority &&\n this.styleId === other.styleId &&\n this.materialId === other.materialId &&\n this.transparency === other.transparency &&\n this.fillColor.equals(other.fillColor) &&\n this.fillTransparency === other.fillTransparency;\n }\n\n /** @internal */\n public toJSON(): SubCategoryAppearance.Props {\n const val: SubCategoryAppearance.Props = { color: this.color.toJSON() };\n if (this.invisible)\n val.invisible = true;\n\n if (this.dontPlot)\n val.dontPlot = true;\n\n if (this.dontSnap)\n val.dontSnap = true;\n\n if (this.dontLocate)\n val.dontLocate = true;\n\n if (0 !== this.weight)\n val.weight = this.weight;\n\n if (0 !== this.priority)\n val.priority = this.priority;\n\n if (Id64.isValid(this.styleId))\n val.style = this.styleId;\n\n if (Id64.isValid(this.materialId))\n val.material = this.materialId;\n\n if (0.0 !== this.transparency)\n val.transp = this.transparency;\n\n if (this._fillColor)\n val.fill = this._fillColor.toJSON();\n\n if (this._fillTransparency)\n val.transpFill = this._fillTransparency;\n\n return val;\n }\n\n public clone(): SubCategoryAppearance { return new SubCategoryAppearance(this.toJSON()); }\n\n public static defaults = new SubCategoryAppearance();\n}\n\n/** @public */\nexport namespace SubCategoryAppearance {\n /** Properties used to create a SubCategoryAppearance\n * See [[SubCategoryAppearance]]\n */\n export interface Props {\n /** See [[SubCategoryAppearance.color]]. Defaults to black. */\n color?: ColorDefProps;\n /** See [[SubCategoryAppearance.fillColor]]. Defaults to [[SubCategoryAppearance.color]]. */\n fill?: ColorDefProps;\n /** See [[SubCategoryAppearance.invisible]]. Defaults to false. */\n invisible?: boolean;\n /** @internal */\n dontPlot?: boolean;\n /** @internal */\n dontSnap?: boolean;\n /** @internal */\n dontLocate?: boolean;\n /** See [[SubCategoryAppearance.weight]]. Defaults to 0. */\n weight?: number;\n /** See [[SubCategoryAppearance.styleId]]. Defaults to an invalid ID indicating \"no line style\". */\n style?: Id64String;\n /** See [[SubCategoryAppearance.priority]]. Defaults to 0. */\n priority?: number;\n /** See [[SubCategoryAppearance.materialId]]. Defaults to an invalid ID indicating \"no material\". */\n material?: Id64String;\n /** See [[SubCategoryAppearance.transparency]]. Defaults to 0. */\n transp?: number;\n /** See [[SubCategoryAppearance.fillTransparency]]. Defaults to [[SubCategoryAppearance.transparency]]. */\n transpFill?: number;\n }\n}\n"]}
1
+ {"version":3,"file":"SubCategoryAppearance.js","sourceRoot":"","sources":["../../src/SubCategoryAppearance.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAc,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AAErD;;;;GAIG;AACH,MAAM,OAAO,qBAAqB;IAoChC;;;OAGG;IACH,IAAW,SAAS,KAAe,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3G,qJAAqJ;IACrJ,IAAW,gBAAgB,KAAa,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAErI,YAAY,KAAmC;QAC7C,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;YAC5B,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;YAChB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;YAClB,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;YACtB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;YACzE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;YAC5B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC;YAC/B,OAAO;QACT,CAAC;QAED,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,MAAM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E3B,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC;YAC/B,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC;QAEjC,IAAI,GAAG,KAAK,IAAI,CAAC,YAAY;YAC3B,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC;QAEjC,IAAI,IAAI,CAAC,UAAU;YACjB,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;QAEtC,IAAI,IAAI,CAAC,iBAAiB;YACxB,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC;QAE1C,OAAO,GAAG,CAAC;IACb,CAAC;IAEM,KAAK,KAA4B,OAAO,IAAI,qBAAqB,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;aAE5E,aAAQ,GAAG,IAAI,qBAAqB,EAAE,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 Symbology\n */\n\nimport { Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\nimport { ColorDef, ColorDefProps } from \"./ColorDef\";\n\n/** Parameters that define the way geometry on a [[SubCategory]] appears.\n * SubCategoryAppearance describes the intrinsic appearance of geometry belonging to that SubCategory, independent of a particular [[ViewState]].\n * Aspects of a SubCategory's appearance can be overridden in the context of a particular [[ViewState]] through the use of [[SubCategoryOverride]]s.\n * @public\n */\nexport class SubCategoryAppearance {\n /** The color of the geometry.\n * @note The transparency component of the color is ignored.\n * @see [[SubCategoryAppearance.transparency]].\n */\n public readonly color: ColorDef;\n /** The line width, in pixels.\n * @note The renderer will clamp values to the integer range [1, 32].\n */\n public readonly weight: number;\n /** The display priority used to control which geometry draws in front of other geometry within a 2D view.\n * The priority is a number in the range [-8388576,8388576].\n * Where two pieces of geometry overlap, the one with the larger priority value draws on top of the one with the smaller priority.\n * If they have equal priorities, the order in which they draw is undefined, and z-fighting may result.\n * @note This property has no effect in 3D views unless [[PlanProjectionSettings]] are in effect.\n */\n public readonly priority: number;\n /** A value in the range [0, 1] indicating the transparency of the geometry where 0.0 means \"fully opaque\" and 1.0 means \"fully transparent\". */\n public readonly transparency: number;\n /** If true, geometry belonging to this SubCategory is not drawn. */\n public readonly invisible: boolean;\n /** @internal */\n public readonly dontPlot: boolean;\n /** @internal */\n public readonly dontSnap: boolean;\n /** @internal */\n public readonly dontLocate: boolean;\n /** The element ID of the line style used to draw curves, or an invalid ID if no line style is specified. */\n public readonly styleId: Id64String;\n /** The element ID of the material applied to surfaces, or an invalid ID if no material is specified. */\n public readonly materialId: Id64String;\n /** @internal */\n protected readonly _fillColor?: ColorDef;\n /** @internal */\n protected readonly _fillTransparency?: number;\n\n /** The fill color of geometry marked as being filled.\n * @note The transparency component of the fill color is ignored.\n * @see [[SubCategoryAppearance.fillTransparency]].\n */\n public get fillColor(): ColorDef { return (undefined !== this._fillColor ? this._fillColor : this.color); }\n /** A value in the range [0, 1] indicating the fill transparency of the geometry where 0.0 means \"fully opaque\" and 1.0 means \"fully transparent\". */\n public get fillTransparency(): number { return (undefined !== this._fillTransparency ? this._fillTransparency : this.transparency); }\n\n constructor(props?: SubCategoryAppearance.Props) {\n if (!props) {\n this.color = ColorDef.black;\n this.weight = 0;\n this.priority = 0;\n this.transparency = 0;\n this.invisible = this.dontPlot = this.dontSnap = this.dontLocate = false;\n this.styleId = Id64.invalid;\n this.materialId = Id64.invalid;\n return;\n }\n\n this.invisible = JsonUtils.asBool(props.invisible);\n this.dontSnap = JsonUtils.asBool(props.dontSnap);\n this.dontLocate = JsonUtils.asBool(props.dontLocate);\n this.dontPlot = JsonUtils.asBool(props.dontPlot);\n this.color = ColorDef.fromJSON(props.color);\n this.weight = JsonUtils.asInt(props.weight);\n this.styleId = Id64.fromJSON(props.style);\n this.priority = JsonUtils.asInt(props.priority);\n this.materialId = Id64.fromJSON(props.material);\n this.transparency = JsonUtils.asDouble(props.transp);\n if (props.fill)\n this._fillColor = ColorDef.fromJSON(props.fill);\n if (props.transpFill)\n this._fillTransparency = JsonUtils.asDouble(props.transpFill);\n }\n\n public equals(other: SubCategoryAppearance): boolean {\n return this.invisible === other.invisible &&\n this.dontPlot === other.dontPlot &&\n this.dontSnap === other.dontSnap &&\n this.dontLocate === other.dontLocate &&\n this.color.equals(other.color) &&\n this.weight === other.weight &&\n this.priority === other.priority &&\n this.styleId === other.styleId &&\n this.materialId === other.materialId &&\n this.transparency === other.transparency &&\n this.fillColor.equals(other.fillColor) &&\n this.fillTransparency === other.fillTransparency;\n }\n\n /** @internal */\n public toJSON(): SubCategoryAppearance.Props {\n const val: SubCategoryAppearance.Props = { color: this.color.toJSON() };\n if (this.invisible)\n val.invisible = true;\n\n if (this.dontPlot)\n val.dontPlot = true;\n\n if (this.dontSnap)\n val.dontSnap = true;\n\n if (this.dontLocate)\n val.dontLocate = true;\n\n if (0 !== this.weight)\n val.weight = this.weight;\n\n if (0 !== this.priority)\n val.priority = this.priority;\n\n if (Id64.isValid(this.styleId))\n val.style = this.styleId;\n\n if (Id64.isValid(this.materialId))\n val.material = this.materialId;\n\n if (0.0 !== this.transparency)\n val.transp = this.transparency;\n\n if (this._fillColor)\n val.fill = this._fillColor.toJSON();\n\n if (this._fillTransparency)\n val.transpFill = this._fillTransparency;\n\n return val;\n }\n\n public clone(): SubCategoryAppearance { return new SubCategoryAppearance(this.toJSON()); }\n\n public static defaults = new SubCategoryAppearance();\n}\n\n/** @public */\nexport namespace SubCategoryAppearance {\n /** Properties used to create a SubCategoryAppearance\n * See [[SubCategoryAppearance]]\n */\n export interface Props {\n /** See [[SubCategoryAppearance.color]]. Defaults to black. */\n color?: ColorDefProps;\n /** See [[SubCategoryAppearance.fillColor]]. Defaults to [[SubCategoryAppearance.color]]. */\n fill?: ColorDefProps;\n /** See [[SubCategoryAppearance.invisible]]. Defaults to false. */\n invisible?: boolean;\n /** @internal */\n dontPlot?: boolean;\n /** @internal */\n dontSnap?: boolean;\n /** @internal */\n dontLocate?: boolean;\n /** See [[SubCategoryAppearance.weight]]. Defaults to 0. */\n weight?: number;\n /** See [[SubCategoryAppearance.styleId]]. Defaults to an invalid ID indicating \"no line style\". */\n style?: Id64String;\n /** See [[SubCategoryAppearance.priority]]. Defaults to 0. */\n priority?: number;\n /** See [[SubCategoryAppearance.materialId]]. Defaults to an invalid ID indicating \"no material\". */\n material?: Id64String;\n /** See [[SubCategoryAppearance.transparency]]. Defaults to 0. */\n transp?: number;\n /** See [[SubCategoryAppearance.fillTransparency]]. Defaults to [[SubCategoryAppearance.transparency]]. */\n transpFill?: number;\n }\n}\n"]}
@@ -95,7 +95,7 @@ export class SubCategoryOverride {
95
95
  if (undefined !== props.transp)
96
96
  this.transparency = JsonUtils.asDouble(props.transp);
97
97
  }
98
+ /** A default SubCategoryOverride which overrides nothing. */
99
+ static { this.defaults = new SubCategoryOverride({}); }
98
100
  }
99
- /** A default SubCategoryOverride which overrides nothing. */
100
- SubCategoryOverride.defaults = new SubCategoryOverride({});
101
101
  //# sourceMappingURL=SubCategoryOverride.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SubCategoryOverride.js","sourceRoot":"","sources":["../../src/SubCategoryOverride.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAc,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;;;;;;;GAQG;AACH,MAAM,OAAO,mBAAmB;IAgB9B,yGAAyG;IACzG,IAAW,aAAa;QACtB,OAAO,SAAS,KAAK,IAAI,CAAC,SAAS,IAAI,SAAS,KAAK,IAAI,CAAC,KAAK,IAAI,SAAS,KAAK,IAAI,CAAC,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AC,CAAC;IACzD,CAAC;;AAED,6DAA6D;AAC/C,4BAAQ,GAAG,IAAI,mBAAmB,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 { Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\nimport { ColorDef } from \"./ColorDef\";\nimport { SubCategoryAppearance } from \"./SubCategoryAppearance\";\n\n/** Overrides selected aspects of a [[SubCategoryAppearance]] in the context of a [[DisplayStyleState]].\n * When determining how geometry belonging to a [[SubCategory]] will appear when drawn within a view:\n * 1. The base [[SubCategoryAppearance]] associated with that subcategory is obtained.\n * 2. The [[SubCategoryOverride]] associated with that subcategory in the [[DisplayStyleState]] is obtained.\n * 3. Any aspects of the appearance overridden by the SubCategoryOverride are replaced with the values from the SubCategoryOverride.\n * An aspect is overridden by virtue of not being set to \"undefined\" in the SubCategoryOverride.\n * @see [[DisplayStyleState.overrideSubCategory]]\n * @public\n */\nexport class SubCategoryOverride {\n /** See [[SubCategoryAppearance.color]] */\n public readonly color?: ColorDef;\n /** See [[SubCategoryAppearance.invisible]] */\n public readonly invisible?: boolean;\n /** See [[SubCategoryAppearance.weight]] */\n public readonly weight?: number;\n /** @internal Overriding with arbitrary custom line style is not supported - overriding with LinePixels enum could be. */\n public readonly style?: Id64String;\n /** See [[SubCategoryAppearance.priority]] */\n public readonly priority?: number;\n /** See [[SubCategoryAppearance.materialId]] */\n public readonly material?: Id64String;\n /** See [[SubCategoryAppearance.transparency]] */\n public readonly transparency?: number;\n\n /** Returns true if any aspect of the appearance is overridden (i.e., if any member is not undefined). */\n public get anyOverridden(): boolean {\n return undefined !== this.invisible || undefined !== this.color || undefined !== this.weight || undefined !== this.style || undefined !== this.priority || undefined !== this.material || undefined !== this.transparency;\n }\n\n /** Returns a SubCategoryAppearance overridden to match the properties defined by this SubCategoryOverride. */\n public override(appearance: SubCategoryAppearance): SubCategoryAppearance {\n if (!this.anyOverridden)\n return appearance;\n\n const props = appearance.toJSON();\n const ovrProps = this.toJSON();\n if (undefined !== ovrProps.invisible)\n props.invisible = ovrProps.invisible;\n if (undefined !== ovrProps.weight)\n props.weight = ovrProps.weight;\n if (undefined !== ovrProps.style)\n props.style = ovrProps.style;\n if (undefined !== ovrProps.material)\n props.material = ovrProps.material;\n if (undefined !== ovrProps.priority)\n props.priority = ovrProps.priority;\n if (undefined !== ovrProps.transp)\n props.transp = ovrProps.transp;\n if (undefined !== ovrProps.color)\n props.color = ovrProps.color;\n\n return new SubCategoryAppearance(props);\n }\n\n /** Convert this SubCategoryOverride to a JSON object\n * @internal\n */\n public toJSON(): SubCategoryAppearance.Props {\n const props: SubCategoryAppearance.Props = {};\n if (undefined !== this.invisible)\n props.invisible = this.invisible;\n\n if (undefined !== this.weight)\n props.weight = this.weight;\n\n if (undefined !== this.style)\n props.style = this.style;\n\n if (undefined !== this.material)\n props.material = this.material;\n\n if (undefined !== this.priority)\n props.priority = this.priority;\n\n if (undefined !== this.transparency)\n props.transp = this.transparency;\n\n if (undefined !== this.color)\n props.color = this.color.toJSON();\n\n return props;\n }\n\n /** Perform equality comparison against another SubCategoryOverride. */\n public equals(other: SubCategoryOverride): boolean {\n if (this.invisible !== other.invisible || this.weight !== other.weight || this.style !== other.style\n || this.priority !== other.priority || this.material !== other.material || this.transparency !== other.transparency)\n return false;\n\n if (undefined !== this.color && undefined !== other.color)\n return this.color.tbgr === other.color.tbgr;\n else\n return undefined === this.color && undefined === other.color;\n }\n\n /** Create a new SubCategoryOverride from a JSON object */\n public static fromJSON(json?: SubCategoryAppearance.Props): SubCategoryOverride {\n return undefined !== json ? new SubCategoryOverride(json) : this.defaults;\n }\n\n private constructor(props: SubCategoryAppearance.Props) {\n if (undefined !== props.invisible)\n this.invisible = JsonUtils.asBool(props.invisible);\n if (undefined !== props.color)\n this.color = ColorDef.fromJSON(props.color);\n if (undefined !== props.weight)\n this.weight = JsonUtils.asInt(props.weight);\n if (undefined !== props.style)\n this.style = Id64.fromJSON(props.style);\n if (undefined !== props.material)\n this.material = Id64.fromJSON(props.material);\n if (undefined !== props.priority)\n this.priority = JsonUtils.asInt(props.priority);\n if (undefined !== props.transp)\n this.transparency = JsonUtils.asDouble(props.transp);\n }\n\n /** A default SubCategoryOverride which overrides nothing. */\n public static defaults = new SubCategoryOverride({});\n}\n"]}
1
+ {"version":3,"file":"SubCategoryOverride.js","sourceRoot":"","sources":["../../src/SubCategoryOverride.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAc,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;;;;;;;GAQG;AACH,MAAM,OAAO,mBAAmB;IAgB9B,yGAAyG;IACzG,IAAW,aAAa;QACtB,OAAO,SAAS,KAAK,IAAI,CAAC,SAAS,IAAI,SAAS,KAAK,IAAI,CAAC,KAAK,IAAI,SAAS,KAAK,IAAI,CAAC,MAAM,IAAI,SAAS,KAAK,IAAI,CAAC,KAAK,IAAI,SAAS,KAAK,IAAI,CAAC,QAAQ,IAAI,SAAS,KAAK,IAAI,CAAC,QAAQ,IAAI,SAAS,KAAK,IAAI,CAAC,YAAY,CAAC;IAC5N,CAAC;IAED,8GAA8G;IACvG,QAAQ,CAAC,UAAiC;QAC/C,IAAI,CAAC,IAAI,CAAC,aAAa;YACrB,OAAO,UAAU,CAAC;QAEpB,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC;QAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAC/B,IAAI,SAAS,KAAK,QAAQ,CAAC,SAAS;YAClC,KAAK,CAAC,SAAS,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,CAAC;QACrD,IAAI,SAAS,KAAK,KAAK,CAAC,KAAK;YAC3B,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC9C,IAAI,SAAS,KAAK,KAAK,CAAC,MAAM;YAC5B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC9C,IAAI,SAAS,KAAK,KAAK,CAAC,KAAK;YAC3B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1C,IAAI,SAAS,KAAK,KAAK,CAAC,QAAQ;YAC9B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChD,IAAI,SAAS,KAAK,KAAK,CAAC,QAAQ;YAC9B,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAClD,IAAI,SAAS,KAAK,KAAK,CAAC,MAAM;YAC5B,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACzD,CAAC;IAED,6DAA6D;aAC/C,aAAQ,GAAG,IAAI,mBAAmB,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 { Id64, Id64String, JsonUtils } from \"@itwin/core-bentley\";\nimport { ColorDef } from \"./ColorDef\";\nimport { SubCategoryAppearance } from \"./SubCategoryAppearance\";\n\n/** Overrides selected aspects of a [[SubCategoryAppearance]] in the context of a [[DisplayStyleState]].\n * When determining how geometry belonging to a [[SubCategory]] will appear when drawn within a view:\n * 1. The base [[SubCategoryAppearance]] associated with that subcategory is obtained.\n * 2. The [[SubCategoryOverride]] associated with that subcategory in the [[DisplayStyleState]] is obtained.\n * 3. Any aspects of the appearance overridden by the SubCategoryOverride are replaced with the values from the SubCategoryOverride.\n * An aspect is overridden by virtue of not being set to \"undefined\" in the SubCategoryOverride.\n * @see [[DisplayStyleState.overrideSubCategory]]\n * @public\n */\nexport class SubCategoryOverride {\n /** See [[SubCategoryAppearance.color]] */\n public readonly color?: ColorDef;\n /** See [[SubCategoryAppearance.invisible]] */\n public readonly invisible?: boolean;\n /** See [[SubCategoryAppearance.weight]] */\n public readonly weight?: number;\n /** @internal Overriding with arbitrary custom line style is not supported - overriding with LinePixels enum could be. */\n public readonly style?: Id64String;\n /** See [[SubCategoryAppearance.priority]] */\n public readonly priority?: number;\n /** See [[SubCategoryAppearance.materialId]] */\n public readonly material?: Id64String;\n /** See [[SubCategoryAppearance.transparency]] */\n public readonly transparency?: number;\n\n /** Returns true if any aspect of the appearance is overridden (i.e., if any member is not undefined). */\n public get anyOverridden(): boolean {\n return undefined !== this.invisible || undefined !== this.color || undefined !== this.weight || undefined !== this.style || undefined !== this.priority || undefined !== this.material || undefined !== this.transparency;\n }\n\n /** Returns a SubCategoryAppearance overridden to match the properties defined by this SubCategoryOverride. */\n public override(appearance: SubCategoryAppearance): SubCategoryAppearance {\n if (!this.anyOverridden)\n return appearance;\n\n const props = appearance.toJSON();\n const ovrProps = this.toJSON();\n if (undefined !== ovrProps.invisible)\n props.invisible = ovrProps.invisible;\n if (undefined !== ovrProps.weight)\n props.weight = ovrProps.weight;\n if (undefined !== ovrProps.style)\n props.style = ovrProps.style;\n if (undefined !== ovrProps.material)\n props.material = ovrProps.material;\n if (undefined !== ovrProps.priority)\n props.priority = ovrProps.priority;\n if (undefined !== ovrProps.transp)\n props.transp = ovrProps.transp;\n if (undefined !== ovrProps.color)\n props.color = ovrProps.color;\n\n return new SubCategoryAppearance(props);\n }\n\n /** Convert this SubCategoryOverride to a JSON object\n * @internal\n */\n public toJSON(): SubCategoryAppearance.Props {\n const props: SubCategoryAppearance.Props = {};\n if (undefined !== this.invisible)\n props.invisible = this.invisible;\n\n if (undefined !== this.weight)\n props.weight = this.weight;\n\n if (undefined !== this.style)\n props.style = this.style;\n\n if (undefined !== this.material)\n props.material = this.material;\n\n if (undefined !== this.priority)\n props.priority = this.priority;\n\n if (undefined !== this.transparency)\n props.transp = this.transparency;\n\n if (undefined !== this.color)\n props.color = this.color.toJSON();\n\n return props;\n }\n\n /** Perform equality comparison against another SubCategoryOverride. */\n public equals(other: SubCategoryOverride): boolean {\n if (this.invisible !== other.invisible || this.weight !== other.weight || this.style !== other.style\n || this.priority !== other.priority || this.material !== other.material || this.transparency !== other.transparency)\n return false;\n\n if (undefined !== this.color && undefined !== other.color)\n return this.color.tbgr === other.color.tbgr;\n else\n return undefined === this.color && undefined === other.color;\n }\n\n /** Create a new SubCategoryOverride from a JSON object */\n public static fromJSON(json?: SubCategoryAppearance.Props): SubCategoryOverride {\n return undefined !== json ? new SubCategoryOverride(json) : this.defaults;\n }\n\n private constructor(props: SubCategoryAppearance.Props) {\n if (undefined !== props.invisible)\n this.invisible = JsonUtils.asBool(props.invisible);\n if (undefined !== props.color)\n this.color = ColorDef.fromJSON(props.color);\n if (undefined !== props.weight)\n this.weight = JsonUtils.asInt(props.weight);\n if (undefined !== props.style)\n this.style = Id64.fromJSON(props.style);\n if (undefined !== props.material)\n this.material = Id64.fromJSON(props.material);\n if (undefined !== props.priority)\n this.priority = JsonUtils.asInt(props.priority);\n if (undefined !== props.transp)\n this.transparency = JsonUtils.asDouble(props.transp);\n }\n\n /** A default SubCategoryOverride which overrides nothing. */\n public static defaults = new SubCategoryOverride({});\n}\n"]}
@@ -74,6 +74,8 @@ export class TextureMapping {
74
74
  const matrix = Matrix3d.createRowValues(m00, m01, 0, m10, m11, 0, 0, 0, 1);
75
75
  this.transform = Transform.createRefs(origin, matrix);
76
76
  }
77
+ /** An immutable 2x3 identity matrix. */
78
+ static { this.identity = new Trans2x3(); }
77
79
  /** An [OrderedComparator]($bentley) that compares this Trans2x3 against `other`. */
78
80
  compare(other) {
79
81
  if (this === other) {
@@ -92,8 +94,6 @@ export class TextureMapping {
92
94
  return 0;
93
95
  }
94
96
  }
95
- /** An immutable 2x3 identity matrix. */
96
- Trans2x3.identity = new Trans2x3();
97
97
  TextureMapping.Trans2x3 = Trans2x3;
98
98
  function compareConstantLodParams(lhs, rhs) {
99
99
  return compareNumbers(lhs.repetitions, rhs.repetitions) || compareNumbers(lhs.offset.x, rhs.offset.x) || compareNumbers(lhs.offset.y, rhs.offset.y)
@@ -1 +1 @@
1
- {"version":3,"file":"TextureMapping.js","sourceRoot":"","sources":["../../src/TextureMapping.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAA0B,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAmB,SAAS,EAAE,QAAQ,EAAS,MAAM,sBAAsB,CAAC;AAEvI,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,cAAc,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAkBvJ,SAAS,sBAAsB,CAAC,GAAoB,EAAE,GAAoB;IACxE,OAAO,wBAAwB,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC;WACpF,0BAA0B,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,yBAAyB,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC;WACvG,0BAA0B,CAAC,GAAG,CAAC,cAAc,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;AAC1E,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,cAAc;IAUzB,YAAmB,EAAiB,EAAE,MAA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,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;YACpD,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;KACF;IAtJY,qBAAM,SAsJlB,CAAA;AACH,CAAC,EAjRgB,cAAc,KAAd,cAAc,QAiR9B;AAED,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Rendering\n */\n\nimport { IndexedPolyfaceVisitor, Matrix3d, Point2d, Point3d, PolyfaceVisitor, Transform, Vector3d, XAndY } from \"@itwin/core-geometry\";\nimport { RenderTexture } from \"./RenderTexture\";\nimport { compareBooleans, compareBooleansOrUndefined, compareNumbers, compareNumbersOrUndefined, comparePossiblyUndefined } from \"@itwin/core-bentley\";\n\n/** Defines normal map parameters.\n * @beta\n */\nexport interface NormalMapParams {\n /** The texture to use as a normal map. If not present then the pattern map texture will be used as a normal map. */\n normalMap?: RenderTexture;\n /** True if the Y component stored in the green channel should be negated. By default, positive Y points downward, but some\n * normal maps are created with positive Y pointing upward.\n */\n greenUp?: boolean;\n /** Scale factor by which to multiply the components of the normal extracted from [[normalMap]]. */\n scale?: number;\n /** True if want to use constant LOD texture mapping for the normal map texture. */\n useConstantLod?: boolean;\n}\n\nfunction compareNormalMapParams(lhs: NormalMapParams, rhs: NormalMapParams): number {\n return comparePossiblyUndefined((lh, rh) => lh.compare(rh), lhs.normalMap, rhs.normalMap)\n || compareBooleansOrUndefined(lhs.greenUp, rhs.greenUp) || compareNumbersOrUndefined(lhs.scale, rhs.scale)\n || compareBooleansOrUndefined(lhs.useConstantLod, rhs.useConstantLod);\n}\n\n/** Describes how to map a [[RenderTexture]]'s image onto a surface as part of a [[RenderMaterial]].\n * @public\n */\nexport class TextureMapping {\n /** The texture to be mapped to the surface. If normalMapParams is present but does not contain a normal map, then texture is used as a normal map rather than a pattern map. */\n public readonly texture: RenderTexture;\n /** The parameters for normal mapping.\n * @beta\n */\n public normalMapParams?: NormalMapParams;\n /** The parameters describing how the textures are mapped to the surface. */\n public readonly params: TextureMapping.Params;\n\n public constructor(tx: RenderTexture, params: TextureMapping.Params) {\n this.texture = tx;\n this.params = params;\n }\n\n /** @internal */\n public computeUVParams(visitor: PolyfaceVisitor, transformToImodel: Transform): Point2d[] | undefined {\n return this.params.computeUVParams(visitor as IndexedPolyfaceVisitor, transformToImodel);\n }\n\n /** An [OrderedComparator]($bentley) that compares this mapping against `other`. */\n public compare(other: TextureMapping): number {\n if (this === other) {\n return 0;\n }\n\n return this.texture.compare(other.texture) || this.params.compare(other.params)\n || comparePossiblyUndefined((lh, rh) => compareNormalMapParams(lh, rh), this.normalMapParams, other.normalMapParams);\n }\n}\n\n/** @public */\nexport namespace TextureMapping {\n /** Enumerates the possible texture mapping modes. */\n export enum Mode {\n None = -1,\n Parametric = 0,\n ElevationDrape = 1,\n Planar = 2,\n /** @internal */\n DirectionalDrape = 3,\n /** @internal */\n Cubic = 4,\n /** @internal */\n Spherical = 5,\n /** @internal */\n Cylindrical = 6,\n /** @internal */\n Solid = 7,\n /** @internal Only valid for lights */\n FrontProject = 8,\n }\n\n /** A 2x3 matrix for mapping a texture image to a surface. */\n export class Trans2x3 {\n /** The 3x4 transform produced from the 2x3 matrix. */\n public readonly transform: Transform;\n\n /** Construct from the two rows of the matrix:\n * ```\n * | m00 m01 originX |\n * | m10 m11 originY |\n * ```\n * Producing the [Transform]($core-geometry):\n * ```\n * | m00 m01 0 originX |\n * | m10 m11 0 originY |\n * | 0 0 1 0 |\n * ```\n */\n public constructor(m00 = 1, m01 = 0, originX = 0, m10 = 0, m11 = 1, originY = 0) {\n const origin = new Point3d(originX, originY, 0);\n const matrix = Matrix3d.createRowValues(m00, m01, 0, m10, m11, 0, 0, 0, 1);\n this.transform = Transform.createRefs(origin, matrix);\n }\n\n /** An immutable 2x3 identity matrix. */\n public static readonly identity = new Trans2x3();\n\n /** An [OrderedComparator]($bentley) that compares this Trans2x3 against `other`. */\n public compare(other: Trans2x3): number {\n if (this === other) {\n return 0;\n }\n\n const originDiff = compareNumbers(this.transform.origin.x, other.transform.origin.x) || compareNumbers(this.transform.origin.y, other.transform.origin.y);\n if (originDiff !== 0) {\n return originDiff;\n }\n\n for (const i of [0, 1, 3, 4]) {\n const matDiff = compareNumbers(this.transform.matrix.coffs[i], other.transform.matrix.coffs[i]);\n if (matDiff !== 0) {\n return matDiff;\n }\n }\n\n return 0;\n }\n }\n\n /** Properties used to construct a [[TextureMapping.ConstantLodParams]]. */\n export interface ConstantLodParamProps {\n /** The number of times the texture is repeated. Increasing this will make the texture pattern appear smaller, decreasing it will make it larger. Defaults to 1. */\n repetitions?: number;\n /** An offset in world units used to shift the texture. Defaults to (0, 0). */\n offset?: XAndY;\n /** The minimum distance (from the eye to the surface) at which to clamp the texture. Defaults to 1.*/\n minDistClamp?: number;\n /** The maximum distance (from the eye to the surface) at which to clamp the texture. Defaults to 2^32. */\n maxDistClamp?: number;\n }\n\n /** Parameters to define constant level of detail mapping mode, a mode of texture coordinate generation which dynamically creates\n * texture cooprdinates so that the level of detail of the texture in the rendered image remains somewhat constant. */\n export interface ConstantLodParams {\n /** The number of times the texture is repeated. Increasing this will make the texture pattern appear smaller, decreasing it will make it larger. */\n repetitions: number;\n /** An offset in world units used to shift the texture. */\n offset: XAndY;\n /** The minimum distance (from the eye to the surface) at which to clamp the texture. */\n minDistClamp: number;\n /** The maximum distance (from the eye to the surface) at which to clamp the texture. */\n maxDistClamp: number;\n }\n\n function compareConstantLodParams(lhs: ConstantLodParams, rhs: ConstantLodParams): number {\n return compareNumbers(lhs.repetitions, rhs.repetitions) || compareNumbers(lhs.offset.x, rhs.offset.x) || compareNumbers(lhs.offset.y, rhs.offset.y)\n || compareNumbers(lhs.minDistClamp, rhs.minDistClamp) || compareNumbers(lhs.maxDistClamp, rhs.maxDistClamp);\n }\n\n /** Properties used to construct a [[TextureMapping.Params]]. */\n export interface ParamProps {\n /** The matrix used to map the image to a surface. */\n textureMat2x3?: TextureMapping.Trans2x3;\n /** The ratio in [0, 1] with which to mix the color sampled from the texture with the surface's color.\n * A value of 0.0 uses only the surface color. A value of 1.0 uses only the texture color. A value of 0.5 uses an even mix of both.\n * @note This affects only the red, green, and blue components of the color. The alpha sampled from the texture is always multiplied by the surface color's alpha.\n * @note Defaults to 1.0\n */\n textureWeight?: number;\n /** The mode by which to map the image to a surface.\n * @note Defaults to [[TextureMapping.Mode.Parametric]].\n */\n mapMode?: TextureMapping.Mode;\n /** @internal */\n worldMapping?: boolean;\n /** True if want to use constant LOD texture mapping for the surface texture. */\n useConstantLod?: boolean;\n /** Parameters for constantLod mapping mode. */\n constantLodProps?: ConstantLodParamProps;\n }\n\n /** Parameters describing how a [[RenderTexture]]'s image is mapped to a surface. */\n export class Params {\n /** The matrix used to map the image to a surface. */\n public textureMatrix: TextureMapping.Trans2x3;\n /** The ratio in [0, 1] with which to mix the color sampled from the texture with the element's color.\n * A value of 0.0 uses only the element color. A value of 1.0 uses only the texture color.\n */\n public weight: number;\n /** The mode by which to map the image to a surface. */\n public mode: TextureMapping.Mode;\n /** @internal */\n public worldMapping: boolean;\n /** True if want to use constant LOD texture mapping for the surface texture. */\n public useConstantLod: boolean;\n /** Parameters for constantLod mapping mode. */\n public constantLodParams: ConstantLodParams;\n\n public constructor(props?: TextureMapping.ParamProps) {\n this.textureMatrix = props?.textureMat2x3 ?? Trans2x3.identity;\n this.weight = props?.textureWeight ?? 1;\n this.mode = props?.mapMode ?? Mode.Parametric;\n this.worldMapping = props?.worldMapping ?? false;\n this.useConstantLod = props?.useConstantLod ?? false;\n this.constantLodParams = {\n repetitions: props?.constantLodProps?.repetitions ?? 1,\n offset: props?.constantLodProps?.offset ?? { x: 0, y: 0 },\n minDistClamp: props?.constantLodProps?.minDistClamp ?? 1,\n maxDistClamp: props?.constantLodProps?.maxDistClamp ?? 4096 * 1024 * 1024,\n };\n }\n\n /** An [OrderedComparator]($bentley) that compares these Params against `other`. */\n public compare(other: Params): number {\n if (this === other) {\n return 0;\n }\n\n return compareNumbers(this.weight, other.weight) || compareNumbers(this.mode, other.mode) || compareBooleans(this.worldMapping, other.worldMapping)\n || compareBooleans(this.useConstantLod, other.useConstantLod) || this.textureMatrix.compare(other.textureMatrix)\n || compareConstantLodParams(this.constantLodParams, other.constantLodParams);\n }\n\n /**\n * Generates UV parameters for textured surfaces. Returns undefined on failure.\n * @internal\n */\n public computeUVParams(visitor: IndexedPolyfaceVisitor, transformToImodel: Transform): Point2d[] | undefined {\n switch (this.mode) {\n default: // Fall through to parametric in default case\n case TextureMapping.Mode.Parametric: {\n return this.computeParametricUVParams(visitor, this.textureMatrix.transform, !this.worldMapping);\n }\n case TextureMapping.Mode.Planar: {\n const normalIndices = visitor.normalIndex;\n if (!normalIndices)\n return undefined;\n\n // Ignore planar mode unless master or sub units for scaleMode and facet is planar\n if (!this.worldMapping || (visitor.normalIndex !== undefined && (normalIndices[0] !== normalIndices[1] || normalIndices[0] !== normalIndices[2]))) {\n return this.computeParametricUVParams(visitor, this.textureMatrix.transform, !this.worldMapping);\n } else {\n return this.computePlanarUVParams(visitor, this.textureMatrix.transform);\n }\n }\n case TextureMapping.Mode.ElevationDrape: {\n return this.computeElevationDrapeUVParams(visitor, this.textureMatrix.transform, transformToImodel);\n }\n }\n }\n\n /** Computes UV parameters given a texture mapping mode of parametric. */\n private computeParametricUVParams(visitor: IndexedPolyfaceVisitor, uvTransform: Transform, isRelativeUnits: boolean): Point2d[] {\n const params: Point2d[] = [];\n for (let i = 0; i < visitor.numEdgesThisFacet; i++) {\n let param = Point2d.create();\n\n if (isRelativeUnits || !visitor.tryGetDistanceParameter(i, param)) {\n if (!visitor.tryGetNormalizedParameter(i, param)) {\n // If mesh does not have facetFaceData, we still want to use the texture coordinates if they are present\n param = visitor.getParam(i)!;\n }\n }\n\n params.push(uvTransform.multiplyPoint2d(param));\n }\n return params;\n }\n\n /** Computes UV parameters given a texture mapping mode of planar. The result is stored in the Point2d array given. */\n private computePlanarUVParams(visitor: IndexedPolyfaceVisitor, uvTransform: Transform): Point2d[] | undefined {\n const params: Point2d[] = [];\n const points = visitor.point;\n let normal: Vector3d;\n\n if (visitor.normal === undefined)\n normal = points.getPoint3dAtUncheckedPointIndex(0).crossProductToPoints(points.getPoint3dAtUncheckedPointIndex(1), points.getPoint3dAtUncheckedPointIndex(2));\n else\n normal = visitor.normal.getVector3dAtCheckedVectorIndex(0)!;\n\n if (!normal.normalize(normal))\n return undefined;\n\n // adjust U texture coordinate to be a continuous length starting at the\n // origin. V coordinate stays the same. This mode assumes Z is up vector\n\n // Flipping normal puts us in a planar coordinate system consistent with MicroStation's display system\n normal.scale(-1.0, normal);\n\n // pick the first vertex normal\n const sideVector = Vector3d.create(normal.y, -normal.x, 0.0);\n\n // if the magnitude of the normal is near zero, the real normal points\n // almost straighten up.. In this case, use Y as the up vector to match QV\n\n const magnitude = sideVector.magnitude();\n sideVector.normalize(sideVector); // won't remain undefined if failed due to following check..\n\n if (magnitude < 1e-3) {\n normal.set(0, 0, -1);\n sideVector.set(1, 0, 0);\n }\n\n const upVector = sideVector.crossProduct(normal).normalize();\n if (!upVector)\n return undefined;\n\n const numEdges = visitor.numEdgesThisFacet;\n for (let i = 0; i < numEdges; i++) {\n const vector = Vector3d.createFrom(points.getPoint3dAtUncheckedPointIndex(i));\n\n params.push(Point2d.create(vector.dotProduct(sideVector), vector.dotProduct(upVector)));\n uvTransform.multiplyPoint2d(params[i], params[i]);\n }\n return params;\n }\n\n /** Computes UV parameters given a texture mapping mode of elevation drape. The result is stored in the Point2d array given. */\n private computeElevationDrapeUVParams(visitor: IndexedPolyfaceVisitor, uvTransform: Transform, transformToIModel?: Transform): Point2d[] {\n const params: Point2d[] = [];\n const numEdges = visitor.numEdgesThisFacet;\n for (let i = 0; i < numEdges; i++) {\n const point = visitor.point.getPoint3dAtUncheckedPointIndex(i);\n\n if (transformToIModel !== undefined)\n transformToIModel.multiplyPoint3d(point, point);\n\n params.push(Point2d.createFrom(point));\n uvTransform.multiplyPoint2d(params[i], params[i]);\n }\n return params;\n }\n }\n}\n\nObject.freeze(TextureMapping.Trans2x3.identity);\n"]}
1
+ {"version":3,"file":"TextureMapping.js","sourceRoot":"","sources":["../../src/TextureMapping.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAA0B,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAmB,SAAS,EAAE,QAAQ,EAAS,MAAM,sBAAsB,CAAC;AAEvI,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,cAAc,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAkBvJ,SAAS,sBAAsB,CAAC,GAAoB,EAAE,GAAoB;IACxE,OAAO,wBAAwB,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC;WACpF,0BAA0B,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,yBAAyB,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC;WACvG,0BAA0B,CAAC,GAAG,CAAC,cAAc,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;AAC1E,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,cAAc;IAUzB,YAAmB,EAAiB,EAAE,MAA6B;QACjE,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,gBAAgB;IACT,eAAe,CAAC,OAAwB,EAAE,iBAA4B;QAC3E,OAAO,IAAI,CAAC,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AC,EAjRgB,cAAc,KAAd,cAAc,QAiR9B;AAED,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Rendering\n */\n\nimport { IndexedPolyfaceVisitor, Matrix3d, Point2d, Point3d, PolyfaceVisitor, Transform, Vector3d, XAndY } from \"@itwin/core-geometry\";\nimport { RenderTexture } from \"./RenderTexture\";\nimport { compareBooleans, compareBooleansOrUndefined, compareNumbers, compareNumbersOrUndefined, comparePossiblyUndefined } from \"@itwin/core-bentley\";\n\n/** Defines normal map parameters.\n * @beta\n */\nexport interface NormalMapParams {\n /** The texture to use as a normal map. If not present then the pattern map texture will be used as a normal map. */\n normalMap?: RenderTexture;\n /** True if the Y component stored in the green channel should be negated. By default, positive Y points downward, but some\n * normal maps are created with positive Y pointing upward.\n */\n greenUp?: boolean;\n /** Scale factor by which to multiply the components of the normal extracted from [[normalMap]]. */\n scale?: number;\n /** True if want to use constant LOD texture mapping for the normal map texture. */\n useConstantLod?: boolean;\n}\n\nfunction compareNormalMapParams(lhs: NormalMapParams, rhs: NormalMapParams): number {\n return comparePossiblyUndefined((lh, rh) => lh.compare(rh), lhs.normalMap, rhs.normalMap)\n || compareBooleansOrUndefined(lhs.greenUp, rhs.greenUp) || compareNumbersOrUndefined(lhs.scale, rhs.scale)\n || compareBooleansOrUndefined(lhs.useConstantLod, rhs.useConstantLod);\n}\n\n/** Describes how to map a [[RenderTexture]]'s image onto a surface as part of a [[RenderMaterial]].\n * @public\n */\nexport class TextureMapping {\n /** The texture to be mapped to the surface. If normalMapParams is present but does not contain a normal map, then texture is used as a normal map rather than a pattern map. */\n public readonly texture: RenderTexture;\n /** The parameters for normal mapping.\n * @beta\n */\n public normalMapParams?: NormalMapParams;\n /** The parameters describing how the textures are mapped to the surface. */\n public readonly params: TextureMapping.Params;\n\n public constructor(tx: RenderTexture, params: TextureMapping.Params) {\n this.texture = tx;\n this.params = params;\n }\n\n /** @internal */\n public computeUVParams(visitor: PolyfaceVisitor, transformToImodel: Transform): Point2d[] | undefined {\n return this.params.computeUVParams(visitor as IndexedPolyfaceVisitor, transformToImodel);\n }\n\n /** An [OrderedComparator]($bentley) that compares this mapping against `other`. */\n public compare(other: TextureMapping): number {\n if (this === other) {\n return 0;\n }\n\n return this.texture.compare(other.texture) || this.params.compare(other.params)\n || comparePossiblyUndefined((lh, rh) => compareNormalMapParams(lh, rh), this.normalMapParams, other.normalMapParams);\n }\n}\n\n/** @public */\nexport namespace TextureMapping {\n /** Enumerates the possible texture mapping modes. */\n export enum Mode {\n None = -1,\n Parametric = 0,\n ElevationDrape = 1,\n Planar = 2,\n /** @internal */\n DirectionalDrape = 3,\n /** @internal */\n Cubic = 4,\n /** @internal */\n Spherical = 5,\n /** @internal */\n Cylindrical = 6,\n /** @internal */\n Solid = 7,\n /** @internal Only valid for lights */\n FrontProject = 8,\n }\n\n /** A 2x3 matrix for mapping a texture image to a surface. */\n export class Trans2x3 {\n /** The 3x4 transform produced from the 2x3 matrix. */\n public readonly transform: Transform;\n\n /** Construct from the two rows of the matrix:\n * ```\n * | m00 m01 originX |\n * | m10 m11 originY |\n * ```\n * Producing the [Transform]($core-geometry):\n * ```\n * | m00 m01 0 originX |\n * | m10 m11 0 originY |\n * | 0 0 1 0 |\n * ```\n */\n public constructor(m00 = 1, m01 = 0, originX = 0, m10 = 0, m11 = 1, originY = 0) {\n const origin = new Point3d(originX, originY, 0);\n const matrix = Matrix3d.createRowValues(m00, m01, 0, m10, m11, 0, 0, 0, 1);\n this.transform = Transform.createRefs(origin, matrix);\n }\n\n /** An immutable 2x3 identity matrix. */\n public static readonly identity = new Trans2x3();\n\n /** An [OrderedComparator]($bentley) that compares this Trans2x3 against `other`. */\n public compare(other: Trans2x3): number {\n if (this === other) {\n return 0;\n }\n\n const originDiff = compareNumbers(this.transform.origin.x, other.transform.origin.x) || compareNumbers(this.transform.origin.y, other.transform.origin.y);\n if (originDiff !== 0) {\n return originDiff;\n }\n\n for (const i of [0, 1, 3, 4]) {\n const matDiff = compareNumbers(this.transform.matrix.coffs[i], other.transform.matrix.coffs[i]);\n if (matDiff !== 0) {\n return matDiff;\n }\n }\n\n return 0;\n }\n }\n\n /** Properties used to construct a [[TextureMapping.ConstantLodParams]]. */\n export interface ConstantLodParamProps {\n /** The number of times the texture is repeated. Increasing this will make the texture pattern appear smaller, decreasing it will make it larger. Defaults to 1. */\n repetitions?: number;\n /** An offset in world units used to shift the texture. Defaults to (0, 0). */\n offset?: XAndY;\n /** The minimum distance (from the eye to the surface) at which to clamp the texture. Defaults to 1.*/\n minDistClamp?: number;\n /** The maximum distance (from the eye to the surface) at which to clamp the texture. Defaults to 2^32. */\n maxDistClamp?: number;\n }\n\n /** Parameters to define constant level of detail mapping mode, a mode of texture coordinate generation which dynamically creates\n * texture cooprdinates so that the level of detail of the texture in the rendered image remains somewhat constant. */\n export interface ConstantLodParams {\n /** The number of times the texture is repeated. Increasing this will make the texture pattern appear smaller, decreasing it will make it larger. */\n repetitions: number;\n /** An offset in world units used to shift the texture. */\n offset: XAndY;\n /** The minimum distance (from the eye to the surface) at which to clamp the texture. */\n minDistClamp: number;\n /** The maximum distance (from the eye to the surface) at which to clamp the texture. */\n maxDistClamp: number;\n }\n\n function compareConstantLodParams(lhs: ConstantLodParams, rhs: ConstantLodParams): number {\n return compareNumbers(lhs.repetitions, rhs.repetitions) || compareNumbers(lhs.offset.x, rhs.offset.x) || compareNumbers(lhs.offset.y, rhs.offset.y)\n || compareNumbers(lhs.minDistClamp, rhs.minDistClamp) || compareNumbers(lhs.maxDistClamp, rhs.maxDistClamp);\n }\n\n /** Properties used to construct a [[TextureMapping.Params]]. */\n export interface ParamProps {\n /** The matrix used to map the image to a surface. */\n textureMat2x3?: TextureMapping.Trans2x3;\n /** The ratio in [0, 1] with which to mix the color sampled from the texture with the surface's color.\n * A value of 0.0 uses only the surface color. A value of 1.0 uses only the texture color. A value of 0.5 uses an even mix of both.\n * @note This affects only the red, green, and blue components of the color. The alpha sampled from the texture is always multiplied by the surface color's alpha.\n * @note Defaults to 1.0\n */\n textureWeight?: number;\n /** The mode by which to map the image to a surface.\n * @note Defaults to [[TextureMapping.Mode.Parametric]].\n */\n mapMode?: TextureMapping.Mode;\n /** @internal */\n worldMapping?: boolean;\n /** True if want to use constant LOD texture mapping for the surface texture. */\n useConstantLod?: boolean;\n /** Parameters for constantLod mapping mode. */\n constantLodProps?: ConstantLodParamProps;\n }\n\n /** Parameters describing how a [[RenderTexture]]'s image is mapped to a surface. */\n export class Params {\n /** The matrix used to map the image to a surface. */\n public textureMatrix: TextureMapping.Trans2x3;\n /** The ratio in [0, 1] with which to mix the color sampled from the texture with the element's color.\n * A value of 0.0 uses only the element color. A value of 1.0 uses only the texture color.\n */\n public weight: number;\n /** The mode by which to map the image to a surface. */\n public mode: TextureMapping.Mode;\n /** @internal */\n public worldMapping: boolean;\n /** True if want to use constant LOD texture mapping for the surface texture. */\n public useConstantLod: boolean;\n /** Parameters for constantLod mapping mode. */\n public constantLodParams: ConstantLodParams;\n\n public constructor(props?: TextureMapping.ParamProps) {\n this.textureMatrix = props?.textureMat2x3 ?? Trans2x3.identity;\n this.weight = props?.textureWeight ?? 1;\n this.mode = props?.mapMode ?? Mode.Parametric;\n this.worldMapping = props?.worldMapping ?? false;\n this.useConstantLod = props?.useConstantLod ?? false;\n this.constantLodParams = {\n repetitions: props?.constantLodProps?.repetitions ?? 1,\n offset: props?.constantLodProps?.offset ?? { x: 0, y: 0 },\n minDistClamp: props?.constantLodProps?.minDistClamp ?? 1,\n maxDistClamp: props?.constantLodProps?.maxDistClamp ?? 4096 * 1024 * 1024,\n };\n }\n\n /** An [OrderedComparator]($bentley) that compares these Params against `other`. */\n public compare(other: Params): number {\n if (this === other) {\n return 0;\n }\n\n return compareNumbers(this.weight, other.weight) || compareNumbers(this.mode, other.mode) || compareBooleans(this.worldMapping, other.worldMapping)\n || compareBooleans(this.useConstantLod, other.useConstantLod) || this.textureMatrix.compare(other.textureMatrix)\n || compareConstantLodParams(this.constantLodParams, other.constantLodParams);\n }\n\n /**\n * Generates UV parameters for textured surfaces. Returns undefined on failure.\n * @internal\n */\n public computeUVParams(visitor: IndexedPolyfaceVisitor, transformToImodel: Transform): Point2d[] | undefined {\n switch (this.mode) {\n default: // Fall through to parametric in default case\n case TextureMapping.Mode.Parametric: {\n return this.computeParametricUVParams(visitor, this.textureMatrix.transform, !this.worldMapping);\n }\n case TextureMapping.Mode.Planar: {\n const normalIndices = visitor.normalIndex;\n if (!normalIndices)\n return undefined;\n\n // Ignore planar mode unless master or sub units for scaleMode and facet is planar\n if (!this.worldMapping || (visitor.normalIndex !== undefined && (normalIndices[0] !== normalIndices[1] || normalIndices[0] !== normalIndices[2]))) {\n return this.computeParametricUVParams(visitor, this.textureMatrix.transform, !this.worldMapping);\n } else {\n return this.computePlanarUVParams(visitor, this.textureMatrix.transform);\n }\n }\n case TextureMapping.Mode.ElevationDrape: {\n return this.computeElevationDrapeUVParams(visitor, this.textureMatrix.transform, transformToImodel);\n }\n }\n }\n\n /** Computes UV parameters given a texture mapping mode of parametric. */\n private computeParametricUVParams(visitor: IndexedPolyfaceVisitor, uvTransform: Transform, isRelativeUnits: boolean): Point2d[] {\n const params: Point2d[] = [];\n for (let i = 0; i < visitor.numEdgesThisFacet; i++) {\n let param = Point2d.create();\n\n if (isRelativeUnits || !visitor.tryGetDistanceParameter(i, param)) {\n if (!visitor.tryGetNormalizedParameter(i, param)) {\n // If mesh does not have facetFaceData, we still want to use the texture coordinates if they are present\n param = visitor.getParam(i)!;\n }\n }\n\n params.push(uvTransform.multiplyPoint2d(param));\n }\n return params;\n }\n\n /** Computes UV parameters given a texture mapping mode of planar. The result is stored in the Point2d array given. */\n private computePlanarUVParams(visitor: IndexedPolyfaceVisitor, uvTransform: Transform): Point2d[] | undefined {\n const params: Point2d[] = [];\n const points = visitor.point;\n let normal: Vector3d;\n\n if (visitor.normal === undefined)\n normal = points.getPoint3dAtUncheckedPointIndex(0).crossProductToPoints(points.getPoint3dAtUncheckedPointIndex(1), points.getPoint3dAtUncheckedPointIndex(2));\n else\n normal = visitor.normal.getVector3dAtCheckedVectorIndex(0)!;\n\n if (!normal.normalize(normal))\n return undefined;\n\n // adjust U texture coordinate to be a continuous length starting at the\n // origin. V coordinate stays the same. This mode assumes Z is up vector\n\n // Flipping normal puts us in a planar coordinate system consistent with MicroStation's display system\n normal.scale(-1.0, normal);\n\n // pick the first vertex normal\n const sideVector = Vector3d.create(normal.y, -normal.x, 0.0);\n\n // if the magnitude of the normal is near zero, the real normal points\n // almost straighten up.. In this case, use Y as the up vector to match QV\n\n const magnitude = sideVector.magnitude();\n sideVector.normalize(sideVector); // won't remain undefined if failed due to following check..\n\n if (magnitude < 1e-3) {\n normal.set(0, 0, -1);\n sideVector.set(1, 0, 0);\n }\n\n const upVector = sideVector.crossProduct(normal).normalize();\n if (!upVector)\n return undefined;\n\n const numEdges = visitor.numEdgesThisFacet;\n for (let i = 0; i < numEdges; i++) {\n const vector = Vector3d.createFrom(points.getPoint3dAtUncheckedPointIndex(i));\n\n params.push(Point2d.create(vector.dotProduct(sideVector), vector.dotProduct(upVector)));\n uvTransform.multiplyPoint2d(params[i], params[i]);\n }\n return params;\n }\n\n /** Computes UV parameters given a texture mapping mode of elevation drape. The result is stored in the Point2d array given. */\n private computeElevationDrapeUVParams(visitor: IndexedPolyfaceVisitor, uvTransform: Transform, transformToIModel?: Transform): Point2d[] {\n const params: Point2d[] = [];\n const numEdges = visitor.numEdgesThisFacet;\n for (let i = 0; i < numEdges; i++) {\n const point = visitor.point.getPoint3dAtUncheckedPointIndex(i);\n\n if (transformToIModel !== undefined)\n transformToIModel.multiplyPoint3d(point, point);\n\n params.push(Point2d.createFrom(point));\n uvTransform.multiplyPoint2d(params[i], params[i]);\n }\n return params;\n }\n }\n}\n\nObject.freeze(TextureMapping.Trans2x3.identity);\n"]}
@@ -74,6 +74,8 @@ export class ThematicGradientSettings {
74
74
  static get margin() { return .001; } // A fixed portion of the gradient for out of range values.
75
75
  static get contentRange() { return 1.0 - 2.0 * ThematicGradientSettings.margin; }
76
76
  static get contentMax() { return 1.0 - ThematicGradientSettings.margin; }
77
+ static { this.defaults = new ThematicGradientSettings({}); }
78
+ static { this._defaultCustomKeys = [[0.0, 255, 255, 255], [1.0, 0, 0, 0]]; }
77
79
  /** @alpha */
78
80
  get textureTransparency() {
79
81
  let transp = TextureTransparency.Opaque;
@@ -201,8 +203,6 @@ export class ThematicGradientSettings {
201
203
  return ThematicGradientSettings.fromJSON(props);
202
204
  }
203
205
  }
204
- ThematicGradientSettings.defaults = new ThematicGradientSettings({});
205
- ThematicGradientSettings._defaultCustomKeys = [[0.0, 255, 255, 255], [1.0, 0, 0, 0]];
206
206
  /** A sensor in world space, used for [[ThematicDisplayMode.InverseDistanceWeightedSensors]].
207
207
  * @public
208
208
  */