@itwin/frontend-devtools 5.0.0-dev.9 → 5.0.0-dev.90
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.
- package/CHANGELOG.md +51 -1
- package/lib/cjs/ClipboardUtilities.js.map +1 -1
- package/lib/cjs/FrontEndDevTools.js +1 -1
- package/lib/cjs/FrontEndDevTools.js.map +1 -1
- package/lib/cjs/effects/Convolution.js +23 -23
- package/lib/cjs/effects/Convolution.js.map +1 -1
- package/lib/cjs/effects/EffectTools.js +2 -2
- package/lib/cjs/effects/EffectTools.js.map +1 -1
- package/lib/cjs/effects/Explosion.js +37 -25
- package/lib/cjs/effects/Explosion.js.map +1 -1
- package/lib/cjs/effects/FlipImage.js +22 -22
- package/lib/cjs/effects/FlipImage.js.map +1 -1
- package/lib/cjs/effects/LensDistortion.js +25 -25
- package/lib/cjs/effects/LensDistortion.js.map +1 -1
- package/lib/cjs/effects/Random.js.map +1 -1
- package/lib/cjs/effects/Saturation.js +30 -30
- package/lib/cjs/effects/Saturation.js.map +1 -1
- package/lib/cjs/effects/Snow.d.ts +1 -1
- package/lib/cjs/effects/Snow.d.ts.map +1 -1
- package/lib/cjs/effects/Snow.js +19 -8
- package/lib/cjs/effects/Snow.js.map +1 -1
- package/lib/cjs/effects/Vignette.js +41 -41
- package/lib/cjs/effects/Vignette.js.map +1 -1
- package/lib/cjs/frontend-devtools.js.map +1 -1
- package/lib/cjs/tools/AnimationIntervalTool.js +1 -1
- package/lib/cjs/tools/AnimationIntervalTool.js.map +1 -1
- package/lib/cjs/tools/ChangeUnitsTool.js +1 -1
- package/lib/cjs/tools/ChangeUnitsTool.js.map +1 -1
- package/lib/cjs/tools/ClipTools.js +6 -8
- package/lib/cjs/tools/ClipTools.js.map +1 -1
- package/lib/cjs/tools/DisplayStyleTools.js +21 -25
- package/lib/cjs/tools/DisplayStyleTools.js.map +1 -1
- package/lib/cjs/tools/EmphasizeElementsTool.js +7 -13
- package/lib/cjs/tools/EmphasizeElementsTool.js.map +1 -1
- package/lib/cjs/tools/FrustumDecoration.js +28 -9
- package/lib/cjs/tools/FrustumDecoration.js.map +1 -1
- package/lib/cjs/tools/InspectElementTool.js +7 -6
- package/lib/cjs/tools/InspectElementTool.js.map +1 -1
- package/lib/cjs/tools/MapLayerTool.js +24 -20
- package/lib/cjs/tools/MapLayerTool.js.map +1 -1
- package/lib/cjs/tools/MeasureTileLoadTime.js +4 -1
- package/lib/cjs/tools/MeasureTileLoadTime.js.map +1 -1
- package/lib/cjs/tools/ModelAppearanceTools.js +9 -9
- package/lib/cjs/tools/ModelAppearanceTools.js.map +1 -1
- package/lib/cjs/tools/PlanProjectionTools.js +8 -15
- package/lib/cjs/tools/PlanProjectionTools.js.map +1 -1
- package/lib/cjs/tools/PlanarMaskTools.js +21 -26
- package/lib/cjs/tools/PlanarMaskTools.js.map +1 -1
- package/lib/cjs/tools/ProjectExtents.js +6 -3
- package/lib/cjs/tools/ProjectExtents.js.map +1 -1
- package/lib/cjs/tools/RealityModelTools.js +10 -10
- package/lib/cjs/tools/RealityModelTools.js.map +1 -1
- package/lib/cjs/tools/RealityTransitionTool.js +1 -1
- package/lib/cjs/tools/RealityTransitionTool.js.map +1 -1
- package/lib/cjs/tools/RenderSystemTools.js +4 -3
- package/lib/cjs/tools/RenderSystemTools.js.map +1 -1
- package/lib/cjs/tools/RenderTargetTools.d.ts +1 -1
- package/lib/cjs/tools/RenderTargetTools.d.ts.map +1 -1
- package/lib/cjs/tools/RenderTargetTools.js +15 -20
- package/lib/cjs/tools/RenderTargetTools.js.map +1 -1
- package/lib/cjs/tools/ReportWebGLCompatibilityTool.js +1 -1
- package/lib/cjs/tools/ReportWebGLCompatibilityTool.js.map +1 -1
- package/lib/cjs/tools/SavedViews.js +4 -7
- package/lib/cjs/tools/SavedViews.js.map +1 -1
- package/lib/cjs/tools/ScheduleScriptTools.d.ts.map +1 -1
- package/lib/cjs/tools/ScheduleScriptTools.js +11 -12
- package/lib/cjs/tools/ScheduleScriptTools.js.map +1 -1
- package/lib/cjs/tools/SelectionTools.js +4 -6
- package/lib/cjs/tools/SelectionTools.js.map +1 -1
- package/lib/cjs/tools/SetGpuMemoryLimitTool.js +1 -1
- package/lib/cjs/tools/SetGpuMemoryLimitTool.js.map +1 -1
- package/lib/cjs/tools/SourceAspectIdTools.js +2 -2
- package/lib/cjs/tools/SourceAspectIdTools.js.map +1 -1
- package/lib/cjs/tools/TileRequestDecoration.js +6 -3
- package/lib/cjs/tools/TileRequestDecoration.js.map +1 -1
- package/lib/cjs/tools/TileTreeBoundsDecoration.d.ts.map +1 -1
- package/lib/cjs/tools/TileTreeBoundsDecoration.js +8 -4
- package/lib/cjs/tools/TileTreeBoundsDecoration.js.map +1 -1
- package/lib/cjs/tools/ToolTipProvider.js +2 -1
- package/lib/cjs/tools/ToolTipProvider.js.map +1 -1
- package/lib/cjs/tools/ViewportTools.js +22 -19
- package/lib/cjs/tools/ViewportTools.js.map +1 -1
- package/lib/cjs/tools/parseArgs.js.map +1 -1
- package/lib/cjs/tools/parseBoolean.js.map +1 -1
- package/lib/cjs/tools/parseToggle.js.map +1 -1
- package/lib/cjs/ui/Button.js.map +1 -1
- package/lib/cjs/ui/CheckBox.js.map +1 -1
- package/lib/cjs/ui/ColorInput.js.map +1 -1
- package/lib/cjs/ui/ComboBox.js.map +1 -1
- package/lib/cjs/ui/DataList.js.map +1 -1
- package/lib/cjs/ui/NestedMenu.js.map +1 -1
- package/lib/cjs/ui/NumericInput.js.map +1 -1
- package/lib/cjs/ui/RadioBox.js.map +1 -1
- package/lib/cjs/ui/Slider.js.map +1 -1
- package/lib/cjs/ui/TextBox.js.map +1 -1
- package/lib/cjs/widgets/DiagnosticsPanel.d.ts +1 -1
- package/lib/cjs/widgets/DiagnosticsPanel.d.ts.map +1 -1
- package/lib/cjs/widgets/DiagnosticsPanel.js +11 -1
- package/lib/cjs/widgets/DiagnosticsPanel.js.map +1 -1
- package/lib/cjs/widgets/FpsTracker.d.ts +1 -1
- package/lib/cjs/widgets/FpsTracker.d.ts.map +1 -1
- package/lib/cjs/widgets/FpsTracker.js +5 -1
- package/lib/cjs/widgets/FpsTracker.js.map +1 -1
- package/lib/cjs/widgets/GpuProfiler.d.ts +1 -1
- package/lib/cjs/widgets/GpuProfiler.d.ts.map +1 -1
- package/lib/cjs/widgets/GpuProfiler.js +89 -82
- package/lib/cjs/widgets/GpuProfiler.js.map +1 -1
- package/lib/cjs/widgets/KeyinField.js +8 -1
- package/lib/cjs/widgets/KeyinField.js.map +1 -1
- package/lib/cjs/widgets/MemoryTracker.d.ts +1 -1
- package/lib/cjs/widgets/MemoryTracker.d.ts.map +1 -1
- package/lib/cjs/widgets/MemoryTracker.js +16 -4
- package/lib/cjs/widgets/MemoryTracker.js.map +1 -1
- package/lib/cjs/widgets/RenderCommandBreakdown.d.ts +1 -1
- package/lib/cjs/widgets/RenderCommandBreakdown.d.ts.map +1 -1
- package/lib/cjs/widgets/RenderCommandBreakdown.js +6 -2
- package/lib/cjs/widgets/RenderCommandBreakdown.js.map +1 -1
- package/lib/cjs/widgets/TileMemoryBreakdown.d.ts +1 -1
- package/lib/cjs/widgets/TileMemoryBreakdown.d.ts.map +1 -1
- package/lib/cjs/widgets/TileMemoryBreakdown.js +10 -8
- package/lib/cjs/widgets/TileMemoryBreakdown.js.map +1 -1
- package/lib/cjs/widgets/TileStatisticsTracker.d.ts +1 -1
- package/lib/cjs/widgets/TileStatisticsTracker.d.ts.map +1 -1
- package/lib/cjs/widgets/TileStatisticsTracker.js +5 -2
- package/lib/cjs/widgets/TileStatisticsTracker.js.map +1 -1
- package/lib/cjs/widgets/ToolSettingsTracker.d.ts +1 -1
- package/lib/cjs/widgets/ToolSettingsTracker.d.ts.map +1 -1
- package/lib/cjs/widgets/ToolSettingsTracker.js +2 -2
- package/lib/cjs/widgets/ToolSettingsTracker.js.map +1 -1
- package/lib/esm/ClipboardUtilities.js.map +1 -1
- package/lib/esm/FrontEndDevTools.js +1 -1
- package/lib/esm/FrontEndDevTools.js.map +1 -1
- package/lib/esm/effects/Convolution.js +23 -23
- package/lib/esm/effects/Convolution.js.map +1 -1
- package/lib/esm/effects/EffectTools.js +2 -2
- package/lib/esm/effects/EffectTools.js.map +1 -1
- package/lib/esm/effects/Explosion.js +37 -25
- package/lib/esm/effects/Explosion.js.map +1 -1
- package/lib/esm/effects/FlipImage.js +22 -22
- package/lib/esm/effects/FlipImage.js.map +1 -1
- package/lib/esm/effects/LensDistortion.js +25 -25
- package/lib/esm/effects/LensDistortion.js.map +1 -1
- package/lib/esm/effects/Random.js.map +1 -1
- package/lib/esm/effects/Saturation.js +30 -30
- package/lib/esm/effects/Saturation.js.map +1 -1
- package/lib/esm/effects/Snow.d.ts +1 -1
- package/lib/esm/effects/Snow.d.ts.map +1 -1
- package/lib/esm/effects/Snow.js +19 -8
- package/lib/esm/effects/Snow.js.map +1 -1
- package/lib/esm/effects/Vignette.js +41 -41
- package/lib/esm/effects/Vignette.js.map +1 -1
- package/lib/esm/frontend-devtools.js.map +1 -1
- package/lib/esm/tools/AnimationIntervalTool.js +1 -1
- package/lib/esm/tools/AnimationIntervalTool.js.map +1 -1
- package/lib/esm/tools/ChangeUnitsTool.js +1 -1
- package/lib/esm/tools/ChangeUnitsTool.js.map +1 -1
- package/lib/esm/tools/ClipTools.js +6 -8
- package/lib/esm/tools/ClipTools.js.map +1 -1
- package/lib/esm/tools/DisplayStyleTools.js +21 -25
- package/lib/esm/tools/DisplayStyleTools.js.map +1 -1
- package/lib/esm/tools/EmphasizeElementsTool.js +7 -13
- package/lib/esm/tools/EmphasizeElementsTool.js.map +1 -1
- package/lib/esm/tools/FrustumDecoration.js +28 -9
- package/lib/esm/tools/FrustumDecoration.js.map +1 -1
- package/lib/esm/tools/InspectElementTool.js +7 -6
- package/lib/esm/tools/InspectElementTool.js.map +1 -1
- package/lib/esm/tools/MapLayerTool.js +24 -20
- package/lib/esm/tools/MapLayerTool.js.map +1 -1
- package/lib/esm/tools/MeasureTileLoadTime.js +4 -1
- package/lib/esm/tools/MeasureTileLoadTime.js.map +1 -1
- package/lib/esm/tools/ModelAppearanceTools.js +9 -9
- package/lib/esm/tools/ModelAppearanceTools.js.map +1 -1
- package/lib/esm/tools/PlanProjectionTools.js +8 -15
- package/lib/esm/tools/PlanProjectionTools.js.map +1 -1
- package/lib/esm/tools/PlanarMaskTools.js +21 -26
- package/lib/esm/tools/PlanarMaskTools.js.map +1 -1
- package/lib/esm/tools/ProjectExtents.js +6 -3
- package/lib/esm/tools/ProjectExtents.js.map +1 -1
- package/lib/esm/tools/RealityModelTools.js +10 -10
- package/lib/esm/tools/RealityModelTools.js.map +1 -1
- package/lib/esm/tools/RealityTransitionTool.js +1 -1
- package/lib/esm/tools/RealityTransitionTool.js.map +1 -1
- package/lib/esm/tools/RenderSystemTools.js +4 -3
- package/lib/esm/tools/RenderSystemTools.js.map +1 -1
- package/lib/esm/tools/RenderTargetTools.d.ts +1 -1
- package/lib/esm/tools/RenderTargetTools.d.ts.map +1 -1
- package/lib/esm/tools/RenderTargetTools.js +15 -20
- package/lib/esm/tools/RenderTargetTools.js.map +1 -1
- package/lib/esm/tools/ReportWebGLCompatibilityTool.js +1 -1
- package/lib/esm/tools/ReportWebGLCompatibilityTool.js.map +1 -1
- package/lib/esm/tools/SavedViews.js +4 -7
- package/lib/esm/tools/SavedViews.js.map +1 -1
- package/lib/esm/tools/ScheduleScriptTools.d.ts.map +1 -1
- package/lib/esm/tools/ScheduleScriptTools.js +11 -12
- package/lib/esm/tools/ScheduleScriptTools.js.map +1 -1
- package/lib/esm/tools/SelectionTools.js +4 -6
- package/lib/esm/tools/SelectionTools.js.map +1 -1
- package/lib/esm/tools/SetGpuMemoryLimitTool.js +1 -1
- package/lib/esm/tools/SetGpuMemoryLimitTool.js.map +1 -1
- package/lib/esm/tools/SourceAspectIdTools.js +2 -2
- package/lib/esm/tools/SourceAspectIdTools.js.map +1 -1
- package/lib/esm/tools/TileRequestDecoration.js +6 -3
- package/lib/esm/tools/TileRequestDecoration.js.map +1 -1
- package/lib/esm/tools/TileTreeBoundsDecoration.d.ts.map +1 -1
- package/lib/esm/tools/TileTreeBoundsDecoration.js +8 -4
- package/lib/esm/tools/TileTreeBoundsDecoration.js.map +1 -1
- package/lib/esm/tools/ToolTipProvider.js +2 -1
- package/lib/esm/tools/ToolTipProvider.js.map +1 -1
- package/lib/esm/tools/ViewportTools.js +22 -19
- package/lib/esm/tools/ViewportTools.js.map +1 -1
- package/lib/esm/tools/parseArgs.js.map +1 -1
- package/lib/esm/tools/parseBoolean.js.map +1 -1
- package/lib/esm/tools/parseToggle.js.map +1 -1
- package/lib/esm/ui/Button.js.map +1 -1
- package/lib/esm/ui/CheckBox.js.map +1 -1
- package/lib/esm/ui/ColorInput.js.map +1 -1
- package/lib/esm/ui/ComboBox.js.map +1 -1
- package/lib/esm/ui/DataList.js.map +1 -1
- package/lib/esm/ui/NestedMenu.js.map +1 -1
- package/lib/esm/ui/NumericInput.js.map +1 -1
- package/lib/esm/ui/RadioBox.js.map +1 -1
- package/lib/esm/ui/Slider.js.map +1 -1
- package/lib/esm/ui/TextBox.js.map +1 -1
- package/lib/esm/widgets/DiagnosticsPanel.d.ts +1 -1
- package/lib/esm/widgets/DiagnosticsPanel.d.ts.map +1 -1
- package/lib/esm/widgets/DiagnosticsPanel.js +11 -1
- package/lib/esm/widgets/DiagnosticsPanel.js.map +1 -1
- package/lib/esm/widgets/FpsTracker.d.ts +1 -1
- package/lib/esm/widgets/FpsTracker.d.ts.map +1 -1
- package/lib/esm/widgets/FpsTracker.js +5 -1
- package/lib/esm/widgets/FpsTracker.js.map +1 -1
- package/lib/esm/widgets/GpuProfiler.d.ts +1 -1
- package/lib/esm/widgets/GpuProfiler.d.ts.map +1 -1
- package/lib/esm/widgets/GpuProfiler.js +89 -82
- package/lib/esm/widgets/GpuProfiler.js.map +1 -1
- package/lib/esm/widgets/KeyinField.js +8 -1
- package/lib/esm/widgets/KeyinField.js.map +1 -1
- package/lib/esm/widgets/MemoryTracker.d.ts +1 -1
- package/lib/esm/widgets/MemoryTracker.d.ts.map +1 -1
- package/lib/esm/widgets/MemoryTracker.js +16 -4
- package/lib/esm/widgets/MemoryTracker.js.map +1 -1
- package/lib/esm/widgets/RenderCommandBreakdown.d.ts +1 -1
- package/lib/esm/widgets/RenderCommandBreakdown.d.ts.map +1 -1
- package/lib/esm/widgets/RenderCommandBreakdown.js +6 -2
- package/lib/esm/widgets/RenderCommandBreakdown.js.map +1 -1
- package/lib/esm/widgets/TileMemoryBreakdown.d.ts +1 -1
- package/lib/esm/widgets/TileMemoryBreakdown.d.ts.map +1 -1
- package/lib/esm/widgets/TileMemoryBreakdown.js +10 -8
- package/lib/esm/widgets/TileMemoryBreakdown.js.map +1 -1
- package/lib/esm/widgets/TileStatisticsTracker.d.ts +1 -1
- package/lib/esm/widgets/TileStatisticsTracker.d.ts.map +1 -1
- package/lib/esm/widgets/TileStatisticsTracker.js +5 -2
- package/lib/esm/widgets/TileStatisticsTracker.js.map +1 -1
- package/lib/esm/widgets/ToolSettingsTracker.d.ts +1 -1
- package/lib/esm/widgets/ToolSettingsTracker.d.ts.map +1 -1
- package/lib/esm/widgets/ToolSettingsTracker.js +2 -2
- package/lib/esm/widgets/ToolSettingsTracker.js.map +1 -1
- package/lib/public/locales/en/FrontendDevTools.json +494 -494
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LensDistortion.js","sourceRoot":"","sources":["../../../src/effects/LensDistortion.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAA4B,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAChG,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;;;;GAKG;AAC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,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3C,MAAM,KAAc,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAE3C,MAAM,CAAC,QAAQ,GAAG,GAAG,CAAC;IACtB,MAAM,CAAC,gBAAgB,GAAG,GAAG,CAAC;IAErB,KAAK,CAAC,GAAG,CAAC,QAAiB,EAAE,KAAc;QACzD,oBAAoB,CAAC,QAAQ,GAAG,QAAQ,IAAI,GAAG,CAAC;QAChD,oBAAoB,CAAC,gBAAgB,GAAG,KAAK,IAAI,GAAG,CAAC;QACrD,yBAAyB,CAAC,oBAAoB,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC;IACd,CAAC;IAEe,KAAK,CAAC,WAAW,CAAC,GAAG,KAAe;QAClD,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1D,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 { assert } from \"@itwin/core-bentley\";\nimport { ScreenSpaceEffectBuilder, Tool, UniformType, VaryingType } from \"@itwin/core-frontend\";\nimport { AddEffectTool, refreshViewportsForEffect } from \"./EffectTools\";\nimport { parseArgs } from \"../tools/parseArgs\";\n\n/** Adds a screen-space effect to the selected [[Viewport]] to simulate the lens distortion produced by real-world cameras with very wide fields of view.\n * Based on https://www.decarpentier.nl/lens-distortion\n * The effect is improved considerably by enabling anti-aliasing (e.g., via [RenderSystem.Options.antialiasSamples]($frontend) at startup, or using the `fdt aasamples` key-in`).\n * @note Because this effect applies a non-linear transform to each pixel, operations like snapping to geometry will not work properly. Element locate will work however - @see [ScreenSpaceEffectSource.sampleSourcePixel]($frontend).\n * @beta\n */\nexport class LensDistortionEffect extends AddEffectTool {\n public static override toolId = \"LensDistortionEffect\";\n\n protected get effectName() { return \"lensdistortion\"; }\n protected get textureCoordFromPosition() { return true; }\n\n protected get source() {\n return {\n vertex: `\n void effectMain(vec4 position) {\n vec2 uv = textureCoordFromPosition(position);\n float scaledHeight = strength * height;\n float cylAspectRatio = aspectRatio * cylindricalRatio;\n float aspectDiagSq = aspectRatio * aspectRatio + 1.0;\n float diagSq = scaledHeight * scaledHeight * aspectDiagSq;\n vec2 signedUV = (2.0 * uv + vec2(-1.0, -1.0));\n\n float z = 0.5 * sqrt(diagSq + 1.0) + 0.5;\n float ny = (z - 1.0) / (cylAspectRatio * cylAspectRatio + 1.0);\n\n vUVDot = sqrt(ny) * vec2(cylAspectRatio, 1.0) * signedUV;\n vUV = vec3(0.5, 0.5, 1.0) * z + vec3(-0.5, -0.5, 0.0);\n vUV.xy += uv;\n }`,\n // We simply shift pixels - we don't alter their colors.\n fragment: `\n vec4 effectMain() {\n return sampleSourcePixel();\n }`,\n // Because we're moving pixels around, we must tell the render system where the source pixel was originally located - otherwise\n // element locate will not work correctly.\n sampleSourcePixel: `\n vec3 uv = dot(vUVDot, vUVDot) * vec3(-0.5, -0.5, -1.0) + vUV;\n return TEXTURE_PROJ(u_diffuse, uv);\n `,\n };\n }\n\n protected defineEffect(builder: ScreenSpaceEffectBuilder): void {\n // Lens distortion is only applicable to views with the camera enabled.\n builder.shouldApply = (context) => context.viewport.isCameraOn;\n\n builder.addVarying(\"vUV\", VaryingType.Vec3);\n builder.addVarying(\"vUVDot\", VaryingType.Vec2);\n\n builder.addUniform({\n name: \"strength\",\n type: UniformType.Float,\n bind: (uniform) => uniform.setUniform1f(LensDistortionConfig.strength),\n });\n builder.addUniform({\n name: \"cylindricalRatio\",\n type: UniformType.Float,\n bind: (uniform) => uniform.setUniform1f(LensDistortionConfig.cylindricalRatio),\n });\n builder.addUniform({\n name: \"aspectRatio\",\n type: UniformType.Float,\n bind: (uniform, context) => uniform.setUniform1f(context.viewport.viewRect.aspect),\n });\n builder.addUniform({\n name: \"height\",\n type: UniformType.Float,\n bind: (uniform, context) => {\n assert(context.viewport.view.is3d() && context.viewport.view.isCameraOn);\n const fov = context.viewport.view.camera.lens.radians;\n const height = Math.tan(fov / 2) / context.viewport.viewRect.aspect;\n uniform.setUniform1f(height);\n },\n });\n }\n}\n\n/** Configures the [[LensDistortionEffect]].\n * @beta\n */\nexport class LensDistortionConfig extends Tool {\n public static override toolId = \"LensDistortionConfig\";\n public static override get minArgs() { return 0; }\n public static override get maxArgs() { return 2; }\n\n public static strength = 0.5;\n public static cylindricalRatio = 0.5;\n\n public override async run(strength?: number, ratio?: number): Promise<boolean> {\n LensDistortionConfig.strength = strength ?? 0.5;\n LensDistortionConfig.cylindricalRatio = ratio ?? 0.5;\n refreshViewportsForEffect(\"fdt lensdistortion\");\n return true;\n }\n\n public override async parseAndRun(...input: string[]): Promise<boolean> {\n const args = parseArgs(input);\n return this.run(args.getFloat(\"s\"), args.getFloat(\"r\"));\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Random.js","sourceRoot":"","sources":["../../../src/effects/Random.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAoB,MAAM,sBAAsB,CAAC;AAEjE;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW,EAAE,GAAW;IACpD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;AAC3D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAc;IACjD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC;AAC9E,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW,EAAE,GAAW;IAClD,OAAO,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,OAAO,WAAW,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAc;IAClD,MAAM,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjD,MAAM,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjD,MAAM,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjD,OAAO,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"Random.js","sourceRoot":"","sources":["../../../src/effects/Random.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAoB,MAAM,sBAAsB,CAAC;AAEjE;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW,EAAE,GAAW;IACpD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;AAC3D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAc;IACjD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC;AAC9E,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW,EAAE,GAAW;IAClD,OAAO,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,OAAO,WAAW,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAc;IAClD,MAAM,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjD,MAAM,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjD,MAAM,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjD,OAAO,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9B,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 { Point3d, Range1d, Range3d } from \"@itwin/core-geometry\";\n\n/** Generate integer in [min, max].\n * @beta\n */\nexport function randomInteger(min: number, max: number): number {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n}\n\n/** Generate random integer in [range.low, range.high].\n * @beta\n */\nexport function randomIntegerInRange(range: Range1d): number {\n return Math.floor(Math.random() * (range.high - range.low + 1)) + range.low;\n}\n\n/** Generate random floating-point number in [min, max).\n * @beta\n */\nexport function randomFloat(min: number, max: number): number {\n return Math.random() * (max - min) + min;\n}\n\n/** Generate random floating-point number in [range.low, range.high).\n * @beta\n */\nexport function randomFloatInRange(range: Range1d): number {\n return randomFloat(range.low, range.high);\n}\n\n/** Generate a random position in the specified range.\n * @beta\n */\nexport function randomPositionInRange(range: Range3d): Point3d {\n const x = randomFloat(range.low.x, range.high.x);\n const y = randomFloat(range.low.y, range.high.y);\n const z = randomFloat(range.low.z, range.high.z);\n return new Point3d(x, y, z);\n}\n"]}
|
|
@@ -12,40 +12,41 @@ import { AddEffectTool, refreshViewportsForEffect } from "./EffectTools";
|
|
|
12
12
|
* @beta
|
|
13
13
|
*/
|
|
14
14
|
export class SaturationEffect extends AddEffectTool {
|
|
15
|
+
static toolId = "SaturationEffect";
|
|
15
16
|
get effectName() { return "Saturation"; }
|
|
16
17
|
get textureCoordFromPosition() { return true; }
|
|
17
18
|
get source() {
|
|
18
19
|
// rgb <-> hsl conversion routines from https://gamedev.stackexchange.com/questions/59797/glsl-shader-change-hue-saturation-brightness
|
|
19
20
|
return {
|
|
20
21
|
// Vertex shader simply computes texture coordinate for source pixel.
|
|
21
|
-
vertex: `
|
|
22
|
-
void effectMain(vec4 pos) {
|
|
23
|
-
v_texCoord = textureCoordFromPosition(pos);
|
|
22
|
+
vertex: `
|
|
23
|
+
void effectMain(vec4 pos) {
|
|
24
|
+
v_texCoord = textureCoordFromPosition(pos);
|
|
24
25
|
}`,
|
|
25
26
|
// Fragment shader converts color to HSV, adjusts the saturation, and converts back to RGB.
|
|
26
|
-
fragment: `
|
|
27
|
-
vec3 rgb2hsv(vec3 c) {
|
|
28
|
-
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
|
29
|
-
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
|
|
30
|
-
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
|
|
31
|
-
|
|
32
|
-
float d = q.x - min(q.w, q.y);
|
|
33
|
-
float e = 1.0e-10;
|
|
34
|
-
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
vec3 hsv2rgb(vec3 c) {
|
|
38
|
-
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
|
39
|
-
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
|
40
|
-
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
vec4 effectMain() {
|
|
44
|
-
vec4 color = TEXTURE(u_diffuse, v_texCoord);
|
|
45
|
-
color.rgb = rgb2hsv(color.rgb);
|
|
46
|
-
color.rgb.y = color.rgb.y * u_saturationMult;
|
|
47
|
-
color.rgb = hsv2rgb(color.rgb);
|
|
48
|
-
return color;
|
|
27
|
+
fragment: `
|
|
28
|
+
vec3 rgb2hsv(vec3 c) {
|
|
29
|
+
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
|
30
|
+
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
|
|
31
|
+
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
|
|
32
|
+
|
|
33
|
+
float d = q.x - min(q.w, q.y);
|
|
34
|
+
float e = 1.0e-10;
|
|
35
|
+
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
vec3 hsv2rgb(vec3 c) {
|
|
39
|
+
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
|
40
|
+
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
|
41
|
+
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
vec4 effectMain() {
|
|
45
|
+
vec4 color = TEXTURE(u_diffuse, v_texCoord);
|
|
46
|
+
color.rgb = rgb2hsv(color.rgb);
|
|
47
|
+
color.rgb.y = color.rgb.y * u_saturationMult;
|
|
48
|
+
color.rgb = hsv2rgb(color.rgb);
|
|
49
|
+
return color;
|
|
49
50
|
}`,
|
|
50
51
|
};
|
|
51
52
|
}
|
|
@@ -58,13 +59,15 @@ export class SaturationEffect extends AddEffectTool {
|
|
|
58
59
|
});
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
|
-
SaturationEffect.toolId = "SaturationEffect";
|
|
62
62
|
/** Configures the [[SaturationEffect]].
|
|
63
63
|
* @beta
|
|
64
64
|
*/
|
|
65
65
|
export class SaturationConfig extends Tool {
|
|
66
|
+
static toolId = "SaturationConfig";
|
|
66
67
|
static get minArgs() { return 0; }
|
|
67
68
|
static get maxArgs() { return 1; }
|
|
69
|
+
/** Multiplier applied to the saturation of each color in the source image. */
|
|
70
|
+
static multiplier = 2.0;
|
|
68
71
|
async run(multiplier) {
|
|
69
72
|
SaturationConfig.multiplier = multiplier ?? 2.0;
|
|
70
73
|
refreshViewportsForEffect("fdt Saturation");
|
|
@@ -75,7 +78,4 @@ export class SaturationConfig extends Tool {
|
|
|
75
78
|
return this.run(args.getFloat("s"));
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
|
-
SaturationConfig.toolId = "SaturationConfig";
|
|
79
|
-
/** Multiplier applied to the saturation of each color in the source image. */
|
|
80
|
-
SaturationConfig.multiplier = 2.0;
|
|
81
81
|
//# sourceMappingURL=Saturation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Saturation.js","sourceRoot":"","sources":["../../../src/effects/Saturation.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAA4B,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAEzE;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,aAAa;
|
|
1
|
+
{"version":3,"file":"Saturation.js","sourceRoot":"","sources":["../../../src/effects/Saturation.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAA4B,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAEzE;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,aAAa;IAC1C,MAAM,CAAU,MAAM,GAAG,kBAAkB,CAAC;IAEnD,IAAc,UAAU,KAAK,OAAO,YAAY,CAAC,CAAC,CAAC;IACnD,IAAc,wBAAwB,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC;IAEzD,IAAc,MAAM;QAClB,sIAAsI;QACtI,OAAO;YACL,qEAAqE;YACrE,MAAM,EAAE;;;UAGJ;YACJ,2FAA2F;YAC3F,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;UAuBN;SACL,CAAC;IACJ,CAAC;IAES,YAAY,CAAC,OAAiC;QACtD,OAAO,CAAC,UAAU,CAAC,YAAY,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;QACnD,OAAO,CAAC,UAAU,CAAC;YACjB,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,WAAW,CAAC,KAAK;YACvB,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,gBAAgB,CAAC,UAAU,CAAC;SACrE,CAAC,CAAC;IACL,CAAC;;AAGH;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,IAAI;IACjC,MAAM,CAAU,MAAM,GAAG,kBAAkB,CAAC;IAC5C,MAAM,KAAc,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3C,MAAM,KAAc,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAElD,8EAA8E;IACvE,MAAM,CAAC,UAAU,GAAG,GAAG,CAAC;IAEf,KAAK,CAAC,GAAG,CAAC,UAAmB;QAC3C,gBAAgB,CAAC,UAAU,GAAG,UAAU,IAAI,GAAG,CAAC;QAChD,yBAAyB,CAAC,gBAAgB,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC;IACd,CAAC;IAEe,KAAK,CAAC,WAAW,CAAC,GAAG,KAAe;QAClD,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IACtC,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 { ScreenSpaceEffectBuilder, Tool, UniformType, VaryingType } from \"@itwin/core-frontend\";\nimport { parseArgs } from \"../tools/parseArgs\";\nimport { AddEffectTool, refreshViewportsForEffect } from \"./EffectTools\";\n\n/** Adjusts the saturation of colors in a viewport.\n * @beta\n */\nexport class SaturationEffect extends AddEffectTool {\n public static override toolId = \"SaturationEffect\";\n\n protected get effectName() { return \"Saturation\"; }\n protected get textureCoordFromPosition() { return true; }\n\n protected get source() {\n // rgb <-> hsl conversion routines from https://gamedev.stackexchange.com/questions/59797/glsl-shader-change-hue-saturation-brightness\n return {\n // Vertex shader simply computes texture coordinate for source pixel.\n vertex: `\n void effectMain(vec4 pos) {\n v_texCoord = textureCoordFromPosition(pos);\n }`,\n // Fragment shader converts color to HSV, adjusts the saturation, and converts back to RGB.\n fragment: `\n vec3 rgb2hsv(vec3 c) {\n vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));\n vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));\n\n float d = q.x - min(q.w, q.y);\n float e = 1.0e-10;\n return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n }\n\n vec3 hsv2rgb(vec3 c) {\n vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n }\n\n vec4 effectMain() {\n vec4 color = TEXTURE(u_diffuse, v_texCoord);\n color.rgb = rgb2hsv(color.rgb);\n color.rgb.y = color.rgb.y * u_saturationMult;\n color.rgb = hsv2rgb(color.rgb);\n return color;\n }`,\n };\n }\n\n protected defineEffect(builder: ScreenSpaceEffectBuilder): void {\n builder.addVarying(\"v_texCoord\", VaryingType.Vec2);\n builder.addUniform({\n name: \"u_saturationMult\",\n type: UniformType.Float,\n bind: (uniform) => uniform.setUniform1f(SaturationConfig.multiplier),\n });\n }\n}\n\n/** Configures the [[SaturationEffect]].\n * @beta\n */\nexport class SaturationConfig extends Tool {\n public static override toolId = \"SaturationConfig\";\n public static override get minArgs() { return 0; }\n public static override get maxArgs() { return 1; }\n\n /** Multiplier applied to the saturation of each color in the source image. */\n public static multiplier = 2.0;\n\n public override async run(multiplier?: number): Promise<boolean> {\n SaturationConfig.multiplier = multiplier ?? 2.0;\n refreshViewportsForEffect(\"fdt Saturation\");\n return true;\n }\n\n public override async parseAndRun(...input: string[]): Promise<boolean> {\n const args = parseArgs(input);\n return this.run(args.getFloat(\"s\"));\n }\n}\n\n"]}
|
|
@@ -41,7 +41,7 @@ export declare class SnowDecorator implements Decorator {
|
|
|
41
41
|
/** The viewport being decorated. */
|
|
42
42
|
readonly viewport: Viewport;
|
|
43
43
|
/** Invoked when this decorator is to be destroyed. */
|
|
44
|
-
readonly dispose: VoidFunction;
|
|
44
|
+
readonly [Symbol.dispose]: VoidFunction;
|
|
45
45
|
/** The initial width and height of the viewport, from which we randomly select each particle's initial position. */
|
|
46
46
|
private readonly _dimensions;
|
|
47
47
|
/** The list of particles being drawn. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Snow.d.ts","sourceRoot":"","sources":["../../../src/effects/Snow.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAW,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE3E,OAAO,EACL,eAAe,EAAE,SAAS,EAA0E,aAAa,EAAE,IAAI,EAAE,QAAQ,EAClI,MAAM,sBAAsB,CAAC;AAI9B;;;GAGG;AACH,MAAM,WAAW,YAAa,SAAQ,aAAa;IACjD,oDAAoD;IACpD,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IAEV,8CAA8C;IAC9C,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,sKAAsK;IACtK,YAAY,EAAE,MAAM,CAAC;IACrB,2EAA2E;IAC3E,SAAS,EAAE,OAAO,CAAC;IACnB,wEAAwE;IACxE,iBAAiB,EAAE,OAAO,CAAC;IAC3B,kGAAkG;IAClG,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CAAC,EAAE,YAAY,CAAC;IAC/C,oHAAoH;IACpH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAU;IACtC,yCAAyC;IACzC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsB;IACjD,8CAA8C;IAC9C,OAAO,CAAC,QAAQ,CAAC,CAAgB;IACjC,sEAAsE;IACtE,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAa;IAErC,OAAO;IAuCA,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IA0B/C,8DAA8D;IACvD,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI;IAQnD,sDAAsD;IACtD,OAAO,CAAC,IAAI;IAaZ,OAAO,CAAC,eAAe;IA4CvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAsC;IAEzE;;;OAGG;WACiB,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAmBhF;AAED;;;GAGG;AACH,qBAAa,UAAW,SAAQ,IAAI;IAClC,OAAuB,MAAM,SAAgB;IAEvB,GAAG,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAQvC,WAAW,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;CAOvE"}
|
package/lib/esm/effects/Snow.js
CHANGED
|
@@ -26,9 +26,20 @@ const defaultSnowParams = {
|
|
|
26
26
|
* @beta
|
|
27
27
|
*/
|
|
28
28
|
export class SnowDecorator {
|
|
29
|
+
/** The viewport being decorated. */
|
|
30
|
+
viewport;
|
|
31
|
+
/** Invoked when this decorator is to be destroyed. */
|
|
32
|
+
[Symbol.dispose];
|
|
33
|
+
/** The initial width and height of the viewport, from which we randomly select each particle's initial position. */
|
|
34
|
+
_dimensions;
|
|
35
|
+
/** The list of particles being drawn. */
|
|
36
|
+
_particles = [];
|
|
37
|
+
/** The image to display for each particle. */
|
|
38
|
+
_texture;
|
|
39
|
+
/** The last time `updateParticles()` was invoked, in milliseconds. */
|
|
40
|
+
_lastUpdateTime;
|
|
41
|
+
_params;
|
|
29
42
|
constructor(viewport, texture) {
|
|
30
|
-
/** The list of particles being drawn. */
|
|
31
|
-
this._particles = [];
|
|
32
43
|
this._params = { ...defaultSnowParams };
|
|
33
44
|
this.viewport = viewport;
|
|
34
45
|
this._dimensions = new Point2d(viewport.viewRect.width, viewport.viewRect.height);
|
|
@@ -41,13 +52,13 @@ export class SnowDecorator {
|
|
|
41
52
|
// Transfer ownership of the texture to the new decorator.
|
|
42
53
|
const tex = this._texture;
|
|
43
54
|
this._texture = undefined;
|
|
44
|
-
this.dispose();
|
|
55
|
+
this[Symbol.dispose]();
|
|
45
56
|
new SnowDecorator(viewport, tex);
|
|
46
57
|
});
|
|
47
58
|
// When the viewport is destroyed, dispose of this decorator too.
|
|
48
|
-
const removeOnDispose = viewport.onDisposed.addListener(() => this.dispose());
|
|
59
|
+
const removeOnDispose = viewport.onDisposed.addListener(() => this[Symbol.dispose]());
|
|
49
60
|
const removeDecorator = IModelApp.viewManager.addDecorator(this);
|
|
50
|
-
this.dispose = () => {
|
|
61
|
+
this[Symbol.dispose] = () => {
|
|
51
62
|
removeDecorator();
|
|
52
63
|
removeOnRender();
|
|
53
64
|
removeOnDispose();
|
|
@@ -138,6 +149,7 @@ export class SnowDecorator {
|
|
|
138
149
|
this._particles[i] = this.emit(false);
|
|
139
150
|
}
|
|
140
151
|
}
|
|
152
|
+
static _decorators = new Map();
|
|
141
153
|
/** Toggle this decorator for the specified viewport.
|
|
142
154
|
* @param viewport The viewport to which the effect should be applied or removed.
|
|
143
155
|
* @param enable `true` to enable the effect, `false` to disable it, or `undefined` to toggle the current state.
|
|
@@ -147,7 +159,7 @@ export class SnowDecorator {
|
|
|
147
159
|
if (undefined === enable)
|
|
148
160
|
enable = undefined === decorator;
|
|
149
161
|
if (undefined !== decorator && !enable)
|
|
150
|
-
decorator.dispose();
|
|
162
|
+
decorator[Symbol.dispose]();
|
|
151
163
|
else if (undefined === decorator && enable) {
|
|
152
164
|
// Create a texture to use for the particles.
|
|
153
165
|
// Note: the decorator takes ownership of the texture, and disposes of it when the decorator is disposed.
|
|
@@ -160,12 +172,12 @@ export class SnowDecorator {
|
|
|
160
172
|
}
|
|
161
173
|
}
|
|
162
174
|
}
|
|
163
|
-
SnowDecorator._decorators = new Map();
|
|
164
175
|
/** Toggles a decorator that simulates snow using particle effects.
|
|
165
176
|
* @see [[SnowDecorator]] for the implementation of the decorator.
|
|
166
177
|
* @beta
|
|
167
178
|
*/
|
|
168
179
|
export class SnowEffect extends Tool {
|
|
180
|
+
static toolId = "SnowEffect";
|
|
169
181
|
async run(enable) {
|
|
170
182
|
const vp = IModelApp.viewManager.selectedView;
|
|
171
183
|
if (vp)
|
|
@@ -179,5 +191,4 @@ export class SnowEffect extends Tool {
|
|
|
179
191
|
return true;
|
|
180
192
|
}
|
|
181
193
|
}
|
|
182
|
-
SnowEffect.toolId = "SnowEffect";
|
|
183
194
|
//# 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,OAAO,EAAiB,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EACuB,WAAW,EAAE,mBAAmB,EAAE,SAAS,EAAE,yBAAyB,EAAiB,IAAI,GACxH,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,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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.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,OAAO,E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YAC3C,6CAA6C;YAC7C,yGAAyG;YACzG,MAAM,KAAK,GAAG,MAAM,mBAAmB,CAAC,GAAG,SAAS,CAAC,UAAU,2BAA2B,CAAC,CAAC;YAC5F,MAAM,OAAO,GAAG,SAAS,CAAC,YAAY,CAAC,aAAa,CAAC;gBACnD,SAAS,EAAE,UAAU;gBACrB,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,mBAAmB,CAAC,KAAK,EAAE;aAClE,CAAC,CAAC;YAEH,IAAI,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;;AAGH;;;GAGG;AACH,MAAM,OAAO,UAAW,SAAQ,IAAI;IAC3B,MAAM,CAAU,MAAM,GAAG,YAAY,CAAC;IAE7B,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","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 [Symbol.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[Symbol.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[Symbol.dispose]());\n const removeDecorator = IModelApp.viewManager.addDecorator(this);\n\n this[Symbol.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[Symbol.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"]}
|
|
@@ -13,40 +13,41 @@ import { AddEffectTool, refreshViewportsForEffect } from "./EffectTools";
|
|
|
13
13
|
* @beta
|
|
14
14
|
*/
|
|
15
15
|
export class VignetteEffect extends AddEffectTool {
|
|
16
|
+
static toolId = "VignetteEffect";
|
|
16
17
|
get effectName() { return "Vignette"; }
|
|
17
18
|
get textureCoordFromPosition() { return true; }
|
|
18
19
|
get source() {
|
|
19
20
|
return {
|
|
20
|
-
vertex: `
|
|
21
|
-
void effectMain(vec4 pos) {
|
|
22
|
-
v_texCoord = textureCoordFromPosition(pos);
|
|
23
|
-
}
|
|
21
|
+
vertex: `
|
|
22
|
+
void effectMain(vec4 pos) {
|
|
23
|
+
v_texCoord = textureCoordFromPosition(pos);
|
|
24
|
+
}
|
|
24
25
|
`,
|
|
25
|
-
fragment: `
|
|
26
|
-
float sdSquare(vec2 point, float width) {
|
|
27
|
-
vec2 d = abs(point) - width;
|
|
28
|
-
return min(max(d.x,d.y),0.0) + length(max(d,0.0));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
float vignette(vec2 uv, vec2 size, float roundness, float smoothness) {
|
|
32
|
-
// Center UVs
|
|
33
|
-
uv -= 0.5;
|
|
34
|
-
|
|
35
|
-
// Shift UVs based on the larger of width or height
|
|
36
|
-
float minWidth = min(size.x, size.y);
|
|
37
|
-
uv.x = sign(uv.x) * clamp(abs(uv.x) - abs(minWidth - size.x), 0.0, 1.0);
|
|
38
|
-
uv.y = sign(uv.y) * clamp(abs(uv.y) - abs(minWidth - size.y), 0.0, 1.0);
|
|
39
|
-
|
|
40
|
-
// Signed distance calculation
|
|
41
|
-
float boxSize = minWidth * (1.0 - roundness);
|
|
42
|
-
float dist = sdSquare(uv, boxSize) - (minWidth * roundness);
|
|
43
|
-
|
|
44
|
-
return 1.0 - smoothstep(0.0, smoothness, dist);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
vec4 effectMain() {
|
|
48
|
-
return TEXTURE(u_diffuse, v_texCoord) * vignette(v_texCoord, u_size, u_roundness, u_smoothness);
|
|
49
|
-
}
|
|
26
|
+
fragment: `
|
|
27
|
+
float sdSquare(vec2 point, float width) {
|
|
28
|
+
vec2 d = abs(point) - width;
|
|
29
|
+
return min(max(d.x,d.y),0.0) + length(max(d,0.0));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
float vignette(vec2 uv, vec2 size, float roundness, float smoothness) {
|
|
33
|
+
// Center UVs
|
|
34
|
+
uv -= 0.5;
|
|
35
|
+
|
|
36
|
+
// Shift UVs based on the larger of width or height
|
|
37
|
+
float minWidth = min(size.x, size.y);
|
|
38
|
+
uv.x = sign(uv.x) * clamp(abs(uv.x) - abs(minWidth - size.x), 0.0, 1.0);
|
|
39
|
+
uv.y = sign(uv.y) * clamp(abs(uv.y) - abs(minWidth - size.y), 0.0, 1.0);
|
|
40
|
+
|
|
41
|
+
// Signed distance calculation
|
|
42
|
+
float boxSize = minWidth * (1.0 - roundness);
|
|
43
|
+
float dist = sdSquare(uv, boxSize) - (minWidth * roundness);
|
|
44
|
+
|
|
45
|
+
return 1.0 - smoothstep(0.0, smoothness, dist);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
vec4 effectMain() {
|
|
49
|
+
return TEXTURE(u_diffuse, v_texCoord) * vignette(v_texCoord, u_size, u_roundness, u_smoothness);
|
|
50
|
+
}
|
|
50
51
|
`,
|
|
51
52
|
};
|
|
52
53
|
}
|
|
@@ -69,13 +70,23 @@ export class VignetteEffect extends AddEffectTool {
|
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
|
-
VignetteEffect.toolId = "VignetteEffect";
|
|
73
73
|
/** Configures the [[VignetteEffect]].
|
|
74
74
|
* @beta
|
|
75
75
|
*/
|
|
76
76
|
export class VignetteConfig extends Tool {
|
|
77
|
+
static toolId = "VignetteConfig";
|
|
77
78
|
static get minArgs() { return 0; }
|
|
78
79
|
static get maxArgs() { return 4; }
|
|
80
|
+
/** 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
|
|
81
|
+
* UV space, use (0.25, 0.25).
|
|
82
|
+
*/
|
|
83
|
+
static size = new Float32Array([0.25, 0.25]);
|
|
84
|
+
/** How round the vignette will be, from 0.0 (perfectly rectangular) to 1.0 (perfectly round). */
|
|
85
|
+
static roundness = 1.0;
|
|
86
|
+
/** How quickly the vignette fades in. The vignette starts fading in at the edge of the values provided by `size` and will be
|
|
87
|
+
* fully faded in at (size.x + smoothness, size.y * smoothness). A value of 0.0 produces a hard edge.
|
|
88
|
+
*/
|
|
89
|
+
static smoothness = 0.5;
|
|
79
90
|
async run(width, height, roundness, smoothness) {
|
|
80
91
|
const config = VignetteConfig;
|
|
81
92
|
config.size[0] = width ?? config.size[0];
|
|
@@ -90,15 +101,4 @@ export class VignetteConfig extends Tool {
|
|
|
90
101
|
return this.run(args.getFloat("w"), args.getFloat("h"), args.getFloat("r"), args.getFloat("s"));
|
|
91
102
|
}
|
|
92
103
|
}
|
|
93
|
-
VignetteConfig.toolId = "VignetteConfig";
|
|
94
|
-
/** 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
|
|
95
|
-
* UV space, use (0.25, 0.25).
|
|
96
|
-
*/
|
|
97
|
-
VignetteConfig.size = new Float32Array([0.25, 0.25]);
|
|
98
|
-
/** How round the vignette will be, from 0.0 (perfectly rectangular) to 1.0 (perfectly round). */
|
|
99
|
-
VignetteConfig.roundness = 1.0;
|
|
100
|
-
/** How quickly the vignette fades in. The vignette starts fading in at the edge of the values provided by `size` and will be
|
|
101
|
-
* fully faded in at (size.x + smoothness, size.y * smoothness). A value of 0.0 produces a hard edge.
|
|
102
|
-
*/
|
|
103
|
-
VignetteConfig.smoothness = 0.5;
|
|
104
104
|
//# sourceMappingURL=Vignette.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Vignette.js","sourceRoot":"","sources":["../../../src/effects/Vignette.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAA4B,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAEzE;;;GAGG;AACH,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AAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAClG,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 { ScreenSpaceEffectBuilder, Tool, UniformType, VaryingType } from \"@itwin/core-frontend\";\nimport { parseArgs } from \"../tools/parseArgs\";\nimport { AddEffectTool, refreshViewportsForEffect } from \"./EffectTools\";\n\n/** Applies a [vignette](https://en.wikipedia.org/wiki/Vignetting) effect to the viewport.\n * From https://github.com/TyLindberg/glsl-vignette/blob/master/advanced.glsl.\n * @beta\n */\nexport class VignetteEffect extends AddEffectTool {\n public static override toolId = \"VignetteEffect\";\n\n protected get effectName() { return \"Vignette\"; }\n protected get textureCoordFromPosition() { return true; }\n\n protected get source() {\n return {\n vertex: `\n void effectMain(vec4 pos) {\n v_texCoord = textureCoordFromPosition(pos);\n }\n `,\n fragment: `\n float sdSquare(vec2 point, float width) {\n vec2 d = abs(point) - width;\n return min(max(d.x,d.y),0.0) + length(max(d,0.0));\n }\n\n float vignette(vec2 uv, vec2 size, float roundness, float smoothness) {\n // Center UVs\n uv -= 0.5;\n\n // Shift UVs based on the larger of width or height\n float minWidth = min(size.x, size.y);\n uv.x = sign(uv.x) * clamp(abs(uv.x) - abs(minWidth - size.x), 0.0, 1.0);\n uv.y = sign(uv.y) * clamp(abs(uv.y) - abs(minWidth - size.y), 0.0, 1.0);\n\n // Signed distance calculation\n float boxSize = minWidth * (1.0 - roundness);\n float dist = sdSquare(uv, boxSize) - (minWidth * roundness);\n\n return 1.0 - smoothstep(0.0, smoothness, dist);\n }\n\n vec4 effectMain() {\n return TEXTURE(u_diffuse, v_texCoord) * vignette(v_texCoord, u_size, u_roundness, u_smoothness);\n }\n `,\n };\n }\n\n protected defineEffect(builder: ScreenSpaceEffectBuilder): void {\n builder.addVarying(\"v_texCoord\", VaryingType.Vec2);\n builder.addUniform({\n name: \"u_size\",\n type: UniformType.Vec2,\n bind: (uniform) => uniform.setUniform2fv(VignetteConfig.size),\n });\n builder.addUniform({\n name: \"u_roundness\",\n type: UniformType.Float,\n bind: (uniform) => uniform.setUniform1f(VignetteConfig.roundness),\n });\n builder.addUniform({\n name: \"u_smoothness\",\n type: UniformType.Float,\n bind: (uniform) => uniform.setUniform1f(VignetteConfig.smoothness),\n });\n }\n}\n\n/** Configures the [[VignetteEffect]].\n * @beta\n */\nexport class VignetteConfig extends Tool {\n public static override toolId = \"VignetteConfig\";\n public static override get minArgs() { return 0; }\n public static override get maxArgs() { return 4; }\n\n /** 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\n * UV space, use (0.25, 0.25).\n */\n public static readonly size = new Float32Array([0.25, 0.25]);\n\n /** How round the vignette will be, from 0.0 (perfectly rectangular) to 1.0 (perfectly round). */\n public static roundness = 1.0;\n\n /** How quickly the vignette fades in. The vignette starts fading in at the edge of the values provided by `size` and will be\n * fully faded in at (size.x + smoothness, size.y * smoothness). A value of 0.0 produces a hard edge.\n */\n public static smoothness = 0.5;\n\n public override async run(width?: number, height?: number, roundness?: number, smoothness?: number): Promise<boolean> {\n const config = VignetteConfig;\n config.size[0] = width ?? config.size[0];\n config.size[1] = height ?? config.size[1];\n config.roundness = roundness ?? config.roundness;\n config.smoothness = smoothness ?? config.smoothness;\n\n refreshViewportsForEffect(\"fdt Vignette\");\n return true;\n }\n\n public override async parseAndRun(...input: string[]): Promise<boolean> {\n const args = parseArgs(input);\n return this.run(args.getFloat(\"w\"), args.getFloat(\"h\"), args.getFloat(\"r\"), args.getFloat(\"s\"));\n }\n}\n"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AC;AAEtC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAE7B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAE9C;;GAEG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"frontend-devtools.js","sourceRoot":"","sources":["../../src/frontend-devtools.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AAEnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sCAAsC,CAAC;AACrD,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AAEtC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAE7B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAE9C;;GAEG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;GAGG","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\nexport * from \"./ClipboardUtilities\";\nexport * from \"./FrontEndDevTools\";\n\nexport * from \"./effects/Convolution\";\nexport * from \"./effects/EffectTools\";\nexport * from \"./effects/Explosion\";\nexport * from \"./effects/FlipImage\";\nexport * from \"./effects/LensDistortion\";\nexport * from \"./effects/Random\";\nexport * from \"./effects/Saturation\";\nexport * from \"./effects/Snow\";\nexport * from \"./effects/Vignette\";\n\nexport * from \"./tools/AnimationIntervalTool\";\nexport * from \"./tools/ChangeUnitsTool\";\nexport * from \"./tools/ClipTools\";\nexport * from \"./tools/DisplayStyleTools\";\nexport * from \"./tools/EmphasizeElementsTool\";\nexport * from \"./tools/FrustumDecoration\";\nexport * from \"./tools/InspectElementTool\";\nexport * from \"./tools/MapLayerTool\";\nexport * from \"./tools/MeasureTileLoadTime\";\nexport * from \"./tools/ModelAppearanceTools\";\nexport * from \"./tools/parseArgs\";\nexport * from \"./tools/parseBoolean\";\nexport * from \"./tools/parseToggle\";\nexport * from \"./tools/PlanarMaskTools\";\nexport * from \"./tools/PlanProjectionTools\";\nexport * from \"./tools/ProjectExtents\";\nexport * from \"./tools/RealityModelTools\";\nexport * from \"./tools/RealityTransitionTool\";\nexport * from \"./tools/RenderSystemTools\";\nexport * from \"./tools/RenderTargetTools\";\nexport * from \"./tools/ReportWebGLCompatibilityTool\";\nexport * from \"./tools/SavedViews\";\nexport * from \"./tools/SelectionTools\";\nexport * from \"./tools/ScheduleScriptTools\";\nexport * from \"./tools/SetGpuMemoryLimitTool\";\nexport * from \"./tools/SourceAspectIdTools\";\nexport * from \"./tools/TileRequestDecoration\";\nexport * from \"./tools/TileTreeBoundsDecoration\";\nexport * from \"./tools/ToolTipProvider\";\nexport * from \"./tools/ViewportTools\";\n\nexport * from \"./ui/Button\";\nexport * from \"./ui/CheckBox\";\nexport * from \"./ui/ColorInput\";\nexport * from \"./ui/ComboBox\";\nexport * from \"./ui/DataList\";\nexport * from \"./ui/NestedMenu\";\nexport * from \"./ui/NumericInput\";\nexport * from \"./ui/RadioBox\";\nexport * from \"./ui/Slider\";\nexport * from \"./ui/TextBox\";\n\nexport * from \"./widgets/DiagnosticsPanel\";\nexport * from \"./widgets/FpsTracker\";\nexport * from \"./widgets/GpuProfiler\";\nexport * from \"./widgets/KeyinField\";\nexport * from \"./widgets/MemoryTracker\";\nexport * from \"./widgets/TileMemoryBreakdown\";\nexport * from \"./widgets/TileStatisticsTracker\";\nexport * from \"./widgets/ToolSettingsTracker\";\n\n/** @docs-package-description\n * The frontend-devtools package contains various tools and widgets for monitoring and debugging the front-end state of an iTwin.js application.\n */\n\n/**\n * @docs-group-description Widgets\n * Widgets that wrap some of the package's functionality into embeddable HTML controls.\n */\n\n/**\n * @docs-group-description Tools\n * Interactive- and immediate-mode [tools]($docs/learning/frontend/Tools.md), most of which can be executed via key-in. All key-ins are documented in the package's README.\n */\n\n/**\n * @docs-group-description Controls\n * Rudimentary HTML components used to build the widgets.\n */\n\n/**\n * @docs-group-description Effects\n * Examples of screen-space effects produced by [RenderSystem.createScreenSpaceEffectBuilder]($frontend).\n */\n\n/**\n * @docs-group-description Utilities\n * Utility functions used throughout the package.\n */\n"]}
|
|
@@ -11,6 +11,7 @@ import { IModelApp, Tool } from "@itwin/core-frontend";
|
|
|
11
11
|
* @beta
|
|
12
12
|
*/
|
|
13
13
|
export class AnimationIntervalTool extends Tool {
|
|
14
|
+
static toolId = "AnimationInterval";
|
|
14
15
|
static get minArgs() { return 1; }
|
|
15
16
|
static get maxArgs() { return 1; }
|
|
16
17
|
async run(interval) {
|
|
@@ -23,5 +24,4 @@ export class AnimationIntervalTool extends Tool {
|
|
|
23
24
|
return this.run(interval);
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
|
-
AnimationIntervalTool.toolId = "AnimationInterval";
|
|
27
27
|
//# sourceMappingURL=AnimationIntervalTool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnimationIntervalTool.js","sourceRoot":"","sources":["../../../src/tools/AnimationIntervalTool.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,IAAI;
|
|
1
|
+
{"version":3,"file":"AnimationIntervalTool.js","sourceRoot":"","sources":["../../../src/tools/AnimationIntervalTool.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,IAAI;IACtC,MAAM,CAAU,MAAM,GAAG,mBAAmB,CAAC;IAC7C,MAAM,KAAc,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3C,MAAM,KAAc,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAElC,KAAK,CAAC,GAAG,CAAC,QAAqB;QAC7C,SAAS,CAAC,iBAAiB,GAAG,QAAQ,CAAC;QACvC,OAAO,IAAI,CAAC;IACd,CAAC;IAEe,KAAK,CAAC,WAAW,CAAC,GAAG,IAAc;QACjD,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC5C,MAAM,QAAQ,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACzF,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC5B,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\n/** @packageDocumentation\n * @module Tools\n */\n\nimport { BeDuration } from \"@itwin/core-bentley\";\nimport { IModelApp, Tool } from \"@itwin/core-frontend\";\n\n/** Changes the [IModelApp.animationInterval]($frontend). Specify the interval in integer milliseconds; or pass any string not parseable as an integer to disable the animation interval callback.\n * @beta\n */\nexport class AnimationIntervalTool extends Tool {\n public static override toolId = \"AnimationInterval\";\n public static override get minArgs() { return 1; }\n public static override get maxArgs() { return 1; }\n\n public override async run(interval?: BeDuration): Promise<boolean> {\n IModelApp.animationInterval = interval;\n return true;\n }\n\n public override async parseAndRun(...args: string[]): Promise<boolean> {\n const millis = Number.parseInt(args[0], 10);\n const interval = !Number.isNaN(millis) ? BeDuration.fromMilliseconds(millis) : undefined;\n return this.run(interval);\n }\n}\n"]}
|
|
@@ -13,6 +13,7 @@ import { parseToggle } from "./parseToggle";
|
|
|
13
13
|
* @beta
|
|
14
14
|
*/
|
|
15
15
|
export class ChangeUnitsTool extends Tool {
|
|
16
|
+
static toolId = "ChangeUnits";
|
|
16
17
|
static get minArgs() { return 0; }
|
|
17
18
|
static get maxArgs() { return 1; }
|
|
18
19
|
// support boolean for backwards compatibility
|
|
@@ -34,5 +35,4 @@ export class ChangeUnitsTool extends Tool {
|
|
|
34
35
|
return true;
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
|
-
ChangeUnitsTool.toolId = "ChangeUnits";
|
|
38
38
|
//# sourceMappingURL=ChangeUnitsTool.js.map
|