@3driseai/3drise-viewer 0.1.7 → 0.1.9
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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Clouds.d.ts","sourceRoot":"","sources":["../../src/components/Clouds.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAQ7D,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACjF,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,MAAM,WAAW,WAAY,SAAQ,gBAAgB;IACjD,QAAQ,EAAE,qBAAqB,CAAC;IAChC,YAAY,CAAC,EAAE,YAAY,CAAC;CAC/B;AAmFD,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"Clouds.d.ts","sourceRoot":"","sources":["../../src/components/Clouds.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAQ7D,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACjF,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,MAAM,WAAW,WAAY,SAAQ,gBAAgB;IACjD,QAAQ,EAAE,qBAAqB,CAAC;IAChC,YAAY,CAAC,EAAE,YAAY,CAAC;CAC/B;AAmFD,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAqLjC,CAAC;AACF,eAAe,MAAM,CAAC"}
|
|
@@ -185,7 +185,6 @@ const Clouds = ({ settings, timeSettings = defaultTimeSettings, onObjectReady, o
|
|
|
185
185
|
return;
|
|
186
186
|
const now = Date.now();
|
|
187
187
|
const pointer = state.pointer;
|
|
188
|
-
// ── PER-DOMAIN ANIMATIONS ────────────────────────────────────────────────
|
|
189
188
|
const mouseMove = settings.mouseMove;
|
|
190
189
|
// const isPerDomain = mm && ('transform' in mm || 'material' in mm || 'edges' in mm || 'light' in mm || 'clouds' in mm);
|
|
191
190
|
// transform: position / rotation / scale
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SkySettings, TimeSettings } from '@3driseai/3drise-core';
|
|
3
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
4
|
+
import type { VolumetricCloudsSettings } from '../types/cloudConfigs';
|
|
5
|
+
export interface CloudsGeneratorProps extends ObjectReadyProps {
|
|
6
|
+
/** Accepts a partial or older-shaped blob: a published scene loads whatever was
|
|
7
|
+
* saved the day it was authored, and every block is merged over its defaults. */
|
|
8
|
+
settings?: Partial<VolumetricCloudsSettings> | null;
|
|
9
|
+
skySettings?: SkySettings;
|
|
10
|
+
timeSettings?: TimeSettings;
|
|
11
|
+
/** Matches SkySystem's sunIntensity, so clouds brighten with the rest of the scene. */
|
|
12
|
+
sunIntensity?: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Picks the cloud model for the scene's sky.
|
|
16
|
+
*
|
|
17
|
+
* A sky is a deck plus an optional ice layer, not one of four things — cirrus
|
|
18
|
+
* coexists with every other type in nature and in the renderer. So the deck's type
|
|
19
|
+
* selects the component, and cirrus rides along with whichever one is chosen. With
|
|
20
|
+
* the deck off, the cirrus-only branch runs a three-sample ice pass and skips the
|
|
21
|
+
* volumetric march entirely.
|
|
22
|
+
*
|
|
23
|
+
* Whichever branch is taken mounts exactly one render pass, which is the constraint
|
|
24
|
+
* that matters: the pass owns the render loop.
|
|
25
|
+
*
|
|
26
|
+
* Each block is memoised against its own source object, not against `settings`, so
|
|
27
|
+
* editing cirrus does not hand the deck a new config and restart its temporal
|
|
28
|
+
* accumulation.
|
|
29
|
+
*/
|
|
30
|
+
declare const CloudsGenerator: React.FC<CloudsGeneratorProps>;
|
|
31
|
+
export default CloudsGenerator;
|
|
32
|
+
//# sourceMappingURL=CloudsGenerator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CloudsGenerator.d.ts","sourceRoot":"","sources":["../../src/components/CloudsGenerator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAOtE,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC1D;sFACkF;IAClF,QAAQ,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,GAAG,IAAI,CAAC;IACpD,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,uFAAuF;IACvF,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;;;;GAeG;AACH,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA4CnD,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { CLOUD_DECK_DEFAULTS, normalizeCirrus, normalizeCloudDeck, normalizeCloudQuality } from '../types/cloudConfigs.js';
|
|
4
|
+
import Cumulus from './volumetricClouds/Cumulus.js';
|
|
5
|
+
import Stratocumulus from './volumetricClouds/Stratocumulus.js';
|
|
6
|
+
import Cumulonimbus from './volumetricClouds/Cumulonimbus.js';
|
|
7
|
+
import Cirrus from './volumetricClouds/Cirrus.js';
|
|
8
|
+
/**
|
|
9
|
+
* Picks the cloud model for the scene's sky.
|
|
10
|
+
*
|
|
11
|
+
* A sky is a deck plus an optional ice layer, not one of four things — cirrus
|
|
12
|
+
* coexists with every other type in nature and in the renderer. So the deck's type
|
|
13
|
+
* selects the component, and cirrus rides along with whichever one is chosen. With
|
|
14
|
+
* the deck off, the cirrus-only branch runs a three-sample ice pass and skips the
|
|
15
|
+
* volumetric march entirely.
|
|
16
|
+
*
|
|
17
|
+
* Whichever branch is taken mounts exactly one render pass, which is the constraint
|
|
18
|
+
* that matters: the pass owns the render loop.
|
|
19
|
+
*
|
|
20
|
+
* Each block is memoised against its own source object, not against `settings`, so
|
|
21
|
+
* editing cirrus does not hand the deck a new config and restart its temporal
|
|
22
|
+
* accumulation.
|
|
23
|
+
*/
|
|
24
|
+
const CloudsGenerator = ({ settings, skySettings, timeSettings, sunIntensity, onObjectReady, onObjectDispose, }) => {
|
|
25
|
+
const deck = useMemo(() => normalizeCloudDeck(settings?.config), [settings?.config]);
|
|
26
|
+
const cirrus = useMemo(() => normalizeCirrus(settings?.cirrus), [settings?.cirrus]);
|
|
27
|
+
const quality = useMemo(() => normalizeCloudQuality(settings?.quality), [settings?.quality]);
|
|
28
|
+
const deckOn = !!deck?.enabled;
|
|
29
|
+
const cirrusOn = !!cirrus?.enabled;
|
|
30
|
+
// The cirrus-only branch ignores the deck entirely (it passes deck={null} to the
|
|
31
|
+
// pass), but the shared prop shape still wants a real config rather than a
|
|
32
|
+
// non-null assertion over something that is genuinely absent.
|
|
33
|
+
const deckOrDefault = deck ?? { ...CLOUD_DECK_DEFAULTS.stratocumulus, enabled: false };
|
|
34
|
+
if (!deckOn && !cirrusOn)
|
|
35
|
+
return null;
|
|
36
|
+
const shared = {
|
|
37
|
+
deck: deckOrDefault,
|
|
38
|
+
cirrus: cirrusOn ? cirrus : null,
|
|
39
|
+
quality,
|
|
40
|
+
skySettings,
|
|
41
|
+
timeSettings,
|
|
42
|
+
sunIntensity,
|
|
43
|
+
animations: settings?.animations,
|
|
44
|
+
mouseMove: settings?.mouseMove,
|
|
45
|
+
id: settings?.id,
|
|
46
|
+
onObjectReady,
|
|
47
|
+
onObjectDispose,
|
|
48
|
+
};
|
|
49
|
+
if (!deckOn)
|
|
50
|
+
return _jsx(Cirrus, { ...shared });
|
|
51
|
+
switch (deckOrDefault.deckType) {
|
|
52
|
+
case 'cumulus': return _jsx(Cumulus, { ...shared });
|
|
53
|
+
case 'cumulonimbus': return _jsx(Cumulonimbus, { ...shared });
|
|
54
|
+
case 'stratocumulus':
|
|
55
|
+
default: return _jsx(Stratocumulus, { ...shared });
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
export default CloudsGenerator;
|
|
@@ -1,9 +1,51 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Vector3 } from 'three';
|
|
3
|
+
import { type SkySystemRef, type SkySystemProps } from './SkySystem';
|
|
4
|
+
import type { EnvironmentConfig, FogSettings, HdrSettings, SkySettings, TimeSettings } from '@3driseai/3drise-core';
|
|
5
|
+
import type { VolumetricCloudsSettings } from '../types/cloudConfigs';
|
|
6
|
+
import type { ProceduralTerrainSettings } from '../types/terrainConfigs';
|
|
7
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
8
|
+
/**
|
|
9
|
+
* The whole environment in one component: HDR background, image-based lighting,
|
|
10
|
+
* sky, sun, fog, clouds and terrain.
|
|
11
|
+
*
|
|
12
|
+
* This is the *composed* entry point, for SceneBuilder and for anyone embedding a
|
|
13
|
+
* published scene, where the settings arrive as one saved blob and nothing
|
|
14
|
+
* re-renders unless the project changes.
|
|
15
|
+
*
|
|
16
|
+
* A host with fine-grained reactive state — the editor — should compose the same
|
|
17
|
+
* pieces itself, one store subscription per slice, so a fog change cannot
|
|
18
|
+
* re-render the sun. Every piece here is exported for exactly that:
|
|
19
|
+
* HdrEnvironment, useEnvironmentProbe, SkySystem, SceneFog, CloudsGenerator,
|
|
20
|
+
* TerrainBuilder. Both paths run the same components; only the subscription
|
|
21
|
+
* granularity differs, and that is the only thing that should ever differ.
|
|
22
|
+
*/
|
|
23
|
+
/** core's EnvironmentConfig still types `clouds` as the retired CloudsSettings.
|
|
24
|
+
* Narrowed here rather than in core, which cannot reference the viewer's cloud
|
|
25
|
+
* types — they live next to the shader that consumes them. */
|
|
26
|
+
export type ViewerEnvironmentConfig = Omit<EnvironmentConfig, 'clouds'> & {
|
|
27
|
+
clouds?: VolumetricCloudsSettings;
|
|
28
|
+
/** core's EnvironmentConfig has no terrain field at all, and its
|
|
29
|
+
* `TerrainSettings` is the retired flat shape. Declared here for the same
|
|
30
|
+
* reason `clouds` is narrowed here: the config type lives next to the shader
|
|
31
|
+
* that consumes it, and core cannot reference the viewer. */
|
|
32
|
+
terrain?: ProceduralTerrainSettings;
|
|
33
|
+
};
|
|
34
|
+
export interface EnvironmentManagerProps extends ObjectReadyProps {
|
|
35
|
+
timeSettings: TimeSettings;
|
|
36
|
+
/** Saved-project shape. Any discrete prop below overrides the matching field. */
|
|
37
|
+
environment?: ViewerEnvironmentConfig;
|
|
38
|
+
hdrSettings?: HdrSettings;
|
|
39
|
+
skySettings?: SkySettings;
|
|
40
|
+
cloudsSettings?: VolumetricCloudsSettings;
|
|
41
|
+
terrainSettings?: ProceduralTerrainSettings;
|
|
42
|
+
fogSettings?: FogSettings;
|
|
5
43
|
cubeCameraResolution?: number;
|
|
44
|
+
skyboxScale?: number;
|
|
45
|
+
playerPosition?: Vector3;
|
|
46
|
+
onTimeOfDayChange?: SkySystemProps['onTimeOfDayChange'];
|
|
47
|
+
onTimeUpdate?: SkySystemProps['onTimeUpdate'];
|
|
6
48
|
}
|
|
7
|
-
declare const EnvironmentManager:
|
|
49
|
+
declare const EnvironmentManager: React.ForwardRefExoticComponent<EnvironmentManagerProps & React.RefAttributes<SkySystemRef>>;
|
|
8
50
|
export default EnvironmentManager;
|
|
9
51
|
//# sourceMappingURL=EnvironmentManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnvironmentManager.d.ts","sourceRoot":"","sources":["../../src/components/EnvironmentManager.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EnvironmentManager.d.ts","sourceRoot":"","sources":["../../src/components/EnvironmentManager.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAkB,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAGhF,OAAO,KAAK,EACR,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,WAAW,EACX,YAAY,EACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D;;;;;;;;;;;;;;GAcG;AAEH;;+DAE+D;AAC/D,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC,GAAG;IACtE,MAAM,CAAC,EAAE,wBAAwB,CAAC;IAClC;;;kEAG8D;IAC9D,OAAO,CAAC,EAAE,yBAAyB,CAAC;CACvC,CAAC;AAEF,MAAM,WAAW,uBAAwB,SAAQ,gBAAgB;IAC7D,YAAY,EAAE,YAAY,CAAC;IAC3B,iFAAiF;IACjF,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,cAAc,CAAC,EAAE,wBAAwB,CAAC;IAC1C,eAAe,CAAC,EAAE,yBAAyB,CAAC;IAC5C,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,cAAc,CAAC,mBAAmB,CAAC,CAAC;IACxD,YAAY,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;CACjD;AAoBD,QAAA,MAAM,kBAAkB,8FAwEtB,CAAC;AAGH,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,74 +1,43 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { Environment } from '@react-three/drei';
|
|
4
|
-
import { useThree } from '@react-three/fiber';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
5
3
|
import { Vector3 } from 'three';
|
|
6
4
|
import SkySystem from './SkySystem.js';
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const hdr = environment?.hdr ??
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const shadowMapSize = sky?.sunSystem?.shadowMapSize;
|
|
41
|
-
const playerPosition = new Vector3(0, 0, 0);
|
|
42
|
-
const starsSettings = environment?.stars;
|
|
43
|
-
const cloudsSettings = environment?.clouds;
|
|
44
|
-
const cloudsMaterialSettings = environment?.clouds?.materialSettings;
|
|
45
|
-
const skyControllerSettings = sky && !sky.sunSystem.visible ? sky : undefined;
|
|
46
|
-
const rainSettings = environment?.rain;
|
|
47
|
-
const fogSettings = environment?.fog;
|
|
48
|
-
useCubeCamera({
|
|
49
|
-
hdrSettings: hdr,
|
|
50
|
-
skyVisible: true,
|
|
51
|
-
sunSystemVisible: sunSystemVisible ?? false,
|
|
52
|
-
timeSettings,
|
|
5
|
+
import HdrEnvironment, { isHdrActive } from './HdrEnvironment.js';
|
|
6
|
+
import { useEnvironmentProbe } from '../hooks/useEnvironmentProbe.js';
|
|
7
|
+
import TerrainBuilder from './TerrainBuilder.js';
|
|
8
|
+
const DEFAULT_HDR = {
|
|
9
|
+
visible: false,
|
|
10
|
+
name: null,
|
|
11
|
+
settings: {
|
|
12
|
+
groundRadius: 200,
|
|
13
|
+
groundHeight: 10,
|
|
14
|
+
groundScale: 100,
|
|
15
|
+
blur: 0,
|
|
16
|
+
backgroundBlurriness: 0,
|
|
17
|
+
backgroundIntensity: 1,
|
|
18
|
+
backgroundRotation: 0,
|
|
19
|
+
environmentIntensity: 1,
|
|
20
|
+
environmentRotation: 0,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
const ORIGIN = new Vector3(0, 0, 0);
|
|
24
|
+
const EnvironmentManager = forwardRef(({ timeSettings, environment, hdrSettings, skySettings, cloudsSettings, terrainSettings, fogSettings, cubeCameraResolution = 512, skyboxScale = 100000, playerPosition = ORIGIN, onTimeOfDayChange, onTimeUpdate, onObjectReady, onObjectDispose, }, ref) => {
|
|
25
|
+
const hdr = hdrSettings ?? environment?.hdr ?? DEFAULT_HDR;
|
|
26
|
+
const sky = skySettings ?? environment?.sky;
|
|
27
|
+
const clouds = cloudsSettings ?? environment?.clouds;
|
|
28
|
+
const terrain = terrainSettings ?? environment?.terrain;
|
|
29
|
+
const fog = fogSettings ?? environment?.fog;
|
|
30
|
+
const sunSystemVisible = !!sky?.sunSystem?.visible;
|
|
31
|
+
// Previously hardcoded true, which kept a cube camera alive — and re-captured
|
|
32
|
+
// its six faces — for scenes that have no sky at all.
|
|
33
|
+
const skyActive = !!sky?.visible || sunSystemVisible;
|
|
34
|
+
useEnvironmentProbe({
|
|
35
|
+
hdrActive: isHdrActive(hdr),
|
|
36
|
+
skyActive,
|
|
37
|
+
autoAnimate: !!timeSettings.autoAnimate,
|
|
53
38
|
resolution: cubeCameraResolution,
|
|
54
39
|
});
|
|
55
|
-
|
|
56
|
-
// owns scene.environment + scene.background for the duration of the transitions.
|
|
57
|
-
const environmentComponent = useMemo(() => {
|
|
58
|
-
if (playlistActive)
|
|
59
|
-
return null;
|
|
60
|
-
if (!singleUrl && !backgroundName)
|
|
61
|
-
return null;
|
|
62
|
-
const sourceProps = singleUrl
|
|
63
|
-
? { files: singleUrl }
|
|
64
|
-
: { preset: backgroundName };
|
|
65
|
-
return (_jsx(Environment, { ...sourceProps, background: true, scene: scene, backgroundBlurriness: hdr.settings.backgroundBlurriness ?? 0, backgroundIntensity: hdr.settings.backgroundIntensity ?? 1, backgroundRotation: [0, hdr.settings.backgroundRotation ?? Math.PI / 2, 0], environmentIntensity: hdr.settings.environmentIntensity ?? 1, environmentRotation: [0, hdr.settings.environmentRotation ?? Math.PI / 2, 0], blur: hdr.settings.blur ?? 0, ground: {
|
|
66
|
-
radius: hdr.settings.groundRadius,
|
|
67
|
-
height: hdr.settings.groundHeight,
|
|
68
|
-
scale: hdr.settings.groundScale,
|
|
69
|
-
} }));
|
|
70
|
-
}, [playlistActive, singleUrl, backgroundName, hdr.settings, scene]);
|
|
71
|
-
return (_jsxs(_Fragment, { children: [environmentComponent, playlistActive && urls && (_jsx(HdrPlaylistRenderer, { urls: urls, transition: getTransitionSettings(hdr), onObjectReady: onObjectReady, onObjectDispose: onObjectDispose })), _jsx(SkySystem, { ref: ref, timeSettings: timeSettings, visible: true, sunSystemVisible: sunSystemVisible, sunSize: sunSize, moonSize: moonSize, skyboxScale: skyboxScale, sunIntensity: sunIntensity, castShadow: castShadow, shadowMapSize: shadowMapSize, playerPosition: playerPosition, starsSettings: starsSettings, cloudsSettings: cloudsSettings, cloudsMaterialSettings: cloudsMaterialSettings, skyControllerSettings: skyControllerSettings, rainSettings: rainSettings, fogSettings: fogSettings, onTimeOfDayChange: onTimeOfDayChange, onTimeUpdate: onTimeUpdate, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose })] }));
|
|
40
|
+
return (_jsxs(_Fragment, { children: [_jsx(HdrEnvironment, { hdr: hdr, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }), _jsx(TerrainBuilder, { settings: terrain, skySettings: sky, timeSettings: timeSettings, sunIntensity: sky?.sunSystem?.intensity ?? 1, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }), _jsx(SkySystem, { ref: ref, timeSettings: timeSettings, visible: true, sunSystemVisible: sunSystemVisible, sunSize: sky?.sunSystem?.sunSize, moonSize: sky?.sunSystem?.moonSize, skyboxScale: skyboxScale, sunIntensity: sky?.sunSystem?.intensity ?? 1, castShadow: sky?.sunSystem?.castShadow, shadowMapSize: sky?.sunSystem?.shadowMapSize, playerPosition: playerPosition, cloudsSettings: clouds, skyControllerSettings: sky, fogSettings: fog, onTimeOfDayChange: onTimeOfDayChange, onTimeUpdate: onTimeUpdate, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose })] }));
|
|
72
41
|
});
|
|
73
42
|
EnvironmentManager.displayName = 'EnvironmentManager';
|
|
74
43
|
export default EnvironmentManager;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { HdrSettings } from '@3driseai/3drise-core';
|
|
3
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
4
|
+
/**
|
|
5
|
+
* The HDR background and the image-based lighting that comes with it.
|
|
6
|
+
*
|
|
7
|
+
* Split out of EnvironmentManager so the editor's HDR connector and a published
|
|
8
|
+
* scene render the identical thing from the identical settings object. One
|
|
9
|
+
* `<Environment>`, one set of prop defaults, one place to change them.
|
|
10
|
+
*/
|
|
11
|
+
/** A background is active when something is actually going to be drawn: a named
|
|
12
|
+
* drei preset, a single URL, or a playlist. `visible` alone is not enough — it
|
|
13
|
+
* can be true with nothing selected. */
|
|
14
|
+
export declare function isHdrActive(hdr: HdrSettings): boolean;
|
|
15
|
+
export interface HdrEnvironmentProps extends ObjectReadyProps {
|
|
16
|
+
hdr: HdrSettings;
|
|
17
|
+
}
|
|
18
|
+
declare const HdrEnvironment: React.FC<HdrEnvironmentProps>;
|
|
19
|
+
export default HdrEnvironment;
|
|
20
|
+
//# sourceMappingURL=HdrEnvironment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HdrEnvironment.d.ts","sourceRoot":"","sources":["../../src/components/HdrEnvironment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAIvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D;;;;;;GAMG;AAEH;;yCAEyC;AACzC,wBAAgB,WAAW,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAIrD;AAED,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IACzD,GAAG,EAAE,WAAW,CAAC;CACpB;AAED,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAgDjD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { Environment } from '@react-three/drei';
|
|
4
|
+
import { useThree } from '@react-three/fiber';
|
|
5
|
+
import { getTransitionSettings } from '@3driseai/3drise-core';
|
|
6
|
+
import HdrPlaylistRenderer from './HdrPlaylistRenderer.js';
|
|
7
|
+
/**
|
|
8
|
+
* The HDR background and the image-based lighting that comes with it.
|
|
9
|
+
*
|
|
10
|
+
* Split out of EnvironmentManager so the editor's HDR connector and a published
|
|
11
|
+
* scene render the identical thing from the identical settings object. One
|
|
12
|
+
* `<Environment>`, one set of prop defaults, one place to change them.
|
|
13
|
+
*/
|
|
14
|
+
/** A background is active when something is actually going to be drawn: a named
|
|
15
|
+
* drei preset, a single URL, or a playlist. `visible` alone is not enough — it
|
|
16
|
+
* can be true with nothing selected. */
|
|
17
|
+
export function isHdrActive(hdr) {
|
|
18
|
+
const name = hdr.visible ? hdr.name : null;
|
|
19
|
+
const urls = hdr.urls;
|
|
20
|
+
return !!(name || (urls && urls.length >= 1));
|
|
21
|
+
}
|
|
22
|
+
const HdrEnvironment = ({ hdr, onObjectReady, onObjectDispose }) => {
|
|
23
|
+
const { scene } = useThree();
|
|
24
|
+
const backgroundName = hdr.visible ? hdr.name : null;
|
|
25
|
+
const urls = hdr.urls;
|
|
26
|
+
const playlistActive = !!urls && urls.length > 1;
|
|
27
|
+
const singleUrl = urls && urls.length === 1 ? urls[0] : undefined;
|
|
28
|
+
const active = !!(backgroundName || singleUrl || playlistActive);
|
|
29
|
+
// While the playlist runs, drei's <Environment> unmounts: HdrPlaylistRenderer
|
|
30
|
+
// owns scene.environment and scene.background for the duration of the
|
|
31
|
+
// transitions, and two owners means one of them loses.
|
|
32
|
+
const environmentComponent = useMemo(() => {
|
|
33
|
+
if (playlistActive || !active)
|
|
34
|
+
return null;
|
|
35
|
+
const sourceProps = singleUrl ? { files: singleUrl } : { preset: backgroundName };
|
|
36
|
+
return (_jsx(Environment, { ...sourceProps, background: true, scene: scene, backgroundBlurriness: hdr.settings.backgroundBlurriness ?? 0, backgroundIntensity: hdr.settings.backgroundIntensity ?? 1, backgroundRotation: [0, hdr.settings.backgroundRotation ?? Math.PI / 2, 0], environmentIntensity: hdr.settings.environmentIntensity ?? 1, environmentRotation: [0, hdr.settings.environmentRotation ?? Math.PI / 2, 0], blur: hdr.settings.blur ?? 0, ground: {
|
|
37
|
+
radius: hdr.settings.groundRadius,
|
|
38
|
+
height: hdr.settings.groundHeight,
|
|
39
|
+
scale: hdr.settings.groundScale,
|
|
40
|
+
} }));
|
|
41
|
+
}, [playlistActive, active, singleUrl, backgroundName, hdr.settings, scene]);
|
|
42
|
+
return (_jsxs(_Fragment, { children: [environmentComponent, playlistActive && urls && (_jsx(HdrPlaylistRenderer, { urls: urls, transition: getTransitionSettings(hdr), onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }))] }));
|
|
43
|
+
};
|
|
44
|
+
export default HdrEnvironment;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
3
|
+
import type { LandscapeSettings } from '../types/landscapeConfigs';
|
|
4
|
+
export interface LandscapeBuilderProps extends ObjectReadyProps {
|
|
5
|
+
/** Accepts a partial or older-shaped blob. A blob with no `heightMap`
|
|
6
|
+
* normalises to nothing — a landscape without one is not a landscape, and
|
|
7
|
+
* inventing a default would put ground in a scene that never had any. */
|
|
8
|
+
settings?: Partial<LandscapeSettings> | null;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The world ground.
|
|
12
|
+
*
|
|
13
|
+
* The counterpart to `TerrainBuilder` and deliberately independent of it: a
|
|
14
|
+
* scene may have procedural terrain, an authored landscape, both or neither.
|
|
15
|
+
* They are different objects with different config and nothing shared, which is
|
|
16
|
+
* why there is no `groundType` switch anywhere.
|
|
17
|
+
*
|
|
18
|
+
* Each block is normalised against its own source, so editing quality cannot
|
|
19
|
+
* invalidate the config and re-run RTIN.
|
|
20
|
+
*/
|
|
21
|
+
declare const LandscapeBuilder: React.FC<LandscapeBuilderProps>;
|
|
22
|
+
export default LandscapeBuilder;
|
|
23
|
+
//# sourceMappingURL=LandscapeBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LandscapeBuilder.d.ts","sourceRoot":"","sources":["../../src/components/LandscapeBuilder.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAIlE,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC3D;;8EAE0E;IAC1E,QAAQ,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAA;CAC/C;AAED;;;;;;;;;;GAUG;AACH,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAqBrD,CAAA;AAED,eAAe,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { normalizeLandscape, normalizeLandscapeQuality } from '../types/landscapeConfigs.js';
|
|
4
|
+
import LandscapeMesh from './landscape/LandscapeMesh.js';
|
|
5
|
+
/**
|
|
6
|
+
* The world ground.
|
|
7
|
+
*
|
|
8
|
+
* The counterpart to `TerrainBuilder` and deliberately independent of it: a
|
|
9
|
+
* scene may have procedural terrain, an authored landscape, both or neither.
|
|
10
|
+
* They are different objects with different config and nothing shared, which is
|
|
11
|
+
* why there is no `groundType` switch anywhere.
|
|
12
|
+
*
|
|
13
|
+
* Each block is normalised against its own source, so editing quality cannot
|
|
14
|
+
* invalidate the config and re-run RTIN.
|
|
15
|
+
*/
|
|
16
|
+
const LandscapeBuilder = ({ settings, onObjectReady, onObjectDispose, }) => {
|
|
17
|
+
const config = useMemo(() => normalizeLandscape(settings?.config), [settings?.config]);
|
|
18
|
+
const quality = useMemo(() => normalizeLandscapeQuality(settings?.quality), [settings?.quality]);
|
|
19
|
+
if (!config?.enabled)
|
|
20
|
+
return null;
|
|
21
|
+
if (!config.heightMap || config.surfaces.length === 0)
|
|
22
|
+
return null;
|
|
23
|
+
return (_jsx(LandscapeMesh, { id: settings?.id ?? '3drise-landscape', config: config, quality: quality, applyTransform: true, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }));
|
|
24
|
+
};
|
|
25
|
+
export default LandscapeBuilder;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
3
|
+
import type { LandscapeSettings } from '../types/landscapeConfigs';
|
|
4
|
+
export interface LandscapeObjectProps extends ObjectReadyProps {
|
|
5
|
+
settings: Partial<LandscapeSettings> & {
|
|
6
|
+
id?: string;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A placed landscape — a floating island, a diorama, a game tile, a table-top
|
|
11
|
+
* relief.
|
|
12
|
+
*
|
|
13
|
+
* Mounted through `ObjectNode`'s renderers map, so it is an ordinary
|
|
14
|
+
* `CreatedObject` and gets the transform gizmo, keyframe animation, mouse-move
|
|
15
|
+
* interactions, parenting and click actions with no work here. That is the whole
|
|
16
|
+
* argument for it being an object rather than a second environment entry.
|
|
17
|
+
*
|
|
18
|
+
* `applyTransform` is false: the wrapper owns position, rotation and scale, and
|
|
19
|
+
* the config's own `origin` / `rotationY` are ground-host fields that would
|
|
20
|
+
* fight it.
|
|
21
|
+
*/
|
|
22
|
+
declare const LandscapeObject: React.FC<LandscapeObjectProps>;
|
|
23
|
+
export default LandscapeObject;
|
|
24
|
+
//# sourceMappingURL=LandscapeObject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LandscapeObject.d.ts","sourceRoot":"","sources":["../../src/components/LandscapeObject.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAIlE,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC1D,QAAQ,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG;QAAE,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CACzD;AAED;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAqBnD,CAAA;AAED,eAAe,eAAe,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { normalizeLandscape, normalizeLandscapeQuality } from '../types/landscapeConfigs.js';
|
|
4
|
+
import LandscapeMesh from './landscape/LandscapeMesh.js';
|
|
5
|
+
/**
|
|
6
|
+
* A placed landscape — a floating island, a diorama, a game tile, a table-top
|
|
7
|
+
* relief.
|
|
8
|
+
*
|
|
9
|
+
* Mounted through `ObjectNode`'s renderers map, so it is an ordinary
|
|
10
|
+
* `CreatedObject` and gets the transform gizmo, keyframe animation, mouse-move
|
|
11
|
+
* interactions, parenting and click actions with no work here. That is the whole
|
|
12
|
+
* argument for it being an object rather than a second environment entry.
|
|
13
|
+
*
|
|
14
|
+
* `applyTransform` is false: the wrapper owns position, rotation and scale, and
|
|
15
|
+
* the config's own `origin` / `rotationY` are ground-host fields that would
|
|
16
|
+
* fight it.
|
|
17
|
+
*/
|
|
18
|
+
const LandscapeObject = ({ settings, onObjectReady, onObjectDispose, }) => {
|
|
19
|
+
const config = useMemo(() => normalizeLandscape(settings?.config), [settings?.config]);
|
|
20
|
+
const quality = useMemo(() => normalizeLandscapeQuality(settings?.quality), [settings?.quality]);
|
|
21
|
+
if (!config?.enabled)
|
|
22
|
+
return null;
|
|
23
|
+
if (!config.heightMap || config.surfaces.length === 0)
|
|
24
|
+
return null;
|
|
25
|
+
return (_jsx(LandscapeMesh, { id: settings.id ?? 'landscape-object', config: config, quality: quality, applyTransform: false, onObjectReady: onObjectReady, onObjectDispose: onObjectDispose }));
|
|
26
|
+
};
|
|
27
|
+
export default LandscapeObject;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectNode.d.ts","sourceRoot":"","sources":["../../src/components/ObjectNode.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ObjectNode.d.ts","sourceRoot":"","sources":["../../src/components/ObjectNode.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAe,qBAAqB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,KAAK,eAAe,GAAG,gBAAgB,GAAG;IACtC,IAAI,EAAE,cAAc,CAAC;IACrB,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAC7G,CAAC;AAgBF,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAmHzC,CAAC;AACF,eAAe,UAAU,CAAC"}
|
|
@@ -13,6 +13,8 @@ import LightObject from "./LightObject.js";
|
|
|
13
13
|
import EnvironmentObject from "./EnvironmentObject.js";
|
|
14
14
|
import Galaxy from "./Galaxy.js";
|
|
15
15
|
import GridGenerator from "./GridsGenerator.js";
|
|
16
|
+
import OceanBuilder from "./OceanBuilder.js";
|
|
17
|
+
import LandscapeObject from "./LandscapeObject.js";
|
|
16
18
|
import { SELF_MANAGED_MATERIAL } from "../constants.js";
|
|
17
19
|
// const EffectsLayer: React.FC<{ effects: CreatedObjectSettings['effects'] }> = ({ effects }) =>
|
|
18
20
|
// effects?.length ? (
|
|
@@ -77,6 +79,14 @@ const ObjectNode = ({ node, onObjectReady, onObjectDispose, handleObjectClick })
|
|
|
77
79
|
grid: (obj, onObjectReady) => (
|
|
78
80
|
// <GridHelper {...(obj.config as GridConfig)} side={2} />
|
|
79
81
|
_jsx(GridGenerator, { config: obj.config, ...relabel(obj) })),
|
|
82
|
+
// A placed body of water — the object host. The world ocean is mounted by
|
|
83
|
+
// the environment instead, so this branch only ever sees a pool, a pond or
|
|
84
|
+
// a canal; OceanBuilder decides which from config.host either way.
|
|
85
|
+
ocean: (obj, onObjectReady) => (_jsx(OceanBuilder, { settings: obj, ...relabel(obj) }, obj.id)),
|
|
86
|
+
// A placed landscape — the object host. The world ground is mounted by
|
|
87
|
+
// LandscapeConnector instead; this one is a diorama, a floating island or
|
|
88
|
+
// a game tile, and gets its transform from the CreatedObject wrapper.
|
|
89
|
+
landscape: (obj, onObjectReady) => (_jsx(LandscapeObject, { settings: obj, ...relabel(obj) }, obj.id)),
|
|
80
90
|
effect: (obj) => (_jsx(EffectsGenerator, { settings: {
|
|
81
91
|
config: obj.config,
|
|
82
92
|
}, ...relabel(obj) }, obj.id)),
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SkySettings, TimeSettings } from '@3driseai/3drise-core';
|
|
3
|
+
import type { ObjectReadyProps } from '../types/objectReady';
|
|
4
|
+
import type { OceanWaterSettings } from '../types/oceanConfigs';
|
|
5
|
+
export interface OceanBuilderProps extends ObjectReadyProps {
|
|
6
|
+
/** Accepts a partial or older-shaped blob — including core's retired
|
|
7
|
+
* `OceanSettings`, the flat plane with a water material picked out of the
|
|
8
|
+
* registry. That one is MAPPED rather than dropped: see below. */
|
|
9
|
+
settings?: Partial<OceanWaterSettings> | null;
|
|
10
|
+
skySettings?: SkySettings;
|
|
11
|
+
timeSettings?: TimeSettings;
|
|
12
|
+
/** Matches SkySystem's sunIntensity, so water brightens with the scene. */
|
|
13
|
+
sunIntensity?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Picks the water body for the scene.
|
|
17
|
+
*
|
|
18
|
+
* The counterpart to `CloudsGenerator` and `TerrainBuilder`, and deliberately the
|
|
19
|
+
* same shape: switch on the model field, mount exactly one renderer, normalise
|
|
20
|
+
* each block against its own source so editing one cannot invalidate the other.
|
|
21
|
+
*
|
|
22
|
+
* ## One place it differs from the terrain, on purpose
|
|
23
|
+
*
|
|
24
|
+
* `normalizeTerrain` returns null for a blob in the retired shape, because a
|
|
25
|
+
* project saved before terrain existed never had ground and defaulting one in
|
|
26
|
+
* would give it a landscape it was never authored with. The ocean is the
|
|
27
|
+
* opposite case: the old ocean is a visible plane with a water material, so a
|
|
28
|
+
* project saved before this system very possibly HAD water, and returning null
|
|
29
|
+
* would delete it. A legacy blob is therefore mapped — its material variant onto
|
|
30
|
+
* the nearest type, its plane size onto the host, its Y onto the sea level. See
|
|
31
|
+
* `normalizeOcean`.
|
|
32
|
+
*/
|
|
33
|
+
declare const OceanBuilder: React.FC<OceanBuilderProps>;
|
|
34
|
+
export default OceanBuilder;
|
|
35
|
+
//# sourceMappingURL=OceanBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OceanBuilder.d.ts","sourceRoot":"","sources":["../../src/components/OceanBuilder.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAOhE,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACvD;;uEAEmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC;IAC9C,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,2EAA2E;IAC3E,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAmC7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { normalizeOcean, normalizeOceanQuality } from '../types/oceanConfigs.js';
|
|
4
|
+
import Sea from './water/Sea.js';
|
|
5
|
+
import Lake from './water/Lake.js';
|
|
6
|
+
import Storm from './water/Storm.js';
|
|
7
|
+
import Shore from './water/Shore.js';
|
|
8
|
+
/**
|
|
9
|
+
* Picks the water body for the scene.
|
|
10
|
+
*
|
|
11
|
+
* The counterpart to `CloudsGenerator` and `TerrainBuilder`, and deliberately the
|
|
12
|
+
* same shape: switch on the model field, mount exactly one renderer, normalise
|
|
13
|
+
* each block against its own source so editing one cannot invalidate the other.
|
|
14
|
+
*
|
|
15
|
+
* ## One place it differs from the terrain, on purpose
|
|
16
|
+
*
|
|
17
|
+
* `normalizeTerrain` returns null for a blob in the retired shape, because a
|
|
18
|
+
* project saved before terrain existed never had ground and defaulting one in
|
|
19
|
+
* would give it a landscape it was never authored with. The ocean is the
|
|
20
|
+
* opposite case: the old ocean is a visible plane with a water material, so a
|
|
21
|
+
* project saved before this system very possibly HAD water, and returning null
|
|
22
|
+
* would delete it. A legacy blob is therefore mapped — its material variant onto
|
|
23
|
+
* the nearest type, its plane size onto the host, its Y onto the sea level. See
|
|
24
|
+
* `normalizeOcean`.
|
|
25
|
+
*/
|
|
26
|
+
const OceanBuilder = ({ settings, skySettings, timeSettings, sunIntensity, onObjectReady, onObjectDispose, }) => {
|
|
27
|
+
// Each block against its own source. Merging them through one object would
|
|
28
|
+
// hand the renderer a new config every time a quality slider moved, which
|
|
29
|
+
// rebuilds every clipmap ring.
|
|
30
|
+
const config = useMemo(() => normalizeOcean(settings?.config, settings), [settings]);
|
|
31
|
+
const quality = useMemo(() => normalizeOceanQuality(settings?.quality), [settings?.quality]);
|
|
32
|
+
if (!config?.enabled)
|
|
33
|
+
return null;
|
|
34
|
+
const shared = {
|
|
35
|
+
config,
|
|
36
|
+
quality,
|
|
37
|
+
skySettings,
|
|
38
|
+
timeSettings,
|
|
39
|
+
sunIntensity,
|
|
40
|
+
id: settings?.id,
|
|
41
|
+
meshSettings: settings?.meshSettings,
|
|
42
|
+
onObjectReady,
|
|
43
|
+
onObjectDispose,
|
|
44
|
+
};
|
|
45
|
+
switch (config.waterType) {
|
|
46
|
+
case 'lake': return _jsx(Lake, { ...shared });
|
|
47
|
+
case 'storm': return _jsx(Storm, { ...shared });
|
|
48
|
+
case 'shore': return _jsx(Shore, { ...shared });
|
|
49
|
+
case 'sea':
|
|
50
|
+
default: return _jsx(Sea, { ...shared });
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
export default OceanBuilder;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneBuilder.d.ts","sourceRoot":"","sources":["../../src/components/SceneBuilder.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAQ/D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,GAAG,gBAAgB,
|
|
1
|
+
{"version":3,"file":"SceneBuilder.d.ts","sourceRoot":"","sources":["../../src/components/SceneBuilder.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAQ/D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,GAAG,gBAAgB,CAmIhE,CAAC;AACF,eAAe,YAAY,CAAC"}
|