@womp/spark-agent 17.7.2 → 17.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +41 -0
- package/dist/bench-camera.d.ts +36 -2
- package/dist/bench-camera.js +18 -3
- package/dist/camera-fit.d.ts +47 -0
- package/dist/camera-fit.js +70 -0
- package/dist/capabilities/scene.d.ts +99 -1
- package/dist/capabilities/scene.js +129 -19
- package/dist/capabilities.d.ts +2 -2
- package/dist/capabilities.js +1 -1
- package/dist/generated/scene-declarations.d.ts +1 -1
- package/dist/generated/scene-declarations.js +1 -1
- package/dist/kakapo-mux-cli.js +41 -0
- package/dist/kakapo-mux.d.ts +56 -0
- package/dist/kakapo-mux.js +264 -0
- package/dist/materials/inspection.d.ts +1 -1
- package/dist/materials/inspection.js +2 -2
- package/dist/public-capabilities.d.ts +1 -1
- package/dist/quality-bench-cli.d.ts +2 -0
- package/dist/quality-bench-cli.js +156 -0
- package/dist/quality-bench-sheet.d.ts +13 -0
- package/dist/quality-bench-sheet.js +120 -0
- package/dist/quality-bench.d.ts +293 -0
- package/dist/quality-bench.js +1120 -0
- package/dist/sdk-scene-screenshot.d.ts +5 -2
- package/dist/sdk-scene-screenshot.js +32 -10
- package/dist/server/sqlite-store.js +2 -1
- package/package.json +8 -4
- package/dist/simple-bench-cli.js +0 -64
- package/dist/simple-bench-prompts.d.ts +0 -5
- package/dist/simple-bench-prompts.js +0 -12
- package/dist/simple-bench.d.ts +0 -15
- package/dist/simple-bench.js +0 -163
- /package/dist/{simple-bench-cli.d.ts → kakapo-mux-cli.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,30 @@ Notable changes to `@womp/spark-agent`, newest first. Versions follow
|
|
|
4
4
|
[Semantic Versioning](https://semver.org/). Add an entry with each version bump; describe what
|
|
5
5
|
changed for hosts and users, and how to migrate across breaking changes.
|
|
6
6
|
|
|
7
|
+
## 17.8.0 — 2026-12-01
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- `womp.scene.screenshot({ fit })` frames objects (`ids`) or a world-space `box` from a `direction`, centred
|
|
12
|
+
and unclipped, using renderer bounds and the capture's real aspect ratio. Agents no longer hand-place
|
|
13
|
+
cameras for whole-object views.
|
|
14
|
+
- Hosts receive `SceneScreenshotOptions.fitted` beside the 16:9 camera. SDK-backed capture refits it to
|
|
15
|
+
the image aspect it learns; other hosts can call `fitSceneCamera(fitted, aspect)` or use `camera` as is.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- The scene-editing skill frames every view of objects with `fit`, including views that match a reference
|
|
20
|
+
image's angle and lens, and keeps `camera` for views whose position itself matters. It states that
|
|
21
|
+
`orthographicWidth` and the FOV span the frame's width.
|
|
22
|
+
|
|
23
|
+
## 17.7.3 — 2026-11-25
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- Fit shallow parts to their rounded footprints and use fitted profiles for rolled cuffs and hems.
|
|
28
|
+
- Repair loft banding by adjusting sample overlap or blend when density tuning leaves visible bands.
|
|
29
|
+
Recheck the affected surface and nearby clearances after each adjustment.
|
|
30
|
+
|
|
7
31
|
## 17.7.2 — 2026-11-24
|
|
8
32
|
|
|
9
33
|
### Changed
|
package/README.md
CHANGED
|
@@ -315,6 +315,47 @@ It prints each case's routes and pass rate and writes `report.json`, with every
|
|
|
315
315
|
calls, deciding call and reply, under `.spark/intent-bench/`. It exits 1 when any run took a route
|
|
316
316
|
the case does not expect. Model calls are paid; the full set costs about $0.10 on gpt-6-luna.
|
|
317
317
|
|
|
318
|
+
## Measure build quality
|
|
319
|
+
|
|
320
|
+
`yarn quality-bench` builds cases from `bench/quality/cases/` (split into `tune` and `holdout`),
|
|
321
|
+
renders standardized same-camera views (fixed 3/4, 4 sides, 5-view turntable, 2×2 grid, and case
|
|
322
|
+
close-ups), counts deterministic SDF structure (top-level Areas, same-material seams, Cubes, curves,
|
|
323
|
+
curve ribbing depth, floating clusters), and exports one full-resolution lossless PNG comparison
|
|
324
|
+
sheet per repeat (`sheet-run-<n>.png`) alongside `report.json`, `report.md`, and `results.csv`.
|
|
325
|
+
AI vision judges are opt-in via `--judge` (default `false`); blinded order-swapped pairwise
|
|
326
|
+
comparisons between two runs use `--ab`.
|
|
327
|
+
|
|
328
|
+
```sh
|
|
329
|
+
git lfs pull # case images are stored in git LFS
|
|
330
|
+
yarn quality-bench # every case, 2 repeats, 32 builds at once
|
|
331
|
+
yarn quality-bench --only kiko,retro-car --repeat 1 --output .spark/quality/my-run
|
|
332
|
+
yarn quality-bench --split tune --judge # run tune split with AI vision judges
|
|
333
|
+
yarn quality-bench --sheet .spark/quality/my-run # regenerate sheet-run-<n>.png without rebuilding
|
|
334
|
+
yarn quality-bench --ab .spark/quality/cand --baseline .spark/quality/base
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
Builds share one Kakapo through an in-process `kakapo-mux` (below). If Kakapo starts with an empty
|
|
338
|
+
scene, the bench seeds a minimal root scene automatically. Each build, with its `scene.json`,
|
|
339
|
+
renders, timings, and optional judge answers, is saved under
|
|
340
|
+
`.spark/quality/<timestamp>/<case>/run-<n>/`. With `--baseline <report.json>`, `report.md` adds
|
|
341
|
+
each metric's change and marks changes beyond two standard errors. `--score-only <run-dir>`
|
|
342
|
+
re-renders and scores saved `scene.json` files to recover after a Kakapo crash.
|
|
343
|
+
|
|
344
|
+
A case is a directory with `case.json` (`id`, `split`, `prompt`, `images`, `reference`, `parts`,
|
|
345
|
+
`checks`) and its images. Check views frame a band of the build's height (`band`) or the parts
|
|
346
|
+
whose names match a pattern (`match`, optionally one `half`), from the side the build faces turned
|
|
347
|
+
by `turn` degrees, with a `label` that tells the judge what it shows. See `src/quality-bench.ts`
|
|
348
|
+
for the fields.
|
|
349
|
+
|
|
350
|
+
### Share one Kakapo between benches
|
|
351
|
+
|
|
352
|
+
`yarn kakapo-mux --port 5600` serves many bench clients from one Kakapo. Connections to
|
|
353
|
+
`ws://127.0.0.1:5600/s/<name>` share a scene that outlives them; other connections each get their
|
|
354
|
+
own. Before a call that reads or changes a scene, the proxy loads that scene into the engine, so
|
|
355
|
+
clients never see each other's nodes, and a screenshot keeps the engine until its frame arrives.
|
|
356
|
+
New scenes start from the engine's scene when the proxy started. While it runs, do not use the
|
|
357
|
+
engine directly. It is bench tooling with no authentication; never expose it.
|
|
358
|
+
|
|
318
359
|
## Run cost estimates
|
|
319
360
|
|
|
320
361
|
The chat displays estimated API token cost in USD after every completed model step, from the
|
package/dist/bench-camera.d.ts
CHANGED
|
@@ -5,5 +5,39 @@ export type BenchBounds = {
|
|
|
5
5
|
};
|
|
6
6
|
/** Groups organize geometry; query their visible renderable children, not Group bounds. */
|
|
7
7
|
export declare function benchGeometryIds(api: Pick<KakapoAPI, "listNodes">, parentId?: number): number[];
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
export declare const BENCH_SHEET_CAMERAS: readonly [{
|
|
9
|
+
readonly file: "fixed-3q.jpg";
|
|
10
|
+
readonly offset: {
|
|
11
|
+
readonly x: 1;
|
|
12
|
+
readonly y: 0.65;
|
|
13
|
+
readonly z: 1;
|
|
14
|
+
};
|
|
15
|
+
}, {
|
|
16
|
+
readonly file: "fixed-front.jpg";
|
|
17
|
+
readonly offset: {
|
|
18
|
+
readonly x: 0;
|
|
19
|
+
readonly y: 0.12;
|
|
20
|
+
readonly z: 1;
|
|
21
|
+
};
|
|
22
|
+
}, {
|
|
23
|
+
readonly file: "fixed-back.jpg";
|
|
24
|
+
readonly offset: {
|
|
25
|
+
readonly x: 0;
|
|
26
|
+
readonly y: 0.12;
|
|
27
|
+
readonly z: -1;
|
|
28
|
+
};
|
|
29
|
+
}, {
|
|
30
|
+
readonly file: "fixed-top.jpg";
|
|
31
|
+
readonly offset: {
|
|
32
|
+
readonly x: 0.7;
|
|
33
|
+
readonly y: 1.4;
|
|
34
|
+
readonly z: 0.7;
|
|
35
|
+
};
|
|
36
|
+
}];
|
|
37
|
+
/** Fixed Spark-space view (default three-quarter), fitted against all eight native-world bounding-box corners. */
|
|
38
|
+
export declare function benchCamera(bounds: BenchBounds, aspect: number, sparkOffset?: Vec3): CameraConfiguration;
|
|
39
|
+
/**
|
|
40
|
+
* Orthographic camera that looks along -`back` (a direction from the build toward the camera, in engine space) and
|
|
41
|
+
* fits every corner of `boxes` in a frame of `aspect` (width / height), with `margin` around the tighter dimension.
|
|
42
|
+
*/
|
|
43
|
+
export declare function fitOrthographicCamera(boxes: BenchBounds[], back: Vec3, aspect?: number, margin?: number): CameraConfiguration;
|
package/dist/bench-camera.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { toEnginePosition } from "./coordinates.js";
|
|
2
|
+
import { fitCamera } from "./camera-fit.js";
|
|
2
3
|
/** Groups organize geometry; query their visible renderable children, not Group bounds. */
|
|
3
4
|
export function benchGeometryIds(api, parentId = 0) {
|
|
4
5
|
return api.listNodes({ parentId }).flatMap(node => {
|
|
@@ -7,13 +8,19 @@ export function benchGeometryIds(api, parentId = 0) {
|
|
|
7
8
|
return node.kind === "group" ? benchGeometryIds(api, node.id) : [node.id];
|
|
8
9
|
});
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
export const BENCH_SHEET_CAMERAS = [
|
|
12
|
+
{ file: "fixed-3q.jpg", offset: { x: 1, y: 0.65, z: 1 } },
|
|
13
|
+
{ file: "fixed-front.jpg", offset: { x: 0, y: 0.12, z: 1 } },
|
|
14
|
+
{ file: "fixed-back.jpg", offset: { x: 0, y: 0.12, z: -1 } },
|
|
15
|
+
{ file: "fixed-top.jpg", offset: { x: 0.7, y: 1.4, z: 0.7 } },
|
|
16
|
+
];
|
|
17
|
+
/** Fixed Spark-space view (default three-quarter), fitted against all eight native-world bounding-box corners. */
|
|
18
|
+
export function benchCamera(bounds, aspect, sparkOffset = { x: 1, y: 0.65, z: 1 }) {
|
|
12
19
|
const axes = ["x", "y", "z"];
|
|
13
20
|
if (!Number.isFinite(aspect) || aspect <= 0 || axes.some(a => !Number.isFinite(bounds.min[a]) || !Number.isFinite(bounds.max[a]) || bounds.min[a] > bounds.max[a]))
|
|
14
21
|
throw new Error("Benchmark framing requires finite ordered bounds and a positive aspect ratio.");
|
|
15
22
|
const target = { x: (bounds.min.x + bounds.max.x) / 2, y: (bounds.min.y + bounds.max.y) / 2, z: (bounds.min.z + bounds.max.z) / 2 };
|
|
16
|
-
const offset = toEnginePosition(
|
|
23
|
+
const offset = toEnginePosition(sparkOffset);
|
|
17
24
|
const length = Math.hypot(offset.x, offset.y, offset.z);
|
|
18
25
|
const back = { x: offset.x / length, y: offset.y / length, z: offset.z / length };
|
|
19
26
|
const horizontal = Math.hypot(back.x, back.z);
|
|
@@ -30,3 +37,11 @@ export function benchCamera(bounds, aspect) {
|
|
|
30
37
|
}
|
|
31
38
|
return { position: { x: target.x + back.x * distance, y: target.y + back.y * distance, z: target.z + back.z * distance }, target, projection: "perspective", horizontalFovDegrees: 60 };
|
|
32
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Orthographic camera that looks along -`back` (a direction from the build toward the camera, in engine space) and
|
|
42
|
+
* fits every corner of `boxes` in a frame of `aspect` (width / height), with `margin` around the tighter dimension.
|
|
43
|
+
*/
|
|
44
|
+
export function fitOrthographicCamera(boxes, back, aspect = 16 / 9, margin = 1.1) {
|
|
45
|
+
// The SDK accepts orthographic widths from about 0.24 world units (a 6 mm frame); 40 units keeps the camera clear of the build.
|
|
46
|
+
return fitCamera(boxes, { direction: back, projection: "orthographic", aspect, margin, minWidth: 0.25, standoff: 40 });
|
|
47
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** A Y-up axis-aligned box. The fit works in any Y-up frame and unit: Womp project space or Kakapo's engine space. */
|
|
2
|
+
export type FitBox = {
|
|
3
|
+
min: {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
z: number;
|
|
7
|
+
};
|
|
8
|
+
max: {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
z: number;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
type V = {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
z: number;
|
|
18
|
+
};
|
|
19
|
+
export type FitCameraOptions = {
|
|
20
|
+
/** From the boxes toward the camera; any length. It must not be vertical. */
|
|
21
|
+
direction: V;
|
|
22
|
+
projection?: "orthographic" | "perspective";
|
|
23
|
+
/** Frame width / height. */
|
|
24
|
+
aspect?: number;
|
|
25
|
+
/** Frame size over the boxes' projected size along the limiting dimension, 1 or more. */
|
|
26
|
+
margin?: number;
|
|
27
|
+
/** Perspective only. */
|
|
28
|
+
horizontalFovDegrees?: number;
|
|
29
|
+
/** Smallest orthographic width, in the boxes' units. */
|
|
30
|
+
minWidth?: number;
|
|
31
|
+
/** How far an orthographic camera sits in front of the nearest box corner, in the boxes' units. */
|
|
32
|
+
standoff?: number;
|
|
33
|
+
};
|
|
34
|
+
export type FittedCamera = {
|
|
35
|
+
position: V;
|
|
36
|
+
target: V;
|
|
37
|
+
projection: "orthographic" | "perspective";
|
|
38
|
+
orthographicWidth?: number;
|
|
39
|
+
horizontalFovDegrees?: number;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Camera looking along -`direction` whose frame holds every corner of `boxes`, centred, with `margin` around the
|
|
43
|
+
* limiting dimension. The corners are projected onto the tilted camera's own right and up axes, so elevated views fit
|
|
44
|
+
* too. `orthographicWidth` and `horizontalFovDegrees` are horizontal: the vertical span is the width / `aspect`.
|
|
45
|
+
*/
|
|
46
|
+
export declare function fitCamera(boxes: FitBox[], options: FitCameraOptions): FittedCamera;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const dot = (p, q) => p.x * q.x + p.y * q.y + p.z * q.z;
|
|
2
|
+
/**
|
|
3
|
+
* Camera looking along -`direction` whose frame holds every corner of `boxes`, centred, with `margin` around the
|
|
4
|
+
* limiting dimension. The corners are projected onto the tilted camera's own right and up axes, so elevated views fit
|
|
5
|
+
* too. `orthographicWidth` and `horizontalFovDegrees` are horizontal: the vertical span is the width / `aspect`.
|
|
6
|
+
*/
|
|
7
|
+
export function fitCamera(boxes, options) {
|
|
8
|
+
const { direction, projection = "orthographic", aspect = 16 / 9, margin = 1.1, horizontalFovDegrees = 60, minWidth = 0, standoff = 0 } = options;
|
|
9
|
+
const axes = ["x", "y", "z"];
|
|
10
|
+
if (!boxes.length || boxes.some(b => axes.some(a => !Number.isFinite(b.min[a]) || !Number.isFinite(b.max[a]) || b.min[a] > b.max[a])))
|
|
11
|
+
throw new Error("Camera fit needs at least one box with finite ordered bounds.");
|
|
12
|
+
if (!Number.isFinite(aspect) || aspect <= 0 || !Number.isFinite(margin) || margin < 1)
|
|
13
|
+
throw new Error("Camera fit needs a positive aspect ratio and a margin of at least 1.");
|
|
14
|
+
if (projection === "perspective" && !(horizontalFovDegrees > 0 && horizontalFovDegrees < 180))
|
|
15
|
+
throw new Error("Camera fit needs a horizontal field of view between 0 and 180 degrees.");
|
|
16
|
+
const length = Math.hypot(direction.x, direction.y, direction.z);
|
|
17
|
+
const back = { x: direction.x / length, y: direction.y / length, z: direction.z / length };
|
|
18
|
+
const horizontal = Math.hypot(back.x, back.z);
|
|
19
|
+
if (!(horizontal > 1e-3))
|
|
20
|
+
throw new Error("Camera fit needs a direction that is not vertical.");
|
|
21
|
+
const right = { x: back.z / horizontal, y: 0, z: -back.x / horizontal };
|
|
22
|
+
const up = { x: -back.x * back.y / horizontal, y: horizontal, z: -back.z * back.y / horizontal };
|
|
23
|
+
const corners = [];
|
|
24
|
+
for (const b of boxes)
|
|
25
|
+
for (const x of [b.min.x, b.max.x])
|
|
26
|
+
for (const y of [b.min.y, b.max.y])
|
|
27
|
+
for (const z of [b.min.z, b.max.z])
|
|
28
|
+
corners.push({ x, y, z });
|
|
29
|
+
const lo = [Infinity, Infinity, Infinity], hi = [-Infinity, -Infinity, -Infinity];
|
|
30
|
+
for (const p of corners)
|
|
31
|
+
[dot(p, right), dot(p, up), dot(p, back)].forEach((v, i) => { lo[i] = Math.min(lo[i], v); hi[i] = Math.max(hi[i], v); });
|
|
32
|
+
const [cu, cv, cw] = [0, 1, 2].map(i => (lo[i] + hi[i]) / 2);
|
|
33
|
+
const target = {
|
|
34
|
+
x: cu * right.x + cv * up.x + cw * back.x,
|
|
35
|
+
y: cu * right.y + cv * up.y + cw * back.y,
|
|
36
|
+
z: cu * right.z + cv * up.z + cw * back.z,
|
|
37
|
+
};
|
|
38
|
+
const at = (distance) => ({ x: target.x + back.x * distance, y: target.y + back.y * distance, z: target.z + back.z * distance });
|
|
39
|
+
if (projection === "orthographic") {
|
|
40
|
+
const width = Math.max(minWidth, Math.max(hi[0] - lo[0], (hi[1] - lo[1]) * aspect) * margin);
|
|
41
|
+
return { position: at((hi[2] - lo[2]) / 2 + standoff), target, projection, orthographicWidth: width };
|
|
42
|
+
}
|
|
43
|
+
// Perspective: the eye sits at (eu, ev, ew) on the camera's right/up/back axes. Corner (u, v, w) is inside the frame
|
|
44
|
+
// with the margin when |u - eu| <= kH (ew - w) and |v - ev| <= kV (ew - w). Per axis that needs
|
|
45
|
+
// ew >= (max(u + k w) - min(u - k w)) / 2k, so the nearest eye is exact; the sideways offset that centres the
|
|
46
|
+
// projected extent is the root of a decreasing function, found by bisection.
|
|
47
|
+
const kH = Math.tan(horizontalFovDegrees * Math.PI / 360) / margin, kV = kH / aspect;
|
|
48
|
+
const uvw = corners.map(p => [dot(p, right), dot(p, up), dot(p, back)]);
|
|
49
|
+
const nearest = (axis, k) => (Math.max(...uvw.map(c => c[axis] + k * c[2])) - Math.min(...uvw.map(c => c[axis] - k * c[2]))) / (2 * k);
|
|
50
|
+
const ew = Math.max(nearest(0, kH), nearest(1, kV), hi[2] + 1e-9 * Math.max(1, hi[2] - lo[2]));
|
|
51
|
+
const centre = (axis) => {
|
|
52
|
+
const offset = (e) => {
|
|
53
|
+
const r = uvw.map(c => (c[axis] - e) / (ew - c[2]));
|
|
54
|
+
return Math.max(...r) + Math.min(...r);
|
|
55
|
+
};
|
|
56
|
+
let [a, b] = [lo[axis], hi[axis]];
|
|
57
|
+
for (let i = 0; i < 100 && b - a > 1e-12 * Math.max(1, Math.abs(a)); i++) {
|
|
58
|
+
const m = (a + b) / 2;
|
|
59
|
+
if (offset(m) > 0)
|
|
60
|
+
a = m;
|
|
61
|
+
else
|
|
62
|
+
b = m;
|
|
63
|
+
}
|
|
64
|
+
return (a + b) / 2;
|
|
65
|
+
};
|
|
66
|
+
const [eu, ev] = [centre(0), centre(1)];
|
|
67
|
+
const eye = { x: eu * right.x + ev * up.x + ew * back.x, y: eu * right.y + ev * up.y + ew * back.y, z: eu * right.z + ev * up.z + ew * back.z };
|
|
68
|
+
const aim = { x: eye.x - back.x * (ew - cw), y: eye.y - back.y * (ew - cw), z: eye.z - back.z * (ew - cw) };
|
|
69
|
+
return { position: eye, target: aim, projection, horizontalFovDegrees };
|
|
70
|
+
}
|
|
@@ -13,14 +13,59 @@ export type SceneSnapshot = {
|
|
|
13
13
|
parentId: number;
|
|
14
14
|
}[];
|
|
15
15
|
};
|
|
16
|
+
type SceneVector = {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
z: number;
|
|
20
|
+
};
|
|
21
|
+
type SceneBox = {
|
|
22
|
+
min: SceneVector;
|
|
23
|
+
max: SceneVector;
|
|
24
|
+
};
|
|
25
|
+
/** A resolved fit, in Womp scene coordinates and project units. */
|
|
26
|
+
export type SceneScreenshotFitted = {
|
|
27
|
+
boxes: SceneBox[];
|
|
28
|
+
direction: SceneVector;
|
|
29
|
+
projection: "perspective" | "orthographic";
|
|
30
|
+
margin: number;
|
|
31
|
+
horizontalFovDegrees?: number;
|
|
32
|
+
unitMultiplier: number;
|
|
33
|
+
};
|
|
34
|
+
/** What a host captures. */
|
|
16
35
|
export type SceneScreenshotOptions = {
|
|
17
36
|
/** Position/target and orthographic width use Womp scene coordinates and current project units. */
|
|
18
37
|
camera?: CameraConfiguration;
|
|
38
|
+
/**
|
|
39
|
+
* Present when `camera` was fitted to these boxes for a 16:9 frame. A host that knows its capture aspect may refit
|
|
40
|
+
* the camera with `fitSceneCamera`; one that does not captures `camera` as given.
|
|
41
|
+
*/
|
|
42
|
+
fitted?: SceneScreenshotFitted;
|
|
43
|
+
};
|
|
44
|
+
/** Frame objects or a box instead of placing the camera by hand. */
|
|
45
|
+
export type SceneScreenshotFit = {
|
|
46
|
+
/** Objects to frame. A part frames its owning top-level Area and a Group its visible Areas. Omit ids and box to frame every visible object. */
|
|
47
|
+
ids?: number[];
|
|
48
|
+
/** A world-space box in project units, framed together with any ids. */
|
|
49
|
+
box?: SceneBox;
|
|
50
|
+
/** From the subject toward the camera; any length, not vertical. Defaults to a front three-quarter view, {x: 1, y: 0.65, z: 1}. */
|
|
51
|
+
direction?: SceneVector;
|
|
52
|
+
/** Defaults to orthographic. */
|
|
53
|
+
projection?: "perspective" | "orthographic";
|
|
54
|
+
/** Perspective only; defaults to 60. */
|
|
55
|
+
horizontalFovDegrees?: number;
|
|
56
|
+
/** Frame size over the subject's size along the limiting dimension, 1 to 4; defaults to 1.1. */
|
|
57
|
+
margin?: number;
|
|
58
|
+
};
|
|
59
|
+
export type SceneScreenshotRequest = {
|
|
60
|
+
/** Position/target and orthographic width use Womp scene coordinates and current project units. */
|
|
61
|
+
camera?: CameraConfiguration;
|
|
62
|
+
/** Fit the camera to objects or a box; use instead of camera. */
|
|
63
|
+
fit?: SceneScreenshotFit;
|
|
19
64
|
};
|
|
20
65
|
export type WompSceneApi = {
|
|
21
66
|
health(objectIds?: number[]): Promise<SceneHealth>;
|
|
22
67
|
access<T>(callback: (draft: WompSceneDraft) => T | Promise<T>): Promise<T>;
|
|
23
|
-
screenshot(options?:
|
|
68
|
+
screenshot(options?: SceneScreenshotRequest): Promise<ArtifactRef>;
|
|
24
69
|
};
|
|
25
70
|
export interface SceneHealthHost {
|
|
26
71
|
read(objectIds: number[], context: SparkInvocationContext): Promise<SceneHealth>;
|
|
@@ -30,6 +75,27 @@ export interface SceneHost {
|
|
|
30
75
|
access<T>(callback: (draft: WompSceneDraft) => T | Promise<T>, context: SparkInvocationContext): Promise<T>;
|
|
31
76
|
screenshot(options: SceneScreenshotOptions, context: SparkInvocationContext): Promise<ArtifactRef>;
|
|
32
77
|
}
|
|
78
|
+
/** A screenshot placed by an explicit camera only. */
|
|
79
|
+
export declare const cameraScreenshotOptions: z.ZodObject<{
|
|
80
|
+
camera: z.ZodOptional<z.ZodObject<{
|
|
81
|
+
position: z.ZodObject<{
|
|
82
|
+
x: z.ZodNumber;
|
|
83
|
+
y: z.ZodNumber;
|
|
84
|
+
z: z.ZodNumber;
|
|
85
|
+
}, z.core.$strict>;
|
|
86
|
+
target: z.ZodObject<{
|
|
87
|
+
x: z.ZodNumber;
|
|
88
|
+
y: z.ZodNumber;
|
|
89
|
+
z: z.ZodNumber;
|
|
90
|
+
}, z.core.$strict>;
|
|
91
|
+
projection: z.ZodOptional<z.ZodEnum<{
|
|
92
|
+
perspective: "perspective";
|
|
93
|
+
orthographic: "orthographic";
|
|
94
|
+
}>>;
|
|
95
|
+
horizontalFovDegrees: z.ZodOptional<z.ZodNumber>;
|
|
96
|
+
orthographicWidth: z.ZodOptional<z.ZodNumber>;
|
|
97
|
+
}, z.core.$strict>>;
|
|
98
|
+
}, z.core.$strict>;
|
|
33
99
|
export declare const screenshotOptions: z.ZodObject<{
|
|
34
100
|
camera: z.ZodOptional<z.ZodObject<{
|
|
35
101
|
position: z.ZodObject<{
|
|
@@ -49,5 +115,37 @@ export declare const screenshotOptions: z.ZodObject<{
|
|
|
49
115
|
horizontalFovDegrees: z.ZodOptional<z.ZodNumber>;
|
|
50
116
|
orthographicWidth: z.ZodOptional<z.ZodNumber>;
|
|
51
117
|
}, z.core.$strict>>;
|
|
118
|
+
fitted: z.ZodOptional<z.ZodObject<{
|
|
119
|
+
boxes: z.ZodArray<z.ZodObject<{
|
|
120
|
+
min: z.ZodObject<{
|
|
121
|
+
x: z.ZodNumber;
|
|
122
|
+
y: z.ZodNumber;
|
|
123
|
+
z: z.ZodNumber;
|
|
124
|
+
}, z.core.$strict>;
|
|
125
|
+
max: z.ZodObject<{
|
|
126
|
+
x: z.ZodNumber;
|
|
127
|
+
y: z.ZodNumber;
|
|
128
|
+
z: z.ZodNumber;
|
|
129
|
+
}, z.core.$strict>;
|
|
130
|
+
}, z.core.$strict>>;
|
|
131
|
+
direction: z.ZodObject<{
|
|
132
|
+
x: z.ZodNumber;
|
|
133
|
+
y: z.ZodNumber;
|
|
134
|
+
z: z.ZodNumber;
|
|
135
|
+
}, z.core.$strict>;
|
|
136
|
+
projection: z.ZodEnum<{
|
|
137
|
+
perspective: "perspective";
|
|
138
|
+
orthographic: "orthographic";
|
|
139
|
+
}>;
|
|
140
|
+
margin: z.ZodNumber;
|
|
141
|
+
horizontalFovDegrees: z.ZodOptional<z.ZodNumber>;
|
|
142
|
+
unitMultiplier: z.ZodNumber;
|
|
143
|
+
}, z.core.$strict>>;
|
|
52
144
|
}, z.core.$strict>;
|
|
145
|
+
/**
|
|
146
|
+
* Camera fitted to `fitted` for a frame of `aspect` (width / height), in Womp scene coordinates and project units.
|
|
147
|
+
* Hosts that know their capture aspect call this to refit a fitted screenshot.
|
|
148
|
+
*/
|
|
149
|
+
export declare function fitSceneCamera(fitted: SceneScreenshotFitted, aspect?: number): CameraConfiguration;
|
|
53
150
|
export declare function createSceneCapability(host: SceneHost): SparkCapability<WompSceneApi>;
|
|
151
|
+
export {};
|