feat(web): wire Blender world lighting controls
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled

This commit is contained in:
mes123456
2026-08-30 20:10:15 +08:00
parent e9e1788b14
commit b15ac3770a
40 changed files with 1985 additions and 22 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@@ -585,9 +585,10 @@ function assertFutureCapability(payload: Extract<WebEngineRequest["command"], {
case "setWorldProperties": {
const world = currentSnapshot?.worlds.find((candidate) => candidate.id === payload.dataId);
const properties = payload.properties;
if (!world || !validPropertyKeys(properties, ["color", "exposure", "mist"])) throw report("RENDER_PROPERTY_INVALID", "World target or properties are invalid");
if (!world || !validPropertyKeys(properties, ["color", "exposure", "ambientOcclusionDistance", "ambientOcclusionEnergy", "sunThreshold", "sunAngle", "sunShadowMaximumResolution", "sunShadowJitterOverblur", "sunShadowFilterRadius", "mist"])) throw report("RENDER_PROPERTY_INVALID", "World target or properties are invalid");
if (properties.color !== undefined && (!Array.isArray(properties.color) || properties.color.length !== 3 || properties.color.some((value) => !boundedNumber(value, 0, 100)))) throw report("RENDER_PROPERTY_INVALID", "World color is invalid");
if (properties.exposure !== undefined && !boundedNumber(properties.exposure, -20, 20)) throw report("RENDER_PROPERTY_INVALID", "World exposure is invalid");
for (const [field, minimum, maximum] of [["ambientOcclusionDistance", 0, 1e9], ["ambientOcclusionEnergy", 0, 1e9], ["sunThreshold", 0, 1e9], ["sunAngle", 0, Math.PI], ["sunShadowMaximumResolution", 0.0000001, 1e9], ["sunShadowJitterOverblur", 0, 1e9], ["sunShadowFilterRadius", 0, 1e9]] as const) if (properties[field] !== undefined && !boundedNumber(properties[field], minimum, maximum)) throw report("RENDER_PROPERTY_INVALID", `World ${field} is outside the bounded range`);
if (properties.mist !== undefined) {
const mist = properties.mist;
if (!validPropertyKeys(mist, ["enabled", "type", "start", "depth", "intensity", "height"])) throw report("RENDER_PROPERTY_INVALID", "World mist is invalid");