Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Compact the scene_create schema for the light shapes fields (issue #612)

Nguyen Xuan An599e6b5d55cd
diff --git a/changes/612-lights.size.md b/changes/612-lights.size.md
index d4dd5a98..36f96aba 100644
--- a/changes/612-lights.size.md
+++ b/changes/612-lights.size.md
@@ -3,6 +3,8 @@
- entry:cascaded-shadows: the soft sun (blocker search plus a 16 tap filter) lives in the lazy cascade module and runs only when sunAngularRadius is set.
- scene:agent-scene: the recipe hook for sunAngularRadius, area castShadow and ies, three field names and a module marker (70 bytes gzip); the code is in the lazy light-shapes module.
- scene:agent-scene+lazy: the lazy light-shapes and light-profile modules, loaded only for a recipe that names the new fields.
+- tool:scene_create: three bare schema fields (sunAngularRadius, ies on spot and area lights, castShadow on area lights), 76 bytes; the rules and names are in the docs and the recipe errors.
+- tool-total: the same three fields.
- goal:lit-box: three one-line hooks in lighting, renderer and shaders (56 bytes gzip) that the lazy light-shapes module fills.
- goal:gltf-box: the same three hooks (46 bytes gzip).
- goal:agent-scene: the hooks plus the recipe fields (70 bytes gzip); everything else is lazy.
diff --git a/scripts/mcp-server.mjs b/scripts/mcp-server.mjs
index bf961c95..dded03a0 100644
--- a/scripts/mcp-server.mjs
+++ b/scripts/mcp-server.mjs
@@ -13,7 +13,6 @@ import { MATERIAL_PATTERN_TYPES, MATERIAL_MAPPINGS, LIGHTING_SETUP_NAMES, RENDER
import { MATERIAL_LAYER_SCALAR_RANGES, MATERIAL_LAYER_COLOR_RANGES } from '../src/material-layers.js';
import { SUBSURFACE_RANGES } from '../src/subsurface-limits.js';
import { MAX_POINT_LIGHTS, MAX_SPOT_LIGHTS, MAX_AREA_LIGHTS } from '../src/light-limits.js';
-import { IES_PROFILE_NAMES } from '../src/light-profile.js';
const finite = z.number().min(-3.4028234663852886e38).max(3.4028234663852886e38);
const positive = finite.positive();
@@ -195,10 +194,7 @@ const volumeFog = z.strictObject({
keyScattering: bounded(0, 10).optional(),
});
const affects = z.array(z.string()).optional();
-const iesProfile = z.union([
- z.enum(IES_PROFILE_NAMES),
- z.strictObject({ angles: z.array(z.number().min(0).max(180)).min(2).max(32), candela: z.array(z.number().min(0).max(1e7)).min(2).max(32) }),
-]).optional().describe('Intensity against the angle from the axis: a bundled name or { angles (degrees, rising), candela }; 1 on the axis, so intensity stays the head-on candela.');
+const iesProfile = z.any().optional();
const lines = z.record(z.string(), z.unknown()).describe('Outlines, toon light and polylines as plain JSON; fields and limits in scene_capabilities lineArt. null clears.');
const environment = z.strictObject({
world: z.boolean().optional().describe('Draw the sky and apply surface fog.'),
@@ -215,7 +211,7 @@ const environment = z.strictObject({
daylight: bounded(0, 100).optional(),
keyAffects: affects.describe('Node IDs lit; default all.'),
shadowCascades: z.number().int().min(0).max(4).optional().describe('Sun shadow slices; 0 one map.'),
- sunAngularRadius: bounded(0.0005, 0.2).optional().describe('Sun disk radius, radians; softens the sun shadow (0.0087 is half a degree, the path tracer default).'),
+ sunAngularRadius: z.number().optional(),
pointLights: z.array(z.strictObject({
position: boundedVector(-1e6, 1e6),
color: color.optional(),
@@ -246,7 +242,7 @@ const environment = z.strictObject({
height: bounded(0.001, 1e4),
color: color.optional(),
intensity: bounded(0, 1e5).optional().describe('Candela head on.'),
- castShadow: z.boolean().optional().describe('Casts a soft shadow, wider with the rectangle; 1 atlas tile.'),
+ castShadow: z.boolean().optional(),
ies: iesProfile,
affects,
})).max(MAX_AREA_LIGHTS).optional().describe('Replaces the list; [] clears.'),