Add support for God Rays advanced rendering settings

This commit is contained in:
2026-04-28 04:31:43 +02:00
parent ae83091848
commit 371ee6d595
2 changed files with 41 additions and 1 deletions

View File

@@ -177,6 +177,7 @@ import {
CONTROL_SURFACE_FOUNDATION_SCENE_DOCUMENT_VERSION,
DISTANCE_FOG_SCENE_DOCUMENT_VERSION,
DYNAMIC_GLOBAL_ILLUMINATION_SCENE_DOCUMENT_VERSION,
GOD_RAYS_SCENE_DOCUMENT_VERSION,
DEFAULT_PROJECT_NAME,
DEFAULT_PROJECT_SCENE_ID,
SCENE_EDITOR_PREFERENCES_SCENE_DOCUMENT_VERSION,
@@ -792,6 +793,10 @@ function readAdvancedRenderingSettings(
throw new Error("world.advancedRendering.distanceFog must be an object.");
}
if (value.godRays !== undefined && !isRecord(value.godRays)) {
throw new Error("world.advancedRendering.godRays must be an object.");
}
const shadows = value.shadows as Record<string, unknown> | undefined;
const ambientOcclusion = value.ambientOcclusion as
| Record<string, unknown>
@@ -808,6 +813,7 @@ function readAdvancedRenderingSettings(
| Record<string, unknown>
| undefined;
const distanceFog = value.distanceFog as Record<string, unknown> | undefined;
const godRays = value.godRays as Record<string, unknown> | undefined;
const shadowsMapSize = readOptionalAllowedValue(
shadows?.mapSize,
@@ -1015,6 +1021,39 @@ function readAdvancedRenderingSettings(
defaults.distanceFog.renderDistance
)
},
godRays: {
enabled: readOptionalBoolean(
godRays?.enabled,
"world.advancedRendering.godRays.enabled",
defaults.godRays.enabled
),
intensity: readOptionalNonNegativeFiniteNumber(
godRays?.intensity,
"world.advancedRendering.godRays.intensity",
defaults.godRays.intensity
),
decay: readOptionalNonNegativeFiniteNumber(
godRays?.decay,
"world.advancedRendering.godRays.decay",
defaults.godRays.decay
),
exposure: readOptionalNonNegativeFiniteNumber(
godRays?.exposure,
"world.advancedRendering.godRays.exposure",
defaults.godRays.exposure
),
density: readOptionalNonNegativeFiniteNumber(
godRays?.density,
"world.advancedRendering.godRays.density",
defaults.godRays.density
),
samples: readOptionalPositiveIntegerWithMax(
godRays?.samples,
"world.advancedRendering.godRays.samples",
defaults.godRays.samples,
64
)
},
fogPath,
waterPath,
waterReflectionMode

View File

@@ -29,7 +29,8 @@ import {
} from "../sequencer/project-sequences";
import type { Terrain } from "./terrains";
export const SCENE_DOCUMENT_VERSION = 86 as const;
export const SCENE_DOCUMENT_VERSION = 87 as const;
export const GOD_RAYS_SCENE_DOCUMENT_VERSION = 87 as const;
export const DISTANCE_FOG_SCENE_DOCUMENT_VERSION = 86 as const;
export const DYNAMIC_GLOBAL_ILLUMINATION_SCENE_DOCUMENT_VERSION = 85 as const;
export const PLAYER_START_MOUSE_INVERT_SCENE_DOCUMENT_VERSION = 84 as const;