@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 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/landscape/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC1D,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as LandscapeMesh } from './LandscapeMesh.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ObjectReadyProps } from '../../types/objectReady';
|
|
2
|
+
import type { LandscapeConfig, LandscapeQualityConfig } from '../../types/landscapeConfigs';
|
|
3
|
+
/** Shared by both hosts. The ground host reads its transform out of the config;
|
|
4
|
+
* the placed host is wrapped in a CreatedObject and leaves those at zero. */
|
|
5
|
+
export interface LandscapeLayerProps extends ObjectReadyProps {
|
|
6
|
+
/** Scene id, so a controller can findById() the landscape and drive it live. */
|
|
7
|
+
id?: string;
|
|
8
|
+
config: LandscapeConfig;
|
|
9
|
+
quality: LandscapeQualityConfig;
|
|
10
|
+
/** Ground host only. The placed host gets its transform from CreatedObject. */
|
|
11
|
+
applyTransform?: boolean;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/landscape/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAE3F;8EAC8E;AAC9E,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IACzD,gFAAgF;IAChF,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,sBAAsB,CAAA;IAC/B,+EAA+E;IAC/E,cAAc,CAAC,EAAE,OAAO,CAAA;CAC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TerrainLayerProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Mesa and canyon country — built by subtraction, which is what makes it read
|
|
5
|
+
* correctly.
|
|
6
|
+
*
|
|
7
|
+
* A canyon is not a mountain range with the sign flipped: it is a plateau with a
|
|
8
|
+
* drainage network cut into it. So `plateau` flattens the top of the height range
|
|
9
|
+
* first, and `valleyDepth` then removes material along the zero set of a ridged
|
|
10
|
+
* noise field — which is a connected, branching line, so the channels join up
|
|
11
|
+
* into a network instead of appearing as unrelated gouges.
|
|
12
|
+
*
|
|
13
|
+
* `terraces` is doing more work here than anywhere else. Sedimentary rock erodes
|
|
14
|
+
* in bands, and the horizontal banding on the walls is most of what makes a mesa
|
|
15
|
+
* read as a mesa rather than as a lumpy plateau. `terraceSharpness` near 1 gives
|
|
16
|
+
* the near-vertical riser that a hard stratum leaves standing.
|
|
17
|
+
*
|
|
18
|
+
* The most expensive of the four: near-vertical walls mean the shadow march walks
|
|
19
|
+
* a long way before it clears an occluder.
|
|
20
|
+
*/
|
|
21
|
+
declare const Canyon: React.FC<TerrainLayerProps>;
|
|
22
|
+
export default Canyon;
|
|
23
|
+
//# sourceMappingURL=Canyon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Canyon.d.ts","sourceRoot":"","sources":["../../../src/components/terrain/Canyon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CASvC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import TerrainSurface from './TerrainSurface.js';
|
|
4
|
+
/**
|
|
5
|
+
* Mesa and canyon country — built by subtraction, which is what makes it read
|
|
6
|
+
* correctly.
|
|
7
|
+
*
|
|
8
|
+
* A canyon is not a mountain range with the sign flipped: it is a plateau with a
|
|
9
|
+
* drainage network cut into it. So `plateau` flattens the top of the height range
|
|
10
|
+
* first, and `valleyDepth` then removes material along the zero set of a ridged
|
|
11
|
+
* noise field — which is a connected, branching line, so the channels join up
|
|
12
|
+
* into a network instead of appearing as unrelated gouges.
|
|
13
|
+
*
|
|
14
|
+
* `terraces` is doing more work here than anywhere else. Sedimentary rock erodes
|
|
15
|
+
* in bands, and the horizontal banding on the walls is most of what makes a mesa
|
|
16
|
+
* read as a mesa rather than as a lumpy plateau. `terraceSharpness` near 1 gives
|
|
17
|
+
* the near-vertical riser that a hard stratum leaves standing.
|
|
18
|
+
*
|
|
19
|
+
* The most expensive of the four: near-vertical walls mean the shadow march walks
|
|
20
|
+
* a long way before it clears an occluder.
|
|
21
|
+
*/
|
|
22
|
+
const Canyon = ({ config, quality, ...rest }) => {
|
|
23
|
+
// Cliff faces are where the analytic shadow earns its keep and also where it
|
|
24
|
+
// is most likely to run out of march before it escapes the wall. Floored, the
|
|
25
|
+
// same way Cumulonimbus floors its step budget.
|
|
26
|
+
const resolvedQuality = useMemo(() => ({ ...quality, shadowSteps: Math.max(quality.shadowSteps, 16) }), [quality]);
|
|
27
|
+
return _jsx(TerrainSurface, { config: config, quality: resolvedQuality, ...rest });
|
|
28
|
+
};
|
|
29
|
+
export default Canyon;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TerrainLayerProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* A dune field. The one landform that is not primarily fBm.
|
|
5
|
+
*
|
|
6
|
+
* Dunes form transverse to the prevailing wind, so the shape is a wave train:
|
|
7
|
+
* `bearing` sets its direction, `duneWavelength` its spacing, and the fBm's job
|
|
8
|
+
* is to bend the crest lines and vary the height along them rather than to be the
|
|
9
|
+
* terrain. `duneAsymmetry` is what stops it looking like corrugated iron — a real
|
|
10
|
+
* dune is a long windward ramp and a short slip face at the angle of repose, and
|
|
11
|
+
* at zero the two sides are mirror images.
|
|
12
|
+
*
|
|
13
|
+
* Strata and canyon carving are forced off; sand has no bedding planes.
|
|
14
|
+
*
|
|
15
|
+
* The defaults also carry more specular and more ground bounce than the other
|
|
16
|
+
* three, which is not decoration: sand's low-sun sheen and the light it throws
|
|
17
|
+
* back into its own lee are most of why a dune field reads as sand rather than as
|
|
18
|
+
* beige hills.
|
|
19
|
+
*/
|
|
20
|
+
declare const Dunes: React.FC<TerrainLayerProps>;
|
|
21
|
+
export default Dunes;
|
|
22
|
+
//# sourceMappingURL=Dunes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dunes.d.ts","sourceRoot":"","sources":["../../../src/components/terrain/Dunes.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAMtC,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import TerrainSurface from './TerrainSurface.js';
|
|
4
|
+
/**
|
|
5
|
+
* A dune field. The one landform that is not primarily fBm.
|
|
6
|
+
*
|
|
7
|
+
* Dunes form transverse to the prevailing wind, so the shape is a wave train:
|
|
8
|
+
* `bearing` sets its direction, `duneWavelength` its spacing, and the fBm's job
|
|
9
|
+
* is to bend the crest lines and vary the height along them rather than to be the
|
|
10
|
+
* terrain. `duneAsymmetry` is what stops it looking like corrugated iron — a real
|
|
11
|
+
* dune is a long windward ramp and a short slip face at the angle of repose, and
|
|
12
|
+
* at zero the two sides are mirror images.
|
|
13
|
+
*
|
|
14
|
+
* Strata and canyon carving are forced off; sand has no bedding planes.
|
|
15
|
+
*
|
|
16
|
+
* The defaults also carry more specular and more ground bounce than the other
|
|
17
|
+
* three, which is not decoration: sand's low-sun sheen and the light it throws
|
|
18
|
+
* back into its own lee are most of why a dune field reads as sand rather than as
|
|
19
|
+
* beige hills.
|
|
20
|
+
*/
|
|
21
|
+
const Dunes = ({ config, ...rest }) => {
|
|
22
|
+
const resolved = useMemo(() => ({ ...config, terraces: 0, plateau: 0, valleyDepth: 0 }), [config]);
|
|
23
|
+
return _jsx(TerrainSurface, { config: resolved, ...rest });
|
|
24
|
+
};
|
|
25
|
+
export default Dunes;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TerrainLayerProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Rolling hills and plains — the same fBm with the ridge fold near zero, so the
|
|
5
|
+
* crests stay rounded, and a heavier domain warp so the shapes still have a grain
|
|
6
|
+
* rather than reading as billows.
|
|
7
|
+
*
|
|
8
|
+
* The friendly default, and the one worth reaching for when the terrain is a
|
|
9
|
+
* setting rather than the subject: it is the cheapest of the four (fewest
|
|
10
|
+
* octaves, shallow relief, so the shadow march exits early) and the least likely
|
|
11
|
+
* to fight whatever is placed on it.
|
|
12
|
+
*
|
|
13
|
+
* Strata and canyon carving are forced off — a terraced hill is a quarry.
|
|
14
|
+
*/
|
|
15
|
+
declare const Hills: React.FC<TerrainLayerProps>;
|
|
16
|
+
export default Hills;
|
|
17
|
+
//# sourceMappingURL=Hills.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Hills.d.ts","sourceRoot":"","sources":["../../../src/components/terrain/Hills.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAMtC,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import TerrainSurface from './TerrainSurface.js';
|
|
4
|
+
/**
|
|
5
|
+
* Rolling hills and plains — the same fBm with the ridge fold near zero, so the
|
|
6
|
+
* crests stay rounded, and a heavier domain warp so the shapes still have a grain
|
|
7
|
+
* rather than reading as billows.
|
|
8
|
+
*
|
|
9
|
+
* The friendly default, and the one worth reaching for when the terrain is a
|
|
10
|
+
* setting rather than the subject: it is the cheapest of the four (fewest
|
|
11
|
+
* octaves, shallow relief, so the shadow march exits early) and the least likely
|
|
12
|
+
* to fight whatever is placed on it.
|
|
13
|
+
*
|
|
14
|
+
* Strata and canyon carving are forced off — a terraced hill is a quarry.
|
|
15
|
+
*/
|
|
16
|
+
const Hills = ({ config, ...rest }) => {
|
|
17
|
+
const resolved = useMemo(() => ({ ...config, terraces: 0, plateau: 0, valleyDepth: 0 }), [config]);
|
|
18
|
+
return _jsx(TerrainSurface, { config: resolved, ...rest });
|
|
19
|
+
};
|
|
20
|
+
export default Hills;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TerrainLayerProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Alpine terrain — ridged fBm with derivative damping, rock splatted by slope and
|
|
5
|
+
* a snow line held off the steep faces.
|
|
6
|
+
*
|
|
7
|
+
* The reference case for the height field, because its silhouette shows every
|
|
8
|
+
* term at once: the ridge fold makes the crest lines, the domain warp bends them
|
|
9
|
+
* into a range instead of a field of bumps, and the erosion damping is what puts
|
|
10
|
+
* flat floors in the valleys between them. Turn erosion to zero and it reads as
|
|
11
|
+
* noise immediately.
|
|
12
|
+
*
|
|
13
|
+
* Canyon-only shaping is forced off. Both terms are gated on the landform inside
|
|
14
|
+
* the shader anyway, so a stale value would do nothing visible while making the
|
|
15
|
+
* panel read as though it should.
|
|
16
|
+
*/
|
|
17
|
+
declare const Mountains: React.FC<TerrainLayerProps>;
|
|
18
|
+
export default Mountains;
|
|
19
|
+
//# sourceMappingURL=Mountains.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Mountains.d.ts","sourceRoot":"","sources":["../../../src/components/terrain/Mountains.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAG1C,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import TerrainSurface from './TerrainSurface.js';
|
|
4
|
+
/**
|
|
5
|
+
* Alpine terrain — ridged fBm with derivative damping, rock splatted by slope and
|
|
6
|
+
* a snow line held off the steep faces.
|
|
7
|
+
*
|
|
8
|
+
* The reference case for the height field, because its silhouette shows every
|
|
9
|
+
* term at once: the ridge fold makes the crest lines, the domain warp bends them
|
|
10
|
+
* into a range instead of a field of bumps, and the erosion damping is what puts
|
|
11
|
+
* flat floors in the valleys between them. Turn erosion to zero and it reads as
|
|
12
|
+
* noise immediately.
|
|
13
|
+
*
|
|
14
|
+
* Canyon-only shaping is forced off. Both terms are gated on the landform inside
|
|
15
|
+
* the shader anyway, so a stale value would do nothing visible while making the
|
|
16
|
+
* panel read as though it should.
|
|
17
|
+
*/
|
|
18
|
+
const Mountains = ({ config, ...rest }) => {
|
|
19
|
+
const resolved = useMemo(() => ({ ...config, plateau: 0, valleyDepth: 0 }), [config]);
|
|
20
|
+
return _jsx(TerrainSurface, { config: resolved, ...rest });
|
|
21
|
+
};
|
|
22
|
+
export default Mountains;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TerrainLayerProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* The terrain renderer. One clipmap, one material, four landforms — they differ
|
|
5
|
+
* by the shaping operator the height field applies, not by having separate
|
|
6
|
+
* renderers, the same way three of the four cloud types share one marcher.
|
|
7
|
+
*
|
|
8
|
+
* Unlike the cloud pass this does NOT take over the render loop, and that is the
|
|
9
|
+
* entire reason to build terrain as geometry: it depth-sorts against scene
|
|
10
|
+
* objects, it receives the sun's shadow map so anything standing on it casts onto
|
|
11
|
+
* it, scene fog applies, and the cloud pass composites over it correctly because
|
|
12
|
+
* it is simply in the scene when that pass renders. A raymarched terrain would
|
|
13
|
+
* have none of that.
|
|
14
|
+
*
|
|
15
|
+
* Per frame it does three things: resolves the sun (from the same
|
|
16
|
+
* `skySystemManager` the sun rig and the clouds read, so a time slider moves all
|
|
17
|
+
* three together), pushes the config into uniforms, and re-snaps the clipmap to
|
|
18
|
+
* the camera. Nothing here re-renders React.
|
|
19
|
+
*/
|
|
20
|
+
declare const TerrainSurface: React.FC<TerrainLayerProps>;
|
|
21
|
+
export default TerrainSurface;
|
|
22
|
+
//# sourceMappingURL=TerrainSurface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TerrainSurface.d.ts","sourceRoot":"","sources":["../../../src/components/terrain/TerrainSurface.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAU1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAgG/C,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
3
|
+
import { useFrame } from '@react-three/fiber';
|
|
4
|
+
import { useObjectReady } from '../../hooks/useObjectReady.js';
|
|
5
|
+
import { useTerrainClipmap } from '../../hooks/useTerrainClipmap.js';
|
|
6
|
+
import { useCloudSun } from '../../hooks/useCloudSun.js';
|
|
7
|
+
import { TERRAIN_LIVE_KEY } from '../../hooks/useTerrainLive.js';
|
|
8
|
+
import { TerrainMaterial } from '../../shaders/terrain/TerrainMaterial.js';
|
|
9
|
+
import { applySunUniforms } from '../../utils/cloudUniforms.js';
|
|
10
|
+
import { applyTerrainAmbient, applyTerrainUniforms } from '../../utils/terrainUniforms.js';
|
|
11
|
+
/**
|
|
12
|
+
* The terrain renderer. One clipmap, one material, four landforms — they differ
|
|
13
|
+
* by the shaping operator the height field applies, not by having separate
|
|
14
|
+
* renderers, the same way three of the four cloud types share one marcher.
|
|
15
|
+
*
|
|
16
|
+
* Unlike the cloud pass this does NOT take over the render loop, and that is the
|
|
17
|
+
* entire reason to build terrain as geometry: it depth-sorts against scene
|
|
18
|
+
* objects, it receives the sun's shadow map so anything standing on it casts onto
|
|
19
|
+
* it, scene fog applies, and the cloud pass composites over it correctly because
|
|
20
|
+
* it is simply in the scene when that pass renders. A raymarched terrain would
|
|
21
|
+
* have none of that.
|
|
22
|
+
*
|
|
23
|
+
* Per frame it does three things: resolves the sun (from the same
|
|
24
|
+
* `skySystemManager` the sun rig and the clouds read, so a time slider moves all
|
|
25
|
+
* three together), pushes the config into uniforms, and re-snaps the clipmap to
|
|
26
|
+
* the camera. Nothing here re-renders React.
|
|
27
|
+
*/
|
|
28
|
+
const TerrainSurface = ({ id = '3drise-terrain', config, quality, skySettings, timeSettings, sunIntensity = 1, onObjectReady, onObjectDispose, }) => {
|
|
29
|
+
const clipmap = useTerrainClipmap(quality.levels, quality.segments, quality.cellSize);
|
|
30
|
+
const { state: sun, update: updateSun } = useCloudSun({ skySettings, timeSettings });
|
|
31
|
+
const material = useMemo(() => new TerrainMaterial(), []);
|
|
32
|
+
useEffect(() => () => { material.dispose(); }, [material]);
|
|
33
|
+
// Live controller overrides. A slider drag writes here every pointer-move and
|
|
34
|
+
// the frame loop reads it on top of the config, so the terrain responds without
|
|
35
|
+
// a dispatch per frame — which for `quality` also means without rebuilding
|
|
36
|
+
// every clipmap ring sixty times a second. Cleared when the config identity
|
|
37
|
+
// changes, which is exactly slider-end committing the same value.
|
|
38
|
+
const liveConfig = useRef({});
|
|
39
|
+
const liveQuality = useRef({});
|
|
40
|
+
useEffect(() => { liveConfig.current = {}; }, [config]);
|
|
41
|
+
useEffect(() => { liveQuality.current = {}; }, [quality]);
|
|
42
|
+
const rootRef = useRef(null);
|
|
43
|
+
const meshRefs = useRef([]);
|
|
44
|
+
// The handle a controller reaches through findById(id).userData. Set in an
|
|
45
|
+
// effect, never as a userData JSX prop: R3F replaces the whole userData object
|
|
46
|
+
// on every render, which would drop the handle whenever anything above
|
|
47
|
+
// re-rendered.
|
|
48
|
+
const liveHandle = useMemo(() => ({
|
|
49
|
+
config: (key, value) => { liveConfig.current[key] = value; },
|
|
50
|
+
quality: (key, value) => { liveQuality.current[key] = value; },
|
|
51
|
+
}), []);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
const root = rootRef.current;
|
|
54
|
+
if (!root)
|
|
55
|
+
return;
|
|
56
|
+
root.userData.id = id;
|
|
57
|
+
root.userData[TERRAIN_LIVE_KEY] = liveHandle;
|
|
58
|
+
return () => { delete root.userData[TERRAIN_LIVE_KEY]; };
|
|
59
|
+
}, [id, liveHandle]);
|
|
60
|
+
useObjectReady(rootRef, { id, type: 'terrain', config, quality }, onObjectReady, onObjectDispose);
|
|
61
|
+
useFrame((state) => {
|
|
62
|
+
const camera = state.camera;
|
|
63
|
+
updateSun();
|
|
64
|
+
applySunUniforms(material, sun, sunIntensity);
|
|
65
|
+
// Overwrites the two ambient colours applySunUniforms just set. Those are
|
|
66
|
+
// the cloud curve, tuned for cloud interiors; the ground has to be lit by
|
|
67
|
+
// the sky that is actually being drawn behind it or a sunset landscape
|
|
68
|
+
// comes out black under a blazing sky.
|
|
69
|
+
applyTerrainAmbient(material, sun);
|
|
70
|
+
const cfg = { ...config, ...liveConfig.current };
|
|
71
|
+
const qual = { ...quality, ...liveQuality.current };
|
|
72
|
+
applyTerrainUniforms(material, cfg, qual);
|
|
73
|
+
// ONE origin for the whole pyramid, snapped to twice the finest cell.
|
|
74
|
+
//
|
|
75
|
+
// Snapping each ring to its own cell grid is the textbook clipmap and it is
|
|
76
|
+
// what tears the seams open: neighbouring rings then sit on origins up to a
|
|
77
|
+
// cell apart, and boundaries that match exactly in local space miss each
|
|
78
|
+
// other in the world by that offset. Sharing the origin makes them coincide
|
|
79
|
+
// by construction. Twice the cell, so index parity — and with it the
|
|
80
|
+
// geomorph — never flips as the camera crosses a cell boundary.
|
|
81
|
+
const snap = clipmap.sharedSnap;
|
|
82
|
+
const ox = Math.round(camera.position.x / snap) * snap;
|
|
83
|
+
const oz = Math.round(camera.position.z / snap) * snap;
|
|
84
|
+
for (let i = 0; i < clipmap.levels.length; i++) {
|
|
85
|
+
meshRefs.current[i]?.position.set(ox, 0, oz);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
return (_jsx("group", { ref: rootRef, children: clipmap.levels.map((ring, i) => (_jsx("mesh", { ref: (m) => { meshRefs.current[i] = m; }, geometry: ring.geometry, material: material, receiveShadow: quality.receiveShadows,
|
|
89
|
+
// Displacement happens in the vertex shader, so the object-space
|
|
90
|
+
// bounds describe a flat plane. Culling against them hides the
|
|
91
|
+
// terrain the moment the camera tilts up.
|
|
92
|
+
frustumCulled: false }, ring.level))) }));
|
|
93
|
+
};
|
|
94
|
+
export default TerrainSurface;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { TerrainLayerProps } from './types';
|
|
2
|
+
export { default as TerrainSurface } from './TerrainSurface';
|
|
3
|
+
export { default as Mountains } from './Mountains';
|
|
4
|
+
export { default as Dunes } from './Dunes';
|
|
5
|
+
export { default as Hills } from './Hills';
|
|
6
|
+
export { default as Canyon } from './Canyon';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/terrain/index.ts"],"names":[],"mappings":"AAGA,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Terrain landforms. Each renders the shared clipmap surface with the coercions
|
|
2
|
+
// its type needs; exactly one is mounted at a time, by TerrainBuilder.
|
|
3
|
+
export { default as TerrainSurface } from './TerrainSurface.js';
|
|
4
|
+
export { default as Mountains } from './Mountains.js';
|
|
5
|
+
export { default as Dunes } from './Dunes.js';
|
|
6
|
+
export { default as Hills } from './Hills.js';
|
|
7
|
+
export { default as Canyon } from './Canyon.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SkySettings, TimeSettings } from '@3driseai/3drise-core';
|
|
2
|
+
import type { ObjectReadyProps } from '../../types/objectReady';
|
|
3
|
+
import type { TerrainConfig, TerrainQualityConfig } from '../../types/terrainConfigs';
|
|
4
|
+
/** Shared by every landform component. The builder hands all four the same shape. */
|
|
5
|
+
export interface TerrainLayerProps extends ObjectReadyProps {
|
|
6
|
+
/** Scene id, so a controller can findById() the terrain and drive it live. */
|
|
7
|
+
id?: string;
|
|
8
|
+
config: TerrainConfig;
|
|
9
|
+
quality: TerrainQualityConfig;
|
|
10
|
+
/** The four Preetham parameters, so the ground is lit by the same atmosphere
|
|
11
|
+
* the sky is drawn with and the clouds are lit by. */
|
|
12
|
+
skySettings?: SkySettings;
|
|
13
|
+
timeSettings?: TimeSettings;
|
|
14
|
+
/** Matches SkySystem's sunIntensity, so terrain brightens with the scene. */
|
|
15
|
+
sunIntensity?: number;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/terrain/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,aAAa,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAEtF,qFAAqF;AACrF,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACvD,8EAA8E;IAC9E,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,oBAAoB,CAAC;IAC9B;2DACuD;IACvD,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { CloudLayerProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* The cirrus-only sky: high ice with no deck beneath it.
|
|
5
|
+
*
|
|
6
|
+
* Cirrus normally rides along with whatever deck is enabled — the pass composites
|
|
7
|
+
* it above, which is correct while the camera is below both. This component is the
|
|
8
|
+
* case where the deck is switched off entirely, so the deck march is skipped and
|
|
9
|
+
* only the three-sample ice pass runs. That is a fraction of the cost of any
|
|
10
|
+
* volumetric type, which is why a clear-with-cirrus sky is close to free.
|
|
11
|
+
*/
|
|
12
|
+
declare const Cirrus: React.FC<CloudLayerProps>;
|
|
13
|
+
export default Cirrus;
|
|
14
|
+
//# sourceMappingURL=Cirrus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Cirrus.d.ts","sourceRoot":"","sources":["../../../src/components/volumetricClouds/Cirrus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;;;;;;;;GAQG;AACH,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAErC,CAAC;AACF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import VolumetricCloudsPass from './VolumetricCloudsPass.js';
|
|
3
|
+
/**
|
|
4
|
+
* The cirrus-only sky: high ice with no deck beneath it.
|
|
5
|
+
*
|
|
6
|
+
* Cirrus normally rides along with whatever deck is enabled — the pass composites
|
|
7
|
+
* it above, which is correct while the camera is below both. This component is the
|
|
8
|
+
* case where the deck is switched off entirely, so the deck march is skipped and
|
|
9
|
+
* only the three-sample ice pass runs. That is a fraction of the cost of any
|
|
10
|
+
* volumetric type, which is why a clear-with-cirrus sky is close to free.
|
|
11
|
+
*/
|
|
12
|
+
const Cirrus = ({ cirrus, quality, skySettings, timeSettings, sunIntensity, animations, mouseMove, id, onObjectReady, onObjectDispose }) => (_jsx(VolumetricCloudsPass, { deck: null, cirrus: cirrus, quality: quality, skySettings: skySettings, timeSettings: timeSettings, sunIntensity: sunIntensity, animations: animations, mouseMove: mouseMove, id: id, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }));
|
|
13
|
+
export default Cirrus;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { CloudLayerProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* A storm cell — the deepest and most expensive type.
|
|
5
|
+
*
|
|
6
|
+
* Three config values carry its identity, and with any of them at zero it reads as
|
|
7
|
+
* an oversized cumulus: `shear` leans the tower and drags the anvil downwind,
|
|
8
|
+
* `anvil` flattens the top at the tropopause instead of rounding it, and
|
|
9
|
+
* `precipitation` drops scattering albedo at the base, which is the only thing that
|
|
10
|
+
* makes it charcoal — extinction alone will not.
|
|
11
|
+
*
|
|
12
|
+
* Cost scales with depth, since the fine step is derived from it, so a shallow step
|
|
13
|
+
* budget on a 9 km tower gives kilometre steps and loses the structure. Floored here.
|
|
14
|
+
*/
|
|
15
|
+
declare const Cumulonimbus: React.FC<CloudLayerProps>;
|
|
16
|
+
export default Cumulonimbus;
|
|
17
|
+
//# sourceMappingURL=Cumulonimbus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Cumulonimbus.d.ts","sourceRoot":"","sources":["../../../src/components/volumetricClouds/Cumulonimbus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAG3C,CAAC;AACF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import VolumetricCloudsPass from './VolumetricCloudsPass.js';
|
|
4
|
+
/**
|
|
5
|
+
* A storm cell — the deepest and most expensive type.
|
|
6
|
+
*
|
|
7
|
+
* Three config values carry its identity, and with any of them at zero it reads as
|
|
8
|
+
* an oversized cumulus: `shear` leans the tower and drags the anvil downwind,
|
|
9
|
+
* `anvil` flattens the top at the tropopause instead of rounding it, and
|
|
10
|
+
* `precipitation` drops scattering albedo at the base, which is the only thing that
|
|
11
|
+
* makes it charcoal — extinction alone will not.
|
|
12
|
+
*
|
|
13
|
+
* Cost scales with depth, since the fine step is derived from it, so a shallow step
|
|
14
|
+
* budget on a 9 km tower gives kilometre steps and loses the structure. Floored here.
|
|
15
|
+
*/
|
|
16
|
+
const Cumulonimbus = ({ deck, cirrus, quality, skySettings, timeSettings, sunIntensity, animations, mouseMove, id, onObjectReady, onObjectDispose }) => {
|
|
17
|
+
const resolvedQuality = useMemo(() => ({ ...quality, steps: Math.max(quality.steps, 96) }), [quality]);
|
|
18
|
+
return (_jsx(VolumetricCloudsPass, { deck: deck, cirrus: cirrus, quality: resolvedQuality, skySettings: skySettings, timeSettings: timeSettings, sunIntensity: sunIntensity, animations: animations, mouseMove: mouseMove, id: id, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }));
|
|
19
|
+
};
|
|
20
|
+
export default Cumulonimbus;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { CloudLayerProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Fair-weather cumulus — flat condensation base, cauliflower top, sky between the
|
|
5
|
+
* cells. The reference case for the scattering model, because its silhouette shows
|
|
6
|
+
* every term at once: lit flank, powder-dark base, silver rim, blue underside.
|
|
7
|
+
*
|
|
8
|
+
* Anvil and precipitation are forced off. Both are gated on the vertical profile
|
|
9
|
+
* inside the shader anyway, so leaving a stale value in the config would do nothing
|
|
10
|
+
* visible while making the panel read as though it should.
|
|
11
|
+
*/
|
|
12
|
+
declare const Cumulus: React.FC<CloudLayerProps>;
|
|
13
|
+
export default Cumulus;
|
|
14
|
+
//# sourceMappingURL=Cumulus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Cumulus.d.ts","sourceRoot":"","sources":["../../../src/components/volumetricClouds/Cumulus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;;;;;;;;GAQG;AACH,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAGtC,CAAC;AACF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import VolumetricCloudsPass from './VolumetricCloudsPass.js';
|
|
4
|
+
/**
|
|
5
|
+
* Fair-weather cumulus — flat condensation base, cauliflower top, sky between the
|
|
6
|
+
* cells. The reference case for the scattering model, because its silhouette shows
|
|
7
|
+
* every term at once: lit flank, powder-dark base, silver rim, blue underside.
|
|
8
|
+
*
|
|
9
|
+
* Anvil and precipitation are forced off. Both are gated on the vertical profile
|
|
10
|
+
* inside the shader anyway, so leaving a stale value in the config would do nothing
|
|
11
|
+
* visible while making the panel read as though it should.
|
|
12
|
+
*/
|
|
13
|
+
const Cumulus = ({ deck, cirrus, quality, skySettings, timeSettings, sunIntensity, animations, mouseMove, id, onObjectReady, onObjectDispose }) => {
|
|
14
|
+
const resolved = useMemo(() => ({ ...deck, anvil: 0, precipitation: 0 }), [deck]);
|
|
15
|
+
return (_jsx(VolumetricCloudsPass, { deck: resolved, cirrus: cirrus, quality: quality, skySettings: skySettings, timeSettings: timeSettings, sunIntensity: sunIntensity, animations: animations, mouseMove: mouseMove, id: id, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }));
|
|
16
|
+
};
|
|
17
|
+
export default Cumulus;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { CloudLayerProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* A low overcast deck — rolls, lumpy undersides, little vertical development.
|
|
5
|
+
*
|
|
6
|
+
* The deck is shallow, so the march's fine step (derived from depth) is already
|
|
7
|
+
* small and a large step budget is wasted; it is capped here. Anvil and
|
|
8
|
+
* precipitation are off for the same reason as cumulus.
|
|
9
|
+
*/
|
|
10
|
+
declare const Stratocumulus: React.FC<CloudLayerProps>;
|
|
11
|
+
export default Stratocumulus;
|
|
12
|
+
//# sourceMappingURL=Stratocumulus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stratocumulus.d.ts","sourceRoot":"","sources":["../../../src/components/volumetricClouds/Stratocumulus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;;;;;;GAMG;AACH,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAI5C,CAAC;AACF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import VolumetricCloudsPass from './VolumetricCloudsPass.js';
|
|
4
|
+
/**
|
|
5
|
+
* A low overcast deck — rolls, lumpy undersides, little vertical development.
|
|
6
|
+
*
|
|
7
|
+
* The deck is shallow, so the march's fine step (derived from depth) is already
|
|
8
|
+
* small and a large step budget is wasted; it is capped here. Anvil and
|
|
9
|
+
* precipitation are off for the same reason as cumulus.
|
|
10
|
+
*/
|
|
11
|
+
const Stratocumulus = ({ deck, cirrus, quality, skySettings, timeSettings, sunIntensity, animations, mouseMove, id, onObjectReady, onObjectDispose }) => {
|
|
12
|
+
const resolved = useMemo(() => ({ ...deck, anvil: 0, precipitation: 0 }), [deck]);
|
|
13
|
+
const resolvedQuality = useMemo(() => ({ ...quality, steps: Math.min(quality.steps, 112) }), [quality]);
|
|
14
|
+
return (_jsx(VolumetricCloudsPass, { deck: resolved, cirrus: cirrus, quality: resolvedQuality, skySettings: skySettings, timeSettings: timeSettings, sunIntensity: sunIntensity, animations: animations, mouseMove: mouseMove, id: id, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }));
|
|
15
|
+
};
|
|
16
|
+
export default Stratocumulus;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ObjectReadyProps } from '../../types/objectReady';
|
|
3
|
+
import type { SkySettings, TimeSettings } from '@3driseai/3drise-core';
|
|
4
|
+
import type { CirrusLayerConfig, CloudDeckConfig, CloudsQualityConfig } from '../../types/cloudConfigs';
|
|
5
|
+
import type { ObjectAnimations, MouseMoveInteractions } from '@3driseai/3drise-core';
|
|
6
|
+
/**
|
|
7
|
+
* The cloud render pipeline. The only component in this package that takes over
|
|
8
|
+
* rendering, and there must be exactly one.
|
|
9
|
+
*
|
|
10
|
+
* Per frame:
|
|
11
|
+
* 1. scene, into an HDR target with a depth texture
|
|
12
|
+
* 2. deck march at `resolutionScale`, jittered a sub-pixel per frame
|
|
13
|
+
* 3. temporal resolve against a reprojected history, neighbourhood-clamped
|
|
14
|
+
* 4. cirrus at the same scale — smooth enough to need no temporal pass
|
|
15
|
+
* 5. depth-aware upsample, composite, tonemap
|
|
16
|
+
*
|
|
17
|
+
* Half resolution plus a temporal resolve buys roughly four times the march steps
|
|
18
|
+
* for the same cost, which is the difference between a cloud with structure and a
|
|
19
|
+
* cloud made of fog. The cost is one frame of latency and this component owning
|
|
20
|
+
* the loop.
|
|
21
|
+
*
|
|
22
|
+
* If it unmounts, R3F resumes its own auto-render and the scene draws normally
|
|
23
|
+
* without clouds — so hiding it is safe.
|
|
24
|
+
*/
|
|
25
|
+
export interface VolumetricCloudsPassProps extends ObjectReadyProps {
|
|
26
|
+
/** Scene id, so a controller can findById() this layer and drive it live. */
|
|
27
|
+
id?: string;
|
|
28
|
+
deck?: CloudDeckConfig | null;
|
|
29
|
+
cirrus?: CirrusLayerConfig | null;
|
|
30
|
+
quality: CloudsQualityConfig;
|
|
31
|
+
skySettings?: SkySettings;
|
|
32
|
+
timeSettings?: TimeSettings;
|
|
33
|
+
/** Multiplies sun radiance for the clouds only. Matches SkySystem's sunIntensity. */
|
|
34
|
+
sunIntensity?: number;
|
|
35
|
+
/** Per-domain keyframes; the `clouds` domain drives deck properties. */
|
|
36
|
+
animations?: ObjectAnimations;
|
|
37
|
+
/** Per-domain pointer interactions; same `clouds` domain. */
|
|
38
|
+
mouseMove?: MouseMoveInteractions;
|
|
39
|
+
}
|
|
40
|
+
declare const VolumetricCloudsPass: React.FC<VolumetricCloudsPassProps>;
|
|
41
|
+
export default VolumetricCloudsPass;
|
|
42
|
+
//# sourceMappingURL=VolumetricCloudsPass.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VolumetricCloudsPass.d.ts","sourceRoot":"","sources":["../../../src/components/volumetricClouds/VolumetricCloudsPass.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAIvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAQvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAExG,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAErF;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,WAAW,yBAA0B,SAAQ,gBAAgB;IAC/D,6EAA6E;IAC7E,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;IAC9B,MAAM,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAClC,OAAO,EAAE,mBAAmB,CAAC;IAC7B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,qFAAqF;IACrF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wEAAwE;IACxE,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,6DAA6D;IAC7D,SAAS,CAAC,EAAE,qBAAqB,CAAC;CACrC;AAkBD,QAAA,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CA0S7D,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|