@itwin/frontend-devtools 3.5.0-dev.63 → 3.5.0-dev.66

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 (374) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/README.md +7 -4
  3. package/lib/cjs/ClipboardUtilities.d.ts +8 -8
  4. package/lib/cjs/ClipboardUtilities.js +26 -26
  5. package/lib/cjs/ClipboardUtilities.js.map +1 -1
  6. package/lib/cjs/FrontEndDevTools.d.ts +19 -19
  7. package/lib/cjs/FrontEndDevTools.d.ts.map +1 -1
  8. package/lib/cjs/FrontEndDevTools.js +221 -220
  9. package/lib/cjs/FrontEndDevTools.js.map +1 -1
  10. package/lib/cjs/effects/Convolution.d.ts +68 -68
  11. package/lib/cjs/effects/Convolution.js +165 -165
  12. package/lib/cjs/effects/Convolution.js.map +1 -1
  13. package/lib/cjs/effects/EffectTools.d.ts +33 -33
  14. package/lib/cjs/effects/EffectTools.js +68 -68
  15. package/lib/cjs/effects/EffectTools.js.map +1 -1
  16. package/lib/cjs/effects/Explosion.d.ts +12 -12
  17. package/lib/cjs/effects/Explosion.js +168 -168
  18. package/lib/cjs/effects/Explosion.js.map +1 -1
  19. package/lib/cjs/effects/FlipImage.d.ts +30 -30
  20. package/lib/cjs/effects/FlipImage.js +99 -99
  21. package/lib/cjs/effects/FlipImage.js.map +1 -1
  22. package/lib/cjs/effects/LensDistortion.d.ts +34 -34
  23. package/lib/cjs/effects/LensDistortion.js +109 -109
  24. package/lib/cjs/effects/LensDistortion.js.map +1 -1
  25. package/lib/cjs/effects/Random.d.ts +24 -24
  26. package/lib/cjs/effects/Random.js +49 -49
  27. package/lib/cjs/effects/Random.js.map +1 -1
  28. package/lib/cjs/effects/Saturation.d.ts +30 -30
  29. package/lib/cjs/effects/Saturation.js +85 -85
  30. package/lib/cjs/effects/Saturation.js.map +1 -1
  31. package/lib/cjs/effects/Snow.d.ts +76 -76
  32. package/lib/cjs/effects/Snow.js +187 -187
  33. package/lib/cjs/effects/Snow.js.map +1 -1
  34. package/lib/cjs/effects/Vignette.d.ts +39 -39
  35. package/lib/cjs/effects/Vignette.js +108 -108
  36. package/lib/cjs/effects/Vignette.js.map +1 -1
  37. package/lib/cjs/frontend-devtools.d.ts +82 -82
  38. package/lib/cjs/frontend-devtools.js +98 -98
  39. package/lib/cjs/frontend-devtools.js.map +1 -1
  40. package/lib/cjs/tools/AnimationIntervalTool.d.ts +15 -15
  41. package/lib/cjs/tools/AnimationIntervalTool.js +30 -30
  42. package/lib/cjs/tools/AnimationIntervalTool.js.map +1 -1
  43. package/lib/cjs/tools/ChangeUnitsTool.d.ts +15 -15
  44. package/lib/cjs/tools/ChangeUnitsTool.js +41 -41
  45. package/lib/cjs/tools/ChangeUnitsTool.js.map +1 -1
  46. package/lib/cjs/tools/ClipTools.d.ts +67 -67
  47. package/lib/cjs/tools/ClipTools.js +164 -164
  48. package/lib/cjs/tools/ClipTools.js.map +1 -1
  49. package/lib/cjs/tools/DisplayStyleTools.d.ts +145 -145
  50. package/lib/cjs/tools/DisplayStyleTools.js +370 -370
  51. package/lib/cjs/tools/DisplayStyleTools.js.map +1 -1
  52. package/lib/cjs/tools/EmphasizeElementsTool.d.ts +60 -60
  53. package/lib/cjs/tools/EmphasizeElementsTool.js +154 -154
  54. package/lib/cjs/tools/EmphasizeElementsTool.js.map +1 -1
  55. package/lib/cjs/tools/FrustumDecoration.d.ts +57 -57
  56. package/lib/cjs/tools/FrustumDecoration.js +374 -374
  57. package/lib/cjs/tools/FrustumDecoration.js.map +1 -1
  58. package/lib/cjs/tools/InspectElementTool.d.ts +42 -42
  59. package/lib/cjs/tools/InspectElementTool.js +198 -198
  60. package/lib/cjs/tools/InspectElementTool.js.map +1 -1
  61. package/lib/cjs/tools/MapLayerTool.d.ts +264 -264
  62. package/lib/cjs/tools/MapLayerTool.js +507 -507
  63. package/lib/cjs/tools/MapLayerTool.js.map +1 -1
  64. package/lib/cjs/tools/MeasureTileLoadTime.d.ts +12 -12
  65. package/lib/cjs/tools/MeasureTileLoadTime.js +63 -63
  66. package/lib/cjs/tools/MeasureTileLoadTime.js.map +1 -1
  67. package/lib/cjs/tools/ModelAppearanceTools.d.ts +86 -86
  68. package/lib/cjs/tools/ModelAppearanceTools.js +183 -183
  69. package/lib/cjs/tools/ModelAppearanceTools.js.map +1 -1
  70. package/lib/cjs/tools/PlanProjectionTools.d.ts +40 -40
  71. package/lib/cjs/tools/PlanProjectionTools.js +149 -149
  72. package/lib/cjs/tools/PlanProjectionTools.js.map +1 -1
  73. package/lib/cjs/tools/PlanarMaskTools.d.ts +182 -182
  74. package/lib/cjs/tools/PlanarMaskTools.js +393 -393
  75. package/lib/cjs/tools/PlanarMaskTools.js.map +1 -1
  76. package/lib/cjs/tools/ProjectExtents.d.ts +41 -41
  77. package/lib/cjs/tools/ProjectExtents.js +110 -110
  78. package/lib/cjs/tools/ProjectExtents.js.map +1 -1
  79. package/lib/cjs/tools/RealityModelTools.d.ts +116 -116
  80. package/lib/cjs/tools/RealityModelTools.js +281 -281
  81. package/lib/cjs/tools/RealityModelTools.js.map +1 -1
  82. package/lib/cjs/tools/RealityTransitionTool.d.ts +25 -25
  83. package/lib/cjs/tools/RealityTransitionTool.js +116 -116
  84. package/lib/cjs/tools/RealityTransitionTool.js.map +1 -1
  85. package/lib/cjs/tools/RenderSystemTools.d.ts +38 -38
  86. package/lib/cjs/tools/RenderSystemTools.js +70 -70
  87. package/lib/cjs/tools/RenderSystemTools.js.map +1 -1
  88. package/lib/cjs/tools/RenderTargetTools.d.ts +107 -100
  89. package/lib/cjs/tools/RenderTargetTools.d.ts.map +1 -1
  90. package/lib/cjs/tools/RenderTargetTools.js +174 -166
  91. package/lib/cjs/tools/RenderTargetTools.js.map +1 -1
  92. package/lib/cjs/tools/ReportWebGLCompatibilityTool.d.ts +11 -11
  93. package/lib/cjs/tools/ReportWebGLCompatibilityTool.js +30 -30
  94. package/lib/cjs/tools/ReportWebGLCompatibilityTool.js.map +1 -1
  95. package/lib/cjs/tools/SavedViews.d.ts +46 -46
  96. package/lib/cjs/tools/SavedViews.js +136 -136
  97. package/lib/cjs/tools/SavedViews.js.map +1 -1
  98. package/lib/cjs/tools/ScheduleScriptTools.d.ts +37 -37
  99. package/lib/cjs/tools/ScheduleScriptTools.js +159 -159
  100. package/lib/cjs/tools/ScheduleScriptTools.js.map +1 -1
  101. package/lib/cjs/tools/SelectionTools.d.ts +28 -28
  102. package/lib/cjs/tools/SelectionTools.js +87 -87
  103. package/lib/cjs/tools/SelectionTools.js.map +1 -1
  104. package/lib/cjs/tools/SetGpuMemoryLimitTool.d.ts +15 -15
  105. package/lib/cjs/tools/SetGpuMemoryLimitTool.js +33 -33
  106. package/lib/cjs/tools/SetGpuMemoryLimitTool.js.map +1 -1
  107. package/lib/cjs/tools/SourceAspectIdTools.d.ts +40 -40
  108. package/lib/cjs/tools/SourceAspectIdTools.js +86 -86
  109. package/lib/cjs/tools/SourceAspectIdTools.js.map +1 -1
  110. package/lib/cjs/tools/TileRequestDecoration.d.ts +12 -12
  111. package/lib/cjs/tools/TileRequestDecoration.js +83 -83
  112. package/lib/cjs/tools/TileRequestDecoration.js.map +1 -1
  113. package/lib/cjs/tools/TileTreeBoundsDecoration.d.ts +11 -11
  114. package/lib/cjs/tools/TileTreeBoundsDecoration.js +74 -74
  115. package/lib/cjs/tools/TileTreeBoundsDecoration.js.map +1 -1
  116. package/lib/cjs/tools/ToolTipProvider.d.ts +15 -15
  117. package/lib/cjs/tools/ToolTipProvider.js +66 -66
  118. package/lib/cjs/tools/ToolTipProvider.js.map +1 -1
  119. package/lib/cjs/tools/ViewportTools.d.ts +218 -218
  120. package/lib/cjs/tools/ViewportTools.js +516 -516
  121. package/lib/cjs/tools/ViewportTools.js.map +1 -1
  122. package/lib/cjs/tools/parseArgs.d.ts +23 -23
  123. package/lib/cjs/tools/parseArgs.js +51 -51
  124. package/lib/cjs/tools/parseArgs.js.map +1 -1
  125. package/lib/cjs/tools/parseBoolean.d.ts +8 -8
  126. package/lib/cjs/tools/parseBoolean.js +26 -26
  127. package/lib/cjs/tools/parseBoolean.js.map +1 -1
  128. package/lib/cjs/tools/parseToggle.d.ts +8 -8
  129. package/lib/cjs/tools/parseToggle.js +25 -25
  130. package/lib/cjs/tools/parseToggle.js.map +1 -1
  131. package/lib/cjs/ui/Button.d.ts +29 -29
  132. package/lib/cjs/ui/Button.js +26 -26
  133. package/lib/cjs/ui/Button.js.map +1 -1
  134. package/lib/cjs/ui/CheckBox.d.ts +23 -23
  135. package/lib/cjs/ui/CheckBox.js +27 -27
  136. package/lib/cjs/ui/CheckBox.js.map +1 -1
  137. package/lib/cjs/ui/ColorInput.d.ts +27 -27
  138. package/lib/cjs/ui/ColorInput.js +53 -53
  139. package/lib/cjs/ui/ColorInput.js.map +1 -1
  140. package/lib/cjs/ui/ComboBox.d.ts +28 -28
  141. package/lib/cjs/ui/ComboBox.js +42 -42
  142. package/lib/cjs/ui/ComboBox.js.map +1 -1
  143. package/lib/cjs/ui/DataList.d.ts +27 -27
  144. package/lib/cjs/ui/DataList.js +39 -39
  145. package/lib/cjs/ui/DataList.js.map +1 -1
  146. package/lib/cjs/ui/NestedMenu.d.ts +19 -19
  147. package/lib/cjs/ui/NestedMenu.js +46 -46
  148. package/lib/cjs/ui/NestedMenu.js.map +1 -1
  149. package/lib/cjs/ui/NumericInput.d.ts +35 -35
  150. package/lib/cjs/ui/NumericInput.js +61 -61
  151. package/lib/cjs/ui/NumericInput.js.map +1 -1
  152. package/lib/cjs/ui/RadioBox.d.ts +29 -29
  153. package/lib/cjs/ui/RadioBox.js +76 -76
  154. package/lib/cjs/ui/RadioBox.js.map +1 -1
  155. package/lib/cjs/ui/Slider.d.ts +26 -26
  156. package/lib/cjs/ui/Slider.js +34 -34
  157. package/lib/cjs/ui/Slider.js.map +1 -1
  158. package/lib/cjs/ui/TextBox.d.ts +32 -32
  159. package/lib/cjs/ui/TextBox.js +56 -56
  160. package/lib/cjs/ui/TextBox.js.map +1 -1
  161. package/lib/cjs/widgets/DiagnosticsPanel.d.ts +37 -37
  162. package/lib/cjs/widgets/DiagnosticsPanel.js +81 -81
  163. package/lib/cjs/widgets/DiagnosticsPanel.js.map +1 -1
  164. package/lib/cjs/widgets/FpsTracker.d.ts +19 -19
  165. package/lib/cjs/widgets/FpsTracker.js +56 -56
  166. package/lib/cjs/widgets/FpsTracker.js.map +1 -1
  167. package/lib/cjs/widgets/GpuProfiler.d.ts +16 -16
  168. package/lib/cjs/widgets/GpuProfiler.js +192 -192
  169. package/lib/cjs/widgets/GpuProfiler.js.map +1 -1
  170. package/lib/cjs/widgets/KeyinField.d.ts +61 -61
  171. package/lib/cjs/widgets/KeyinField.js +187 -187
  172. package/lib/cjs/widgets/KeyinField.js.map +1 -1
  173. package/lib/cjs/widgets/MemoryTracker.d.ts +27 -27
  174. package/lib/cjs/widgets/MemoryTracker.js +243 -243
  175. package/lib/cjs/widgets/MemoryTracker.js.map +1 -1
  176. package/lib/cjs/widgets/RenderCommandBreakdown.d.ts +15 -15
  177. package/lib/cjs/widgets/RenderCommandBreakdown.js +68 -68
  178. package/lib/cjs/widgets/RenderCommandBreakdown.js.map +1 -1
  179. package/lib/cjs/widgets/TileMemoryBreakdown.d.ts +30 -30
  180. package/lib/cjs/widgets/TileMemoryBreakdown.js +204 -204
  181. package/lib/cjs/widgets/TileMemoryBreakdown.js.map +1 -1
  182. package/lib/cjs/widgets/TileStatisticsTracker.d.ts +21 -21
  183. package/lib/cjs/widgets/TileStatisticsTracker.js +142 -142
  184. package/lib/cjs/widgets/TileStatisticsTracker.js.map +1 -1
  185. package/lib/cjs/widgets/ToolSettingsTracker.d.ts +9 -9
  186. package/lib/cjs/widgets/ToolSettingsTracker.js +211 -211
  187. package/lib/cjs/widgets/ToolSettingsTracker.js.map +1 -1
  188. package/lib/esm/ClipboardUtilities.d.ts +8 -8
  189. package/lib/esm/ClipboardUtilities.js +22 -22
  190. package/lib/esm/ClipboardUtilities.js.map +1 -1
  191. package/lib/esm/FrontEndDevTools.d.ts +19 -19
  192. package/lib/esm/FrontEndDevTools.d.ts.map +1 -1
  193. package/lib/esm/FrontEndDevTools.js +217 -216
  194. package/lib/esm/FrontEndDevTools.js.map +1 -1
  195. package/lib/esm/effects/Convolution.d.ts +68 -68
  196. package/lib/esm/effects/Convolution.js +155 -155
  197. package/lib/esm/effects/Convolution.js.map +1 -1
  198. package/lib/esm/effects/EffectTools.d.ts +33 -33
  199. package/lib/esm/effects/EffectTools.js +62 -62
  200. package/lib/esm/effects/EffectTools.js.map +1 -1
  201. package/lib/esm/effects/Explosion.d.ts +12 -12
  202. package/lib/esm/effects/Explosion.js +164 -164
  203. package/lib/esm/effects/Explosion.js.map +1 -1
  204. package/lib/esm/effects/FlipImage.d.ts +30 -30
  205. package/lib/esm/effects/FlipImage.js +94 -94
  206. package/lib/esm/effects/FlipImage.js.map +1 -1
  207. package/lib/esm/effects/LensDistortion.d.ts +34 -34
  208. package/lib/esm/effects/LensDistortion.js +104 -104
  209. package/lib/esm/effects/LensDistortion.js.map +1 -1
  210. package/lib/esm/effects/Random.d.ts +24 -24
  211. package/lib/esm/effects/Random.js +41 -41
  212. package/lib/esm/effects/Random.js.map +1 -1
  213. package/lib/esm/effects/Saturation.d.ts +30 -30
  214. package/lib/esm/effects/Saturation.js +80 -80
  215. package/lib/esm/effects/Saturation.js.map +1 -1
  216. package/lib/esm/effects/Snow.d.ts +76 -76
  217. package/lib/esm/effects/Snow.js +182 -182
  218. package/lib/esm/effects/Snow.js.map +1 -1
  219. package/lib/esm/effects/Vignette.d.ts +39 -39
  220. package/lib/esm/effects/Vignette.js +103 -103
  221. package/lib/esm/effects/Vignette.js.map +1 -1
  222. package/lib/esm/frontend-devtools.d.ts +82 -82
  223. package/lib/esm/frontend-devtools.js +86 -86
  224. package/lib/esm/frontend-devtools.js.map +1 -1
  225. package/lib/esm/tools/AnimationIntervalTool.d.ts +15 -15
  226. package/lib/esm/tools/AnimationIntervalTool.js +26 -26
  227. package/lib/esm/tools/AnimationIntervalTool.js.map +1 -1
  228. package/lib/esm/tools/ChangeUnitsTool.d.ts +15 -15
  229. package/lib/esm/tools/ChangeUnitsTool.js +37 -37
  230. package/lib/esm/tools/ChangeUnitsTool.js.map +1 -1
  231. package/lib/esm/tools/ClipTools.d.ts +67 -67
  232. package/lib/esm/tools/ClipTools.js +158 -158
  233. package/lib/esm/tools/ClipTools.js.map +1 -1
  234. package/lib/esm/tools/DisplayStyleTools.d.ts +145 -145
  235. package/lib/esm/tools/DisplayStyleTools.js +356 -356
  236. package/lib/esm/tools/DisplayStyleTools.js.map +1 -1
  237. package/lib/esm/tools/EmphasizeElementsTool.d.ts +60 -60
  238. package/lib/esm/tools/EmphasizeElementsTool.js +145 -145
  239. package/lib/esm/tools/EmphasizeElementsTool.js.map +1 -1
  240. package/lib/esm/tools/FrustumDecoration.d.ts +57 -57
  241. package/lib/esm/tools/FrustumDecoration.js +367 -367
  242. package/lib/esm/tools/FrustumDecoration.js.map +1 -1
  243. package/lib/esm/tools/InspectElementTool.d.ts +42 -42
  244. package/lib/esm/tools/InspectElementTool.js +194 -194
  245. package/lib/esm/tools/InspectElementTool.js.map +1 -1
  246. package/lib/esm/tools/MapLayerTool.d.ts +264 -264
  247. package/lib/esm/tools/MapLayerTool.js +485 -485
  248. package/lib/esm/tools/MapLayerTool.js.map +1 -1
  249. package/lib/esm/tools/MeasureTileLoadTime.d.ts +12 -12
  250. package/lib/esm/tools/MeasureTileLoadTime.js +59 -59
  251. package/lib/esm/tools/MeasureTileLoadTime.js.map +1 -1
  252. package/lib/esm/tools/ModelAppearanceTools.d.ts +86 -86
  253. package/lib/esm/tools/ModelAppearanceTools.js +172 -172
  254. package/lib/esm/tools/ModelAppearanceTools.js.map +1 -1
  255. package/lib/esm/tools/PlanProjectionTools.d.ts +40 -40
  256. package/lib/esm/tools/PlanProjectionTools.js +143 -143
  257. package/lib/esm/tools/PlanProjectionTools.js.map +1 -1
  258. package/lib/esm/tools/PlanarMaskTools.d.ts +182 -182
  259. package/lib/esm/tools/PlanarMaskTools.js +377 -377
  260. package/lib/esm/tools/PlanarMaskTools.js.map +1 -1
  261. package/lib/esm/tools/ProjectExtents.d.ts +41 -41
  262. package/lib/esm/tools/ProjectExtents.js +104 -104
  263. package/lib/esm/tools/ProjectExtents.js.map +1 -1
  264. package/lib/esm/tools/RealityModelTools.d.ts +116 -116
  265. package/lib/esm/tools/RealityModelTools.js +268 -268
  266. package/lib/esm/tools/RealityModelTools.js.map +1 -1
  267. package/lib/esm/tools/RealityTransitionTool.d.ts +25 -25
  268. package/lib/esm/tools/RealityTransitionTool.js +112 -112
  269. package/lib/esm/tools/RealityTransitionTool.js.map +1 -1
  270. package/lib/esm/tools/RenderSystemTools.d.ts +38 -38
  271. package/lib/esm/tools/RenderSystemTools.js +63 -63
  272. package/lib/esm/tools/RenderSystemTools.js.map +1 -1
  273. package/lib/esm/tools/RenderTargetTools.d.ts +107 -100
  274. package/lib/esm/tools/RenderTargetTools.d.ts.map +1 -1
  275. package/lib/esm/tools/RenderTargetTools.js +159 -152
  276. package/lib/esm/tools/RenderTargetTools.js.map +1 -1
  277. package/lib/esm/tools/ReportWebGLCompatibilityTool.d.ts +11 -11
  278. package/lib/esm/tools/ReportWebGLCompatibilityTool.js +26 -26
  279. package/lib/esm/tools/ReportWebGLCompatibilityTool.js.map +1 -1
  280. package/lib/esm/tools/SavedViews.d.ts +46 -46
  281. package/lib/esm/tools/SavedViews.js +128 -128
  282. package/lib/esm/tools/SavedViews.js.map +1 -1
  283. package/lib/esm/tools/ScheduleScriptTools.d.ts +37 -37
  284. package/lib/esm/tools/ScheduleScriptTools.js +153 -153
  285. package/lib/esm/tools/ScheduleScriptTools.js.map +1 -1
  286. package/lib/esm/tools/SelectionTools.d.ts +28 -28
  287. package/lib/esm/tools/SelectionTools.js +82 -82
  288. package/lib/esm/tools/SelectionTools.js.map +1 -1
  289. package/lib/esm/tools/SetGpuMemoryLimitTool.d.ts +15 -15
  290. package/lib/esm/tools/SetGpuMemoryLimitTool.js +29 -29
  291. package/lib/esm/tools/SetGpuMemoryLimitTool.js.map +1 -1
  292. package/lib/esm/tools/SourceAspectIdTools.d.ts +40 -40
  293. package/lib/esm/tools/SourceAspectIdTools.js +80 -80
  294. package/lib/esm/tools/SourceAspectIdTools.js.map +1 -1
  295. package/lib/esm/tools/TileRequestDecoration.d.ts +12 -12
  296. package/lib/esm/tools/TileRequestDecoration.js +79 -79
  297. package/lib/esm/tools/TileRequestDecoration.js.map +1 -1
  298. package/lib/esm/tools/TileTreeBoundsDecoration.d.ts +11 -11
  299. package/lib/esm/tools/TileTreeBoundsDecoration.js +70 -70
  300. package/lib/esm/tools/TileTreeBoundsDecoration.js.map +1 -1
  301. package/lib/esm/tools/ToolTipProvider.d.ts +15 -15
  302. package/lib/esm/tools/ToolTipProvider.js +62 -62
  303. package/lib/esm/tools/ToolTipProvider.js.map +1 -1
  304. package/lib/esm/tools/ViewportTools.d.ts +218 -218
  305. package/lib/esm/tools/ViewportTools.js +492 -492
  306. package/lib/esm/tools/ViewportTools.js.map +1 -1
  307. package/lib/esm/tools/parseArgs.d.ts +23 -23
  308. package/lib/esm/tools/parseArgs.js +47 -47
  309. package/lib/esm/tools/parseArgs.js.map +1 -1
  310. package/lib/esm/tools/parseBoolean.d.ts +8 -8
  311. package/lib/esm/tools/parseBoolean.js +22 -22
  312. package/lib/esm/tools/parseBoolean.js.map +1 -1
  313. package/lib/esm/tools/parseToggle.d.ts +8 -8
  314. package/lib/esm/tools/parseToggle.js +21 -21
  315. package/lib/esm/tools/parseToggle.js.map +1 -1
  316. package/lib/esm/ui/Button.d.ts +29 -29
  317. package/lib/esm/ui/Button.js +22 -22
  318. package/lib/esm/ui/Button.js.map +1 -1
  319. package/lib/esm/ui/CheckBox.d.ts +23 -23
  320. package/lib/esm/ui/CheckBox.js +23 -23
  321. package/lib/esm/ui/CheckBox.js.map +1 -1
  322. package/lib/esm/ui/ColorInput.d.ts +27 -27
  323. package/lib/esm/ui/ColorInput.js +48 -48
  324. package/lib/esm/ui/ColorInput.js.map +1 -1
  325. package/lib/esm/ui/ComboBox.d.ts +28 -28
  326. package/lib/esm/ui/ComboBox.js +38 -38
  327. package/lib/esm/ui/ComboBox.js.map +1 -1
  328. package/lib/esm/ui/DataList.d.ts +27 -27
  329. package/lib/esm/ui/DataList.js +34 -34
  330. package/lib/esm/ui/DataList.js.map +1 -1
  331. package/lib/esm/ui/NestedMenu.d.ts +19 -19
  332. package/lib/esm/ui/NestedMenu.js +42 -42
  333. package/lib/esm/ui/NestedMenu.js.map +1 -1
  334. package/lib/esm/ui/NumericInput.d.ts +35 -35
  335. package/lib/esm/ui/NumericInput.js +56 -56
  336. package/lib/esm/ui/NumericInput.js.map +1 -1
  337. package/lib/esm/ui/RadioBox.d.ts +29 -29
  338. package/lib/esm/ui/RadioBox.js +72 -72
  339. package/lib/esm/ui/RadioBox.js.map +1 -1
  340. package/lib/esm/ui/Slider.d.ts +26 -26
  341. package/lib/esm/ui/Slider.js +30 -30
  342. package/lib/esm/ui/Slider.js.map +1 -1
  343. package/lib/esm/ui/TextBox.d.ts +32 -32
  344. package/lib/esm/ui/TextBox.js +52 -52
  345. package/lib/esm/ui/TextBox.js.map +1 -1
  346. package/lib/esm/widgets/DiagnosticsPanel.d.ts +37 -37
  347. package/lib/esm/widgets/DiagnosticsPanel.js +77 -77
  348. package/lib/esm/widgets/DiagnosticsPanel.js.map +1 -1
  349. package/lib/esm/widgets/FpsTracker.d.ts +19 -19
  350. package/lib/esm/widgets/FpsTracker.js +52 -52
  351. package/lib/esm/widgets/FpsTracker.js.map +1 -1
  352. package/lib/esm/widgets/GpuProfiler.d.ts +16 -16
  353. package/lib/esm/widgets/GpuProfiler.js +188 -188
  354. package/lib/esm/widgets/GpuProfiler.js.map +1 -1
  355. package/lib/esm/widgets/KeyinField.d.ts +61 -61
  356. package/lib/esm/widgets/KeyinField.js +183 -183
  357. package/lib/esm/widgets/KeyinField.js.map +1 -1
  358. package/lib/esm/widgets/MemoryTracker.d.ts +27 -27
  359. package/lib/esm/widgets/MemoryTracker.js +238 -238
  360. package/lib/esm/widgets/MemoryTracker.js.map +1 -1
  361. package/lib/esm/widgets/RenderCommandBreakdown.d.ts +15 -15
  362. package/lib/esm/widgets/RenderCommandBreakdown.js +64 -64
  363. package/lib/esm/widgets/RenderCommandBreakdown.js.map +1 -1
  364. package/lib/esm/widgets/TileMemoryBreakdown.d.ts +30 -30
  365. package/lib/esm/widgets/TileMemoryBreakdown.js +200 -200
  366. package/lib/esm/widgets/TileMemoryBreakdown.js.map +1 -1
  367. package/lib/esm/widgets/TileStatisticsTracker.d.ts +21 -21
  368. package/lib/esm/widgets/TileStatisticsTracker.js +138 -138
  369. package/lib/esm/widgets/TileStatisticsTracker.js.map +1 -1
  370. package/lib/esm/widgets/ToolSettingsTracker.d.ts +9 -9
  371. package/lib/esm/widgets/ToolSettingsTracker.js +207 -207
  372. package/lib/esm/widgets/ToolSettingsTracker.js.map +1 -1
  373. package/lib/public/locales/en/FrontendDevTools.json +484 -481
  374. package/package.json +8 -8
@@ -1,188 +1,188 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- /** @packageDocumentation
7
- * @module Effects
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.SnowEffect = exports.SnowDecorator = void 0;
11
- const core_bentley_1 = require("@itwin/core-bentley");
12
- const core_geometry_1 = require("@itwin/core-geometry");
13
- const core_common_1 = require("@itwin/core-common");
14
- const core_frontend_1 = require("@itwin/core-frontend");
15
- const parseToggle_1 = require("../tools/parseToggle");
16
- const Random_1 = require("./Random");
17
- /** The default snow effect parameters used by newly-created SnowDecorators. */
18
- const defaultSnowParams = {
19
- numParticles: 2000,
20
- sizeRange: core_geometry_1.Range1d.createXX(3, 22),
21
- transparencyRange: core_geometry_1.Range1d.createXX(0, 50),
22
- velocityRange: new core_geometry_1.Range2d(-30, 50, 30, 130),
23
- accelerationRange: new core_geometry_1.Range2d(-1, -0.25, 1, 0.25),
24
- windVelocity: 0,
25
- };
26
- /** Simulates snowfall in a [Viewport]($frontend) using particle effects.
27
- * @see [[SnowEffect]] for a [Tool]($frontend) that toggles this decorator.
28
- * @see [ParticleCollectionBuilder]($frontend) for defining custom particle effects.
29
- * @beta
30
- */
31
- class SnowDecorator {
32
- constructor(viewport, texture) {
33
- /** The list of particles being drawn. */
34
- this._particles = [];
35
- this._params = { ...defaultSnowParams };
36
- this.viewport = viewport;
37
- this._dimensions = new core_geometry_1.Point2d(viewport.viewRect.width, viewport.viewRect.height);
38
- this._lastUpdateTime = Date.now();
39
- this._texture = texture;
40
- // Tell the viewport to re-render the decorations every frame so that the snow particles animate smoothly.
41
- const removeOnRender = viewport.onRender.addListener(() => viewport.invalidateDecorations());
42
- // When the viewport is resized, replace this decorator with a new one to match the new dimensions.
43
- const removeOnResized = viewport.onResized.addListener(() => {
44
- // Transfer ownership of the texture to the new decorator.
45
- const tex = this._texture;
46
- this._texture = undefined;
47
- this.dispose();
48
- new SnowDecorator(viewport, tex);
49
- });
50
- // When the viewport is destroyed, dispose of this decorator too.
51
- const removeOnDispose = viewport.onDisposed.addListener(() => this.dispose());
52
- const removeDecorator = core_frontend_1.IModelApp.viewManager.addDecorator(this);
53
- this.dispose = () => {
54
- removeDecorator();
55
- removeOnRender();
56
- removeOnDispose();
57
- removeOnResized();
58
- this._texture = (0, core_bentley_1.dispose)(this._texture);
59
- SnowDecorator._decorators.delete(viewport);
60
- };
61
- SnowDecorator._decorators.set(viewport, this);
62
- // Initialize the particles.
63
- for (let i = 0; i < this._params.numParticles; i++)
64
- this._particles.push(this.emit(true));
65
- }
66
- decorate(context) {
67
- if (context.viewport !== this.viewport || !this._texture)
68
- return;
69
- // Update the particles.
70
- const now = Date.now();
71
- const deltaMillis = now - this._lastUpdateTime;
72
- this._lastUpdateTime = now;
73
- this.updateParticles(deltaMillis / 1000);
74
- // Create particle graphics.
75
- const builder = core_frontend_1.ParticleCollectionBuilder.create({
76
- viewport: this.viewport,
77
- isViewCoords: true,
78
- texture: this._texture,
79
- size: (this._params.sizeRange.high - this._params.sizeRange.low) / 2,
80
- });
81
- for (const particle of this._particles)
82
- builder.addParticle(particle);
83
- const graphic = builder.finish();
84
- if (graphic)
85
- context.addDecoration(core_frontend_1.GraphicType.ViewOverlay, graphic);
86
- }
87
- /** Change some of the parameters affecting this decorator. */
88
- configure(params) {
89
- for (const key of Object.keys(params)) {
90
- const val = params[key];
91
- if (undefined !== val)
92
- this._params[key] = val;
93
- }
94
- }
95
- /** Emit a new particle with randomized properties. */
96
- emit(randomizeHeight) {
97
- return {
98
- x: (0, Random_1.randomInteger)(0, this._dimensions.x),
99
- y: randomizeHeight ? (0, Random_1.randomInteger)(0, this._dimensions.y) : 0,
100
- z: 0,
101
- size: (0, Random_1.randomInteger)(this._params.sizeRange.low, this._params.sizeRange.high),
102
- transparency: (0, Random_1.randomInteger)(this._params.transparencyRange.low, this._params.transparencyRange.high),
103
- velocity: new core_geometry_1.Vector2d((0, Random_1.randomFloat)(this._params.velocityRange.low.x, this._params.velocityRange.high.x), (0, Random_1.randomFloat)(this._params.velocityRange.low.y, this._params.velocityRange.high.y)),
104
- };
105
- }
106
- // Update the positions and velocities of all the particles based on the amount of time that has passed since the last update.
107
- updateParticles(elapsedSeconds) {
108
- // Determine if someone changed the desired number of particles.
109
- const particleDiscrepancy = this._params.numParticles - this._particles.length;
110
- if (particleDiscrepancy > 0) {
111
- // Birth new particles up to the new maximum.
112
- for (let i = 0; i < particleDiscrepancy; i++)
113
- this._particles.push(this.emit(true));
114
- }
115
- else {
116
- // Destroy extra particles.
117
- this._particles.length = this._params.numParticles;
118
- }
119
- const acceleration = new core_geometry_1.Vector2d();
120
- const velocity = new core_geometry_1.Vector2d();
121
- for (let i = 0; i < this._particles.length; i++) {
122
- // Apply some acceleration to produce random drift.
123
- const particle = this._particles[i];
124
- acceleration.set((0, Random_1.randomFloat)(this._params.accelerationRange.low.x, this._params.accelerationRange.high.x), (0, Random_1.randomFloat)(this._params.accelerationRange.low.y, this._params.accelerationRange.high.y));
125
- acceleration.scale(elapsedSeconds, acceleration);
126
- particle.velocity.plus(acceleration, particle.velocity);
127
- // Apply velocity.
128
- particle.velocity.clone(velocity);
129
- velocity.scale(elapsedSeconds, velocity);
130
- particle.x += velocity.x;
131
- particle.y += velocity.y;
132
- // Apply wind
133
- particle.x += this._params.windVelocity * elapsedSeconds;
134
- // Particles that travel beyond the viewport's left or right edges wrap around to the other side.
135
- if (particle.x < 0)
136
- particle.x = this._dimensions.x - 1;
137
- else if (particle.x >= this._dimensions.x)
138
- particle.x = 0;
139
- // Particles that travel beyond the viewport's bottom or top edges are replaced by newborn particles.
140
- if (particle.y < 0 || particle.y >= this._dimensions.y)
141
- this._particles[i] = this.emit(false);
142
- }
143
- }
144
- /** Toggle this decorator for the specified viewport.
145
- * @param viewport The viewport to which the effect should be applied or removed.
146
- * @param enable `true` to enable the effect, `false` to disable it, or `undefined` to toggle the current state.
147
- */
148
- static async toggle(viewport, enable) {
149
- const decorator = this._decorators.get(viewport);
150
- if (undefined === enable)
151
- enable = undefined === decorator;
152
- if (undefined !== decorator && !enable)
153
- decorator.dispose();
154
- else if (undefined === decorator && enable) {
155
- // Create a texture to use for the particles.
156
- // Note: the decorator takes ownership of the texture, and disposes of it when the decorator is disposed.
157
- const image = await (0, core_frontend_1.imageElementFromUrl)(`${core_frontend_1.IModelApp.publicPath}sprites/particle_snow.png`);
158
- const texture = core_frontend_1.IModelApp.renderSystem.createTexture({
159
- ownership: "external",
160
- image: { source: image, transparency: core_common_1.TextureTransparency.Mixed },
161
- });
162
- new SnowDecorator(viewport, texture);
163
- }
164
- }
165
- }
166
- exports.SnowDecorator = SnowDecorator;
167
- SnowDecorator._decorators = new Map();
168
- /** Toggles a decorator that simulates snow using particle effects.
169
- * @see [[SnowDecorator]] for the implementation of the decorator.
170
- * @beta
171
- */
172
- class SnowEffect extends core_frontend_1.Tool {
173
- async run(enable) {
174
- const vp = core_frontend_1.IModelApp.viewManager.selectedView;
175
- if (vp)
176
- await SnowDecorator.toggle(vp, enable);
177
- return true;
178
- }
179
- async parseAndRun(...args) {
180
- const enable = (0, parseToggle_1.parseToggle)(args[0]);
181
- if (typeof enable !== "string")
182
- await this.run(enable);
183
- return true;
184
- }
185
- }
186
- exports.SnowEffect = SnowEffect;
187
- SnowEffect.toolId = "SnowEffect";
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module Effects
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.SnowEffect = exports.SnowDecorator = void 0;
11
+ const core_bentley_1 = require("@itwin/core-bentley");
12
+ const core_geometry_1 = require("@itwin/core-geometry");
13
+ const core_common_1 = require("@itwin/core-common");
14
+ const core_frontend_1 = require("@itwin/core-frontend");
15
+ const parseToggle_1 = require("../tools/parseToggle");
16
+ const Random_1 = require("./Random");
17
+ /** The default snow effect parameters used by newly-created SnowDecorators. */
18
+ const defaultSnowParams = {
19
+ numParticles: 2000,
20
+ sizeRange: core_geometry_1.Range1d.createXX(3, 22),
21
+ transparencyRange: core_geometry_1.Range1d.createXX(0, 50),
22
+ velocityRange: new core_geometry_1.Range2d(-30, 50, 30, 130),
23
+ accelerationRange: new core_geometry_1.Range2d(-1, -0.25, 1, 0.25),
24
+ windVelocity: 0,
25
+ };
26
+ /** Simulates snowfall in a [Viewport]($frontend) using particle effects.
27
+ * @see [[SnowEffect]] for a [Tool]($frontend) that toggles this decorator.
28
+ * @see [ParticleCollectionBuilder]($frontend) for defining custom particle effects.
29
+ * @beta
30
+ */
31
+ class SnowDecorator {
32
+ constructor(viewport, texture) {
33
+ /** The list of particles being drawn. */
34
+ this._particles = [];
35
+ this._params = { ...defaultSnowParams };
36
+ this.viewport = viewport;
37
+ this._dimensions = new core_geometry_1.Point2d(viewport.viewRect.width, viewport.viewRect.height);
38
+ this._lastUpdateTime = Date.now();
39
+ this._texture = texture;
40
+ // Tell the viewport to re-render the decorations every frame so that the snow particles animate smoothly.
41
+ const removeOnRender = viewport.onRender.addListener(() => viewport.invalidateDecorations());
42
+ // When the viewport is resized, replace this decorator with a new one to match the new dimensions.
43
+ const removeOnResized = viewport.onResized.addListener(() => {
44
+ // Transfer ownership of the texture to the new decorator.
45
+ const tex = this._texture;
46
+ this._texture = undefined;
47
+ this.dispose();
48
+ new SnowDecorator(viewport, tex);
49
+ });
50
+ // When the viewport is destroyed, dispose of this decorator too.
51
+ const removeOnDispose = viewport.onDisposed.addListener(() => this.dispose());
52
+ const removeDecorator = core_frontend_1.IModelApp.viewManager.addDecorator(this);
53
+ this.dispose = () => {
54
+ removeDecorator();
55
+ removeOnRender();
56
+ removeOnDispose();
57
+ removeOnResized();
58
+ this._texture = (0, core_bentley_1.dispose)(this._texture);
59
+ SnowDecorator._decorators.delete(viewport);
60
+ };
61
+ SnowDecorator._decorators.set(viewport, this);
62
+ // Initialize the particles.
63
+ for (let i = 0; i < this._params.numParticles; i++)
64
+ this._particles.push(this.emit(true));
65
+ }
66
+ decorate(context) {
67
+ if (context.viewport !== this.viewport || !this._texture)
68
+ return;
69
+ // Update the particles.
70
+ const now = Date.now();
71
+ const deltaMillis = now - this._lastUpdateTime;
72
+ this._lastUpdateTime = now;
73
+ this.updateParticles(deltaMillis / 1000);
74
+ // Create particle graphics.
75
+ const builder = core_frontend_1.ParticleCollectionBuilder.create({
76
+ viewport: this.viewport,
77
+ isViewCoords: true,
78
+ texture: this._texture,
79
+ size: (this._params.sizeRange.high - this._params.sizeRange.low) / 2,
80
+ });
81
+ for (const particle of this._particles)
82
+ builder.addParticle(particle);
83
+ const graphic = builder.finish();
84
+ if (graphic)
85
+ context.addDecoration(core_frontend_1.GraphicType.ViewOverlay, graphic);
86
+ }
87
+ /** Change some of the parameters affecting this decorator. */
88
+ configure(params) {
89
+ for (const key of Object.keys(params)) {
90
+ const val = params[key];
91
+ if (undefined !== val)
92
+ this._params[key] = val;
93
+ }
94
+ }
95
+ /** Emit a new particle with randomized properties. */
96
+ emit(randomizeHeight) {
97
+ return {
98
+ x: (0, Random_1.randomInteger)(0, this._dimensions.x),
99
+ y: randomizeHeight ? (0, Random_1.randomInteger)(0, this._dimensions.y) : 0,
100
+ z: 0,
101
+ size: (0, Random_1.randomInteger)(this._params.sizeRange.low, this._params.sizeRange.high),
102
+ transparency: (0, Random_1.randomInteger)(this._params.transparencyRange.low, this._params.transparencyRange.high),
103
+ velocity: new core_geometry_1.Vector2d((0, Random_1.randomFloat)(this._params.velocityRange.low.x, this._params.velocityRange.high.x), (0, Random_1.randomFloat)(this._params.velocityRange.low.y, this._params.velocityRange.high.y)),
104
+ };
105
+ }
106
+ // Update the positions and velocities of all the particles based on the amount of time that has passed since the last update.
107
+ updateParticles(elapsedSeconds) {
108
+ // Determine if someone changed the desired number of particles.
109
+ const particleDiscrepancy = this._params.numParticles - this._particles.length;
110
+ if (particleDiscrepancy > 0) {
111
+ // Birth new particles up to the new maximum.
112
+ for (let i = 0; i < particleDiscrepancy; i++)
113
+ this._particles.push(this.emit(true));
114
+ }
115
+ else {
116
+ // Destroy extra particles.
117
+ this._particles.length = this._params.numParticles;
118
+ }
119
+ const acceleration = new core_geometry_1.Vector2d();
120
+ const velocity = new core_geometry_1.Vector2d();
121
+ for (let i = 0; i < this._particles.length; i++) {
122
+ // Apply some acceleration to produce random drift.
123
+ const particle = this._particles[i];
124
+ acceleration.set((0, Random_1.randomFloat)(this._params.accelerationRange.low.x, this._params.accelerationRange.high.x), (0, Random_1.randomFloat)(this._params.accelerationRange.low.y, this._params.accelerationRange.high.y));
125
+ acceleration.scale(elapsedSeconds, acceleration);
126
+ particle.velocity.plus(acceleration, particle.velocity);
127
+ // Apply velocity.
128
+ particle.velocity.clone(velocity);
129
+ velocity.scale(elapsedSeconds, velocity);
130
+ particle.x += velocity.x;
131
+ particle.y += velocity.y;
132
+ // Apply wind
133
+ particle.x += this._params.windVelocity * elapsedSeconds;
134
+ // Particles that travel beyond the viewport's left or right edges wrap around to the other side.
135
+ if (particle.x < 0)
136
+ particle.x = this._dimensions.x - 1;
137
+ else if (particle.x >= this._dimensions.x)
138
+ particle.x = 0;
139
+ // Particles that travel beyond the viewport's bottom or top edges are replaced by newborn particles.
140
+ if (particle.y < 0 || particle.y >= this._dimensions.y)
141
+ this._particles[i] = this.emit(false);
142
+ }
143
+ }
144
+ /** Toggle this decorator for the specified viewport.
145
+ * @param viewport The viewport to which the effect should be applied or removed.
146
+ * @param enable `true` to enable the effect, `false` to disable it, or `undefined` to toggle the current state.
147
+ */
148
+ static async toggle(viewport, enable) {
149
+ const decorator = this._decorators.get(viewport);
150
+ if (undefined === enable)
151
+ enable = undefined === decorator;
152
+ if (undefined !== decorator && !enable)
153
+ decorator.dispose();
154
+ else if (undefined === decorator && enable) {
155
+ // Create a texture to use for the particles.
156
+ // Note: the decorator takes ownership of the texture, and disposes of it when the decorator is disposed.
157
+ const image = await (0, core_frontend_1.imageElementFromUrl)(`${core_frontend_1.IModelApp.publicPath}sprites/particle_snow.png`);
158
+ const texture = core_frontend_1.IModelApp.renderSystem.createTexture({
159
+ ownership: "external",
160
+ image: { source: image, transparency: core_common_1.TextureTransparency.Mixed },
161
+ });
162
+ new SnowDecorator(viewport, texture);
163
+ }
164
+ }
165
+ }
166
+ exports.SnowDecorator = SnowDecorator;
167
+ SnowDecorator._decorators = new Map();
168
+ /** Toggles a decorator that simulates snow using particle effects.
169
+ * @see [[SnowDecorator]] for the implementation of the decorator.
170
+ * @beta
171
+ */
172
+ class SnowEffect extends core_frontend_1.Tool {
173
+ async run(enable) {
174
+ const vp = core_frontend_1.IModelApp.viewManager.selectedView;
175
+ if (vp)
176
+ await SnowDecorator.toggle(vp, enable);
177
+ return true;
178
+ }
179
+ async parseAndRun(...args) {
180
+ const enable = (0, parseToggle_1.parseToggle)(args[0]);
181
+ if (typeof enable !== "string")
182
+ await this.run(enable);
183
+ return true;
184
+ }
185
+ }
186
+ exports.SnowEffect = SnowEffect;
187
+ SnowEffect.toolId = "SnowEffect";
188
188
  //# sourceMappingURL=Snow.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Snow.js","sourceRoot":"","sources":["../../../src/effects/Snow.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA8C;AAC9C,wDAA2E;AAC3E,oDAAwE;AACxE,wDAE8B;AAC9B,sDAAmD;AACnD,qCAAsD;AAkCtD,+EAA+E;AAC/E,MAAM,iBAAiB,GAAe;IACpC,YAAY,EAAE,IAAI;IAClB,SAAS,EAAE,uBAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC;IAClC,iBAAiB,EAAE,uBAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC;IAC1C,aAAa,EAAE,IAAI,uBAAO,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC;IAC5C,iBAAiB,EAAE,IAAI,uBAAO,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC;IAClD,YAAY,EAAE,CAAC;CAChB,CAAC;AAEF;;;;GAIG;AACH,MAAa,aAAa;IAexB,YAAoB,QAAkB,EAAE,OAAkC;QAR1E,yCAAyC;QACxB,eAAU,GAAmB,EAAE,CAAC;QAQ/C,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,iBAAiB,EAAE,CAAC;QACxC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,IAAI,uBAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAClF,IA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U;gBACrB,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,iCAAmB,CAAC,KAAK,EAAE;aAClE,CAAC,CAAC;YAEH,IAAI,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;SACtC;IACH,CAAC;;AA3KH,sCA4KC;AAzByB,yBAAW,GAAG,IAAI,GAAG,EAA2B,CAAC;AA2B3E;;;GAGG;AACH,MAAa,UAAW,SAAQ,oBAAI;IAGlB,KAAK,CAAC,GAAG,CAAC,MAAgB;QACxC,MAAM,EAAE,GAAG,yBAAS,CAAC,WAAW,CAAC,YAAY,CAAC;QAC9C,IAAI,EAAE;YACJ,MAAM,aAAa,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;QAEzC,OAAO,IAAI,CAAC;IACd,CAAC;IAEe,KAAK,CAAC,WAAW,CAAC,GAAG,IAAc;QACjD,MAAM,MAAM,GAAG,IAAA,yBAAW,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,IAAI,OAAO,MAAM,KAAK,QAAQ;YAC5B,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAEzB,OAAO,IAAI,CAAC;IACd,CAAC;;AAjBH,gCAkBC;AAjBwB,iBAAM,GAAG,YAAY,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Effects\r\n */\r\n\r\nimport { dispose } from \"@itwin/core-bentley\";\r\nimport { Point2d, Range1d, Range2d, Vector2d } from \"@itwin/core-geometry\";\r\nimport { RenderTexture, TextureTransparency } from \"@itwin/core-common\";\r\nimport {\r\n DecorateContext, Decorator, GraphicType, imageElementFromUrl, IModelApp, ParticleCollectionBuilder, ParticleProps, Tool, Viewport,\r\n} from \"@itwin/core-frontend\";\r\nimport { parseToggle } from \"../tools/parseToggle\";\r\nimport { randomFloat, randomInteger } from \"./Random\";\r\n\r\n/** Represents one particle displayed by a [[SnowDecorator]].\r\n * Particle positions are in [CoordSystem.View]($frontend).\r\n * @beta\r\n */\r\nexport interface SnowParticle extends ParticleProps {\r\n /** Make x, y, and z from ParticleProps writable. */\r\n x: number;\r\n y: number;\r\n z: number;\r\n\r\n /** Current velocity, in pixels per second. */\r\n velocity: Vector2d;\r\n}\r\n\r\n/** Parameters controlling how a [[SnowDecorator]] works.\r\n * @beta\r\n */\r\nexport interface SnowParams {\r\n /** The number of snow particles to produce. This could alternatively be expressed as a density so that small viewports would not be more crowded than larger ones. */\r\n numParticles: number;\r\n /** Range from which to randomly select each particle's size, in pixels. */\r\n sizeRange: Range1d;\r\n /** Range from which to randomly select each particle's transparency. */\r\n transparencyRange: Range1d;\r\n /** Range from which to randomly select each particle's initial velocity, in pixels per second. */\r\n velocityRange: Range2d;\r\n /** Range from which to randomly select an acceleration to apply to each particle's velocity each frame, in pixels per second squared, to simulate wind. */\r\n accelerationRange: Range2d;\r\n /** Wind velocity in pixels per second in X. */\r\n windVelocity: number;\r\n}\r\n\r\n/** The default snow effect parameters used by newly-created SnowDecorators. */\r\nconst defaultSnowParams: SnowParams = {\r\n numParticles: 2000,\r\n sizeRange: Range1d.createXX(3, 22),\r\n transparencyRange: Range1d.createXX(0, 50),\r\n velocityRange: new Range2d(-30, 50, 30, 130),\r\n accelerationRange: new Range2d(-1, -0.25, 1, 0.25),\r\n windVelocity: 0,\r\n};\r\n\r\n/** Simulates snowfall in a [Viewport]($frontend) using particle effects.\r\n * @see [[SnowEffect]] for a [Tool]($frontend) that toggles this decorator.\r\n * @see [ParticleCollectionBuilder]($frontend) for defining custom particle effects.\r\n * @beta\r\n */\r\nexport class SnowDecorator implements Decorator {\r\n /** The viewport being decorated. */\r\n public readonly viewport: Viewport;\r\n /** Invoked when this decorator is to be destroyed. */\r\n public readonly dispose: VoidFunction;\r\n /** The initial width and height of the viewport, from which we randomly select each particle's initial position. */\r\n private readonly _dimensions: Point2d;\r\n /** The list of particles being drawn. */\r\n private readonly _particles: SnowParticle[] = [];\r\n /** The image to display for each particle. */\r\n private _texture?: RenderTexture;\r\n /** The last time `updateParticles()` was invoked, in milliseconds. */\r\n private _lastUpdateTime: number;\r\n private readonly _params: SnowParams;\r\n\r\n private constructor(viewport: Viewport, texture: RenderTexture | undefined) {\r\n this._params = { ...defaultSnowParams };\r\n this.viewport = viewport;\r\n this._dimensions = new Point2d(viewport.viewRect.width, viewport.viewRect.height);\r\n this._lastUpdateTime = Date.now();\r\n this._texture = texture;\r\n\r\n // Tell the viewport to re-render the decorations every frame so that the snow particles animate smoothly.\r\n const removeOnRender = viewport.onRender.addListener(() => viewport.invalidateDecorations());\r\n\r\n // When the viewport is resized, replace this decorator with a new one to match the new dimensions.\r\n const removeOnResized = viewport.onResized.addListener(() => {\r\n // Transfer ownership of the texture to the new decorator.\r\n const tex = this._texture;\r\n this._texture = undefined;\r\n this.dispose();\r\n new SnowDecorator(viewport, tex);\r\n });\r\n\r\n // When the viewport is destroyed, dispose of this decorator too.\r\n const removeOnDispose = viewport.onDisposed.addListener(() => this.dispose());\r\n const removeDecorator = IModelApp.viewManager.addDecorator(this);\r\n\r\n this.dispose = () => {\r\n removeDecorator();\r\n removeOnRender();\r\n removeOnDispose();\r\n removeOnResized();\r\n this._texture = dispose(this._texture);\r\n SnowDecorator._decorators.delete(viewport);\r\n };\r\n\r\n SnowDecorator._decorators.set(viewport, this);\r\n\r\n // Initialize the particles.\r\n for (let i = 0; i < this._params.numParticles; i++)\r\n this._particles.push(this.emit(true));\r\n }\r\n\r\n public decorate(context: DecorateContext): void {\r\n if (context.viewport !== this.viewport || !this._texture)\r\n return;\r\n\r\n // Update the particles.\r\n const now = Date.now();\r\n const deltaMillis = now - this._lastUpdateTime;\r\n this._lastUpdateTime = now;\r\n this.updateParticles(deltaMillis / 1000);\r\n\r\n // Create particle graphics.\r\n const builder = ParticleCollectionBuilder.create({\r\n viewport: this.viewport,\r\n isViewCoords: true,\r\n texture: this._texture,\r\n size: (this._params.sizeRange.high - this._params.sizeRange.low) / 2,\r\n });\r\n\r\n for (const particle of this._particles)\r\n builder.addParticle(particle);\r\n\r\n const graphic = builder.finish();\r\n if (graphic)\r\n context.addDecoration(GraphicType.ViewOverlay, graphic);\r\n }\r\n\r\n /** Change some of the parameters affecting this decorator. */\r\n public configure(params: Partial<SnowParams>): void {\r\n for (const key of Object.keys(params)) {\r\n const val = (params as any)[key];\r\n if (undefined !== val)\r\n (this._params as any)[key] = val;\r\n }\r\n }\r\n\r\n /** Emit a new particle with randomized properties. */\r\n private emit(randomizeHeight: boolean): SnowParticle {\r\n return {\r\n x: randomInteger(0, this._dimensions.x),\r\n y: randomizeHeight ? randomInteger(0, this._dimensions.y) : 0,\r\n z: 0,\r\n size: randomInteger(this._params.sizeRange.low, this._params.sizeRange.high),\r\n transparency: randomInteger(this._params.transparencyRange.low, this._params.transparencyRange.high),\r\n velocity: new Vector2d(randomFloat(this._params.velocityRange.low.x, this._params.velocityRange.high.x),\r\n randomFloat(this._params.velocityRange.low.y, this._params.velocityRange.high.y)),\r\n };\r\n }\r\n\r\n // Update the positions and velocities of all the particles based on the amount of time that has passed since the last update.\r\n private updateParticles(elapsedSeconds: number): void {\r\n // Determine if someone changed the desired number of particles.\r\n const particleDiscrepancy = this._params.numParticles - this._particles.length;\r\n if (particleDiscrepancy > 0) {\r\n // Birth new particles up to the new maximum.\r\n for (let i = 0; i < particleDiscrepancy; i++)\r\n this._particles.push(this.emit(true));\r\n } else {\r\n // Destroy extra particles.\r\n this._particles.length = this._params.numParticles;\r\n }\r\n\r\n const acceleration = new Vector2d();\r\n const velocity = new Vector2d();\r\n for (let i = 0; i < this._particles.length; i++) {\r\n // Apply some acceleration to produce random drift.\r\n const particle = this._particles[i];\r\n acceleration.set(randomFloat(this._params.accelerationRange.low.x, this._params.accelerationRange.high.x),\r\n randomFloat(this._params.accelerationRange.low.y, this._params.accelerationRange.high.y));\r\n\r\n acceleration.scale(elapsedSeconds, acceleration);\r\n particle.velocity.plus(acceleration, particle.velocity);\r\n\r\n // Apply velocity.\r\n particle.velocity.clone(velocity);\r\n velocity.scale(elapsedSeconds, velocity);\r\n particle.x += velocity.x;\r\n particle.y += velocity.y;\r\n\r\n // Apply wind\r\n particle.x += this._params.windVelocity * elapsedSeconds;\r\n\r\n // Particles that travel beyond the viewport's left or right edges wrap around to the other side.\r\n if (particle.x < 0)\r\n particle.x = this._dimensions.x - 1;\r\n else if (particle.x >= this._dimensions.x)\r\n particle.x = 0;\r\n\r\n // Particles that travel beyond the viewport's bottom or top edges are replaced by newborn particles.\r\n if (particle.y < 0 || particle.y >= this._dimensions.y)\r\n this._particles[i] = this.emit(false);\r\n }\r\n }\r\n\r\n private static readonly _decorators = new Map<Viewport, SnowDecorator>();\r\n\r\n /** Toggle this decorator for the specified viewport.\r\n * @param viewport The viewport to which the effect should be applied or removed.\r\n * @param enable `true` to enable the effect, `false` to disable it, or `undefined` to toggle the current state.\r\n */\r\n public static async toggle(viewport: Viewport, enable?: boolean): Promise<void> {\r\n const decorator = this._decorators.get(viewport);\r\n if (undefined === enable)\r\n enable = undefined === decorator;\r\n\r\n if (undefined !== decorator && !enable)\r\n decorator.dispose();\r\n else if (undefined === decorator && enable) {\r\n // Create a texture to use for the particles.\r\n // Note: the decorator takes ownership of the texture, and disposes of it when the decorator is disposed.\r\n const image = await imageElementFromUrl(`${IModelApp.publicPath}sprites/particle_snow.png`);\r\n const texture = IModelApp.renderSystem.createTexture({\r\n ownership: \"external\",\r\n image: { source: image, transparency: TextureTransparency.Mixed },\r\n });\r\n\r\n new SnowDecorator(viewport, texture);\r\n }\r\n }\r\n}\r\n\r\n/** Toggles a decorator that simulates snow using particle effects.\r\n * @see [[SnowDecorator]] for the implementation of the decorator.\r\n * @beta\r\n */\r\nexport class SnowEffect extends Tool {\r\n public static override toolId = \"SnowEffect\";\r\n\r\n public override async run(enable?: boolean): Promise<boolean> {\r\n const vp = IModelApp.viewManager.selectedView;\r\n if (vp)\r\n await SnowDecorator.toggle(vp, enable);\r\n\r\n return true;\r\n }\r\n\r\n public override async parseAndRun(...args: string[]): Promise<boolean> {\r\n const enable = parseToggle(args[0]);\r\n if (typeof enable !== \"string\")\r\n await this.run(enable);\r\n\r\n return true;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Snow.js","sourceRoot":"","sources":["../../../src/effects/Snow.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA8C;AAC9C,wDAA2E;AAC3E,oDAAwE;AACxE,wDAE8B;AAC9B,sDAAmD;AACnD,qCAAsD;AAkCtD,+EAA+E;AAC/E,MAAM,iBAAiB,GAAe;IACpC,YAAY,EAAE,IAAI;IAClB,SAAS,EAAE,uBAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC;IAClC,iBAAiB,EAAE,uBAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC;IAC1C,aAAa,EAAE,IAAI,uBAAO,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC;IAC5C,iBAAiB,EAAE,IAAI,uBAAO,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC;IAClD,YAAY,EAAE,CAAC;CAChB,CAAC;AAEF;;;;GAIG;AACH,MAAa,aAAa;IAexB,YAAoB,QAAkB,EAAE,OAAkC;QAR1E,yCAAyC;QACxB,eAAU,GAAmB,EAAE,CAAC;QAQ/C,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,iBAAiB,EAAE,CAAC;QACxC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,IAAI,uBAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAClF,IAAI,CAA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B,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,iCAAmB,CAAC,KAAK,EAAE;aAClE,CAAC,CAAC;YAEH,IAAI,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;SACtC;IACH,CAAC;;AA3KH,sCA4KC;AAzByB,yBAAW,GAAG,IAAI,GAAG,EAA2B,CAAC;AA2B3E;;;GAGG;AACH,MAAa,UAAW,SAAQ,oBAAI;IAGlB,KAAK,CAAC,GAAG,CAAC,MAAgB;QACxC,MAAM,EAAE,GAAG,yBAAS,CAAC,WAAW,CAAC,YAAY,CAAC;QAC9C,IAAI,EAAE;YACJ,MAAM,aAAa,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;QAEzC,OAAO,IAAI,CAAC;IACd,CAAC;IAEe,KAAK,CAAC,WAAW,CAAC,GAAG,IAAc;QACjD,MAAM,MAAM,GAAG,IAAA,yBAAW,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,IAAI,OAAO,MAAM,KAAK,QAAQ;YAC5B,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAEzB,OAAO,IAAI,CAAC;IACd,CAAC;;AAjBH,gCAkBC;AAjBwB,iBAAM,GAAG,YAAY,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 Effects\n */\n\nimport { dispose } from \"@itwin/core-bentley\";\nimport { Point2d, Range1d, Range2d, Vector2d } from \"@itwin/core-geometry\";\nimport { RenderTexture, TextureTransparency } from \"@itwin/core-common\";\nimport {\n DecorateContext, Decorator, GraphicType, imageElementFromUrl, IModelApp, ParticleCollectionBuilder, ParticleProps, Tool, Viewport,\n} from \"@itwin/core-frontend\";\nimport { parseToggle } from \"../tools/parseToggle\";\nimport { randomFloat, randomInteger } from \"./Random\";\n\n/** Represents one particle displayed by a [[SnowDecorator]].\n * Particle positions are in [CoordSystem.View]($frontend).\n * @beta\n */\nexport interface SnowParticle extends ParticleProps {\n /** Make x, y, and z from ParticleProps writable. */\n x: number;\n y: number;\n z: number;\n\n /** Current velocity, in pixels per second. */\n velocity: Vector2d;\n}\n\n/** Parameters controlling how a [[SnowDecorator]] works.\n * @beta\n */\nexport interface SnowParams {\n /** The number of snow particles to produce. This could alternatively be expressed as a density so that small viewports would not be more crowded than larger ones. */\n numParticles: number;\n /** Range from which to randomly select each particle's size, in pixels. */\n sizeRange: Range1d;\n /** Range from which to randomly select each particle's transparency. */\n transparencyRange: Range1d;\n /** Range from which to randomly select each particle's initial velocity, in pixels per second. */\n velocityRange: Range2d;\n /** Range from which to randomly select an acceleration to apply to each particle's velocity each frame, in pixels per second squared, to simulate wind. */\n accelerationRange: Range2d;\n /** Wind velocity in pixels per second in X. */\n windVelocity: number;\n}\n\n/** The default snow effect parameters used by newly-created SnowDecorators. */\nconst defaultSnowParams: SnowParams = {\n numParticles: 2000,\n sizeRange: Range1d.createXX(3, 22),\n transparencyRange: Range1d.createXX(0, 50),\n velocityRange: new Range2d(-30, 50, 30, 130),\n accelerationRange: new Range2d(-1, -0.25, 1, 0.25),\n windVelocity: 0,\n};\n\n/** Simulates snowfall in a [Viewport]($frontend) using particle effects.\n * @see [[SnowEffect]] for a [Tool]($frontend) that toggles this decorator.\n * @see [ParticleCollectionBuilder]($frontend) for defining custom particle effects.\n * @beta\n */\nexport class SnowDecorator implements Decorator {\n /** The viewport being decorated. */\n public readonly viewport: Viewport;\n /** Invoked when this decorator is to be destroyed. */\n public readonly dispose: VoidFunction;\n /** The initial width and height of the viewport, from which we randomly select each particle's initial position. */\n private readonly _dimensions: Point2d;\n /** The list of particles being drawn. */\n private readonly _particles: SnowParticle[] = [];\n /** The image to display for each particle. */\n private _texture?: RenderTexture;\n /** The last time `updateParticles()` was invoked, in milliseconds. */\n private _lastUpdateTime: number;\n private readonly _params: SnowParams;\n\n private constructor(viewport: Viewport, texture: RenderTexture | undefined) {\n this._params = { ...defaultSnowParams };\n this.viewport = viewport;\n this._dimensions = new Point2d(viewport.viewRect.width, viewport.viewRect.height);\n this._lastUpdateTime = Date.now();\n this._texture = texture;\n\n // Tell the viewport to re-render the decorations every frame so that the snow particles animate smoothly.\n const removeOnRender = viewport.onRender.addListener(() => viewport.invalidateDecorations());\n\n // When the viewport is resized, replace this decorator with a new one to match the new dimensions.\n const removeOnResized = viewport.onResized.addListener(() => {\n // Transfer ownership of the texture to the new decorator.\n const tex = this._texture;\n this._texture = undefined;\n this.dispose();\n new SnowDecorator(viewport, tex);\n });\n\n // When the viewport is destroyed, dispose of this decorator too.\n const removeOnDispose = viewport.onDisposed.addListener(() => this.dispose());\n const removeDecorator = IModelApp.viewManager.addDecorator(this);\n\n this.dispose = () => {\n removeDecorator();\n removeOnRender();\n removeOnDispose();\n removeOnResized();\n this._texture = dispose(this._texture);\n SnowDecorator._decorators.delete(viewport);\n };\n\n SnowDecorator._decorators.set(viewport, this);\n\n // Initialize the particles.\n for (let i = 0; i < this._params.numParticles; i++)\n this._particles.push(this.emit(true));\n }\n\n public decorate(context: DecorateContext): void {\n if (context.viewport !== this.viewport || !this._texture)\n return;\n\n // Update the particles.\n const now = Date.now();\n const deltaMillis = now - this._lastUpdateTime;\n this._lastUpdateTime = now;\n this.updateParticles(deltaMillis / 1000);\n\n // Create particle graphics.\n const builder = ParticleCollectionBuilder.create({\n viewport: this.viewport,\n isViewCoords: true,\n texture: this._texture,\n size: (this._params.sizeRange.high - this._params.sizeRange.low) / 2,\n });\n\n for (const particle of this._particles)\n builder.addParticle(particle);\n\n const graphic = builder.finish();\n if (graphic)\n context.addDecoration(GraphicType.ViewOverlay, graphic);\n }\n\n /** Change some of the parameters affecting this decorator. */\n public configure(params: Partial<SnowParams>): void {\n for (const key of Object.keys(params)) {\n const val = (params as any)[key];\n if (undefined !== val)\n (this._params as any)[key] = val;\n }\n }\n\n /** Emit a new particle with randomized properties. */\n private emit(randomizeHeight: boolean): SnowParticle {\n return {\n x: randomInteger(0, this._dimensions.x),\n y: randomizeHeight ? randomInteger(0, this._dimensions.y) : 0,\n z: 0,\n size: randomInteger(this._params.sizeRange.low, this._params.sizeRange.high),\n transparency: randomInteger(this._params.transparencyRange.low, this._params.transparencyRange.high),\n velocity: new Vector2d(randomFloat(this._params.velocityRange.low.x, this._params.velocityRange.high.x),\n randomFloat(this._params.velocityRange.low.y, this._params.velocityRange.high.y)),\n };\n }\n\n // Update the positions and velocities of all the particles based on the amount of time that has passed since the last update.\n private updateParticles(elapsedSeconds: number): void {\n // Determine if someone changed the desired number of particles.\n const particleDiscrepancy = this._params.numParticles - this._particles.length;\n if (particleDiscrepancy > 0) {\n // Birth new particles up to the new maximum.\n for (let i = 0; i < particleDiscrepancy; i++)\n this._particles.push(this.emit(true));\n } else {\n // Destroy extra particles.\n this._particles.length = this._params.numParticles;\n }\n\n const acceleration = new Vector2d();\n const velocity = new Vector2d();\n for (let i = 0; i < this._particles.length; i++) {\n // Apply some acceleration to produce random drift.\n const particle = this._particles[i];\n acceleration.set(randomFloat(this._params.accelerationRange.low.x, this._params.accelerationRange.high.x),\n randomFloat(this._params.accelerationRange.low.y, this._params.accelerationRange.high.y));\n\n acceleration.scale(elapsedSeconds, acceleration);\n particle.velocity.plus(acceleration, particle.velocity);\n\n // Apply velocity.\n particle.velocity.clone(velocity);\n velocity.scale(elapsedSeconds, velocity);\n particle.x += velocity.x;\n particle.y += velocity.y;\n\n // Apply wind\n particle.x += this._params.windVelocity * elapsedSeconds;\n\n // Particles that travel beyond the viewport's left or right edges wrap around to the other side.\n if (particle.x < 0)\n particle.x = this._dimensions.x - 1;\n else if (particle.x >= this._dimensions.x)\n particle.x = 0;\n\n // Particles that travel beyond the viewport's bottom or top edges are replaced by newborn particles.\n if (particle.y < 0 || particle.y >= this._dimensions.y)\n this._particles[i] = this.emit(false);\n }\n }\n\n private static readonly _decorators = new Map<Viewport, SnowDecorator>();\n\n /** Toggle this decorator for the specified viewport.\n * @param viewport The viewport to which the effect should be applied or removed.\n * @param enable `true` to enable the effect, `false` to disable it, or `undefined` to toggle the current state.\n */\n public static async toggle(viewport: Viewport, enable?: boolean): Promise<void> {\n const decorator = this._decorators.get(viewport);\n if (undefined === enable)\n enable = undefined === decorator;\n\n if (undefined !== decorator && !enable)\n decorator.dispose();\n else if (undefined === decorator && enable) {\n // Create a texture to use for the particles.\n // Note: the decorator takes ownership of the texture, and disposes of it when the decorator is disposed.\n const image = await imageElementFromUrl(`${IModelApp.publicPath}sprites/particle_snow.png`);\n const texture = IModelApp.renderSystem.createTexture({\n ownership: \"external\",\n image: { source: image, transparency: TextureTransparency.Mixed },\n });\n\n new SnowDecorator(viewport, texture);\n }\n }\n}\n\n/** Toggles a decorator that simulates snow using particle effects.\n * @see [[SnowDecorator]] for the implementation of the decorator.\n * @beta\n */\nexport class SnowEffect extends Tool {\n public static override toolId = \"SnowEffect\";\n\n public override async run(enable?: boolean): Promise<boolean> {\n const vp = IModelApp.viewManager.selectedView;\n if (vp)\n await SnowDecorator.toggle(vp, enable);\n\n return true;\n }\n\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n const enable = parseToggle(args[0]);\n if (typeof enable !== \"string\")\n await this.run(enable);\n\n return true;\n }\n}\n"]}
@@ -1,40 +1,40 @@
1
- /** @packageDocumentation
2
- * @module Effects
3
- */
4
- import { ScreenSpaceEffectBuilder, Tool } from "@itwin/core-frontend";
5
- import { AddEffectTool } from "./EffectTools";
6
- /** Applies a [vignette](https://en.wikipedia.org/wiki/Vignetting) effect to the viewport.
7
- * From https://github.com/TyLindberg/glsl-vignette/blob/master/advanced.glsl.
8
- * @beta
9
- */
10
- export declare class VignetteEffect extends AddEffectTool {
11
- static toolId: string;
12
- protected get effectName(): string;
13
- protected get textureCoordFromPosition(): boolean;
14
- protected get source(): {
15
- vertex: string;
16
- fragment: string;
17
- };
18
- protected defineEffect(builder: ScreenSpaceEffectBuilder): void;
19
- }
20
- /** Configures the [[VignetteEffect]].
21
- * @beta
22
- */
23
- export declare class VignetteConfig extends Tool {
24
- static toolId: string;
25
- static get minArgs(): number;
26
- static get maxArgs(): number;
27
- /** Size of the vignette in the form (width/2, height/2). e.g., to make the vignette start fading in halfway between the center and edges of
28
- * UV space, use (0.25, 0.25).
29
- */
30
- static readonly size: Float32Array;
31
- /** How round the vignette will be, from 0.0 (perfectly rectangular) to 1.0 (perfectly round). */
32
- static roundness: number;
33
- /** How quickly the vignette fades in. The vignette starts fading in at the edge of the values provided by `size` and will be
34
- * fully faded in at (size.x + smoothness, size.y * smoothness). A value of 0.0 produces a hard edge.
35
- */
36
- static smoothness: number;
37
- run(width?: number, height?: number, roundness?: number, smoothness?: number): Promise<boolean>;
38
- parseAndRun(...input: string[]): Promise<boolean>;
39
- }
1
+ /** @packageDocumentation
2
+ * @module Effects
3
+ */
4
+ import { ScreenSpaceEffectBuilder, Tool } from "@itwin/core-frontend";
5
+ import { AddEffectTool } from "./EffectTools";
6
+ /** Applies a [vignette](https://en.wikipedia.org/wiki/Vignetting) effect to the viewport.
7
+ * From https://github.com/TyLindberg/glsl-vignette/blob/master/advanced.glsl.
8
+ * @beta
9
+ */
10
+ export declare class VignetteEffect extends AddEffectTool {
11
+ static toolId: string;
12
+ protected get effectName(): string;
13
+ protected get textureCoordFromPosition(): boolean;
14
+ protected get source(): {
15
+ vertex: string;
16
+ fragment: string;
17
+ };
18
+ protected defineEffect(builder: ScreenSpaceEffectBuilder): void;
19
+ }
20
+ /** Configures the [[VignetteEffect]].
21
+ * @beta
22
+ */
23
+ export declare class VignetteConfig extends Tool {
24
+ static toolId: string;
25
+ static get minArgs(): number;
26
+ static get maxArgs(): number;
27
+ /** Size of the vignette in the form (width/2, height/2). e.g., to make the vignette start fading in halfway between the center and edges of
28
+ * UV space, use (0.25, 0.25).
29
+ */
30
+ static readonly size: Float32Array;
31
+ /** How round the vignette will be, from 0.0 (perfectly rectangular) to 1.0 (perfectly round). */
32
+ static roundness: number;
33
+ /** How quickly the vignette fades in. The vignette starts fading in at the edge of the values provided by `size` and will be
34
+ * fully faded in at (size.x + smoothness, size.y * smoothness). A value of 0.0 produces a hard edge.
35
+ */
36
+ static smoothness: number;
37
+ run(width?: number, height?: number, roundness?: number, smoothness?: number): Promise<boolean>;
38
+ parseAndRun(...input: string[]): Promise<boolean>;
39
+ }
40
40
  //# sourceMappingURL=Vignette.d.ts.map