@tableslayer/ui 0.1.3 → 0.1.4

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 (205) hide show
  1. package/package.json +2 -13
  2. package/src/lib/components/Avatar/Avatar.svelte +82 -0
  3. package/src/lib/components/Avatar/AvatarFileInput.svelte +85 -0
  4. package/src/lib/components/Avatar/AvatarPopover.svelte +34 -0
  5. package/src/lib/components/Avatar/index.ts +4 -0
  6. package/src/lib/components/Avatar/types.ts +24 -0
  7. package/src/lib/components/BrushSizeSlider/BrushSizeSlider.svelte +174 -0
  8. package/src/lib/components/BrushSizeSlider/index.ts +1 -0
  9. package/src/lib/components/Button/Button.svelte +182 -0
  10. package/src/lib/components/Button/ConfirmActionButton.svelte +98 -0
  11. package/src/lib/components/Button/IconButton.svelte +121 -0
  12. package/src/lib/components/Button/RadioButton.svelte +93 -0
  13. package/src/lib/components/Button/index.ts +5 -0
  14. package/src/lib/components/Button/types.ts +54 -0
  15. package/src/lib/components/CardFan/CardFan.svelte +165 -0
  16. package/src/lib/components/CardFan/index.ts +2 -0
  17. package/src/lib/components/CardFan/types.ts +6 -0
  18. package/src/lib/components/CodeBlock/Code.svelte +7 -0
  19. package/src/lib/components/CodeBlock/CodeBlock.svelte +102 -0
  20. package/src/lib/components/CodeBlock/index.ts +3 -0
  21. package/src/lib/components/CodeBlock/types.ts +10 -0
  22. package/src/lib/components/ColorMode/ColorMode.svelte +8 -0
  23. package/src/lib/components/ColorMode/index.ts +2 -0
  24. package/src/lib/components/ColorMode/types.ts +12 -0
  25. package/src/lib/components/ColorPicker/ColorPicker.svelte +838 -0
  26. package/src/lib/components/ColorPicker/ColorPickerSwatch.svelte +32 -0
  27. package/src/lib/components/ColorPicker/index.ts +3 -0
  28. package/src/lib/components/ColorPicker/types.ts +51 -0
  29. package/src/lib/components/ContextMenu/ContextMenu.svelte +86 -0
  30. package/src/lib/components/ContextMenu/index.ts +2 -0
  31. package/src/lib/components/ContextMenu/types.ts +15 -0
  32. package/src/lib/components/DrawingSliders/DrawingSliders.svelte +379 -0
  33. package/src/lib/components/DrawingSliders/index.ts +1 -0
  34. package/src/lib/components/Editor/Editor.svelte +825 -0
  35. package/src/lib/components/Editor/index.ts +1 -0
  36. package/src/lib/components/FogSliders/FogSliders.svelte +33 -0
  37. package/src/lib/components/FogSliders/index.ts +1 -0
  38. package/src/lib/components/Hr/Hr.svelte +15 -0
  39. package/src/lib/components/Hr/index.ts +1 -0
  40. package/src/lib/components/Icon/Icon.svelte +6 -0
  41. package/src/lib/components/Icon/index.ts +2 -0
  42. package/src/lib/components/Icon/types.ts +20 -0
  43. package/src/lib/components/Input/DualInputSlider.svelte +126 -0
  44. package/src/lib/components/Input/FileInput.svelte +176 -0
  45. package/src/lib/components/Input/FormControl.svelte +150 -0
  46. package/src/lib/components/Input/FormError.svelte +37 -0
  47. package/src/lib/components/Input/Input.svelte +56 -0
  48. package/src/lib/components/Input/InputCheckbox.svelte +99 -0
  49. package/src/lib/components/Input/InputSlider.svelte +86 -0
  50. package/src/lib/components/Input/Label.svelte +19 -0
  51. package/src/lib/components/Input/index.ts +9 -0
  52. package/src/lib/components/Input/types.ts +39 -0
  53. package/src/lib/components/Link/Link.svelte +41 -0
  54. package/src/lib/components/Link/LinkBox.svelte +20 -0
  55. package/src/lib/components/Link/LinkOverlay.svelte +23 -0
  56. package/src/lib/components/Link/index.ts +4 -0
  57. package/src/lib/components/Link/types.ts +17 -0
  58. package/src/lib/components/Loading/Loader.svelte +60 -0
  59. package/src/lib/components/Loading/Skeleton.svelte +9 -0
  60. package/src/lib/components/Loading/index.ts +2 -0
  61. package/src/lib/components/Logo/Logo.svelte +16 -0
  62. package/src/lib/components/Logo/index.ts +1 -0
  63. package/src/lib/components/MarkerTooltip/MarkerTooltip.svelte +435 -0
  64. package/src/lib/components/MarkerTooltip/index.ts +1 -0
  65. package/src/lib/components/Menu/SelectorMenu.svelte +280 -0
  66. package/src/lib/components/Menu/index.ts +2 -0
  67. package/src/lib/components/Menu/types.ts +17 -0
  68. package/src/lib/components/MyCounterButton.svelte +11 -0
  69. package/src/lib/components/Panel/index.ts +2 -0
  70. package/src/lib/components/Panel/panel.svelte +18 -0
  71. package/src/lib/components/Panel/types.ts +8 -0
  72. package/src/lib/components/PersistButton/PersistButton.svelte +100 -0
  73. package/src/lib/components/PersistButton/index.ts +1 -0
  74. package/src/lib/components/Popover/Popover.svelte +81 -0
  75. package/src/lib/components/Popover/index.ts +2 -0
  76. package/src/lib/components/Popover/types.ts +19 -0
  77. package/src/lib/components/PropsTable/PropsTable.svelte +107 -0
  78. package/src/lib/components/RadialMenu/EffectPreview.svelte +36 -0
  79. package/src/lib/components/RadialMenu/EffectPreviewScene.svelte +194 -0
  80. package/src/lib/components/RadialMenu/RadialMenu.svelte +503 -0
  81. package/src/lib/components/RadialMenu/RadialMenuItem.svelte +176 -0
  82. package/src/lib/components/RadialMenu/index.ts +2 -0
  83. package/src/lib/components/RadialMenu/types.ts +35 -0
  84. package/src/lib/components/Select/Select.svelte +342 -0
  85. package/src/lib/components/Select/index.ts +2 -0
  86. package/src/lib/components/Select/types.ts +22 -0
  87. package/src/lib/components/Spacer/Spacer.svelte +14 -0
  88. package/src/lib/components/Spacer/index.ts +2 -0
  89. package/src/lib/components/Spacer/types.ts +5 -0
  90. package/src/lib/components/Stage/components/AnnotationLayer/AnnotationLayer.svelte +445 -0
  91. package/src/lib/components/Stage/components/AnnotationLayer/AnnotationMaterial.svelte +167 -0
  92. package/src/lib/components/Stage/components/AnnotationLayer/types.ts +196 -0
  93. package/src/lib/components/Stage/components/CursorLayer/CursorLayer.svelte +148 -0
  94. package/src/lib/components/Stage/components/CursorLayer/cursor.svg +26 -0
  95. package/src/lib/components/Stage/components/CursorLayer/index.ts +2 -0
  96. package/src/lib/components/Stage/components/CursorLayer/types.ts +23 -0
  97. package/src/lib/components/Stage/components/DrawingLayer/DrawingMaterial.svelte +364 -0
  98. package/src/lib/components/Stage/components/DrawingLayer/types.ts +65 -0
  99. package/src/lib/components/Stage/components/EdgeOverlayLayer/EdgeOverlayLayer.svelte +72 -0
  100. package/src/lib/components/Stage/components/EdgeOverlayLayer/types.ts +34 -0
  101. package/src/lib/components/Stage/components/FogLayer/FogLayer.svelte +75 -0
  102. package/src/lib/components/Stage/components/FogLayer/types.ts +51 -0
  103. package/src/lib/components/Stage/components/FogOfWarLayer/FogOfWarLayer.svelte +249 -0
  104. package/src/lib/components/Stage/components/FogOfWarLayer/FogOfWarMaterial.svelte +200 -0
  105. package/src/lib/components/Stage/components/FogOfWarLayer/types.ts +116 -0
  106. package/src/lib/components/Stage/components/GridLayer/GridLayer.svelte +20 -0
  107. package/src/lib/components/Stage/components/GridLayer/GridMaterial.svelte +69 -0
  108. package/src/lib/components/Stage/components/GridLayer/types.ts +79 -0
  109. package/src/lib/components/Stage/components/LayerInput/LayerInput.svelte +300 -0
  110. package/src/lib/components/Stage/components/MapLayer/MapLayer.svelte +196 -0
  111. package/src/lib/components/Stage/components/MapLayer/dataSources/GifDataSource.ts +265 -0
  112. package/src/lib/components/Stage/components/MapLayer/dataSources/IMapDataSource.ts +55 -0
  113. package/src/lib/components/Stage/components/MapLayer/dataSources/ImageDataSource.ts +87 -0
  114. package/src/lib/components/Stage/components/MapLayer/dataSources/VideoDataSource.ts +150 -0
  115. package/src/lib/components/Stage/components/MapLayer/dataSources/dataSourceFactory.ts +48 -0
  116. package/src/lib/components/Stage/components/MapLayer/dataSources/index.ts +16 -0
  117. package/src/lib/components/Stage/components/MapLayer/types.ts +58 -0
  118. package/src/lib/components/Stage/components/MarkerLayer/MarkerLayer.svelte +398 -0
  119. package/src/lib/components/Stage/components/MarkerLayer/MarkerToken.svelte +262 -0
  120. package/src/lib/components/Stage/components/MarkerLayer/types.ts +126 -0
  121. package/src/lib/components/Stage/components/MeasurementLayer/MeasurementLayer.svelte +364 -0
  122. package/src/lib/components/Stage/components/MeasurementLayer/MeasurementManager.svelte +473 -0
  123. package/src/lib/components/Stage/components/MeasurementLayer/measurements/BaseMeasurement.ts +427 -0
  124. package/src/lib/components/Stage/components/MeasurementLayer/measurements/BeamMeasurement.ts +105 -0
  125. package/src/lib/components/Stage/components/MeasurementLayer/measurements/CircleMeasurement.ts +98 -0
  126. package/src/lib/components/Stage/components/MeasurementLayer/measurements/ConeMeasurement.ts +163 -0
  127. package/src/lib/components/Stage/components/MeasurementLayer/measurements/LineMeasurement.ts +102 -0
  128. package/src/lib/components/Stage/components/MeasurementLayer/measurements/RectangleMeasurement.ts +120 -0
  129. package/src/lib/components/Stage/components/MeasurementLayer/measurements/index.ts +7 -0
  130. package/src/lib/components/Stage/components/MeasurementLayer/types.ts +94 -0
  131. package/src/lib/components/Stage/components/MeasurementLayer/utils/canvasDrawing.ts +357 -0
  132. package/src/lib/components/Stage/components/MeasurementLayer/utils/distanceCalculations.ts +170 -0
  133. package/src/lib/components/Stage/components/ParticleSystem/ParticleSystem.svelte +220 -0
  134. package/src/lib/components/Stage/components/ParticleSystem/particles/atlases/ash.png +0 -0
  135. package/src/lib/components/Stage/components/ParticleSystem/particles/atlases/leaves.png +0 -0
  136. package/src/lib/components/Stage/components/ParticleSystem/particles/atlases/rain.png +0 -0
  137. package/src/lib/components/Stage/components/ParticleSystem/particles/atlases/snow.png +0 -0
  138. package/src/lib/components/Stage/components/ParticleSystem/rng.js +20 -0
  139. package/src/lib/components/Stage/components/ParticleSystem/types.ts +95 -0
  140. package/src/lib/components/Stage/components/PerformanceDebugger/PerformanceDebugger.svelte +144 -0
  141. package/src/lib/components/Stage/components/PerformanceDebugger/index.ts +1 -0
  142. package/src/lib/components/Stage/components/PerformanceOverlay/PerformanceOverlay.svelte +208 -0
  143. package/src/lib/components/Stage/components/PerformanceOverlay/index.ts +1 -0
  144. package/src/lib/components/Stage/components/PointerInputManager/PointerInputManager.svelte +201 -0
  145. package/src/lib/components/Stage/components/Scene/Scene.svelte +651 -0
  146. package/src/lib/components/Stage/components/Scene/luts.ts +24 -0
  147. package/src/lib/components/Stage/components/Scene/types.ts +225 -0
  148. package/src/lib/components/Stage/components/Stage/Stage.svelte +332 -0
  149. package/src/lib/components/Stage/components/Stage/types.ts +136 -0
  150. package/src/lib/components/Stage/components/WeatherLayer/WeatherLayer.svelte +135 -0
  151. package/src/lib/components/Stage/components/WeatherLayer/presets/AshPreset.ts +71 -0
  152. package/src/lib/components/Stage/components/WeatherLayer/presets/LeavesPreset.ts +70 -0
  153. package/src/lib/components/Stage/components/WeatherLayer/presets/RainPreset.ts +68 -0
  154. package/src/lib/components/Stage/components/WeatherLayer/presets/SnowPreset.ts +70 -0
  155. package/src/lib/components/Stage/components/WeatherLayer/presets/index.ts +6 -0
  156. package/src/lib/components/Stage/components/WeatherLayer/types.ts +35 -0
  157. package/src/lib/components/Stage/helpers/clippingPlaneStore.svelte.ts +28 -0
  158. package/src/lib/components/Stage/helpers/debugState.svelte.ts +18 -0
  159. package/src/lib/components/Stage/helpers/grid.ts +548 -0
  160. package/src/lib/components/Stage/helpers/lazyBrush.ts +171 -0
  161. package/src/lib/components/Stage/helpers/performanceMetrics.svelte.ts +220 -0
  162. package/src/lib/components/Stage/helpers/utils.ts +21 -0
  163. package/src/lib/components/Stage/index.ts +49 -0
  164. package/src/lib/components/Stage/shaders/AnnotationEffects.frag +1070 -0
  165. package/src/lib/components/Stage/shaders/Annotations.frag +29 -0
  166. package/src/lib/components/Stage/shaders/Drawing.frag +83 -0
  167. package/src/lib/components/Stage/shaders/Drawing.vert +5 -0
  168. package/src/lib/components/Stage/shaders/Fog.frag +147 -0
  169. package/src/lib/components/Stage/shaders/FractalNoise.frag +96 -0
  170. package/src/lib/components/Stage/shaders/GridShader.frag +174 -0
  171. package/src/lib/components/Stage/shaders/Overlay.frag +23 -0
  172. package/src/lib/components/Stage/shaders/Overlay.vert +0 -0
  173. package/src/lib/components/Stage/shaders/Particles.frag +27 -0
  174. package/src/lib/components/Stage/shaders/Particles.vert +51 -0
  175. package/src/lib/components/Stage/shaders/ToolOutline.frag +59 -0
  176. package/src/lib/components/Stage/shaders/default.vert +8 -0
  177. package/src/lib/components/Stage/types.ts +4 -0
  178. package/src/lib/components/Table/Table.svelte +16 -0
  179. package/src/lib/components/Table/Td.svelte +17 -0
  180. package/src/lib/components/Table/Th.svelte +18 -0
  181. package/src/lib/components/Table/index.ts +4 -0
  182. package/src/lib/components/Table/types.ts +14 -0
  183. package/src/lib/components/Text/Text.svelte +23 -0
  184. package/src/lib/components/Text/index.ts +2 -0
  185. package/src/lib/components/Text/types.ts +12 -0
  186. package/src/lib/components/Title/Title.svelte +54 -0
  187. package/src/lib/components/Title/index.ts +2 -0
  188. package/src/lib/components/Title/types.ts +9 -0
  189. package/src/lib/components/Toast/Toast.svelte +155 -0
  190. package/src/lib/components/Toast/index.ts +5 -0
  191. package/src/lib/components/Toast/toastCookie.ts +24 -0
  192. package/src/lib/components/Toast/types.ts +6 -0
  193. package/src/lib/components/ToolTip/ToolTip.svelte +70 -0
  194. package/src/lib/components/ToolTip/index.ts +2 -0
  195. package/src/lib/components/ToolTip/types.ts +14 -0
  196. package/src/lib/components/index.ts +32 -0
  197. package/src/lib/components/types.ts +0 -0
  198. package/src/lib/index.ts +2 -0
  199. package/src/lib/styles/globals.css +108 -0
  200. package/src/lib/styles/normalize.css +9 -0
  201. package/src/lib/styles/reset.css +133 -0
  202. package/src/lib/styles/utilities.css +179 -0
  203. package/src/lib/styles/vars.css +1103 -0
  204. package/src/lib/types/awareness.ts +17 -0
  205. package/src/lib/utils/rle.ts +217 -0
@@ -0,0 +1,135 @@
1
+ <script lang="ts">
2
+ import * as THREE from 'three';
3
+ import { onMount, onDestroy, untrack } from 'svelte';
4
+ import { T, useTask, useThrelte, type Props as ThrelteProps } from '@threlte/core';
5
+ import { WeatherType, type WeatherLayerPreset } from './types';
6
+ import ParticleSystem from '../ParticleSystem/ParticleSystem.svelte';
7
+ import type { StageProps } from '../Stage/types';
8
+
9
+ import SnowPreset from './presets/SnowPreset';
10
+ import RainPreset from './presets/RainPreset';
11
+ import LeavesPreset from './presets/LeavesPreset';
12
+ import AshPreset from './presets/AshPreset';
13
+
14
+ interface Props extends ThrelteProps<typeof THREE.Mesh> {
15
+ props: StageProps;
16
+ size: { x: number; y: number };
17
+ }
18
+
19
+ const { props, size, ...meshProps }: Props = $props();
20
+
21
+ const { renderer, renderStage } = useThrelte();
22
+ let weatherType: WeatherType | null = $state(null);
23
+ let weatherPreset: WeatherLayerPreset = $state(RainPreset);
24
+ let mesh: THREE.Mesh = $state(new THREE.Mesh());
25
+ let particleScene = $state(new THREE.Scene());
26
+ let particleCamera = $state(new THREE.PerspectiveCamera(90, 1, 0.01, 10));
27
+ particleCamera.position.set(0, 0, -1);
28
+ particleCamera.rotation.x = Math.PI;
29
+
30
+ // Render target for particle scene
31
+ const renderTarget = new THREE.WebGLRenderTarget(1, 1, {
32
+ format: THREE.RGBAFormat,
33
+ minFilter: THREE.LinearFilter,
34
+ magFilter: THREE.LinearFilter
35
+ });
36
+
37
+ // Material for displaying particles
38
+ const quadMaterial = new THREE.MeshBasicMaterial({
39
+ map: renderTarget.texture,
40
+ transparent: true,
41
+ blending: THREE.NormalBlending
42
+ });
43
+
44
+ onMount(() => {
45
+ if (particleCamera && particleScene) {
46
+ renderTarget.setSize(size.x, size.y);
47
+ }
48
+ });
49
+
50
+ onDestroy(() => {
51
+ renderTarget.dispose();
52
+ quadMaterial.dispose();
53
+ });
54
+
55
+ // If weather type changes, update the preset
56
+ $effect(() => {
57
+ if (props.weather.type === weatherType) {
58
+ return;
59
+ }
60
+
61
+ untrack(() => {
62
+ weatherType = props.weather.type;
63
+ switch (weatherType) {
64
+ case WeatherType.Snow:
65
+ weatherPreset = { ...SnowPreset };
66
+ break;
67
+ case WeatherType.Rain:
68
+ weatherPreset = { ...RainPreset };
69
+ break;
70
+ case WeatherType.Leaves:
71
+ weatherPreset = { ...LeavesPreset };
72
+ break;
73
+ case WeatherType.Custom:
74
+ weatherPreset = { ...(props.weather.custom || RainPreset) };
75
+ break;
76
+ case WeatherType.Ash:
77
+ weatherPreset = { ...AshPreset };
78
+ break;
79
+ default:
80
+ // Fallback to rain preset
81
+ weatherPreset = { ...RainPreset };
82
+ }
83
+ });
84
+ });
85
+
86
+ // Overrides for fov, intensity, and opacity set in the UI
87
+ $effect(() => {
88
+ if (props.weather.fov) {
89
+ weatherPreset.fov = props.weather.fov;
90
+ }
91
+
92
+ if (props.weather.intensity) {
93
+ weatherPreset.intensity = props.weather.intensity;
94
+ }
95
+
96
+ if (props.weather.opacity) {
97
+ weatherPreset.opacity = props.weather.opacity;
98
+ }
99
+ });
100
+
101
+ // Update the camera and render target when size changes
102
+ $effect(() => {
103
+ particleCamera.aspect = size.x / size.y;
104
+ particleCamera.fov = weatherPreset.fov;
105
+ particleCamera.updateProjectionMatrix();
106
+ renderTarget.setSize(size.x, size.y);
107
+ });
108
+
109
+ // Render particle scene directly to render target (bypasses unnecessary EffectComposer overhead)
110
+ useTask(
111
+ () => {
112
+ if (!particleScene || !particleCamera || !size) return;
113
+
114
+ particleScene.visible = true;
115
+ renderer.setRenderTarget(renderTarget);
116
+ renderer.clear();
117
+ renderer.render(particleScene, particleCamera);
118
+ renderer.setRenderTarget(null);
119
+ particleScene.visible = false;
120
+ quadMaterial.needsUpdate = true;
121
+ },
122
+ { stage: renderStage }
123
+ );
124
+ </script>
125
+
126
+ <!-- Remove the stencil mesh and keep only the particle scenes -->
127
+ <T.Scene is={particleScene} visible={false}>
128
+ <T.PerspectiveCamera is={particleCamera} manual />
129
+ <ParticleSystem props={weatherPreset.particles} opacity={weatherPreset.opacity} intensity={weatherPreset.intensity} />
130
+ </T.Scene>
131
+
132
+ <T.Mesh bind:ref={mesh} {...meshProps} visible={props.weather.type !== WeatherType.None}>
133
+ <T.MeshBasicMaterial is={quadMaterial} />
134
+ <T.PlaneGeometry args={[size.x, size.y]} />
135
+ </T.Mesh>
@@ -0,0 +1,71 @@
1
+ import { KernelSize } from 'postprocessing';
2
+ import type { WeatherLayerPreset } from '../types';
3
+
4
+ export default {
5
+ fov: 20,
6
+ intensity: 0.5,
7
+ opacity: 0.8,
8
+ depthOfField: {
9
+ enabled: true,
10
+ focus: 0.75,
11
+ focalLength: 6.6,
12
+ bokehScale: 250.0,
13
+ kernelSize: KernelSize.LARGE
14
+ },
15
+ particles: {
16
+ maxParticleCount: 500,
17
+ opacity: 0.5,
18
+ type: 4,
19
+ color: '#404040',
20
+ fadeInTime: 5,
21
+ fadeOutTime: 2,
22
+ lifetime: 10,
23
+ spawnArea: {
24
+ minRadius: 0.01,
25
+ maxRadius: 0.08
26
+ },
27
+ initialVelocity: {
28
+ x: 0,
29
+ y: 0,
30
+ z: 0
31
+ },
32
+ force: {
33
+ linear: {
34
+ x: 0,
35
+ y: 0,
36
+ z: 0.01
37
+ },
38
+ exponential: {
39
+ x: 0,
40
+ y: 0,
41
+ z: 0
42
+ },
43
+ sinusoidal: {
44
+ amplitude: {
45
+ x: 0.015,
46
+ y: 0.014,
47
+ z: 0
48
+ },
49
+ frequency: {
50
+ x: 0.002,
51
+ y: 0.0025,
52
+ z: 0
53
+ }
54
+ }
55
+ },
56
+ rotation: {
57
+ alignRadially: false,
58
+ offset: 0,
59
+ velocity: 1,
60
+ randomize: true
61
+ },
62
+ scale: {
63
+ x: 1,
64
+ y: 1
65
+ },
66
+ size: {
67
+ min: 0.001,
68
+ max: 0.0013
69
+ }
70
+ }
71
+ } as WeatherLayerPreset;
@@ -0,0 +1,70 @@
1
+ import { KernelSize } from 'postprocessing';
2
+ import type { WeatherLayerPreset } from '../types';
3
+
4
+ export default {
5
+ fov: 30,
6
+ intensity: 0.5,
7
+ opacity: 1,
8
+ depthOfField: {
9
+ enabled: true,
10
+ focus: 0.7,
11
+ focalLength: 4,
12
+ bokehScale: 50,
13
+ kernelSize: KernelSize.VERY_LARGE
14
+ },
15
+ particles: {
16
+ maxParticleCount: 50,
17
+ type: 3,
18
+ color: '#ffffff',
19
+ fadeInTime: 7,
20
+ fadeOutTime: 1,
21
+ lifetime: 15,
22
+ spawnArea: {
23
+ minRadius: 0.20142663043478262,
24
+ maxRadius: 0.27751358695652173
25
+ },
26
+ initialVelocity: {
27
+ x: 0,
28
+ y: 0,
29
+ z: 0
30
+ },
31
+ force: {
32
+ linear: {
33
+ x: 0,
34
+ y: 0,
35
+ z: 0.02
36
+ },
37
+ exponential: {
38
+ x: 0,
39
+ y: 0,
40
+ z: 0
41
+ },
42
+ sinusoidal: {
43
+ amplitude: {
44
+ x: 0.01,
45
+ y: 0.015,
46
+ z: 0
47
+ },
48
+ frequency: {
49
+ x: 0.3,
50
+ y: 0.5,
51
+ z: 0
52
+ }
53
+ }
54
+ },
55
+ rotation: {
56
+ alignRadially: false,
57
+ offset: 0,
58
+ velocity: 0.9,
59
+ randomize: true
60
+ },
61
+ scale: {
62
+ x: 1,
63
+ y: 1
64
+ },
65
+ size: {
66
+ min: 0.025611413043478262,
67
+ max: 0.0484375
68
+ }
69
+ }
70
+ } as WeatherLayerPreset;
@@ -0,0 +1,68 @@
1
+ import type { WeatherLayerPreset } from '../types';
2
+ export default {
3
+ fov: 70,
4
+ intensity: 0.7,
5
+ opacity: 1.0,
6
+ depthOfField: {
7
+ enabled: false,
8
+ focus: 0,
9
+ focalLength: 0,
10
+ bokehScale: 0,
11
+ kernelSize: 0
12
+ },
13
+ particles: {
14
+ maxParticleCount: 5000,
15
+ type: 2,
16
+ color: '#e0e0e0',
17
+ fadeInTime: 1,
18
+ fadeOutTime: 3,
19
+ lifetime: 3,
20
+ spawnArea: {
21
+ minRadius: 0.008,
22
+ maxRadius: 0.02
23
+ },
24
+ initialVelocity: {
25
+ x: 0,
26
+ y: 0,
27
+ z: 0
28
+ },
29
+ force: {
30
+ linear: {
31
+ x: 0,
32
+ y: 0,
33
+ z: 0.02
34
+ },
35
+ exponential: {
36
+ x: 0,
37
+ y: 0,
38
+ z: 0
39
+ },
40
+ sinusoidal: {
41
+ amplitude: {
42
+ x: 0,
43
+ y: 0,
44
+ z: 0
45
+ },
46
+ frequency: {
47
+ x: 5,
48
+ y: 5,
49
+ z: 5
50
+ }
51
+ }
52
+ },
53
+ rotation: {
54
+ alignRadially: true,
55
+ offset: 270,
56
+ velocity: 0,
57
+ randomize: false
58
+ },
59
+ scale: {
60
+ x: 0.2,
61
+ y: 1
62
+ },
63
+ size: {
64
+ min: 0.001,
65
+ max: 0.001
66
+ }
67
+ }
68
+ } as WeatherLayerPreset;
@@ -0,0 +1,70 @@
1
+ import { KernelSize } from 'postprocessing';
2
+ import type { WeatherLayerPreset } from '../types';
3
+
4
+ export default {
5
+ fov: 90,
6
+ intensity: 0.2,
7
+ opacity: 0.8,
8
+ depthOfField: {
9
+ enabled: true,
10
+ focus: 0.7,
11
+ focalLength: 5.0,
12
+ bokehScale: 50.0,
13
+ kernelSize: KernelSize.LARGE
14
+ },
15
+ particles: {
16
+ maxParticleCount: 1000,
17
+ type: 1,
18
+ color: '#ffffff',
19
+ fadeInTime: 8,
20
+ fadeOutTime: 2,
21
+ lifetime: 10,
22
+ spawnArea: {
23
+ minRadius: 0.02,
24
+ maxRadius: 0.5
25
+ },
26
+ initialVelocity: {
27
+ x: 0,
28
+ y: 0,
29
+ z: 0
30
+ },
31
+ force: {
32
+ linear: {
33
+ x: 0,
34
+ y: 0,
35
+ z: 0.005
36
+ },
37
+ exponential: {
38
+ x: 0,
39
+ y: 0,
40
+ z: 0
41
+ },
42
+ sinusoidal: {
43
+ amplitude: {
44
+ x: 0.002,
45
+ y: 0.003,
46
+ z: 0
47
+ },
48
+ frequency: {
49
+ x: 2,
50
+ y: 1,
51
+ z: 0
52
+ }
53
+ }
54
+ },
55
+ rotation: {
56
+ alignRadially: false,
57
+ offset: 0,
58
+ velocity: 0,
59
+ randomize: true
60
+ },
61
+ scale: {
62
+ x: 1,
63
+ y: 1
64
+ },
65
+ size: {
66
+ min: 0.001,
67
+ max: 0.005
68
+ }
69
+ }
70
+ } as WeatherLayerPreset;
@@ -0,0 +1,6 @@
1
+ import AshPreset from './AshPreset';
2
+ import LeavesPreset from './LeavesPreset';
3
+ import RainPreset from './RainPreset';
4
+ import SnowPreset from './SnowPreset';
5
+
6
+ export { AshPreset, LeavesPreset, RainPreset, SnowPreset };
@@ -0,0 +1,35 @@
1
+ import type { KernelSize } from 'postprocessing';
2
+ import type { ParticleSystemProps } from '../ParticleSystem/types';
3
+
4
+ export enum WeatherType {
5
+ None = 0,
6
+ Rain = 1,
7
+ Snow = 2,
8
+ Leaves = 3,
9
+ Ash = 4,
10
+ Custom = 99
11
+ }
12
+
13
+ export interface DepthOfFieldConfig {
14
+ enabled: boolean;
15
+ focus: number;
16
+ focalLength: number;
17
+ bokehScale: number;
18
+ kernelSize: KernelSize;
19
+ }
20
+
21
+ export interface WeatherLayerPreset {
22
+ fov: number;
23
+ intensity: number;
24
+ opacity: number;
25
+ depthOfField: DepthOfFieldConfig;
26
+ particles: ParticleSystemProps;
27
+ }
28
+
29
+ export interface WeatherLayerProps {
30
+ type: WeatherType;
31
+ fov?: number;
32
+ intensity?: number;
33
+ opacity?: number;
34
+ custom?: WeatherLayerPreset;
35
+ }
@@ -0,0 +1,28 @@
1
+ import * as THREE from 'three';
2
+ import type { SceneLayerProps } from '../components/Scene/types';
3
+ import type { DisplayProps } from '../components/Stage/types';
4
+
5
+ export const clippingPlaneStore: { value: THREE.Plane[] } = $state({
6
+ value: [
7
+ new THREE.Plane(new THREE.Vector3(-1, 0, 0)),
8
+ new THREE.Plane(new THREE.Vector3(1, 0, 0)),
9
+ new THREE.Plane(new THREE.Vector3(0, 1, 0)),
10
+ new THREE.Plane(new THREE.Vector3(0, -1, 0))
11
+ ]
12
+ });
13
+
14
+ export function updateClippingPlanes(sceneProps: SceneLayerProps, displayProps: DisplayProps) {
15
+ // Whenever the scene is translated/zoomed, update the clipping planes
16
+ const { x, y } = sceneProps.offset;
17
+ const worldExtents = {
18
+ x: sceneProps.zoom * (displayProps.resolution.x / 2),
19
+ y: sceneProps.zoom * (displayProps.resolution.y / 2)
20
+ };
21
+
22
+ clippingPlaneStore.value = [
23
+ new THREE.Plane(new THREE.Vector3(-1, 0, 0), worldExtents.x + x),
24
+ new THREE.Plane(new THREE.Vector3(1, 0, 0), worldExtents.x - x),
25
+ new THREE.Plane(new THREE.Vector3(0, 1, 0), worldExtents.y - y),
26
+ new THREE.Plane(new THREE.Vector3(0, -1, 0), worldExtents.y + y)
27
+ ];
28
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Global debug state that persists independently of stageProps.
3
+ * This prevents debug settings from being reset when stageProps are rebuilt.
4
+ */
5
+ export const debugState: {
6
+ enableMetrics: boolean;
7
+ logMetricsToConsole: boolean;
8
+ } = $state({
9
+ enableMetrics: false,
10
+ logMetricsToConsole: false
11
+ });
12
+
13
+ export const setDebugEnabled = (enabled: boolean) => {
14
+ debugState.enableMetrics = enabled;
15
+ debugState.logMetricsToConsole = enabled;
16
+ };
17
+
18
+ export const isDebugEnabled = () => debugState.enableMetrics;