@3driseai/3drise-viewer 0.1.27 → 0.1.29

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 (690) hide show
  1. package/dist/animationsV2/ClipPlayer.d.ts.map +1 -1
  2. package/dist/animationsV2/ClipPlayer.js +13 -9
  3. package/dist/animationsV2/ClipsRuntime.d.ts +44 -3
  4. package/dist/animationsV2/ClipsRuntime.d.ts.map +1 -1
  5. package/dist/animationsV2/ClipsRuntime.js +173 -55
  6. package/dist/animationsV2/appliers.d.ts.map +1 -1
  7. package/dist/animationsV2/appliers.js +21 -5
  8. package/dist/animationsV2/index.d.ts +1 -1
  9. package/dist/animationsV2/index.d.ts.map +1 -1
  10. package/dist/animationsV2/normalize.d.ts.map +1 -1
  11. package/dist/animationsV2/normalize.js +7 -3
  12. package/dist/animationsV2/sequenceUtils.d.ts +44 -6
  13. package/dist/animationsV2/sequenceUtils.d.ts.map +1 -1
  14. package/dist/animationsV2/sequenceUtils.js +58 -12
  15. package/dist/animationsV2/types.d.ts +22 -12
  16. package/dist/animationsV2/types.d.ts.map +1 -1
  17. package/dist/api/sceneHandle.d.ts +35 -1
  18. package/dist/api/sceneHandle.d.ts.map +1 -1
  19. package/dist/api/sceneHandle.js +88 -17
  20. package/dist/components/AdvancedGrid.d.ts +1 -5
  21. package/dist/components/AdvancedGrid.d.ts.map +1 -1
  22. package/dist/components/AdvancedGrid.js +6 -35
  23. package/dist/components/AnimatedObject.d.ts.map +1 -1
  24. package/dist/components/AnimatedObject.js +9 -4
  25. package/dist/components/ApollonianGrid.d.ts +25 -0
  26. package/dist/components/ApollonianGrid.d.ts.map +1 -0
  27. package/dist/components/ApollonianGrid.js +55 -0
  28. package/dist/components/ChladniGrid.d.ts +1 -1
  29. package/dist/components/ChladniGrid.d.ts.map +1 -1
  30. package/dist/components/ChladniGrid.js +6 -35
  31. package/dist/components/CircuitGrid.d.ts +1 -1
  32. package/dist/components/CircuitGrid.d.ts.map +1 -1
  33. package/dist/components/CircuitGrid.js +6 -34
  34. package/dist/components/ConformalGrid.d.ts +25 -0
  35. package/dist/components/ConformalGrid.d.ts.map +1 -0
  36. package/dist/components/ConformalGrid.js +66 -0
  37. package/dist/components/ContourGrid.d.ts +1 -1
  38. package/dist/components/ContourGrid.d.ts.map +1 -1
  39. package/dist/components/ContourGrid.js +6 -34
  40. package/dist/components/CustomPrimitive.js +1 -1
  41. package/dist/components/EnvironmentObject.d.ts.map +1 -1
  42. package/dist/components/EnvironmentObject.js +9 -7
  43. package/dist/components/FlowNetGrid.d.ts +1 -1
  44. package/dist/components/FlowNetGrid.d.ts.map +1 -1
  45. package/dist/components/FlowNetGrid.js +6 -34
  46. package/dist/components/FractalGrid.d.ts +1 -1
  47. package/dist/components/FractalGrid.d.ts.map +1 -1
  48. package/dist/components/FractalGrid.js +6 -37
  49. package/dist/components/Galaxy.d.ts.map +1 -1
  50. package/dist/components/Galaxy.js +9 -23
  51. package/dist/components/GirihGrid.d.ts +1 -1
  52. package/dist/components/GirihGrid.d.ts.map +1 -1
  53. package/dist/components/GirihGrid.js +6 -35
  54. package/dist/components/GravWaveGrid.d.ts +1 -1
  55. package/dist/components/GravWaveGrid.d.ts.map +1 -1
  56. package/dist/components/GravWaveGrid.js +6 -35
  57. package/dist/components/GridsGenerator.d.ts +2 -2
  58. package/dist/components/GridsGenerator.d.ts.map +1 -1
  59. package/dist/components/GridsGenerator.js +21 -0
  60. package/dist/components/HexGrid.d.ts +1 -5
  61. package/dist/components/HexGrid.d.ts.map +1 -1
  62. package/dist/components/HexGrid.js +6 -36
  63. package/dist/components/HilbertGrid.d.ts +25 -0
  64. package/dist/components/HilbertGrid.d.ts.map +1 -0
  65. package/dist/components/HilbertGrid.js +66 -0
  66. package/dist/components/HyperbolicGrid.d.ts +1 -1
  67. package/dist/components/HyperbolicGrid.d.ts.map +1 -1
  68. package/dist/components/HyperbolicGrid.js +6 -34
  69. package/dist/components/LandObject.d.ts +9 -0
  70. package/dist/components/LandObject.d.ts.map +1 -0
  71. package/dist/components/LandObject.js +15 -0
  72. package/dist/components/LensingGrid.d.ts +25 -0
  73. package/dist/components/LensingGrid.d.ts.map +1 -0
  74. package/dist/components/LensingGrid.js +55 -0
  75. package/dist/components/LightsManager.d.ts.map +1 -1
  76. package/dist/components/LightsManager.js +8 -0
  77. package/dist/components/ModelBoundary.d.ts +2 -0
  78. package/dist/components/ModelBoundary.d.ts.map +1 -1
  79. package/dist/components/ModelBoundary.js +3 -0
  80. package/dist/components/ModelPrimitive.d.ts.map +1 -1
  81. package/dist/components/ModelPrimitive.js +6 -0
  82. package/dist/components/MoireGrid.d.ts +1 -1
  83. package/dist/components/MoireGrid.d.ts.map +1 -1
  84. package/dist/components/MoireGrid.js +6 -35
  85. package/dist/components/MoonDisc.d.ts +11 -0
  86. package/dist/components/MoonDisc.d.ts.map +1 -0
  87. package/dist/components/MoonDisc.js +128 -0
  88. package/dist/components/ObjectNode.d.ts.map +1 -1
  89. package/dist/components/ObjectNode.js +15 -4
  90. package/dist/components/ObjectsRenderer.d.ts.map +1 -1
  91. package/dist/components/ObjectsRenderer.js +7 -5
  92. package/dist/components/OceanBuilder.d.ts.map +1 -1
  93. package/dist/components/OceanBuilder.js +2 -0
  94. package/dist/components/ParastichyGrid.d.ts +25 -0
  95. package/dist/components/ParastichyGrid.d.ts.map +1 -0
  96. package/dist/components/ParastichyGrid.js +55 -0
  97. package/dist/components/PhyllotaxisGrid.d.ts +25 -0
  98. package/dist/components/PhyllotaxisGrid.d.ts.map +1 -0
  99. package/dist/components/PhyllotaxisGrid.js +66 -0
  100. package/dist/components/ProjectLoader.d.ts +5 -3
  101. package/dist/components/ProjectLoader.d.ts.map +1 -1
  102. package/dist/components/ProjectLoader.js +6 -3
  103. package/dist/components/QuasiGrid.d.ts +1 -1
  104. package/dist/components/QuasiGrid.d.ts.map +1 -1
  105. package/dist/components/QuasiGrid.js +6 -33
  106. package/dist/components/RadarGrid.d.ts +1 -1
  107. package/dist/components/RadarGrid.d.ts.map +1 -1
  108. package/dist/components/RadarGrid.js +6 -34
  109. package/dist/components/ReactionDiffusionGrid.d.ts +1 -1
  110. package/dist/components/ReactionDiffusionGrid.d.ts.map +1 -1
  111. package/dist/components/ReactionDiffusionGrid.js +6 -35
  112. package/dist/components/SceneBuilder.d.ts +25 -3
  113. package/dist/components/SceneBuilder.d.ts.map +1 -1
  114. package/dist/components/SceneBuilder.js +68 -38
  115. package/dist/components/SkyController.d.ts +25 -1
  116. package/dist/components/SkyController.d.ts.map +1 -1
  117. package/dist/components/SkyController.js +189 -130
  118. package/dist/components/SkyMesh.d.ts.map +1 -1
  119. package/dist/components/SkyMesh.js +26 -1
  120. package/dist/components/SkyStars.d.ts +11 -0
  121. package/dist/components/SkyStars.d.ts.map +1 -0
  122. package/dist/components/SkyStars.js +187 -0
  123. package/dist/components/SkySystem.d.ts +3 -3
  124. package/dist/components/SkySystem.d.ts.map +1 -1
  125. package/dist/components/SkySystem.js +8 -2
  126. package/dist/components/Sun.d.ts +15 -1
  127. package/dist/components/Sun.d.ts.map +1 -1
  128. package/dist/components/Sun.js +64 -3
  129. package/dist/components/SunLight.d.ts +6 -1
  130. package/dist/components/SunLight.d.ts.map +1 -1
  131. package/dist/components/SunLight.js +96 -44
  132. package/dist/components/TerrainBuilder.d.ts.map +1 -1
  133. package/dist/components/TerrainBuilder.js +2 -0
  134. package/dist/components/TextGenerator.d.ts +9 -0
  135. package/dist/components/TextGenerator.d.ts.map +1 -0
  136. package/dist/components/TextGenerator.js +29 -0
  137. package/dist/components/TruchetGrid.d.ts +25 -0
  138. package/dist/components/TruchetGrid.d.ts.map +1 -0
  139. package/dist/components/TruchetGrid.js +55 -0
  140. package/dist/components/VoronoiGrid.d.ts +1 -1
  141. package/dist/components/VoronoiGrid.d.ts.map +1 -1
  142. package/dist/components/VoronoiGrid.js +6 -33
  143. package/dist/components/WallpaperGrid.d.ts +1 -1
  144. package/dist/components/WallpaperGrid.d.ts.map +1 -1
  145. package/dist/components/WallpaperGrid.js +6 -35
  146. package/dist/components/environment/Rain.d.ts +15 -0
  147. package/dist/components/environment/Rain.d.ts.map +1 -0
  148. package/dist/components/environment/Rain.js +110 -0
  149. package/dist/components/environment/Rainbow.d.ts +20 -0
  150. package/dist/components/environment/Rainbow.d.ts.map +1 -0
  151. package/dist/components/environment/Rainbow.js +974 -0
  152. package/dist/components/environment/Sandstorm.d.ts +20 -0
  153. package/dist/components/environment/Sandstorm.d.ts.map +1 -0
  154. package/dist/components/environment/Sandstorm.js +776 -0
  155. package/dist/components/environment/Snow.d.ts +20 -0
  156. package/dist/components/environment/Snow.d.ts.map +1 -0
  157. package/dist/components/environment/Snow.js +609 -0
  158. package/dist/components/environment/Thunderstorm.d.ts +20 -0
  159. package/dist/components/environment/Thunderstorm.d.ts.map +1 -0
  160. package/dist/components/environment/Thunderstorm.js +731 -0
  161. package/dist/components/environment/Tornado.d.ts +20 -0
  162. package/dist/components/environment/Tornado.d.ts.map +1 -0
  163. package/dist/components/environment/Tornado.js +762 -0
  164. package/dist/components/environment/index.d.ts +13 -0
  165. package/dist/components/environment/index.d.ts.map +1 -0
  166. package/dist/components/environment/index.js +7 -0
  167. package/dist/components/index.d.ts +24 -10
  168. package/dist/components/index.d.ts.map +1 -1
  169. package/dist/components/index.js +15 -6
  170. package/dist/components/land/LandPatch.d.ts +15 -0
  171. package/dist/components/land/LandPatch.d.ts.map +1 -0
  172. package/dist/components/land/LandPatch.js +170 -0
  173. package/dist/components/land/index.d.ts +3 -0
  174. package/dist/components/land/index.d.ts.map +1 -0
  175. package/dist/components/land/index.js +1 -0
  176. package/dist/components/space/Earth.d.ts +16 -0
  177. package/dist/components/space/Earth.d.ts.map +1 -0
  178. package/dist/components/space/Earth.js +75 -0
  179. package/dist/components/space/ShootingStar.d.ts +21 -0
  180. package/dist/components/space/ShootingStar.d.ts.map +1 -0
  181. package/dist/components/space/ShootingStar.js +101 -0
  182. package/dist/components/space/ShootingStars.d.ts +16 -0
  183. package/dist/components/space/ShootingStars.d.ts.map +1 -0
  184. package/dist/components/space/ShootingStars.js +71 -0
  185. package/dist/components/space/SolarSystem.d.ts +16 -0
  186. package/dist/components/space/SolarSystem.d.ts.map +1 -0
  187. package/dist/components/space/SolarSystem.js +141 -0
  188. package/dist/components/space/Stars.d.ts +20 -0
  189. package/dist/components/space/Stars.d.ts.map +1 -0
  190. package/dist/components/space/Stars.js +160 -0
  191. package/dist/components/space/index.d.ts +11 -0
  192. package/dist/components/space/index.d.ts.map +1 -0
  193. package/dist/components/space/index.js +8 -0
  194. package/dist/components/terrain/TerrainSurface.d.ts.map +1 -1
  195. package/dist/components/terrain/TerrainSurface.js +27 -3
  196. package/dist/components/terrain/types.d.ts +5 -1
  197. package/dist/components/terrain/types.d.ts.map +1 -1
  198. package/dist/components/text/BurnAwayText.d.ts +15 -0
  199. package/dist/components/text/BurnAwayText.d.ts.map +1 -0
  200. package/dist/components/text/BurnAwayText.js +4 -0
  201. package/dist/components/text/ChalkboardText.d.ts +15 -0
  202. package/dist/components/text/ChalkboardText.d.ts.map +1 -0
  203. package/dist/components/text/ChalkboardText.js +4 -0
  204. package/dist/components/text/ConstellationText.d.ts +15 -0
  205. package/dist/components/text/ConstellationText.d.ts.map +1 -0
  206. package/dist/components/text/ConstellationText.js +4 -0
  207. package/dist/components/text/EmbroideryText.d.ts +15 -0
  208. package/dist/components/text/EmbroideryText.d.ts.map +1 -0
  209. package/dist/components/text/EmbroideryText.js +4 -0
  210. package/dist/components/text/FourierSketchText.d.ts +15 -0
  211. package/dist/components/text/FourierSketchText.d.ts.map +1 -0
  212. package/dist/components/text/FourierSketchText.js +4 -0
  213. package/dist/components/text/FrostGrowthText.d.ts +15 -0
  214. package/dist/components/text/FrostGrowthText.d.ts.map +1 -0
  215. package/dist/components/text/FrostGrowthText.js +4 -0
  216. package/dist/components/text/HandwritingText.d.ts +15 -0
  217. package/dist/components/text/HandwritingText.d.ts.map +1 -0
  218. package/dist/components/text/HandwritingText.js +4 -0
  219. package/dist/components/text/InkBleedText.d.ts +15 -0
  220. package/dist/components/text/InkBleedText.d.ts.map +1 -0
  221. package/dist/components/text/InkBleedText.js +4 -0
  222. package/dist/components/text/LightPaintingText.d.ts +15 -0
  223. package/dist/components/text/LightPaintingText.d.ts.map +1 -0
  224. package/dist/components/text/LightPaintingText.js +4 -0
  225. package/dist/components/text/LiquidMetalText.d.ts +15 -0
  226. package/dist/components/text/LiquidMetalText.d.ts.map +1 -0
  227. package/dist/components/text/LiquidMetalText.js +4 -0
  228. package/dist/components/text/NeonTubeText.d.ts +15 -0
  229. package/dist/components/text/NeonTubeText.d.ts.map +1 -0
  230. package/dist/components/text/NeonTubeText.js +4 -0
  231. package/dist/components/text/PlasmaDischargeText.d.ts +15 -0
  232. package/dist/components/text/PlasmaDischargeText.d.ts.map +1 -0
  233. package/dist/components/text/PlasmaDischargeText.js +4 -0
  234. package/dist/components/text/TextObjectView.d.ts +12 -0
  235. package/dist/components/text/TextObjectView.d.ts.map +1 -0
  236. package/dist/components/text/TextObjectView.js +11 -0
  237. package/dist/components/text/engine/fieldkit.d.ts +24 -0
  238. package/dist/components/text/engine/fieldkit.d.ts.map +1 -0
  239. package/dist/components/text/engine/fieldkit.js +201 -0
  240. package/dist/components/text/engine/glyphs.d.ts +19 -0
  241. package/dist/components/text/engine/glyphs.d.ts.map +1 -0
  242. package/dist/components/text/engine/glyphs.js +269 -0
  243. package/dist/components/text/engine/looks/burnAway.d.ts +144 -0
  244. package/dist/components/text/engine/looks/burnAway.d.ts.map +1 -0
  245. package/dist/components/text/engine/looks/burnAway.js +593 -0
  246. package/dist/components/text/engine/looks/chalkboard.d.ts +135 -0
  247. package/dist/components/text/engine/looks/chalkboard.d.ts.map +1 -0
  248. package/dist/components/text/engine/looks/chalkboard.js +426 -0
  249. package/dist/components/text/engine/looks/constellation.d.ts +111 -0
  250. package/dist/components/text/engine/looks/constellation.d.ts.map +1 -0
  251. package/dist/components/text/engine/looks/constellation.js +496 -0
  252. package/dist/components/text/engine/looks/embroidery.d.ts +165 -0
  253. package/dist/components/text/engine/looks/embroidery.d.ts.map +1 -0
  254. package/dist/components/text/engine/looks/embroidery.js +645 -0
  255. package/dist/components/text/engine/looks/frostGrowth.d.ts +109 -0
  256. package/dist/components/text/engine/looks/frostGrowth.d.ts.map +1 -0
  257. package/dist/components/text/engine/looks/frostGrowth.js +727 -0
  258. package/dist/components/text/engine/looks/index.d.ts +2 -0
  259. package/dist/components/text/engine/looks/index.d.ts.map +1 -0
  260. package/dist/components/text/engine/looks/index.js +48 -0
  261. package/dist/components/text/engine/looks/inkBleed.d.ts +103 -0
  262. package/dist/components/text/engine/looks/inkBleed.d.ts.map +1 -0
  263. package/dist/components/text/engine/looks/inkBleed.js +590 -0
  264. package/dist/components/text/engine/looks/lightPainting.d.ts +132 -0
  265. package/dist/components/text/engine/looks/lightPainting.d.ts.map +1 -0
  266. package/dist/components/text/engine/looks/lightPainting.js +567 -0
  267. package/dist/components/text/engine/looks/liquidMetal.d.ts +135 -0
  268. package/dist/components/text/engine/looks/liquidMetal.d.ts.map +1 -0
  269. package/dist/components/text/engine/looks/liquidMetal.js +655 -0
  270. package/dist/components/text/engine/looks/plasmaDischarge.d.ts +126 -0
  271. package/dist/components/text/engine/looks/plasmaDischarge.d.ts.map +1 -0
  272. package/dist/components/text/engine/looks/plasmaDischarge.js +763 -0
  273. package/dist/components/text/engine/methods.d.ts +19 -0
  274. package/dist/components/text/engine/methods.d.ts.map +1 -0
  275. package/dist/components/text/engine/methods.js +126 -0
  276. package/dist/components/text/engine/playback.d.ts +40 -0
  277. package/dist/components/text/engine/playback.d.ts.map +1 -0
  278. package/dist/components/text/engine/playback.js +114 -0
  279. package/dist/components/text/engine/ribbon.d.ts +58 -0
  280. package/dist/components/text/engine/ribbon.d.ts.map +1 -0
  281. package/dist/components/text/engine/ribbon.js +250 -0
  282. package/dist/components/text/engine/variants.d.ts +159 -0
  283. package/dist/components/text/engine/variants.d.ts.map +1 -0
  284. package/dist/components/text/engine/variants.js +378 -0
  285. package/dist/components/text/fonts/architects-daughter.outline.d.ts +3 -0
  286. package/dist/components/text/fonts/architects-daughter.outline.d.ts.map +1 -0
  287. package/dist/components/text/fonts/architects-daughter.outline.js +4 -0
  288. package/dist/components/text/fonts/architects-daughter.strokes.d.ts +3 -0
  289. package/dist/components/text/fonts/architects-daughter.strokes.d.ts.map +1 -0
  290. package/dist/components/text/fonts/architects-daughter.strokes.js +4 -0
  291. package/dist/components/text/fonts/caveat.outline.d.ts +3 -0
  292. package/dist/components/text/fonts/caveat.outline.d.ts.map +1 -0
  293. package/dist/components/text/fonts/caveat.outline.js +4 -0
  294. package/dist/components/text/fonts/caveat.strokes.d.ts +3 -0
  295. package/dist/components/text/fonts/caveat.strokes.d.ts.map +1 -0
  296. package/dist/components/text/fonts/caveat.strokes.js +4 -0
  297. package/dist/components/text/fonts/courgette.outline.d.ts +3 -0
  298. package/dist/components/text/fonts/courgette.outline.d.ts.map +1 -0
  299. package/dist/components/text/fonts/courgette.outline.js +4 -0
  300. package/dist/components/text/fonts/courgette.strokes.d.ts +3 -0
  301. package/dist/components/text/fonts/courgette.strokes.d.ts.map +1 -0
  302. package/dist/components/text/fonts/courgette.strokes.js +4 -0
  303. package/dist/components/text/fonts/dancing-script.outline.d.ts +3 -0
  304. package/dist/components/text/fonts/dancing-script.outline.d.ts.map +1 -0
  305. package/dist/components/text/fonts/dancing-script.outline.js +4 -0
  306. package/dist/components/text/fonts/dancing-script.strokes.d.ts +3 -0
  307. package/dist/components/text/fonts/dancing-script.strokes.d.ts.map +1 -0
  308. package/dist/components/text/fonts/dancing-script.strokes.js +4 -0
  309. package/dist/components/text/fonts/gochi-hand.outline.d.ts +3 -0
  310. package/dist/components/text/fonts/gochi-hand.outline.d.ts.map +1 -0
  311. package/dist/components/text/fonts/gochi-hand.outline.js +4 -0
  312. package/dist/components/text/fonts/gochi-hand.strokes.d.ts +3 -0
  313. package/dist/components/text/fonts/gochi-hand.strokes.d.ts.map +1 -0
  314. package/dist/components/text/fonts/gochi-hand.strokes.js +4 -0
  315. package/dist/components/text/fonts/handlee.outline.d.ts +3 -0
  316. package/dist/components/text/fonts/handlee.outline.d.ts.map +1 -0
  317. package/dist/components/text/fonts/handlee.outline.js +4 -0
  318. package/dist/components/text/fonts/handlee.strokes.d.ts +3 -0
  319. package/dist/components/text/fonts/handlee.strokes.d.ts.map +1 -0
  320. package/dist/components/text/fonts/handlee.strokes.js +4 -0
  321. package/dist/components/text/fonts/index.d.ts +5 -0
  322. package/dist/components/text/fonts/index.d.ts.map +1 -0
  323. package/dist/components/text/fonts/index.js +44 -0
  324. package/dist/components/text/fonts/indie-flower.outline.d.ts +3 -0
  325. package/dist/components/text/fonts/indie-flower.outline.d.ts.map +1 -0
  326. package/dist/components/text/fonts/indie-flower.outline.js +4 -0
  327. package/dist/components/text/fonts/indie-flower.strokes.d.ts +3 -0
  328. package/dist/components/text/fonts/indie-flower.strokes.d.ts.map +1 -0
  329. package/dist/components/text/fonts/indie-flower.strokes.js +4 -0
  330. package/dist/components/text/fonts/kalam.outline.d.ts +3 -0
  331. package/dist/components/text/fonts/kalam.outline.d.ts.map +1 -0
  332. package/dist/components/text/fonts/kalam.outline.js +4 -0
  333. package/dist/components/text/fonts/kalam.strokes.d.ts +3 -0
  334. package/dist/components/text/fonts/kalam.strokes.d.ts.map +1 -0
  335. package/dist/components/text/fonts/kalam.strokes.js +4 -0
  336. package/dist/components/text/fonts/kaushan-script.outline.d.ts +3 -0
  337. package/dist/components/text/fonts/kaushan-script.outline.d.ts.map +1 -0
  338. package/dist/components/text/fonts/kaushan-script.outline.js +4 -0
  339. package/dist/components/text/fonts/kaushan-script.strokes.d.ts +3 -0
  340. package/dist/components/text/fonts/kaushan-script.strokes.d.ts.map +1 -0
  341. package/dist/components/text/fonts/kaushan-script.strokes.js +4 -0
  342. package/dist/components/text/fonts/mynerve.outline.d.ts +3 -0
  343. package/dist/components/text/fonts/mynerve.outline.d.ts.map +1 -0
  344. package/dist/components/text/fonts/mynerve.outline.js +4 -0
  345. package/dist/components/text/fonts/mynerve.strokes.d.ts +3 -0
  346. package/dist/components/text/fonts/mynerve.strokes.d.ts.map +1 -0
  347. package/dist/components/text/fonts/mynerve.strokes.js +4 -0
  348. package/dist/components/text/fonts/nanum-pen-script.outline.d.ts +3 -0
  349. package/dist/components/text/fonts/nanum-pen-script.outline.d.ts.map +1 -0
  350. package/dist/components/text/fonts/nanum-pen-script.outline.js +4 -0
  351. package/dist/components/text/fonts/nanum-pen-script.strokes.d.ts +3 -0
  352. package/dist/components/text/fonts/nanum-pen-script.strokes.d.ts.map +1 -0
  353. package/dist/components/text/fonts/nanum-pen-script.strokes.js +4 -0
  354. package/dist/components/text/fonts/pacifico.outline.d.ts +3 -0
  355. package/dist/components/text/fonts/pacifico.outline.d.ts.map +1 -0
  356. package/dist/components/text/fonts/pacifico.outline.js +4 -0
  357. package/dist/components/text/fonts/pacifico.strokes.d.ts +3 -0
  358. package/dist/components/text/fonts/pacifico.strokes.d.ts.map +1 -0
  359. package/dist/components/text/fonts/pacifico.strokes.js +4 -0
  360. package/dist/components/text/fonts/patrick-hand.outline.d.ts +3 -0
  361. package/dist/components/text/fonts/patrick-hand.outline.d.ts.map +1 -0
  362. package/dist/components/text/fonts/patrick-hand.outline.js +4 -0
  363. package/dist/components/text/fonts/patrick-hand.strokes.d.ts +3 -0
  364. package/dist/components/text/fonts/patrick-hand.strokes.d.ts.map +1 -0
  365. package/dist/components/text/fonts/patrick-hand.strokes.js +4 -0
  366. package/dist/components/text/fonts/poppins.outline.d.ts +3 -0
  367. package/dist/components/text/fonts/poppins.outline.d.ts.map +1 -0
  368. package/dist/components/text/fonts/poppins.outline.js +4 -0
  369. package/dist/components/text/fonts/poppins.strokes.d.ts +3 -0
  370. package/dist/components/text/fonts/poppins.strokes.d.ts.map +1 -0
  371. package/dist/components/text/fonts/poppins.strokes.js +4 -0
  372. package/dist/components/text/fonts/satisfy.outline.d.ts +3 -0
  373. package/dist/components/text/fonts/satisfy.outline.d.ts.map +1 -0
  374. package/dist/components/text/fonts/satisfy.outline.js +4 -0
  375. package/dist/components/text/fonts/satisfy.strokes.d.ts +3 -0
  376. package/dist/components/text/fonts/satisfy.strokes.d.ts.map +1 -0
  377. package/dist/components/text/fonts/satisfy.strokes.js +4 -0
  378. package/dist/components/text/fonts/sriracha.outline.d.ts +3 -0
  379. package/dist/components/text/fonts/sriracha.outline.d.ts.map +1 -0
  380. package/dist/components/text/fonts/sriracha.outline.js +4 -0
  381. package/dist/components/text/fonts/sriracha.strokes.d.ts +3 -0
  382. package/dist/components/text/fonts/sriracha.strokes.d.ts.map +1 -0
  383. package/dist/components/text/fonts/sriracha.strokes.js +4 -0
  384. package/dist/components/text/index.d.ts +27 -0
  385. package/dist/components/text/index.d.ts.map +1 -0
  386. package/dist/components/text/index.js +13 -0
  387. package/dist/components/text/useTextObject.d.ts +21 -0
  388. package/dist/components/text/useTextObject.d.ts.map +1 -0
  389. package/dist/components/text/useTextObject.js +118 -0
  390. package/dist/components/water/OceanSurface.d.ts.map +1 -1
  391. package/dist/components/water/OceanSurface.js +3 -1
  392. package/dist/components/water/WaterBody.d.ts.map +1 -1
  393. package/dist/components/water/WaterBody.js +3 -1
  394. package/dist/components/water/types.d.ts +5 -1
  395. package/dist/components/water/types.d.ts.map +1 -1
  396. package/dist/constants.d.ts +1 -1
  397. package/dist/constants.d.ts.map +1 -1
  398. package/dist/constants.js +5 -1
  399. package/dist/hooks/index.d.ts +2 -0
  400. package/dist/hooks/index.d.ts.map +1 -1
  401. package/dist/hooks/index.js +1 -0
  402. package/dist/hooks/useCloudSun.d.ts +9 -4
  403. package/dist/hooks/useCloudSun.d.ts.map +1 -1
  404. package/dist/hooks/useCloudSun.js +17 -7
  405. package/dist/hooks/useConfigLive.d.ts +3 -2
  406. package/dist/hooks/useConfigLive.d.ts.map +1 -1
  407. package/dist/hooks/useContinuousEffects.d.ts.map +1 -1
  408. package/dist/hooks/useContinuousEffects.js +4 -10
  409. package/dist/hooks/useEnvironmentProbe.d.ts +3 -22
  410. package/dist/hooks/useEnvironmentProbe.d.ts.map +1 -1
  411. package/dist/hooks/useEnvironmentProbe.js +47 -8
  412. package/dist/hooks/useGridSurface.d.ts +3 -10
  413. package/dist/hooks/useGridSurface.d.ts.map +1 -1
  414. package/dist/hooks/useGridSurface.js +5 -31
  415. package/dist/hooks/useInteraction.d.ts.map +1 -1
  416. package/dist/hooks/useInteraction.js +19 -72
  417. package/dist/hooks/useLightConfig.d.ts +2 -1
  418. package/dist/hooks/useLightConfig.d.ts.map +1 -1
  419. package/dist/hooks/useOceanMaterial.d.ts +6 -2
  420. package/dist/hooks/useOceanMaterial.d.ts.map +1 -1
  421. package/dist/hooks/useOceanMaterial.js +37 -2
  422. package/dist/hooks/useSkyLive.d.ts +23 -0
  423. package/dist/hooks/useSkyLive.d.ts.map +1 -0
  424. package/dist/hooks/useSkyLive.js +30 -0
  425. package/dist/hooks/useSkyUniforms.d.ts.map +1 -1
  426. package/dist/hooks/useSkyUniforms.js +2 -10
  427. package/dist/hooks/useTerrainLive.d.ts +3 -1
  428. package/dist/hooks/useTerrainLive.d.ts.map +1 -1
  429. package/dist/hooks/useTerrainTextures.d.ts +38 -0
  430. package/dist/hooks/useTerrainTextures.d.ts.map +1 -0
  431. package/dist/hooks/useTerrainTextures.js +149 -0
  432. package/dist/index.d.ts +11 -2
  433. package/dist/index.d.ts.map +1 -1
  434. package/dist/index.js +8 -1
  435. package/dist/operations/catalogue/blastOff.d.ts +3 -0
  436. package/dist/operations/catalogue/blastOff.d.ts.map +1 -0
  437. package/dist/operations/catalogue/blastOff.js +118 -0
  438. package/dist/operations/catalogue/bounce.d.ts +3 -0
  439. package/dist/operations/catalogue/bounce.d.ts.map +1 -0
  440. package/dist/operations/catalogue/bounce.js +34 -0
  441. package/dist/operations/catalogue/curlSmoke.d.ts.map +1 -1
  442. package/dist/operations/catalogue/curlSmoke.js +3 -1
  443. package/dist/operations/catalogue/dissolve.d.ts.map +1 -1
  444. package/dist/operations/catalogue/dissolve.js +2 -1
  445. package/dist/operations/catalogue/driftUp.d.ts +3 -0
  446. package/dist/operations/catalogue/driftUp.d.ts.map +1 -0
  447. package/dist/operations/catalogue/driftUp.js +57 -0
  448. package/dist/operations/catalogue/emberAsh.d.ts.map +1 -1
  449. package/dist/operations/catalogue/emberAsh.js +2 -1
  450. package/dist/operations/catalogue/flip.d.ts.map +1 -1
  451. package/dist/operations/catalogue/flip.js +19 -9
  452. package/dist/operations/catalogue/float.d.ts +3 -0
  453. package/dist/operations/catalogue/float.d.ts.map +1 -0
  454. package/dist/operations/catalogue/float.js +39 -0
  455. package/dist/operations/catalogue/flyBy.d.ts +3 -0
  456. package/dist/operations/catalogue/flyBy.d.ts.map +1 -0
  457. package/dist/operations/catalogue/flyBy.js +79 -0
  458. package/dist/operations/catalogue/frost.d.ts.map +1 -1
  459. package/dist/operations/catalogue/frost.js +10 -3
  460. package/dist/operations/catalogue/grow.d.ts +3 -0
  461. package/dist/operations/catalogue/grow.d.ts.map +1 -0
  462. package/dist/operations/catalogue/grow.js +19 -0
  463. package/dist/operations/catalogue/hologram.d.ts.map +1 -1
  464. package/dist/operations/catalogue/hologram.js +11 -5
  465. package/dist/operations/catalogue/jelly.d.ts.map +1 -1
  466. package/dist/operations/catalogue/jelly.js +18 -8
  467. package/dist/operations/catalogue/knockAway.d.ts +3 -0
  468. package/dist/operations/catalogue/knockAway.d.ts.map +1 -0
  469. package/dist/operations/catalogue/knockAway.js +74 -0
  470. package/dist/operations/catalogue/leafFall.d.ts +3 -0
  471. package/dist/operations/catalogue/leafFall.d.ts.map +1 -0
  472. package/dist/operations/catalogue/leafFall.js +74 -0
  473. package/dist/operations/catalogue/lidarScan.d.ts.map +1 -1
  474. package/dist/operations/catalogue/lidarScan.js +4 -1
  475. package/dist/operations/catalogue/metalize.d.ts.map +1 -1
  476. package/dist/operations/catalogue/metalize.js +8 -2
  477. package/dist/operations/catalogue/motionTrail.d.ts +6 -0
  478. package/dist/operations/catalogue/motionTrail.d.ts.map +1 -0
  479. package/dist/operations/catalogue/motionTrail.js +221 -0
  480. package/dist/operations/catalogue/petrify.d.ts.map +1 -1
  481. package/dist/operations/catalogue/petrify.js +9 -3
  482. package/dist/operations/catalogue/physicalExit.d.ts +55 -0
  483. package/dist/operations/catalogue/physicalExit.d.ts.map +1 -0
  484. package/dist/operations/catalogue/physicalExit.js +165 -0
  485. package/dist/operations/catalogue/physicalHeld.d.ts +41 -0
  486. package/dist/operations/catalogue/physicalHeld.d.ts.map +1 -0
  487. package/dist/operations/catalogue/physicalHeld.js +78 -0
  488. package/dist/operations/catalogue/physicalMix.d.ts +45 -0
  489. package/dist/operations/catalogue/physicalMix.d.ts.map +1 -0
  490. package/dist/operations/catalogue/physicalMix.js +144 -0
  491. package/dist/operations/catalogue/pop.d.ts +3 -0
  492. package/dist/operations/catalogue/pop.d.ts.map +1 -0
  493. package/dist/operations/catalogue/pop.js +44 -0
  494. package/dist/operations/catalogue/print3d.d.ts.map +1 -1
  495. package/dist/operations/catalogue/print3d.js +5 -1
  496. package/dist/operations/catalogue/pulse.d.ts +3 -0
  497. package/dist/operations/catalogue/pulse.d.ts.map +1 -0
  498. package/dist/operations/catalogue/pulse.js +29 -0
  499. package/dist/operations/catalogue/restPose.d.ts +5 -7
  500. package/dist/operations/catalogue/restPose.d.ts.map +1 -1
  501. package/dist/operations/catalogue/restPose.js +18 -48
  502. package/dist/operations/catalogue/rotate.d.ts +3 -0
  503. package/dist/operations/catalogue/rotate.d.ts.map +1 -0
  504. package/dist/operations/catalogue/rotate.js +49 -0
  505. package/dist/operations/catalogue/shake.d.ts +3 -0
  506. package/dist/operations/catalogue/shake.d.ts.map +1 -0
  507. package/dist/operations/catalogue/shake.js +31 -0
  508. package/dist/operations/catalogue/shatter.d.ts.map +1 -1
  509. package/dist/operations/catalogue/shatter.js +5 -1
  510. package/dist/operations/catalogue/slam.d.ts +3 -0
  511. package/dist/operations/catalogue/slam.d.ts.map +1 -0
  512. package/dist/operations/catalogue/slam.js +89 -0
  513. package/dist/operations/catalogue/slingshot.d.ts +3 -0
  514. package/dist/operations/catalogue/slingshot.d.ts.map +1 -0
  515. package/dist/operations/catalogue/slingshot.js +88 -0
  516. package/dist/operations/catalogue/spin.d.ts.map +1 -1
  517. package/dist/operations/catalogue/spin.js +24 -13
  518. package/dist/operations/catalogue/sway.d.ts +3 -0
  519. package/dist/operations/catalogue/sway.d.ts.map +1 -0
  520. package/dist/operations/catalogue/sway.js +23 -0
  521. package/dist/operations/catalogue/swirl.d.ts.map +1 -1
  522. package/dist/operations/catalogue/swirl.js +6 -5
  523. package/dist/operations/catalogue/trailCore.d.ts +89 -0
  524. package/dist/operations/catalogue/trailCore.d.ts.map +1 -0
  525. package/dist/operations/catalogue/trailCore.js +190 -0
  526. package/dist/operations/catalogue/trailGhosts.d.ts +5 -0
  527. package/dist/operations/catalogue/trailGhosts.d.ts.map +1 -0
  528. package/dist/operations/catalogue/trailGhosts.js +179 -0
  529. package/dist/operations/catalogue/trailStampStyles.d.ts +11 -0
  530. package/dist/operations/catalogue/trailStampStyles.d.ts.map +1 -0
  531. package/dist/operations/catalogue/trailStampStyles.js +479 -0
  532. package/dist/operations/catalogue/trailStamps.d.ts +57 -0
  533. package/dist/operations/catalogue/trailStamps.d.ts.map +1 -0
  534. package/dist/operations/catalogue/trailStamps.js +349 -0
  535. package/dist/operations/catalogue/trailStreaks.d.ts +3 -0
  536. package/dist/operations/catalogue/trailStreaks.d.ts.map +1 -0
  537. package/dist/operations/catalogue/trailStreaks.js +147 -0
  538. package/dist/operations/catalogue/transitionField.d.ts +30 -0
  539. package/dist/operations/catalogue/transitionField.d.ts.map +1 -1
  540. package/dist/operations/catalogue/transitionField.js +21 -0
  541. package/dist/operations/catalogue/turnAway.d.ts +3 -0
  542. package/dist/operations/catalogue/turnAway.d.ts.map +1 -0
  543. package/dist/operations/catalogue/turnAway.js +54 -0
  544. package/dist/operations/catalogue/vortexDrain.d.ts +3 -0
  545. package/dist/operations/catalogue/vortexDrain.d.ts.map +1 -0
  546. package/dist/operations/catalogue/vortexDrain.js +68 -0
  547. package/dist/operations/catalogue/warp.d.ts +3 -0
  548. package/dist/operations/catalogue/warp.d.ts.map +1 -0
  549. package/dist/operations/catalogue/warp.js +73 -0
  550. package/dist/operations/catalogue/whoosh.d.ts +3 -0
  551. package/dist/operations/catalogue/whoosh.d.ts.map +1 -0
  552. package/dist/operations/catalogue/whoosh.js +84 -0
  553. package/dist/operations/catalogue/wobble.d.ts +3 -0
  554. package/dist/operations/catalogue/wobble.d.ts.map +1 -0
  555. package/dist/operations/catalogue/wobble.js +23 -0
  556. package/dist/operations/clipPreview.d.ts +3 -0
  557. package/dist/operations/clipPreview.d.ts.map +1 -0
  558. package/dist/operations/clipPreview.js +20 -0
  559. package/dist/operations/groupFanout.d.ts +96 -0
  560. package/dist/operations/groupFanout.d.ts.map +1 -0
  561. package/dist/operations/groupFanout.js +365 -0
  562. package/dist/operations/groups.d.ts +20 -0
  563. package/dist/operations/groups.d.ts.map +1 -0
  564. package/dist/operations/groups.js +66 -0
  565. package/dist/operations/index.d.ts +5 -2
  566. package/dist/operations/index.d.ts.map +1 -1
  567. package/dist/operations/index.js +5 -2
  568. package/dist/operations/objectEffects.d.ts +161 -6
  569. package/dist/operations/objectEffects.d.ts.map +1 -1
  570. package/dist/operations/objectEffects.js +1091 -17
  571. package/dist/operations/registry.d.ts.map +1 -1
  572. package/dist/operations/registry.js +24 -2
  573. package/dist/operations/runtime.d.ts +57 -2
  574. package/dist/operations/runtime.d.ts.map +1 -1
  575. package/dist/operations/runtime.js +161 -18
  576. package/dist/operations/types.d.ts +60 -3
  577. package/dist/operations/types.d.ts.map +1 -1
  578. package/dist/operations/types.js +5 -1
  579. package/dist/operations/useObjectEffectLayers.d.ts +2 -2
  580. package/dist/operations/useObjectEffectLayers.d.ts.map +1 -1
  581. package/dist/operations/useObjectEffectLayers.js +31 -10
  582. package/dist/operations/usePresentedVisibility.d.ts +10 -0
  583. package/dist/operations/usePresentedVisibility.d.ts.map +1 -0
  584. package/dist/operations/usePresentedVisibility.js +53 -0
  585. package/dist/presets/terrainBiomes.d.ts +67 -0
  586. package/dist/presets/terrainBiomes.d.ts.map +1 -0
  587. package/dist/presets/terrainBiomes.js +294 -0
  588. package/dist/presets/terrainPresets.d.ts +6 -0
  589. package/dist/presets/terrainPresets.d.ts.map +1 -1
  590. package/dist/presets/terrainPresets.js +26 -38
  591. package/dist/shaders/glsl/oceanCore.glsl.d.ts +2 -2
  592. package/dist/shaders/glsl/oceanCore.glsl.d.ts.map +1 -1
  593. package/dist/shaders/glsl/oceanCore.glsl.js +17 -0
  594. package/dist/shaders/glsl/surfaceCore.glsl.d.ts +21 -0
  595. package/dist/shaders/glsl/surfaceCore.glsl.d.ts.map +1 -0
  596. package/dist/shaders/glsl/surfaceCore.glsl.js +120 -0
  597. package/dist/shaders/glsl/terrainCore.glsl.d.ts +16 -3
  598. package/dist/shaders/glsl/terrainCore.glsl.d.ts.map +1 -1
  599. package/dist/shaders/glsl/terrainCore.glsl.js +266 -20
  600. package/dist/shaders/ocean/OceanSurfaceMaterial.d.ts +2 -0
  601. package/dist/shaders/ocean/OceanSurfaceMaterial.d.ts.map +1 -1
  602. package/dist/shaders/ocean/OceanSurfaceMaterial.js +3 -0
  603. package/dist/shaders/terrain/TerrainMaterial.d.ts +17 -0
  604. package/dist/shaders/terrain/TerrainMaterial.d.ts.map +1 -1
  605. package/dist/shaders/terrain/TerrainMaterial.js +107 -8
  606. package/dist/triggers/engine.d.ts +44 -0
  607. package/dist/triggers/engine.d.ts.map +1 -0
  608. package/dist/triggers/engine.js +165 -0
  609. package/dist/triggers/hosts/actions.d.ts +8 -0
  610. package/dist/triggers/hosts/actions.d.ts.map +1 -0
  611. package/dist/triggers/hosts/actions.js +22 -0
  612. package/dist/triggers/hosts/interactions.d.ts +6 -0
  613. package/dist/triggers/hosts/interactions.d.ts.map +1 -0
  614. package/dist/triggers/hosts/interactions.js +4 -0
  615. package/dist/triggers/hosts/timelineCues.d.ts +2 -0
  616. package/dist/triggers/hosts/timelineCues.d.ts.map +1 -0
  617. package/dist/triggers/hosts/timelineCues.js +22 -0
  618. package/dist/triggers/index.d.ts +13 -0
  619. package/dist/triggers/index.d.ts.map +1 -0
  620. package/dist/triggers/index.js +9 -0
  621. package/dist/triggers/kinds/action.d.ts +2 -0
  622. package/dist/triggers/kinds/action.d.ts.map +1 -0
  623. package/dist/triggers/kinds/action.js +31 -0
  624. package/dist/triggers/kinds/animations.d.ts +2 -0
  625. package/dist/triggers/kinds/animations.d.ts.map +1 -0
  626. package/dist/triggers/kinds/animations.js +75 -0
  627. package/dist/triggers/kinds/effects.d.ts +2 -0
  628. package/dist/triggers/kinds/effects.d.ts.map +1 -0
  629. package/dist/triggers/kinds/effects.js +27 -0
  630. package/dist/triggers/kinds/index.d.ts +4 -0
  631. package/dist/triggers/kinds/index.d.ts.map +1 -0
  632. package/dist/triggers/kinds/index.js +4 -0
  633. package/dist/triggers/log.d.ts +21 -0
  634. package/dist/triggers/log.d.ts.map +1 -0
  635. package/dist/triggers/log.js +43 -0
  636. package/dist/triggers/readiness.d.ts +40 -0
  637. package/dist/triggers/readiness.d.ts.map +1 -0
  638. package/dist/triggers/readiness.js +158 -0
  639. package/dist/triggers/registry.d.ts +41 -0
  640. package/dist/triggers/registry.d.ts.map +1 -0
  641. package/dist/triggers/registry.js +7 -0
  642. package/dist/types/gridConfigs.d.ts +117 -19
  643. package/dist/types/gridConfigs.d.ts.map +1 -1
  644. package/dist/types/index.d.ts +1 -1
  645. package/dist/types/index.d.ts.map +1 -1
  646. package/dist/ui/UiAnchorUpdater.d.ts +10 -0
  647. package/dist/ui/UiAnchorUpdater.d.ts.map +1 -0
  648. package/dist/ui/UiAnchorUpdater.js +111 -0
  649. package/dist/ui/UiLayers.d.ts +20 -0
  650. package/dist/ui/UiLayers.d.ts.map +1 -0
  651. package/dist/ui/UiLayers.js +57 -0
  652. package/dist/ui/index.d.ts +9 -0
  653. package/dist/ui/index.d.ts.map +1 -0
  654. package/dist/ui/index.js +6 -0
  655. package/dist/ui/uiAnchors.d.ts +21 -0
  656. package/dist/ui/uiAnchors.d.ts.map +1 -0
  657. package/dist/ui/uiAnchors.js +22 -0
  658. package/dist/ui/uiBaseStyles.d.ts +2 -0
  659. package/dist/ui/uiBaseStyles.d.ts.map +1 -0
  660. package/dist/ui/uiBaseStyles.js +100 -0
  661. package/dist/ui/uiBinder.d.ts +30 -0
  662. package/dist/ui/uiBinder.d.ts.map +1 -0
  663. package/dist/ui/uiBinder.js +344 -0
  664. package/dist/utils/configAnimations.d.ts.map +1 -1
  665. package/dist/utils/configAnimations.js +5 -1
  666. package/dist/utils/gridConfig.d.ts +1 -1
  667. package/dist/utils/gridConfig.d.ts.map +1 -1
  668. package/dist/utils/gridConfig.js +1 -1
  669. package/dist/utils/landPatch.d.ts +33 -0
  670. package/dist/utils/landPatch.d.ts.map +1 -0
  671. package/dist/utils/landPatch.js +114 -0
  672. package/dist/utils/renderedSky.d.ts +32 -0
  673. package/dist/utils/renderedSky.d.ts.map +1 -0
  674. package/dist/utils/renderedSky.js +57 -0
  675. package/dist/utils/skyMoon.d.ts +35 -0
  676. package/dist/utils/skyMoon.d.ts.map +1 -0
  677. package/dist/utils/skyMoon.js +41 -0
  678. package/dist/utils/terrainHeight.d.ts +4 -0
  679. package/dist/utils/terrainHeight.d.ts.map +1 -0
  680. package/dist/utils/terrainHeight.js +150 -0
  681. package/dist/utils/terrainTextureResolver.d.ts +18 -0
  682. package/dist/utils/terrainTextureResolver.d.ts.map +1 -0
  683. package/dist/utils/terrainTextureResolver.js +17 -0
  684. package/dist/utils/terrainUniforms.d.ts +17 -0
  685. package/dist/utils/terrainUniforms.d.ts.map +1 -1
  686. package/dist/utils/terrainUniforms.js +84 -0
  687. package/dist/utils/textureArrays.d.ts +29 -0
  688. package/dist/utils/textureArrays.d.ts.map +1 -0
  689. package/dist/utils/textureArrays.js +140 -0
  690. package/package.json +2 -2
@@ -0,0 +1,776 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCallback, useEffect, useLayoutEffect, useMemo, useRef } from 'react';
3
+ import * as THREE from 'three';
4
+ import { useFrame } from '@react-three/fiber';
5
+ import { DEFAULT_ENVIRONMENT_OBJECTS, ENVIRONMENT_OBJECTS_ANIMATABLE } from '@3driseai/3drise-core';
6
+ import { withConfigDefaults } from '../../utils/configAnimations.js';
7
+ import { useObjectReady } from '../../hooks/useObjectReady.js';
8
+ import { useConfigDriver } from '../../hooks/useConfigDriver.js';
9
+ import { useCloudSun } from '../../hooks/useCloudSun.js';
10
+ import { stepPointerField, usePointerField } from '../../utils/pointerField.js';
11
+ // Generated from Claude outputs/environment-lab (common.mjs + sandstorm.mjs, the approved lab modules)
12
+ // by gen_family.mjs — edit there and regenerate.
13
+ // ---------------------------------------------------------------------------- shared core
14
+ // Shared core of the environment objects (lab). Inlined verbatim into every generated component.
15
+ //
16
+ // Slice volume: continuous media (dust, rain curtains, funnels) are rendered as N view-aligned
17
+ // slices between the camera and the far side of the volume, drawn back to front in one instanced
18
+ // call. Each slice is a full-screen quad at a fixed view depth, depth-tested against the scene,
19
+ // so objects inside the medium are hidden by exactly the medium in front of them — volume
20
+ // rendering without a depth texture. Slices are spaced geometrically (dense near the eye) and
21
+ // every fragment samples at a per-pixel dithered depth inside its slab, which turns slice
22
+ // banding into fine grain.
23
+ //
24
+ // What a slice volume costs is pixels x slices x the work per sample, so the core keeps all three down:
25
+ // noise vnoise3 is one trilinear fetch from a small 3-D texture holding the very lattice values
26
+ // the hash gave (the smoothstep goes into the coordinate), instead of 8 hashes and 7 mixes.
27
+ // bounds slices cover the volume's box on screen, not the whole screen.
28
+ // density on a dense display (device pixel ratio above 1) neighbouring pixels take turns over the
29
+ // slices (2 or 4 interleaved sets, each sample standing for the slabs it skips), so the
30
+ // samples per CSS pixel — what the eye resolves — stay what they are at ratio 1.
31
+ // reach near layers (streaks, grains, splashes) are not submitted when the camera is too far
32
+ // from the volume to see any of them (layerInReach).
33
+ const WIND_MS_COMMON = 8; // m/s per unit of windStrength (Rain's 0..1 range)
34
+ const DEG_C = Math.PI / 180;
35
+ function mulberry32(a) {
36
+ return function () {
37
+ a |= 0;
38
+ a = (a + 0x6d2b79f5) | 0;
39
+ let t = Math.imul(a ^ (a >>> 15), 1 | a);
40
+ t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
41
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
42
+ };
43
+ }
44
+ // ---------------------------------------------------------------------------- noise texture
45
+ // The lattice of vnoise3 as a texture: NOISE_N^3 values of the same hash the shader used to evaluate,
46
+ // for lattice points -NOISE_N/2 .. NOISE_N/2 - 1 on each axis (beyond that it repeats). One per page,
47
+ // shared by every environment object.
48
+ const NOISE_N = 64;
49
+ let _noiseTex = null;
50
+ function noiseTexture() {
51
+ if (_noiseTex)
52
+ return _noiseTex;
53
+ const N = NOISE_N, H = N / 2, f = Math.fround;
54
+ const fr = (x) => f(x - Math.floor(x));
55
+ const data = new Uint8Array(N * N * N);
56
+ let o = 0;
57
+ for (let z = 0; z < N; z++)
58
+ for (let y = 0; y < N; y++)
59
+ for (let x = 0; x < N; x++) {
60
+ // hash13: p = fract(p * 0.1031); p += dot(p, p.zyx + 31.32); return fract((p.x + p.y) * p.z);
61
+ let px = fr(f((x - H) * f(0.1031))), py = fr(f((y - H) * f(0.1031))), pz = fr(f((z - H) * f(0.1031)));
62
+ const d = f(f(f(px * f(pz + f(31.32))) + f(py * f(py + f(31.32)))) + f(pz * f(px + f(31.32))));
63
+ px = f(px + d);
64
+ py = f(py + d);
65
+ pz = f(pz + d);
66
+ data[o++] = Math.min(255, Math.round(fr(f(f(px + py) * pz)) * 255));
67
+ }
68
+ const tex = new THREE.Data3DTexture(data, N, N, N);
69
+ tex.format = THREE.RedFormat;
70
+ tex.type = THREE.UnsignedByteType;
71
+ tex.minFilter = THREE.LinearFilter;
72
+ tex.magFilter = THREE.LinearFilter;
73
+ tex.wrapS = THREE.RepeatWrapping;
74
+ tex.wrapT = THREE.RepeatWrapping;
75
+ tex.wrapR = THREE.RepeatWrapping;
76
+ tex.unpackAlignment = 1;
77
+ tex.generateMipmaps = false;
78
+ tex.needsUpdate = true;
79
+ _noiseTex = tex;
80
+ return tex;
81
+ }
82
+ function setColor(uniform, v) {
83
+ if (v === undefined || v === null)
84
+ return;
85
+ if (v.isColor)
86
+ uniform.value.copy(v);
87
+ else
88
+ uniform.value.set(v);
89
+ }
90
+ /** Uniforms every environment object has. */
91
+ function createCommonUniforms() {
92
+ return {
93
+ uTime: { value: 0 },
94
+ uWind: { value: new THREE.Vector2() },
95
+ uWindDir: { value: new THREE.Vector2(0, 1) },
96
+ uWindStrength: { value: 0.2 },
97
+ uTurb: { value: 0.3 },
98
+ uTurbPhase: { value: 0 },
99
+ uSpeed: { value: 1 },
100
+ uVolume: { value: new THREE.Vector3(100, 40, 100) },
101
+ uCam: { value: new THREE.Vector3() },
102
+ uCamToLocal: { value: new THREE.Matrix4() },
103
+ uSliceNear: { value: 0.3 },
104
+ uSliceFar: { value: 200 },
105
+ uSliceCount: { value: 32 },
106
+ uSliceRect: { value: new THREE.Vector4(-1.04, -1.04, 1.04, 1.04) },
107
+ uSkip: { value: 1 },
108
+ uSkipMax: { value: 4 },
109
+ uSliceCurve: { value: 0 },
110
+ uNoise: { value: noiseTexture() },
111
+ uFollow: { value: 0 },
112
+ uViewH: { value: 800 },
113
+ uIntensity: { value: 1 },
114
+ uOpacity: { value: 1 },
115
+ uColor: { value: new THREE.Color('#ffffff') },
116
+ uShadeColor: { value: new THREE.Color('#808080') },
117
+ uSunDir: { value: new THREE.Vector3(0.35, 0.42, 0.84).normalize() },
118
+ uSunColor: { value: new THREE.Color(1.0, 0.93, 0.82) },
119
+ uSkyAmbient: { value: new THREE.Color(0.55, 0.65, 0.85) },
120
+ uPointer: { value: new THREE.Vector3() },
121
+ uPointerVel: { value: new THREE.Vector3() },
122
+ uPointerActive: { value: 0 },
123
+ uPointerMode: { value: -1 },
124
+ uPointerStrength: { value: 1 },
125
+ uPointerRadius: { value: 1 },
126
+ uPointerColor: { value: new THREE.Color('#ffffff') },
127
+ };
128
+ }
129
+ /** The base knobs every environment object shares (push point, part 1). */
130
+ function applyCommonConfig(u, c, pointerModes) {
131
+ if (c.intensity !== undefined)
132
+ u.uIntensity.value = c.intensity;
133
+ if (c.speed !== undefined)
134
+ u.uSpeed.value = c.speed;
135
+ if (c.opacity !== undefined)
136
+ u.uOpacity.value = c.opacity;
137
+ setColor(u.uColor, c.color);
138
+ setColor(u.uShadeColor, c.shadeColor);
139
+ setColor(u.uPointerColor, c.pointerColor);
140
+ if (c.windStrength !== undefined)
141
+ u.uWindStrength.value = c.windStrength;
142
+ if (c.windDirection !== undefined)
143
+ u.uWindDir.value.set(Math.sin(c.windDirection * DEG_C), Math.cos(c.windDirection * DEG_C));
144
+ if (c.turbulence !== undefined)
145
+ u.uTurb.value = c.turbulence;
146
+ if (c.pointerStrength !== undefined)
147
+ u.uPointerStrength.value = c.pointerStrength;
148
+ if (c.pointerRadius !== undefined)
149
+ u.uPointerRadius.value = c.pointerRadius;
150
+ if (c.pointerMode !== undefined)
151
+ u.uPointerMode.value = pointerModes.indexOf(c.pointerMode);
152
+ if (c.followCamera !== undefined)
153
+ u.uFollow.value = c.followCamera ? 1 : 0;
154
+ }
155
+ const _cs = new THREE.Vector3(), _cc = new THREE.Vector3(), _cq = new THREE.Quaternion(), _csun = new THREE.Vector3();
156
+ const _cinv = new THREE.Matrix4();
157
+ const _corner = new THREE.Vector3();
158
+ const _cview = new THREE.Matrix4();
159
+ /** Per-frame bookkeeping shared by every object: volume, camera, slice range and bounds, sun, phases. */
160
+ function updateCommon(u, object, camera, dt, viewH, sunWorld, dpr) {
161
+ // the camera may have been moved this frame (controls) without its matrices following yet
162
+ camera.updateMatrixWorld();
163
+ object.updateWorldMatrix(true, false);
164
+ object.getWorldScale(_cs);
165
+ u.uVolume.value.set(Math.max(_cs.x, 0.01), Math.max(_cs.y, 0.01), Math.max(_cs.z, 0.01));
166
+ const V = u.uVolume.value;
167
+ object.worldToLocal(_cc.copy(camera.position));
168
+ u.uCam.value.set(_cc.x * V.x, _cc.y * V.y, _cc.z * V.z);
169
+ _cinv.copy(object.matrixWorld).invert();
170
+ u.uCamToLocal.value.multiplyMatrices(_cinv, camera.matrixWorld);
171
+ if (viewH)
172
+ u.uViewH.value = viewH;
173
+ // slice range: from where the volume starts in front of the eye to its far corner
174
+ const C = u.uCam.value;
175
+ const follow = u.uFollow.value > 0.5;
176
+ const hx = follow ? 1e6 : V.x / 2, hz = follow ? 1e6 : V.z / 2;
177
+ const dx = Math.max(Math.abs(C.x) - hx, 0), dz = Math.max(Math.abs(C.z) - hz, 0);
178
+ const dy = Math.max(-C.y, C.y - V.y, 0);
179
+ const dNear = Math.hypot(dx, dy, dz);
180
+ let dFar = 0;
181
+ for (let i = 0; i < 8; i++) {
182
+ _corner.set((i & 1 ? 1 : -1) * Math.min(hx, 3e3), i & 2 ? V.y : 0, (i & 4 ? 1 : -1) * Math.min(hz, 3e3));
183
+ dFar = Math.max(dFar, _corner.distanceTo(C));
184
+ }
185
+ const far = camera.far !== undefined ? camera.far : 2000;
186
+ u.uSliceNear.value = Math.max(0.3, dNear * 0.6);
187
+ u.uSliceFar.value = Math.max(u.uSliceNear.value * 1.5, Math.min(dFar, 600, far * 0.98));
188
+ // Slice bounds: the volume's box on screen (NDC). Whole screen when the box reaches behind the
189
+ // eye (the camera is inside or right next to it) or follows the camera.
190
+ const R = u.uSliceRect.value.set(-1.04, -1.04, 1.04, 1.04);
191
+ if (!follow && camera.projectionMatrix) {
192
+ _cview.copy(camera.matrixWorld).invert().multiply(object.matrixWorld);
193
+ const P = camera.projectionMatrix.elements, nearZ = camera.near !== undefined ? camera.near : 0.1;
194
+ let x0 = 1e9, y0 = 1e9, x1 = -1e9, y1 = -1e9, ok = true;
195
+ for (let i = 0; i < 8 && ok; i++) {
196
+ _corner.set(i & 1 ? 0.5 : -0.5, i & 2 ? 1 : 0, i & 4 ? 0.5 : -0.5).applyMatrix4(_cview);
197
+ if (_corner.z > -nearZ) {
198
+ ok = false;
199
+ break;
200
+ }
201
+ const w = -_corner.z, x = (P[0] * _corner.x + P[8] * _corner.z) / w, y = (P[5] * _corner.y + P[9] * _corner.z) / w;
202
+ if (x < x0)
203
+ x0 = x;
204
+ if (x > x1)
205
+ x1 = x;
206
+ if (y < y0)
207
+ y0 = y;
208
+ if (y > y1)
209
+ y1 = y;
210
+ }
211
+ // the margin covers the depth dither, which slides a sample along its ray but never off its pixel
212
+ if (ok)
213
+ R.set(Math.max(x0 - 0.03, -1.04), Math.max(y0 - 0.03, -1.04), Math.min(x1 + 0.03, 1.04), Math.min(y1 + 0.03, 1.04));
214
+ if (R.z <= R.x || R.w <= R.y)
215
+ R.set(0, 0, 0, 0); // off screen: nothing to draw
216
+ }
217
+ // Interleaved slices on dense displays: pixels take turns over 2 (ratio >= 1.25) or 4 (>= 1.75) sets.
218
+ // An object caps it (buildSlices' interleave): fine, fast-changing structure like the tornado's funnel
219
+ // loses its crispness when neighbours see different slabs, so it takes every slice.
220
+ u.uSkip.value = Math.min(dpr >= 1.75 ? 4 : dpr >= 1.25 ? 2 : 1, u.uSkipMax.value);
221
+ // phases (rates integrated on the CPU, so animating them never jumps)
222
+ const sp = u.uSpeed.value;
223
+ u.uTime.value += dt * sp;
224
+ u.uWind.value.addScaledVector(u.uWindDir.value, dt * sp * u.uWindStrength.value * WIND_MS_COMMON);
225
+ u.uTurbPhase.value += dt * sp * 0.25;
226
+ if (sunWorld) {
227
+ object.getWorldQuaternion(_cq).invert();
228
+ u.uSunDir.value.copy(_csun.copy(sunWorld).normalize().applyQuaternion(_cq));
229
+ }
230
+ }
231
+ /**
232
+ * True when a layer that only exists inside the volume and within `reach` metres of the eye can show
233
+ * anything: used to skip submitting near layers (thousands of instances, each fully evaluated per
234
+ * vertex) while the camera is away from the volume.
235
+ */
236
+ function layerInReach(u, reach) {
237
+ const C = u.uCam.value, V = u.uVolume.value, follow = u.uFollow.value > 0.5;
238
+ const ox = follow ? 0 : Math.max(Math.abs(C.x) - 0.5 * V.x, 0), oz = follow ? 0 : Math.max(Math.abs(C.z) - 0.5 * V.z, 0);
239
+ const oy = Math.max(-C.y, C.y - V.y, 0);
240
+ return ox * ox + oy * oy + oz * oz < reach * reach;
241
+ }
242
+ // Where the pointer plane passes (object-local unit coords; the plane faces the camera):
243
+ // a few metres ahead of the eye inside the volume, else through the volume centre's depth.
244
+ const _pa = new THREE.Vector3(), _pd = new THREE.Vector3(), _pc = new THREE.Vector3();
245
+ function pointerAnchor(object, camera, u, out, ahead) {
246
+ const V = u.uVolume.value, C = u.uCam.value;
247
+ const inside = Math.abs(C.x) < 0.5 * V.x && Math.abs(C.z) < 0.5 * V.z && C.y > 0 && C.y < V.y;
248
+ camera.getWorldDirection(_pd);
249
+ let dist = ahead || 4.5;
250
+ if (!inside) {
251
+ object.updateWorldMatrix(true, false);
252
+ object.localToWorld(_pc.set(0, 0.5, 0));
253
+ dist = Math.max(dist, _pc.sub(camera.position).dot(_pd));
254
+ }
255
+ _pa.copy(camera.position).addScaledVector(_pd, dist);
256
+ return object.worldToLocal(out.copy(_pa));
257
+ }
258
+ const NOISE_GLSL = /* glsl */ `
259
+ uniform highp sampler3D uNoise;
260
+ float hash13(vec3 p) { p = fract(p * 0.1031); p += dot(p, p.zyx + 31.32); return fract((p.x + p.y) * p.z); }
261
+ float hash12(vec2 p) { vec3 q = fract(vec3(p.xyx) * 0.1031); q += dot(q, q.yzx + 33.33); return fract((q.x + q.y) * q.z); }
262
+ // value noise from the lattice texture: the smoothstep is put into the coordinate, the trilinear
263
+ // filter does the eight-corner mix (same lattice values as hash13 around the origin)
264
+ float vnoise3(vec3 p) {
265
+ vec3 i = floor(p); vec3 f = fract(p); f = f * f * (3.0 - 2.0 * f);
266
+ return texture(uNoise, (i + f + ${(0.5 + NOISE_N / 2).toFixed(1)}) / ${NOISE_N.toFixed(1)}).r;
267
+ }
268
+ float vnoise2(vec2 p) {
269
+ vec2 i = floor(p); vec2 f = fract(p); f = f * f * (3.0 - 2.0 * f);
270
+ return mix(mix(hash12(i), hash12(i + vec2(1, 0)), f.x), mix(hash12(i + vec2(0, 1)), hash12(i + vec2(1, 1)), f.x), f.y);
271
+ }
272
+ // three octaves, rotated between octaves so the lattice never lines up
273
+ float fbm3(vec3 p) {
274
+ float s = 0.5 * vnoise3(p);
275
+ p = mat3(0.00, 0.80, 0.60, -0.80, 0.36, -0.48, -0.60, -0.48, 0.64) * p * 2.03;
276
+ s += 0.25 * vnoise3(p);
277
+ p = mat3(0.00, 0.80, 0.60, -0.80, 0.36, -0.48, -0.60, -0.48, 0.64) * p * 2.01;
278
+ s += 0.125 * vnoise3(p);
279
+ return s / 0.875;
280
+ }
281
+ float bump(float x) { float t = clamp(1.0 - x * x, 0.0, 1.0); return t * t; }
282
+ float hgPhase(float mu, float g) { return 0.0795775 * (1.0 - g * g) / pow(1.0 + g * g - 2.0 * g * mu, 1.5); }
283
+ float ign(vec2 px) { return fract(52.9829189 * fract(dot(px, vec2(0.06711056, 0.00583715)))); }
284
+ `;
285
+ const COMMON_UNIFORMS_GLSL = /* glsl */ `
286
+ uniform float uTime, uWindStrength, uTurb, uTurbPhase, uSpeed, uFollow, uViewH;
287
+ uniform vec2 uWind, uWindDir;
288
+ uniform vec3 uVolume, uCam;
289
+ uniform vec3 uSunDir, uSunColor, uSkyAmbient, uColor, uShadeColor, uPointerColor;
290
+ uniform float uIntensity, uOpacity;
291
+ uniform vec3 uPointer, uPointerVel;
292
+ uniform float uPointerActive, uPointerMode, uPointerStrength, uPointerRadius;
293
+ `;
294
+ const FOG_V = /* glsl */ `
295
+ #ifdef USE_FOG
296
+ varying float vFogDepth;
297
+ #endif
298
+ `;
299
+ const FOG_F = /* glsl */ `
300
+ #ifdef USE_FOG
301
+ uniform vec3 fogColor;
302
+ varying float vFogDepth;
303
+ #ifdef FOG_EXP2
304
+ uniform float fogDensity;
305
+ #else
306
+ uniform float fogNear;
307
+ uniform float fogFar;
308
+ #endif
309
+ #endif
310
+ `;
311
+ const FOG_APPLY = /* glsl */ `
312
+ #ifdef USE_FOG
313
+ #ifdef FOG_EXP2
314
+ float fogFactor = 1.0 - exp(-fogDensity * fogDensity * vFogDepth * vFogDepth);
315
+ #else
316
+ float fogFactor = smoothstep(fogNear, fogFar, vFogDepth);
317
+ #endif
318
+ gl_FragColor.rgb = mix(gl_FragColor.rgb, fogColor * gl_FragColor.a, fogFactor);
319
+ #endif
320
+ `;
321
+ /** Soft walls of the volume (metres); the ground is hard. */
322
+ const VOLUME_GLSL = /* glsl */ `
323
+ float volumeFade(vec3 p, float side, float top) {
324
+ float a = step(0.0, p.y) * (1.0 - smoothstep(uVolume.y - top, uVolume.y, p.y));
325
+ if (uFollow < 0.5) {
326
+ vec2 e = 0.5 * uVolume.xz - abs(p.xz);
327
+ a *= smoothstep(0.0, side, e.x) * smoothstep(0.0, side, e.y);
328
+ }
329
+ return a;
330
+ }
331
+ `;
332
+ const SLICE_VERT = /* glsl */ `
333
+ ${COMMON_UNIFORMS_GLSL}
334
+ uniform float uSliceNear, uSliceFar, uSliceCount, uSliceCurve;
335
+ uniform vec4 uSliceRect;
336
+ uniform mat4 uCamToLocal;
337
+ attribute vec2 aCorner;
338
+ attribute float aSlice;
339
+ varying vec3 vLocal;
340
+ varying vec3 vRay;
341
+ varying float vDz, vSlice;
342
+ ${FOG_V}
343
+ void main() {
344
+ // slice 0 is the farthest: instances draw back to front
345
+ float k = log(uSliceFar / uSliceNear);
346
+ float t0 = 1.0 - (aSlice + 1.0) / uSliceCount;
347
+ float t1 = 1.0 - aSlice / uSliceCount;
348
+ // legacy spacing is geometric; even (quadratic) spacing spends far fewer slabs on the first metres
349
+ float z0 = uSliceCurve > 0.5 ? uSliceNear + (uSliceFar - uSliceNear) * t0 * t0 : uSliceNear * exp(k * t0);
350
+ float z1 = uSliceCurve > 0.5 ? uSliceNear + (uSliceFar - uSliceNear) * t1 * t1 : uSliceNear * exp(k * t1);
351
+ float z = 0.5 * (z0 + z1);
352
+ vDz = z1 - z0;
353
+ // the quad spans the volume's bounds on screen (NDC), not the screen
354
+ vec2 ndc = mix(uSliceRect.xy, uSliceRect.zw, aCorner * 0.5 + 0.5);
355
+ vec3 view = vec3((ndc.x + projectionMatrix[2][0]) * z / projectionMatrix[0][0], (ndc.y + projectionMatrix[2][1]) * z / projectionMatrix[1][1], -z);
356
+ vSlice = aSlice;
357
+ gl_Position = projectionMatrix * vec4(view, 1.0);
358
+ vLocal = (uCamToLocal * vec4(view, 1.0)).xyz * uVolume;
359
+ vRay = vLocal - uCam;
360
+ #ifdef USE_FOG
361
+ vFogDepth = z;
362
+ #endif
363
+ }
364
+ `;
365
+ /**
366
+ * Wraps an object's `vec4 sliceSample(vec3 p, vec3 rd, float dz)` (premultiplied rgb, alpha).
367
+ *
368
+ * The canvas stores display (non-linear) values. By default the premultiplied colour goes through
369
+ * the output transform as it is, which makes a thin layer brighter than its share: the look then
370
+ * depends on how thin the slabs are (the first objects were tuned by eye under it — leave them).
371
+ * `straight` converts the colour first and weights it by alpha after, so a medium looks the same
372
+ * at every slice count, density and quality; new objects use it.
373
+ */
374
+ function sliceFrag(body, straight) {
375
+ return /* glsl */ `
376
+ ${COMMON_UNIFORMS_GLSL}
377
+ uniform float uSkip;
378
+ varying vec3 vLocal;
379
+ varying vec3 vRay;
380
+ varying float vDz, vSlice;
381
+ ${FOG_F}
382
+ ${NOISE_GLSL}
383
+ ${VOLUME_GLSL}
384
+ ${body}
385
+ void main() {
386
+ // dense displays: neighbouring pixels take turns over the slices (see updateCommon)
387
+ if (uSkip > 1.5) {
388
+ vec2 px = mod(floor(gl_FragCoord.xy), 2.0);
389
+ float turn = uSkip > 3.0 ? mod(px.x * 2.0 + px.y * 3.0, 4.0) : mod(px.x + px.y, 2.0);
390
+ if (mod(vSlice + turn, uSkip) > 0.5) discard;
391
+ }
392
+ vec3 rd = normalize(vRay);
393
+ // dithered depth inside the slab: banding becomes grain
394
+ vec3 p = vLocal + rd * (ign(gl_FragCoord.xy) - 0.5) * 0.6 * vDz;
395
+ if (p.y < 0.0 || p.y > uVolume.y) discard;
396
+ if (uFollow < 0.5 && (abs(p.x) > 0.5 * uVolume.x || abs(p.z) > 0.5 * uVolume.z)) discard;
397
+ vec4 s = sliceSample(p, rd, vDz);
398
+ s *= uOpacity;
399
+ if (s.a < 0.0015 && dot(s.rgb, vec3(1.0)) < 0.002) discard;
400
+ gl_FragColor = ${straight ? 'vec4(s.rgb / max(s.a, 1e-5) * uIntensity, 1.0)' : 'vec4(s.rgb * uIntensity, s.a)'};
401
+ #include <tonemapping_fragment>
402
+ #include <colorspace_fragment>${straight ? '\n gl_FragColor = vec4(gl_FragColor.rgb * s.a, s.a);' : ''}
403
+ ${FOG_APPLY}
404
+ // A pixel that skipped slabs stands for them: it lays down what 2 or 4 copies of its own thin
405
+ // layer would have composited to (colour c (1 + t + ...), transmittance t^n), so the volume
406
+ // keeps exactly the brightness and opacity it has when every pixel takes every slice.
407
+ if (uSkip > 1.5) {
408
+ float t = 1.0 - gl_FragColor.a;
409
+ float t2 = t * t;
410
+ gl_FragColor = uSkip > 3.0 ? vec4(gl_FragColor.rgb * (1.0 + t) * (1.0 + t2), 1.0 - t2 * t2) : vec4(gl_FragColor.rgb * (1.0 + t), 1.0 - t2);
411
+ }
412
+ }
413
+ `;
414
+ }
415
+ function premulMaterial(u, vertexShader, fragmentShader, additive) {
416
+ return new THREE.ShaderMaterial({
417
+ uniforms: Object.assign({}, THREE.UniformsUtils.clone(THREE.UniformsLib.fog), u),
418
+ vertexShader, fragmentShader,
419
+ transparent: true, depthWrite: false, fog: true,
420
+ blending: THREE.CustomBlending,
421
+ blendSrc: THREE.OneFactor, blendDst: additive ? THREE.OneFactor : THREE.OneMinusSrcAlphaFactor,
422
+ blendSrcAlpha: THREE.OneFactor, blendDstAlpha: THREE.OneMinusSrcAlphaFactor,
423
+ premultipliedAlpha: true,
424
+ });
425
+ }
426
+ /** Bounds-only `position`: the unit volume box, so Box3.expandByObject centres the gizmo on it. */
427
+ function boxPositions(geo) {
428
+ geo.setAttribute('position', new THREE.Float32BufferAttribute([-0.5, 0, -0.5, 0.5, 0, 0.5, 0.5, 1, -0.5, -0.5, 1, 0.5], 3));
429
+ geo.boundingSphere = new THREE.Sphere(new THREE.Vector3(0, 0.5, 0), 0.87);
430
+ }
431
+ /**
432
+ * One instanced draw of `count` view-aligned slices. `interleave` (1, 2 or 4, default 4) is the most
433
+ * sets of slices neighbouring pixels may take turns over on a dense display; 1 = every pixel, every slice.
434
+ */
435
+ function buildSlices(u, fragmentShader, count, interleave, curve) {
436
+ const geo = new THREE.InstancedBufferGeometry();
437
+ boxPositions(geo);
438
+ geo.setAttribute('aCorner', new THREE.Float32BufferAttribute([-1, -1, 1, -1, 1, 1, -1, 1], 2));
439
+ geo.setIndex([0, 1, 2, 0, 2, 3]);
440
+ const idx = new Float32Array(count);
441
+ for (let i = 0; i < count; i++)
442
+ idx[i] = i;
443
+ geo.setAttribute('aSlice', new THREE.InstancedBufferAttribute(idx, 1));
444
+ geo.instanceCount = count;
445
+ u.uSliceCount.value = count;
446
+ u.uSkipMax.value = interleave || 1;
447
+ u.uSliceCurve.value = curve ? 1 : 0;
448
+ const mat = premulMaterial(u, SLICE_VERT, fragmentShader, false);
449
+ const mesh = new THREE.Mesh(geo, mat);
450
+ mesh.frustumCulled = false;
451
+ mesh.raycast = function () { };
452
+ return mesh;
453
+ }
454
+ /**
455
+ * Slice budget by where the eye is (even-spaced volumes only; call after updateCommon). Inside the
456
+ * volume the medium fills the screen and half the slabs give the same picture, because even spacing
457
+ * no longer spends a third of them on the first three metres; seen from outside, thinner slabs are
458
+ * what keeps its brightness, and it covers few pixels, so it takes them all. The count eases between
459
+ * the two over the first stretch outside the wall.
460
+ */
461
+ function adaptSlices(u, mesh, full) {
462
+ const C = u.uCam.value, V = u.uVolume.value, follow = u.uFollow.value > 0.5;
463
+ const ox = follow ? 0 : Math.max(Math.abs(C.x) - 0.5 * V.x, 0), oz = follow ? 0 : Math.max(Math.abs(C.z) - 0.5 * V.z, 0);
464
+ const d = Math.hypot(ox, Math.max(-C.y, C.y - V.y, 0), oz);
465
+ const t = Math.min(d / Math.max(0.25 * Math.min(V.x, V.z), 1), 1);
466
+ const n = Math.max(4, Math.round(full * (0.5 + 0.5 * t * t * (3 - 2 * t))));
467
+ mesh.geometry.instanceCount = n;
468
+ u.uSliceCount.value = n;
469
+ }
470
+ /** Instanced quad geometry with per-instance seeds (two vec4s). */
471
+ function seededQuads(count, rnd) {
472
+ const geo = new THREE.InstancedBufferGeometry();
473
+ boxPositions(geo);
474
+ geo.setAttribute('aCorner', new THREE.Float32BufferAttribute([-1, -1, 1, -1, 1, 1, -1, 1], 2));
475
+ geo.setIndex([0, 1, 2, 0, 2, 3]);
476
+ const a = new Float32Array(count * 4), b = new Float32Array(count * 4);
477
+ for (let i = 0; i < count * 4; i++) {
478
+ a[i] = rnd();
479
+ b[i] = rnd();
480
+ }
481
+ geo.setAttribute('aSeedA', new THREE.InstancedBufferAttribute(a, 4));
482
+ geo.setAttribute('aSeedB', new THREE.InstancedBufferAttribute(b, 4));
483
+ geo.instanceCount = count;
484
+ return geo;
485
+ }
486
+ /** A streak quad between two view-space points, at least 1 px wide (energy kept by alpha). */
487
+ const STREAK_GLSL = /* glsl */ `
488
+ // returns the clip position of this corner; writes the coverage factor into cover
489
+ vec4 streakCorner(vec4 headV, vec4 tailV, vec2 corner, float widthM, out float cover, out float lenPx) {
490
+ vec4 h = projectionMatrix * headV;
491
+ vec4 t = projectionMatrix * tailV;
492
+ vec2 hs = h.xy / h.w, ts = t.xy / t.w;
493
+ vec2 scr = vec2(uViewH * projectionMatrix[1][1] / projectionMatrix[0][0], uViewH) * 0.5;
494
+ vec2 d = (hs - ts) * scr;
495
+ lenPx = length(d);
496
+ vec2 dir = lenPx > 1e-4 ? d / lenPx : vec2(0.0, 1.0);
497
+ vec2 nrm = vec2(dir.y, -dir.x); // (nrm, dir) right-handed: the quad stays front-facing
498
+ float wPx = widthM * uViewH * projectionMatrix[1][1] * 0.5 / max(-headV.z, 1e-3);
499
+ float w = max(wPx, 1.0);
500
+ cover = wPx / w;
501
+ vec4 base = corner.y > 0.0 ? h : t;
502
+ vec2 off = nrm * corner.x * 0.5 * w / scr;
503
+ // extend half a pixel past both ends so short streaks stay round
504
+ off += dir * corner.y * 0.5 / scr;
505
+ return vec4(base.xy + off * base.w, base.zw);
506
+ }
507
+ `;
508
+ // ---------------------------------------------------------------------------- sandstorm
509
+ // Sandstorm — environment object (lab module). Shared core: ./common.mjs.
510
+ // Construction:
511
+ // dust a continuous medium in the slice volume. Density = haze + billows, under an
512
+ // exponential height profile (scale height knob). The billows are 3-octave fbm,
513
+ // domain-warped and advected with the CPU-integrated wind; they churn upward.
514
+ // walls gust fronts (haboobs): a sawtooth in the along-wind coordinate, travelling
515
+ // downwind at the wind speed. Each period has a steep leading wall that rises
516
+ // higher (the scale height grows behind the front) and a long settling tail;
517
+ // the fbm breaks the wall into cauliflower lobes.
518
+ // light single scattering with a Henyey–Greenstein forward lobe (g = 0.6) and a
519
+ // column-depth shadow toward the sun (Beer–Lambert on the analytic profile),
520
+ // sky fill on the shaded side. The dust colour is the albedo, so thick dust
521
+ // tints everything behind it (brownout).
522
+ // grains saltation: sand grains hop in ballistic arcs a few centimetres high, length
523
+ // ~ wind speed, drawn as motion-blurred streaks in a camera tile near the ground.
524
+ const catalog = {
525
+ key: 'sandstorm',
526
+ name: 'Sandstorm',
527
+ description: 'A haboob: billowing dust under a scale-height profile, gust fronts that roll downwind as towering walls, and saltating grains streaking along the ground, lit by forward-scattered sun. The cursor is a windbreak, a dust devil or a gust. Use for desert, ash and Mars scenes.',
528
+ tags: ['sandstorm', 'desert', 'dust', 'haboob', 'weather', 'wind'],
529
+ structural: ['density', 'quality', 'seed'],
530
+ pointerModes: ['windbreak', 'devil', 'gust'],
531
+ pointerLabels: ['Windbreak', 'Dust devil', 'Gust'],
532
+ volume: [150, 50, 150],
533
+ staging: { sky: '#9a8a78', ground: '#a8865e', fog: 0.0022, sunEl: 30, sunAz: 150, inside: [[0, 1.7, 14], [0, 4, 0]], outside: [[95, 22, 150], [0, 12, 0]] },
534
+ };
535
+ const QUALITY = { low: { slices: 20, grains: 0.5 }, medium: { slices: 32, grains: 1 }, high: { slices: 48, grains: 1.6 } };
536
+ const GRAIN_BASE = 24000;
537
+ const GRAIN_TILE = 14;
538
+ function createUniforms() {
539
+ return Object.assign(createCommonUniforms(), {
540
+ uSigma: { value: 0.035 },
541
+ uHeight: { value: 0.35 },
542
+ uWalls: { value: 0.75 },
543
+ uHaze: { value: 0.4 },
544
+ uGrains: { value: 1 },
545
+ uGrainSize: { value: 1 },
546
+ uWallPhase: { value: 0 },
547
+ uGrainPhase: { value: 0 },
548
+ });
549
+ }
550
+ function applyConfig(u, c) {
551
+ applyCommonConfig(u, c, catalog.pointerModes);
552
+ if (c.height !== undefined)
553
+ u.uHeight.value = c.height;
554
+ if (c.walls !== undefined)
555
+ u.uWalls.value = c.walls;
556
+ if (c.haze !== undefined)
557
+ u.uHaze.value = c.haze;
558
+ if (c.grains !== undefined)
559
+ u.uGrains.value = c.grains;
560
+ if (c.grainSize !== undefined)
561
+ u.uGrainSize.value = c.grainSize;
562
+ }
563
+ const DUST = /* glsl */ `
564
+ uniform float uSigma, uHeight, uWalls, uHaze, uWallPhase;
565
+ // pointer: the windbreak's lee, the dust devil's swirl and column, or the gust's shove
566
+ vec3 pointerWarp(vec3 p, out float lee, out float devil) {
567
+ lee = 0.0; devil = 0.0;
568
+ if (uPointerMode < -0.5 || uPointerActive < 0.001) return p;
569
+ vec3 P = uPointer * uVolume, V = uPointerVel * uVolume;
570
+ float R = max(uPointerRadius * 3.0, 0.1), S = uPointerStrength * uPointerActive;
571
+ vec3 dp = p - P;
572
+ if (uPointerMode < 0.5) {
573
+ // windbreak: a still wake downwind of the cursor, widening and filling back in
574
+ vec3 C = P - V * 0.3;
575
+ vec2 d = p.xz - C.xz;
576
+ float along = dot(d, uWindDir), across = dot(d, vec2(-uWindDir.y, uWindDir.x));
577
+ float w = R * (1.0 + 0.15 * max(along, 0.0));
578
+ lee = S * bump(across / w) * smoothstep(-0.5 * R, 0.5 * R, along) * exp(-max(along, 0.0) / (10.0 * R)) * smoothstep(3.0 * R, 0.0, p.y - C.y + 1.0);
579
+ return p;
580
+ } else if (uPointerMode < 1.5) {
581
+ // dust devil: a vortex standing on the ground under the cursor, leaning with its motion
582
+ vec2 c = P.xz - V.xz * 0.4 * clamp(p.y / (8.0 * R), 0.0, 1.0);
583
+ vec2 d = p.xz - c; float r = length(d);
584
+ float ang = S * 6.0 * R / (r + 0.6 * R) * exp(-p.y / (10.0 * R)) - uTime * 2.0 * S * bump(r / (3.0 * R));
585
+ float cs = cos(ang), sn = sin(ang);
586
+ vec2 q = vec2(cs * d.x - sn * d.y, sn * d.x + cs * d.y);
587
+ devil = S * bump(r / (1.2 * R)) * exp(-p.y / (8.0 * R));
588
+ return vec3(c.x + q.x, p.y, c.y + q.y);
589
+ }
590
+ // gust: the hand's air shoves the dust along its motion
591
+ float w = bump(length(dp) / (1.5 * R));
592
+ vec3 push = V * 0.5; float m = length(push); if (m > 8.0) push *= 8.0 / m;
593
+ return p - S * w * push;
594
+ }
595
+ // dust density at p (1/m units folded into uSigma); g = how deep inside a wall
596
+ float dust(vec3 p, out float g, out float devil) {
597
+ float lee;
598
+ vec3 pw = pointerWarp(p, lee, devil);
599
+ vec3 q = pw; q.xz -= uWind;
600
+ float w = vnoise3(q * 0.018 + vec3(0.0, -uTurbPhase * 0.4, 0.0));
601
+ q.xz += (w - 0.5) * uTurb * 28.0;
602
+ float n = fbm3(q * vec3(0.045, 0.07, 0.045) + vec3(0.0, -uTime * 0.12, 0.0));
603
+ // gust fronts: steep leading wall, long tail, travelling downwind
604
+ float s = dot(pw.xz, uWindDir) / 90.0 - uWallPhase + 0.3 * (w - 0.5);
605
+ float f = fract(s);
606
+ g = pow(f, 2.2) * (1.0 - smoothstep(0.93, 1.0, f));
607
+ float hs = max(uHeight * uVolume.y, 0.5) * (0.55 + 1.6 * g * uWalls);
608
+ float prof = exp(-pw.y / hs);
609
+ float body = smoothstep(0.42, 0.7, n + 0.3 * g * uWalls);
610
+ float d = prof * (uHaze * 0.45 + body * mix(1.0, 0.25 + 2.4 * g, uWalls));
611
+ d += devil * 12.0 * smoothstep(0.25, 0.7, n + 0.25);
612
+ return d * (1.0 - lee);
613
+ }
614
+ vec4 sliceSample(vec3 p, vec3 rd, float dz) {
615
+ float g, devil;
616
+ float d = dust(p, g, devil) * volumeFade(p, min(10.0, 0.08 * uVolume.x), min(6.0, 0.12 * uVolume.y));
617
+ if (d < 0.002) return vec4(0.0);
618
+ float a = 1.0 - exp(-uSigma * d * dz);
619
+ // self-shadow: one look a few metres toward the sun (lit billow tops, dark undersides),
620
+ // then Beer–Lambert on the analytic column above
621
+ vec3 ps = p + uSunDir * 6.0; ps.xz -= uWind;
622
+ float dS = d * smoothstep(0.3, 0.75, vnoise3(ps * vec3(0.045, 0.07, 0.045) + vec3(0.0, -uTime * 0.12, 0.0)) + 0.15);
623
+ float hs = max(uHeight * uVolume.y, 0.5);
624
+ float tau = uSigma * (dS * 30.0 + d * hs * 1.2 / max(uSunDir.y, 0.15));
625
+ float sunUp = smoothstep(-0.05, 0.1, uSunDir.y);
626
+ float mu = dot(rd, uSunDir);
627
+ float phase = hgPhase(mu, 0.6) * 1.2 + 0.25;
628
+ vec3 sun = uSunColor * sunUp * exp(-tau) * phase;
629
+ vec3 amb = uSkyAmbient * uShadeColor * (0.45 + 0.4 * exp(-uSigma * d * 25.0));
630
+ vec3 col = uColor * (sun + amb) + uPointerColor * devil * 0.2 * sun;
631
+ return vec4(min(col, vec3(1.0)) * a, a);
632
+ }
633
+ `;
634
+ const GRAIN_VERT = /* glsl */ `
635
+ ${COMMON_UNIFORMS_GLSL}
636
+ uniform float uGrains, uGrainSize, uGrainPhase;
637
+ attribute vec2 aCorner;
638
+ attribute vec4 aSeedA;
639
+ attribute vec4 aSeedB;
640
+ varying float vAlpha;
641
+ varying vec2 vUv;
642
+ varying vec3 vRd;
643
+ ${FOG_V}
644
+ ${NOISE_GLSL}
645
+ ${VOLUME_GLSL}
646
+ ${STREAK_GLSL}
647
+ void main() {
648
+ float on = step(aSeedB.w, uGrains * 0.5);
649
+ float windMs = uWindStrength * 8.0;
650
+ float hopL = mix(0.3, 2.2, aSeedA.w) * mix(0.6, 1.4, uGrainSize) * (0.4 + 0.15 * windMs);
651
+ float hopH = hopL * mix(0.06, 0.14, aSeedB.x);
652
+ float sp = windMs * mix(0.45, 0.75, aSeedB.y);
653
+ // along-wind travel is integrated on the CPU (uGrainPhase = wind distance), so gusts never jump
654
+ float travel = uGrainPhase * mix(0.45, 0.75, aSeedB.y) / 0.6;
655
+ vec2 perp = vec2(-uWindDir.y, uWindDir.x);
656
+ vec2 base = (aSeedA.xz - 0.5) * ${GRAIN_TILE.toFixed(1)};
657
+ vec2 xz = uWindDir * (dot(base, uWindDir) + travel) + perp * dot(base, perp);
658
+ xz = uCam.xz + mod(xz - uCam.xz + ${(GRAIN_TILE / 2).toFixed(1)}, ${GRAIN_TILE.toFixed(1)}) - ${(GRAIN_TILE / 2).toFixed(1)};
659
+ float f = fract(travel / max(hopL, 0.05) + aSeedB.z);
660
+ float y = hopH * 4.0 * f * (1.0 - f) + 0.01;
661
+ vec3 p = vec3(xz.x, y, xz.y);
662
+ float vy = hopH * 4.0 * (1.0 - 2.0 * f) * sp / max(hopL, 0.05);
663
+ vec3 vel = vec3(uWindDir.x * sp, vy, uWindDir.y * sp);
664
+ vec3 tail = p - vel * 0.035;
665
+ vec4 hv = modelViewMatrix * vec4(p / uVolume, 1.0);
666
+ vec4 tv = modelViewMatrix * vec4(tail / uVolume, 1.0);
667
+ float cover, lenPx;
668
+ gl_Position = streakCorner(hv, tv, aCorner, 0.0012 * uGrainSize * mix(0.6, 1.4, aSeedA.y), cover, lenPx);
669
+ float dist = length(p - uCam);
670
+ float a = on * cover * volumeFade(p, 2.0, 1.0) * (1.0 - smoothstep(0.32 * ${GRAIN_TILE.toFixed(1)}, 0.5 * ${GRAIN_TILE.toFixed(1)}, dist));
671
+ a *= smoothstep(0.08, 0.25, uWindStrength) * smoothstep(0.15, 0.5, -hv.z);
672
+ a /= max(1.0, lenPx * 0.08);
673
+ vAlpha = a * 0.9;
674
+ vUv = aCorner;
675
+ vRd = normalize(p - uCam);
676
+ #ifdef USE_FOG
677
+ vFogDepth = -hv.z;
678
+ #endif
679
+ }
680
+ `;
681
+ const GRAIN_FRAG = /* glsl */ `
682
+ ${COMMON_UNIFORMS_GLSL}
683
+ varying float vAlpha;
684
+ varying vec2 vUv;
685
+ varying vec3 vRd;
686
+ ${FOG_F}
687
+ void main() {
688
+ float across = 1.0 - abs(vUv.x);
689
+ float along = smoothstep(-1.0, -0.4, vUv.y) * smoothstep(1.0, 0.6, vUv.y);
690
+ float a = vAlpha * across * along * uOpacity;
691
+ if (a < 0.003) discard;
692
+ float sunUp = smoothstep(-0.05, 0.1, uSunDir.y);
693
+ // quartz grains glint toward the sun
694
+ vec3 col = uColor * (uSunColor * sunUp * (0.8 + 1.2 * pow(max(dot(vRd, uSunDir), 0.0), 6.0)) + uSkyAmbient * 0.5);
695
+ gl_FragColor = vec4(min(col, vec3(1.2)) * uIntensity * a, a);
696
+ #include <tonemapping_fragment>
697
+ #include <colorspace_fragment>
698
+ ${FOG_APPLY}
699
+ }
700
+ `;
701
+ function build(u, c) {
702
+ const q = QUALITY[c.quality] || QUALITY.medium;
703
+ const dens = Math.max(0.05, c.density ?? 1);
704
+ u.uSigma.value = 0.014 * dens;
705
+ const rnd = mulberry32((c.seed ?? 11) * 2654435761);
706
+ const slices = buildSlices(u, sliceFrag(DUST, false), q.slices, 1, true);
707
+ slices.renderOrder = 1;
708
+ const nGrains = Math.round(GRAIN_BASE * q.grains);
709
+ const grainGeo = seededQuads(nGrains, rnd);
710
+ const grainMat = premulMaterial(u, GRAIN_VERT, GRAIN_FRAG, false);
711
+ const grains = new THREE.Mesh(grainGeo, grainMat);
712
+ grains.frustumCulled = false;
713
+ grains.renderOrder = 2;
714
+ grains.raycast = function () { };
715
+ const object = new THREE.Group();
716
+ object.name = 'sandstorm';
717
+ object.add(slices, grains);
718
+ return {
719
+ object,
720
+ materials: [slices.material, grainMat],
721
+ apply: function (cfg) { applyConfig(u, cfg); },
722
+ update: function (dt, camera, viewH, sunWorld, dpr) {
723
+ updateCommon(u, object, camera, dt, viewH, sunWorld, dpr);
724
+ adaptSlices(u, slices, q.slices);
725
+ // the hopping grains live within half a tile of the eye, inside the volume
726
+ grains.visible = layerInReach(u, GRAIN_TILE / 2);
727
+ const windMs = u.uWindStrength.value * 8;
728
+ u.uWallPhase.value += dt * u.uSpeed.value * (0.4 + windMs) / 90;
729
+ u.uGrainPhase.value += dt * u.uSpeed.value * windMs * 0.6;
730
+ },
731
+ dispose: function () { slices.geometry.dispose(); slices.material.dispose(); grainGeo.dispose(); grainMat.dispose(); },
732
+ };
733
+ }
734
+ // =============================================================================
735
+ // Component
736
+ // =============================================================================
737
+ const DEFAULTS = DEFAULT_ENVIRONMENT_OBJECTS.sandstorm;
738
+ /** Knobs that rebuild the object: never live, they change once, on commit. */
739
+ const STRUCTURAL = ['density', 'quality', 'seed'];
740
+ /** Knobs a keyframe or pointer binding may drive per frame — exactly what applyConfig pushes. */
741
+ const ANIMATABLE = new Set(ENVIRONMENT_OBJECTS_ANIMATABLE.sandstorm.map((p) => p.value));
742
+ /** The scene's sky fill is brighter than the medium's own ambient term expects. */
743
+ const SKY_FILL = 0.5;
744
+ /**
745
+ * A haboob: billowing dust under a scale-height profile, gust fronts that roll downwind as towering walls, and saltating grains streaking along the ground, lit by forward-scattered sun. The cursor is a windbreak, a dust devil or a gust. Use for desert, ash and Mars scenes.
746
+ *
747
+ * The volume is the parent's transform: x / z span its scale, y rises from its origin to scale.y.
748
+ */
749
+ const Sandstorm = ({ config, id, keyframes, mouseMove, onObjectReady, onObjectDispose }) => {
750
+ const rootRef = useRef(null);
751
+ useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
752
+ const cfg = useMemo(() => withConfigDefaults(DEFAULTS, config), [config]);
753
+ // uniforms outlive rebuilds, so phases and keyframes survive a structural change
754
+ const uniforms = useMemo(() => createUniforms(), []);
755
+ const instance = useMemo(() => build(uniforms, cfg), [uniforms, cfg.density, cfg.quality, cfg.seed]); // eslint-disable-line react-hooks/exhaustive-deps
756
+ useEffect(() => () => instance.dispose(), [instance]);
757
+ useLayoutEffect(() => { applyConfig(uniforms, cfg); }, [uniforms, cfg]);
758
+ const push = useCallback((merged) => { applyConfig(uniforms, merged); }, [uniforms]);
759
+ useConfigDriver({ rootRef, id, family: 'environment', base: cfg, structural: STRUCTURAL, allowed: ANIMATABLE, keyframes, mouseMove, push });
760
+ const pointer = usePointerField();
761
+ // the scene's sun, read-only: the same one the clouds, the water and the key light use
762
+ const sun = useCloudSun();
763
+ const anchor = useMemo(() => new THREE.Vector3(), []);
764
+ const buffer = useMemo(() => new THREE.Vector2(), []);
765
+ useFrame((state, delta) => {
766
+ const dt = Math.min(delta, 0.1);
767
+ const s = sun.update();
768
+ uniforms.uSunColor.value.copy(s.color);
769
+ uniforms.uSkyAmbient.value.copy(s.skyAmbient).multiplyScalar(SKY_FILL);
770
+ state.gl.getDrawingBufferSize(buffer);
771
+ instance.update(dt, state.camera, buffer.y, s.direction, state.viewport.dpr);
772
+ stepPointerField(uniforms, pointer, state.camera, instance.object, 1, dt, pointerAnchor(instance.object, state.camera, uniforms, anchor, 4.5));
773
+ });
774
+ return (_jsx("group", { ref: rootRef, children: _jsx("primitive", { object: instance.object }) }));
775
+ };
776
+ export default Sandstorm;