@3driseai/3drise-viewer 0.1.7 → 0.1.8

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 (259) hide show
  1. package/dist/components/Clouds.d.ts.map +1 -1
  2. package/dist/components/Clouds.js +0 -1
  3. package/dist/components/CloudsGenerator.d.ts +32 -0
  4. package/dist/components/CloudsGenerator.d.ts.map +1 -0
  5. package/dist/components/CloudsGenerator.js +58 -0
  6. package/dist/components/EnvironmentManager.d.ts +47 -5
  7. package/dist/components/EnvironmentManager.d.ts.map +1 -1
  8. package/dist/components/EnvironmentManager.js +35 -66
  9. package/dist/components/HdrEnvironment.d.ts +20 -0
  10. package/dist/components/HdrEnvironment.d.ts.map +1 -0
  11. package/dist/components/HdrEnvironment.js +44 -0
  12. package/dist/components/LandscapeBuilder.d.ts +23 -0
  13. package/dist/components/LandscapeBuilder.d.ts.map +1 -0
  14. package/dist/components/LandscapeBuilder.js +25 -0
  15. package/dist/components/LandscapeObject.d.ts +24 -0
  16. package/dist/components/LandscapeObject.d.ts.map +1 -0
  17. package/dist/components/LandscapeObject.js +27 -0
  18. package/dist/components/ObjectNode.d.ts.map +1 -1
  19. package/dist/components/ObjectNode.js +10 -0
  20. package/dist/components/OceanBuilder.d.ts +35 -0
  21. package/dist/components/OceanBuilder.d.ts.map +1 -0
  22. package/dist/components/OceanBuilder.js +53 -0
  23. package/dist/components/SceneBuilder.d.ts.map +1 -1
  24. package/dist/components/SkySystem.d.ts +27 -6
  25. package/dist/components/SkySystem.d.ts.map +1 -1
  26. package/dist/components/SkySystem.js +6 -5
  27. package/dist/components/SunLight.d.ts.map +1 -1
  28. package/dist/components/SunLight.js +4 -1
  29. package/dist/components/TerrainBuilder.d.ts +30 -0
  30. package/dist/components/TerrainBuilder.d.ts.map +1 -0
  31. package/dist/components/TerrainBuilder.js +44 -0
  32. package/dist/components/index.d.ts +17 -1
  33. package/dist/components/index.d.ts.map +1 -1
  34. package/dist/components/index.js +10 -0
  35. package/dist/components/landscape/LandscapeMesh.d.ts +18 -0
  36. package/dist/components/landscape/LandscapeMesh.d.ts.map +1 -0
  37. package/dist/components/landscape/LandscapeMesh.js +278 -0
  38. package/dist/components/landscape/index.d.ts +3 -0
  39. package/dist/components/landscape/index.d.ts.map +1 -0
  40. package/dist/components/landscape/index.js +1 -0
  41. package/dist/components/landscape/types.d.ts +13 -0
  42. package/dist/components/landscape/types.d.ts.map +1 -0
  43. package/dist/components/landscape/types.js +1 -0
  44. package/dist/components/terrain/Canyon.d.ts +23 -0
  45. package/dist/components/terrain/Canyon.d.ts.map +1 -0
  46. package/dist/components/terrain/Canyon.js +29 -0
  47. package/dist/components/terrain/Dunes.d.ts +22 -0
  48. package/dist/components/terrain/Dunes.d.ts.map +1 -0
  49. package/dist/components/terrain/Dunes.js +25 -0
  50. package/dist/components/terrain/Hills.d.ts +17 -0
  51. package/dist/components/terrain/Hills.d.ts.map +1 -0
  52. package/dist/components/terrain/Hills.js +20 -0
  53. package/dist/components/terrain/Mountains.d.ts +19 -0
  54. package/dist/components/terrain/Mountains.d.ts.map +1 -0
  55. package/dist/components/terrain/Mountains.js +22 -0
  56. package/dist/components/terrain/TerrainSurface.d.ts +22 -0
  57. package/dist/components/terrain/TerrainSurface.d.ts.map +1 -0
  58. package/dist/components/terrain/TerrainSurface.js +94 -0
  59. package/dist/components/terrain/index.d.ts +7 -0
  60. package/dist/components/terrain/index.d.ts.map +1 -0
  61. package/dist/components/terrain/index.js +7 -0
  62. package/dist/components/terrain/types.d.ts +17 -0
  63. package/dist/components/terrain/types.d.ts.map +1 -0
  64. package/dist/components/terrain/types.js +1 -0
  65. package/dist/components/volumetricClouds/Cirrus.d.ts +14 -0
  66. package/dist/components/volumetricClouds/Cirrus.d.ts.map +1 -0
  67. package/dist/components/volumetricClouds/Cirrus.js +13 -0
  68. package/dist/components/volumetricClouds/Cumulonimbus.d.ts +17 -0
  69. package/dist/components/volumetricClouds/Cumulonimbus.d.ts.map +1 -0
  70. package/dist/components/volumetricClouds/Cumulonimbus.js +20 -0
  71. package/dist/components/volumetricClouds/Cumulus.d.ts +14 -0
  72. package/dist/components/volumetricClouds/Cumulus.d.ts.map +1 -0
  73. package/dist/components/volumetricClouds/Cumulus.js +17 -0
  74. package/dist/components/volumetricClouds/Stratocumulus.d.ts +12 -0
  75. package/dist/components/volumetricClouds/Stratocumulus.d.ts.map +1 -0
  76. package/dist/components/volumetricClouds/Stratocumulus.js +16 -0
  77. package/dist/components/volumetricClouds/VolumetricCloudsPass.d.ts +42 -0
  78. package/dist/components/volumetricClouds/VolumetricCloudsPass.d.ts.map +1 -0
  79. package/dist/components/volumetricClouds/VolumetricCloudsPass.js +298 -0
  80. package/dist/components/volumetricClouds/index.d.ts +8 -0
  81. package/dist/components/volumetricClouds/index.d.ts.map +1 -0
  82. package/dist/components/volumetricClouds/index.js +7 -0
  83. package/dist/components/volumetricClouds/types.d.ts +17 -0
  84. package/dist/components/volumetricClouds/types.d.ts.map +1 -0
  85. package/dist/components/volumetricClouds/types.js +1 -0
  86. package/dist/components/water/Host.d.ts +12 -0
  87. package/dist/components/water/Host.d.ts.map +1 -0
  88. package/dist/components/water/Host.js +12 -0
  89. package/dist/components/water/Lake.d.ts +18 -0
  90. package/dist/components/water/Lake.d.ts.map +1 -0
  91. package/dist/components/water/Lake.js +21 -0
  92. package/dist/components/water/OceanSurface.d.ts +27 -0
  93. package/dist/components/water/OceanSurface.d.ts.map +1 -0
  94. package/dist/components/water/OceanSurface.js +60 -0
  95. package/dist/components/water/Sea.d.ts +18 -0
  96. package/dist/components/water/Sea.d.ts.map +1 -0
  97. package/dist/components/water/Sea.js +17 -0
  98. package/dist/components/water/Shore.d.ts +16 -0
  99. package/dist/components/water/Shore.d.ts.map +1 -0
  100. package/dist/components/water/Shore.js +15 -0
  101. package/dist/components/water/Storm.d.ts +14 -0
  102. package/dist/components/water/Storm.d.ts.map +1 -0
  103. package/dist/components/water/Storm.js +13 -0
  104. package/dist/components/water/WaterBody.d.ts +31 -0
  105. package/dist/components/water/WaterBody.d.ts.map +1 -0
  106. package/dist/components/water/WaterBody.js +76 -0
  107. package/dist/components/water/index.d.ts +9 -0
  108. package/dist/components/water/index.d.ts.map +1 -0
  109. package/dist/components/water/index.js +11 -0
  110. package/dist/components/water/types.d.ts +20 -0
  111. package/dist/components/water/types.d.ts.map +1 -0
  112. package/dist/components/water/types.js +1 -0
  113. package/dist/constants.d.ts.map +1 -1
  114. package/dist/constants.js +9 -0
  115. package/dist/hooks/index.d.ts +24 -1
  116. package/dist/hooks/index.d.ts.map +1 -1
  117. package/dist/hooks/index.js +12 -0
  118. package/dist/hooks/useClipmap.d.ts +71 -0
  119. package/dist/hooks/useClipmap.d.ts.map +1 -0
  120. package/dist/hooks/useClipmap.js +81 -0
  121. package/dist/hooks/useCloudLive.d.ts +29 -0
  122. package/dist/hooks/useCloudLive.d.ts.map +1 -0
  123. package/dist/hooks/useCloudLive.js +43 -0
  124. package/dist/hooks/useCloudNoise.d.ts +28 -0
  125. package/dist/hooks/useCloudNoise.d.ts.map +1 -0
  126. package/dist/hooks/useCloudNoise.js +128 -0
  127. package/dist/hooks/useCloudSun.d.ts +49 -0
  128. package/dist/hooks/useCloudSun.d.ts.map +1 -0
  129. package/dist/hooks/useCloudSun.js +84 -0
  130. package/dist/hooks/useCubeCamera.d.ts +27 -9
  131. package/dist/hooks/useCubeCamera.d.ts.map +1 -1
  132. package/dist/hooks/useCubeCamera.js +28 -70
  133. package/dist/hooks/useEnvironmentProbe.d.ts +32 -0
  134. package/dist/hooks/useEnvironmentProbe.d.ts.map +1 -0
  135. package/dist/hooks/useEnvironmentProbe.js +35 -0
  136. package/dist/hooks/useFrameRenderer.d.ts +15 -0
  137. package/dist/hooks/useFrameRenderer.d.ts.map +1 -0
  138. package/dist/hooks/useFrameRenderer.js +23 -0
  139. package/dist/hooks/useLandscapeLive.d.ts +29 -0
  140. package/dist/hooks/useLandscapeLive.d.ts.map +1 -0
  141. package/dist/hooks/useLandscapeLive.js +41 -0
  142. package/dist/hooks/useLandscapeMaps.d.ts +32 -0
  143. package/dist/hooks/useLandscapeMaps.d.ts.map +1 -0
  144. package/dist/hooks/useLandscapeMaps.js +138 -0
  145. package/dist/hooks/useOceanLive.d.ts +29 -0
  146. package/dist/hooks/useOceanLive.d.ts.map +1 -0
  147. package/dist/hooks/useOceanLive.js +38 -0
  148. package/dist/hooks/useOceanMaterial.d.ts +39 -0
  149. package/dist/hooks/useOceanMaterial.d.ts.map +1 -0
  150. package/dist/hooks/useOceanMaterial.js +65 -0
  151. package/dist/hooks/useTerrainClipmap.d.ts +12 -0
  152. package/dist/hooks/useTerrainClipmap.d.ts.map +1 -0
  153. package/dist/hooks/useTerrainClipmap.js +10 -0
  154. package/dist/hooks/useTerrainLive.d.ts +34 -0
  155. package/dist/hooks/useTerrainLive.d.ts.map +1 -0
  156. package/dist/hooks/useTerrainLive.js +45 -0
  157. package/dist/index.d.ts +26 -0
  158. package/dist/index.d.ts.map +1 -1
  159. package/dist/index.js +16 -0
  160. package/dist/presets/landscapePresets.d.ts +60 -0
  161. package/dist/presets/landscapePresets.d.ts.map +1 -0
  162. package/dist/presets/landscapePresets.js +194 -0
  163. package/dist/presets/landscapeTypes.d.ts +195 -0
  164. package/dist/presets/landscapeTypes.d.ts.map +1 -0
  165. package/dist/presets/landscapeTypes.js +315 -0
  166. package/dist/presets/oceanSurfacePresets.d.ts +33 -0
  167. package/dist/presets/oceanSurfacePresets.d.ts.map +1 -0
  168. package/dist/presets/oceanSurfacePresets.js +245 -0
  169. package/dist/presets/terrainPresets.d.ts +28 -0
  170. package/dist/presets/terrainPresets.d.ts.map +1 -0
  171. package/dist/presets/terrainPresets.js +293 -0
  172. package/dist/presets/volumetricCloudPresets.d.ts +38 -0
  173. package/dist/presets/volumetricCloudPresets.d.ts.map +1 -0
  174. package/dist/presets/volumetricCloudPresets.js +480 -0
  175. package/dist/shaders/clouds/CirrusMaterial.d.ts +84 -0
  176. package/dist/shaders/clouds/CirrusMaterial.d.ts.map +1 -0
  177. package/dist/shaders/clouds/CirrusMaterial.js +167 -0
  178. package/dist/shaders/clouds/CloudCompositeMaterial.d.ts +20 -0
  179. package/dist/shaders/clouds/CloudCompositeMaterial.d.ts.map +1 -0
  180. package/dist/shaders/clouds/CloudCompositeMaterial.js +82 -0
  181. package/dist/shaders/clouds/CloudResolveMaterial.d.ts +22 -0
  182. package/dist/shaders/clouds/CloudResolveMaterial.d.ts.map +1 -0
  183. package/dist/shaders/clouds/CloudResolveMaterial.js +77 -0
  184. package/dist/shaders/clouds/CloudVolumeMaterial.d.ts +143 -0
  185. package/dist/shaders/clouds/CloudVolumeMaterial.d.ts.map +1 -0
  186. package/dist/shaders/clouds/CloudVolumeMaterial.js +249 -0
  187. package/dist/shaders/clouds/SkyBackgroundMaterial.d.ts +21 -0
  188. package/dist/shaders/clouds/SkyBackgroundMaterial.d.ts.map +1 -0
  189. package/dist/shaders/clouds/SkyBackgroundMaterial.js +42 -0
  190. package/dist/shaders/glsl/cloudCore.glsl.d.ts +24 -0
  191. package/dist/shaders/glsl/cloudCore.glsl.d.ts.map +1 -0
  192. package/dist/shaders/glsl/cloudCore.glsl.js +348 -0
  193. package/dist/shaders/glsl/landscapeCore.glsl.d.ts +49 -0
  194. package/dist/shaders/glsl/landscapeCore.glsl.d.ts.map +1 -0
  195. package/dist/shaders/glsl/landscapeCore.glsl.js +518 -0
  196. package/dist/shaders/glsl/noiseBake.glsl.d.ts +30 -0
  197. package/dist/shaders/glsl/noiseBake.glsl.d.ts.map +1 -0
  198. package/dist/shaders/glsl/noiseBake.glsl.js +164 -0
  199. package/dist/shaders/glsl/oceanCore.glsl.d.ts +52 -0
  200. package/dist/shaders/glsl/oceanCore.glsl.d.ts.map +1 -0
  201. package/dist/shaders/glsl/oceanCore.glsl.js +421 -0
  202. package/dist/shaders/glsl/terrainCore.glsl.d.ts +78 -0
  203. package/dist/shaders/glsl/terrainCore.glsl.d.ts.map +1 -0
  204. package/dist/shaders/glsl/terrainCore.glsl.js +625 -0
  205. package/dist/shaders/landscape/LandscapeMaterial.d.ts +73 -0
  206. package/dist/shaders/landscape/LandscapeMaterial.d.ts.map +1 -0
  207. package/dist/shaders/landscape/LandscapeMaterial.js +136 -0
  208. package/dist/shaders/ocean/OceanSurfaceMaterial.d.ts +57 -0
  209. package/dist/shaders/ocean/OceanSurfaceMaterial.d.ts.map +1 -0
  210. package/dist/shaders/ocean/OceanSurfaceMaterial.js +268 -0
  211. package/dist/shaders/terrain/TerrainMaterial.d.ts +80 -0
  212. package/dist/shaders/terrain/TerrainMaterial.d.ts.map +1 -0
  213. package/dist/shaders/terrain/TerrainMaterial.js +291 -0
  214. package/dist/types/cloudConfigs.d.ts +244 -0
  215. package/dist/types/cloudConfigs.d.ts.map +1 -0
  216. package/dist/types/cloudConfigs.js +282 -0
  217. package/dist/types/index.d.ts +8 -0
  218. package/dist/types/index.d.ts.map +1 -1
  219. package/dist/types/index.js +4 -1
  220. package/dist/types/landscapeConfigs.d.ts +218 -0
  221. package/dist/types/landscapeConfigs.d.ts.map +1 -0
  222. package/dist/types/landscapeConfigs.js +256 -0
  223. package/dist/types/oceanConfigs.d.ts +290 -0
  224. package/dist/types/oceanConfigs.d.ts.map +1 -0
  225. package/dist/types/oceanConfigs.js +380 -0
  226. package/dist/types/terrainConfigs.d.ts +251 -0
  227. package/dist/types/terrainConfigs.d.ts.map +1 -0
  228. package/dist/types/terrainConfigs.js +292 -0
  229. package/dist/utils/cloudUniforms.d.ts +14 -0
  230. package/dist/utils/cloudUniforms.d.ts.map +1 -0
  231. package/dist/utils/cloudUniforms.js +122 -0
  232. package/dist/utils/frameRenderer.d.ts +33 -0
  233. package/dist/utils/frameRenderer.d.ts.map +1 -0
  234. package/dist/utils/frameRenderer.js +24 -0
  235. package/dist/utils/handleCloudsAnimations.d.ts +16 -0
  236. package/dist/utils/handleCloudsAnimations.d.ts.map +1 -0
  237. package/dist/utils/handleCloudsAnimations.js +64 -0
  238. package/dist/utils/landscapeGeometry.d.ts +61 -0
  239. package/dist/utils/landscapeGeometry.d.ts.map +1 -0
  240. package/dist/utils/landscapeGeometry.js +126 -0
  241. package/dist/utils/landscapeHeight.d.ts +44 -0
  242. package/dist/utils/landscapeHeight.d.ts.map +1 -0
  243. package/dist/utils/landscapeHeight.js +65 -0
  244. package/dist/utils/landscapeTextures.d.ts +94 -0
  245. package/dist/utils/landscapeTextures.d.ts.map +1 -0
  246. package/dist/utils/landscapeTextures.js +290 -0
  247. package/dist/utils/landscapeUniforms.d.ts +20 -0
  248. package/dist/utils/landscapeUniforms.d.ts.map +1 -0
  249. package/dist/utils/landscapeUniforms.js +61 -0
  250. package/dist/utils/oceanUniforms.d.ts +47 -0
  251. package/dist/utils/oceanUniforms.d.ts.map +1 -0
  252. package/dist/utils/oceanUniforms.js +216 -0
  253. package/dist/utils/rtin.d.ts +63 -0
  254. package/dist/utils/rtin.d.ts.map +1 -0
  255. package/dist/utils/rtin.js +202 -0
  256. package/dist/utils/terrainUniforms.d.ts +14 -0
  257. package/dist/utils/terrainUniforms.d.ts.map +1 -0
  258. package/dist/utils/terrainUniforms.js +196 -0
  259. package/package.json +2 -2
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import type { OceanLayerProps } from './types';
3
+ /**
4
+ * A placed body of water — a pool, a pond, a canal, a flooded room.
5
+ *
6
+ * The object host, and the counterpart to the clouds' object host: bounded,
7
+ * transformable, and as many of them in a scene as you like. It runs the same
8
+ * material and the same wave field as the world ocean; what differs is the mesh
9
+ * and two uniforms.
10
+ *
11
+ * Three things follow from being bounded:
12
+ *
13
+ * **It has a transform, and its level comes from that.** `meshSettings.position.y`
14
+ * is the surface height, so two bodies at different heights in one scene need no
15
+ * coordination — and none of them is tied to the terrain's sea level either.
16
+ *
17
+ * **Waves are evaluated in its own space,** so they rotate with it and a rotated
18
+ * canal has waves running along the canal rather than along the world axes. The
19
+ * material switches on `u_bodyHalf` being non-zero.
20
+ *
21
+ * **Waves longer than the body are meaningless,** so the spectrum is clamped by
22
+ * its size before it reaches the table: a three-metre pool with forty-metre swell
23
+ * is one rigid slab tilting up and down. `OBJECT_HOST_OVERRIDES` sets the
24
+ * defaults for that; this clamps whatever the user then asks for.
25
+ *
26
+ * The rim taper (`edgeFade`) is in the vertex shader — without it the boundary
27
+ * is a sawn-off cliff of water.
28
+ */
29
+ declare const WaterBody: React.FC<OceanLayerProps>;
30
+ export default WaterBody;
31
+ //# sourceMappingURL=WaterBody.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WaterBody.d.ts","sourceRoot":"","sources":["../../../src/components/water/WaterBody.tsx"],"names":[],"mappings":"AACA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAGlD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAsExC,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,76 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as THREE from 'three';
3
+ import { useEffect, useMemo } from 'react';
4
+ import { useObjectReady } from '../../hooks/useObjectReady.js';
5
+ import { useOceanMaterial } from '../../hooks/useOceanMaterial.js';
6
+ /**
7
+ * A placed body of water — a pool, a pond, a canal, a flooded room.
8
+ *
9
+ * The object host, and the counterpart to the clouds' object host: bounded,
10
+ * transformable, and as many of them in a scene as you like. It runs the same
11
+ * material and the same wave field as the world ocean; what differs is the mesh
12
+ * and two uniforms.
13
+ *
14
+ * Three things follow from being bounded:
15
+ *
16
+ * **It has a transform, and its level comes from that.** `meshSettings.position.y`
17
+ * is the surface height, so two bodies at different heights in one scene need no
18
+ * coordination — and none of them is tied to the terrain's sea level either.
19
+ *
20
+ * **Waves are evaluated in its own space,** so they rotate with it and a rotated
21
+ * canal has waves running along the canal rather than along the world axes. The
22
+ * material switches on `u_bodyHalf` being non-zero.
23
+ *
24
+ * **Waves longer than the body are meaningless,** so the spectrum is clamped by
25
+ * its size before it reaches the table: a three-metre pool with forty-metre swell
26
+ * is one rigid slab tilting up and down. `OBJECT_HOST_OVERRIDES` sets the
27
+ * defaults for that; this clamps whatever the user then asks for.
28
+ *
29
+ * The rim taper (`edgeFade`) is in the vertex shader — without it the boundary
30
+ * is a sawn-off cliff of water.
31
+ */
32
+ const WaterBody = ({ id = '3drise-water-body', config, quality, skySettings, timeSettings, sunIntensity = 1, meshSettings, onObjectReady, onObjectDispose, }) => {
33
+ const [width, depth] = config.size;
34
+ // A body cannot carry a wave longer than it is: fetch is capped at its own
35
+ // extent, which is physically what fetch MEANS — the open water upwind.
36
+ const bounded = useMemo(() => ({
37
+ ...config,
38
+ fetch: Math.min(config.fetch, Math.max(width, depth) / 1000),
39
+ }), [config, width, depth]);
40
+ const geometry = useMemo(() => {
41
+ const segments = Math.max(4, Math.min(Math.round(config.segments), 1024));
42
+ const geo = new THREE.PlaneGeometry(Math.max(width, 0.01), Math.max(depth, 0.01), segments, segments);
43
+ // PlaneGeometry is built in XY; the water field is XZ, and rotating the
44
+ // mesh instead would rotate the transform the user edits.
45
+ geo.rotateX(-Math.PI / 2);
46
+ const count = geo.attributes.position.count;
47
+ const cell = Math.max(width, depth) / segments;
48
+ // The material reads all three on both hosts. A body has no coarser ring
49
+ // to morph toward, so the morph attributes are zero and `cellLod` is just
50
+ // the cell — which is still what the per-wave LOD fade needs, so a pool
51
+ // does not try to draw ripples finer than its own grid.
52
+ geo.setAttribute('aCell', new THREE.BufferAttribute(new Float32Array(count).fill(cell), 1));
53
+ geo.setAttribute('aMorph', new THREE.BufferAttribute(new Float32Array(count), 1));
54
+ geo.setAttribute('aCoarse', new THREE.BufferAttribute(new Float32Array(count * 2), 2));
55
+ // Displaced in the vertex shader, so the computed bounds are a flat
56
+ // rectangle. Unlike the clipmap this SHOULD cull — a pool behind the
57
+ // camera is not on screen — so the sphere is grown rather than made
58
+ // infinite.
59
+ geo.computeBoundingSphere();
60
+ if (geo.boundingSphere)
61
+ geo.boundingSphere.radius *= 1.2;
62
+ return geo;
63
+ }, [width, depth, config.segments]);
64
+ useEffect(() => () => { geometry.dispose(); }, [geometry]);
65
+ const { material, rootRef } = useOceanMaterial({
66
+ id,
67
+ config: bounded,
68
+ quality,
69
+ skySettings,
70
+ timeSettings,
71
+ sunIntensity,
72
+ });
73
+ useObjectReady(rootRef, { id, type: 'ocean', config, quality }, onObjectReady, onObjectDispose);
74
+ return (_jsx("group", { ref: rootRef, position: meshSettings?.position ?? [0, config.seaLevel, 0], rotation: meshSettings?.rotation ?? [0, 0, 0], scale: meshSettings?.scale ?? [1, 1, 1], visible: meshSettings ? meshSettings.visible !== false : true, children: _jsx("mesh", { geometry: geometry, material: material, receiveShadow: quality.receiveShadows }) }));
75
+ };
76
+ export default WaterBody;
@@ -0,0 +1,9 @@
1
+ export type { OceanLayerProps } from './types';
2
+ export { default as OceanSurface } from './OceanSurface';
3
+ export { default as WaterBody } from './WaterBody';
4
+ export { default as OceanHost } from './Host';
5
+ export { default as Sea } from './Sea';
6
+ export { default as Lake } from './Lake';
7
+ export { default as Storm } from './Storm';
8
+ export { default as Shore } from './Shore';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/water/index.ts"],"names":[],"mappings":"AAKA,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,11 @@
1
+ // Water bodies. Four spectra over one wave field, in either of two hosts —
2
+ // the camera-following world ocean or a placed, transformable body. Exactly one
3
+ // world ocean is mounted at a time, by OceanBuilder; placed bodies are ordinary
4
+ // scene objects and there can be any number of them.
5
+ export { default as OceanSurface } from './OceanSurface.js';
6
+ export { default as WaterBody } from './WaterBody.js';
7
+ export { default as OceanHost } from './Host.js';
8
+ export { default as Sea } from './Sea.js';
9
+ export { default as Lake } from './Lake.js';
10
+ export { default as Storm } from './Storm.js';
11
+ export { default as Shore } from './Shore.js';
@@ -0,0 +1,20 @@
1
+ import type { SkySettings, TimeSettings } from '@3driseai/3drise-core';
2
+ import type { ObjectReadyProps } from '../../types/objectReady';
3
+ import type { OceanConfig, OceanMeshSettings, OceanQualityConfig } from '../../types/oceanConfigs';
4
+ /** Shared by every water type. The builder hands all four the same shape. */
5
+ export interface OceanLayerProps extends ObjectReadyProps {
6
+ /** Scene id, so a controller can findById() the water and drive it live. */
7
+ id?: string;
8
+ config: OceanConfig;
9
+ quality: OceanQualityConfig;
10
+ /** The four Preetham parameters, so the water reflects and is lit by the same
11
+ * atmosphere the sky is drawn with. More important here than anywhere else:
12
+ * most of what you see looking at water is the sky. */
13
+ skySettings?: SkySettings;
14
+ timeSettings?: TimeSettings;
15
+ /** Matches SkySystem's sunIntensity, so water brightens with the scene. */
16
+ sunIntensity?: number;
17
+ /** Object host only — the placed body's transform. */
18
+ meshSettings?: OceanMeshSettings;
19
+ }
20
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/water/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnG,6EAA6E;AAC7E,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACrD,4EAA4E;IAC5E,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,kBAAkB,CAAC;IAC5B;;4DAEwD;IACxD,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,2EAA2E;IAC3E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sDAAsD;IACtD,YAAY,CAAC,EAAE,iBAAiB,CAAC;CACpC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB,gCAAgC,CAAC;AAC9D,eAAO,MAAM,qBAAqB,aAKhC,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB,gCAAgC,CAAC;AAC9D,eAAO,MAAM,qBAAqB,aAchC,CAAC"}
package/dist/constants.js CHANGED
@@ -5,8 +5,17 @@ const isLocalHostRuntime = typeof window !== 'undefined' &&
5
5
  // export const dataCenterServer = isLocalHostRuntime ? LOCAL_DATA_CENTER_SERVER : PRODUCTION_DATA_CENTER_SERVER;
6
6
  export const dataCenterServer = PRODUCTION_DATA_CENTER_SERVER;
7
7
  export const SELF_MANAGED_MATERIAL = new Set([
8
+ // The landscape owns its shader: splat arrays, height blending and the
9
+ // heightmap displacement are the material. useMaterialApplication would
10
+ // replace it with whatever the registry has under materialType.
11
+ 'landscape',
8
12
  'effect',
9
13
  'space',
10
14
  'grid',
15
+ // The water surface owns its shader — one material for both hosts, built
16
+ // around the wave field. Left out of this set, useMaterialApplication
17
+ // overwrites it with whatever the registry has under materialType, which for
18
+ // a legacy ocean is the old flat-plane water material.
19
+ 'ocean',
11
20
  // 'moon'
12
21
  ]);
@@ -2,10 +2,29 @@ export type { Update3driseShaderOptions } from './use3driseShader';
2
2
  export { update3driseShaderUniforms, use3driseShader } from './use3driseShader';
3
3
  export { useAnimationEvents } from './useAnimationEvents';
4
4
  export { useCameraAnimation } from './useCameraAnimation';
5
+ export type { CloudNoise } from './useCloudNoise';
6
+ export { bakeCloudNoise, useCloudNoise } from './useCloudNoise';
7
+ export type { CloudSunState, UseCloudSunOptions } from './useCloudSun';
8
+ export { computeCloudSun, useCloudSun } from './useCloudSun';
9
+ export type { CloudLiveHandle } from './useCloudLive';
10
+ export { CLOUD_LIVE_KEY, useCloudLive } from './useCloudLive';
11
+ export type { TerrainLiveHandle } from './useTerrainLive';
12
+ export { TERRAIN_LIVE_KEY, useTerrainLive } from './useTerrainLive';
13
+ export type { TerrainClipmap, TerrainClipmapLevel } from './useTerrainClipmap';
14
+ export { useTerrainClipmap } from './useTerrainClipmap';
15
+ export type { Clipmap, ClipmapLevel } from './useClipmap';
16
+ export { useClipmap } from './useClipmap';
17
+ export type { OceanLiveHandle } from './useOceanLive';
18
+ export { OCEAN_LIVE_KEY, useOceanLive } from './useOceanLive';
19
+ export { useOceanMaterial } from './useOceanMaterial';
20
+ export type { UseOceanMaterialOptions, OceanMaterialHandle } from './useOceanMaterial';
5
21
  export type { UseContinuousEffectsOptions, UseContinuousEffectsResult } from './useContinuousEffects';
6
22
  export { useContinuousEffects } from './useContinuousEffects';
7
- export type { UseCubeCameraOptions } from './useCubeCamera';
23
+ export type { UseCubeCameraOptions, UseCubeCameraReturn } from './useCubeCamera';
8
24
  export { useCubeCamera } from './useCubeCamera';
25
+ export type { UseEnvironmentProbeOptions } from './useEnvironmentProbe';
26
+ export { useEnvironmentProbe } from './useEnvironmentProbe';
27
+ export { useFrameRenderer } from './useFrameRenderer';
9
28
  export type { UseEnvironmentEffectsOptions } from './useEnvironmentEffects';
10
29
  export { useEnvironmentEffects } from './useEnvironmentEffects';
11
30
  export { useFrameAnimations } from './useFrameAnimations';
@@ -56,4 +75,8 @@ export { useTransformControls } from './useTransformControls';
56
75
  export { useVolumePoints } from './useVolumePoints';
57
76
  export { useWaterEnvironment } from './useWaterEnvironment';
58
77
  export { useWaterReflections } from './useWaterReflections';
78
+ export type { LandscapeLiveHandle } from './useLandscapeLive';
79
+ export { LANDSCAPE_LIVE_KEY, useLandscapeLive } from './useLandscapeLive';
80
+ export { useLandscapeMaps } from './useLandscapeMaps';
81
+ export type { LandscapeMapsState } from './useLandscapeMaps';
59
82
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAKA,YAAY,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEhF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,YAAY,EAAE,2BAA2B,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACtG,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,YAAY,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,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EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC5G,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -5,8 +5,18 @@
5
5
  export { update3driseShaderUniforms, use3driseShader } from './use3driseShader.js';
6
6
  export { useAnimationEvents } from './useAnimationEvents.js';
7
7
  export { useCameraAnimation } from './useCameraAnimation.js';
8
+ export { bakeCloudNoise, useCloudNoise } from './useCloudNoise.js';
9
+ export { computeCloudSun, useCloudSun } from './useCloudSun.js';
10
+ export { CLOUD_LIVE_KEY, useCloudLive } from './useCloudLive.js';
11
+ export { TERRAIN_LIVE_KEY, useTerrainLive } from './useTerrainLive.js';
12
+ export { useTerrainClipmap } from './useTerrainClipmap.js';
13
+ export { useClipmap } from './useClipmap.js';
14
+ export { OCEAN_LIVE_KEY, useOceanLive } from './useOceanLive.js';
15
+ export { useOceanMaterial } from './useOceanMaterial.js';
8
16
  export { useContinuousEffects } from './useContinuousEffects.js';
9
17
  export { useCubeCamera } from './useCubeCamera.js';
18
+ export { useEnvironmentProbe } from './useEnvironmentProbe.js';
19
+ export { useFrameRenderer } from './useFrameRenderer.js';
10
20
  export { useEnvironmentEffects } from './useEnvironmentEffects.js';
11
21
  export { useFrameAnimations } from './useFrameAnimations.js';
12
22
  export { useFrameEffects } from './useFrameEffects.js';
@@ -46,3 +56,5 @@ export { useTransformControls } from './useTransformControls.js';
46
56
  export { useVolumePoints } from './useVolumePoints.js';
47
57
  export { useWaterEnvironment } from './useWaterEnvironment.js';
48
58
  export { useWaterReflections } from './useWaterReflections.js';
59
+ export { LANDSCAPE_LIVE_KEY, useLandscapeLive } from './useLandscapeLive.js';
60
+ export { useLandscapeMaps } from './useLandscapeMaps.js';
@@ -0,0 +1,71 @@
1
+ import * as THREE from 'three';
2
+ /**
3
+ * Geometry clipmap rings. Shared by the terrain and the ocean.
4
+ *
5
+ * A surface that reaches the horizon cannot be one grid: at 4 m cells, 25 km is
6
+ * 39 million quads. A clipmap spends its vertices where they are visible instead
7
+ * — level 0 is a dense square centred on the camera, and every level above it is
8
+ * a hollow ring of the SAME vertex count at twice the cell size, so each ring
9
+ * covers four times the area for the same cost. Seven levels of 96 segments at
10
+ * 4 m reach roughly 24 km for about 65k vertices.
11
+ *
12
+ * This hook knows nothing about what displaces it. It was written for terrain
13
+ * (`useTerrainClipmap`, now a shim over this) and the ocean uses it unchanged;
14
+ * the height field, the LOD rule and the material are the caller's business.
15
+ *
16
+ * Two details make it work, and both are baked into the attributes here rather
17
+ * than solved at runtime:
18
+ *
19
+ * **`aMorph`** ramps 0 to 1 across the outer band of every ring. In the vertex
20
+ * shader it slides odd-indexed vertices onto their even neighbours, so by the
21
+ * ring's outer edge the polyline is exactly the next ring's coarser polyline.
22
+ * That closes the T-junction cracks between levels — and because it is a
23
+ * continuous slide rather than a swap, it also removes the pop.
24
+ *
25
+ * **`aCoarse`** is the offset to that even neighbour, and it is zero on even
26
+ * indices. The ring boundaries are all at even indices (which is why `segments`
27
+ * must be a multiple of 8), so a boundary vertex only ever moves ALONG the
28
+ * boundary, never off it. A morph that displaced the edge inward would trade the
29
+ * crack for a gap.
30
+ *
31
+ * **`aCell`** is the ring's world cell size, so one material can serve every
32
+ * ring. Both consumers pair it with the same morph rule —
33
+ * `cellLod = aCell * (1.0 + aMorph)` — which makes a ring's outer edge sample the
34
+ * field at exactly the next ring's cell size. Terrain uses it to drop octaves;
35
+ * the ocean uses it to fade out waves shorter than the cell can carry. In both
36
+ * cases the two sides of a seam then agree on the surface, which the geomorph
37
+ * alone does not guarantee.
38
+ *
39
+ * And one thing that is NOT here, because getting it wrong is the classic way to
40
+ * open the seams: every ring shares ONE snapped origin, exposed as `sharedSnap`.
41
+ * Snapping each ring to its own cell grid — which is what a clipmap tutorial will
42
+ * tell you to do — puts neighbouring rings on origins up to a cell apart, and the
43
+ * boundaries that line up perfectly in local space then miss each other in world
44
+ * space by that offset. The published fix for that is Asirvatham & Hoppe's
45
+ * L-shaped trim piece in four rotations; sharing the origin avoids needing one.
46
+ * The price is that coarse rings re-tessellate in sub-cell steps as the camera
47
+ * moves rather than snapping cleanly, and at their cell sizes the octave cut-off
48
+ * has already smoothed away everything that would show it.
49
+ */
50
+ export interface ClipmapLevel {
51
+ geometry: THREE.BufferGeometry;
52
+ /** World size of one cell at this level. */
53
+ cell: number;
54
+ level: number;
55
+ }
56
+ export interface Clipmap {
57
+ levels: ClipmapLevel[];
58
+ /** The grid every ring is snapped to: twice the finest cell. Twice, so index
59
+ * parity — and with it the geomorph — never flips as the camera crosses a
60
+ * cell boundary. Snapping to one cell inverts the morph every step and the
61
+ * whole surface shimmers. */
62
+ sharedSnap: number;
63
+ }
64
+ /**
65
+ * `segments` is rounded to a multiple of 8: the ring boundaries sit at
66
+ * `segments/4` and `segments/2`, and both must land on even indices or the morph
67
+ * pulls boundary vertices off their own edge.
68
+ */
69
+ export declare function useClipmap(levels: number, segments: number, cellSize: number): Clipmap;
70
+ export default useClipmap;
71
+ //# sourceMappingURL=useClipmap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useClipmap.d.ts","sourceRoot":"","sources":["../../src/hooks/useClipmap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,MAAM,WAAW,YAAY;IACzB,QAAQ,EAAE,KAAK,CAAC,cAAc,CAAC;IAC/B,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,OAAO;IACpB,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB;;;kCAG8B;IAC9B,UAAU,EAAE,MAAM,CAAC;CACtB;AA4ED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAgBtF;AAED,eAAe,UAAU,CAAC"}
@@ -0,0 +1,81 @@
1
+ import * as THREE from 'three';
2
+ import { useEffect, useMemo } from 'react';
3
+ /** Fraction of the ring's half-extent over which the morph runs. */
4
+ const MORPH_BAND = 0.25;
5
+ function buildLevel(segments, cell, hollow, level) {
6
+ const side = segments + 1;
7
+ const half = segments / 2;
8
+ const count = side * side;
9
+ const positions = new Float32Array(count * 3);
10
+ const aCell = new Float32Array(count);
11
+ const aMorph = new Float32Array(count);
12
+ const aCoarse = new Float32Array(count * 2);
13
+ for (let j = 0; j < side; j++) {
14
+ for (let i = 0; i < side; i++) {
15
+ const v = j * side + i;
16
+ const x = (i - half) * cell;
17
+ const z = (j - half) * cell;
18
+ positions[v * 3] = x;
19
+ positions[v * 3 + 1] = 0;
20
+ positions[v * 3 + 2] = z;
21
+ aCell[v] = cell;
22
+ // Chebyshev distance from the centre, normalised to the half-extent.
23
+ // Square rings need a square metric, or the morph band bulges at the
24
+ // corners and the seam opens there.
25
+ const u = Math.max(Math.abs(i - half), Math.abs(j - half)) / half;
26
+ const t = (u - (1 - MORPH_BAND)) / MORPH_BAND;
27
+ aMorph[v] = Math.min(Math.max(t, 0), 1);
28
+ aCoarse[v * 2] = -(i % 2) * cell;
29
+ aCoarse[v * 2 + 1] = -(j % 2) * cell;
30
+ }
31
+ }
32
+ // The hole spans the middle half in each axis, which is exactly the extent of
33
+ // the level below — the two meet edge to edge with nothing between them.
34
+ const holeLo = segments / 4;
35
+ const holeHi = segments - segments / 4;
36
+ const indices = [];
37
+ for (let j = 0; j < segments; j++) {
38
+ for (let i = 0; i < segments; i++) {
39
+ if (hollow && i >= holeLo && i < holeHi && j >= holeLo && j < holeHi)
40
+ continue;
41
+ const a = j * side + i;
42
+ const b = a + 1;
43
+ const c = a + side;
44
+ const d = c + 1;
45
+ indices.push(a, c, b, b, c, d);
46
+ }
47
+ }
48
+ const geometry = new THREE.BufferGeometry();
49
+ geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3));
50
+ geometry.setAttribute('aCell', new THREE.BufferAttribute(aCell, 1));
51
+ geometry.setAttribute('aMorph', new THREE.BufferAttribute(aMorph, 1));
52
+ geometry.setAttribute('aCoarse', new THREE.BufferAttribute(aCoarse, 2));
53
+ geometry.setIndex(indices);
54
+ // The mesh is flat in object space and displaced in the vertex shader, so a
55
+ // computed bounding volume describes a plane and the ring is frustum-culled
56
+ // the moment the camera looks up. Infinite sphere, culling handled by the
57
+ // clipmap itself: it only ever exists around the camera.
58
+ geometry.boundingSphere = new THREE.Sphere(new THREE.Vector3(), Infinity);
59
+ geometry.boundingBox = new THREE.Box3(new THREE.Vector3(-Infinity, -Infinity, -Infinity), new THREE.Vector3(Infinity, Infinity, Infinity));
60
+ return { geometry, cell, level };
61
+ }
62
+ /**
63
+ * `segments` is rounded to a multiple of 8: the ring boundaries sit at
64
+ * `segments/4` and `segments/2`, and both must land on even indices or the morph
65
+ * pulls boundary vertices off their own edge.
66
+ */
67
+ export function useClipmap(levels, segments, cellSize) {
68
+ const safeLevels = Math.max(1, Math.min(Math.round(levels), 14));
69
+ const safeSegments = Math.max(16, Math.round(segments / 8) * 8);
70
+ const safeCell = Math.max(0.05, cellSize);
71
+ const clipmap = useMemo(() => {
72
+ const out = [];
73
+ for (let l = 0; l < safeLevels; l++) {
74
+ out.push(buildLevel(safeSegments, safeCell * Math.pow(2, l), l > 0, l));
75
+ }
76
+ return { levels: out, sharedSnap: safeCell * 2 };
77
+ }, [safeLevels, safeSegments, safeCell]);
78
+ useEffect(() => () => { clipmap.levels.forEach((r) => r.geometry.dispose()); }, [clipmap]);
79
+ return clipmap;
80
+ }
81
+ export default useClipmap;
@@ -0,0 +1,29 @@
1
+ import type { Object3D } from 'three';
2
+ /**
3
+ * Live cloud editing, the counterpart to useMaterialUniforms.
4
+ *
5
+ * A slider drag fires on every pointer-move. Routing that through Redux would
6
+ * dispatch and re-render the tree sixty times a second, and — because the cloud
7
+ * pass keys its temporal history off the config — would also restart the
8
+ * accumulation on every one of those frames, so the deck would boil while you tune
9
+ * it. Instead the controller finds the layer with findById(id) and writes straight
10
+ * into the renderer here; Redux only hears about it on slider end.
11
+ *
12
+ * const live = useCloudLive(settings.id);
13
+ * <BaseControllerUi onLiveChange={live.deck} onSettingsChange={dispatchToRedux} ... />
14
+ */
15
+ /** Where VolumetricCloudsPass stashes its handle on the root object's userData. */
16
+ export declare const CLOUD_LIVE_KEY = "__cloudLive";
17
+ export interface CloudLiveHandle {
18
+ deck(key: string, value: number | boolean): void;
19
+ cirrus(key: string, value: number | boolean): void;
20
+ quality(key: string, value: number | boolean): void;
21
+ }
22
+ /**
23
+ * Safe before the layer mounts and after it unmounts: the handle is resolved at call
24
+ * time, not at hook time, so a controller opened before the scene is ready still works
25
+ * once it is — and a stale object reference degrades to a no-op instead of throwing.
26
+ */
27
+ export declare function useCloudLive(target?: Object3D | string | null): CloudLiveHandle;
28
+ export default useCloudLive;
29
+ //# sourceMappingURL=useCloudLive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCloudLive.d.ts","sourceRoot":"","sources":["../../src/hooks/useCloudLive.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGtC;;;;;;;;;;;;GAYG;AAEH,mFAAmF;AACnF,eAAO,MAAM,cAAc,gBAAgB,CAAC;AAE5C,MAAM,WAAW,eAAe;IAC5B,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;IACjD,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;IACnD,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;CACvD;AAID;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI,GAAG,eAAe,CAkB/E;AAED,eAAe,YAAY,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { useMemo } from 'react';
2
+ import { findById } from '../utils/sceneQuery.js';
3
+ /**
4
+ * Live cloud editing, the counterpart to useMaterialUniforms.
5
+ *
6
+ * A slider drag fires on every pointer-move. Routing that through Redux would
7
+ * dispatch and re-render the tree sixty times a second, and — because the cloud
8
+ * pass keys its temporal history off the config — would also restart the
9
+ * accumulation on every one of those frames, so the deck would boil while you tune
10
+ * it. Instead the controller finds the layer with findById(id) and writes straight
11
+ * into the renderer here; Redux only hears about it on slider end.
12
+ *
13
+ * const live = useCloudLive(settings.id);
14
+ * <BaseControllerUi onLiveChange={live.deck} onSettingsChange={dispatchToRedux} ... />
15
+ */
16
+ /** Where VolumetricCloudsPass stashes its handle on the root object's userData. */
17
+ export const CLOUD_LIVE_KEY = '__cloudLive';
18
+ const NOOP = { deck: () => { }, cirrus: () => { }, quality: () => { } };
19
+ /**
20
+ * Safe before the layer mounts and after it unmounts: the handle is resolved at call
21
+ * time, not at hook time, so a controller opened before the scene is ready still works
22
+ * once it is — and a stale object reference degrades to a no-op instead of throwing.
23
+ */
24
+ export function useCloudLive(target) {
25
+ return useMemo(() => {
26
+ const resolve = () => {
27
+ // Resolved per call, never cached. A findById() memoised in the
28
+ // controller resolves once — and if the layer is not mounted yet, which
29
+ // it is not while the layer is switched off, it resolves to null and
30
+ // stays null until the controller remounts. Every slider then silently
31
+ // does nothing.
32
+ const object = typeof target === 'string' ? findById(target) : target;
33
+ const handle = object?.userData?.[CLOUD_LIVE_KEY];
34
+ return handle ?? NOOP;
35
+ };
36
+ return {
37
+ deck: (key, value) => resolve().deck(key, value),
38
+ cirrus: (key, value) => resolve().cirrus(key, value),
39
+ quality: (key, value) => resolve().quality(key, value),
40
+ };
41
+ }, [target]);
42
+ }
43
+ export default useCloudLive;
@@ -0,0 +1,28 @@
1
+ import * as THREE from 'three';
2
+ /**
3
+ * Bakes the four cloud noise textures once and shares them across the scene.
4
+ *
5
+ * A hook rather than a provider: the cache is keyed on the renderer, so every
6
+ * caller in a Canvas gets the same volumes with no wrapper component to remember.
7
+ * Two decks and four placed clouds should not mean six 128-cubed volumes — the
8
+ * base texture alone is 8 MB, and the field is identical for all of them. What
9
+ * differs per cloud is how it samples it.
10
+ *
11
+ * The bake is a handful of GPU draws plus one readback, a few hundred ms on
12
+ * integrated graphics, paid once per renderer for the life of the page.
13
+ */
14
+ export interface CloudNoise {
15
+ base: THREE.Data3DTexture;
16
+ detail: THREE.Data3DTexture;
17
+ weather: THREE.Texture;
18
+ curl: THREE.Texture;
19
+ dispose(): void;
20
+ }
21
+ export declare function bakeCloudNoise(gl: THREE.WebGLRenderer): CloudNoise | null;
22
+ /**
23
+ * Null when the context cannot support the volumes. Callers should render nothing
24
+ * rather than treat that as an error.
25
+ */
26
+ export declare function useCloudNoise(): CloudNoise | null;
27
+ export default useCloudNoise;
28
+ //# sourceMappingURL=useCloudNoise.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCloudNoise.d.ts","sourceRoot":"","sources":["../../src/hooks/useCloudNoise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC;IAC1B,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;IACvB,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC;IACpB,OAAO,IAAI,IAAI,CAAC;CACnB;AAoGD,wBAAgB,cAAc,CAAC,EAAE,EAAE,KAAK,CAAC,aAAa,GAAG,UAAU,GAAG,IAAI,CAwBzE;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,UAAU,GAAG,IAAI,CAKjD;AAED,eAAe,aAAa,CAAC"}