@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.
- package/dist/components/Clouds.d.ts.map +1 -1
- package/dist/components/Clouds.js +0 -1
- package/dist/components/CloudsGenerator.d.ts +32 -0
- package/dist/components/CloudsGenerator.d.ts.map +1 -0
- package/dist/components/CloudsGenerator.js +58 -0
- package/dist/components/EnvironmentManager.d.ts +47 -5
- package/dist/components/EnvironmentManager.d.ts.map +1 -1
- package/dist/components/EnvironmentManager.js +35 -66
- package/dist/components/HdrEnvironment.d.ts +20 -0
- package/dist/components/HdrEnvironment.d.ts.map +1 -0
- package/dist/components/HdrEnvironment.js +44 -0
- package/dist/components/LandscapeBuilder.d.ts +23 -0
- package/dist/components/LandscapeBuilder.d.ts.map +1 -0
- package/dist/components/LandscapeBuilder.js +25 -0
- package/dist/components/LandscapeObject.d.ts +24 -0
- package/dist/components/LandscapeObject.d.ts.map +1 -0
- package/dist/components/LandscapeObject.js +27 -0
- package/dist/components/ObjectNode.d.ts.map +1 -1
- package/dist/components/ObjectNode.js +10 -0
- package/dist/components/OceanBuilder.d.ts +35 -0
- package/dist/components/OceanBuilder.d.ts.map +1 -0
- package/dist/components/OceanBuilder.js +53 -0
- package/dist/components/SceneBuilder.d.ts.map +1 -1
- package/dist/components/SkySystem.d.ts +27 -6
- package/dist/components/SkySystem.d.ts.map +1 -1
- package/dist/components/SkySystem.js +6 -5
- package/dist/components/SunLight.d.ts.map +1 -1
- package/dist/components/SunLight.js +4 -1
- package/dist/components/TerrainBuilder.d.ts +30 -0
- package/dist/components/TerrainBuilder.d.ts.map +1 -0
- package/dist/components/TerrainBuilder.js +44 -0
- package/dist/components/index.d.ts +17 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +10 -0
- package/dist/components/landscape/LandscapeMesh.d.ts +18 -0
- package/dist/components/landscape/LandscapeMesh.d.ts.map +1 -0
- package/dist/components/landscape/LandscapeMesh.js +278 -0
- package/dist/components/landscape/index.d.ts +3 -0
- package/dist/components/landscape/index.d.ts.map +1 -0
- package/dist/components/landscape/index.js +1 -0
- package/dist/components/landscape/types.d.ts +13 -0
- package/dist/components/landscape/types.d.ts.map +1 -0
- package/dist/components/landscape/types.js +1 -0
- package/dist/components/terrain/Canyon.d.ts +23 -0
- package/dist/components/terrain/Canyon.d.ts.map +1 -0
- package/dist/components/terrain/Canyon.js +29 -0
- package/dist/components/terrain/Dunes.d.ts +22 -0
- package/dist/components/terrain/Dunes.d.ts.map +1 -0
- package/dist/components/terrain/Dunes.js +25 -0
- package/dist/components/terrain/Hills.d.ts +17 -0
- package/dist/components/terrain/Hills.d.ts.map +1 -0
- package/dist/components/terrain/Hills.js +20 -0
- package/dist/components/terrain/Mountains.d.ts +19 -0
- package/dist/components/terrain/Mountains.d.ts.map +1 -0
- package/dist/components/terrain/Mountains.js +22 -0
- package/dist/components/terrain/TerrainSurface.d.ts +22 -0
- package/dist/components/terrain/TerrainSurface.d.ts.map +1 -0
- package/dist/components/terrain/TerrainSurface.js +94 -0
- package/dist/components/terrain/index.d.ts +7 -0
- package/dist/components/terrain/index.d.ts.map +1 -0
- package/dist/components/terrain/index.js +7 -0
- package/dist/components/terrain/types.d.ts +17 -0
- package/dist/components/terrain/types.d.ts.map +1 -0
- package/dist/components/terrain/types.js +1 -0
- package/dist/components/volumetricClouds/Cirrus.d.ts +14 -0
- package/dist/components/volumetricClouds/Cirrus.d.ts.map +1 -0
- package/dist/components/volumetricClouds/Cirrus.js +13 -0
- package/dist/components/volumetricClouds/Cumulonimbus.d.ts +17 -0
- package/dist/components/volumetricClouds/Cumulonimbus.d.ts.map +1 -0
- package/dist/components/volumetricClouds/Cumulonimbus.js +20 -0
- package/dist/components/volumetricClouds/Cumulus.d.ts +14 -0
- package/dist/components/volumetricClouds/Cumulus.d.ts.map +1 -0
- package/dist/components/volumetricClouds/Cumulus.js +17 -0
- package/dist/components/volumetricClouds/Stratocumulus.d.ts +12 -0
- package/dist/components/volumetricClouds/Stratocumulus.d.ts.map +1 -0
- package/dist/components/volumetricClouds/Stratocumulus.js +16 -0
- package/dist/components/volumetricClouds/VolumetricCloudsPass.d.ts +42 -0
- package/dist/components/volumetricClouds/VolumetricCloudsPass.d.ts.map +1 -0
- package/dist/components/volumetricClouds/VolumetricCloudsPass.js +298 -0
- package/dist/components/volumetricClouds/index.d.ts +8 -0
- package/dist/components/volumetricClouds/index.d.ts.map +1 -0
- package/dist/components/volumetricClouds/index.js +7 -0
- package/dist/components/volumetricClouds/types.d.ts +17 -0
- package/dist/components/volumetricClouds/types.d.ts.map +1 -0
- package/dist/components/volumetricClouds/types.js +1 -0
- package/dist/components/water/Host.d.ts +12 -0
- package/dist/components/water/Host.d.ts.map +1 -0
- package/dist/components/water/Host.js +12 -0
- package/dist/components/water/Lake.d.ts +18 -0
- package/dist/components/water/Lake.d.ts.map +1 -0
- package/dist/components/water/Lake.js +21 -0
- package/dist/components/water/OceanSurface.d.ts +27 -0
- package/dist/components/water/OceanSurface.d.ts.map +1 -0
- package/dist/components/water/OceanSurface.js +60 -0
- package/dist/components/water/Sea.d.ts +18 -0
- package/dist/components/water/Sea.d.ts.map +1 -0
- package/dist/components/water/Sea.js +17 -0
- package/dist/components/water/Shore.d.ts +16 -0
- package/dist/components/water/Shore.d.ts.map +1 -0
- package/dist/components/water/Shore.js +15 -0
- package/dist/components/water/Storm.d.ts +14 -0
- package/dist/components/water/Storm.d.ts.map +1 -0
- package/dist/components/water/Storm.js +13 -0
- package/dist/components/water/WaterBody.d.ts +31 -0
- package/dist/components/water/WaterBody.d.ts.map +1 -0
- package/dist/components/water/WaterBody.js +76 -0
- package/dist/components/water/index.d.ts +9 -0
- package/dist/components/water/index.d.ts.map +1 -0
- package/dist/components/water/index.js +11 -0
- package/dist/components/water/types.d.ts +20 -0
- package/dist/components/water/types.d.ts.map +1 -0
- package/dist/components/water/types.js +1 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +9 -0
- package/dist/hooks/index.d.ts +24 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +12 -0
- package/dist/hooks/useClipmap.d.ts +71 -0
- package/dist/hooks/useClipmap.d.ts.map +1 -0
- package/dist/hooks/useClipmap.js +81 -0
- package/dist/hooks/useCloudLive.d.ts +29 -0
- package/dist/hooks/useCloudLive.d.ts.map +1 -0
- package/dist/hooks/useCloudLive.js +43 -0
- package/dist/hooks/useCloudNoise.d.ts +28 -0
- package/dist/hooks/useCloudNoise.d.ts.map +1 -0
- package/dist/hooks/useCloudNoise.js +128 -0
- package/dist/hooks/useCloudSun.d.ts +49 -0
- package/dist/hooks/useCloudSun.d.ts.map +1 -0
- package/dist/hooks/useCloudSun.js +84 -0
- package/dist/hooks/useCubeCamera.d.ts +27 -9
- package/dist/hooks/useCubeCamera.d.ts.map +1 -1
- package/dist/hooks/useCubeCamera.js +28 -70
- package/dist/hooks/useEnvironmentProbe.d.ts +32 -0
- package/dist/hooks/useEnvironmentProbe.d.ts.map +1 -0
- package/dist/hooks/useEnvironmentProbe.js +35 -0
- package/dist/hooks/useFrameRenderer.d.ts +15 -0
- package/dist/hooks/useFrameRenderer.d.ts.map +1 -0
- package/dist/hooks/useFrameRenderer.js +23 -0
- package/dist/hooks/useLandscapeLive.d.ts +29 -0
- package/dist/hooks/useLandscapeLive.d.ts.map +1 -0
- package/dist/hooks/useLandscapeLive.js +41 -0
- package/dist/hooks/useLandscapeMaps.d.ts +32 -0
- package/dist/hooks/useLandscapeMaps.d.ts.map +1 -0
- package/dist/hooks/useLandscapeMaps.js +138 -0
- package/dist/hooks/useOceanLive.d.ts +29 -0
- package/dist/hooks/useOceanLive.d.ts.map +1 -0
- package/dist/hooks/useOceanLive.js +38 -0
- package/dist/hooks/useOceanMaterial.d.ts +39 -0
- package/dist/hooks/useOceanMaterial.d.ts.map +1 -0
- package/dist/hooks/useOceanMaterial.js +65 -0
- package/dist/hooks/useTerrainClipmap.d.ts +12 -0
- package/dist/hooks/useTerrainClipmap.d.ts.map +1 -0
- package/dist/hooks/useTerrainClipmap.js +10 -0
- package/dist/hooks/useTerrainLive.d.ts +34 -0
- package/dist/hooks/useTerrainLive.d.ts.map +1 -0
- package/dist/hooks/useTerrainLive.js +45 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -0
- package/dist/presets/landscapePresets.d.ts +60 -0
- package/dist/presets/landscapePresets.d.ts.map +1 -0
- package/dist/presets/landscapePresets.js +194 -0
- package/dist/presets/landscapeTypes.d.ts +195 -0
- package/dist/presets/landscapeTypes.d.ts.map +1 -0
- package/dist/presets/landscapeTypes.js +315 -0
- package/dist/presets/oceanSurfacePresets.d.ts +33 -0
- package/dist/presets/oceanSurfacePresets.d.ts.map +1 -0
- package/dist/presets/oceanSurfacePresets.js +245 -0
- package/dist/presets/terrainPresets.d.ts +28 -0
- package/dist/presets/terrainPresets.d.ts.map +1 -0
- package/dist/presets/terrainPresets.js +293 -0
- package/dist/presets/volumetricCloudPresets.d.ts +38 -0
- package/dist/presets/volumetricCloudPresets.d.ts.map +1 -0
- package/dist/presets/volumetricCloudPresets.js +480 -0
- package/dist/shaders/clouds/CirrusMaterial.d.ts +84 -0
- package/dist/shaders/clouds/CirrusMaterial.d.ts.map +1 -0
- package/dist/shaders/clouds/CirrusMaterial.js +167 -0
- package/dist/shaders/clouds/CloudCompositeMaterial.d.ts +20 -0
- package/dist/shaders/clouds/CloudCompositeMaterial.d.ts.map +1 -0
- package/dist/shaders/clouds/CloudCompositeMaterial.js +82 -0
- package/dist/shaders/clouds/CloudResolveMaterial.d.ts +22 -0
- package/dist/shaders/clouds/CloudResolveMaterial.d.ts.map +1 -0
- package/dist/shaders/clouds/CloudResolveMaterial.js +77 -0
- package/dist/shaders/clouds/CloudVolumeMaterial.d.ts +143 -0
- package/dist/shaders/clouds/CloudVolumeMaterial.d.ts.map +1 -0
- package/dist/shaders/clouds/CloudVolumeMaterial.js +249 -0
- package/dist/shaders/clouds/SkyBackgroundMaterial.d.ts +21 -0
- package/dist/shaders/clouds/SkyBackgroundMaterial.d.ts.map +1 -0
- package/dist/shaders/clouds/SkyBackgroundMaterial.js +42 -0
- package/dist/shaders/glsl/cloudCore.glsl.d.ts +24 -0
- package/dist/shaders/glsl/cloudCore.glsl.d.ts.map +1 -0
- package/dist/shaders/glsl/cloudCore.glsl.js +348 -0
- package/dist/shaders/glsl/landscapeCore.glsl.d.ts +49 -0
- package/dist/shaders/glsl/landscapeCore.glsl.d.ts.map +1 -0
- package/dist/shaders/glsl/landscapeCore.glsl.js +518 -0
- package/dist/shaders/glsl/noiseBake.glsl.d.ts +30 -0
- package/dist/shaders/glsl/noiseBake.glsl.d.ts.map +1 -0
- package/dist/shaders/glsl/noiseBake.glsl.js +164 -0
- package/dist/shaders/glsl/oceanCore.glsl.d.ts +52 -0
- package/dist/shaders/glsl/oceanCore.glsl.d.ts.map +1 -0
- package/dist/shaders/glsl/oceanCore.glsl.js +421 -0
- package/dist/shaders/glsl/terrainCore.glsl.d.ts +78 -0
- package/dist/shaders/glsl/terrainCore.glsl.d.ts.map +1 -0
- package/dist/shaders/glsl/terrainCore.glsl.js +625 -0
- package/dist/shaders/landscape/LandscapeMaterial.d.ts +73 -0
- package/dist/shaders/landscape/LandscapeMaterial.d.ts.map +1 -0
- package/dist/shaders/landscape/LandscapeMaterial.js +136 -0
- package/dist/shaders/ocean/OceanSurfaceMaterial.d.ts +57 -0
- package/dist/shaders/ocean/OceanSurfaceMaterial.d.ts.map +1 -0
- package/dist/shaders/ocean/OceanSurfaceMaterial.js +268 -0
- package/dist/shaders/terrain/TerrainMaterial.d.ts +80 -0
- package/dist/shaders/terrain/TerrainMaterial.d.ts.map +1 -0
- package/dist/shaders/terrain/TerrainMaterial.js +291 -0
- package/dist/types/cloudConfigs.d.ts +244 -0
- package/dist/types/cloudConfigs.d.ts.map +1 -0
- package/dist/types/cloudConfigs.js +282 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +4 -1
- package/dist/types/landscapeConfigs.d.ts +218 -0
- package/dist/types/landscapeConfigs.d.ts.map +1 -0
- package/dist/types/landscapeConfigs.js +256 -0
- package/dist/types/oceanConfigs.d.ts +290 -0
- package/dist/types/oceanConfigs.d.ts.map +1 -0
- package/dist/types/oceanConfigs.js +380 -0
- package/dist/types/terrainConfigs.d.ts +251 -0
- package/dist/types/terrainConfigs.d.ts.map +1 -0
- package/dist/types/terrainConfigs.js +292 -0
- package/dist/utils/cloudUniforms.d.ts +14 -0
- package/dist/utils/cloudUniforms.d.ts.map +1 -0
- package/dist/utils/cloudUniforms.js +122 -0
- package/dist/utils/frameRenderer.d.ts +33 -0
- package/dist/utils/frameRenderer.d.ts.map +1 -0
- package/dist/utils/frameRenderer.js +24 -0
- package/dist/utils/handleCloudsAnimations.d.ts +16 -0
- package/dist/utils/handleCloudsAnimations.d.ts.map +1 -0
- package/dist/utils/handleCloudsAnimations.js +64 -0
- package/dist/utils/landscapeGeometry.d.ts +61 -0
- package/dist/utils/landscapeGeometry.d.ts.map +1 -0
- package/dist/utils/landscapeGeometry.js +126 -0
- package/dist/utils/landscapeHeight.d.ts +44 -0
- package/dist/utils/landscapeHeight.d.ts.map +1 -0
- package/dist/utils/landscapeHeight.js +65 -0
- package/dist/utils/landscapeTextures.d.ts +94 -0
- package/dist/utils/landscapeTextures.d.ts.map +1 -0
- package/dist/utils/landscapeTextures.js +290 -0
- package/dist/utils/landscapeUniforms.d.ts +20 -0
- package/dist/utils/landscapeUniforms.d.ts.map +1 -0
- package/dist/utils/landscapeUniforms.js +61 -0
- package/dist/utils/oceanUniforms.d.ts +47 -0
- package/dist/utils/oceanUniforms.d.ts.map +1 -0
- package/dist/utils/oceanUniforms.js +216 -0
- package/dist/utils/rtin.d.ts +63 -0
- package/dist/utils/rtin.d.ts.map +1 -0
- package/dist/utils/rtin.js +202 -0
- package/dist/utils/terrainUniforms.d.ts +14 -0
- package/dist/utils/terrainUniforms.d.ts.map +1 -0
- package/dist/utils/terrainUniforms.js +196 -0
- package/package.json +2 -2
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config shapes for the landscape system — a bounded, authored ground tile built
|
|
3
|
+
* from a heightmap and textured through splat maps.
|
|
4
|
+
*
|
|
5
|
+
* This is NOT a mode of the procedural terrain and does not share a config with
|
|
6
|
+
* it. Terrain is an infinite camera-following clipmap generated from noise; a
|
|
7
|
+
* landscape is a finite tile whose shape and materials the user supplies. Both
|
|
8
|
+
* may be enabled in one scene; nothing here reads `terrainConfigs`.
|
|
9
|
+
*
|
|
10
|
+
* Declared in the viewer, next to the material that consumes it, for the same
|
|
11
|
+
* reason `terrainConfigs` and `oceanConfigs` are.
|
|
12
|
+
*/
|
|
13
|
+
// -----------------------------------------------------------------------------
|
|
14
|
+
// Defaults
|
|
15
|
+
// -----------------------------------------------------------------------------
|
|
16
|
+
export const defaultLandscapeSurface = {
|
|
17
|
+
name: 'Surface',
|
|
18
|
+
diffuse: '',
|
|
19
|
+
normal: '',
|
|
20
|
+
displacement: '',
|
|
21
|
+
repeat: 200,
|
|
22
|
+
normalStrength: 0.6,
|
|
23
|
+
saturation: 1,
|
|
24
|
+
tint: '#ffffff',
|
|
25
|
+
roughness: 0.9,
|
|
26
|
+
metalness: 0,
|
|
27
|
+
heightBlend: 0.6,
|
|
28
|
+
aperiodic: true,
|
|
29
|
+
triplanar: false,
|
|
30
|
+
flipNormalY: false,
|
|
31
|
+
};
|
|
32
|
+
export const defaultAutoSplat = {
|
|
33
|
+
bands: [0, 0.35, 0.75],
|
|
34
|
+
bandWidth: 0.45,
|
|
35
|
+
slopeStart: 0.35,
|
|
36
|
+
slopeEnd: 0.62,
|
|
37
|
+
noise: 0.12,
|
|
38
|
+
noiseSize: 400,
|
|
39
|
+
};
|
|
40
|
+
export const defaultLandscapeConfig = {
|
|
41
|
+
enabled: false,
|
|
42
|
+
host: 'ground',
|
|
43
|
+
heightMap: '',
|
|
44
|
+
heightEncoding: 'grayscale',
|
|
45
|
+
splatSource: 'auto',
|
|
46
|
+
splatMaps: [],
|
|
47
|
+
autoSplat: { ...defaultAutoSplat, bands: [...defaultAutoSplat.bands] },
|
|
48
|
+
aoMap: '',
|
|
49
|
+
size: 2048,
|
|
50
|
+
elevationScale: 300,
|
|
51
|
+
elevationBias: 0,
|
|
52
|
+
origin: [0, 0, 0],
|
|
53
|
+
rotationY: 0,
|
|
54
|
+
smoothness: 1,
|
|
55
|
+
surfaces: [],
|
|
56
|
+
surfaceSamples: 3,
|
|
57
|
+
macroVariation: 0.25,
|
|
58
|
+
macroSize: 900,
|
|
59
|
+
aoIntensity: 0.8,
|
|
60
|
+
envMapIntensity: 0.9,
|
|
61
|
+
preset: '',
|
|
62
|
+
};
|
|
63
|
+
export const defaultLandscapeQuality = {
|
|
64
|
+
meshError: 1.5,
|
|
65
|
+
mobileMeshError: 6,
|
|
66
|
+
chunks: 4,
|
|
67
|
+
arrayResolution: 1024,
|
|
68
|
+
anisotropy: 4,
|
|
69
|
+
stochastic: true,
|
|
70
|
+
triplanar: true,
|
|
71
|
+
castShadows: true,
|
|
72
|
+
receiveShadows: true,
|
|
73
|
+
wireframe: false,
|
|
74
|
+
};
|
|
75
|
+
export const defaultLandscapeSettings = {
|
|
76
|
+
id: '3drise-landscape',
|
|
77
|
+
type: 'landscape',
|
|
78
|
+
config: { ...defaultLandscapeConfig },
|
|
79
|
+
quality: { ...defaultLandscapeQuality },
|
|
80
|
+
};
|
|
81
|
+
/** Hard ceiling. Two splat maps carry four channels each, and the index is packed
|
|
82
|
+
* as `i / MAX_SURFACES` in the weight pair. */
|
|
83
|
+
export const MAX_LANDSCAPE_SURFACES = 8;
|
|
84
|
+
/** The object host keeps the same material with a shorter list. */
|
|
85
|
+
export const MAX_OBJECT_SURFACES = 4;
|
|
86
|
+
export const LANDSCAPE_SCHEMA = [
|
|
87
|
+
{ key: 'size', label: 'Size', group: 'form', min: 4, max: 40000, step: 4, unit: 'm', description: 'World units across the tile. The heightmap is square, so this is both sides.' },
|
|
88
|
+
{ key: 'elevationScale', label: 'Elevation', group: 'form', min: 0, max: 4000, step: 1, unit: 'm', description: 'World height of the heightmap’s full range. This is the knob that turns a relief map into mountains.' },
|
|
89
|
+
{ key: 'elevationBias', label: 'Base height', group: 'form', min: -2000, max: 2000, step: 1, unit: 'm', description: 'World Y added after scaling — where the lowest point of the heightmap sits.' },
|
|
90
|
+
{ key: 'rotationY', label: 'Rotation', group: 'form', min: 0, max: 360, step: 1, unit: 'deg', hosts: ['ground'], description: 'Turns the tile about its centre. The placed host uses its own transform instead.' },
|
|
91
|
+
{ key: 'smoothness', label: 'Smoothness', group: 'form', min: 0, max: 8, step: 0.05, description: 'Bicubic filtering of the heightmap over a widened footprint. Above 0 it is what keeps an 8-bit heightmap from rendering as terraced steps.' },
|
|
92
|
+
{ key: 'surfaceSamples', label: 'Surface samples', group: 'surface', min: 1, max: 4, step: 1, description: 'How many of the heaviest surface weights are blended per pixel. The strongest cost dial in the material — 2 is enough almost everywhere, and artefacts only show where three splat channels genuinely overlap.' },
|
|
93
|
+
{ key: 'macroVariation', label: 'Macro variation', group: 'surface', min: 0, max: 1, step: 0.005, description: 'Large-scale albedo break-up, generated rather than sampled. Without it a splat layer is one flat colour across hundreds of metres and the eye reads it as untextured.' },
|
|
94
|
+
{ key: 'macroSize', label: 'Macro size', group: 'surface', min: 50, max: 8000, step: 10, unit: 'm', description: 'World size of that break-up.' },
|
|
95
|
+
{ key: 'aoIntensity', label: 'AO intensity', group: 'surface', min: 0, max: 2, step: 0.01, description: 'Strength of the baked ambient occlusion map, when one is supplied.' },
|
|
96
|
+
{ key: 'envMapIntensity', label: 'Environment', group: 'surface', min: 0, max: 3, step: 0.01, description: 'How much the scene’s HDR environment lights the ground.' },
|
|
97
|
+
];
|
|
98
|
+
export const LANDSCAPE_AUTOSPLAT_SCHEMA = [
|
|
99
|
+
{ key: 'bandWidth', label: 'Band width', group: 'surface', min: 0.05, max: 1.5, step: 0.01, description: 'How far each surface reaches either side of its height band. Wide bands cross-fade; narrow ones stripe.' },
|
|
100
|
+
{ key: 'slopeStart', label: 'Rock from slope', group: 'surface', min: 0, max: 1, step: 0.005, description: 'Slope at which the last surface (rock) starts showing through. Splatting rock by slope rather than height is what makes a cliff read as a cliff at any altitude.' },
|
|
101
|
+
{ key: 'slopeEnd', label: 'Bare rock at slope', group: 'surface', min: 0, max: 1, step: 0.005, description: 'Slope at which the surface is fully rock.' },
|
|
102
|
+
{ key: 'noise', label: 'Band break-up', group: 'surface', min: 0, max: 1, step: 0.005, description: 'Jitters the height before banding, so the boundaries are not contour lines.' },
|
|
103
|
+
{ key: 'noiseSize', label: 'Break-up size', group: 'surface', min: 10, max: 4000, step: 5, unit: 'm', description: 'World size of that jitter.' },
|
|
104
|
+
];
|
|
105
|
+
export const LANDSCAPE_QUALITY_SCHEMA = [
|
|
106
|
+
{ key: 'meshError', label: 'Mesh error', group: 'quality', min: 0, max: 60, step: 0.1, unit: 'm', description: 'The most a triangle may be wrong by, vertically. Lower spends triangles on cliffs; 0 puts a vertex on every heightmap texel. Changing it rebuilds the mesh, so it commits on release.' },
|
|
107
|
+
{ key: 'chunks', label: 'Culling chunks', group: 'quality', min: 1, max: 12, step: 1, description: 'The tile is split into this many chunks per side over one shared vertex buffer, so it frustum-culls instead of drawing whole. More chunks cull better and cost more draw calls.' },
|
|
108
|
+
{ key: 'anisotropy', label: 'Anisotropy', group: 'quality', min: 1, max: 16, step: 1, description: 'Sharpness of ground textures at grazing angles — which on a landscape is most of the screen.' },
|
|
109
|
+
{ key: 'stochastic', label: 'Stochastic tiling', group: 'quality', type: 'boolean', description: 'Breaks the repeat grid on surfaces flagged for it, with a variance-preserving three-tap blend. Doubles the fetches for those surfaces and is the difference between authored ground and wallpaper.' },
|
|
110
|
+
{ key: 'triplanar', label: 'Triplanar', group: 'quality', type: 'boolean', description: 'Enables world-axis projection for surfaces flagged for it, so a cliff face is not a smear of stretched pixels. Biplanar in practice — two planes, not three.' },
|
|
111
|
+
{ key: 'castShadows', label: 'Cast shadows', group: 'quality', type: 'boolean', description: 'The landscape casts into the scene’s shadow map. It is bounded, so the sun’s shadow camera actually covers it — which is why this is possible here and not for the procedural terrain.' },
|
|
112
|
+
{ key: 'receiveShadows', label: 'Receive shadows', group: 'quality', type: 'boolean', description: 'Objects standing on the landscape cast onto it.' },
|
|
113
|
+
{ key: 'wireframe', label: 'Wireframe', group: 'quality', type: 'boolean', description: 'Draw the adaptive mesh itself. The fastest way to see what the error budget is buying.' },
|
|
114
|
+
];
|
|
115
|
+
// -----------------------------------------------------------------------------
|
|
116
|
+
// What can be driven live, and what cannot
|
|
117
|
+
// -----------------------------------------------------------------------------
|
|
118
|
+
//
|
|
119
|
+
// A slider drag fires on every pointer-move. Everything that is only a uniform
|
|
120
|
+
// can be written straight into the renderer at that rate; everything that
|
|
121
|
+
// rebuilds something cannot, and has to wait for the pointer to come up.
|
|
122
|
+
//
|
|
123
|
+
// These sets are the single statement of that split. The controller passes every
|
|
124
|
+
// key it has and the renderer's live handle drops the ones that are not here, so
|
|
125
|
+
// a rebuild key cannot half-apply — which is what `size` did before this existed:
|
|
126
|
+
// the triplanar scale is a uniform and moved during the drag while the mesh,
|
|
127
|
+
// built at the committed size, did not.
|
|
128
|
+
/** Config keys that are uniforms and nothing else. */
|
|
129
|
+
export const LANDSCAPE_LIVE_CONFIG_KEYS = [
|
|
130
|
+
'elevationScale',
|
|
131
|
+
'elevationBias',
|
|
132
|
+
'smoothness',
|
|
133
|
+
'macroVariation',
|
|
134
|
+
'macroSize',
|
|
135
|
+
'aoIntensity',
|
|
136
|
+
'envMapIntensity',
|
|
137
|
+
'rotationY',
|
|
138
|
+
];
|
|
139
|
+
/** Quality keys that are uniforms, material flags or texture state. */
|
|
140
|
+
export const LANDSCAPE_LIVE_QUALITY_KEYS = [
|
|
141
|
+
'wireframe',
|
|
142
|
+
'castShadows',
|
|
143
|
+
'receiveShadows',
|
|
144
|
+
'anisotropy',
|
|
145
|
+
];
|
|
146
|
+
/**
|
|
147
|
+
* Keys that rebuild something, listed for the panel to explain itself with.
|
|
148
|
+
*
|
|
149
|
+
* meshError, chunks re-run RTIN and rebuild every index buffer
|
|
150
|
+
* arrayResolution repacks up to sixteen textures
|
|
151
|
+
* surfaceSamples changes a #define, so the shader recompiles
|
|
152
|
+
* stochastic, triplanar likewise
|
|
153
|
+
* size, heightMap, splatMaps, heightEncoding, splatSource, surfaces
|
|
154
|
+
* change the mesh or the arrays
|
|
155
|
+
*/
|
|
156
|
+
export const LANDSCAPE_REBUILD_KEYS = [
|
|
157
|
+
'meshError',
|
|
158
|
+
'mobileMeshError',
|
|
159
|
+
'chunks',
|
|
160
|
+
'arrayResolution',
|
|
161
|
+
'surfaceSamples',
|
|
162
|
+
'stochastic',
|
|
163
|
+
'triplanar',
|
|
164
|
+
'size',
|
|
165
|
+
'heightMap',
|
|
166
|
+
'heightEncoding',
|
|
167
|
+
'splatSource',
|
|
168
|
+
'splatMaps',
|
|
169
|
+
'surfaces',
|
|
170
|
+
];
|
|
171
|
+
/** Every surface field except the three texture slots is a uniform. */
|
|
172
|
+
export const LANDSCAPE_LIVE_SURFACE_KEYS = [
|
|
173
|
+
'repeat',
|
|
174
|
+
'normalStrength',
|
|
175
|
+
'saturation',
|
|
176
|
+
'tint',
|
|
177
|
+
'roughness',
|
|
178
|
+
'metalness',
|
|
179
|
+
'heightBlend',
|
|
180
|
+
'aperiodic',
|
|
181
|
+
'triplanar',
|
|
182
|
+
'flipNormalY',
|
|
183
|
+
];
|
|
184
|
+
/** Auto-splat is entirely uniforms — all four rows plus the band list. */
|
|
185
|
+
export const LANDSCAPE_LIVE_AUTOSPLAT_KEYS = [
|
|
186
|
+
'bandWidth',
|
|
187
|
+
'slopeStart',
|
|
188
|
+
'slopeEnd',
|
|
189
|
+
'noise',
|
|
190
|
+
'noiseSize',
|
|
191
|
+
];
|
|
192
|
+
// =============================================================================
|
|
193
|
+
// Normalisation
|
|
194
|
+
// =============================================================================
|
|
195
|
+
//
|
|
196
|
+
// Same rule as the terrain, not the ocean: a blob with no heightMap renders
|
|
197
|
+
// nothing. There is no legacy landscape shape to migrate, and a landscape with
|
|
198
|
+
// no heightmap is not a landscape.
|
|
199
|
+
//
|
|
200
|
+
// Each block merges over its own defaults SEPARATELY, so a quality edit does not
|
|
201
|
+
// hand the mesh a new config object and re-run RTIN.
|
|
202
|
+
const isRecord = (v) => typeof v === 'object' && v !== null;
|
|
203
|
+
export function normalizeLandscapeSurface(raw, index = 0) {
|
|
204
|
+
const src = isRecord(raw) ? raw : {};
|
|
205
|
+
return {
|
|
206
|
+
...defaultLandscapeSurface,
|
|
207
|
+
name: typeof src.name === 'string' ? src.name : `Surface ${index + 1}`,
|
|
208
|
+
...src,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
export function normalizeLandscape(raw) {
|
|
212
|
+
if (!isRecord(raw))
|
|
213
|
+
return null;
|
|
214
|
+
if (typeof raw.heightMap !== 'string' || raw.heightMap.length === 0)
|
|
215
|
+
return null;
|
|
216
|
+
const host = raw.host === 'object' ? 'object' : 'ground';
|
|
217
|
+
const limit = host === 'object' ? MAX_OBJECT_SURFACES : MAX_LANDSCAPE_SURFACES;
|
|
218
|
+
const surfaces = Array.isArray(raw.surfaces)
|
|
219
|
+
? raw.surfaces.slice(0, limit).map((s, i) => normalizeLandscapeSurface(s, i))
|
|
220
|
+
: [];
|
|
221
|
+
return {
|
|
222
|
+
...defaultLandscapeConfig,
|
|
223
|
+
...raw,
|
|
224
|
+
host,
|
|
225
|
+
surfaces,
|
|
226
|
+
splatMaps: Array.isArray(raw.splatMaps)
|
|
227
|
+
? raw.splatMaps.filter((s) => typeof s === 'string').slice(0, 2)
|
|
228
|
+
: [],
|
|
229
|
+
autoSplat: {
|
|
230
|
+
...defaultAutoSplat,
|
|
231
|
+
...(isRecord(raw.autoSplat) ? raw.autoSplat : {}),
|
|
232
|
+
bands: Array.isArray(raw.autoSplat?.bands)
|
|
233
|
+
? raw.autoSplat.bands
|
|
234
|
+
: [...defaultAutoSplat.bands],
|
|
235
|
+
},
|
|
236
|
+
origin: Array.isArray(raw.origin) && raw.origin.length === 3
|
|
237
|
+
? [...raw.origin]
|
|
238
|
+
: [...defaultLandscapeConfig.origin],
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
export function normalizeLandscapeQuality(raw) {
|
|
242
|
+
return {
|
|
243
|
+
...defaultLandscapeQuality,
|
|
244
|
+
...(isRecord(raw) ? raw : {}),
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
export function normalizeLandscapeSettings(raw) {
|
|
248
|
+
const source = isRecord(raw) ? raw : {};
|
|
249
|
+
const config = normalizeLandscape(source.config);
|
|
250
|
+
return {
|
|
251
|
+
id: typeof source.id === 'string' ? source.id : defaultLandscapeSettings.id,
|
|
252
|
+
type: 'landscape',
|
|
253
|
+
config: config ?? { ...defaultLandscapeConfig },
|
|
254
|
+
quality: normalizeLandscapeQuality(source.quality),
|
|
255
|
+
};
|
|
256
|
+
}
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config shapes for the ocean that lives in this package.
|
|
3
|
+
*
|
|
4
|
+
* Declared locally rather than in `@3driseai/3drise-core`, alongside
|
|
5
|
+
* `terrainConfigs.ts` and `cloudConfigs.ts`, because the material and the
|
|
6
|
+
* renderer are here and nothing outside the viewer needs to construct these by
|
|
7
|
+
* hand.
|
|
8
|
+
*
|
|
9
|
+
* Core's `OceanSettings` is the retired shape — a flat plane with a
|
|
10
|
+
* `materialSettings` block picked out of the water material registry — and is
|
|
11
|
+
* deliberately left alone: a saved project still carries one. Unlike terrain,
|
|
12
|
+
* where a legacy blob normalises to NOTHING, a legacy ocean normalises to a real
|
|
13
|
+
* ocean: a project saved before this system existed very possibly had water, and
|
|
14
|
+
* dropping it would delete it. See `normalizeOcean` at the bottom.
|
|
15
|
+
*
|
|
16
|
+
* An ocean is ONE wave model in two containers, not two renderers — the same way
|
|
17
|
+
* three of the four cloud types share one marcher and all four landforms share
|
|
18
|
+
* one height field. `waterType` shapes the spectrum; `host` chooses the mesh.
|
|
19
|
+
*/
|
|
20
|
+
/** The four water bodies the spectrum is shaped for. */
|
|
21
|
+
export type WaterType = 'sea' | 'lake' | 'storm' | 'shore';
|
|
22
|
+
/**
|
|
23
|
+
* Where the water lives.
|
|
24
|
+
*
|
|
25
|
+
* `world` is the sea: a camera-following clipmap at `seaLevel`, one per scene,
|
|
26
|
+
* mounted by the environment. `object` is a placed body of water — a pool, a
|
|
27
|
+
* pond, a canal — a bounded grid with its own transform, any number of them,
|
|
28
|
+
* mounted as ordinary scene objects. The clouds' `object` / `layer` split, and
|
|
29
|
+
* for the same reason: a deck that stops at a sphere is not a deck, and a pool
|
|
30
|
+
* that follows the camera is not a pool.
|
|
31
|
+
*/
|
|
32
|
+
export type WaterHost = 'world' | 'object';
|
|
33
|
+
/** Gerstner today; the FFT cascades land behind the same interface. */
|
|
34
|
+
export type WaveModel = 'gerstner' | 'fft';
|
|
35
|
+
export type ReflectionMode = 'planar' | 'env' | 'off';
|
|
36
|
+
export type TerrainInteraction = 'auto' | 'on' | 'off';
|
|
37
|
+
/** Fields every water body shares, whatever its type or host. */
|
|
38
|
+
export interface OceanSurfaceConfig {
|
|
39
|
+
enabled: boolean;
|
|
40
|
+
host: WaterHost;
|
|
41
|
+
/** `gerstner` sums analytic trochoids in the vertex shader. `fft` swaps the
|
|
42
|
+
* height field for Tessendorf cascades and changes nothing above it — the
|
|
43
|
+
* material, the shading, the panel and the saved shape are identical. */
|
|
44
|
+
waveModel: WaveModel;
|
|
45
|
+
/** World Y the surface sits at. **World host only** — a placed body takes its
|
|
46
|
+
* level from its own transform, which is what makes two water bodies at
|
|
47
|
+
* different heights in one scene work without either knowing about the
|
|
48
|
+
* other. Nothing here is tied to the terrain's `seaLevel`: the shoreline is
|
|
49
|
+
* computed from the difference, never configured. */
|
|
50
|
+
seaLevel: number;
|
|
51
|
+
/** Extent of a placed body, in world units. **Object host only.** */
|
|
52
|
+
size: [number, number];
|
|
53
|
+
/** Grid resolution of a placed body. **Object host only.** */
|
|
54
|
+
segments: number;
|
|
55
|
+
/** Fraction of the half-extent over which displacement tapers to zero at the
|
|
56
|
+
* rim of a placed body. **Object host only.** Without it the boundary is a
|
|
57
|
+
* sawn-off cliff of water. */
|
|
58
|
+
edgeFade: number;
|
|
59
|
+
/** Wind speed at 10 m, in m/s. The whole sea state comes off this: peak
|
|
60
|
+
* wavelength goes as U squared and significant wave height with it, so this
|
|
61
|
+
* is the one knob that decides whether this is a millpond or a gale. */
|
|
62
|
+
windSpeed: number;
|
|
63
|
+
/** Compass bearing the wind blows toward, in degrees. Waves travel with it. */
|
|
64
|
+
windBearing: number;
|
|
65
|
+
/** Open water upwind, in km. Short fetch means small, short, steep waves
|
|
66
|
+
* however hard it blows — which is exactly why a lake in a storm does not
|
|
67
|
+
* look like an ocean in one. */
|
|
68
|
+
fetch: number;
|
|
69
|
+
/** Angular spread of the wave train about the wind bearing, in degrees. Zero
|
|
70
|
+
* gives a corduroy of parallel crests; real seas run 25-40. */
|
|
71
|
+
directionalSpread: number;
|
|
72
|
+
/** Number of trochoidal components summed. Cost is linear in it, and every
|
|
73
|
+
* component is a sin and a cos per vertex. */
|
|
74
|
+
waveComponents: number;
|
|
75
|
+
/** Artistic multiplier over the physically derived wave height. 1 is the
|
|
76
|
+
* Pierson-Moskowitz fit for the given wind and fetch. */
|
|
77
|
+
amplitudeScale: number;
|
|
78
|
+
/** Horizontal displacement, as a fraction of the limit where a crest folds
|
|
79
|
+
* through itself. This is what makes crests peaked rather than sinusoidal —
|
|
80
|
+
* and it is what generates the Jacobian that foam is read from, so at 0
|
|
81
|
+
* there are no whitecaps to find. */
|
|
82
|
+
choppiness: number;
|
|
83
|
+
/** Energy pushed toward the long, low, narrow-band end of the spectrum.
|
|
84
|
+
* Swell is what has travelled out of the weather that made it. */
|
|
85
|
+
swell: number;
|
|
86
|
+
/** Extra steepening of the shorter components. Above ~1 the surface starts to
|
|
87
|
+
* self-intersect and the wave folds inside out; clamped in the uniforms. */
|
|
88
|
+
steepness: number;
|
|
89
|
+
/** How much of the compressing surface reads as whitecap. */
|
|
90
|
+
foamAmount: number;
|
|
91
|
+
/** How far foam trails behind the crest that made it. A real whitecap
|
|
92
|
+
* persists after the crest has moved on; at 0 it flickers on and off with
|
|
93
|
+
* the crest and reads as sparkle rather than as foam. */
|
|
94
|
+
foamDecay: number;
|
|
95
|
+
/** Size of the break-up noise in the foam, in world units. */
|
|
96
|
+
foamSize: number;
|
|
97
|
+
/** Water seen at depth — the body colour. */
|
|
98
|
+
deepColor: string;
|
|
99
|
+
/** Water seen over something close behind it. Until the refraction grab
|
|
100
|
+
* exists this is the grazing tint; after it, it is the shallow end of the
|
|
101
|
+
* absorption ramp. */
|
|
102
|
+
shallowColor: string;
|
|
103
|
+
foamColor: string;
|
|
104
|
+
/** Beer-Lambert absorption per metre. Higher swallows the bottom sooner. */
|
|
105
|
+
absorption: number;
|
|
106
|
+
/** Suspended matter. Lifts the shallow colour and softens the refraction. */
|
|
107
|
+
clarity: number;
|
|
108
|
+
/** Widens the specular lobe. Water is smooth; this is fine detail below the
|
|
109
|
+
* mesh, not surface finish. */
|
|
110
|
+
roughness: number;
|
|
111
|
+
/** Specular strength. The sun glitter path from horizon to camera is most of
|
|
112
|
+
* what says "water" at distance, and it comes from here. */
|
|
113
|
+
specular: number;
|
|
114
|
+
/** Sun scattering through the body of a wave — crests glowing when the sun is
|
|
115
|
+
* behind them. The second-most recognisable water cue after glitter. */
|
|
116
|
+
sssStrength: number;
|
|
117
|
+
sssColor: string;
|
|
118
|
+
/** High-frequency normal detail added per fragment, below mesh resolution.
|
|
119
|
+
* This is where the energy lost to the per-ring wave LOD goes. */
|
|
120
|
+
detailStrength: number;
|
|
121
|
+
/** Size of that detail, in world units. */
|
|
122
|
+
detailSize: number;
|
|
123
|
+
reflection: ReflectionMode;
|
|
124
|
+
/** Strength of the refracted (see-through) term once the grab exists. */
|
|
125
|
+
refraction: number;
|
|
126
|
+
/** Sky-dome fill, from the same atmosphere the sky and clouds use. */
|
|
127
|
+
ambient: number;
|
|
128
|
+
/** Rate distant water fades into the sky behind it. Water needs more of this
|
|
129
|
+
* than ground, because most of what you see looking at the sea IS the sky. */
|
|
130
|
+
aerialPerspective: number;
|
|
131
|
+
/** Radiance scale, so water sits at the same exposure as sky, clouds and
|
|
132
|
+
* terrain whether or not the cloud composite is tonemapping the frame. */
|
|
133
|
+
exposure: number;
|
|
134
|
+
/** `auto` turns on when the scene has terrain enabled. Off costs nothing:
|
|
135
|
+
* every terrain branch in the shader early-outs on one uniform. */
|
|
136
|
+
terrainInteraction: TerrainInteraction;
|
|
137
|
+
/** Strength of the terrain shadow marched down the sun vector. Terrain does
|
|
138
|
+
* not write into the scene shadow map — its shadow camera is framed around
|
|
139
|
+
* objects — so this is the only way a headland shadows the water beside it. */
|
|
140
|
+
terrainShadow: number;
|
|
141
|
+
/** Depth over which the shallow colour and the shore foam ramp in. */
|
|
142
|
+
shoreDepth: number;
|
|
143
|
+
/** Strength of the foam line where the ground comes up through the surface. */
|
|
144
|
+
shoreFoam: number;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* A water body, as stored.
|
|
148
|
+
*
|
|
149
|
+
* `type` is 'ocean' — the OBJECT type anything routing on object type reads —
|
|
150
|
+
* with the model kept separately in `waterType` and the container in `host`,
|
|
151
|
+
* exactly as the clouds keep `deckType` and the terrain keeps `terrainType` apart
|
|
152
|
+
* from `type`.
|
|
153
|
+
*/
|
|
154
|
+
export type OceanConfig = OceanSurfaceConfig & {
|
|
155
|
+
type: 'ocean';
|
|
156
|
+
waterType: WaterType;
|
|
157
|
+
/** Name of the preset the numbers came from, or '' once any of them is
|
|
158
|
+
* edited. Purely a UI bookmark — the renderer never reads it. */
|
|
159
|
+
preset?: string;
|
|
160
|
+
};
|
|
161
|
+
/** Cost and extent knobs. World-host geometry lives here; a placed body sizes
|
|
162
|
+
* itself from its own config, because its extent is a design decision rather
|
|
163
|
+
* than a performance one. */
|
|
164
|
+
export interface OceanQualityConfig {
|
|
165
|
+
/** Clipmap ring count. Each doubles its cell size, so visible radius is
|
|
166
|
+
* roughly `cellSize * segments * 2^(levels-1)`. */
|
|
167
|
+
levels: number;
|
|
168
|
+
/** Grid resolution per ring side. */
|
|
169
|
+
segments: number;
|
|
170
|
+
/** Finest cell, in world units, at the camera. Water is smooth, so this
|
|
171
|
+
* matters more than reach: waves are metres, not kilometres. */
|
|
172
|
+
cellSize: number;
|
|
173
|
+
/** 1/(2R). Drops the surface away with the square of distance so the sea
|
|
174
|
+
* meets a real horizon instead of running flat to the far plane. */
|
|
175
|
+
curvature: number;
|
|
176
|
+
/** Resolution of the planar reflection target, as a fraction of the frame.
|
|
177
|
+
* 0 disables the pass and falls back to `scene.environment`. */
|
|
178
|
+
reflectionScale: number;
|
|
179
|
+
/** Resolution of the refraction/depth grab, as a fraction of the frame. */
|
|
180
|
+
refractionScale: number;
|
|
181
|
+
/** Steps in the terrain shadow march, nearest the camera. 0 disables it. */
|
|
182
|
+
terrainShadowSteps: number;
|
|
183
|
+
/** Range over which that march fades out. It runs per vertex, so lowering
|
|
184
|
+
* this drops whole clipmap rings out of it. */
|
|
185
|
+
terrainShadowDistance: number;
|
|
186
|
+
/** Distance over which the fragment-stage ripple detail fades out. */
|
|
187
|
+
detailFadeDistance: number;
|
|
188
|
+
/** Receive the scene's directional shadow map, so objects cast onto water. */
|
|
189
|
+
receiveShadows: boolean;
|
|
190
|
+
wireframe: boolean;
|
|
191
|
+
}
|
|
192
|
+
/** Open ocean. The reference case: long swell under a wind sea, deep colour. */
|
|
193
|
+
export declare const defaultSeaConfig: OceanConfig;
|
|
194
|
+
/**
|
|
195
|
+
* Inland water. Short fetch is doing all the work here — a lake in a gale still
|
|
196
|
+
* has small, short, steep waves, because there is no room upwind to build
|
|
197
|
+
* anything longer. Greener and murkier, because inland water is.
|
|
198
|
+
*/
|
|
199
|
+
export declare const defaultLakeConfig: OceanConfig;
|
|
200
|
+
/** Storm sea. Steep, broken, and mostly foam at the top of the range. */
|
|
201
|
+
export declare const defaultStormConfig: OceanConfig;
|
|
202
|
+
/**
|
|
203
|
+
* Coastal water. Narrow spread, because waves refract into alignment with the
|
|
204
|
+
* beach as they shoal, and a much stronger shoreline because that is the whole
|
|
205
|
+
* point of the type.
|
|
206
|
+
*/
|
|
207
|
+
export declare const defaultShoreConfig: OceanConfig;
|
|
208
|
+
export declare const defaultOceanQuality: OceanQualityConfig;
|
|
209
|
+
/** Per-type defaults, for the controller's type switcher. */
|
|
210
|
+
export declare const OCEAN_DEFAULTS: Record<WaterType, OceanConfig>;
|
|
211
|
+
/** Object-host bodies are small, still and shallow by default — a pool, not a
|
|
212
|
+
* shrunken sea. Applied on top of the type when the host is switched. */
|
|
213
|
+
export declare const OBJECT_HOST_OVERRIDES: Partial<OceanSurfaceConfig>;
|
|
214
|
+
export type OceanPropertyGroup = 'form' | 'waves' | 'surface' | 'shore' | 'quality';
|
|
215
|
+
/**
|
|
216
|
+
* Everything the controller needs to build a row and everything the AI context
|
|
217
|
+
* builder needs to know what a knob does and where it is safe. The runtime never
|
|
218
|
+
* reads this — defaults live in the config objects above.
|
|
219
|
+
*
|
|
220
|
+
* `kind` exists here and not in the terrain schema because the ocean exposes
|
|
221
|
+
* colours and choices, not only numbers.
|
|
222
|
+
*/
|
|
223
|
+
export interface OceanPropertySchema {
|
|
224
|
+
key: string;
|
|
225
|
+
label: string;
|
|
226
|
+
group: OceanPropertyGroup;
|
|
227
|
+
/** How the value is edited and what can carry it. Absent means a ranged
|
|
228
|
+
* number, which is the common case. Anything that is not a number cannot
|
|
229
|
+
* ride in the agent's numeric changes list, so the agent filters on this
|
|
230
|
+
* too — see the ocean catalog in aiAgent. */
|
|
231
|
+
kind?: 'number' | 'color' | 'boolean' | 'select' | 'vector2';
|
|
232
|
+
options?: string[];
|
|
233
|
+
min?: number;
|
|
234
|
+
max?: number;
|
|
235
|
+
step?: number;
|
|
236
|
+
unit?: string;
|
|
237
|
+
description: string;
|
|
238
|
+
advanced?: boolean;
|
|
239
|
+
/** Only show for these water types. Absent means all. */
|
|
240
|
+
types?: WaterType[];
|
|
241
|
+
/** Only show on these hosts. A placed pool has no sea level and the sea has
|
|
242
|
+
* no size; showing either is worse than hiding it, because a row that does
|
|
243
|
+
* nothing reads as a bug in the renderer. */
|
|
244
|
+
hosts?: WaterHost[];
|
|
245
|
+
}
|
|
246
|
+
export declare const OCEAN_SCHEMA: OceanPropertySchema[];
|
|
247
|
+
export declare const OCEAN_QUALITY_SCHEMA: OceanPropertySchema[];
|
|
248
|
+
/** Transform of a placed body. Same shape the rest of the app uses. */
|
|
249
|
+
export interface OceanMeshSettings {
|
|
250
|
+
name?: string;
|
|
251
|
+
visible: boolean;
|
|
252
|
+
position: [number, number, number];
|
|
253
|
+
rotation: [number, number, number];
|
|
254
|
+
scale: [number, number, number];
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* A water body, as stored.
|
|
258
|
+
*
|
|
259
|
+
* Named `OceanWaterSettings` because core already exports an `OceanSettings` —
|
|
260
|
+
* the retired flat-plane-plus-material shape — and a saved project may still
|
|
261
|
+
* carry one. Same reason `ProceduralTerrainSettings` is not `TerrainSettings`.
|
|
262
|
+
*
|
|
263
|
+
* `meshSettings` is present only on the object host. The world ocean has no
|
|
264
|
+
* transform to edit: its clipmap follows the camera, and its one positional
|
|
265
|
+
* degree of freedom is `config.seaLevel`.
|
|
266
|
+
*/
|
|
267
|
+
export interface OceanWaterSettings {
|
|
268
|
+
id: string;
|
|
269
|
+
type: 'ocean';
|
|
270
|
+
parentid?: string;
|
|
271
|
+
config: OceanConfig;
|
|
272
|
+
quality: OceanQualityConfig;
|
|
273
|
+
/** Object host only. */
|
|
274
|
+
meshSettings?: OceanMeshSettings;
|
|
275
|
+
/** Per-domain keyframes. Object host only, like any other scene object. */
|
|
276
|
+
animations?: unknown;
|
|
277
|
+
/** Per-domain pointer interactions. Object host only. */
|
|
278
|
+
mouseMove?: unknown;
|
|
279
|
+
}
|
|
280
|
+
export declare const defaultOceanWaterSettings: OceanWaterSettings;
|
|
281
|
+
/**
|
|
282
|
+
* Surface block merged over its type's defaults, or null when there is nothing
|
|
283
|
+
* to render. Unlike the terrain, a legacy blob is mapped rather than dropped —
|
|
284
|
+
* see the note above.
|
|
285
|
+
*/
|
|
286
|
+
export declare function normalizeOcean(raw: unknown, whole?: unknown): OceanConfig | null;
|
|
287
|
+
export declare function normalizeOceanQuality(raw: unknown): OceanQualityConfig;
|
|
288
|
+
/** A whole settings blob, from a project of any age. */
|
|
289
|
+
export declare function normalizeOceanSettings(raw: unknown): OceanWaterSettings;
|
|
290
|
+
//# sourceMappingURL=oceanConfigs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oceanConfigs.d.ts","sourceRoot":"","sources":["../../src/types/oceanConfigs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,wDAAwD;AACxD,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAE3D;;;;;;;;;GASG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE3C,uEAAuE;AACvE,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,KAAK,CAAC;AAE3C,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,KAAK,GAAG,KAAK,CAAC;AAEtD,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,IAAI,GAAG,KAAK,CAAC;AAEvD,iEAAiE;AACjE,MAAM,WAAW,kBAAkB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,SAAS,CAAC;IAChB;;8EAE0E;IAC1E,SAAS,EAAE,SAAS,CAAC;IAGrB;;;;0DAIsD;IACtD,QAAQ,EAAE,MAAM,CAAC;IACjB,qEAAqE;IAC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