Add support for whitebox bevel in scene document

This commit is contained in:
2026-04-12 01:03:50 +02:00
parent 5b822548ae
commit ad9790e750
3 changed files with 63 additions and 1 deletions

View File

@@ -105,6 +105,7 @@ import {
TRIGGER_ACTION_TARGET_FOUNDATION_SCENE_DOCUMENT_VERSION,
RUNNER_LOADING_SCREEN_SCENE_DOCUMENT_VERSION,
WATER_SURFACE_DISPLACEMENT_SCENE_DOCUMENT_VERSION,
WHITEBOX_BEVEL_SCENE_DOCUMENT_VERSION,
WHITEBOX_BOX_VOLUME_SCENE_DOCUMENT_VERSION,
WHITEBOX_FLOAT_TRANSFORM_SCENE_DOCUMENT_VERSION,
WHITEBOX_GEOMETRY_SCENE_DOCUMENT_VERSION,
@@ -510,6 +511,10 @@ function readAdvancedRenderingSettings(
throw new Error("world.advancedRendering.depthOfField must be an object.");
}
if (value.whiteboxBevel !== undefined && !isRecord(value.whiteboxBevel)) {
throw new Error("world.advancedRendering.whiteboxBevel must be an object.");
}
const shadows = value.shadows as Record<string, unknown> | undefined;
const ambientOcclusion = value.ambientOcclusion as
| Record<string, unknown>
@@ -519,6 +524,9 @@ function readAdvancedRenderingSettings(
const depthOfField = value.depthOfField as
| Record<string, unknown>
| undefined;
const whiteboxBevel = value.whiteboxBevel as
| Record<string, unknown>
| undefined;
const shadowsMapSize = readOptionalAllowedValue(
shadows?.mapSize,
@@ -651,6 +659,23 @@ function readAdvancedRenderingSettings(
defaults.depthOfField.bokehScale
)
},
whiteboxBevel: {
enabled: readOptionalBoolean(
whiteboxBevel?.enabled,
"world.advancedRendering.whiteboxBevel.enabled",
defaults.whiteboxBevel.enabled
),
edgeWidth: readOptionalNonNegativeFiniteNumber(
whiteboxBevel?.edgeWidth,
"world.advancedRendering.whiteboxBevel.edgeWidth",
defaults.whiteboxBevel.edgeWidth
),
normalStrength: readOptionalNonNegativeFiniteNumber(
whiteboxBevel?.normalStrength,
"world.advancedRendering.whiteboxBevel.normalStrength",
defaults.whiteboxBevel.normalStrength
)
},
fogPath,
waterPath,
waterReflectionMode
@@ -2841,6 +2866,7 @@ export function migrateSceneDocument(source: unknown): SceneDocument {
source.version !== RUNNER_LOADING_SCREEN_SCENE_DOCUMENT_VERSION &&
source.version !== MULTI_SCENE_FOUNDATION_SCENE_DOCUMENT_VERSION &&
source.version !== WATER_SURFACE_DISPLACEMENT_SCENE_DOCUMENT_VERSION &&
source.version !== WHITEBOX_BEVEL_SCENE_DOCUMENT_VERSION &&
source.version !== WHITEBOX_BOX_VOLUME_SCENE_DOCUMENT_VERSION &&
source.version !== WHITEBOX_FLOAT_TRANSFORM_SCENE_DOCUMENT_VERSION &&
source.version !== WHITEBOX_GEOMETRY_SCENE_DOCUMENT_VERSION

View File

@@ -498,6 +498,41 @@ function validateWorldSettings(
);
}
if (!isBoolean(advancedRendering.whiteboxBevel.enabled)) {
diagnostics.push(
createDiagnostic(
"error",
"invalid-advanced-rendering-whitebox-bevel-enabled",
"Advanced rendering whitebox bevel enabled must be a boolean.",
"world.advancedRendering.whiteboxBevel.enabled"
)
);
}
if (!isNonNegativeFiniteNumber(advancedRendering.whiteboxBevel.edgeWidth)) {
diagnostics.push(
createDiagnostic(
"error",
"invalid-advanced-rendering-whitebox-bevel-edge-width",
"Advanced rendering whitebox bevel edge width must be a non-negative finite number.",
"world.advancedRendering.whiteboxBevel.edgeWidth"
)
);
}
if (
!isNonNegativeFiniteNumber(advancedRendering.whiteboxBevel.normalStrength)
) {
diagnostics.push(
createDiagnostic(
"error",
"invalid-advanced-rendering-whitebox-bevel-normal-strength",
"Advanced rendering whitebox bevel normal strength must be a non-negative finite number.",
"world.advancedRendering.whiteboxBevel.normalStrength"
)
);
}
if (!isBoxVolumeRenderPath(advancedRendering.fogPath)) {
diagnostics.push(
createDiagnostic(

View File

@@ -15,7 +15,8 @@ import {
type WorldSettings
} from "./world-settings";
export const SCENE_DOCUMENT_VERSION = 32 as const;
export const SCENE_DOCUMENT_VERSION = 33 as const;
export const WHITEBOX_BEVEL_SCENE_DOCUMENT_VERSION = 32 as const;
export const PLAYER_START_LOCOMOTION_CORE_SCENE_DOCUMENT_VERSION = 32 as const;
export const PLAYER_START_MOVEMENT_TEMPLATE_SCENE_DOCUMENT_VERSION =
31 as const;