feat(web): wire Blender world lighting controls
This commit is contained in:
File diff suppressed because one or more lines are too long
2
web/app/src/vendor/blender/web_engine.js
vendored
2
web/app/src/vendor/blender/web_engine.js
vendored
File diff suppressed because one or more lines are too long
BIN
web/app/src/vendor/blender/web_engine.wasm
vendored
BIN
web/app/src/vendor/blender/web_engine.wasm
vendored
Binary file not shown.
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user