feat(web): wire Blender light clip start
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 19:48:41 +08:00
parent 6414d899fb
commit e9e1788b14
38 changed files with 1952 additions and 21 deletions

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@@ -541,7 +541,7 @@ function assertFutureCapability(payload: Extract<WebEngineRequest["command"], {
case "setLightProperties": {
const light = currentSnapshot?.lights.find((candidate) => candidate.id === payload.dataId);
const properties = payload.properties;
if (!light || !validPropertyKeys(properties, ["type", "areaShape", "diffuseFactor", "specularFactor", "transmissionFactor", "volumeFactor", "attenuationDistance", "shadowFilterRadius", "shadowMaximumResolution", "shadowJitterOverblur", "cascadeMaxDistance", "cascadeExponent", "cascadeFade", "cascadeCount", "areaSizeZ", "color", "energy", "exposure", "temperature", "useTemperature", "castsShadow", "radius", "spotAngle", "spotBlend", "areaSize", "areaSizeY", "areaSpread", "sunAngle"])) throw report("RENDER_PROPERTY_INVALID", "Light target or properties are invalid");
if (!light || !validPropertyKeys(properties, ["type", "areaShape", "diffuseFactor", "specularFactor", "transmissionFactor", "volumeFactor", "attenuationDistance", "shadowFilterRadius", "shadowMaximumResolution", "shadowJitterOverblur", "cascadeMaxDistance", "cascadeExponent", "cascadeFade", "cascadeCount", "areaSizeZ", "clipStart", "color", "energy", "exposure", "temperature", "useTemperature", "castsShadow", "radius", "spotAngle", "spotBlend", "areaSize", "areaSizeY", "areaSpread", "sunAngle"])) throw report("RENDER_PROPERTY_INVALID", "Light target or properties are invalid");
if (properties.type !== undefined && !["POINT", "SUN", "SPOT", "AREA"].includes(properties.type)) throw report("RENDER_PROPERTY_INVALID", "Light type is invalid");
if (properties.areaShape !== undefined && ![0, 1, 4, 5].includes(properties.areaShape)) throw report("RENDER_PROPERTY_INVALID", "Light area shape is invalid");
for (const field of ["diffuseFactor", "specularFactor", "transmissionFactor", "volumeFactor"] as const) if (properties[field] !== undefined && !boundedNumber(properties[field], 0, 1)) throw report("RENDER_PROPERTY_INVALID", `Light ${field} is outside the bounded range`);
@@ -549,8 +549,9 @@ function assertFutureCapability(payload: Extract<WebEngineRequest["command"], {
for (const [field, minimum, maximum] of [["cascadeMaxDistance", 0, 1e9], ["cascadeExponent", 0, 100], ["cascadeFade", 0, 1]] as const) if (properties[field] !== undefined && !boundedNumber(properties[field], minimum, maximum)) throw report("RENDER_PROPERTY_INVALID", `Light ${field} is outside the bounded range`);
if (properties.cascadeCount !== undefined && (!Number.isSafeInteger(properties.cascadeCount) || properties.cascadeCount < 1 || properties.cascadeCount > 4)) throw report("RENDER_PROPERTY_INVALID", "Light cascade count is outside the bounded range");
if (properties.areaSizeZ !== undefined && !boundedNumber(properties.areaSizeZ, 0.0001, 1e9)) throw report("RENDER_PROPERTY_INVALID", "Light areaSizeZ is outside the bounded range");
if (properties.clipStart !== undefined && !boundedNumber(properties.clipStart, 0.0001, 1e9)) throw report("RENDER_PROPERTY_INVALID", "Light clipStart is outside the bounded range");
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", "Light color is invalid");
for (const [field, minimum, maximum] of [["energy", 0, 1e9], ["exposure", -20, 20], ["temperature", 800, 20000], ["radius", 0, 1e9], ["spotAngle", 0.0001, Math.PI], ["spotBlend", 0, 1], ["areaSize", 0.0001, 1e9], ["areaSizeY", 0.0001, 1e9], ["areaSizeZ", 0.0001, 1e9], ["areaSpread", 0.0001, Math.PI], ["sunAngle", 0, Math.PI]] as const) {
for (const [field, minimum, maximum] of [["energy", 0, 1e9], ["exposure", -20, 20], ["temperature", 800, 20000], ["radius", 0, 1e9], ["spotAngle", 0.0001, Math.PI], ["spotBlend", 0, 1], ["areaSize", 0.0001, 1e9], ["areaSizeY", 0.0001, 1e9], ["areaSizeZ", 0.0001, 1e9], ["clipStart", 0.0001, 1e9], ["areaSpread", 0.0001, Math.PI], ["sunAngle", 0, Math.PI]] as const) {
const value = properties[field];
if (value !== undefined && !boundedNumber(value, minimum, maximum)) throw report("RENDER_PROPERTY_INVALID", `Light ${field} is outside the bounded range`);
}