feat(web): wire Blender camera panorama 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 22:00:19 +08:00
parent b7691f2fe3
commit ec65b51c5d
38 changed files with 1936 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

@@ -561,8 +561,10 @@ function assertFutureCapability(payload: Extract<WebEngineRequest["command"], {
case "setCameraProperties": {
const camera = currentSnapshot?.cameras.find((candidate) => candidate.id === payload.dataId);
const properties = payload.properties;
if (!camera || !validPropertyKeys(properties, ["projection", "lensMm", "sensorWidthMm", "sensorHeightMm", "sensorFit", "shift", "near", "far", "orthoScale", "depthOfField"])) throw report("RENDER_PROPERTY_INVALID", "Camera target or properties are invalid");
if (properties.projection !== undefined && !["PERSPECTIVE", "ORTHOGRAPHIC"].includes(properties.projection)) throw report("RENDER_PROPERTY_INVALID", "Camera projection is invalid");
if (!camera || !validPropertyKeys(properties, ["projection", "panoramaType", "fisheyeFov", "lensMm", "sensorWidthMm", "sensorHeightMm", "sensorFit", "shift", "near", "far", "orthoScale", "depthOfField"])) throw report("RENDER_PROPERTY_INVALID", "Camera target or properties are invalid");
if (properties.projection !== undefined && !["PERSPECTIVE", "ORTHOGRAPHIC", "PANORAMIC"].includes(properties.projection)) throw report("RENDER_PROPERTY_INVALID", "Camera projection is invalid");
if (properties.panoramaType !== undefined && (!Number.isSafeInteger(properties.panoramaType) || properties.panoramaType < 0 || properties.panoramaType > 6)) throw report("RENDER_PROPERTY_INVALID", "Camera panoramaType is invalid");
if (properties.fisheyeFov !== undefined && !boundedNumber(properties.fisheyeFov, 0.0001, Math.PI * 2)) throw report("RENDER_PROPERTY_INVALID", "Camera fisheyeFov is invalid");
for (const [field, minimum, maximum] of [["lensMm", 0.1, 10_000], ["sensorWidthMm", 0.1, 10_000], ["sensorHeightMm", 0.1, 10_000], ["near", 0.0001, 1e9], ["far", 0.0002, 1e12], ["orthoScale", 0.0001, 1e9]] as const) {
const value = properties[field];
if (value !== undefined && !boundedNumber(value, minimum, maximum)) throw report("RENDER_PROPERTY_INVALID", `Camera ${field} is outside the bounded range`);