@itwin/frontend-devtools 4.0.0-dev.52 → 4.0.0-dev.55

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 (344) hide show
  1. package/lib/cjs/ClipboardUtilities.d.ts +8 -8
  2. package/lib/cjs/ClipboardUtilities.js +26 -26
  3. package/lib/cjs/FrontEndDevTools.d.ts +19 -19
  4. package/lib/cjs/FrontEndDevTools.js +221 -221
  5. package/lib/cjs/FrontEndDevTools.js.map +1 -1
  6. package/lib/cjs/effects/Convolution.d.ts +68 -68
  7. package/lib/cjs/effects/Convolution.js +148 -148
  8. package/lib/cjs/effects/Convolution.js.map +1 -1
  9. package/lib/cjs/effects/EffectTools.d.ts +33 -33
  10. package/lib/cjs/effects/EffectTools.js +67 -67
  11. package/lib/cjs/effects/EffectTools.js.map +1 -1
  12. package/lib/cjs/effects/Explosion.d.ts +12 -12
  13. package/lib/cjs/effects/Explosion.js +168 -168
  14. package/lib/cjs/effects/Explosion.js.map +1 -1
  15. package/lib/cjs/effects/FlipImage.d.ts +30 -30
  16. package/lib/cjs/effects/FlipImage.js +79 -79
  17. package/lib/cjs/effects/FlipImage.js.map +1 -1
  18. package/lib/cjs/effects/LensDistortion.d.ts +34 -34
  19. package/lib/cjs/effects/LensDistortion.js +88 -88
  20. package/lib/cjs/effects/LensDistortion.js.map +1 -1
  21. package/lib/cjs/effects/Random.d.ts +24 -24
  22. package/lib/cjs/effects/Random.js +49 -49
  23. package/lib/cjs/effects/Saturation.d.ts +30 -30
  24. package/lib/cjs/effects/Saturation.js +59 -59
  25. package/lib/cjs/effects/Saturation.js.map +1 -1
  26. package/lib/cjs/effects/Snow.d.ts +76 -76
  27. package/lib/cjs/effects/Snow.js +187 -187
  28. package/lib/cjs/effects/Snow.js.map +1 -1
  29. package/lib/cjs/effects/Vignette.d.ts +39 -39
  30. package/lib/cjs/effects/Vignette.js +79 -79
  31. package/lib/cjs/effects/Vignette.js.map +1 -1
  32. package/lib/cjs/frontend-devtools.d.ts +82 -82
  33. package/lib/cjs/frontend-devtools.js +102 -98
  34. package/lib/cjs/frontend-devtools.js.map +1 -1
  35. package/lib/cjs/tools/AnimationIntervalTool.d.ts +15 -15
  36. package/lib/cjs/tools/AnimationIntervalTool.js +30 -30
  37. package/lib/cjs/tools/AnimationIntervalTool.js.map +1 -1
  38. package/lib/cjs/tools/ChangeUnitsTool.d.ts +15 -15
  39. package/lib/cjs/tools/ChangeUnitsTool.js +41 -41
  40. package/lib/cjs/tools/ChangeUnitsTool.js.map +1 -1
  41. package/lib/cjs/tools/ClipTools.d.ts +67 -67
  42. package/lib/cjs/tools/ClipTools.js +161 -161
  43. package/lib/cjs/tools/ClipTools.js.map +1 -1
  44. package/lib/cjs/tools/DisplayStyleTools.d.ts +145 -145
  45. package/lib/cjs/tools/DisplayStyleTools.js +368 -368
  46. package/lib/cjs/tools/DisplayStyleTools.js.map +1 -1
  47. package/lib/cjs/tools/EmphasizeElementsTool.d.ts +60 -60
  48. package/lib/cjs/tools/EmphasizeElementsTool.js +154 -154
  49. package/lib/cjs/tools/EmphasizeElementsTool.js.map +1 -1
  50. package/lib/cjs/tools/FrustumDecoration.d.ts +57 -57
  51. package/lib/cjs/tools/FrustumDecoration.js +374 -374
  52. package/lib/cjs/tools/FrustumDecoration.js.map +1 -1
  53. package/lib/cjs/tools/InspectElementTool.d.ts +42 -42
  54. package/lib/cjs/tools/InspectElementTool.js +198 -198
  55. package/lib/cjs/tools/InspectElementTool.js.map +1 -1
  56. package/lib/cjs/tools/MapLayerTool.d.ts +264 -264
  57. package/lib/cjs/tools/MapLayerTool.js +507 -507
  58. package/lib/cjs/tools/MapLayerTool.js.map +1 -1
  59. package/lib/cjs/tools/MeasureTileLoadTime.d.ts +12 -12
  60. package/lib/cjs/tools/MeasureTileLoadTime.js +63 -63
  61. package/lib/cjs/tools/MeasureTileLoadTime.js.map +1 -1
  62. package/lib/cjs/tools/ModelAppearanceTools.d.ts +86 -86
  63. package/lib/cjs/tools/ModelAppearanceTools.js +183 -183
  64. package/lib/cjs/tools/ModelAppearanceTools.js.map +1 -1
  65. package/lib/cjs/tools/PlanProjectionTools.d.ts +40 -40
  66. package/lib/cjs/tools/PlanProjectionTools.js +149 -149
  67. package/lib/cjs/tools/PlanProjectionTools.js.map +1 -1
  68. package/lib/cjs/tools/PlanarMaskTools.d.ts +182 -182
  69. package/lib/cjs/tools/PlanarMaskTools.js +391 -391
  70. package/lib/cjs/tools/PlanarMaskTools.js.map +1 -1
  71. package/lib/cjs/tools/ProjectExtents.d.ts +41 -41
  72. package/lib/cjs/tools/ProjectExtents.js +110 -110
  73. package/lib/cjs/tools/ProjectExtents.js.map +1 -1
  74. package/lib/cjs/tools/RealityModelTools.d.ts +116 -116
  75. package/lib/cjs/tools/RealityModelTools.js +281 -281
  76. package/lib/cjs/tools/RealityModelTools.js.map +1 -1
  77. package/lib/cjs/tools/RealityTransitionTool.d.ts +25 -25
  78. package/lib/cjs/tools/RealityTransitionTool.js +115 -115
  79. package/lib/cjs/tools/RealityTransitionTool.js.map +1 -1
  80. package/lib/cjs/tools/RenderSystemTools.d.ts +38 -38
  81. package/lib/cjs/tools/RenderSystemTools.js +69 -69
  82. package/lib/cjs/tools/RenderSystemTools.js.map +1 -1
  83. package/lib/cjs/tools/RenderTargetTools.d.ts +107 -107
  84. package/lib/cjs/tools/RenderTargetTools.d.ts.map +1 -1
  85. package/lib/cjs/tools/RenderTargetTools.js +174 -174
  86. package/lib/cjs/tools/RenderTargetTools.js.map +1 -1
  87. package/lib/cjs/tools/ReportWebGLCompatibilityTool.d.ts +11 -11
  88. package/lib/cjs/tools/ReportWebGLCompatibilityTool.js +30 -30
  89. package/lib/cjs/tools/ReportWebGLCompatibilityTool.js.map +1 -1
  90. package/lib/cjs/tools/SavedViews.d.ts +46 -46
  91. package/lib/cjs/tools/SavedViews.js +136 -136
  92. package/lib/cjs/tools/SavedViews.js.map +1 -1
  93. package/lib/cjs/tools/ScheduleScriptTools.d.ts +37 -37
  94. package/lib/cjs/tools/ScheduleScriptTools.js +157 -157
  95. package/lib/cjs/tools/ScheduleScriptTools.js.map +1 -1
  96. package/lib/cjs/tools/SelectionTools.d.ts +28 -28
  97. package/lib/cjs/tools/SelectionTools.js +87 -87
  98. package/lib/cjs/tools/SelectionTools.js.map +1 -1
  99. package/lib/cjs/tools/SetGpuMemoryLimitTool.d.ts +15 -15
  100. package/lib/cjs/tools/SetGpuMemoryLimitTool.js +33 -33
  101. package/lib/cjs/tools/SetGpuMemoryLimitTool.js.map +1 -1
  102. package/lib/cjs/tools/SourceAspectIdTools.d.ts +40 -40
  103. package/lib/cjs/tools/SourceAspectIdTools.js +86 -86
  104. package/lib/cjs/tools/SourceAspectIdTools.js.map +1 -1
  105. package/lib/cjs/tools/TileRequestDecoration.d.ts +12 -12
  106. package/lib/cjs/tools/TileRequestDecoration.js +83 -83
  107. package/lib/cjs/tools/TileRequestDecoration.js.map +1 -1
  108. package/lib/cjs/tools/TileTreeBoundsDecoration.d.ts +11 -11
  109. package/lib/cjs/tools/TileTreeBoundsDecoration.js +74 -74
  110. package/lib/cjs/tools/TileTreeBoundsDecoration.js.map +1 -1
  111. package/lib/cjs/tools/ToolTipProvider.d.ts +15 -15
  112. package/lib/cjs/tools/ToolTipProvider.js +66 -66
  113. package/lib/cjs/tools/ToolTipProvider.js.map +1 -1
  114. package/lib/cjs/tools/ViewportTools.d.ts +218 -218
  115. package/lib/cjs/tools/ViewportTools.js +516 -516
  116. package/lib/cjs/tools/ViewportTools.js.map +1 -1
  117. package/lib/cjs/tools/parseArgs.d.ts +23 -23
  118. package/lib/cjs/tools/parseArgs.js +51 -51
  119. package/lib/cjs/tools/parseBoolean.d.ts +8 -8
  120. package/lib/cjs/tools/parseBoolean.js +26 -26
  121. package/lib/cjs/tools/parseToggle.d.ts +8 -8
  122. package/lib/cjs/tools/parseToggle.js +25 -25
  123. package/lib/cjs/ui/Button.d.ts +29 -29
  124. package/lib/cjs/ui/Button.d.ts.map +1 -1
  125. package/lib/cjs/ui/Button.js +26 -26
  126. package/lib/cjs/ui/CheckBox.d.ts +23 -23
  127. package/lib/cjs/ui/CheckBox.d.ts.map +1 -1
  128. package/lib/cjs/ui/CheckBox.js +27 -27
  129. package/lib/cjs/ui/ColorInput.d.ts +27 -27
  130. package/lib/cjs/ui/ColorInput.d.ts.map +1 -1
  131. package/lib/cjs/ui/ColorInput.js +53 -53
  132. package/lib/cjs/ui/ComboBox.d.ts +28 -28
  133. package/lib/cjs/ui/ComboBox.d.ts.map +1 -1
  134. package/lib/cjs/ui/ComboBox.js +42 -42
  135. package/lib/cjs/ui/DataList.d.ts +27 -27
  136. package/lib/cjs/ui/DataList.d.ts.map +1 -1
  137. package/lib/cjs/ui/DataList.js +39 -39
  138. package/lib/cjs/ui/NestedMenu.d.ts +19 -19
  139. package/lib/cjs/ui/NestedMenu.d.ts.map +1 -1
  140. package/lib/cjs/ui/NestedMenu.js +46 -46
  141. package/lib/cjs/ui/NumericInput.d.ts +35 -35
  142. package/lib/cjs/ui/NumericInput.d.ts.map +1 -1
  143. package/lib/cjs/ui/NumericInput.js +61 -61
  144. package/lib/cjs/ui/RadioBox.d.ts +29 -29
  145. package/lib/cjs/ui/RadioBox.d.ts.map +1 -1
  146. package/lib/cjs/ui/RadioBox.js +76 -76
  147. package/lib/cjs/ui/Slider.d.ts +28 -28
  148. package/lib/cjs/ui/Slider.d.ts.map +1 -1
  149. package/lib/cjs/ui/Slider.js +42 -42
  150. package/lib/cjs/ui/TextBox.d.ts +32 -32
  151. package/lib/cjs/ui/TextBox.d.ts.map +1 -1
  152. package/lib/cjs/ui/TextBox.js +56 -56
  153. package/lib/cjs/widgets/DiagnosticsPanel.d.ts +37 -37
  154. package/lib/cjs/widgets/DiagnosticsPanel.js +81 -81
  155. package/lib/cjs/widgets/FpsTracker.d.ts +19 -19
  156. package/lib/cjs/widgets/FpsTracker.js +56 -56
  157. package/lib/cjs/widgets/GpuProfiler.d.ts +16 -16
  158. package/lib/cjs/widgets/GpuProfiler.js +192 -192
  159. package/lib/cjs/widgets/KeyinField.d.ts +61 -61
  160. package/lib/cjs/widgets/KeyinField.js +186 -186
  161. package/lib/cjs/widgets/MemoryTracker.d.ts +27 -27
  162. package/lib/cjs/widgets/MemoryTracker.js +242 -242
  163. package/lib/cjs/widgets/MemoryTracker.js.map +1 -1
  164. package/lib/cjs/widgets/RenderCommandBreakdown.d.ts +15 -15
  165. package/lib/cjs/widgets/RenderCommandBreakdown.js +67 -67
  166. package/lib/cjs/widgets/TileMemoryBreakdown.d.ts +30 -30
  167. package/lib/cjs/widgets/TileMemoryBreakdown.js +203 -203
  168. package/lib/cjs/widgets/TileStatisticsTracker.d.ts +21 -21
  169. package/lib/cjs/widgets/TileStatisticsTracker.js +144 -144
  170. package/lib/cjs/widgets/ToolSettingsTracker.d.ts +9 -9
  171. package/lib/cjs/widgets/ToolSettingsTracker.js +211 -211
  172. package/lib/cjs/widgets/ToolSettingsTracker.js.map +1 -1
  173. package/lib/esm/ClipboardUtilities.d.ts +8 -8
  174. package/lib/esm/ClipboardUtilities.js +22 -22
  175. package/lib/esm/FrontEndDevTools.d.ts +19 -19
  176. package/lib/esm/FrontEndDevTools.js +218 -217
  177. package/lib/esm/FrontEndDevTools.js.map +1 -1
  178. package/lib/esm/effects/Convolution.d.ts +68 -68
  179. package/lib/esm/effects/Convolution.js +144 -138
  180. package/lib/esm/effects/Convolution.js.map +1 -1
  181. package/lib/esm/effects/EffectTools.d.ts +33 -33
  182. package/lib/esm/effects/EffectTools.js +63 -61
  183. package/lib/esm/effects/EffectTools.js.map +1 -1
  184. package/lib/esm/effects/Explosion.d.ts +12 -12
  185. package/lib/esm/effects/Explosion.js +165 -164
  186. package/lib/esm/effects/Explosion.js.map +1 -1
  187. package/lib/esm/effects/FlipImage.d.ts +30 -30
  188. package/lib/esm/effects/FlipImage.js +76 -74
  189. package/lib/esm/effects/FlipImage.js.map +1 -1
  190. package/lib/esm/effects/LensDistortion.d.ts +34 -34
  191. package/lib/esm/effects/LensDistortion.js +85 -83
  192. package/lib/esm/effects/LensDistortion.js.map +1 -1
  193. package/lib/esm/effects/Random.d.ts +24 -24
  194. package/lib/esm/effects/Random.js +41 -41
  195. package/lib/esm/effects/Saturation.d.ts +30 -30
  196. package/lib/esm/effects/Saturation.js +56 -54
  197. package/lib/esm/effects/Saturation.js.map +1 -1
  198. package/lib/esm/effects/Snow.d.ts +76 -76
  199. package/lib/esm/effects/Snow.js +184 -182
  200. package/lib/esm/effects/Snow.js.map +1 -1
  201. package/lib/esm/effects/Vignette.d.ts +39 -39
  202. package/lib/esm/effects/Vignette.js +76 -74
  203. package/lib/esm/effects/Vignette.js.map +1 -1
  204. package/lib/esm/frontend-devtools.d.ts +82 -82
  205. package/lib/esm/frontend-devtools.js +86 -86
  206. package/lib/esm/tools/AnimationIntervalTool.d.ts +15 -15
  207. package/lib/esm/tools/AnimationIntervalTool.js +27 -26
  208. package/lib/esm/tools/AnimationIntervalTool.js.map +1 -1
  209. package/lib/esm/tools/ChangeUnitsTool.d.ts +15 -15
  210. package/lib/esm/tools/ChangeUnitsTool.js +38 -37
  211. package/lib/esm/tools/ChangeUnitsTool.js.map +1 -1
  212. package/lib/esm/tools/ClipTools.d.ts +67 -67
  213. package/lib/esm/tools/ClipTools.js +158 -155
  214. package/lib/esm/tools/ClipTools.js.map +1 -1
  215. package/lib/esm/tools/DisplayStyleTools.d.ts +145 -145
  216. package/lib/esm/tools/DisplayStyleTools.js +364 -354
  217. package/lib/esm/tools/DisplayStyleTools.js.map +1 -1
  218. package/lib/esm/tools/EmphasizeElementsTool.d.ts +60 -60
  219. package/lib/esm/tools/EmphasizeElementsTool.js +150 -145
  220. package/lib/esm/tools/EmphasizeElementsTool.js.map +1 -1
  221. package/lib/esm/tools/FrustumDecoration.d.ts +57 -57
  222. package/lib/esm/tools/FrustumDecoration.js +370 -367
  223. package/lib/esm/tools/FrustumDecoration.js.map +1 -1
  224. package/lib/esm/tools/InspectElementTool.d.ts +42 -42
  225. package/lib/esm/tools/InspectElementTool.js +195 -194
  226. package/lib/esm/tools/InspectElementTool.js.map +1 -1
  227. package/lib/esm/tools/MapLayerTool.d.ts +264 -264
  228. package/lib/esm/tools/MapLayerTool.js +504 -485
  229. package/lib/esm/tools/MapLayerTool.js.map +1 -1
  230. package/lib/esm/tools/MeasureTileLoadTime.d.ts +12 -12
  231. package/lib/esm/tools/MeasureTileLoadTime.js +60 -59
  232. package/lib/esm/tools/MeasureTileLoadTime.js.map +1 -1
  233. package/lib/esm/tools/ModelAppearanceTools.d.ts +86 -86
  234. package/lib/esm/tools/ModelAppearanceTools.js +180 -172
  235. package/lib/esm/tools/ModelAppearanceTools.js.map +1 -1
  236. package/lib/esm/tools/PlanProjectionTools.d.ts +40 -40
  237. package/lib/esm/tools/PlanProjectionTools.js +146 -143
  238. package/lib/esm/tools/PlanProjectionTools.js.map +1 -1
  239. package/lib/esm/tools/PlanarMaskTools.d.ts +182 -182
  240. package/lib/esm/tools/PlanarMaskTools.js +387 -375
  241. package/lib/esm/tools/PlanarMaskTools.js.map +1 -1
  242. package/lib/esm/tools/ProjectExtents.d.ts +41 -41
  243. package/lib/esm/tools/ProjectExtents.js +105 -104
  244. package/lib/esm/tools/ProjectExtents.js.map +1 -1
  245. package/lib/esm/tools/RealityModelTools.d.ts +116 -116
  246. package/lib/esm/tools/RealityModelTools.js +278 -268
  247. package/lib/esm/tools/RealityModelTools.js.map +1 -1
  248. package/lib/esm/tools/RealityTransitionTool.d.ts +25 -25
  249. package/lib/esm/tools/RealityTransitionTool.js +112 -111
  250. package/lib/esm/tools/RealityTransitionTool.js.map +1 -1
  251. package/lib/esm/tools/RenderSystemTools.d.ts +38 -38
  252. package/lib/esm/tools/RenderSystemTools.js +65 -62
  253. package/lib/esm/tools/RenderSystemTools.js.map +1 -1
  254. package/lib/esm/tools/RenderTargetTools.d.ts +107 -107
  255. package/lib/esm/tools/RenderTargetTools.d.ts.map +1 -1
  256. package/lib/esm/tools/RenderTargetTools.js +169 -159
  257. package/lib/esm/tools/RenderTargetTools.js.map +1 -1
  258. package/lib/esm/tools/ReportWebGLCompatibilityTool.d.ts +11 -11
  259. package/lib/esm/tools/ReportWebGLCompatibilityTool.js +27 -26
  260. package/lib/esm/tools/ReportWebGLCompatibilityTool.js.map +1 -1
  261. package/lib/esm/tools/SavedViews.d.ts +46 -46
  262. package/lib/esm/tools/SavedViews.js +131 -128
  263. package/lib/esm/tools/SavedViews.js.map +1 -1
  264. package/lib/esm/tools/ScheduleScriptTools.d.ts +37 -37
  265. package/lib/esm/tools/ScheduleScriptTools.js +154 -151
  266. package/lib/esm/tools/ScheduleScriptTools.js.map +1 -1
  267. package/lib/esm/tools/SelectionTools.d.ts +28 -28
  268. package/lib/esm/tools/SelectionTools.js +84 -82
  269. package/lib/esm/tools/SelectionTools.js.map +1 -1
  270. package/lib/esm/tools/SetGpuMemoryLimitTool.d.ts +15 -15
  271. package/lib/esm/tools/SetGpuMemoryLimitTool.js +30 -29
  272. package/lib/esm/tools/SetGpuMemoryLimitTool.js.map +1 -1
  273. package/lib/esm/tools/SourceAspectIdTools.d.ts +40 -40
  274. package/lib/esm/tools/SourceAspectIdTools.js +82 -80
  275. package/lib/esm/tools/SourceAspectIdTools.js.map +1 -1
  276. package/lib/esm/tools/TileRequestDecoration.d.ts +12 -12
  277. package/lib/esm/tools/TileRequestDecoration.js +80 -79
  278. package/lib/esm/tools/TileRequestDecoration.js.map +1 -1
  279. package/lib/esm/tools/TileTreeBoundsDecoration.d.ts +11 -11
  280. package/lib/esm/tools/TileTreeBoundsDecoration.js +71 -70
  281. package/lib/esm/tools/TileTreeBoundsDecoration.js.map +1 -1
  282. package/lib/esm/tools/ToolTipProvider.d.ts +15 -15
  283. package/lib/esm/tools/ToolTipProvider.js +63 -62
  284. package/lib/esm/tools/ToolTipProvider.js.map +1 -1
  285. package/lib/esm/tools/ViewportTools.d.ts +218 -218
  286. package/lib/esm/tools/ViewportTools.js +511 -492
  287. package/lib/esm/tools/ViewportTools.js.map +1 -1
  288. package/lib/esm/tools/parseArgs.d.ts +23 -23
  289. package/lib/esm/tools/parseArgs.js +47 -47
  290. package/lib/esm/tools/parseBoolean.d.ts +8 -8
  291. package/lib/esm/tools/parseBoolean.js +22 -22
  292. package/lib/esm/tools/parseToggle.d.ts +8 -8
  293. package/lib/esm/tools/parseToggle.js +21 -21
  294. package/lib/esm/ui/Button.d.ts +29 -29
  295. package/lib/esm/ui/Button.d.ts.map +1 -1
  296. package/lib/esm/ui/Button.js +22 -22
  297. package/lib/esm/ui/CheckBox.d.ts +23 -23
  298. package/lib/esm/ui/CheckBox.d.ts.map +1 -1
  299. package/lib/esm/ui/CheckBox.js +23 -23
  300. package/lib/esm/ui/ColorInput.d.ts +27 -27
  301. package/lib/esm/ui/ColorInput.d.ts.map +1 -1
  302. package/lib/esm/ui/ColorInput.js +48 -48
  303. package/lib/esm/ui/ComboBox.d.ts +28 -28
  304. package/lib/esm/ui/ComboBox.d.ts.map +1 -1
  305. package/lib/esm/ui/ComboBox.js +38 -38
  306. package/lib/esm/ui/DataList.d.ts +27 -27
  307. package/lib/esm/ui/DataList.d.ts.map +1 -1
  308. package/lib/esm/ui/DataList.js +34 -34
  309. package/lib/esm/ui/NestedMenu.d.ts +19 -19
  310. package/lib/esm/ui/NestedMenu.d.ts.map +1 -1
  311. package/lib/esm/ui/NestedMenu.js +42 -42
  312. package/lib/esm/ui/NumericInput.d.ts +35 -35
  313. package/lib/esm/ui/NumericInput.d.ts.map +1 -1
  314. package/lib/esm/ui/NumericInput.js +56 -56
  315. package/lib/esm/ui/RadioBox.d.ts +29 -29
  316. package/lib/esm/ui/RadioBox.d.ts.map +1 -1
  317. package/lib/esm/ui/RadioBox.js +72 -72
  318. package/lib/esm/ui/Slider.d.ts +28 -28
  319. package/lib/esm/ui/Slider.d.ts.map +1 -1
  320. package/lib/esm/ui/Slider.js +38 -38
  321. package/lib/esm/ui/TextBox.d.ts +32 -32
  322. package/lib/esm/ui/TextBox.d.ts.map +1 -1
  323. package/lib/esm/ui/TextBox.js +52 -52
  324. package/lib/esm/widgets/DiagnosticsPanel.d.ts +37 -37
  325. package/lib/esm/widgets/DiagnosticsPanel.js +77 -77
  326. package/lib/esm/widgets/FpsTracker.d.ts +19 -19
  327. package/lib/esm/widgets/FpsTracker.js +52 -52
  328. package/lib/esm/widgets/GpuProfiler.d.ts +16 -16
  329. package/lib/esm/widgets/GpuProfiler.js +188 -188
  330. package/lib/esm/widgets/KeyinField.d.ts +61 -61
  331. package/lib/esm/widgets/KeyinField.js +182 -182
  332. package/lib/esm/widgets/MemoryTracker.d.ts +27 -27
  333. package/lib/esm/widgets/MemoryTracker.js +237 -237
  334. package/lib/esm/widgets/MemoryTracker.js.map +1 -1
  335. package/lib/esm/widgets/RenderCommandBreakdown.d.ts +15 -15
  336. package/lib/esm/widgets/RenderCommandBreakdown.js +63 -63
  337. package/lib/esm/widgets/TileMemoryBreakdown.d.ts +30 -30
  338. package/lib/esm/widgets/TileMemoryBreakdown.js +199 -199
  339. package/lib/esm/widgets/TileStatisticsTracker.d.ts +21 -21
  340. package/lib/esm/widgets/TileStatisticsTracker.js +140 -140
  341. package/lib/esm/widgets/ToolSettingsTracker.d.ts +9 -9
  342. package/lib/esm/widgets/ToolSettingsTracker.js +208 -207
  343. package/lib/esm/widgets/ToolSettingsTracker.js.map +1 -1
  344. package/package.json +8 -8
@@ -1,183 +1,185 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- /** @packageDocumentation
6
- * @module Effects
7
- */
8
- import { dispose } from "@itwin/core-bentley";
9
- import { Point2d, Range1d, Range2d, Vector2d } from "@itwin/core-geometry";
10
- import { TextureTransparency } from "@itwin/core-common";
11
- import { GraphicType, imageElementFromUrl, IModelApp, ParticleCollectionBuilder, Tool, } from "@itwin/core-frontend";
12
- import { parseToggle } from "../tools/parseToggle";
13
- import { randomFloat, randomInteger } from "./Random";
14
- /** The default snow effect parameters used by newly-created SnowDecorators. */
15
- const defaultSnowParams = {
16
- numParticles: 2000,
17
- sizeRange: Range1d.createXX(3, 22),
18
- transparencyRange: Range1d.createXX(0, 50),
19
- velocityRange: new Range2d(-30, 50, 30, 130),
20
- accelerationRange: new Range2d(-1, -0.25, 1, 0.25),
21
- windVelocity: 0,
22
- };
23
- /** Simulates snowfall in a [Viewport]($frontend) using particle effects.
24
- * @see [[SnowEffect]] for a [Tool]($frontend) that toggles this decorator.
25
- * @see [ParticleCollectionBuilder]($frontend) for defining custom particle effects.
26
- * @beta
27
- */
28
- export class SnowDecorator {
29
- constructor(viewport, texture) {
30
- /** The list of particles being drawn. */
31
- this._particles = [];
32
- this._params = { ...defaultSnowParams };
33
- this.viewport = viewport;
34
- this._dimensions = new Point2d(viewport.viewRect.width, viewport.viewRect.height);
35
- this._lastUpdateTime = Date.now();
36
- this._texture = texture;
37
- // Tell the viewport to re-render the decorations every frame so that the snow particles animate smoothly.
38
- const removeOnRender = viewport.onRender.addListener(() => viewport.invalidateDecorations());
39
- // When the viewport is resized, replace this decorator with a new one to match the new dimensions.
40
- const removeOnResized = viewport.onResized.addListener(() => {
41
- // Transfer ownership of the texture to the new decorator.
42
- const tex = this._texture;
43
- this._texture = undefined;
44
- this.dispose();
45
- new SnowDecorator(viewport, tex);
46
- });
47
- // When the viewport is destroyed, dispose of this decorator too.
48
- const removeOnDispose = viewport.onDisposed.addListener(() => this.dispose());
49
- const removeDecorator = IModelApp.viewManager.addDecorator(this);
50
- this.dispose = () => {
51
- removeDecorator();
52
- removeOnRender();
53
- removeOnDispose();
54
- removeOnResized();
55
- this._texture = dispose(this._texture);
56
- SnowDecorator._decorators.delete(viewport);
57
- };
58
- SnowDecorator._decorators.set(viewport, this);
59
- // Initialize the particles.
60
- for (let i = 0; i < this._params.numParticles; i++)
61
- this._particles.push(this.emit(true));
62
- }
63
- decorate(context) {
64
- if (context.viewport !== this.viewport || !this._texture)
65
- return;
66
- // Update the particles.
67
- const now = Date.now();
68
- const deltaMillis = now - this._lastUpdateTime;
69
- this._lastUpdateTime = now;
70
- this.updateParticles(deltaMillis / 1000);
71
- // Create particle graphics.
72
- const builder = ParticleCollectionBuilder.create({
73
- viewport: this.viewport,
74
- isViewCoords: true,
75
- texture: this._texture,
76
- size: (this._params.sizeRange.high - this._params.sizeRange.low) / 2,
77
- });
78
- for (const particle of this._particles)
79
- builder.addParticle(particle);
80
- const graphic = builder.finish();
81
- if (graphic)
82
- context.addDecoration(GraphicType.ViewOverlay, graphic);
83
- }
84
- /** Change some of the parameters affecting this decorator. */
85
- configure(params) {
86
- for (const key of Object.keys(params)) {
87
- const val = params[key];
88
- if (undefined !== val)
89
- this._params[key] = val;
90
- }
91
- }
92
- /** Emit a new particle with randomized properties. */
93
- emit(randomizeHeight) {
94
- return {
95
- x: randomInteger(0, this._dimensions.x),
96
- y: randomizeHeight ? randomInteger(0, this._dimensions.y) : 0,
97
- z: 0,
98
- size: randomInteger(this._params.sizeRange.low, this._params.sizeRange.high),
99
- transparency: randomInteger(this._params.transparencyRange.low, this._params.transparencyRange.high),
100
- velocity: new Vector2d(randomFloat(this._params.velocityRange.low.x, this._params.velocityRange.high.x), randomFloat(this._params.velocityRange.low.y, this._params.velocityRange.high.y)),
101
- };
102
- }
103
- // Update the positions and velocities of all the particles based on the amount of time that has passed since the last update.
104
- updateParticles(elapsedSeconds) {
105
- // Determine if someone changed the desired number of particles.
106
- const particleDiscrepancy = this._params.numParticles - this._particles.length;
107
- if (particleDiscrepancy > 0) {
108
- // Birth new particles up to the new maximum.
109
- for (let i = 0; i < particleDiscrepancy; i++)
110
- this._particles.push(this.emit(true));
111
- }
112
- else {
113
- // Destroy extra particles.
114
- this._particles.length = this._params.numParticles;
115
- }
116
- const acceleration = new Vector2d();
117
- const velocity = new Vector2d();
118
- for (let i = 0; i < this._particles.length; i++) {
119
- // Apply some acceleration to produce random drift.
120
- const particle = this._particles[i];
121
- acceleration.set(randomFloat(this._params.accelerationRange.low.x, this._params.accelerationRange.high.x), randomFloat(this._params.accelerationRange.low.y, this._params.accelerationRange.high.y));
122
- acceleration.scale(elapsedSeconds, acceleration);
123
- particle.velocity.plus(acceleration, particle.velocity);
124
- // Apply velocity.
125
- particle.velocity.clone(velocity);
126
- velocity.scale(elapsedSeconds, velocity);
127
- particle.x += velocity.x;
128
- particle.y += velocity.y;
129
- // Apply wind
130
- particle.x += this._params.windVelocity * elapsedSeconds;
131
- // Particles that travel beyond the viewport's left or right edges wrap around to the other side.
132
- if (particle.x < 0)
133
- particle.x = this._dimensions.x - 1;
134
- else if (particle.x >= this._dimensions.x)
135
- particle.x = 0;
136
- // Particles that travel beyond the viewport's bottom or top edges are replaced by newborn particles.
137
- if (particle.y < 0 || particle.y >= this._dimensions.y)
138
- this._particles[i] = this.emit(false);
139
- }
140
- }
141
- /** Toggle this decorator for the specified viewport.
142
- * @param viewport The viewport to which the effect should be applied or removed.
143
- * @param enable `true` to enable the effect, `false` to disable it, or `undefined` to toggle the current state.
144
- */
145
- static async toggle(viewport, enable) {
146
- const decorator = this._decorators.get(viewport);
147
- if (undefined === enable)
148
- enable = undefined === decorator;
149
- if (undefined !== decorator && !enable)
150
- decorator.dispose();
151
- else if (undefined === decorator && enable) {
152
- // Create a texture to use for the particles.
153
- // Note: the decorator takes ownership of the texture, and disposes of it when the decorator is disposed.
154
- const image = await imageElementFromUrl(`${IModelApp.publicPath}sprites/particle_snow.png`);
155
- const texture = IModelApp.renderSystem.createTexture({
156
- ownership: "external",
157
- image: { source: image, transparency: TextureTransparency.Mixed },
158
- });
159
- new SnowDecorator(viewport, texture);
160
- }
161
- }
162
- }
163
- SnowDecorator._decorators = new Map();
164
- /** Toggles a decorator that simulates snow using particle effects.
165
- * @see [[SnowDecorator]] for the implementation of the decorator.
166
- * @beta
167
- */
168
- export class SnowEffect extends Tool {
169
- async run(enable) {
170
- const vp = IModelApp.viewManager.selectedView;
171
- if (vp)
172
- await SnowDecorator.toggle(vp, enable);
173
- return true;
174
- }
175
- async parseAndRun(...args) {
176
- const enable = parseToggle(args[0]);
177
- if (typeof enable !== "string")
178
- await this.run(enable);
179
- return true;
180
- }
181
- }
182
- SnowEffect.toolId = "SnowEffect";
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module Effects
7
+ */
8
+ import { dispose } from "@itwin/core-bentley";
9
+ import { Point2d, Range1d, Range2d, Vector2d } from "@itwin/core-geometry";
10
+ import { TextureTransparency } from "@itwin/core-common";
11
+ import { GraphicType, imageElementFromUrl, IModelApp, ParticleCollectionBuilder, Tool, } from "@itwin/core-frontend";
12
+ import { parseToggle } from "../tools/parseToggle";
13
+ import { randomFloat, randomInteger } from "./Random";
14
+ /** The default snow effect parameters used by newly-created SnowDecorators. */
15
+ const defaultSnowParams = {
16
+ numParticles: 2000,
17
+ sizeRange: Range1d.createXX(3, 22),
18
+ transparencyRange: Range1d.createXX(0, 50),
19
+ velocityRange: new Range2d(-30, 50, 30, 130),
20
+ accelerationRange: new Range2d(-1, -0.25, 1, 0.25),
21
+ windVelocity: 0,
22
+ };
23
+ /** Simulates snowfall in a [Viewport]($frontend) using particle effects.
24
+ * @see [[SnowEffect]] for a [Tool]($frontend) that toggles this decorator.
25
+ * @see [ParticleCollectionBuilder]($frontend) for defining custom particle effects.
26
+ * @beta
27
+ */
28
+ class SnowDecorator {
29
+ constructor(viewport, texture) {
30
+ /** The list of particles being drawn. */
31
+ this._particles = [];
32
+ this._params = { ...defaultSnowParams };
33
+ this.viewport = viewport;
34
+ this._dimensions = new Point2d(viewport.viewRect.width, viewport.viewRect.height);
35
+ this._lastUpdateTime = Date.now();
36
+ this._texture = texture;
37
+ // Tell the viewport to re-render the decorations every frame so that the snow particles animate smoothly.
38
+ const removeOnRender = viewport.onRender.addListener(() => viewport.invalidateDecorations());
39
+ // When the viewport is resized, replace this decorator with a new one to match the new dimensions.
40
+ const removeOnResized = viewport.onResized.addListener(() => {
41
+ // Transfer ownership of the texture to the new decorator.
42
+ const tex = this._texture;
43
+ this._texture = undefined;
44
+ this.dispose();
45
+ new SnowDecorator(viewport, tex);
46
+ });
47
+ // When the viewport is destroyed, dispose of this decorator too.
48
+ const removeOnDispose = viewport.onDisposed.addListener(() => this.dispose());
49
+ const removeDecorator = IModelApp.viewManager.addDecorator(this);
50
+ this.dispose = () => {
51
+ removeDecorator();
52
+ removeOnRender();
53
+ removeOnDispose();
54
+ removeOnResized();
55
+ this._texture = dispose(this._texture);
56
+ SnowDecorator._decorators.delete(viewport);
57
+ };
58
+ SnowDecorator._decorators.set(viewport, this);
59
+ // Initialize the particles.
60
+ for (let i = 0; i < this._params.numParticles; i++)
61
+ this._particles.push(this.emit(true));
62
+ }
63
+ decorate(context) {
64
+ if (context.viewport !== this.viewport || !this._texture)
65
+ return;
66
+ // Update the particles.
67
+ const now = Date.now();
68
+ const deltaMillis = now - this._lastUpdateTime;
69
+ this._lastUpdateTime = now;
70
+ this.updateParticles(deltaMillis / 1000);
71
+ // Create particle graphics.
72
+ const builder = ParticleCollectionBuilder.create({
73
+ viewport: this.viewport,
74
+ isViewCoords: true,
75
+ texture: this._texture,
76
+ size: (this._params.sizeRange.high - this._params.sizeRange.low) / 2,
77
+ });
78
+ for (const particle of this._particles)
79
+ builder.addParticle(particle);
80
+ const graphic = builder.finish();
81
+ if (graphic)
82
+ context.addDecoration(GraphicType.ViewOverlay, graphic);
83
+ }
84
+ /** Change some of the parameters affecting this decorator. */
85
+ configure(params) {
86
+ for (const key of Object.keys(params)) {
87
+ const val = params[key];
88
+ if (undefined !== val)
89
+ this._params[key] = val;
90
+ }
91
+ }
92
+ /** Emit a new particle with randomized properties. */
93
+ emit(randomizeHeight) {
94
+ return {
95
+ x: randomInteger(0, this._dimensions.x),
96
+ y: randomizeHeight ? randomInteger(0, this._dimensions.y) : 0,
97
+ z: 0,
98
+ size: randomInteger(this._params.sizeRange.low, this._params.sizeRange.high),
99
+ transparency: randomInteger(this._params.transparencyRange.low, this._params.transparencyRange.high),
100
+ velocity: new Vector2d(randomFloat(this._params.velocityRange.low.x, this._params.velocityRange.high.x), randomFloat(this._params.velocityRange.low.y, this._params.velocityRange.high.y)),
101
+ };
102
+ }
103
+ // Update the positions and velocities of all the particles based on the amount of time that has passed since the last update.
104
+ updateParticles(elapsedSeconds) {
105
+ // Determine if someone changed the desired number of particles.
106
+ const particleDiscrepancy = this._params.numParticles - this._particles.length;
107
+ if (particleDiscrepancy > 0) {
108
+ // Birth new particles up to the new maximum.
109
+ for (let i = 0; i < particleDiscrepancy; i++)
110
+ this._particles.push(this.emit(true));
111
+ }
112
+ else {
113
+ // Destroy extra particles.
114
+ this._particles.length = this._params.numParticles;
115
+ }
116
+ const acceleration = new Vector2d();
117
+ const velocity = new Vector2d();
118
+ for (let i = 0; i < this._particles.length; i++) {
119
+ // Apply some acceleration to produce random drift.
120
+ const particle = this._particles[i];
121
+ acceleration.set(randomFloat(this._params.accelerationRange.low.x, this._params.accelerationRange.high.x), randomFloat(this._params.accelerationRange.low.y, this._params.accelerationRange.high.y));
122
+ acceleration.scale(elapsedSeconds, acceleration);
123
+ particle.velocity.plus(acceleration, particle.velocity);
124
+ // Apply velocity.
125
+ particle.velocity.clone(velocity);
126
+ velocity.scale(elapsedSeconds, velocity);
127
+ particle.x += velocity.x;
128
+ particle.y += velocity.y;
129
+ // Apply wind
130
+ particle.x += this._params.windVelocity * elapsedSeconds;
131
+ // Particles that travel beyond the viewport's left or right edges wrap around to the other side.
132
+ if (particle.x < 0)
133
+ particle.x = this._dimensions.x - 1;
134
+ else if (particle.x >= this._dimensions.x)
135
+ particle.x = 0;
136
+ // Particles that travel beyond the viewport's bottom or top edges are replaced by newborn particles.
137
+ if (particle.y < 0 || particle.y >= this._dimensions.y)
138
+ this._particles[i] = this.emit(false);
139
+ }
140
+ }
141
+ /** Toggle this decorator for the specified viewport.
142
+ * @param viewport The viewport to which the effect should be applied or removed.
143
+ * @param enable `true` to enable the effect, `false` to disable it, or `undefined` to toggle the current state.
144
+ */
145
+ static async toggle(viewport, enable) {
146
+ const decorator = this._decorators.get(viewport);
147
+ if (undefined === enable)
148
+ enable = undefined === decorator;
149
+ if (undefined !== decorator && !enable)
150
+ decorator.dispose();
151
+ else if (undefined === decorator && enable) {
152
+ // Create a texture to use for the particles.
153
+ // Note: the decorator takes ownership of the texture, and disposes of it when the decorator is disposed.
154
+ const image = await imageElementFromUrl(`${IModelApp.publicPath}sprites/particle_snow.png`);
155
+ const texture = IModelApp.renderSystem.createTexture({
156
+ ownership: "external",
157
+ image: { source: image, transparency: TextureTransparency.Mixed },
158
+ });
159
+ new SnowDecorator(viewport, texture);
160
+ }
161
+ }
162
+ }
163
+ SnowDecorator._decorators = new Map();
164
+ export { SnowDecorator };
165
+ /** Toggles a decorator that simulates snow using particle effects.
166
+ * @see [[SnowDecorator]] for the implementation of the decorator.
167
+ * @beta
168
+ */
169
+ class SnowEffect extends Tool {
170
+ async run(enable) {
171
+ const vp = IModelApp.viewManager.selectedView;
172
+ if (vp)
173
+ await SnowDecorator.toggle(vp, enable);
174
+ return true;
175
+ }
176
+ async parseAndRun(...args) {
177
+ const enable = parseToggle(args[0]);
178
+ if (typeof enable !== "string")
179
+ await this.run(enable);
180
+ return true;
181
+ }
182
+ }
183
+ SnowEffect.toolId = "SnowEffect";
184
+ export { SnowEffect };
183
185
  //# 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,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAA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,MAAM,OAAO,UAAW,SAAQ,IAAI;IAGlB,KAAK,CAAC,GAAG,CAAC,MAAgB;QACxC,MAAM,EAAE,GAAG,SAAS,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,WAAW,CAAC,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;;AAhBsB,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.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,EAAE,mBAAmB,CAAC,KAAK,EAAE;aAClE,CAAC,CAAC;YAEH,IAAI,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;SACtC;IACH,CAAC;;AAxBuB,yBAAW,GAAG,IAAI,GAAG,EAA2B,AAArC,CAAsC;SAnJ9D,aAAa;AA8K1B;;;GAGG;AACH,MAAa,UAAW,SAAQ,IAAI;IAGlB,KAAK,CAAC,GAAG,CAAC,MAAgB;QACxC,MAAM,EAAE,GAAG,SAAS,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,WAAW,CAAC,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;;AAhBsB,iBAAM,GAAG,YAAY,CAAC;SADlC,UAAU","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,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