@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,194 @@
1
+ import { defaultLandscapeSurface } from '../types/landscapeConfigs.js';
2
+ const surface = (patch) => ({
3
+ ...defaultLandscapeSurface,
4
+ ...patch,
5
+ });
6
+ const grass = surface({
7
+ name: 'Grass',
8
+ diffuse: 'grass_col.jpg',
9
+ normal: 'grass_norm.jpg',
10
+ displacement: 'grass_dsp.png',
11
+ repeat: 260,
12
+ normalStrength: 0.45,
13
+ saturation: 0.85,
14
+ tint: '#b6c4a8',
15
+ roughness: 0.95,
16
+ heightBlend: 0.5,
17
+ aperiodic: true,
18
+ });
19
+ const mud = surface({
20
+ name: 'Mud',
21
+ diffuse: 'mud_col.jpg',
22
+ normal: 'mud_norm.jpg',
23
+ displacement: 'mud_dsp.png',
24
+ repeat: 300,
25
+ normalStrength: 0.6,
26
+ saturation: 0.8,
27
+ roughness: 0.88,
28
+ heightBlend: 0.7,
29
+ aperiodic: true,
30
+ });
31
+ const cliff = surface({
32
+ name: 'Cliff',
33
+ diffuse: 'cliff_col.jpg',
34
+ normal: 'cliff_norm.jpg',
35
+ displacement: 'cliff_dsp.png',
36
+ repeat: 220,
37
+ normalStrength: 0.75,
38
+ saturation: 0.7,
39
+ tint: '#cfc9c2',
40
+ roughness: 0.82,
41
+ heightBlend: 0.85,
42
+ // The one surface that needs world-axis projection: on a vertical face the
43
+ // tile's own UV is stretched to a smear.
44
+ triplanar: true,
45
+ aperiodic: true,
46
+ });
47
+ const rock = surface({
48
+ name: 'Rock',
49
+ diffuse: 'rock_col.jpg',
50
+ normal: 'rock_norm.jpg',
51
+ displacement: 'rock_dsp.png',
52
+ repeat: 240,
53
+ normalStrength: 0.7,
54
+ saturation: 0.65,
55
+ tint: '#c8c4bd',
56
+ roughness: 0.86,
57
+ heightBlend: 0.85,
58
+ triplanar: true,
59
+ aperiodic: true,
60
+ });
61
+ export const landscapePresets = [
62
+ {
63
+ name: 'Highlands',
64
+ description: 'The authored case: two splat maps place grass, mud, cliff and rock, '
65
+ + 'with height blending at every transition and world-axis projection on the two rock layers.',
66
+ tags: ['grass', 'rock', 'valley', 'authored'],
67
+ assets: {
68
+ heightMap: 'heightmap.png',
69
+ splatMaps: ['splat0.png', 'splat1.png'],
70
+ aoMap: 'ao.png',
71
+ },
72
+ surfaces: [rock, cliff, mud, grass],
73
+ settings: {
74
+ heightEncoding: 'grayscale',
75
+ splatSource: 'maps',
76
+ size: 2048,
77
+ elevationScale: 340,
78
+ elevationBias: 0,
79
+ smoothness: 1.5,
80
+ surfaceSamples: 3,
81
+ macroVariation: 0.22,
82
+ macroSize: 700,
83
+ },
84
+ },
85
+ {
86
+ name: 'Highlands (generated splat)',
87
+ description: 'The same heightmap with no splat maps at all — surfaces placed by height and slope, '
88
+ + 'rock last. This is what a bare heightmap looks like on drop, which the reference '
89
+ + 'implementation cannot render at all.',
90
+ tags: ['auto', 'generated', 'slope'],
91
+ assets: {
92
+ heightMap: 'heightmap.png',
93
+ aoMap: 'ao.png',
94
+ },
95
+ surfaces: [grass, mud, cliff],
96
+ settings: {
97
+ heightEncoding: 'grayscale',
98
+ splatSource: 'auto',
99
+ size: 2048,
100
+ elevationScale: 340,
101
+ smoothness: 1.5,
102
+ surfaceSamples: 3,
103
+ macroVariation: 0.28,
104
+ macroSize: 800,
105
+ autoSplat: {
106
+ bands: [0.15, 0.55, 0.9],
107
+ bandWidth: 0.5,
108
+ slopeStart: 0.3,
109
+ slopeEnd: 0.6,
110
+ noise: 0.14,
111
+ noiseSize: 350,
112
+ },
113
+ },
114
+ },
115
+ ];
116
+ /**
117
+ * Fill a preset's file names in from wherever the caller keeps its assets.
118
+ *
119
+ * Surfaces whose diffuse cannot be resolved are dropped rather than rendered as
120
+ * a hole — a surface with no albedo is skipped by the renderer anyway, and an
121
+ * empty slot in the middle of the list would silently shift every splat channel
122
+ * after it. A missing normal or height map is not fatal: those degrade to a flat
123
+ * normal and a linear blend, which is what the reference implementation does for
124
+ * every surface always.
125
+ *
126
+ * The heightmap is the one thing that cannot be missing — without it there is no
127
+ * landscape — so an unresolved heightmap returns a config with `enabled: false`
128
+ * and the name in `missing`, for the panel to say so.
129
+ */
130
+ export function resolveLandscapePreset(preset, resolve) {
131
+ const missing = [];
132
+ const take = (name) => {
133
+ if (!name)
134
+ return '';
135
+ const url = resolve(name);
136
+ if (!url) {
137
+ missing.push(name);
138
+ return '';
139
+ }
140
+ return url;
141
+ };
142
+ const heightMap = take(preset.assets.heightMap);
143
+ const splatMaps = (preset.assets.splatMaps ?? []).map(take).filter(Boolean);
144
+ const aoMap = take(preset.assets.aoMap);
145
+ const surfaces = preset.surfaces
146
+ .map((s) => ({
147
+ ...s,
148
+ diffuse: take(s.diffuse),
149
+ normal: take(s.normal),
150
+ displacement: take(s.displacement),
151
+ }))
152
+ .filter((s) => !!s.diffuse);
153
+ return {
154
+ config: {
155
+ ...preset.settings,
156
+ enabled: !!heightMap && surfaces.length > 0,
157
+ heightMap,
158
+ splatMaps,
159
+ aoMap,
160
+ surfaces,
161
+ // A preset that lost its splat maps still has to render, so it falls
162
+ // back to the generated splat rather than to a blank ground.
163
+ splatSource: splatMaps.length > 0 ? (preset.settings.splatSource ?? 'maps') : 'auto',
164
+ preset: preset.name,
165
+ },
166
+ missing,
167
+ };
168
+ }
169
+ export function getLandscapePresetByName(name) {
170
+ return landscapePresets.find((preset) => preset.name === name);
171
+ }
172
+ /** Every file name the built-in presets need, for a client that wants to check
173
+ * what is uploaded before offering them. */
174
+ export function landscapePresetAssetNames() {
175
+ const names = new Set();
176
+ for (const preset of landscapePresets) {
177
+ names.add(preset.assets.heightMap);
178
+ preset.assets.splatMaps?.forEach((n) => names.add(n));
179
+ if (preset.assets.aoMap)
180
+ names.add(preset.assets.aoMap);
181
+ for (const s of preset.surfaces) {
182
+ names.add(s.diffuse);
183
+ if (s.normal)
184
+ names.add(s.normal);
185
+ if (s.displacement)
186
+ names.add(s.displacement);
187
+ }
188
+ }
189
+ return [...names];
190
+ }
191
+ export function searchLandscapePresetsByTags(tags) {
192
+ const wanted = tags.map((t) => t.toLowerCase());
193
+ return landscapePresets.filter((preset) => preset.tags.some((tag) => wanted.includes(tag.toLowerCase())));
194
+ }
@@ -0,0 +1,195 @@
1
+ import type { LandscapeConfig, LandscapeQualityConfig, LandscapeSurface } from '../types/landscapeConfigs';
2
+ /**
3
+ * Landscape types and shapes — the two things a person actually picks.
4
+ *
5
+ * ## The split
6
+ *
7
+ * A landscape is two independent choices:
8
+ *
9
+ * SHAPE the heightmap. Mountains, rolling hills, dunes, a valley.
10
+ * TYPE the biome. Grassland, rocky, snow, sand.
11
+ *
12
+ * They are orthogonal — any shape can wear any type — so eight of each is
13
+ * sixty-four landscapes from sixteen folders. That is the whole reason the panel
14
+ * can be two pictures instead of thirty-three rows.
15
+ *
16
+ * ## Why a type is code and a pack is a folder
17
+ *
18
+ * A type is a dozen numbers: which surface packs, in what order, with what
19
+ * height and slope bands, tints, repeats and roughness. If a type were a folder
20
+ * of textures, re-tuning a band would mean re-uploading. So the files are
21
+ * *packs* (a tiling material) and *shapes* (a heightmap), and the recipe lives
22
+ * here.
23
+ *
24
+ * A type also needs no authored splat map — it uses the generated height-and-
25
+ * slope splat. That is what makes "pick a type" possible at all: otherwise every
26
+ * shape x type pairing would need its own painted splat map, which is sixty-four
27
+ * files that do not exist. Authored splats stay available in the Advanced tab,
28
+ * which is the only place they earn their keep.
29
+ */
30
+ /** A pack resolved from the asset folder: file names for one tiling material. */
31
+ export interface LandscapePackRef {
32
+ /** Folder name under `surfaces/`. */
33
+ pack: string;
34
+ /** Per-type overrides on top of `defaultLandscapeSurface`. */
35
+ surface?: Partial<LandscapeSurface>;
36
+ /** Height fraction this surface is centred on. The LAST entry in a type is
37
+ * the rock layer and is placed by slope instead. */
38
+ band?: number;
39
+ /**
40
+ * How many WORLD METRES one tile of this texture covers.
41
+ *
42
+ * Not a repeat count, deliberately. `repeat` is relative to the tile, so a
43
+ * recipe written at 2 km silently doubles its texture scale when someone
44
+ * drags Size to 4 km, and the ground goes from grass to mush. In metres the
45
+ * recipe is size-independent and the number means something: a grass texture
46
+ * is about two and a half metres across, a rock face about four.
47
+ *
48
+ * The first version wrote repeat counts and got roughly 8-10 m per tile,
49
+ * which is what made the close-up read as giant blobs instead of ground.
50
+ */
51
+ metres?: number;
52
+ }
53
+ export interface LandscapeTypeDef {
54
+ id: string;
55
+ /** What the picker shows. */
56
+ label: string;
57
+ /** One line under the label. */
58
+ description: string;
59
+ /** Bottom of the height range first; the last entry is the slope/rock layer. */
60
+ packs: LandscapePackRef[];
61
+ /** Auto-splat shaping for this biome. */
62
+ splat: {
63
+ bandWidth: number;
64
+ slopeStart: number;
65
+ slopeEnd: number;
66
+ noise: number;
67
+ noiseSize: number;
68
+ };
69
+ /** Config nudges that make this biome read right — macro break-up mostly. */
70
+ settings?: Partial<LandscapeConfig>;
71
+ /** Which pack's thumbnail represents the type in the picker, and the pack
72
+ * without which the type is not itself — Snow without `snow_fresh` is just
73
+ * rock. Defaults to the first pack, which is the one covering most of the
74
+ * ground. Used by `landscapeTypeAvailability`. */
75
+ thumbPack?: string;
76
+ }
77
+ /** Texture repeats across the tile, from a real-world tile size. Clamped: below
78
+ * about half a metre a ground texture aliases before it reads as detail, and
79
+ * above about forty it is wallpaper. */
80
+ export declare function repeatForMetres(size: number, metres: number): number;
81
+ export declare const landscapeTypes: LandscapeTypeDef[];
82
+ export declare function getLandscapeType(id: string): LandscapeTypeDef | undefined;
83
+ /** Every surface pack any type refers to — for a client that wants to know what
84
+ * to upload, or which types it can offer. */
85
+ export declare function landscapeTypePacks(type: LandscapeTypeDef): string[];
86
+ /** One type, what it is missing, and whether that is fatal. */
87
+ export interface LandscapeTypeAvailability {
88
+ type: LandscapeTypeDef;
89
+ /** Every pack named by the recipe that is not in `havePacks`. */
90
+ missingPacks: string[];
91
+ /** The subset of `missingPacks` that actually prevents the type being
92
+ * offered — the slope layer and the signature pack. */
93
+ blockingPacks: string[];
94
+ /** Missing but survivable: middle height bands. The type renders with a
95
+ * wider gap between its remaining layers, which is a poorer version of
96
+ * itself, not a broken one. */
97
+ reducedPacks: string[];
98
+ available: boolean;
99
+ }
100
+ /**
101
+ * Every type, with the reason each unavailable one is unavailable.
102
+ *
103
+ * The packs in a type are NOT interchangeable, so "needs all of them" is the
104
+ * wrong rule and this is the right one. Two of them are load-bearing:
105
+ *
106
+ * THE LAST PACK is the slope layer. The auto-splat block in
107
+ * `landscapeCore.glsl` bands every surface by height, multiplies all but the
108
+ * last by `1 - rock`, and then forces the last one on by slope. Drop it and
109
+ * the next pack up is silently promoted into that role — a ground texture
110
+ * smeared vertically up every cliff face, which is the ugliest thing this
111
+ * material can do.
112
+ *
113
+ * THE SIGNATURE PACK (`thumbPack`, else the first) is what makes the type
114
+ * that type. Snow without `snow_fresh` is rock, and offering it under the
115
+ * name Snow is worse than not offering it.
116
+ *
117
+ * Everything in between is a middle height band. Losing one widens the gap
118
+ * between the layers that remain; `resolveLandscapeType` already rebuilds the
119
+ * band array from the surfaces that actually resolved, so nothing lands at the
120
+ * wrong altitude. That is a poorer version of the biome, not a broken one, and
121
+ * it is not worth blocking a type over — Sand with dune sand and boulders but
122
+ * no ripple layer is still recognisably sand.
123
+ */
124
+ export declare function landscapeTypeAvailability(havePacks: Iterable<string>): LandscapeTypeAvailability[];
125
+ export interface LandscapeShapeDef {
126
+ /** Folder name under `terrains/`. */
127
+ id: string;
128
+ label: string;
129
+ description: string;
130
+ /** Sensible world size and relief for this shape, in metres. The Basic tab's
131
+ * two sliders start here rather than at a global default, because a dune
132
+ * field and an alpine range are not the same scene at the same numbers. */
133
+ size: number;
134
+ elevation: number;
135
+ /** Authored splat maps exist for this shape and are worth preferring over the
136
+ * generated one. Only `highlands` has them today. */
137
+ hasSplatMaps?: boolean;
138
+ }
139
+ export declare const landscapeShapes: LandscapeShapeDef[];
140
+ export declare function getLandscapeShape(id: string): LandscapeShapeDef | undefined;
141
+ export type LandscapeDetail = 'draft' | 'balanced' | 'high';
142
+ /**
143
+ * The six knobs a non-expert cannot reason about individually but has a clear
144
+ * opinion about collectively. `meshError` is in world units and therefore scales
145
+ * with the landscape's relief, so it is applied as a FRACTION of elevation
146
+ * rather than as a constant — 1.5 m of error on a 90 m dune field is invisible,
147
+ * on a 900 m range it is a stepped silhouette.
148
+ */
149
+ export declare const LANDSCAPE_DETAIL: Record<LandscapeDetail, {
150
+ label: string;
151
+ description: string;
152
+ /** meshError is in world units, so it scales with relief rather than being a
153
+ * constant: 1.5 m of error is invisible on a 90 m dune field and a stepped
154
+ * silhouette on a 900 m range. */
155
+ meshErrorFraction: number;
156
+ /** Lives in the CONFIG, not in quality — it is what the material blends, not
157
+ * what the mesh costs. Carried here so one dial still sets it. */
158
+ surfaceSamples: number;
159
+ quality: Partial<LandscapeQualityConfig>;
160
+ }>;
161
+ export declare function landscapeQualityForDetail(detail: LandscapeDetail, elevation: number): LandscapeQualityConfig;
162
+ /** Best guess at which detail level a config came from, so the Basic tab can
163
+ * show the right button after an Advanced edit — or show none, which is the
164
+ * honest answer once someone has hand-tuned it. */
165
+ export declare function detectLandscapeDetail(quality: LandscapeQualityConfig, surfaceSamples: number): LandscapeDetail | null;
166
+ /** How the client hands over what it found in the asset folder. */
167
+ export interface LandscapeAssetIndex {
168
+ /** `surfaces/<pack>/<role>` -> URL. Absent roles are simply missing. */
169
+ pack(name: string, role: 'albedo' | 'normal' | 'height' | 'thumb'): string | null;
170
+ /** `terrains/<shape>/<role>` -> URL. */
171
+ shape(name: string, role: 'height' | 'splat0' | 'splat1' | 'ao' | 'preview'): string | null;
172
+ }
173
+ export interface ResolvedLandscapeType {
174
+ config: Partial<LandscapeConfig>;
175
+ quality: LandscapeQualityConfig;
176
+ /** Packs or maps the index could not supply. Empty means it is whole. */
177
+ missing: string[];
178
+ }
179
+ /**
180
+ * Two picks and a detail level to a whole config.
181
+ *
182
+ * A pack with no albedo is dropped, not rendered as a hole — a surface with no
183
+ * albedo is skipped by the renderer anyway, and an empty slot in the middle of
184
+ * the list would shift the bands of every layer after it.
185
+ *
186
+ * The shape's own `size` and `elevation` are the starting point rather than a
187
+ * global default, because a dune field and an alpine range are not the same
188
+ * scene at the same numbers. The caller overrides them once the user touches a
189
+ * slider.
190
+ */
191
+ export declare function resolveLandscapeType(typeId: string, shapeId: string, index: LandscapeAssetIndex, detail?: LandscapeDetail, override?: {
192
+ size?: number;
193
+ elevation?: number;
194
+ }): ResolvedLandscapeType;
195
+ //# sourceMappingURL=landscapeTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"landscapeTypes.d.ts","sourceRoot":"","sources":["../../src/presets/landscapeTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAI1G;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAMH,iFAAiF;AACjF,MAAM,WAAW,g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