@3driseai/3drise-viewer 0.1.28 → 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 (684) 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 +1 -1
  26. package/dist/components/ApollonianGrid.d.ts.map +1 -1
  27. package/dist/components/ApollonianGrid.js +3 -28
  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 +1 -1
  35. package/dist/components/ConformalGrid.d.ts.map +1 -1
  36. package/dist/components/ConformalGrid.js +3 -34
  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/HexGrid.d.ts +1 -5
  58. package/dist/components/HexGrid.d.ts.map +1 -1
  59. package/dist/components/HexGrid.js +6 -36
  60. package/dist/components/HilbertGrid.d.ts +1 -1
  61. package/dist/components/HilbertGrid.d.ts.map +1 -1
  62. package/dist/components/HilbertGrid.js +3 -30
  63. package/dist/components/HyperbolicGrid.d.ts +1 -1
  64. package/dist/components/HyperbolicGrid.d.ts.map +1 -1
  65. package/dist/components/HyperbolicGrid.js +6 -34
  66. package/dist/components/LandObject.d.ts +9 -0
  67. package/dist/components/LandObject.d.ts.map +1 -0
  68. package/dist/components/LandObject.js +15 -0
  69. package/dist/components/LensingGrid.d.ts +1 -1
  70. package/dist/components/LensingGrid.d.ts.map +1 -1
  71. package/dist/components/LensingGrid.js +3 -29
  72. package/dist/components/LightsManager.d.ts.map +1 -1
  73. package/dist/components/LightsManager.js +8 -0
  74. package/dist/components/ModelBoundary.d.ts +2 -0
  75. package/dist/components/ModelBoundary.d.ts.map +1 -1
  76. package/dist/components/ModelBoundary.js +3 -0
  77. package/dist/components/ModelPrimitive.d.ts.map +1 -1
  78. package/dist/components/ModelPrimitive.js +6 -0
  79. package/dist/components/MoireGrid.d.ts +1 -1
  80. package/dist/components/MoireGrid.d.ts.map +1 -1
  81. package/dist/components/MoireGrid.js +6 -35
  82. package/dist/components/MoonDisc.d.ts +11 -0
  83. package/dist/components/MoonDisc.d.ts.map +1 -0
  84. package/dist/components/MoonDisc.js +128 -0
  85. package/dist/components/ObjectNode.d.ts.map +1 -1
  86. package/dist/components/ObjectNode.js +15 -4
  87. package/dist/components/ObjectsRenderer.d.ts.map +1 -1
  88. package/dist/components/ObjectsRenderer.js +7 -5
  89. package/dist/components/OceanBuilder.d.ts.map +1 -1
  90. package/dist/components/OceanBuilder.js +2 -0
  91. package/dist/components/ParastichyGrid.d.ts +1 -1
  92. package/dist/components/ParastichyGrid.d.ts.map +1 -1
  93. package/dist/components/ParastichyGrid.js +3 -30
  94. package/dist/components/PhyllotaxisGrid.d.ts +1 -1
  95. package/dist/components/PhyllotaxisGrid.d.ts.map +1 -1
  96. package/dist/components/PhyllotaxisGrid.js +3 -32
  97. package/dist/components/ProjectLoader.d.ts +5 -3
  98. package/dist/components/ProjectLoader.d.ts.map +1 -1
  99. package/dist/components/ProjectLoader.js +6 -3
  100. package/dist/components/QuasiGrid.d.ts +1 -1
  101. package/dist/components/QuasiGrid.d.ts.map +1 -1
  102. package/dist/components/QuasiGrid.js +6 -33
  103. package/dist/components/RadarGrid.d.ts +1 -1
  104. package/dist/components/RadarGrid.d.ts.map +1 -1
  105. package/dist/components/RadarGrid.js +6 -34
  106. package/dist/components/ReactionDiffusionGrid.d.ts +1 -1
  107. package/dist/components/ReactionDiffusionGrid.d.ts.map +1 -1
  108. package/dist/components/ReactionDiffusionGrid.js +6 -35
  109. package/dist/components/SceneBuilder.d.ts +25 -3
  110. package/dist/components/SceneBuilder.d.ts.map +1 -1
  111. package/dist/components/SceneBuilder.js +68 -38
  112. package/dist/components/SkyController.d.ts +25 -1
  113. package/dist/components/SkyController.d.ts.map +1 -1
  114. package/dist/components/SkyController.js +189 -130
  115. package/dist/components/SkyMesh.d.ts.map +1 -1
  116. package/dist/components/SkyMesh.js +26 -1
  117. package/dist/components/SkyStars.d.ts +11 -0
  118. package/dist/components/SkyStars.d.ts.map +1 -0
  119. package/dist/components/SkyStars.js +187 -0
  120. package/dist/components/SkySystem.d.ts +3 -3
  121. package/dist/components/SkySystem.d.ts.map +1 -1
  122. package/dist/components/SkySystem.js +8 -2
  123. package/dist/components/Sun.d.ts +15 -1
  124. package/dist/components/Sun.d.ts.map +1 -1
  125. package/dist/components/Sun.js +64 -3
  126. package/dist/components/SunLight.d.ts +6 -1
  127. package/dist/components/SunLight.d.ts.map +1 -1
  128. package/dist/components/SunLight.js +96 -44
  129. package/dist/components/TerrainBuilder.d.ts.map +1 -1
  130. package/dist/components/TerrainBuilder.js +2 -0
  131. package/dist/components/TextGenerator.d.ts +9 -0
  132. package/dist/components/TextGenerator.d.ts.map +1 -0
  133. package/dist/components/TextGenerator.js +29 -0
  134. package/dist/components/TruchetGrid.d.ts +1 -1
  135. package/dist/components/TruchetGrid.d.ts.map +1 -1
  136. package/dist/components/TruchetGrid.js +3 -30
  137. package/dist/components/VoronoiGrid.d.ts +1 -1
  138. package/dist/components/VoronoiGrid.d.ts.map +1 -1
  139. package/dist/components/VoronoiGrid.js +6 -33
  140. package/dist/components/WallpaperGrid.d.ts +1 -1
  141. package/dist/components/WallpaperGrid.d.ts.map +1 -1
  142. package/dist/components/WallpaperGrid.js +6 -35
  143. package/dist/components/environment/Rain.d.ts +15 -0
  144. package/dist/components/environment/Rain.d.ts.map +1 -0
  145. package/dist/components/environment/Rain.js +110 -0
  146. package/dist/components/environment/Rainbow.d.ts +20 -0
  147. package/dist/components/environment/Rainbow.d.ts.map +1 -0
  148. package/dist/components/environment/Rainbow.js +974 -0
  149. package/dist/components/environment/Sandstorm.d.ts +20 -0
  150. package/dist/components/environment/Sandstorm.d.ts.map +1 -0
  151. package/dist/components/environment/Sandstorm.js +776 -0
  152. package/dist/components/environment/Snow.d.ts +20 -0
  153. package/dist/components/environment/Snow.d.ts.map +1 -0
  154. package/dist/components/environment/Snow.js +609 -0
  155. package/dist/components/environment/Thunderstorm.d.ts +20 -0
  156. package/dist/components/environment/Thunderstorm.d.ts.map +1 -0
  157. package/dist/components/environment/Thunderstorm.js +731 -0
  158. package/dist/components/environment/Tornado.d.ts +20 -0
  159. package/dist/components/environment/Tornado.d.ts.map +1 -0
  160. package/dist/components/environment/Tornado.js +762 -0
  161. package/dist/components/environment/index.d.ts +13 -0
  162. package/dist/components/environment/index.d.ts.map +1 -0
  163. package/dist/components/environment/index.js +7 -0
  164. package/dist/components/index.d.ts +10 -10
  165. package/dist/components/index.d.ts.map +1 -1
  166. package/dist/components/index.js +8 -6
  167. package/dist/components/land/LandPatch.d.ts +15 -0
  168. package/dist/components/land/LandPatch.d.ts.map +1 -0
  169. package/dist/components/land/LandPatch.js +170 -0
  170. package/dist/components/land/index.d.ts +3 -0
  171. package/dist/components/land/index.d.ts.map +1 -0
  172. package/dist/components/land/index.js +1 -0
  173. package/dist/components/space/Earth.d.ts +16 -0
  174. package/dist/components/space/Earth.d.ts.map +1 -0
  175. package/dist/components/space/Earth.js +75 -0
  176. package/dist/components/space/ShootingStar.d.ts +21 -0
  177. package/dist/components/space/ShootingStar.d.ts.map +1 -0
  178. package/dist/components/space/ShootingStar.js +101 -0
  179. package/dist/components/space/ShootingStars.d.ts +16 -0
  180. package/dist/components/space/ShootingStars.d.ts.map +1 -0
  181. package/dist/components/space/ShootingStars.js +71 -0
  182. package/dist/components/space/SolarSystem.d.ts +16 -0
  183. package/dist/components/space/SolarSystem.d.ts.map +1 -0
  184. package/dist/components/space/SolarSystem.js +141 -0
  185. package/dist/components/space/Stars.d.ts +20 -0
  186. package/dist/components/space/Stars.d.ts.map +1 -0
  187. package/dist/components/space/Stars.js +160 -0
  188. package/dist/components/space/index.d.ts +11 -0
  189. package/dist/components/space/index.d.ts.map +1 -0
  190. package/dist/components/space/index.js +8 -0
  191. package/dist/components/terrain/TerrainSurface.d.ts.map +1 -1
  192. package/dist/components/terrain/TerrainSurface.js +27 -3
  193. package/dist/components/terrain/types.d.ts +5 -1
  194. package/dist/components/terrain/types.d.ts.map +1 -1
  195. package/dist/components/text/BurnAwayText.d.ts +15 -0
  196. package/dist/components/text/BurnAwayText.d.ts.map +1 -0
  197. package/dist/components/text/BurnAwayText.js +4 -0
  198. package/dist/components/text/ChalkboardText.d.ts +15 -0
  199. package/dist/components/text/ChalkboardText.d.ts.map +1 -0
  200. package/dist/components/text/ChalkboardText.js +4 -0
  201. package/dist/components/text/ConstellationText.d.ts +15 -0
  202. package/dist/components/text/ConstellationText.d.ts.map +1 -0
  203. package/dist/components/text/ConstellationText.js +4 -0
  204. package/dist/components/text/EmbroideryText.d.ts +15 -0
  205. package/dist/components/text/EmbroideryText.d.ts.map +1 -0
  206. package/dist/components/text/EmbroideryText.js +4 -0
  207. package/dist/components/text/FourierSketchText.d.ts +15 -0
  208. package/dist/components/text/FourierSketchText.d.ts.map +1 -0
  209. package/dist/components/text/FourierSketchText.js +4 -0
  210. package/dist/components/text/FrostGrowthText.d.ts +15 -0
  211. package/dist/components/text/FrostGrowthText.d.ts.map +1 -0
  212. package/dist/components/text/FrostGrowthText.js +4 -0
  213. package/dist/components/text/HandwritingText.d.ts +15 -0
  214. package/dist/components/text/HandwritingText.d.ts.map +1 -0
  215. package/dist/components/text/HandwritingText.js +4 -0
  216. package/dist/components/text/InkBleedText.d.ts +15 -0
  217. package/dist/components/text/InkBleedText.d.ts.map +1 -0
  218. package/dist/components/text/InkBleedText.js +4 -0
  219. package/dist/components/text/LightPaintingText.d.ts +15 -0
  220. package/dist/components/text/LightPaintingText.d.ts.map +1 -0
  221. package/dist/components/text/LightPaintingText.js +4 -0
  222. package/dist/components/text/LiquidMetalText.d.ts +15 -0
  223. package/dist/components/text/LiquidMetalText.d.ts.map +1 -0
  224. package/dist/components/text/LiquidMetalText.js +4 -0
  225. package/dist/components/text/NeonTubeText.d.ts +15 -0
  226. package/dist/components/text/NeonTubeText.d.ts.map +1 -0
  227. package/dist/components/text/NeonTubeText.js +4 -0
  228. package/dist/components/text/PlasmaDischargeText.d.ts +15 -0
  229. package/dist/components/text/PlasmaDischargeText.d.ts.map +1 -0
  230. package/dist/components/text/PlasmaDischargeText.js +4 -0
  231. package/dist/components/text/TextObjectView.d.ts +12 -0
  232. package/dist/components/text/TextObjectView.d.ts.map +1 -0
  233. package/dist/components/text/TextObjectView.js +11 -0
  234. package/dist/components/text/engine/fieldkit.d.ts +24 -0
  235. package/dist/components/text/engine/fieldkit.d.ts.map +1 -0
  236. package/dist/components/text/engine/fieldkit.js +201 -0
  237. package/dist/components/text/engine/glyphs.d.ts +19 -0
  238. package/dist/components/text/engine/glyphs.d.ts.map +1 -0
  239. package/dist/components/text/engine/glyphs.js +269 -0
  240. package/dist/components/text/engine/looks/burnAway.d.ts +144 -0
  241. package/dist/components/text/engine/looks/burnAway.d.ts.map +1 -0
  242. package/dist/components/text/engine/looks/burnAway.js +593 -0
  243. package/dist/components/text/engine/looks/chalkboard.d.ts +135 -0
  244. package/dist/components/text/engine/looks/chalkboard.d.ts.map +1 -0
  245. package/dist/components/text/engine/looks/chalkboard.js +426 -0
  246. package/dist/components/text/engine/looks/constellation.d.ts +111 -0
  247. package/dist/components/text/engine/looks/constellation.d.ts.map +1 -0
  248. package/dist/components/text/engine/looks/constellation.js +496 -0
  249. package/dist/components/text/engine/looks/embroidery.d.ts +165 -0
  250. package/dist/components/text/engine/looks/embroidery.d.ts.map +1 -0
  251. package/dist/components/text/engine/looks/embroidery.js +645 -0
  252. package/dist/components/text/engine/looks/frostGrowth.d.ts +109 -0
  253. package/dist/components/text/engine/looks/frostGrowth.d.ts.map +1 -0
  254. package/dist/components/text/engine/looks/frostGrowth.js +727 -0
  255. package/dist/components/text/engine/looks/index.d.ts +2 -0
  256. package/dist/components/text/engine/looks/index.d.ts.map +1 -0
  257. package/dist/components/text/engine/looks/index.js +48 -0
  258. package/dist/components/text/engine/looks/inkBleed.d.ts +103 -0
  259. package/dist/components/text/engine/looks/inkBleed.d.ts.map +1 -0
  260. package/dist/components/text/engine/looks/inkBleed.js +590 -0
  261. package/dist/components/text/engine/looks/lightPainting.d.ts +132 -0
  262. package/dist/components/text/engine/looks/lightPainting.d.ts.map +1 -0
  263. package/dist/components/text/engine/looks/lightPainting.js +567 -0
  264. package/dist/components/text/engine/looks/liquidMetal.d.ts +135 -0
  265. package/dist/components/text/engine/looks/liquidMetal.d.ts.map +1 -0
  266. package/dist/components/text/engine/looks/liquidMetal.js +655 -0
  267. package/dist/components/text/engine/looks/plasmaDischarge.d.ts +126 -0
  268. package/dist/components/text/engine/looks/plasmaDischarge.d.ts.map +1 -0
  269. package/dist/components/text/engine/looks/plasmaDischarge.js +763 -0
  270. package/dist/components/text/engine/methods.d.ts +19 -0
  271. package/dist/components/text/engine/methods.d.ts.map +1 -0
  272. package/dist/components/text/engine/methods.js +126 -0
  273. package/dist/components/text/engine/playback.d.ts +40 -0
  274. package/dist/components/text/engine/playback.d.ts.map +1 -0
  275. package/dist/components/text/engine/playback.js +114 -0
  276. package/dist/components/text/engine/ribbon.d.ts +58 -0
  277. package/dist/components/text/engine/ribbon.d.ts.map +1 -0
  278. package/dist/components/text/engine/ribbon.js +250 -0
  279. package/dist/components/text/engine/variants.d.ts +159 -0
  280. package/dist/components/text/engine/variants.d.ts.map +1 -0
  281. package/dist/components/text/engine/variants.js +378 -0
  282. package/dist/components/text/fonts/architects-daughter.outline.d.ts +3 -0
  283. package/dist/components/text/fonts/architects-daughter.outline.d.ts.map +1 -0
  284. package/dist/components/text/fonts/architects-daughter.outline.js +4 -0
  285. package/dist/components/text/fonts/architects-daughter.strokes.d.ts +3 -0
  286. package/dist/components/text/fonts/architects-daughter.strokes.d.ts.map +1 -0
  287. package/dist/components/text/fonts/architects-daughter.strokes.js +4 -0
  288. package/dist/components/text/fonts/caveat.outline.d.ts +3 -0
  289. package/dist/components/text/fonts/caveat.outline.d.ts.map +1 -0
  290. package/dist/components/text/fonts/caveat.outline.js +4 -0
  291. package/dist/components/text/fonts/caveat.strokes.d.ts +3 -0
  292. package/dist/components/text/fonts/caveat.strokes.d.ts.map +1 -0
  293. package/dist/components/text/fonts/caveat.strokes.js +4 -0
  294. package/dist/components/text/fonts/courgette.outline.d.ts +3 -0
  295. package/dist/components/text/fonts/courgette.outline.d.ts.map +1 -0
  296. package/dist/components/text/fonts/courgette.outline.js +4 -0
  297. package/dist/components/text/fonts/courgette.strokes.d.ts +3 -0
  298. package/dist/components/text/fonts/courgette.strokes.d.ts.map +1 -0
  299. package/dist/components/text/fonts/courgette.strokes.js +4 -0
  300. package/dist/components/text/fonts/dancing-script.outline.d.ts +3 -0
  301. package/dist/components/text/fonts/dancing-script.outline.d.ts.map +1 -0
  302. package/dist/components/text/fonts/dancing-script.outline.js +4 -0
  303. package/dist/components/text/fonts/dancing-script.strokes.d.ts +3 -0
  304. package/dist/components/text/fonts/dancing-script.strokes.d.ts.map +1 -0
  305. package/dist/components/text/fonts/dancing-script.strokes.js +4 -0
  306. package/dist/components/text/fonts/gochi-hand.outline.d.ts +3 -0
  307. package/dist/components/text/fonts/gochi-hand.outline.d.ts.map +1 -0
  308. package/dist/components/text/fonts/gochi-hand.outline.js +4 -0
  309. package/dist/components/text/fonts/gochi-hand.strokes.d.ts +3 -0
  310. package/dist/components/text/fonts/gochi-hand.strokes.d.ts.map +1 -0
  311. package/dist/components/text/fonts/gochi-hand.strokes.js +4 -0
  312. package/dist/components/text/fonts/handlee.outline.d.ts +3 -0
  313. package/dist/components/text/fonts/handlee.outline.d.ts.map +1 -0
  314. package/dist/components/text/fonts/handlee.outline.js +4 -0
  315. package/dist/components/text/fonts/handlee.strokes.d.ts +3 -0
  316. package/dist/components/text/fonts/handlee.strokes.d.ts.map +1 -0
  317. package/dist/components/text/fonts/handlee.strokes.js +4 -0
  318. package/dist/components/text/fonts/index.d.ts +5 -0
  319. package/dist/components/text/fonts/index.d.ts.map +1 -0
  320. package/dist/components/text/fonts/index.js +44 -0
  321. package/dist/components/text/fonts/indie-flower.outline.d.ts +3 -0
  322. package/dist/components/text/fonts/indie-flower.outline.d.ts.map +1 -0
  323. package/dist/components/text/fonts/indie-flower.outline.js +4 -0
  324. package/dist/components/text/fonts/indie-flower.strokes.d.ts +3 -0
  325. package/dist/components/text/fonts/indie-flower.strokes.d.ts.map +1 -0
  326. package/dist/components/text/fonts/indie-flower.strokes.js +4 -0
  327. package/dist/components/text/fonts/kalam.outline.d.ts +3 -0
  328. package/dist/components/text/fonts/kalam.outline.d.ts.map +1 -0
  329. package/dist/components/text/fonts/kalam.outline.js +4 -0
  330. package/dist/components/text/fonts/kalam.strokes.d.ts +3 -0
  331. package/dist/components/text/fonts/kalam.strokes.d.ts.map +1 -0
  332. package/dist/components/text/fonts/kalam.strokes.js +4 -0
  333. package/dist/components/text/fonts/kaushan-script.outline.d.ts +3 -0
  334. package/dist/components/text/fonts/kaushan-script.outline.d.ts.map +1 -0
  335. package/dist/components/text/fonts/kaushan-script.outline.js +4 -0
  336. package/dist/components/text/fonts/kaushan-script.strokes.d.ts +3 -0
  337. package/dist/components/text/fonts/kaushan-script.strokes.d.ts.map +1 -0
  338. package/dist/components/text/fonts/kaushan-script.strokes.js +4 -0
  339. package/dist/components/text/fonts/mynerve.outline.d.ts +3 -0
  340. package/dist/components/text/fonts/mynerve.outline.d.ts.map +1 -0
  341. package/dist/components/text/fonts/mynerve.outline.js +4 -0
  342. package/dist/components/text/fonts/mynerve.strokes.d.ts +3 -0
  343. package/dist/components/text/fonts/mynerve.strokes.d.ts.map +1 -0
  344. package/dist/components/text/fonts/mynerve.strokes.js +4 -0
  345. package/dist/components/text/fonts/nanum-pen-script.outline.d.ts +3 -0
  346. package/dist/components/text/fonts/nanum-pen-script.outline.d.ts.map +1 -0
  347. package/dist/components/text/fonts/nanum-pen-script.outline.js +4 -0
  348. package/dist/components/text/fonts/nanum-pen-script.strokes.d.ts +3 -0
  349. package/dist/components/text/fonts/nanum-pen-script.strokes.d.ts.map +1 -0
  350. package/dist/components/text/fonts/nanum-pen-script.strokes.js +4 -0
  351. package/dist/components/text/fonts/pacifico.outline.d.ts +3 -0
  352. package/dist/components/text/fonts/pacifico.outline.d.ts.map +1 -0
  353. package/dist/components/text/fonts/pacifico.outline.js +4 -0
  354. package/dist/components/text/fonts/pacifico.strokes.d.ts +3 -0
  355. package/dist/components/text/fonts/pacifico.strokes.d.ts.map +1 -0
  356. package/dist/components/text/fonts/pacifico.strokes.js +4 -0
  357. package/dist/components/text/fonts/patrick-hand.outline.d.ts +3 -0
  358. package/dist/components/text/fonts/patrick-hand.outline.d.ts.map +1 -0
  359. package/dist/components/text/fonts/patrick-hand.outline.js +4 -0
  360. package/dist/components/text/fonts/patrick-hand.strokes.d.ts +3 -0
  361. package/dist/components/text/fonts/patrick-hand.strokes.d.ts.map +1 -0
  362. package/dist/components/text/fonts/patrick-hand.strokes.js +4 -0
  363. package/dist/components/text/fonts/poppins.outline.d.ts +3 -0
  364. package/dist/components/text/fonts/poppins.outline.d.ts.map +1 -0
  365. package/dist/components/text/fonts/poppins.outline.js +4 -0
  366. package/dist/components/text/fonts/poppins.strokes.d.ts +3 -0
  367. package/dist/components/text/fonts/poppins.strokes.d.ts.map +1 -0
  368. package/dist/components/text/fonts/poppins.strokes.js +4 -0
  369. package/dist/components/text/fonts/satisfy.outline.d.ts +3 -0
  370. package/dist/components/text/fonts/satisfy.outline.d.ts.map +1 -0
  371. package/dist/components/text/fonts/satisfy.outline.js +4 -0
  372. package/dist/components/text/fonts/satisfy.strokes.d.ts +3 -0
  373. package/dist/components/text/fonts/satisfy.strokes.d.ts.map +1 -0
  374. package/dist/components/text/fonts/satisfy.strokes.js +4 -0
  375. package/dist/components/text/fonts/sriracha.outline.d.ts +3 -0
  376. package/dist/components/text/fonts/sriracha.outline.d.ts.map +1 -0
  377. package/dist/components/text/fonts/sriracha.outline.js +4 -0
  378. package/dist/components/text/fonts/sriracha.strokes.d.ts +3 -0
  379. package/dist/components/text/fonts/sriracha.strokes.d.ts.map +1 -0
  380. package/dist/components/text/fonts/sriracha.strokes.js +4 -0
  381. package/dist/components/text/index.d.ts +27 -0
  382. package/dist/components/text/index.d.ts.map +1 -0
  383. package/dist/components/text/index.js +13 -0
  384. package/dist/components/text/useTextObject.d.ts +21 -0
  385. package/dist/components/text/useTextObject.d.ts.map +1 -0
  386. package/dist/components/text/useTextObject.js +118 -0
  387. package/dist/components/water/OceanSurface.d.ts.map +1 -1
  388. package/dist/components/water/OceanSurface.js +3 -1
  389. package/dist/components/water/WaterBody.d.ts.map +1 -1
  390. package/dist/components/water/WaterBody.js +3 -1
  391. package/dist/components/water/types.d.ts +5 -1
  392. package/dist/components/water/types.d.ts.map +1 -1
  393. package/dist/constants.d.ts.map +1 -1
  394. package/dist/constants.js +4 -0
  395. package/dist/hooks/index.d.ts +2 -0
  396. package/dist/hooks/index.d.ts.map +1 -1
  397. package/dist/hooks/index.js +1 -0
  398. package/dist/hooks/useCloudSun.d.ts +9 -4
  399. package/dist/hooks/useCloudSun.d.ts.map +1 -1
  400. package/dist/hooks/useCloudSun.js +17 -7
  401. package/dist/hooks/useConfigLive.d.ts +3 -2
  402. package/dist/hooks/useConfigLive.d.ts.map +1 -1
  403. package/dist/hooks/useContinuousEffects.d.ts.map +1 -1
  404. package/dist/hooks/useContinuousEffects.js +4 -10
  405. package/dist/hooks/useEnvironmentProbe.d.ts +3 -22
  406. package/dist/hooks/useEnvironmentProbe.d.ts.map +1 -1
  407. package/dist/hooks/useEnvironmentProbe.js +47 -8
  408. package/dist/hooks/useGridSurface.d.ts +3 -10
  409. package/dist/hooks/useGridSurface.d.ts.map +1 -1
  410. package/dist/hooks/useGridSurface.js +5 -31
  411. package/dist/hooks/useInteraction.d.ts.map +1 -1
  412. package/dist/hooks/useInteraction.js +19 -72
  413. package/dist/hooks/useLightConfig.d.ts +2 -1
  414. package/dist/hooks/useLightConfig.d.ts.map +1 -1
  415. package/dist/hooks/useOceanMaterial.d.ts +6 -2
  416. package/dist/hooks/useOceanMaterial.d.ts.map +1 -1
  417. package/dist/hooks/useOceanMaterial.js +37 -2
  418. package/dist/hooks/useSkyLive.d.ts +23 -0
  419. package/dist/hooks/useSkyLive.d.ts.map +1 -0
  420. package/dist/hooks/useSkyLive.js +30 -0
  421. package/dist/hooks/useSkyUniforms.d.ts.map +1 -1
  422. package/dist/hooks/useSkyUniforms.js +2 -10
  423. package/dist/hooks/useTerrainLive.d.ts +3 -1
  424. package/dist/hooks/useTerrainLive.d.ts.map +1 -1
  425. package/dist/hooks/useTerrainTextures.d.ts +38 -0
  426. package/dist/hooks/useTerrainTextures.d.ts.map +1 -0
  427. package/dist/hooks/useTerrainTextures.js +149 -0
  428. package/dist/index.d.ts +11 -2
  429. package/dist/index.d.ts.map +1 -1
  430. package/dist/index.js +8 -1
  431. package/dist/operations/catalogue/blastOff.d.ts +3 -0
  432. package/dist/operations/catalogue/blastOff.d.ts.map +1 -0
  433. package/dist/operations/catalogue/blastOff.js +118 -0
  434. package/dist/operations/catalogue/bounce.d.ts +3 -0
  435. package/dist/operations/catalogue/bounce.d.ts.map +1 -0
  436. package/dist/operations/catalogue/bounce.js +34 -0
  437. package/dist/operations/catalogue/curlSmoke.d.ts.map +1 -1
  438. package/dist/operations/catalogue/curlSmoke.js +3 -1
  439. package/dist/operations/catalogue/dissolve.d.ts.map +1 -1
  440. package/dist/operations/catalogue/dissolve.js +2 -1
  441. package/dist/operations/catalogue/driftUp.d.ts +3 -0
  442. package/dist/operations/catalogue/driftUp.d.ts.map +1 -0
  443. package/dist/operations/catalogue/driftUp.js +57 -0
  444. package/dist/operations/catalogue/emberAsh.d.ts.map +1 -1
  445. package/dist/operations/catalogue/emberAsh.js +2 -1
  446. package/dist/operations/catalogue/flip.d.ts.map +1 -1
  447. package/dist/operations/catalogue/flip.js +19 -9
  448. package/dist/operations/catalogue/float.d.ts +3 -0
  449. package/dist/operations/catalogue/float.d.ts.map +1 -0
  450. package/dist/operations/catalogue/float.js +39 -0
  451. package/dist/operations/catalogue/flyBy.d.ts +3 -0
  452. package/dist/operations/catalogue/flyBy.d.ts.map +1 -0
  453. package/dist/operations/catalogue/flyBy.js +79 -0
  454. package/dist/operations/catalogue/frost.d.ts.map +1 -1
  455. package/dist/operations/catalogue/frost.js +10 -3
  456. package/dist/operations/catalogue/grow.d.ts +3 -0
  457. package/dist/operations/catalogue/grow.d.ts.map +1 -0
  458. package/dist/operations/catalogue/grow.js +19 -0
  459. package/dist/operations/catalogue/hologram.d.ts.map +1 -1
  460. package/dist/operations/catalogue/hologram.js +11 -5
  461. package/dist/operations/catalogue/jelly.d.ts.map +1 -1
  462. package/dist/operations/catalogue/jelly.js +18 -8
  463. package/dist/operations/catalogue/knockAway.d.ts +3 -0
  464. package/dist/operations/catalogue/knockAway.d.ts.map +1 -0
  465. package/dist/operations/catalogue/knockAway.js +74 -0
  466. package/dist/operations/catalogue/leafFall.d.ts +3 -0
  467. package/dist/operations/catalogue/leafFall.d.ts.map +1 -0
  468. package/dist/operations/catalogue/leafFall.js +74 -0
  469. package/dist/operations/catalogue/lidarScan.d.ts.map +1 -1
  470. package/dist/operations/catalogue/lidarScan.js +4 -1
  471. package/dist/operations/catalogue/metalize.d.ts.map +1 -1
  472. package/dist/operations/catalogue/metalize.js +8 -2
  473. package/dist/operations/catalogue/motionTrail.d.ts +6 -0
  474. package/dist/operations/catalogue/motionTrail.d.ts.map +1 -0
  475. package/dist/operations/catalogue/motionTrail.js +221 -0
  476. package/dist/operations/catalogue/petrify.d.ts.map +1 -1
  477. package/dist/operations/catalogue/petrify.js +9 -3
  478. package/dist/operations/catalogue/physicalExit.d.ts +55 -0
  479. package/dist/operations/catalogue/physicalExit.d.ts.map +1 -0
  480. package/dist/operations/catalogue/physicalExit.js +165 -0
  481. package/dist/operations/catalogue/physicalHeld.d.ts +41 -0
  482. package/dist/operations/catalogue/physicalHeld.d.ts.map +1 -0
  483. package/dist/operations/catalogue/physicalHeld.js +78 -0
  484. package/dist/operations/catalogue/physicalMix.d.ts +45 -0
  485. package/dist/operations/catalogue/physicalMix.d.ts.map +1 -0
  486. package/dist/operations/catalogue/physicalMix.js +144 -0
  487. package/dist/operations/catalogue/pop.d.ts +3 -0
  488. package/dist/operations/catalogue/pop.d.ts.map +1 -0
  489. package/dist/operations/catalogue/pop.js +44 -0
  490. package/dist/operations/catalogue/print3d.d.ts.map +1 -1
  491. package/dist/operations/catalogue/print3d.js +5 -1
  492. package/dist/operations/catalogue/pulse.d.ts +3 -0
  493. package/dist/operations/catalogue/pulse.d.ts.map +1 -0
  494. package/dist/operations/catalogue/pulse.js +29 -0
  495. package/dist/operations/catalogue/restPose.d.ts +5 -7
  496. package/dist/operations/catalogue/restPose.d.ts.map +1 -1
  497. package/dist/operations/catalogue/restPose.js +18 -48
  498. package/dist/operations/catalogue/rotate.d.ts +3 -0
  499. package/dist/operations/catalogue/rotate.d.ts.map +1 -0
  500. package/dist/operations/catalogue/rotate.js +49 -0
  501. package/dist/operations/catalogue/shake.d.ts +3 -0
  502. package/dist/operations/catalogue/shake.d.ts.map +1 -0
  503. package/dist/operations/catalogue/shake.js +31 -0
  504. package/dist/operations/catalogue/shatter.d.ts.map +1 -1
  505. package/dist/operations/catalogue/shatter.js +5 -1
  506. package/dist/operations/catalogue/slam.d.ts +3 -0
  507. package/dist/operations/catalogue/slam.d.ts.map +1 -0
  508. package/dist/operations/catalogue/slam.js +89 -0
  509. package/dist/operations/catalogue/slingshot.d.ts +3 -0
  510. package/dist/operations/catalogue/slingshot.d.ts.map +1 -0
  511. package/dist/operations/catalogue/slingshot.js +88 -0
  512. package/dist/operations/catalogue/spin.d.ts.map +1 -1
  513. package/dist/operations/catalogue/spin.js +24 -13
  514. package/dist/operations/catalogue/sway.d.ts +3 -0
  515. package/dist/operations/catalogue/sway.d.ts.map +1 -0
  516. package/dist/operations/catalogue/sway.js +23 -0
  517. package/dist/operations/catalogue/swirl.d.ts.map +1 -1
  518. package/dist/operations/catalogue/swirl.js +6 -5
  519. package/dist/operations/catalogue/trailCore.d.ts +89 -0
  520. package/dist/operations/catalogue/trailCore.d.ts.map +1 -0
  521. package/dist/operations/catalogue/trailCore.js +190 -0
  522. package/dist/operations/catalogue/trailGhosts.d.ts +5 -0
  523. package/dist/operations/catalogue/trailGhosts.d.ts.map +1 -0
  524. package/dist/operations/catalogue/trailGhosts.js +179 -0
  525. package/dist/operations/catalogue/trailStampStyles.d.ts +11 -0
  526. package/dist/operations/catalogue/trailStampStyles.d.ts.map +1 -0
  527. package/dist/operations/catalogue/trailStampStyles.js +479 -0
  528. package/dist/operations/catalogue/trailStamps.d.ts +57 -0
  529. package/dist/operations/catalogue/trailStamps.d.ts.map +1 -0
  530. package/dist/operations/catalogue/trailStamps.js +349 -0
  531. package/dist/operations/catalogue/trailStreaks.d.ts +3 -0
  532. package/dist/operations/catalogue/trailStreaks.d.ts.map +1 -0
  533. package/dist/operations/catalogue/trailStreaks.js +147 -0
  534. package/dist/operations/catalogue/transitionField.d.ts +30 -0
  535. package/dist/operations/catalogue/transitionField.d.ts.map +1 -1
  536. package/dist/operations/catalogue/transitionField.js +21 -0
  537. package/dist/operations/catalogue/turnAway.d.ts +3 -0
  538. package/dist/operations/catalogue/turnAway.d.ts.map +1 -0
  539. package/dist/operations/catalogue/turnAway.js +54 -0
  540. package/dist/operations/catalogue/vortexDrain.d.ts +3 -0
  541. package/dist/operations/catalogue/vortexDrain.d.ts.map +1 -0
  542. package/dist/operations/catalogue/vortexDrain.js +68 -0
  543. package/dist/operations/catalogue/warp.d.ts +3 -0
  544. package/dist/operations/catalogue/warp.d.ts.map +1 -0
  545. package/dist/operations/catalogue/warp.js +73 -0
  546. package/dist/operations/catalogue/whoosh.d.ts +3 -0
  547. package/dist/operations/catalogue/whoosh.d.ts.map +1 -0
  548. package/dist/operations/catalogue/whoosh.js +84 -0
  549. package/dist/operations/catalogue/wobble.d.ts +3 -0
  550. package/dist/operations/catalogue/wobble.d.ts.map +1 -0
  551. package/dist/operations/catalogue/wobble.js +23 -0
  552. package/dist/operations/clipPreview.d.ts +3 -0
  553. package/dist/operations/clipPreview.d.ts.map +1 -0
  554. package/dist/operations/clipPreview.js +20 -0
  555. package/dist/operations/groupFanout.d.ts +96 -0
  556. package/dist/operations/groupFanout.d.ts.map +1 -0
  557. package/dist/operations/groupFanout.js +365 -0
  558. package/dist/operations/groups.d.ts +20 -0
  559. package/dist/operations/groups.d.ts.map +1 -0
  560. package/dist/operations/groups.js +66 -0
  561. package/dist/operations/index.d.ts +5 -2
  562. package/dist/operations/index.d.ts.map +1 -1
  563. package/dist/operations/index.js +5 -2
  564. package/dist/operations/objectEffects.d.ts +161 -6
  565. package/dist/operations/objectEffects.d.ts.map +1 -1
  566. package/dist/operations/objectEffects.js +1091 -17
  567. package/dist/operations/registry.d.ts.map +1 -1
  568. package/dist/operations/registry.js +24 -2
  569. package/dist/operations/runtime.d.ts +57 -2
  570. package/dist/operations/runtime.d.ts.map +1 -1
  571. package/dist/operations/runtime.js +161 -18
  572. package/dist/operations/types.d.ts +60 -3
  573. package/dist/operations/types.d.ts.map +1 -1
  574. package/dist/operations/types.js +5 -1
  575. package/dist/operations/useObjectEffectLayers.d.ts +2 -2
  576. package/dist/operations/useObjectEffectLayers.d.ts.map +1 -1
  577. package/dist/operations/useObjectEffectLayers.js +31 -10
  578. package/dist/operations/usePresentedVisibility.d.ts +10 -0
  579. package/dist/operations/usePresentedVisibility.d.ts.map +1 -0
  580. package/dist/operations/usePresentedVisibility.js +53 -0
  581. package/dist/presets/terrainBiomes.d.ts +67 -0
  582. package/dist/presets/terrainBiomes.d.ts.map +1 -0
  583. package/dist/presets/terrainBiomes.js +294 -0
  584. package/dist/presets/terrainPresets.d.ts +6 -0
  585. package/dist/presets/terrainPresets.d.ts.map +1 -1
  586. package/dist/presets/terrainPresets.js +26 -38
  587. package/dist/shaders/glsl/oceanCore.glsl.d.ts +2 -2
  588. package/dist/shaders/glsl/oceanCore.glsl.d.ts.map +1 -1
  589. package/dist/shaders/glsl/oceanCore.glsl.js +17 -0
  590. package/dist/shaders/glsl/surfaceCore.glsl.d.ts +21 -0
  591. package/dist/shaders/glsl/surfaceCore.glsl.d.ts.map +1 -0
  592. package/dist/shaders/glsl/surfaceCore.glsl.js +120 -0
  593. package/dist/shaders/glsl/terrainCore.glsl.d.ts +16 -3
  594. package/dist/shaders/glsl/terrainCore.glsl.d.ts.map +1 -1
  595. package/dist/shaders/glsl/terrainCore.glsl.js +266 -20
  596. package/dist/shaders/ocean/OceanSurfaceMaterial.d.ts +2 -0
  597. package/dist/shaders/ocean/OceanSurfaceMaterial.d.ts.map +1 -1
  598. package/dist/shaders/ocean/OceanSurfaceMaterial.js +3 -0
  599. package/dist/shaders/terrain/TerrainMaterial.d.ts +17 -0
  600. package/dist/shaders/terrain/TerrainMaterial.d.ts.map +1 -1
  601. package/dist/shaders/terrain/TerrainMaterial.js +107 -8
  602. package/dist/triggers/engine.d.ts +44 -0
  603. package/dist/triggers/engine.d.ts.map +1 -0
  604. package/dist/triggers/engine.js +165 -0
  605. package/dist/triggers/hosts/actions.d.ts +8 -0
  606. package/dist/triggers/hosts/actions.d.ts.map +1 -0
  607. package/dist/triggers/hosts/actions.js +22 -0
  608. package/dist/triggers/hosts/interactions.d.ts +6 -0
  609. package/dist/triggers/hosts/interactions.d.ts.map +1 -0
  610. package/dist/triggers/hosts/interactions.js +4 -0
  611. package/dist/triggers/hosts/timelineCues.d.ts +2 -0
  612. package/dist/triggers/hosts/timelineCues.d.ts.map +1 -0
  613. package/dist/triggers/hosts/timelineCues.js +22 -0
  614. package/dist/triggers/index.d.ts +13 -0
  615. package/dist/triggers/index.d.ts.map +1 -0
  616. package/dist/triggers/index.js +9 -0
  617. package/dist/triggers/kinds/action.d.ts +2 -0
  618. package/dist/triggers/kinds/action.d.ts.map +1 -0
  619. package/dist/triggers/kinds/action.js +31 -0
  620. package/dist/triggers/kinds/animations.d.ts +2 -0
  621. package/dist/triggers/kinds/animations.d.ts.map +1 -0
  622. package/dist/triggers/kinds/animations.js +75 -0
  623. package/dist/triggers/kinds/effects.d.ts +2 -0
  624. package/dist/triggers/kinds/effects.d.ts.map +1 -0
  625. package/dist/triggers/kinds/effects.js +27 -0
  626. package/dist/triggers/kinds/index.d.ts +4 -0
  627. package/dist/triggers/kinds/index.d.ts.map +1 -0
  628. package/dist/triggers/kinds/index.js +4 -0
  629. package/dist/triggers/log.d.ts +21 -0
  630. package/dist/triggers/log.d.ts.map +1 -0
  631. package/dist/triggers/log.js +43 -0
  632. package/dist/triggers/readiness.d.ts +40 -0
  633. package/dist/triggers/readiness.d.ts.map +1 -0
  634. package/dist/triggers/readiness.js +158 -0
  635. package/dist/triggers/registry.d.ts +41 -0
  636. package/dist/triggers/registry.d.ts.map +1 -0
  637. package/dist/triggers/registry.js +7 -0
  638. package/dist/types/gridConfigs.d.ts +18 -23
  639. package/dist/types/gridConfigs.d.ts.map +1 -1
  640. package/dist/ui/UiAnchorUpdater.d.ts +10 -0
  641. package/dist/ui/UiAnchorUpdater.d.ts.map +1 -0
  642. package/dist/ui/UiAnchorUpdater.js +111 -0
  643. package/dist/ui/UiLayers.d.ts +20 -0
  644. package/dist/ui/UiLayers.d.ts.map +1 -0
  645. package/dist/ui/UiLayers.js +57 -0
  646. package/dist/ui/index.d.ts +9 -0
  647. package/dist/ui/index.d.ts.map +1 -0
  648. package/dist/ui/index.js +6 -0
  649. package/dist/ui/uiAnchors.d.ts +21 -0
  650. package/dist/ui/uiAnchors.d.ts.map +1 -0
  651. package/dist/ui/uiAnchors.js +22 -0
  652. package/dist/ui/uiBaseStyles.d.ts +2 -0
  653. package/dist/ui/uiBaseStyles.d.ts.map +1 -0
  654. package/dist/ui/uiBaseStyles.js +100 -0
  655. package/dist/ui/uiBinder.d.ts +30 -0
  656. package/dist/ui/uiBinder.d.ts.map +1 -0
  657. package/dist/ui/uiBinder.js +344 -0
  658. package/dist/utils/configAnimations.d.ts.map +1 -1
  659. package/dist/utils/configAnimations.js +5 -1
  660. package/dist/utils/gridConfig.d.ts +1 -1
  661. package/dist/utils/gridConfig.d.ts.map +1 -1
  662. package/dist/utils/gridConfig.js +1 -1
  663. package/dist/utils/landPatch.d.ts +33 -0
  664. package/dist/utils/landPatch.d.ts.map +1 -0
  665. package/dist/utils/landPatch.js +114 -0
  666. package/dist/utils/renderedSky.d.ts +32 -0
  667. package/dist/utils/renderedSky.d.ts.map +1 -0
  668. package/dist/utils/renderedSky.js +57 -0
  669. package/dist/utils/skyMoon.d.ts +35 -0
  670. package/dist/utils/skyMoon.d.ts.map +1 -0
  671. package/dist/utils/skyMoon.js +41 -0
  672. package/dist/utils/terrainHeight.d.ts +4 -0
  673. package/dist/utils/terrainHeight.d.ts.map +1 -0
  674. package/dist/utils/terrainHeight.js +150 -0
  675. package/dist/utils/terrainTextureResolver.d.ts +18 -0
  676. package/dist/utils/terrainTextureResolver.d.ts.map +1 -0
  677. package/dist/utils/terrainTextureResolver.js +17 -0
  678. package/dist/utils/terrainUniforms.d.ts +17 -0
  679. package/dist/utils/terrainUniforms.d.ts.map +1 -1
  680. package/dist/utils/terrainUniforms.js +84 -0
  681. package/dist/utils/textureArrays.d.ts +29 -0
  682. package/dist/utils/textureArrays.d.ts.map +1 -0
  683. package/dist/utils/textureArrays.js +140 -0
  684. package/package.json +2 -2
@@ -0,0 +1,762 @@
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 + tornado.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
+ uNoise: { value: noiseTexture() },
110
+ uFollow: { value: 0 },
111
+ uViewH: { value: 800 },
112
+ uIntensity: { value: 1 },
113
+ uOpacity: { value: 1 },
114
+ uColor: { value: new THREE.Color('#ffffff') },
115
+ uShadeColor: { value: new THREE.Color('#808080') },
116
+ uSunDir: { value: new THREE.Vector3(0.35, 0.42, 0.84).normalize() },
117
+ uSunColor: { value: new THREE.Color(1.0, 0.93, 0.82) },
118
+ uSkyAmbient: { value: new THREE.Color(0.55, 0.65, 0.85) },
119
+ uPointer: { value: new THREE.Vector3() },
120
+ uPointerVel: { value: new THREE.Vector3() },
121
+ uPointerActive: { value: 0 },
122
+ uPointerMode: { value: -1 },
123
+ uPointerStrength: { value: 1 },
124
+ uPointerRadius: { value: 1 },
125
+ uPointerColor: { value: new THREE.Color('#ffffff') },
126
+ };
127
+ }
128
+ /** The base knobs every environment object shares (push point, part 1). */
129
+ function applyCommonConfig(u, c, pointerModes) {
130
+ if (c.intensity !== undefined)
131
+ u.uIntensity.value = c.intensity;
132
+ if (c.speed !== undefined)
133
+ u.uSpeed.value = c.speed;
134
+ if (c.opacity !== undefined)
135
+ u.uOpacity.value = c.opacity;
136
+ setColor(u.uColor, c.color);
137
+ setColor(u.uShadeColor, c.shadeColor);
138
+ setColor(u.uPointerColor, c.pointerColor);
139
+ if (c.windStrength !== undefined)
140
+ u.uWindStrength.value = c.windStrength;
141
+ if (c.windDirection !== undefined)
142
+ u.uWindDir.value.set(Math.sin(c.windDirection * DEG_C), Math.cos(c.windDirection * DEG_C));
143
+ if (c.turbulence !== undefined)
144
+ u.uTurb.value = c.turbulence;
145
+ if (c.pointerStrength !== undefined)
146
+ u.uPointerStrength.value = c.pointerStrength;
147
+ if (c.pointerRadius !== undefined)
148
+ u.uPointerRadius.value = c.pointerRadius;
149
+ if (c.pointerMode !== undefined)
150
+ u.uPointerMode.value = pointerModes.indexOf(c.pointerMode);
151
+ if (c.followCamera !== undefined)
152
+ u.uFollow.value = c.followCamera ? 1 : 0;
153
+ }
154
+ const _cs = new THREE.Vector3(), _cc = new THREE.Vector3(), _cq = new THREE.Quaternion(), _csun = new THREE.Vector3();
155
+ const _cinv = new THREE.Matrix4();
156
+ const _corner = new THREE.Vector3();
157
+ const _cview = new THREE.Matrix4();
158
+ /** Per-frame bookkeeping shared by every object: volume, camera, slice range and bounds, sun, phases. */
159
+ function updateCommon(u, object, camera, dt, viewH, sunWorld, dpr) {
160
+ // the camera may have been moved this frame (controls) without its matrices following yet
161
+ camera.updateMatrixWorld();
162
+ object.updateWorldMatrix(true, false);
163
+ object.getWorldScale(_cs);
164
+ u.uVolume.value.set(Math.max(_cs.x, 0.01), Math.max(_cs.y, 0.01), Math.max(_cs.z, 0.01));
165
+ const V = u.uVolume.value;
166
+ object.worldToLocal(_cc.copy(camera.position));
167
+ u.uCam.value.set(_cc.x * V.x, _cc.y * V.y, _cc.z * V.z);
168
+ _cinv.copy(object.matrixWorld).invert();
169
+ u.uCamToLocal.value.multiplyMatrices(_cinv, camera.matrixWorld);
170
+ if (viewH)
171
+ u.uViewH.value = viewH;
172
+ // slice range: from where the volume starts in front of the eye to its far corner
173
+ const C = u.uCam.value;
174
+ const follow = u.uFollow.value > 0.5;
175
+ const hx = follow ? 1e6 : V.x / 2, hz = follow ? 1e6 : V.z / 2;
176
+ const dx = Math.max(Math.abs(C.x) - hx, 0), dz = Math.max(Math.abs(C.z) - hz, 0);
177
+ const dy = Math.max(-C.y, C.y - V.y, 0);
178
+ const dNear = Math.hypot(dx, dy, dz);
179
+ let dFar = 0;
180
+ for (let i = 0; i < 8; i++) {
181
+ _corner.set((i & 1 ? 1 : -1) * Math.min(hx, 3e3), i & 2 ? V.y : 0, (i & 4 ? 1 : -1) * Math.min(hz, 3e3));
182
+ dFar = Math.max(dFar, _corner.distanceTo(C));
183
+ }
184
+ const far = camera.far !== undefined ? camera.far : 2000;
185
+ u.uSliceNear.value = Math.max(0.3, dNear * 0.6);
186
+ u.uSliceFar.value = Math.max(u.uSliceNear.value * 1.5, Math.min(dFar, 600, far * 0.98));
187
+ // Slice bounds: the volume's box on screen (NDC). Whole screen when the box reaches behind the
188
+ // eye (the camera is inside or right next to it) or follows the camera.
189
+ const R = u.uSliceRect.value.set(-1.04, -1.04, 1.04, 1.04);
190
+ if (!follow && camera.projectionMatrix) {
191
+ _cview.copy(camera.matrixWorld).invert().multiply(object.matrixWorld);
192
+ const P = camera.projectionMatrix.elements, nearZ = camera.near !== undefined ? camera.near : 0.1;
193
+ let x0 = 1e9, y0 = 1e9, x1 = -1e9, y1 = -1e9, ok = true;
194
+ for (let i = 0; i < 8 && ok; i++) {
195
+ _corner.set(i & 1 ? 0.5 : -0.5, i & 2 ? 1 : 0, i & 4 ? 0.5 : -0.5).applyMatrix4(_cview);
196
+ if (_corner.z > -nearZ) {
197
+ ok = false;
198
+ break;
199
+ }
200
+ const w = -_corner.z, x = (P[0] * _corner.x + P[8] * _corner.z) / w, y = (P[5] * _corner.y + P[9] * _corner.z) / w;
201
+ if (x < x0)
202
+ x0 = x;
203
+ if (x > x1)
204
+ x1 = x;
205
+ if (y < y0)
206
+ y0 = y;
207
+ if (y > y1)
208
+ y1 = y;
209
+ }
210
+ // the margin covers the depth dither, which slides a sample along its ray but never off its pixel
211
+ if (ok)
212
+ 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));
213
+ if (R.z <= R.x || R.w <= R.y)
214
+ R.set(0, 0, 0, 0); // off screen: nothing to draw
215
+ }
216
+ // Interleaved slices on dense displays: pixels take turns over 2 (ratio >= 1.25) or 4 (>= 1.75) sets.
217
+ // An object caps it (buildSlices' interleave): fine, fast-changing structure like the tornado's funnel
218
+ // loses its crispness when neighbours see different slabs, so it takes every slice.
219
+ u.uSkip.value = Math.min(dpr >= 1.75 ? 4 : dpr >= 1.25 ? 2 : 1, u.uSkipMax.value);
220
+ // phases (rates integrated on the CPU, so animating them never jumps)
221
+ const sp = u.uSpeed.value;
222
+ u.uTime.value += dt * sp;
223
+ u.uWind.value.addScaledVector(u.uWindDir.value, dt * sp * u.uWindStrength.value * WIND_MS_COMMON);
224
+ u.uTurbPhase.value += dt * sp * 0.25;
225
+ if (sunWorld) {
226
+ object.getWorldQuaternion(_cq).invert();
227
+ u.uSunDir.value.copy(_csun.copy(sunWorld).normalize().applyQuaternion(_cq));
228
+ }
229
+ }
230
+ /**
231
+ * True when a layer that only exists inside the volume and within `reach` metres of the eye can show
232
+ * anything: used to skip submitting near layers (thousands of instances, each fully evaluated per
233
+ * vertex) while the camera is away from the volume.
234
+ */
235
+ function layerInReach(u, reach) {
236
+ const C = u.uCam.value, V = u.uVolume.value, follow = u.uFollow.value > 0.5;
237
+ 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);
238
+ const oy = Math.max(-C.y, C.y - V.y, 0);
239
+ return ox * ox + oy * oy + oz * oz < reach * reach;
240
+ }
241
+ // Where the pointer plane passes (object-local unit coords; the plane faces the camera):
242
+ // a few metres ahead of the eye inside the volume, else through the volume centre's depth.
243
+ const _pa = new THREE.Vector3(), _pd = new THREE.Vector3(), _pc = new THREE.Vector3();
244
+ function pointerAnchor(object, camera, u, out, ahead) {
245
+ const V = u.uVolume.value, C = u.uCam.value;
246
+ 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;
247
+ camera.getWorldDirection(_pd);
248
+ let dist = ahead || 4.5;
249
+ if (!inside) {
250
+ object.updateWorldMatrix(true, false);
251
+ object.localToWorld(_pc.set(0, 0.5, 0));
252
+ dist = Math.max(dist, _pc.sub(camera.position).dot(_pd));
253
+ }
254
+ _pa.copy(camera.position).addScaledVector(_pd, dist);
255
+ return object.worldToLocal(out.copy(_pa));
256
+ }
257
+ const NOISE_GLSL = /* glsl */ `
258
+ uniform highp sampler3D uNoise;
259
+ float hash13(vec3 p) { p = fract(p * 0.1031); p += dot(p, p.zyx + 31.32); return fract((p.x + p.y) * p.z); }
260
+ 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); }
261
+ // value noise from the lattice texture: the smoothstep is put into the coordinate, the trilinear
262
+ // filter does the eight-corner mix (same lattice values as hash13 around the origin)
263
+ float vnoise3(vec3 p) {
264
+ vec3 i = floor(p); vec3 f = fract(p); f = f * f * (3.0 - 2.0 * f);
265
+ return texture(uNoise, (i + f + ${(0.5 + NOISE_N / 2).toFixed(1)}) / ${NOISE_N.toFixed(1)}).r;
266
+ }
267
+ float vnoise2(vec2 p) {
268
+ vec2 i = floor(p); vec2 f = fract(p); f = f * f * (3.0 - 2.0 * f);
269
+ 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);
270
+ }
271
+ // three octaves, rotated between octaves so the lattice never lines up
272
+ float fbm3(vec3 p) {
273
+ float s = 0.5 * vnoise3(p);
274
+ p = mat3(0.00, 0.80, 0.60, -0.80, 0.36, -0.48, -0.60, -0.48, 0.64) * p * 2.03;
275
+ s += 0.25 * vnoise3(p);
276
+ p = mat3(0.00, 0.80, 0.60, -0.80, 0.36, -0.48, -0.60, -0.48, 0.64) * p * 2.01;
277
+ s += 0.125 * vnoise3(p);
278
+ return s / 0.875;
279
+ }
280
+ float bump(float x) { float t = clamp(1.0 - x * x, 0.0, 1.0); return t * t; }
281
+ float hgPhase(float mu, float g) { return 0.0795775 * (1.0 - g * g) / pow(1.0 + g * g - 2.0 * g * mu, 1.5); }
282
+ float ign(vec2 px) { return fract(52.9829189 * fract(dot(px, vec2(0.06711056, 0.00583715)))); }
283
+ `;
284
+ const COMMON_UNIFORMS_GLSL = /* glsl */ `
285
+ uniform float uTime, uWindStrength, uTurb, uTurbPhase, uSpeed, uFollow, uViewH;
286
+ uniform vec2 uWind, uWindDir;
287
+ uniform vec3 uVolume, uCam;
288
+ uniform vec3 uSunDir, uSunColor, uSkyAmbient, uColor, uShadeColor, uPointerColor;
289
+ uniform float uIntensity, uOpacity;
290
+ uniform vec3 uPointer, uPointerVel;
291
+ uniform float uPointerActive, uPointerMode, uPointerStrength, uPointerRadius;
292
+ `;
293
+ const FOG_V = /* glsl */ `
294
+ #ifdef USE_FOG
295
+ varying float vFogDepth;
296
+ #endif
297
+ `;
298
+ const FOG_F = /* glsl */ `
299
+ #ifdef USE_FOG
300
+ uniform vec3 fogColor;
301
+ varying float vFogDepth;
302
+ #ifdef FOG_EXP2
303
+ uniform float fogDensity;
304
+ #else
305
+ uniform float fogNear;
306
+ uniform float fogFar;
307
+ #endif
308
+ #endif
309
+ `;
310
+ const FOG_APPLY = /* glsl */ `
311
+ #ifdef USE_FOG
312
+ #ifdef FOG_EXP2
313
+ float fogFactor = 1.0 - exp(-fogDensity * fogDensity * vFogDepth * vFogDepth);
314
+ #else
315
+ float fogFactor = smoothstep(fogNear, fogFar, vFogDepth);
316
+ #endif
317
+ gl_FragColor.rgb = mix(gl_FragColor.rgb, fogColor * gl_FragColor.a, fogFactor);
318
+ #endif
319
+ `;
320
+ /** Soft walls of the volume (metres); the ground is hard. */
321
+ const VOLUME_GLSL = /* glsl */ `
322
+ float volumeFade(vec3 p, float side, float top) {
323
+ float a = step(0.0, p.y) * (1.0 - smoothstep(uVolume.y - top, uVolume.y, p.y));
324
+ if (uFollow < 0.5) {
325
+ vec2 e = 0.5 * uVolume.xz - abs(p.xz);
326
+ a *= smoothstep(0.0, side, e.x) * smoothstep(0.0, side, e.y);
327
+ }
328
+ return a;
329
+ }
330
+ `;
331
+ const SLICE_VERT = /* glsl */ `
332
+ ${COMMON_UNIFORMS_GLSL}
333
+ uniform float uSliceNear, uSliceFar, uSliceCount;
334
+ uniform vec4 uSliceRect;
335
+ uniform mat4 uCamToLocal;
336
+ attribute vec2 aCorner;
337
+ attribute float aSlice;
338
+ varying vec3 vLocal;
339
+ varying vec3 vRay;
340
+ varying float vDz, vSlice;
341
+ ${FOG_V}
342
+ void main() {
343
+ // slice 0 is the farthest: instances draw back to front
344
+ float k = log(uSliceFar / uSliceNear);
345
+ float t0 = 1.0 - (aSlice + 1.0) / uSliceCount;
346
+ float t1 = 1.0 - aSlice / uSliceCount;
347
+ float z0 = uSliceNear * exp(k * t0);
348
+ float z1 = uSliceNear * exp(k * t1);
349
+ float z = 0.5 * (z0 + z1);
350
+ vDz = z1 - z0;
351
+ // the quad spans the volume's bounds on screen (NDC), not the screen
352
+ vec2 ndc = mix(uSliceRect.xy, uSliceRect.zw, aCorner * 0.5 + 0.5);
353
+ vec3 view = vec3((ndc.x + projectionMatrix[2][0]) * z / projectionMatrix[0][0], (ndc.y + projectionMatrix[2][1]) * z / projectionMatrix[1][1], -z);
354
+ vSlice = aSlice;
355
+ gl_Position = projectionMatrix * vec4(view, 1.0);
356
+ vLocal = (uCamToLocal * vec4(view, 1.0)).xyz * uVolume;
357
+ vRay = vLocal - uCam;
358
+ #ifdef USE_FOG
359
+ vFogDepth = z;
360
+ #endif
361
+ }
362
+ `;
363
+ /**
364
+ * Wraps an object's `vec4 sliceSample(vec3 p, vec3 rd, float dz)` (premultiplied rgb, alpha).
365
+ *
366
+ * The canvas stores display (non-linear) values. By default the premultiplied colour goes through
367
+ * the output transform as it is, which makes a thin layer brighter than its share: the look then
368
+ * depends on how thin the slabs are (the first objects were tuned by eye under it — leave them).
369
+ * `straight` converts the colour first and weights it by alpha after, so a medium looks the same
370
+ * at every slice count, density and quality; new objects use it.
371
+ */
372
+ function sliceFrag(body, straight) {
373
+ return /* glsl */ `
374
+ ${COMMON_UNIFORMS_GLSL}
375
+ uniform float uSkip;
376
+ varying vec3 vLocal;
377
+ varying vec3 vRay;
378
+ varying float vDz, vSlice;
379
+ ${FOG_F}
380
+ ${NOISE_GLSL}
381
+ ${VOLUME_GLSL}
382
+ ${body}
383
+ void main() {
384
+ // dense displays: neighbouring pixels take turns over the slices (see updateCommon)
385
+ if (uSkip > 1.5) {
386
+ vec2 px = mod(floor(gl_FragCoord.xy), 2.0);
387
+ float turn = uSkip > 3.0 ? mod(px.x * 2.0 + px.y * 3.0, 4.0) : mod(px.x + px.y, 2.0);
388
+ if (mod(vSlice + turn, uSkip) > 0.5) discard;
389
+ }
390
+ vec3 rd = normalize(vRay);
391
+ // dithered depth inside the slab: banding becomes grain
392
+ vec3 p = vLocal + rd * (ign(gl_FragCoord.xy) - 0.5) * 0.6 * vDz;
393
+ if (p.y < 0.0 || p.y > uVolume.y) discard;
394
+ if (uFollow < 0.5 && (abs(p.x) > 0.5 * uVolume.x || abs(p.z) > 0.5 * uVolume.z)) discard;
395
+ vec4 s = sliceSample(p, rd, vDz);
396
+ s *= uOpacity;
397
+ if (s.a < 0.0015 && dot(s.rgb, vec3(1.0)) < 0.002) discard;
398
+ gl_FragColor = ${straight ? 'vec4(s.rgb / max(s.a, 1e-5) * uIntensity, 1.0)' : 'vec4(s.rgb * uIntensity, s.a)'};
399
+ #include <tonemapping_fragment>
400
+ #include <colorspace_fragment>${straight ? '\n gl_FragColor = vec4(gl_FragColor.rgb * s.a, s.a);' : ''}
401
+ ${FOG_APPLY}
402
+ // A pixel that skipped slabs stands for them: it lays down what 2 or 4 copies of its own thin
403
+ // layer would have composited to (colour c (1 + t + ...), transmittance t^n), so the volume
404
+ // keeps exactly the brightness and opacity it has when every pixel takes every slice.
405
+ if (uSkip > 1.5) {
406
+ float t = 1.0 - gl_FragColor.a;
407
+ float t2 = t * t;
408
+ 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);
409
+ }
410
+ }
411
+ `;
412
+ }
413
+ function premulMaterial(u, vertexShader, fragmentShader, additive) {
414
+ return new THREE.ShaderMaterial({
415
+ uniforms: Object.assign({}, THREE.UniformsUtils.clone(THREE.UniformsLib.fog), u),
416
+ vertexShader, fragmentShader,
417
+ transparent: true, depthWrite: false, fog: true,
418
+ blending: THREE.CustomBlending,
419
+ blendSrc: THREE.OneFactor, blendDst: additive ? THREE.OneFactor : THREE.OneMinusSrcAlphaFactor,
420
+ blendSrcAlpha: THREE.OneFactor, blendDstAlpha: THREE.OneMinusSrcAlphaFactor,
421
+ premultipliedAlpha: true,
422
+ });
423
+ }
424
+ /** Bounds-only `position`: the unit volume box, so Box3.expandByObject centres the gizmo on it. */
425
+ function boxPositions(geo) {
426
+ 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));
427
+ geo.boundingSphere = new THREE.Sphere(new THREE.Vector3(0, 0.5, 0), 0.87);
428
+ }
429
+ /**
430
+ * One instanced draw of `count` view-aligned slices. `interleave` (1, 2 or 4, default 4) is the most
431
+ * sets of slices neighbouring pixels may take turns over on a dense display; 1 = every pixel, every slice.
432
+ */
433
+ function buildSlices(u, fragmentShader, count, interleave) {
434
+ const geo = new THREE.InstancedBufferGeometry();
435
+ boxPositions(geo);
436
+ geo.setAttribute('aCorner', new THREE.Float32BufferAttribute([-1, -1, 1, -1, 1, 1, -1, 1], 2));
437
+ geo.setIndex([0, 1, 2, 0, 2, 3]);
438
+ const idx = new Float32Array(count);
439
+ for (let i = 0; i < count; i++)
440
+ idx[i] = i;
441
+ geo.setAttribute('aSlice', new THREE.InstancedBufferAttribute(idx, 1));
442
+ geo.instanceCount = count;
443
+ u.uSliceCount.value = count;
444
+ u.uSkipMax.value = interleave || 4;
445
+ const mat = premulMaterial(u, SLICE_VERT, fragmentShader, false);
446
+ const mesh = new THREE.Mesh(geo, mat);
447
+ mesh.frustumCulled = false;
448
+ mesh.raycast = function () { };
449
+ return mesh;
450
+ }
451
+ /** Instanced quad geometry with per-instance seeds (two vec4s). */
452
+ function seededQuads(count, rnd) {
453
+ const geo = new THREE.InstancedBufferGeometry();
454
+ boxPositions(geo);
455
+ geo.setAttribute('aCorner', new THREE.Float32BufferAttribute([-1, -1, 1, -1, 1, 1, -1, 1], 2));
456
+ geo.setIndex([0, 1, 2, 0, 2, 3]);
457
+ const a = new Float32Array(count * 4), b = new Float32Array(count * 4);
458
+ for (let i = 0; i < count * 4; i++) {
459
+ a[i] = rnd();
460
+ b[i] = rnd();
461
+ }
462
+ geo.setAttribute('aSeedA', new THREE.InstancedBufferAttribute(a, 4));
463
+ geo.setAttribute('aSeedB', new THREE.InstancedBufferAttribute(b, 4));
464
+ geo.instanceCount = count;
465
+ return geo;
466
+ }
467
+ /** A streak quad between two view-space points, at least 1 px wide (energy kept by alpha). */
468
+ const STREAK_GLSL = /* glsl */ `
469
+ // returns the clip position of this corner; writes the coverage factor into cover
470
+ vec4 streakCorner(vec4 headV, vec4 tailV, vec2 corner, float widthM, out float cover, out float lenPx) {
471
+ vec4 h = projectionMatrix * headV;
472
+ vec4 t = projectionMatrix * tailV;
473
+ vec2 hs = h.xy / h.w, ts = t.xy / t.w;
474
+ vec2 scr = vec2(uViewH * projectionMatrix[1][1] / projectionMatrix[0][0], uViewH) * 0.5;
475
+ vec2 d = (hs - ts) * scr;
476
+ lenPx = length(d);
477
+ vec2 dir = lenPx > 1e-4 ? d / lenPx : vec2(0.0, 1.0);
478
+ vec2 nrm = vec2(dir.y, -dir.x); // (nrm, dir) right-handed: the quad stays front-facing
479
+ float wPx = widthM * uViewH * projectionMatrix[1][1] * 0.5 / max(-headV.z, 1e-3);
480
+ float w = max(wPx, 1.0);
481
+ cover = wPx / w;
482
+ vec4 base = corner.y > 0.0 ? h : t;
483
+ vec2 off = nrm * corner.x * 0.5 * w / scr;
484
+ // extend half a pixel past both ends so short streaks stay round
485
+ off += dir * corner.y * 0.5 / scr;
486
+ return vec4(base.xy + off * base.w, base.zw);
487
+ }
488
+ `;
489
+ // ---------------------------------------------------------------------------- tornado
490
+ // Tornado — environment object (lab module). Shared core: ./common.mjs.
491
+ // A standalone vortex: no debris particles, no parent cloud — the funnel dissolves into the sky.
492
+ // Construction:
493
+ // vortex a Rankine vortex on a wandering axis: solid-body rotation inside the core radius
494
+ // r_c, v ∝ 1/r outside, so the angular velocity is Ω inside and Ω (r_c / r)² outside.
495
+ // The foot wanders on slow incommensurate sines and the axis bends like a rope;
496
+ // the core widens with height.
497
+ // funnel condensation where the pressure deficit (r_c / r)² passes a threshold that rises
498
+ // toward the ground — "reach" lowers the funnel until it touches down.
499
+ // flow everything is sampled in the flow's own frame: the angle is advected by ω(r, y)
500
+ // (differential rotation: the inside spins faster, so streaks wind into spirals) and
501
+ // the height by the updraft (they climb). Streaks are helical — stretched along a
502
+ // helix whose pitch is the ratio of updraft to swirl. Winding never runs away: two
503
+ // copies of the field half a cycle apart are cross-faded with cosine weights
504
+ // (advected-texture regeneration), so each copy fades out before it resets.
505
+ // dust ground dust drawn into the vortex: an inflow layer whose streaks wind into spiral
506
+ // arms by the same differential rotation, lifted into a sheath that climbs the
507
+ // outside of the funnel, with fine wisps flung off the sheath.
508
+ // light the funnel is a condensation surface — lit on the sun side, sky-lit in shadow;
509
+ // the dust scatters forward (Henyey–Greenstein, g = 0.5).
510
+ const catalog = {
511
+ key: 'tornado',
512
+ name: 'Tornado',
513
+ description: 'A standalone tornado as a Rankine vortex: a condensation funnel on a wandering, rope-like axis with helical streaks that wind by differential rotation and climb on the updraft, and ground dust spiralling in and swirling up a sheath around it. The cursor steers it, feeds it or bends it with a gust. Use for storm and drama scenes.',
514
+ tags: ['tornado', 'vortex', 'storm', 'twister', 'weather', 'interactive'],
515
+ structural: ['density', 'quality', 'seed'],
516
+ pointerModes: ['steer', 'feed', 'gust'],
517
+ pointerLabels: ['Steer', 'Feed', 'Gust'],
518
+ volume: [160, 90, 160],
519
+ staging: { sky: '#5f6670', ground: '#4f5a44', fog: 0.0028, sunEl: 22, sunAz: 120, inside: [[0, 2, 70], [0, 28, 0]], outside: [[0, 18, 220], [0, 34, 0]] },
520
+ pointerAhead: 60,
521
+ };
522
+ const QUALITY = { low: 22, medium: 36, high: 52 };
523
+ const REGEN = 8.0; // spin units before a copy of the flow field is regenerated
524
+ function createUniforms() {
525
+ return Object.assign(createCommonUniforms(), {
526
+ uSigma: { value: 0.06 },
527
+ uRotation: { value: 1 },
528
+ uCore: { value: 1 },
529
+ uReach: { value: 0.9 },
530
+ uWander: { value: 0.5 },
531
+ uLift: { value: 1 },
532
+ uDust: { value: 1 },
533
+ uDustSpread: { value: 1 },
534
+ uDustColor: { value: new THREE.Color('#8a7358') },
535
+ uSpin: { value: 0 },
536
+ uRise: { value: 0 },
537
+ uWanderPhase: { value: 0 },
538
+ uBase: { value: new THREE.Vector2() },
539
+ uFeed: { value: 0 },
540
+ uBend: { value: new THREE.Vector3() },
541
+ });
542
+ }
543
+ function applyConfig(u, c) {
544
+ applyCommonConfig(u, c, catalog.pointerModes);
545
+ if (c.rotation !== undefined)
546
+ u.uRotation.value = c.rotation;
547
+ if (c.coreRadius !== undefined)
548
+ u.uCore.value = c.coreRadius;
549
+ if (c.reach !== undefined)
550
+ u.uReach.value = c.reach;
551
+ if (c.wander !== undefined)
552
+ u.uWander.value = c.wander;
553
+ if (c.lift !== undefined)
554
+ u.uLift.value = c.lift;
555
+ if (c.dust !== undefined)
556
+ u.uDust.value = c.dust;
557
+ if (c.dustSpread !== undefined)
558
+ u.uDustSpread.value = c.dustSpread;
559
+ setColor(u.uDustColor, c.dustColor);
560
+ }
561
+ const VORTEX = /* glsl */ `
562
+ uniform float uSigma, uRotation, uCore, uReach, uWander, uLift, uDust, uDustSpread, uSpin, uRise, uWanderPhase, uFeed;
563
+ uniform vec2 uBase;
564
+ uniform vec3 uBend, uDustColor;
565
+ // axis centre at height y (metres): the foot at uBase, rope-like bends, leaning downwind with height
566
+ vec2 axisAt(float y) {
567
+ float H = uVolume.y, h = clamp(y / H, 0.0, 1.0);
568
+ vec2 w = vec2(sin(uWanderPhase * 0.31 + h * 2.3) + 0.5 * sin(uWanderPhase * 0.53 + h * 5.1 + 1.7),
569
+ cos(uWanderPhase * 0.27 + h * 2.9 + 0.4) + 0.5 * sin(uWanderPhase * 0.47 + h * 4.3));
570
+ vec2 c = uBase * pow(1.0 - h, 1.3) + w * uWander * 0.1 * H * sin(3.14159 * h * 0.9 + 0.2);
571
+ c += uWindDir * uWindStrength * 0.15 * H * h * h;
572
+ c += uBend.xz * exp(-pow((y - uBend.y) / (0.18 * H * max(uPointerRadius, 0.2)), 2.0));
573
+ return c;
574
+ }
575
+ float coreAt(float y) {
576
+ float h = clamp(y / uVolume.y, 0.0, 1.0);
577
+ float r0 = 0.045 * min(uVolume.x, uVolume.z) * uCore * (1.0 + 0.5 * uFeed);
578
+ return r0 * (0.65 + 0.35 * h + 1.4 * pow(smoothstep(0.55, 1.0, h), 2.0));
579
+ }
580
+ // the flow field seen from the air itself: angle advected by omega(r, y), height by the updraft,
581
+ // streaks stretched along a helix; two regenerating copies, cosine-weighted
582
+ float flow(vec3 p, vec2 c, float r, float rc, float angFreq, float radFreq, float vFreq, float pitch, float seed) {
583
+ vec2 d = p.xz - c;
584
+ float phi = atan(d.y, d.x);
585
+ float omega = 5.0 * (r < rc ? 1.0 : (rc * rc) / (r * r));
586
+ float up = uLift * (0.6 + 0.8 * exp(-max(r - rc, 0.0) / (2.0 * rc)));
587
+ float acc = 0.0;
588
+ for (int k = 0; k < 2; k++) {
589
+ float t = mod(uSpin + float(k) * ${(REGEN / 2).toFixed(1)}, ${REGEN.toFixed(1)});
590
+ float w = 0.5 - 0.5 * cos(6.2831853 * t / ${REGEN.toFixed(1)});
591
+ float a = phi - omega * t;
592
+ float v = p.y * vFreq - up * uRise * vFreq * 4.0 + a * pitch; // constant v: a helix
593
+ vec3 q = vec3(cos(a) * angFreq, v, sin(a) * angFreq) + vec3(r * radFreq) + seed + float(k) * 17.3;
594
+ acc += w * fbm3(q);
595
+ }
596
+ return acc;
597
+ }
598
+ vec4 sliceSample(vec3 p, vec3 rd, float dz) {
599
+ float H = uVolume.y;
600
+ float h = p.y / H;
601
+ vec2 c = axisAt(p.y);
602
+ float r = length(p.xz - c);
603
+ float rc = coreAt(p.y);
604
+ // standalone: the top dissolves into the sky
605
+ float fade = volumeFade(p, min(10.0, 0.06 * uVolume.x), 0.22 * H);
606
+ if (fade <= 0.0) return vec4(0.0);
607
+
608
+ // The flow field is by far the costliest thing here (two fbm per call, three calls), and most of
609
+ // the volume is clear air. So first find out, without it, whether anything can be here at all:
610
+ // the funnel only where the pressure deficit can pass its threshold, the dust only inside its ring.
611
+
612
+ // funnel: pressure deficit against a threshold rising toward the ground
613
+ float reach = clamp(uReach + 0.25 * uFeed, 0.0, 1.2);
614
+ float thr = mix(0.3, 4.0, pow(clamp(1.0 - h - (reach - 0.5) * 1.1, 0.0, 1.0), 1.5));
615
+ // the ragged outline moves the radius by at most 0.35 core radii: the deficit is largest there
616
+ float rIn = max(r - 0.35 * rc, 0.0);
617
+ bool canFunnel = (rIn < rc ? 2.0 - (rIn * rIn) / (rc * rc) : (rc * rc) / (rIn * rIn)) > thr * 0.75;
618
+
619
+ // dust: inflow layer at the ground, a sheath climbing the funnel, clumps and wisps flung round it
620
+ float spread = uDustSpread * (1.0 + 0.6 * uFeed);
621
+ float outer = rc * (3.0 + 6.0 * spread);
622
+ float ring = 0.0, near = 0.0, hp = 0.0;
623
+ if (uDust > 0.001 && r < outer * 1.2) {
624
+ ring = smoothstep(0.55 * rc, 1.05 * rc, r) * (1.0 - smoothstep(0.45 * outer, outer, r));
625
+ near = exp(-max(r - rc, 0.0) / (1.6 * rc));
626
+ float lift = mix(5.0 + 0.2 * rc, 0.5 * H * uLift, near);
627
+ hp = exp(-p.y / max(lift, 0.5));
628
+ }
629
+ float dustGain = uDust * (1.0 + 0.8 * uFeed) * ring * hp;
630
+ // without a funnel, dust thinner than the cut below (at its thickest: every clump and wisp) is nothing
631
+ bool canDust = dustGain > 0.0 && (canFunnel || dustGain * (0.15 + 3.0 + 1.2 * (0.4 + near)) * 0.9 * fade >= 0.003);
632
+ if (!canFunnel && !canDust) return vec4(0.0);
633
+
634
+ float funnel = 0.0;
635
+ if (canFunnel) {
636
+ // the condensation surface is ragged: rotating lobes move its outline
637
+ float s = flow(p, c, r, rc, 0.9, 0.04, 0.12, 0.25, 0.0);
638
+ float rr = max(r + (s - 0.5) * 0.7 * rc, 0.0);
639
+ float deficit = rr < rc ? 2.0 - (rr * rr) / (rc * rc) : (rc * rc) / (rr * rr);
640
+ float edge = smoothstep(thr * 0.75, thr * 1.25, deficit);
641
+ funnel = edge * (0.2 + 0.8 * smoothstep(0.38, 0.64, s));
642
+ }
643
+ float dust = 0.0;
644
+ if (canDust) {
645
+ // billowing clumps orbiting at the local angular speed, wound into spiral arms
646
+ float clumps = smoothstep(0.45, 0.7, flow(p, c, r, rc, 0.7, 0.08, 0.1, 0.35, 31.0));
647
+ float wisps = smoothstep(0.58, 0.8, flow(p, c, r, rc, 1.8, 0.2, 0.25, 0.5, 71.0));
648
+ dust = dustGain * (0.15 + 3.0 * clumps + 1.2 * wisps * (0.4 + near));
649
+ }
650
+
651
+ float d = (funnel * 3.0 + dust * 0.9) * fade;
652
+ if (d < 0.003) return vec4(0.0);
653
+ float a = 1.0 - exp(-uSigma * d * dz);
654
+ float sunUp = smoothstep(-0.05, 0.1, uSunDir.y);
655
+ vec3 nrm = normalize(vec3(p.x - c.x, 0.0, p.z - c.y) + vec3(0.0, 1e-3, 0.0));
656
+ float lam = 0.45 + 0.55 * dot(nrm, uSunDir);
657
+ vec3 amb = uSkyAmbient * uShadeColor * 1.3;
658
+ vec3 sun = uSunColor * sunUp;
659
+ float dustShare = dust * 0.9 / max(funnel * 3.0 + dust * 0.9, 1e-4);
660
+ // the foot of the funnel is stained by the dust it is wrapped in
661
+ float stain = clamp(dustShare + (1.0 - smoothstep(0.0, 0.2, h)) * 0.5, 0.0, 1.0);
662
+ vec3 funnelCol = mix(uColor, uDustColor, stain * 0.6) * (amb + sun * 0.4 * lam);
663
+ // dust the cursor feeds in takes the pointer colour
664
+ vec3 dustCol = mix(uDustColor, uPointerColor, 0.5 * uFeed) * (amb * 1.2 + sun * (0.18 + hgPhase(dot(rd, uSunDir), 0.5) * 0.6));
665
+ vec3 col = mix(funnelCol, dustCol, dustShare);
666
+ return vec4(min(col, vec3(1.0)) * a, a);
667
+ }
668
+ `;
669
+ function build(u, c) {
670
+ u.uSigma.value = 0.06 * Math.max(0.05, c.density ?? 1);
671
+ // every pixel takes every slice: the funnel's fine rotating structure does not survive interleaving
672
+ const slices = buildSlices(u, sliceFrag(VORTEX, false), QUALITY[c.quality] || 36, 1);
673
+ const object = new THREE.Group();
674
+ object.name = 'tornado';
675
+ object.add(slices);
676
+ const target = new THREE.Vector2(), bendTarget = new THREE.Vector3();
677
+ return {
678
+ object,
679
+ materials: [slices.material],
680
+ apply: function (cfg) { applyConfig(u, cfg); },
681
+ update: function (dt, camera, viewH, sunWorld, dpr) {
682
+ updateCommon(u, object, camera, dt, viewH, sunWorld, dpr);
683
+ const sp = u.uSpeed.value;
684
+ // spin and updraft integrated on the CPU: animating rotation or lift never jumps
685
+ u.uSpin.value += dt * sp * u.uRotation.value * (1.0 + 0.4 * u.uFeed.value);
686
+ u.uRise.value += dt * sp * (1.0 + 0.5 * u.uFeed.value);
687
+ u.uWanderPhase.value += dt * sp * 0.25;
688
+ // pointer: steer the foot, feed the inflow, or bend the funnel with a gust
689
+ const mode = u.uPointerMode.value, act = u.uPointerActive.value * u.uPointerStrength.value;
690
+ const V = u.uVolume.value, P = u.uPointer.value, PV = u.uPointerVel.value;
691
+ const lim = 0.35 * Math.min(V.x, V.z);
692
+ if (mode === 0 && act > 0.001)
693
+ target.set(P.x * V.x, P.z * V.z).clampLength(0, lim).multiplyScalar(Math.min(act, 1));
694
+ else
695
+ target.set(0, 0);
696
+ const step = Math.min(1, dt * 0.6), maxMove = dt * 9;
697
+ const dx = (target.x - u.uBase.value.x) * step, dy = (target.y - u.uBase.value.y) * step;
698
+ const m = Math.hypot(dx, dy), s = m > maxMove ? maxMove / m : 1;
699
+ u.uBase.value.x += dx * s;
700
+ u.uBase.value.y += dy * s;
701
+ const feed = mode === 1 ? Math.min(1, act * (0.5 + 0.08 * PV.length() * V.x)) : 0;
702
+ u.uFeed.value += (feed - u.uFeed.value) * Math.min(1, dt * (feed > u.uFeed.value ? 1.5 : 0.4));
703
+ if (mode === 2 && act > 0.001)
704
+ bendTarget.set(PV.x * V.x * 0.8, P.y * V.y, PV.z * V.z * 0.8);
705
+ else
706
+ bendTarget.set(0, u.uBend.value.y, 0);
707
+ const bl = Math.hypot(bendTarget.x, bendTarget.z), cap = 0.12 * V.x;
708
+ if (bl > cap) {
709
+ bendTarget.x *= cap / bl;
710
+ bendTarget.z *= cap / bl;
711
+ }
712
+ const bs = Math.min(1, dt * 1.2);
713
+ u.uBend.value.x += (bendTarget.x * Math.min(act, 1) - u.uBend.value.x) * bs;
714
+ u.uBend.value.z += (bendTarget.z * Math.min(act, 1) - u.uBend.value.z) * bs;
715
+ u.uBend.value.y = bendTarget.y;
716
+ },
717
+ dispose: function () { slices.geometry.dispose(); slices.material.dispose(); },
718
+ };
719
+ }
720
+ // =============================================================================
721
+ // Component
722
+ // =============================================================================
723
+ const DEFAULTS = DEFAULT_ENVIRONMENT_OBJECTS.tornado;
724
+ /** Knobs that rebuild the object: never live, they change once, on commit. */
725
+ const STRUCTURAL = ['density', 'quality', 'seed'];
726
+ /** Knobs a keyframe or pointer binding may drive per frame — exactly what applyConfig pushes. */
727
+ const ANIMATABLE = new Set(ENVIRONMENT_OBJECTS_ANIMATABLE.tornado.map((p) => p.value));
728
+ /** The scene's sky fill is brighter than the medium's own ambient term expects. */
729
+ const SKY_FILL = 0.5;
730
+ /**
731
+ * A standalone tornado as a Rankine vortex: a condensation funnel on a wandering, rope-like axis with helical streaks that wind by differential rotation and climb on the updraft, and ground dust spiralling in and swirling up a sheath around it. The cursor steers it, feeds it or bends it with a gust. Use for storm and drama scenes.
732
+ *
733
+ * The volume is the parent's transform: x / z span its scale, y rises from its origin to scale.y.
734
+ */
735
+ const Tornado = ({ config, id, keyframes, mouseMove, onObjectReady, onObjectDispose }) => {
736
+ const rootRef = useRef(null);
737
+ useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
738
+ const cfg = useMemo(() => withConfigDefaults(DEFAULTS, config), [config]);
739
+ // uniforms outlive rebuilds, so phases and keyframes survive a structural change
740
+ const uniforms = useMemo(() => createUniforms(), []);
741
+ const instance = useMemo(() => build(uniforms, cfg), [uniforms, cfg.density, cfg.quality, cfg.seed]); // eslint-disable-line react-hooks/exhaustive-deps
742
+ useEffect(() => () => instance.dispose(), [instance]);
743
+ useLayoutEffect(() => { applyConfig(uniforms, cfg); }, [uniforms, cfg]);
744
+ const push = useCallback((merged) => { applyConfig(uniforms, merged); }, [uniforms]);
745
+ useConfigDriver({ rootRef, id, family: 'environment', base: cfg, structural: STRUCTURAL, allowed: ANIMATABLE, keyframes, mouseMove, push });
746
+ const pointer = usePointerField();
747
+ // the scene's sun, read-only: the same one the clouds, the water and the key light use
748
+ const sun = useCloudSun();
749
+ const anchor = useMemo(() => new THREE.Vector3(), []);
750
+ const buffer = useMemo(() => new THREE.Vector2(), []);
751
+ useFrame((state, delta) => {
752
+ const dt = Math.min(delta, 0.1);
753
+ const s = sun.update();
754
+ uniforms.uSunColor.value.copy(s.color);
755
+ uniforms.uSkyAmbient.value.copy(s.skyAmbient).multiplyScalar(SKY_FILL);
756
+ state.gl.getDrawingBufferSize(buffer);
757
+ instance.update(dt, state.camera, buffer.y, s.direction, state.viewport.dpr);
758
+ stepPointerField(uniforms, pointer, state.camera, instance.object, 1, dt, pointerAnchor(instance.object, state.camera, uniforms, anchor, 60));
759
+ });
760
+ return (_jsx("group", { ref: rootRef, children: _jsx("primitive", { object: instance.object }) }));
761
+ };
762
+ export default Tornado;