@fleox/agent3d 0.3.1 → 0.5.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/README.md +16 -14
- package/changelog.json +25 -0
- package/dist/agent/agent3d.mjs +802 -90
- package/dist/agent/chunks/{assets-YBkgdfgy.mjs → assets-DdzHgVcn.mjs} +2 -2
- package/dist/agent/chunks/{browser-Dil7VM5m.mjs → browser-nFaRUETt.mjs} +1 -1
- package/dist/agent/chunks/{cdp-DLEis_Z3.mjs → cdp-6vF_gP-H.mjs} +1 -1
- package/dist/agent/chunks/{check-DP9fRYbK.mjs → check-E7GdPxTt.mjs} +14 -2
- package/dist/agent/chunks/{depth-CD_ql3QJ.mjs → depth-Bf7cHwod.mjs} +4 -4
- package/dist/agent/chunks/{depth-BZT4gseQ.mjs → depth-DEaogEAi.mjs} +4 -114
- package/dist/agent/chunks/{export-bJwh2SqG.mjs → export-BSOqVfPT.mjs} +87 -7
- package/dist/agent/chunks/{imageCodec-DeGfmBp3.mjs → imageCodec-DXxqkEQA.mjs} +53 -4
- package/dist/agent/chunks/{objects-DuytRxiC.mjs → objects-DvzrcVmK.mjs} +2 -2
- package/dist/agent/chunks/{optimizeSizing-B-BBiUkD.mjs → optimizeSizing-Dd8vaSnE.mjs} +24 -1
- package/dist/agent/chunks/{package-fMbw9UGh.mjs → package-DzXqX5Oe.mjs} +2 -2
- package/dist/agent/chunks/photoPlacement-D-k3mD0T.mjs +138 -0
- package/dist/agent/chunks/plate-Cwl35I2T.mjs +604 -0
- package/dist/agent/chunks/pngEncode-BMc3U9QC.mjs +119 -0
- package/dist/agent/chunks/{render-B05DU4Q5.mjs → render-CCKciCgu.mjs} +76 -11
- package/dist/agent/chunks/{scene-DWgXH6As.mjs → scene-DSjsun-3.mjs} +22 -5
- package/dist/agent/chunks/{server-Dt_YFvN7.mjs → server-CLvLORgA.mjs} +1 -1
- package/dist/agent/chunks/{tools-Cm4BqDkO.mjs → tools-Vs74Xopx.mjs} +153 -14
- package/dist/runtime/agent3d-photo.js +72 -0
- package/dist/runtime/agent3d-runtime.js +41 -41
- package/dist/runtime/agent3d-runtime.single.js +526 -250
- package/dist/runtime/chunks/assets-kC2Z1Xy_.js +1 -0
- package/dist/runtime/chunks/game-CbQaEB4q.js +20 -0
- package/dist/runtime/chunks/materials-jwhXlLYl.js +107 -0
- package/dist/runtime/chunks/model-CG5T_jcB.js +1 -0
- package/dist/runtime/chunks/num-CQNAlL82.js +1 -0
- package/dist/runtime/chunks/photo-Dq-AKlfw.js +526 -0
- package/dist/runtime/chunks/physicsHost-BU-2V-CZ.js +1 -0
- package/dist/runtime/chunks/{postfx-Cbf_vvOr.js → postfx-DnIeKXAh.js} +1 -1
- package/dist/runtime/chunks/postfx-ylpcQcVK.js +1 -0
- package/dist/runtime/chunks/svg-fYjsY-rV.js +1 -0
- package/dist/runtime/chunks/{text-rSo_2Luk.js → text-CySfj5sH.js} +1 -1
- package/dist/runtime/chunks/util-BEflQURG.js +1 -0
- package/dist/studio/assets/BufferGeometryUtils-BbzK4rCj.js +1 -0
- package/dist/studio/assets/{EXRLoader-BKkzlNd8.js → EXRLoader-CuDOo1xG.js} +1 -1
- package/dist/studio/assets/{FontLoader-Bzjx8mXt.js → FontLoader-DlBfss5q.js} +1 -1
- package/dist/studio/assets/{GLTFLoader-1Zd9N406.js → GLTFLoader-bl1eymL4.js} +1 -1
- package/dist/studio/assets/{GroundedSkybox-BEMqNCBD.js → GroundedSkybox-cLn9JVlt.js} +1 -1
- package/dist/studio/assets/{HDRLoader-DxB0kxPH.js → HDRLoader-8EiZoQQP.js} +1 -1
- package/dist/studio/assets/{OrbitControls-MlE9XiCg.js → OrbitControls-1xEm394I.js} +1 -1
- package/dist/studio/assets/{RectAreaLightUniformsLib-ClHrtYY6.js → RectAreaLightUniformsLib-S0AelTmO.js} +1 -1
- package/dist/studio/assets/{RoomEnvironment-MJ-jIEC8.js → RoomEnvironment-v4QurKxu.js} +1 -1
- package/dist/studio/assets/{SVGLoader-CIYl0nEy.js → SVGLoader-KDBVv02P.js} +1 -1
- package/dist/studio/assets/{Sky-DNMfpp92.js → Sky-D8Lp9Zh3.js} +1 -1
- package/dist/studio/assets/assets-DnOt59SU.js +2 -0
- package/dist/studio/assets/camera-DrubOxWu.js +2 -0
- package/dist/studio/assets/catalog-DDg904x2.js +1 -0
- package/dist/studio/assets/{editor-NkBUKsDB.js → editor-V--luWVq.js} +1 -1
- package/dist/studio/assets/{extrude-9bG8hr2C.js → extrude-BpJda0hq.js} +1 -1
- package/dist/studio/assets/game-43BhY_EE.js +19 -0
- package/dist/studio/assets/{generators-BjIs-kHx.js → generators-lG93qWTO.js} +5 -5
- package/dist/studio/assets/index-BPVRhKVV.js +479 -0
- package/dist/studio/assets/index-D-TPNQMQ.css +1 -0
- package/dist/studio/assets/model-D8-inS_D.js +2 -0
- package/dist/studio/assets/num-CQNAlL82.js +1 -0
- package/dist/studio/assets/params-BZqUA__U.js +1 -0
- package/dist/studio/assets/photo-BuVK-UvQ.js +526 -0
- package/dist/studio/assets/physicsHost-EkPuIy04.js +1 -0
- package/dist/studio/assets/{postfx-BGu30OJK.js → postfx-Bcnem9ci.js} +13 -13
- package/dist/studio/assets/rolldown-runtime-4tVxZq34.js +1 -0
- package/dist/studio/assets/runtime-5Ti8UJJR.js +572 -0
- package/dist/studio/assets/{shaders-Dt6FGXH_.js → shaders-WM5brr9C.js} +1 -1
- package/dist/studio/assets/svg-CJ_RtiER.js +2 -0
- package/dist/studio/assets/text-NO7lyCoH.js +3 -0
- package/dist/studio/assets/three.module-B9FlcKtd.js +4225 -0
- package/dist/studio/index.html +5 -3
- package/package.json +2 -2
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/skills/agent3d-assets/SKILL.md +42 -27
- package/plugin/skills/agent3d-create/SKILL.md +77 -29
- package/plugin/skills/agent3d-create/references/art-direction.md +3 -3
- package/plugin/skills/agent3d-create/references/recipes.md +6 -6
- package/plugin/skills/agent3d-edit/SKILL.md +22 -22
- package/plugin/skills/agent3d-edit/references/patch-ops.md +3 -3
- package/plugin/skills/agent3d-game/SKILL.md +7 -7
- package/plugin/skills/agent3d-publish/SKILL.md +32 -23
- package/plugin/skills/agent3d-publish/references/integrations.md +1 -1
- package/templates/hero-scroll-story/README.md +1 -1
- package/templates/photo-scroll-story/README.md +29 -0
- package/templates/photo-scroll-story/agent3d.json +8 -0
- package/templates/photo-scroll-story/assets/depth/lake-depth.png +0 -0
- package/templates/photo-scroll-story/assets/depth/street-depth.png +0 -0
- package/templates/photo-scroll-story/assets/manifest.json +46 -0
- package/templates/photo-scroll-story/assets/textures/lake.webp +0 -0
- package/templates/photo-scroll-story/assets/textures/street.webp +0 -0
- package/templates/photo-scroll-story/preview.png +0 -0
- package/templates/photo-scroll-story/scene.json +112 -0
- package/templates/photo-scroll-story/template.json +8 -0
- package/templates/photo-title-inside/README.md +31 -0
- package/templates/photo-title-inside/agent3d.json +8 -0
- package/templates/photo-title-inside/assets/depth/street-depth.png +0 -0
- package/templates/photo-title-inside/assets/manifest.json +25 -0
- package/templates/photo-title-inside/assets/textures/street.webp +0 -0
- package/templates/photo-title-inside/preview.png +0 -0
- package/templates/photo-title-inside/scene.json +80 -0
- package/templates/photo-title-inside/template.json +8 -0
- package/dist/runtime/chunks/assets-qnxDnVkj.js +0 -1
- package/dist/runtime/chunks/game-BoEiyZrL.js +0 -20
- package/dist/runtime/chunks/materials-dC4vDNHh.js +0 -107
- package/dist/runtime/chunks/model-BCAl_NRl.js +0 -1
- package/dist/runtime/chunks/photo-DNf14X7B.js +0 -250
- package/dist/runtime/chunks/physicsHost-ChPgysMQ.js +0 -1
- package/dist/runtime/chunks/postfx-CFucYRev.js +0 -1
- package/dist/runtime/chunks/svg-CLUxY6Zy.js +0 -1
- package/dist/runtime/chunks/util-CyaW1fcW.js +0 -1
- package/dist/studio/assets/BufferGeometryUtils-CAlXAboW.js +0 -1
- package/dist/studio/assets/assets-BW5lQkYR.js +0 -1
- package/dist/studio/assets/camera-BgzPVnn-.js +0 -2
- package/dist/studio/assets/game-DARpu0ah.js +0 -19
- package/dist/studio/assets/index-BQT0otii.css +0 -1
- package/dist/studio/assets/index-L-N-e2KM.js +0 -479
- package/dist/studio/assets/model-CqI8j03Z.js +0 -2
- package/dist/studio/assets/params-DhsDKSDs.js +0 -1
- package/dist/studio/assets/photo-DAHd1yNF.js +0 -250
- package/dist/studio/assets/physicsHost-tEUto2-_.js +0 -1
- package/dist/studio/assets/runtime-C_qkIpAK.js +0 -572
- package/dist/studio/assets/svg-ZZt5MdNf.js +0 -2
- package/dist/studio/assets/text-B-HM422i.js +0 -3
- package/dist/studio/assets/three.module-CnI50X0U.js +0 -4225
package/dist/agent/agent3d.mjs
CHANGED
|
@@ -6,7 +6,7 @@ __a3dRequire(import.meta.url);
|
|
|
6
6
|
const __filename = __a3dPath(import.meta.url);
|
|
7
7
|
__a3dDirname(__filename);
|
|
8
8
|
import { t as __exportAll } from "./chunks/rolldown-runtime-ebOQtxsr.mjs";
|
|
9
|
-
import { r as version, t as package_default } from "./chunks/package-
|
|
9
|
+
import { r as version, t as package_default } from "./chunks/package-DzXqX5Oe.mjs";
|
|
10
10
|
import { n as didYouMean, r as listOptions, t as closest } from "./chunks/suggest-Cpcgv1RP.mjs";
|
|
11
11
|
import { format, parseArgs } from "node:util";
|
|
12
12
|
import { createReadStream, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, watch, writeFileSync } from "node:fs";
|
|
@@ -255,7 +255,7 @@ function slugify(text, fallback = "item") {
|
|
|
255
255
|
}
|
|
256
256
|
// src/core/aspect.ts
|
|
257
257
|
var ASPECT_RE = /^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/;
|
|
258
|
-
function parseAspect(value) {
|
|
258
|
+
function parseAspect$1(value) {
|
|
259
259
|
if (typeof value !== "string") return null;
|
|
260
260
|
const m = ASPECT_RE.exec(value);
|
|
261
261
|
if (!m) return null;
|
|
@@ -269,7 +269,7 @@ function parseAspect(value) {
|
|
|
269
269
|
};
|
|
270
270
|
}
|
|
271
271
|
function isValidAspect(value) {
|
|
272
|
-
return parseAspect(value) !== null;
|
|
272
|
+
return parseAspect$1(value) !== null;
|
|
273
273
|
}
|
|
274
274
|
// src/core/catalog.ts
|
|
275
275
|
var n = (name, description, def, min, max) => ({
|
|
@@ -3409,7 +3409,7 @@ var CSS_COLOR_NAMES = {
|
|
|
3409
3409
|
yellow: "ffff00",
|
|
3410
3410
|
yellowgreen: "9acd32"
|
|
3411
3411
|
};
|
|
3412
|
-
var clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
|
|
3412
|
+
var clamp$1 = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
|
|
3413
3413
|
function parseHex(hex) {
|
|
3414
3414
|
if (!/^[0-9a-f]+$/i.test(hex)) return null;
|
|
3415
3415
|
if (hex.length === 3 || hex.length === 4) hex = [...hex].map((c) => c + c).join("");
|
|
@@ -3505,22 +3505,22 @@ function parseColor(value) {
|
|
|
3505
3505
|
const [r, g, b] = parts.slice(0, 3).map((p) => component(p, 255));
|
|
3506
3506
|
if (r === null || g === null || b === null) return null;
|
|
3507
3507
|
return {
|
|
3508
|
-
r: clamp(r, 0, 255),
|
|
3509
|
-
g: clamp(g, 0, 255),
|
|
3510
|
-
b: clamp(b, 0, 255),
|
|
3511
|
-
a: clamp(alpha, 0, 1)
|
|
3508
|
+
r: clamp$1(r, 0, 255),
|
|
3509
|
+
g: clamp$1(g, 0, 255),
|
|
3510
|
+
b: clamp$1(b, 0, 255),
|
|
3511
|
+
a: clamp$1(alpha, 0, 1)
|
|
3512
3512
|
};
|
|
3513
3513
|
}
|
|
3514
3514
|
const h = hue(parts[0]);
|
|
3515
3515
|
const sat = component(parts[1], 1);
|
|
3516
3516
|
const light = component(parts[2], 1);
|
|
3517
3517
|
if (h === null || sat === null || light === null || !parts[1].trim().endsWith("%") || !parts[2].trim().endsWith("%")) return null;
|
|
3518
|
-
const [r, g, b] = hslToRgb(h, clamp(sat, 0, 1), clamp(light, 0, 1));
|
|
3518
|
+
const [r, g, b] = hslToRgb(h, clamp$1(sat, 0, 1), clamp$1(light, 0, 1));
|
|
3519
3519
|
return {
|
|
3520
3520
|
r,
|
|
3521
3521
|
g,
|
|
3522
3522
|
b,
|
|
3523
|
-
a: clamp(alpha, 0, 1)
|
|
3523
|
+
a: clamp$1(alpha, 0, 1)
|
|
3524
3524
|
};
|
|
3525
3525
|
}
|
|
3526
3526
|
function isValidColor(value) {
|
|
@@ -3623,6 +3623,116 @@ function libraryId(ref) {
|
|
|
3623
3623
|
function findLibraryAsset(index, id) {
|
|
3624
3624
|
return index?.assets.find((a) => a.id === id);
|
|
3625
3625
|
}
|
|
3626
|
+
// src/core/photoEffects.ts
|
|
3627
|
+
var num$1 = (def, min, max) => ({
|
|
3628
|
+
type: "number",
|
|
3629
|
+
default: def,
|
|
3630
|
+
min,
|
|
3631
|
+
max
|
|
3632
|
+
});
|
|
3633
|
+
var PHOTO_EFFECTS = {
|
|
3634
|
+
fog: {
|
|
3635
|
+
needsDepth: true,
|
|
3636
|
+
params: {
|
|
3637
|
+
color: {
|
|
3638
|
+
type: "color",
|
|
3639
|
+
default: "#ffffff"
|
|
3640
|
+
},
|
|
3641
|
+
amount: num$1(.6, 0, 1),
|
|
3642
|
+
start: num$1(.7, 0, 1),
|
|
3643
|
+
end: num$1(0, 0, 1),
|
|
3644
|
+
drift: num$1(.3, 0)
|
|
3645
|
+
}
|
|
3646
|
+
},
|
|
3647
|
+
light: {
|
|
3648
|
+
needsDepth: false,
|
|
3649
|
+
params: {
|
|
3650
|
+
color: {
|
|
3651
|
+
type: "color",
|
|
3652
|
+
default: "#ffffff"
|
|
3653
|
+
},
|
|
3654
|
+
intensity: num$1(1, 0),
|
|
3655
|
+
ambient: num$1(.75, 0, 1),
|
|
3656
|
+
position: {
|
|
3657
|
+
type: "vec2",
|
|
3658
|
+
default: [.4, .4],
|
|
3659
|
+
min: -1,
|
|
3660
|
+
max: 1
|
|
3661
|
+
},
|
|
3662
|
+
height: num$1(.6, 0),
|
|
3663
|
+
radius: num$1(.8, 0),
|
|
3664
|
+
relief: num$1(1, 0),
|
|
3665
|
+
specular: num$1(.25, 0, 1),
|
|
3666
|
+
follow: {
|
|
3667
|
+
type: "enum",
|
|
3668
|
+
default: "pointer",
|
|
3669
|
+
options: [
|
|
3670
|
+
"pointer",
|
|
3671
|
+
"auto",
|
|
3672
|
+
"none"
|
|
3673
|
+
],
|
|
3674
|
+
animatable: false
|
|
3675
|
+
}
|
|
3676
|
+
}
|
|
3677
|
+
},
|
|
3678
|
+
reveal: {
|
|
3679
|
+
needsDepth: true,
|
|
3680
|
+
alpha: true,
|
|
3681
|
+
params: {
|
|
3682
|
+
progress: num$1(1, 0, 1),
|
|
3683
|
+
from: {
|
|
3684
|
+
type: "enum",
|
|
3685
|
+
default: "far",
|
|
3686
|
+
options: ["near", "far"],
|
|
3687
|
+
animatable: false
|
|
3688
|
+
},
|
|
3689
|
+
softness: num$1(.15, 0, 1),
|
|
3690
|
+
duration: num$1(void 0, 0),
|
|
3691
|
+
delay: num$1(0, 0)
|
|
3692
|
+
}
|
|
3693
|
+
},
|
|
3694
|
+
blur: {
|
|
3695
|
+
needsDepth: false,
|
|
3696
|
+
params: {
|
|
3697
|
+
focus: num$1(void 0, 0, 1),
|
|
3698
|
+
amount: num$1(.6, 0, 5),
|
|
3699
|
+
range: num$1(.1, 0, 1),
|
|
3700
|
+
to: num$1(void 0, 0, 1),
|
|
3701
|
+
duration: num$1(void 0, 0),
|
|
3702
|
+
delay: num$1(0, 0)
|
|
3703
|
+
}
|
|
3704
|
+
},
|
|
3705
|
+
frame: {
|
|
3706
|
+
needsDepth: false,
|
|
3707
|
+
alpha: true,
|
|
3708
|
+
params: {
|
|
3709
|
+
inset: {
|
|
3710
|
+
type: "vec2",
|
|
3711
|
+
default: [.12, .12],
|
|
3712
|
+
min: 0,
|
|
3713
|
+
max: .45,
|
|
3714
|
+
scalar: true
|
|
3715
|
+
},
|
|
3716
|
+
threshold: num$1(.6, 0, 1),
|
|
3717
|
+
softness: num$1(.04, 0, 1),
|
|
3718
|
+
border: num$1(.015, 0, .2),
|
|
3719
|
+
color: {
|
|
3720
|
+
type: "color",
|
|
3721
|
+
default: "#ffffff"
|
|
3722
|
+
},
|
|
3723
|
+
shadow: num$1(.35, 0, 1)
|
|
3724
|
+
}
|
|
3725
|
+
}
|
|
3726
|
+
};
|
|
3727
|
+
var PHOTO_EFFECT_IDS = Object.keys(PHOTO_EFFECTS);
|
|
3728
|
+
// src/core/qualityTier.ts
|
|
3729
|
+
/** Upper bound of the device pixel ratio per tier (combined with target.maxDpr). */
|
|
3730
|
+
var TIER_DPR_CAP = {
|
|
3731
|
+
low: 1,
|
|
3732
|
+
medium: 1.5,
|
|
3733
|
+
high: 2,
|
|
3734
|
+
ultra: 3
|
|
3735
|
+
};
|
|
3626
3736
|
// src/core/postfx.ts
|
|
3627
3737
|
var SCALED = /* @__PURE__ */ new Set([
|
|
3628
3738
|
"strength",
|
|
@@ -3692,7 +3802,7 @@ function qualitySettings(tier) {
|
|
|
3692
3802
|
switch (tier) {
|
|
3693
3803
|
case "low": return {
|
|
3694
3804
|
tier,
|
|
3695
|
-
dprCap:
|
|
3805
|
+
dprCap: TIER_DPR_CAP.low,
|
|
3696
3806
|
msaa: 0,
|
|
3697
3807
|
effectScale: .5,
|
|
3698
3808
|
maxCost: "medium",
|
|
@@ -3703,7 +3813,7 @@ function qualitySettings(tier) {
|
|
|
3703
3813
|
};
|
|
3704
3814
|
case "medium": return {
|
|
3705
3815
|
tier,
|
|
3706
|
-
dprCap:
|
|
3816
|
+
dprCap: TIER_DPR_CAP.medium,
|
|
3707
3817
|
msaa: 4,
|
|
3708
3818
|
effectScale: .5,
|
|
3709
3819
|
maxCost: "high",
|
|
@@ -3714,7 +3824,7 @@ function qualitySettings(tier) {
|
|
|
3714
3824
|
};
|
|
3715
3825
|
case "ultra": return {
|
|
3716
3826
|
tier,
|
|
3717
|
-
dprCap:
|
|
3827
|
+
dprCap: TIER_DPR_CAP.ultra,
|
|
3718
3828
|
msaa: 8,
|
|
3719
3829
|
effectScale: 1,
|
|
3720
3830
|
maxCost: "high",
|
|
@@ -3725,7 +3835,7 @@ function qualitySettings(tier) {
|
|
|
3725
3835
|
};
|
|
3726
3836
|
default: return {
|
|
3727
3837
|
tier: "high",
|
|
3728
|
-
dprCap:
|
|
3838
|
+
dprCap: TIER_DPR_CAP.high,
|
|
3729
3839
|
msaa: 4,
|
|
3730
3840
|
effectScale: .5,
|
|
3731
3841
|
maxCost: "high",
|
|
@@ -4108,8 +4218,52 @@ function singleKind(head, prop, ids, target) {
|
|
|
4108
4218
|
hint: "Use \"morph.<name>\" (0..1) or \"animation.<clip>.weight\" | \".speed\" | \".time\"."
|
|
4109
4219
|
} };
|
|
4110
4220
|
}
|
|
4221
|
+
if (parts[0] === "effects") return photoEffectKind(base, parts.slice(1), ids);
|
|
4222
|
+
if (parts[0] === "motion") {
|
|
4223
|
+
if (ids.photos && !ids.photos.has(base)) return { error: {
|
|
4224
|
+
message: `"${prop}" needs a photo object; "${base}" is not one.`,
|
|
4225
|
+
hint: "motion.progress (0..1) drives the auto move of a 3D photo (kind \"photo\")."
|
|
4226
|
+
} };
|
|
4227
|
+
if (prop === "motion.progress") return { kind: "number" };
|
|
4228
|
+
return { error: {
|
|
4229
|
+
message: `Photo motion property "${prop}" is not animatable.`,
|
|
4230
|
+
hint: `${didYouMean(prop, ["motion.progress"])}Use "motion.progress" (0..1 along the photo's motion.auto move).`
|
|
4231
|
+
} };
|
|
4232
|
+
}
|
|
4111
4233
|
return objectKind(prop, false);
|
|
4112
4234
|
}
|
|
4235
|
+
function photoEffectKind(id, parts, ids) {
|
|
4236
|
+
const declared = ids.photoEffects?.get(id);
|
|
4237
|
+
if (ids.photoEffects && !declared) return { error: {
|
|
4238
|
+
message: `"${id}" is not a 3D photo: effects.* tracks animate photo effects.`,
|
|
4239
|
+
hint: "Use \"<photoId>.effects.<effect>.<param>\" on a kind \"photo\" object."
|
|
4240
|
+
} };
|
|
4241
|
+
const [effect, param, axis, ...more] = parts;
|
|
4242
|
+
const spec = PHOTO_EFFECTS[effect];
|
|
4243
|
+
if (!spec) return { error: {
|
|
4244
|
+
message: `Unknown photo effect "${effect ?? ""}".`,
|
|
4245
|
+
hint: `${didYouMean(effect ?? "", PHOTO_EFFECT_IDS)}Effects: ${listOptions(PHOTO_EFFECT_IDS)}.`
|
|
4246
|
+
} };
|
|
4247
|
+
if (declared && !declared.has(effect)) return { error: {
|
|
4248
|
+
message: `"${id}" has no ${effect} effect, so this track animates nothing.`,
|
|
4249
|
+
hint: `Add "effects": { "${effect}": {} } to the photo "${id}" first.`
|
|
4250
|
+
} };
|
|
4251
|
+
const params = spec.params;
|
|
4252
|
+
const animatable = Object.keys(params).filter((k) => params[k].animatable !== false);
|
|
4253
|
+
const p = param ? params[param] : void 0;
|
|
4254
|
+
if (!p || p.animatable === false || more.length) return { error: {
|
|
4255
|
+
message: `Photo effect property "${effect}.${param ?? ""}" is not animatable.`,
|
|
4256
|
+
hint: `${didYouMean(param ?? "", animatable)}Animatable ${effect} params: ${listOptions(animatable)}.`
|
|
4257
|
+
} };
|
|
4258
|
+
if (axis !== void 0) {
|
|
4259
|
+
if (p.type === "vec2" && (axis === "x" || axis === "y")) return { kind: "number" };
|
|
4260
|
+
return { error: {
|
|
4261
|
+
message: `"${effect}.${param}.${axis}" is not animatable.`,
|
|
4262
|
+
hint: p.type === "vec2" ? "Use \".x\" or \".y\"." : `Animate "${effect}.${param}" itself.`
|
|
4263
|
+
} };
|
|
4264
|
+
}
|
|
4265
|
+
return { kind: p.type === "vec2" ? "vec2" : p.type === "color" ? "color" : "number" };
|
|
4266
|
+
}
|
|
4113
4267
|
function objectKind(prop, multi) {
|
|
4114
4268
|
const parts = prop.split(".");
|
|
4115
4269
|
if (VEC3_PROPS.includes(parts[0])) {
|
|
@@ -4121,7 +4275,7 @@ function objectKind(prop, multi) {
|
|
|
4121
4275
|
if (parts.length === 2 && MATERIAL_TRACK_PROPS[parts[1]]) return { kind: MATERIAL_TRACK_PROPS[parts[1]] };
|
|
4122
4276
|
if (parts.length === 3 && parts[1] === "uniforms") return { kind: "number" };
|
|
4123
4277
|
}
|
|
4124
|
-
if (multi && (parts[0] === "morph" || parts[0] === "animation")) return { kind: "number" };
|
|
4278
|
+
if (multi && (parts[0] === "morph" || parts[0] === "animation" || prop === "motion.progress")) return { kind: "number" };
|
|
4125
4279
|
const options = [
|
|
4126
4280
|
"position",
|
|
4127
4281
|
"position.x",
|
|
@@ -4132,7 +4286,8 @@ function objectKind(prop, multi) {
|
|
|
4132
4286
|
...Object.keys(MATERIAL_TRACK_PROPS).map((k) => `material.${k}`),
|
|
4133
4287
|
"material.uniforms.<name>",
|
|
4134
4288
|
"morph.<name>",
|
|
4135
|
-
"animation.<clip>.weight"
|
|
4289
|
+
"animation.<clip>.weight",
|
|
4290
|
+
"motion.progress"
|
|
4136
4291
|
];
|
|
4137
4292
|
return { error: {
|
|
4138
4293
|
message: `Property "${prop}" is not animatable.`,
|
|
@@ -4144,6 +4299,7 @@ function keyValueOk(kind, value) {
|
|
|
4144
4299
|
const vec = (x) => Array.isArray(x) && x.length === 3 && x.every(num);
|
|
4145
4300
|
switch (kind) {
|
|
4146
4301
|
case "vec3": return vec(value) || isRel(value);
|
|
4302
|
+
case "vec2": return Array.isArray(value) && value.length === 2 && value.every(num);
|
|
4147
4303
|
case "number": return num(value);
|
|
4148
4304
|
case "color": return isValidColor(value);
|
|
4149
4305
|
case "boolean": return typeof value === "boolean";
|
|
@@ -4152,6 +4308,7 @@ function keyValueOk(kind, value) {
|
|
|
4152
4308
|
}
|
|
4153
4309
|
var KIND_EXAMPLE = {
|
|
4154
4310
|
vec3: "[0, 1, 0] or [\"+=0\", \"+=1\", \"+=0\"]",
|
|
4311
|
+
vec2: "[0.4, -0.2]",
|
|
4155
4312
|
number: "1.5 or \"+=1\"",
|
|
4156
4313
|
color: "\"#ff8800\"",
|
|
4157
4314
|
boolean: "true",
|
|
@@ -4210,7 +4367,8 @@ var C = class {
|
|
|
4210
4367
|
}
|
|
4211
4368
|
};
|
|
4212
4369
|
function collect(scene, ids) {
|
|
4213
|
-
const tags = /* @__PURE__ */ new Set(), models = /* @__PURE__ */ new Set(), parents = /* @__PURE__ */ new Set();
|
|
4370
|
+
const tags = /* @__PURE__ */ new Set(), models = /* @__PURE__ */ new Set(), parents = /* @__PURE__ */ new Set(), photos = /* @__PURE__ */ new Set();
|
|
4371
|
+
const photoEffects = /* @__PURE__ */ new Map();
|
|
4214
4372
|
const walk = (list) => {
|
|
4215
4373
|
if (!Array.isArray(list)) return;
|
|
4216
4374
|
for (const o of list) {
|
|
@@ -4219,6 +4377,8 @@ function collect(scene, ids) {
|
|
|
4219
4377
|
for (const t of o.tags) if (typeof t === "string") tags.add(t);
|
|
4220
4378
|
}
|
|
4221
4379
|
if (o.kind === "model") models.add(o.id);
|
|
4380
|
+
if (o.kind === "photo") photoEffects.set(o.id, new Set(isObj$1(o.effects) ? Object.keys(o.effects) : []));
|
|
4381
|
+
if (o.kind === "photo") photos.add(o.id);
|
|
4222
4382
|
if (Array.isArray(o.children) && o.children.length || o.kind === "text" && (o.splitLetters === true || isObj$1(o.reveal))) parents.add(o.id);
|
|
4223
4383
|
walk(o.children);
|
|
4224
4384
|
}
|
|
@@ -4230,8 +4390,10 @@ function collect(scene, ids) {
|
|
|
4230
4390
|
...ids,
|
|
4231
4391
|
tags,
|
|
4232
4392
|
models,
|
|
4393
|
+
photos,
|
|
4233
4394
|
parents,
|
|
4234
|
-
postfx
|
|
4395
|
+
postfx,
|
|
4396
|
+
photoEffects
|
|
4235
4397
|
};
|
|
4236
4398
|
}
|
|
4237
4399
|
var TIMELINE_TRIGGERS_ALL = [
|
|
@@ -4734,7 +4896,11 @@ var PHOTO_AUTO_MOTIONS = [
|
|
|
4734
4896
|
"none",
|
|
4735
4897
|
"sway",
|
|
4736
4898
|
"orbit",
|
|
4737
|
-
"zoom"
|
|
4899
|
+
"zoom",
|
|
4900
|
+
"dolly",
|
|
4901
|
+
"pan",
|
|
4902
|
+
"rise",
|
|
4903
|
+
"vertigo"
|
|
4738
4904
|
];
|
|
4739
4905
|
var PHOTO_MOTION_KEYS = [
|
|
4740
4906
|
"pointer",
|
|
@@ -4742,7 +4908,10 @@ var PHOTO_MOTION_KEYS = [
|
|
|
4742
4908
|
"gyro",
|
|
4743
4909
|
"auto",
|
|
4744
4910
|
"speed",
|
|
4745
|
-
"smoothing"
|
|
4911
|
+
"smoothing",
|
|
4912
|
+
"loop",
|
|
4913
|
+
"duration",
|
|
4914
|
+
"progress"
|
|
4746
4915
|
];
|
|
4747
4916
|
var PHOTO_MATERIAL_KEYS = [
|
|
4748
4917
|
"opacity",
|
|
@@ -4823,6 +4992,8 @@ var OBJECT_KEYS = {
|
|
|
4823
4992
|
photo: [
|
|
4824
4993
|
"src",
|
|
4825
4994
|
"depth",
|
|
4995
|
+
"plate",
|
|
4996
|
+
"plateDepth",
|
|
4826
4997
|
"mode",
|
|
4827
4998
|
"width",
|
|
4828
4999
|
"height",
|
|
@@ -4831,8 +5002,10 @@ var OBJECT_KEYS = {
|
|
|
4831
5002
|
"segments",
|
|
4832
5003
|
"layers",
|
|
4833
5004
|
"edgeCut",
|
|
5005
|
+
"occlude",
|
|
4834
5006
|
"motion",
|
|
4835
|
-
"material"
|
|
5007
|
+
"material",
|
|
5008
|
+
"effects"
|
|
4836
5009
|
]
|
|
4837
5010
|
};
|
|
4838
5011
|
var SCENE_KEYS = [
|
|
@@ -6210,6 +6383,13 @@ function object(v, o, fallback) {
|
|
|
6210
6383
|
function photo(v, o, p) {
|
|
6211
6384
|
if (v.required(o, "src", p, "an image path (\"assets/textures/photo.jpg\") or \"library:<id>\" (.jpg / .png / .webp)")) v.assetPath(o.src, `${p}.src`, PHOTO_EXT, "an image (.jpg / .png / .webp)");
|
|
6212
6385
|
v.assetPath(o.depth, `${p}.depth`, PHOTO_EXT, "a depth map image (grayscale PNG, white = near)");
|
|
6386
|
+
v.assetPath(o.plate, `${p}.plate`, PHOTO_EXT, "a background plate image (.webp / .png / .jpg)");
|
|
6387
|
+
v.assetPath(o.plateDepth, `${p}.plateDepth`, PHOTO_EXT, "the plate depth map (grayscale PNG, white = near)");
|
|
6388
|
+
if (o.plate === void 0 !== (o.plateDepth === void 0)) {
|
|
6389
|
+
const has = o.plate !== void 0 ? "plate" : "plateDepth";
|
|
6390
|
+
const miss = has === "plate" ? "plateDepth" : "plate";
|
|
6391
|
+
v.warn("photo-plate", `${p}.${miss}`, `Photo "${String(o.id)}" has ${has} but no ${miss}: the plate is ignored (it needs both).`, `Set both from \`agent3d assets plate ${typeof o.src === "string" ? o.src : "<image>"}\` (it returns { plate, plateDepth }).`);
|
|
6392
|
+
} else if (o.plate !== void 0 && o.depth === void 0) v.info("ignored", `${p}.plate`, `plate only applies to a photo with a depth map (this one is flat).`, "Set depth too, or remove plate / plateDepth.");
|
|
6213
6393
|
v.enumOf(o.mode, PHOTO_MODES, `${p}.mode`);
|
|
6214
6394
|
v.number(o.width, `${p}.width`, {
|
|
6215
6395
|
min: 0,
|
|
@@ -6238,6 +6418,8 @@ function photo(v, o, p) {
|
|
|
6238
6418
|
max: 16
|
|
6239
6419
|
});
|
|
6240
6420
|
const mode = typeof o.mode === "string" ? o.mode : "parallax";
|
|
6421
|
+
v.boolean(o.occlude, `${p}.occlude`);
|
|
6422
|
+
if (o.occlude === true && o.depth === void 0) v.info("ignored", `${p}.occlude`, `occlude needs a depth map: photo "${String(o.id)}" is flat (it already hides what is behind its plane).`, `Set ${p}.depth (\`agent3d assets depth ${String(o.src ?? "<image>")}\`), or remove occlude.`);
|
|
6241
6423
|
if (o.segments !== void 0 && mode !== "mesh") v.info("ignored", `${p}.segments`, `segments only applies to mode "mesh" (this photo is "${mode}").`, "Set mode: \"mesh\", or remove segments.");
|
|
6242
6424
|
if (o.layers !== void 0 && mode !== "layers") v.info("ignored", `${p}.layers`, `layers only applies to mode "layers" (this photo is "${mode}").`, "Set mode: \"layers\", or remove layers.");
|
|
6243
6425
|
if (o.depth === void 0 && typeof o.src === "string" && PHOTO_MODES.includes(mode)) v.warn("photo-flat", p, `Photo "${String(o.id)}" has no depth map: it renders flat (mode "${mode}" needs one).`, `Run \`agent3d assets depth ${o.src}\` (writes a depth PNG next to it), then set ${p}.depth to its path.`);
|
|
@@ -6261,8 +6443,20 @@ function photo(v, o, p) {
|
|
|
6261
6443
|
min: 0,
|
|
6262
6444
|
max: 1
|
|
6263
6445
|
});
|
|
6446
|
+
v.boolean(m.loop, `${p}.motion.loop`);
|
|
6447
|
+
v.number(m.duration, `${p}.motion.duration`, {
|
|
6448
|
+
min: .1,
|
|
6449
|
+
max: 600
|
|
6450
|
+
});
|
|
6451
|
+
v.number(m.progress, `${p}.motion.progress`, {
|
|
6452
|
+
min: 0,
|
|
6453
|
+
max: 1
|
|
6454
|
+
});
|
|
6455
|
+
if (m.duration !== void 0 && m.loop !== false) v.info("ignored", `${p}.motion.duration`, "motion.duration only applies to one-way moves (loop: false); a loop lasts 10 / speed seconds.", "Set \"loop\": false for a one-way move, or change speed (cycles per 10 s).");
|
|
6456
|
+
if (m.auto === "none" && (m.loop !== void 0 || m.duration !== void 0 || m.progress !== void 0)) v.info("ignored", `${p}.motion`, "loop / duration / progress shape the auto move, but this photo has auto \"none\".", "Set \"auto\" to a move: \"dolly\", \"pan\", \"rise\", \"vertigo\", \"zoom\", \"sway\" or \"orbit\".");
|
|
6264
6457
|
}
|
|
6265
6458
|
}
|
|
6459
|
+
if (o.effects !== void 0) photoEffects(v, o.effects, `${p}.effects`, o.depth !== void 0);
|
|
6266
6460
|
if (o.material !== void 0) {
|
|
6267
6461
|
const m = o.material;
|
|
6268
6462
|
if (!isObj(m)) v.error("type", `${p}.material`, "material must be an object.", "A photo material only takes { \"opacity\", \"color\", \"emissiveIntensity\" }, e.g. { \"opacity\": 0.9 }.");
|
|
@@ -6281,6 +6475,50 @@ function photo(v, o, p) {
|
|
|
6281
6475
|
}
|
|
6282
6476
|
}
|
|
6283
6477
|
}
|
|
6478
|
+
var EFFECT_EXAMPLE = "{ \"fog\": { \"color\": \"#dfe8f2\", \"amount\": 0.6 }, \"light\": { \"follow\": \"pointer\" }, \"reveal\": { \"duration\": 2 } }";
|
|
6479
|
+
function photoEffects(v, fx, p, hasDepth) {
|
|
6480
|
+
if (!isObj(fx)) return v.error("type", p, "effects must be an object.", `Example: ${EFFECT_EXAMPLE}.`);
|
|
6481
|
+
v.unknownKeys(fx, PHOTO_EFFECT_IDS, p, "photo effects");
|
|
6482
|
+
for (const id of PHOTO_EFFECT_IDS) {
|
|
6483
|
+
const e = fx[id];
|
|
6484
|
+
if (e === void 0) continue;
|
|
6485
|
+
const ep = `${p}.${id}`;
|
|
6486
|
+
if (!isObj(e)) {
|
|
6487
|
+
v.error("type", ep, `effects.${id} must be an object (use {} for the defaults).`, `Example: ${EFFECT_EXAMPLE}.`);
|
|
6488
|
+
continue;
|
|
6489
|
+
}
|
|
6490
|
+
const spec = PHOTO_EFFECTS[id];
|
|
6491
|
+
const params = spec.params;
|
|
6492
|
+
v.unknownKeys(e, Object.keys(params), ep, `the ${id} effect`);
|
|
6493
|
+
for (const [k, ps] of Object.entries(params)) {
|
|
6494
|
+
const val = e[k];
|
|
6495
|
+
if (val === void 0) continue;
|
|
6496
|
+
const at = `${ep}.${k}`;
|
|
6497
|
+
const sp = ps;
|
|
6498
|
+
if (sp.type === "number") v.number(val, at, {
|
|
6499
|
+
min: sp.min,
|
|
6500
|
+
max: sp.max
|
|
6501
|
+
});
|
|
6502
|
+
else if (sp.type === "color") v.color(val, at);
|
|
6503
|
+
else if (sp.type === "enum") v.enumOf(val, sp.options ?? [], at);
|
|
6504
|
+
else if (sp.type === "vec2" && sp.scalar && typeof val === "number") v.number(val, at, {
|
|
6505
|
+
min: sp.min,
|
|
6506
|
+
max: sp.max
|
|
6507
|
+
});
|
|
6508
|
+
else if (sp.type === "vec2" && v.vec(val, 2, at)) {
|
|
6509
|
+
if (val.some((x) => x < (sp.min ?? -Infinity) || x > (sp.max ?? Infinity))) v.error("range", at, `${JSON.stringify(val)} is out of range (each coordinate in ${sp.min}..${sp.max}${sp.min === -1 ? ", photo space: -1 left / bottom, 1 right / top" : ""}).`);
|
|
6510
|
+
}
|
|
6511
|
+
}
|
|
6512
|
+
if (spec.needsDepth && !hasDepth) v.info("ignored", ep, `The ${id} effect needs a depth map: this photo has none, so it is ignored.`, `Set the photo's depth (agent3d assets depth <image>), or remove effects.${id}.`);
|
|
6513
|
+
}
|
|
6514
|
+
const r = fx.reveal;
|
|
6515
|
+
if (isObj(r) && r.duration !== void 0 && r.progress !== void 0) v.info("ignored", `${p}.reveal.progress`, "reveal.progress is ignored when reveal.duration is set (progress animates 0 → 1 from delay).", "Remove duration to drive progress yourself (e.g. a timeline track on effects.reveal.progress).");
|
|
6516
|
+
const b = fx.blur;
|
|
6517
|
+
if (isObj(b) && b.to === void 0 !== (b.duration === void 0)) v.info("ignored", `${p}.blur.${b.to === void 0 ? "duration" : "to"}`, "The blur racks focus only with both `to` and `duration`: this one is ignored.", "Set both (e.g. { \"focus\": 0.9, \"to\": 0.1, \"duration\": 3 }) or drive effects.blur.focus from a timeline track.");
|
|
6518
|
+
if (isObj(b) && !hasDepth) v.info("flat", `${p}.blur`, "On a photo without a depth map the blur is even over the whole image (its depth is 0.5).", "Set the photo's depth (agent3d assets depth <image>) for a depth-of-field blur.");
|
|
6519
|
+
const f = fx.frame;
|
|
6520
|
+
if (isObj(f) && !hasDepth) v.info("flat", `${p}.frame`, "On a photo without a depth map nothing pops out of the frame (its depth is 0.5): the photo is just framed.", "Set the photo's depth (agent3d assets depth <image>) for the out-of-frame pop-out.");
|
|
6521
|
+
}
|
|
6284
6522
|
function catalogRef(v, section, id, path) {
|
|
6285
6523
|
const ids = CATALOG[section].map((x) => x.id);
|
|
6286
6524
|
if (typeof id !== "string") {
|
|
@@ -7905,7 +8143,7 @@ function readRuntimeFiles(format = "embed") {
|
|
|
7905
8143
|
const files = {};
|
|
7906
8144
|
for (const f of walkFiles(root)) {
|
|
7907
8145
|
if (f.endsWith(".map")) continue;
|
|
7908
|
-
if (format === "single-html" ? f === "agent3d-runtime.single.js" : f !== "agent3d-runtime.single.js" && f !== "version.json") files[f] = new Uint8Array(readFileSync(join(root, f)));
|
|
8146
|
+
if (format === "single-html" ? f === "agent3d-runtime.single.js" || f === "agent3d-photo.js" : f !== "agent3d-runtime.single.js" && f !== "version.json") files[f] = new Uint8Array(readFileSync(join(root, f)));
|
|
7909
8147
|
}
|
|
7910
8148
|
if (format === "single-html" && !files["agent3d-runtime.single.js"]) throw new CliError("runtime-missing", `The single-file runtime is missing (${join(root, RUNTIME_SINGLE)}).`, "Run `npm run build:runtime` (it builds both runtimes), or export --format embed.");
|
|
7911
8149
|
return files;
|
|
@@ -8267,8 +8505,8 @@ var DIR_BY_KIND = {
|
|
|
8267
8505
|
};
|
|
8268
8506
|
var assetsCommand = {
|
|
8269
8507
|
name: "assets",
|
|
8270
|
-
usage: "assets <list|search|add|optimize|depth|remove|library> [--project <dir>]",
|
|
8271
|
-
summary: "Project assets (assets/ + manifest with licences): list, search free CC0 sources (Poly Haven, ambientCG, Kenney, Quaternius, Khronos), add (local file or a search hit — downloaded once into the project), optimize (smart-size + WebP textures, meshopt .glb geometry), depth (estimate a depth map for a 3D photo), remove, and browse the built-in library.",
|
|
8508
|
+
usage: "assets <list|search|add|optimize|depth|plate|remove|library> [--project <dir>]",
|
|
8509
|
+
summary: "Project assets (assets/ + manifest with licences): list, search free CC0 sources (Poly Haven, ambientCG, Kenney, Quaternius, Khronos), add (local file or a search hit — downloaded once into the project), optimize (smart-size + WebP textures, meshopt .glb geometry), depth (estimate a depth map for a 3D photo), plate (its background plate, for bigger moves), remove, and browse the built-in library.",
|
|
8272
8510
|
subcommands: [
|
|
8273
8511
|
{
|
|
8274
8512
|
name: "list",
|
|
@@ -8295,8 +8533,14 @@ var assetsCommand = {
|
|
|
8295
8533
|
},
|
|
8296
8534
|
{
|
|
8297
8535
|
name: "depth",
|
|
8298
|
-
usage: "assets depth <image> [--out assets/depth/<name>-depth.png] [--size 518] [--max-size 1024]",
|
|
8299
|
-
summary: "Estimate a depth map for a photo of the project (or \"library:<id>\") with Depth Anything V2 Small, run locally in headless Chrome (onnxruntime-web, WASM). Writes a grey PNG (white = near, transparent on depth jumps) at the photo size (capped by --max-size, default 1024) to use as a photo object's `depth`, registered in assets/manifest.json with the photo's licence. The model (27 MB, Apache-2.0) is downloaded once into ~/.agent3d/models (AGENT3D_MODELS overrides); later runs work offline. --size is the model input long side (default 518, up to 1036 for finer edges, slower).",
|
|
8536
|
+
usage: "assets depth <image> [--out assets/depth/<name>-depth.png] [--size 518] [--max-size 1024] [--plate]",
|
|
8537
|
+
summary: "Estimate a depth map for a photo of the project (or \"library:<id>\") with Depth Anything V2 Small, run locally in headless Chrome (onnxruntime-web, WASM). Writes a grey PNG (white = near, transparent on depth jumps) at the photo size (capped by --max-size, default 1024) to use as a photo object's `depth`, registered in assets/manifest.json with the photo's licence. The model (27 MB, Apache-2.0) is downloaded once into ~/.agent3d/models (AGENT3D_MODELS overrides); later runs work offline. --size is the model input long side (default 518, up to 1036 for finer edges, slower). --plate also builds the background plate (see `assets plate`).",
|
|
8538
|
+
writes: true
|
|
8539
|
+
},
|
|
8540
|
+
{
|
|
8541
|
+
name: "plate",
|
|
8542
|
+
usage: "assets plate <image> [--depth <png>] [--strength 1] [--width <px>] [--max-size 1024] [--format webp|png] [--out <path>] [--out-depth <path>]",
|
|
8543
|
+
summary: "Build the background plate of a 3D photo: the photo with the foreground removed next to its depth edges, filled with the background from the far side only, + the plate depth (the background depth continued). Set them on the photo object as `plate` and `plateDepth`: the runtime shows the plate where moving foreground uncovers the background (parallax, mesh backing, layers) instead of smears and stretched edges. Needs the depth map (--depth, else the photo object's depth, else assets/depth/<name>-depth.png). Writes assets/depth/<name>-plate.webp + <name>-plate-depth.png (photo's licence). --strength (default 1) or --width (removed band in px for a full depth jump) size the hole. Headless Chrome decodes the photo; the fill itself is pure TS (about 0.5 s).",
|
|
8300
8544
|
writes: true
|
|
8301
8545
|
},
|
|
8302
8546
|
{
|
|
@@ -8368,7 +8612,7 @@ var assetsCommand = {
|
|
|
8368
8612
|
{
|
|
8369
8613
|
name: "max-size",
|
|
8370
8614
|
type: "string",
|
|
8371
|
-
description: "optimize / add --hit: longest texture side in pixels, for every texture (optimize default: a smart size per texture from the scene; never upscales). depth: longest side of the depth map (default 1024)."
|
|
8615
|
+
description: "optimize / add --hit: longest texture side in pixels, for every texture (optimize default: a smart size per texture from the scene; never upscales). depth: longest side of the depth map (default 1024). plate: longest side of the plate (default 1024)."
|
|
8372
8616
|
},
|
|
8373
8617
|
{
|
|
8374
8618
|
name: "quality",
|
|
@@ -8378,7 +8622,7 @@ var assetsCommand = {
|
|
|
8378
8622
|
{
|
|
8379
8623
|
name: "format",
|
|
8380
8624
|
type: "string",
|
|
8381
|
-
description: "optimize: texture output format — auto (default, WebP), webp, jpeg (images with alpha keep their format), png or keep."
|
|
8625
|
+
description: "optimize: texture output format — auto (default, WebP), webp, jpeg (images with alpha keep their format), png or keep. plate: webp (default) or png."
|
|
8382
8626
|
},
|
|
8383
8627
|
{
|
|
8384
8628
|
name: "compress",
|
|
@@ -8403,7 +8647,32 @@ var assetsCommand = {
|
|
|
8403
8647
|
{
|
|
8404
8648
|
name: "out",
|
|
8405
8649
|
type: "string",
|
|
8406
|
-
description: "depth: project path of the depth PNG (default assets/depth/<image name>-depth.png)."
|
|
8650
|
+
description: "depth: project path of the depth PNG (default assets/depth/<image name>-depth.png). plate: project path of the plate (default assets/depth/<image name>-plate.webp)."
|
|
8651
|
+
},
|
|
8652
|
+
{
|
|
8653
|
+
name: "out-depth",
|
|
8654
|
+
type: "string",
|
|
8655
|
+
description: "plate: project path of the plate depth PNG (default assets/depth/<image name>-plate-depth.png)."
|
|
8656
|
+
},
|
|
8657
|
+
{
|
|
8658
|
+
name: "plate",
|
|
8659
|
+
type: "boolean",
|
|
8660
|
+
description: "depth: also build the background plate (assets plate) from the new depth map."
|
|
8661
|
+
},
|
|
8662
|
+
{
|
|
8663
|
+
name: "depth",
|
|
8664
|
+
type: "string",
|
|
8665
|
+
description: "plate: the photo's depth map PNG (default: the photo object's depth, else assets/depth/<image name>-depth.png)."
|
|
8666
|
+
},
|
|
8667
|
+
{
|
|
8668
|
+
name: "strength",
|
|
8669
|
+
type: "string",
|
|
8670
|
+
description: "plate: strongest photo strength to cover, 0-1 (default 1): how far from each edge the foreground is removed."
|
|
8671
|
+
},
|
|
8672
|
+
{
|
|
8673
|
+
name: "width",
|
|
8674
|
+
type: "string",
|
|
8675
|
+
description: "plate: removed band in plate pixels for a full near-to-far depth jump (overrides --strength)."
|
|
8407
8676
|
},
|
|
8408
8677
|
{
|
|
8409
8678
|
name: "size",
|
|
@@ -8435,7 +8704,7 @@ var assetsCommand = {
|
|
|
8435
8704
|
async run({ io, options, positionals }) {
|
|
8436
8705
|
const [action = "list", ...rest] = positionals;
|
|
8437
8706
|
if (action === "library") {
|
|
8438
|
-
const { listLibrary } = await import("./chunks/assets-
|
|
8707
|
+
const { listLibrary } = await import("./chunks/assets-DdzHgVcn.mjs").then((n) => n.n);
|
|
8439
8708
|
const r = listLibrary(readLibraryIndex(), {
|
|
8440
8709
|
query: strOpt(options, "query") ?? rest[0],
|
|
8441
8710
|
kind: strOpt(options, "kind"),
|
|
@@ -8458,7 +8727,7 @@ var assetsCommand = {
|
|
|
8458
8727
|
if (action === "search") {
|
|
8459
8728
|
const query = strOpt(options, "query") ?? rest.join(" ");
|
|
8460
8729
|
if (!query.trim()) usage("assets search needs a query.", "e.g. agent3d assets search \"pine tree\" --kind model");
|
|
8461
|
-
const { searchAssetsDetailed } = await import("./chunks/assets-
|
|
8730
|
+
const { searchAssetsDetailed } = await import("./chunks/assets-DdzHgVcn.mjs").then((n) => n.n);
|
|
8462
8731
|
const r = await searchAssetsDetailed({
|
|
8463
8732
|
query,
|
|
8464
8733
|
kind: strOpt(options, "kind"),
|
|
@@ -8477,7 +8746,7 @@ var assetsCommand = {
|
|
|
8477
8746
|
}
|
|
8478
8747
|
const fs = projectFs(options);
|
|
8479
8748
|
if (action === "list") {
|
|
8480
|
-
const { listAssets } = await import("./chunks/assets-
|
|
8749
|
+
const { listAssets } = await import("./chunks/assets-DdzHgVcn.mjs").then((n) => n.n);
|
|
8481
8750
|
const r = await listAssets(fs);
|
|
8482
8751
|
return printResult(io, r, () => `${table(r.assets, [
|
|
8483
8752
|
"path",
|
|
@@ -8489,7 +8758,7 @@ var assetsCommand = {
|
|
|
8489
8758
|
}
|
|
8490
8759
|
if (action === "add") {
|
|
8491
8760
|
const hit = jsonObjectOpt(options, "hit");
|
|
8492
|
-
const ops = await import("./chunks/assets-
|
|
8761
|
+
const ops = await import("./chunks/assets-DdzHgVcn.mjs").then((n) => n.n);
|
|
8493
8762
|
if (hit) {
|
|
8494
8763
|
const resolution = strOpt(options, "resolution");
|
|
8495
8764
|
const maxSize = numOpt(options, "max-size") ?? ops.parseResolution(resolution).maxSize;
|
|
@@ -8501,8 +8770,8 @@ var assetsCommand = {
|
|
|
8501
8770
|
inflate: (d) => new Uint8Array(inflateRawSync(d))
|
|
8502
8771
|
});
|
|
8503
8772
|
let entry;
|
|
8504
|
-
if (maxSize && (await import("./chunks/browser-
|
|
8505
|
-
const { withImageCodec } = await import("./chunks/imageCodec-
|
|
8773
|
+
if (maxSize && (await import("./chunks/browser-nFaRUETt.mjs")).findBrowser()) {
|
|
8774
|
+
const { withImageCodec } = await import("./chunks/imageCodec-DXxqkEQA.mjs");
|
|
8506
8775
|
entry = await withImageCodec((codec) => dl(codec), { log: log$1 });
|
|
8507
8776
|
} else entry = await dl();
|
|
8508
8777
|
return printResult(io, { asset: entry }, () => [
|
|
@@ -8559,7 +8828,7 @@ var assetsCommand = {
|
|
|
8559
8828
|
} }, () => `Added ${entry.path}.${bounds ? ` Bounds ${bounds.size.join(" × ")} (w × h × d), up axis ${bounds.upAxis}.` : ""}`);
|
|
8560
8829
|
}
|
|
8561
8830
|
if (action === "optimize") {
|
|
8562
|
-
const { optimizeAssets, planOptimize } = await import("./chunks/assets-
|
|
8831
|
+
const { optimizeAssets, planOptimize } = await import("./chunks/assets-DdzHgVcn.mjs").then((n) => n.d);
|
|
8563
8832
|
const all = boolOpt(options, "all");
|
|
8564
8833
|
if (!rest.length && !all) usage("assets optimize needs paths or --all.", "e.g. agent3d assets optimize --all (plan), then --yes; or a folder: agent3d assets optimize assets/textures/wood --yes (`agent3d assets list` shows sizes).");
|
|
8565
8834
|
const compressRaw = strOpt(options, "compress") ?? "meshopt";
|
|
@@ -8605,7 +8874,7 @@ var assetsCommand = {
|
|
|
8605
8874
|
hint: "--dry-run reports the real savings without writing; --max-size forces one size."
|
|
8606
8875
|
}, humanPlan)) return;
|
|
8607
8876
|
const needsCodec = plan.entries.some((e) => e.kind === "texture" || (e.images ?? 0) > 0);
|
|
8608
|
-
const { findBrowser } = await import("./chunks/browser-
|
|
8877
|
+
const { findBrowser } = await import("./chunks/browser-nFaRUETt.mjs");
|
|
8609
8878
|
const run = (codec) => optimizeAssets(fs, {
|
|
8610
8879
|
...opts,
|
|
8611
8880
|
paths: plan.entries.map((e) => e.path),
|
|
@@ -8614,7 +8883,7 @@ var assetsCommand = {
|
|
|
8614
8883
|
}, codec);
|
|
8615
8884
|
let r;
|
|
8616
8885
|
if (needsCodec && findBrowser()) {
|
|
8617
|
-
const { withImageCodec } = await import("./chunks/imageCodec-
|
|
8886
|
+
const { withImageCodec } = await import("./chunks/imageCodec-DXxqkEQA.mjs");
|
|
8618
8887
|
r = await withImageCodec((codec) => run(codec), { log: log$1 });
|
|
8619
8888
|
} else r = await run();
|
|
8620
8889
|
r.skipped.unshift(...plan.skipped);
|
|
@@ -8636,7 +8905,7 @@ var assetsCommand = {
|
|
|
8636
8905
|
}
|
|
8637
8906
|
if (action === "depth") {
|
|
8638
8907
|
const image = positional(rest, 0, "image (project path or library:<id>)", "assets depth assets/textures/photo.jpg");
|
|
8639
|
-
const { checkDepthRequest, estimateDepth } = await import("./chunks/depth-
|
|
8908
|
+
const { checkDepthRequest, estimateDepth } = await import("./chunks/depth-DEaogEAi.mjs").then((n) => n.r);
|
|
8640
8909
|
const { deflateSync } = await import("node:zlib");
|
|
8641
8910
|
const req = {
|
|
8642
8911
|
image: image.replace(/^\.\//, ""),
|
|
@@ -8648,19 +8917,51 @@ var assetsCommand = {
|
|
|
8648
8917
|
};
|
|
8649
8918
|
if (req.maxSize !== void 0 && !(req.maxSize >= 16 && req.maxSize <= 8192)) usage(`--max-size must be between 16 and 8192, got ${req.maxSize}.`, "e.g. --max-size 1024 (default 2048).");
|
|
8650
8919
|
await checkDepthRequest(fs, req);
|
|
8651
|
-
const { withDepthEstimator } = await import("./chunks/depth-
|
|
8920
|
+
const { withDepthEstimator } = await import("./chunks/depth-Bf7cHwod.mjs");
|
|
8652
8921
|
const r = await withDepthEstimator((estimator) => estimateDepth(fs, req, estimator), { log: log$1 });
|
|
8922
|
+
const depthLine = `Wrote ${r.path} (${r.width}x${r.height}, ${r.kb} KB, licence ${r.license}) in ${(r.ms / 1e3).toFixed(2)} s — ${r.model.id}, ${r.model.backend ?? "wasm"}, model input ${r.input.width}x${r.input.height}.`;
|
|
8923
|
+
if (boolOpt(options, "plate")) {
|
|
8924
|
+
const plate = await runPlate(fs, options, {
|
|
8925
|
+
image: req.image,
|
|
8926
|
+
depth: r.path
|
|
8927
|
+
});
|
|
8928
|
+
const suggestion = {
|
|
8929
|
+
...r.suggestion,
|
|
8930
|
+
...plate.suggestion
|
|
8931
|
+
};
|
|
8932
|
+
return printResult(io, {
|
|
8933
|
+
...r,
|
|
8934
|
+
plate,
|
|
8935
|
+
suggestion,
|
|
8936
|
+
hint: `Use them on a photo object: agent3d object add --json-def '${JSON.stringify({
|
|
8937
|
+
id: "photo",
|
|
8938
|
+
...suggestion
|
|
8939
|
+
})}'`
|
|
8940
|
+
}, () => `${depthLine}\n${plateLine(plate)}\nUse them on a photo object: ${JSON.stringify(suggestion)}`);
|
|
8941
|
+
}
|
|
8653
8942
|
return printResult(io, {
|
|
8654
8943
|
...r,
|
|
8655
8944
|
hint: `Use it on a photo object: agent3d object add --json-def '${JSON.stringify({
|
|
8656
8945
|
id: "photo",
|
|
8657
8946
|
...r.suggestion
|
|
8658
8947
|
})}'`
|
|
8659
|
-
}, () =>
|
|
8948
|
+
}, () => `${depthLine}\nUse it as a photo object's depth: { "kind": "photo", "src": "${r.image}", "depth": "${r.path}" }`);
|
|
8949
|
+
}
|
|
8950
|
+
if (action === "plate") {
|
|
8951
|
+
const r = await runPlate(fs, options, {
|
|
8952
|
+
image: positional(rest, 0, "image (project path or library:<id>)", "assets plate assets/textures/photo.jpg").replace(/^\.\//, ""),
|
|
8953
|
+
depth: strOpt(options, "depth"),
|
|
8954
|
+
out: strOpt(options, "out"),
|
|
8955
|
+
outDepth: strOpt(options, "out-depth")
|
|
8956
|
+
});
|
|
8957
|
+
return printResult(io, {
|
|
8958
|
+
...r,
|
|
8959
|
+
hint: `Set them on the photo object: agent3d object update <id> --json-def '${JSON.stringify(r.suggestion)}'`
|
|
8960
|
+
}, () => `${plateLine(r)}\nSet them on the photo object: ${JSON.stringify(r.suggestion)}`);
|
|
8660
8961
|
}
|
|
8661
8962
|
if (action === "remove") {
|
|
8662
8963
|
const path = positional(rest, 0, "asset path", "assets remove <path>");
|
|
8663
|
-
const { listAssets, removeAsset } = await import("./chunks/assets-
|
|
8964
|
+
const { listAssets, removeAsset } = await import("./chunks/assets-DdzHgVcn.mjs").then((n) => n.n);
|
|
8664
8965
|
const { assets } = await listAssets(fs);
|
|
8665
8966
|
const entry = assets.find((a) => a.path === path);
|
|
8666
8967
|
if (!entry && !await fs.exists(path)) throw new CliError("notFound", `No asset "${path}".`, "`agent3d assets list` lists them.");
|
|
@@ -8675,10 +8976,33 @@ var assetsCommand = {
|
|
|
8675
8976
|
...r
|
|
8676
8977
|
}, () => `Removed ${path}.${r.usedBy.length ? ` Still referenced by: ${r.usedBy.join(", ")} — fix those references.` : ""}`);
|
|
8677
8978
|
}
|
|
8678
|
-
usage(`Unknown assets action "${action}".`, "Use list, search, add, optimize, depth, remove or library.");
|
|
8979
|
+
usage(`Unknown assets action "${action}".`, "Use list, search, add, optimize, depth, plate, remove or library.");
|
|
8679
8980
|
}
|
|
8680
8981
|
};
|
|
8681
8982
|
var log$1 = (m) => void process.stderr.write(`${m}\n`);
|
|
8983
|
+
async function runPlate(fs, options, base) {
|
|
8984
|
+
const { checkPlateRequest, generatePlate } = await import("./chunks/plate-Cwl35I2T.mjs").then((n) => n.r);
|
|
8985
|
+
const { deflateSync } = await import("node:zlib");
|
|
8986
|
+
const fmt = strOpt(options, "format");
|
|
8987
|
+
if (fmt !== void 0 && fmt !== "webp" && fmt !== "png") usage(`--format must be webp or png for a plate, got "${fmt}".`, "e.g. --format webp (default).");
|
|
8988
|
+
const req = {
|
|
8989
|
+
...base,
|
|
8990
|
+
maxSize: numOpt(options, "max-size"),
|
|
8991
|
+
strength: numOpt(options, "strength"),
|
|
8992
|
+
width: numOpt(options, "width"),
|
|
8993
|
+
quality: numOpt(options, "quality"),
|
|
8994
|
+
format: fmt,
|
|
8995
|
+
library: libraryProvider(),
|
|
8996
|
+
deflate: (d) => new Uint8Array(deflateSync(d)),
|
|
8997
|
+
inflate: (d) => new Uint8Array(inflateRawSync(d))
|
|
8998
|
+
};
|
|
8999
|
+
await checkPlateRequest(fs, req);
|
|
9000
|
+
const { withPixelCodec } = await import("./chunks/imageCodec-DXxqkEQA.mjs");
|
|
9001
|
+
return withPixelCodec((codec) => generatePlate(fs, req, codec), { log: log$1 });
|
|
9002
|
+
}
|
|
9003
|
+
function plateLine(r) {
|
|
9004
|
+
return `Wrote ${r.path} (${r.width}x${r.height}, ${r.kb} KB) and ${r.depthPath} (${r.depthKb} KB): ${r.holePercent} % of the photo rebuilt from the background (band ${r.holeWidth} px for a full depth jump${r.unfilled ? `, ${r.unfilled} px without background in reach` : ""}) in ${(r.ms / 1e3).toFixed(2)} s.`;
|
|
9005
|
+
}
|
|
8682
9006
|
async function expandPaths(fs, paths) {
|
|
8683
9007
|
const out = [];
|
|
8684
9008
|
for (const raw of paths) {
|
|
@@ -8764,7 +9088,7 @@ var templatesCommand = {
|
|
|
8764
9088
|
const scene = sceneBytes ? JSON.parse(new TextDecoder().decode(sceneBytes)) : null;
|
|
8765
9089
|
let summary = null;
|
|
8766
9090
|
if (scene) try {
|
|
8767
|
-
summary = (await import("./chunks/scene-
|
|
9091
|
+
summary = (await import("./chunks/scene-DSjsun-3.mjs").then((n) => n.a)).summarizeScene(scene);
|
|
8768
9092
|
} catch {
|
|
8769
9093
|
summary = null;
|
|
8770
9094
|
}
|
|
@@ -8798,14 +9122,14 @@ var checkCommand = {
|
|
|
8798
9122
|
],
|
|
8799
9123
|
async run({ io, options }) {
|
|
8800
9124
|
const fs = projectFs(options);
|
|
8801
|
-
const { checkProject } = await import("./chunks/check-
|
|
9125
|
+
const { checkProject } = await import("./chunks/check-E7GdPxTt.mjs").then((n) => n.r);
|
|
8802
9126
|
let extra = {
|
|
8803
9127
|
library: readLibraryIndex(),
|
|
8804
9128
|
...runtimeKb() !== void 0 ? { runtimeKb: runtimeKb() } : {}
|
|
8805
9129
|
};
|
|
8806
9130
|
let renderNote;
|
|
8807
9131
|
if (boolOpt(options, "render")) {
|
|
8808
|
-
const { renderProject } = await import("./chunks/render-
|
|
9132
|
+
const { renderProject } = await import("./chunks/render-CCKciCgu.mjs");
|
|
8809
9133
|
const out = strOpt(options, "out");
|
|
8810
9134
|
const outDir = out ? isAbsolute(out) ? out : resolve(fs.root, out) : checkRenderDir(fs.root);
|
|
8811
9135
|
const r = await renderProject({
|
|
@@ -8950,7 +9274,7 @@ var doctorCommand = {
|
|
|
8950
9274
|
message: `Node ${process.versions.node}${major >= 22 ? "" : " (Agent3D needs Node 22+)"}`,
|
|
8951
9275
|
...major < 22 ? { hint: "Install Node 22 or newer (https://nodejs.org)." } : {}
|
|
8952
9276
|
});
|
|
8953
|
-
const { findBrowser, browserVersion, noBrowserError } = await import("./chunks/browser-
|
|
9277
|
+
const { findBrowser, browserVersion, noBrowserError } = await import("./chunks/browser-nFaRUETt.mjs");
|
|
8954
9278
|
const browser = findBrowser();
|
|
8955
9279
|
if (browser) {
|
|
8956
9280
|
const version = await browserVersion(browser.path);
|
|
@@ -9016,7 +9340,7 @@ var doctorCommand = {
|
|
|
9016
9340
|
const dir = mkdtempSync(join(tmpdir(), "agent3d-doctor-"));
|
|
9017
9341
|
try {
|
|
9018
9342
|
writeFileSync(join(dir, "scene.json"), JSON.stringify(DOCTOR_SCENE));
|
|
9019
|
-
const { renderProject } = await import("./chunks/render-
|
|
9343
|
+
const { renderProject } = await import("./chunks/render-CCKciCgu.mjs");
|
|
9020
9344
|
const { decodePng, pngVariance } = await import("./chunks/png-DXfSGJZt.mjs");
|
|
9021
9345
|
const t0 = Date.now();
|
|
9022
9346
|
const r = await renderProject({
|
|
@@ -9170,7 +9494,7 @@ var infoCommand = {
|
|
|
9170
9494
|
options: [PROJECT_OPTION],
|
|
9171
9495
|
async run({ io, options }) {
|
|
9172
9496
|
const fs = projectFs(options);
|
|
9173
|
-
const [{ loadProject }, { summarizeScene }] = await Promise.all([Promise.resolve().then(() => project_exports), import("./chunks/scene-
|
|
9497
|
+
const [{ loadProject }, { summarizeScene }] = await Promise.all([Promise.resolve().then(() => project_exports), import("./chunks/scene-DSjsun-3.mjs").then((n) => n.a)]);
|
|
9174
9498
|
const { manifest, scene } = await loadProject(fs);
|
|
9175
9499
|
const files = await fs.list();
|
|
9176
9500
|
const renders = files.filter((f) => f.startsWith("renders/") && f.endsWith(".png")).slice(-8);
|
|
@@ -9190,6 +9514,323 @@ var infoCommand = {
|
|
|
9190
9514
|
].join("\n"));
|
|
9191
9515
|
}
|
|
9192
9516
|
};
|
|
9517
|
+
// src/runtime/num.ts
|
|
9518
|
+
function clamp(v, min, max) {
|
|
9519
|
+
return v < min ? min : v > max ? max : v;
|
|
9520
|
+
}
|
|
9521
|
+
function num(v, def) {
|
|
9522
|
+
return typeof v === "number" && Number.isFinite(v) ? v : def;
|
|
9523
|
+
}
|
|
9524
|
+
// src/runtime/build/photoCore.ts
|
|
9525
|
+
var PHOTO_DEFAULTS = {
|
|
9526
|
+
width: 4,
|
|
9527
|
+
strength: .5,
|
|
9528
|
+
focus: .5,
|
|
9529
|
+
segments: 256,
|
|
9530
|
+
layers: 6,
|
|
9531
|
+
edgeCut: .08,
|
|
9532
|
+
speed: 1,
|
|
9533
|
+
smoothing: .9
|
|
9534
|
+
};
|
|
9535
|
+
function photoSize(def, imgW, imgH) {
|
|
9536
|
+
const aspect = imgW > 0 && imgH > 0 ? imgW / imgH : 1;
|
|
9537
|
+
const w = typeof def.width === "number" && def.width > 0 ? def.width : void 0;
|
|
9538
|
+
const h = typeof def.height === "number" && def.height > 0 ? def.height : void 0;
|
|
9539
|
+
if (w !== void 0 && h !== void 0) return {
|
|
9540
|
+
width: w,
|
|
9541
|
+
height: h
|
|
9542
|
+
};
|
|
9543
|
+
if (h !== void 0) return {
|
|
9544
|
+
width: h * aspect,
|
|
9545
|
+
height: h
|
|
9546
|
+
};
|
|
9547
|
+
const width = w ?? PHOTO_DEFAULTS.width;
|
|
9548
|
+
return {
|
|
9549
|
+
width,
|
|
9550
|
+
height: width / aspect
|
|
9551
|
+
};
|
|
9552
|
+
}
|
|
9553
|
+
function motionPeriod(s) {
|
|
9554
|
+
if (s.auto === "none") return {
|
|
9555
|
+
duration: 0,
|
|
9556
|
+
start: 0
|
|
9557
|
+
};
|
|
9558
|
+
const p = s.speed > 0 ? 10 / s.speed : 0;
|
|
9559
|
+
if (!s.loop) return {
|
|
9560
|
+
duration: s.duration > 0 ? s.duration : p,
|
|
9561
|
+
start: 0
|
|
9562
|
+
};
|
|
9563
|
+
return {
|
|
9564
|
+
duration: p,
|
|
9565
|
+
start: s.auto === "orbit" ? p : 0
|
|
9566
|
+
};
|
|
9567
|
+
}
|
|
9568
|
+
function motionSettings(m) {
|
|
9569
|
+
const pointer = clamp(num(m?.pointer, 1), 0, 1);
|
|
9570
|
+
return {
|
|
9571
|
+
pointer,
|
|
9572
|
+
scroll: clamp(num(m?.scroll, 0), 0, 1),
|
|
9573
|
+
gyro: typeof m?.gyro === "boolean" ? m.gyro : pointer > 0,
|
|
9574
|
+
auto: m?.auto ?? "sway",
|
|
9575
|
+
speed: Math.max(0, num(m?.speed, PHOTO_DEFAULTS.speed)),
|
|
9576
|
+
smoothing: clamp(num(m?.smoothing, PHOTO_DEFAULTS.smoothing), 0, .99),
|
|
9577
|
+
loop: m?.loop !== false,
|
|
9578
|
+
duration: Math.max(0, num(m?.duration, 0)),
|
|
9579
|
+
progress: typeof m?.progress === "number" && Number.isFinite(m.progress) ? clamp(m.progress, 0, 1) : null
|
|
9580
|
+
};
|
|
9581
|
+
}
|
|
9582
|
+
// src/ops/social.ts
|
|
9583
|
+
var SOCIAL_PRESET_IDS = [
|
|
9584
|
+
"vertical",
|
|
9585
|
+
"square",
|
|
9586
|
+
"landscape",
|
|
9587
|
+
"story"
|
|
9588
|
+
];
|
|
9589
|
+
var SOCIAL_PRESETS = {
|
|
9590
|
+
vertical: {
|
|
9591
|
+
id: "vertical",
|
|
9592
|
+
width: 1080,
|
|
9593
|
+
height: 1920,
|
|
9594
|
+
aspect: "9:16",
|
|
9595
|
+
bitrate: 1e7,
|
|
9596
|
+
description: "1080×1920 (9:16): Reels, TikTok, Shorts, LinkedIn / Instagram vertical video."
|
|
9597
|
+
},
|
|
9598
|
+
square: {
|
|
9599
|
+
id: "square",
|
|
9600
|
+
width: 1080,
|
|
9601
|
+
height: 1080,
|
|
9602
|
+
aspect: "1:1",
|
|
9603
|
+
bitrate: 8e6,
|
|
9604
|
+
description: "1080×1080 (1:1): Instagram / LinkedIn / Facebook feed."
|
|
9605
|
+
},
|
|
9606
|
+
landscape: {
|
|
9607
|
+
id: "landscape",
|
|
9608
|
+
width: 1920,
|
|
9609
|
+
height: 1080,
|
|
9610
|
+
aspect: "16:9",
|
|
9611
|
+
bitrate: 1e7,
|
|
9612
|
+
description: "1920×1080 (16:9): YouTube, LinkedIn, X, websites."
|
|
9613
|
+
},
|
|
9614
|
+
story: {
|
|
9615
|
+
id: "story",
|
|
9616
|
+
width: 1080,
|
|
9617
|
+
height: 1920,
|
|
9618
|
+
aspect: "9:16",
|
|
9619
|
+
maxDuration: 15,
|
|
9620
|
+
bitrate: 1e7,
|
|
9621
|
+
description: "1080×1920 (9:16), at most 15 s: Instagram / Facebook stories."
|
|
9622
|
+
}
|
|
9623
|
+
};
|
|
9624
|
+
function parseSocialPreset(name) {
|
|
9625
|
+
const id = name.trim().toLowerCase();
|
|
9626
|
+
if (SOCIAL_PRESET_IDS.includes(id)) return SOCIAL_PRESETS[id];
|
|
9627
|
+
const s = closest(id, SOCIAL_PRESET_IDS);
|
|
9628
|
+
return {
|
|
9629
|
+
error: `Unknown video preset "${name}".`,
|
|
9630
|
+
hint: `${s ? `Did you mean "${s}"? ` : ""}Use ${SOCIAL_PRESET_IDS.join(", ")} (${SOCIAL_PRESET_IDS.map((p) => `${p} ${SOCIAL_PRESETS[p].width}x${SOCIAL_PRESETS[p].height}`).join(", ")}).`
|
|
9631
|
+
};
|
|
9632
|
+
}
|
|
9633
|
+
function photos(scene) {
|
|
9634
|
+
return (scene.objects ?? []).filter((o) => o.kind === "photo");
|
|
9635
|
+
}
|
|
9636
|
+
function socialDuration(scene, preset) {
|
|
9637
|
+
let out = null;
|
|
9638
|
+
for (const p of photos(scene)) {
|
|
9639
|
+
const s = motionSettings(p.motion);
|
|
9640
|
+
if (s.progress !== null) continue;
|
|
9641
|
+
const m = motionPeriod(s);
|
|
9642
|
+
if (m.duration > 0) {
|
|
9643
|
+
out = {
|
|
9644
|
+
...m,
|
|
9645
|
+
source: `one ${s.loop ? "loop" : "move"} of "${p.id}" (motion.auto "${s.auto}")`
|
|
9646
|
+
};
|
|
9647
|
+
break;
|
|
9648
|
+
}
|
|
9649
|
+
}
|
|
9650
|
+
const tl = scene.timeline?.duration;
|
|
9651
|
+
out ??= tl && tl > 0 ? {
|
|
9652
|
+
duration: tl,
|
|
9653
|
+
start: 0,
|
|
9654
|
+
source: "the timeline duration"
|
|
9655
|
+
} : {
|
|
9656
|
+
duration: 5,
|
|
9657
|
+
start: 0,
|
|
9658
|
+
source: "default 5 s"
|
|
9659
|
+
};
|
|
9660
|
+
if (preset?.maxDuration && out.duration > preset.maxDuration) out = {
|
|
9661
|
+
...out,
|
|
9662
|
+
duration: preset.maxDuration,
|
|
9663
|
+
source: `${out.source}, capped to ${preset.maxDuration} s (${preset.id})`
|
|
9664
|
+
};
|
|
9665
|
+
return {
|
|
9666
|
+
...out,
|
|
9667
|
+
duration: Math.round(out.duration * 1e3) / 1e3
|
|
9668
|
+
};
|
|
9669
|
+
}
|
|
9670
|
+
var DEG = Math.PI / 180;
|
|
9671
|
+
var sub = (a, b) => [
|
|
9672
|
+
a[0] - b[0],
|
|
9673
|
+
a[1] - b[1],
|
|
9674
|
+
a[2] - b[2]
|
|
9675
|
+
];
|
|
9676
|
+
var cross = (a, b) => [
|
|
9677
|
+
a[1] * b[2] - a[2] * b[1],
|
|
9678
|
+
a[2] * b[0] - a[0] * b[2],
|
|
9679
|
+
a[0] * b[1] - a[1] * b[0]
|
|
9680
|
+
];
|
|
9681
|
+
var norm = (a) => {
|
|
9682
|
+
const l = Math.hypot(a[0], a[1], a[2]) || 1;
|
|
9683
|
+
return [
|
|
9684
|
+
a[0] / l,
|
|
9685
|
+
a[1] / l,
|
|
9686
|
+
a[2] / l
|
|
9687
|
+
];
|
|
9688
|
+
};
|
|
9689
|
+
function coverScene(scene, aspect, imageSize) {
|
|
9690
|
+
const notes = [];
|
|
9691
|
+
const out = {
|
|
9692
|
+
...scene,
|
|
9693
|
+
target: {
|
|
9694
|
+
...scene.target,
|
|
9695
|
+
aspect: aspectString(aspect)
|
|
9696
|
+
},
|
|
9697
|
+
camera: { ...scene.camera }
|
|
9698
|
+
};
|
|
9699
|
+
const cam = out.camera;
|
|
9700
|
+
const design = parseAspect(scene.target?.aspect);
|
|
9701
|
+
if (design && Math.abs(design - aspect) > .01) notes.push(`The scene (${scene.target?.aspect}) is cropped to ${aspectString(aspect)}: content near the ${aspect < design ? "left and right" : "top and bottom"} edges is cut — look at the frames.`);
|
|
9702
|
+
const C = cam.position;
|
|
9703
|
+
const f = norm(sub(cam.target ?? [
|
|
9704
|
+
0,
|
|
9705
|
+
0,
|
|
9706
|
+
0
|
|
9707
|
+
], C));
|
|
9708
|
+
const r = norm(cross(f, [
|
|
9709
|
+
0,
|
|
9710
|
+
1,
|
|
9711
|
+
0
|
|
9712
|
+
]));
|
|
9713
|
+
const u = cross(r, f);
|
|
9714
|
+
const ortho = cam.type === "orthographic";
|
|
9715
|
+
const tanY = ortho ? 0 : Math.tan((cam.fov ?? 45) * DEG / 2);
|
|
9716
|
+
const halfH = ortho ? (cam.zoom ?? 10) / 2 : 0;
|
|
9717
|
+
let need = 1;
|
|
9718
|
+
for (const p of photos(scene)) {
|
|
9719
|
+
if ((p.rotation ?? [
|
|
9720
|
+
0,
|
|
9721
|
+
0,
|
|
9722
|
+
0
|
|
9723
|
+
]).some((a) => Math.abs(a) > .5) || Math.abs(f[2]) < .97) {
|
|
9724
|
+
notes.push(`"${p.id}" is not facing the camera head-on: cover fit skipped for it.`);
|
|
9725
|
+
continue;
|
|
9726
|
+
}
|
|
9727
|
+
const img = imageSize(p.src);
|
|
9728
|
+
if (!img) {
|
|
9729
|
+
notes.push(`"${p.id}": unknown image size (${p.src}): cover fit skipped for it.`);
|
|
9730
|
+
continue;
|
|
9731
|
+
}
|
|
9732
|
+
const size = photoSize(p, img.width, img.height);
|
|
9733
|
+
const sc = p.scale ?? 1;
|
|
9734
|
+
const [sx, sy] = typeof sc === "number" ? [sc, sc] : [sc[0], sc[1]];
|
|
9735
|
+
const pos = p.position ?? [
|
|
9736
|
+
0,
|
|
9737
|
+
0,
|
|
9738
|
+
0
|
|
9739
|
+
];
|
|
9740
|
+
const hw = size.width * Math.abs(sx) / 2, hh = size.height * Math.abs(sy) / 2;
|
|
9741
|
+
const margin = p.mode === "mesh" ? 1.06 : 1.01;
|
|
9742
|
+
const dist = ortho ? 1 : (pos[2] - C[2]) / f[2];
|
|
9743
|
+
if (!(dist > 0)) continue;
|
|
9744
|
+
const center = [C[0] + f[0] * dist, C[1] + f[1] * dist];
|
|
9745
|
+
const ex = ortho ? halfH * aspect : tanY * aspect * dist, ey = ortho ? halfH : tanY * dist;
|
|
9746
|
+
const fx = Math.abs(r[0]) * ex + Math.abs(u[0]) * ey, fy = Math.abs(r[1]) * ex + Math.abs(u[1]) * ey;
|
|
9747
|
+
const roomX = Math.min(pos[0] + hw - center[0], center[0] - (pos[0] - hw));
|
|
9748
|
+
const roomY = Math.min(pos[1] + hh - center[1], center[1] - (pos[1] - hh));
|
|
9749
|
+
if (roomX <= 0 || roomY <= 0) {
|
|
9750
|
+
notes.push(`"${p.id}" is off the view centre: cover fit skipped for it.`);
|
|
9751
|
+
continue;
|
|
9752
|
+
}
|
|
9753
|
+
need = Math.max(need, fx * margin / roomX, fy * margin / roomY);
|
|
9754
|
+
}
|
|
9755
|
+
if (need > 1.0001) {
|
|
9756
|
+
if (ortho) cam.zoom = (cam.zoom ?? 10) / need;
|
|
9757
|
+
else cam.fov = 2 * Math.atan(tanY / need) / DEG;
|
|
9758
|
+
notes.push(`Camera tightened ${need.toFixed(2)}× (${ortho ? `zoom ${cam.zoom.toFixed(2)}` : `fov ${cam.fov.toFixed(1)}°`}) so the photo covers the ${aspectString(aspect)} frame (no edges).`);
|
|
9759
|
+
if (cam.shots?.length || cam.controls === "scroll") notes.push("Camera shots / scroll paths keep their own fov: check the frames.");
|
|
9760
|
+
}
|
|
9761
|
+
return {
|
|
9762
|
+
scene: out,
|
|
9763
|
+
zoom: need,
|
|
9764
|
+
notes
|
|
9765
|
+
};
|
|
9766
|
+
}
|
|
9767
|
+
function parseAspect(a) {
|
|
9768
|
+
const m = /^\s*([\d.]+)\s*[:/x]\s*([\d.]+)\s*$/.exec(a ?? "");
|
|
9769
|
+
const v = m ? Number(m[1]) / Number(m[2]) : void 0;
|
|
9770
|
+
return v && Number.isFinite(v) && v > 0 ? v : void 0;
|
|
9771
|
+
}
|
|
9772
|
+
function aspectString(a) {
|
|
9773
|
+
for (const [w, h] of [
|
|
9774
|
+
[9, 16],
|
|
9775
|
+
[1, 1],
|
|
9776
|
+
[16, 9],
|
|
9777
|
+
[4, 5],
|
|
9778
|
+
[4, 3],
|
|
9779
|
+
[3, 4],
|
|
9780
|
+
[21, 9],
|
|
9781
|
+
[4, 1],
|
|
9782
|
+
[3, 1],
|
|
9783
|
+
[2, 1]
|
|
9784
|
+
]) if (Math.abs(a - w / h) < .005) return `${w}:${h}`;
|
|
9785
|
+
return `${Math.round(a * 1e3)}:1000`;
|
|
9786
|
+
}
|
|
9787
|
+
function imageHeaderSize(b) {
|
|
9788
|
+
const be16 = (i) => b[i] << 8 | b[i + 1];
|
|
9789
|
+
const be32 = (i) => (b[i] << 24 | b[i + 1] << 16 | b[i + 2] << 8 | b[i + 3]) >>> 0;
|
|
9790
|
+
const le16 = (i) => b[i] | b[i + 1] << 8;
|
|
9791
|
+
const le24 = (i) => b[i] | b[i + 1] << 8 | b[i + 2] << 16;
|
|
9792
|
+
if (b.length >= 24 && b[0] === 137 && b[1] === 80 && b[2] === 78 && b[3] === 71) return {
|
|
9793
|
+
width: be32(16),
|
|
9794
|
+
height: be32(20)
|
|
9795
|
+
};
|
|
9796
|
+
if (b.length >= 30 && String.fromCharCode(...b.subarray(0, 4)) === "RIFF" && String.fromCharCode(...b.subarray(8, 12)) === "WEBP") {
|
|
9797
|
+
const kind = String.fromCharCode(...b.subarray(12, 16));
|
|
9798
|
+
if (kind === "VP8 " && b.length >= 30) return {
|
|
9799
|
+
width: le16(26) & 16383,
|
|
9800
|
+
height: le16(28) & 16383
|
|
9801
|
+
};
|
|
9802
|
+
if (kind === "VP8L" && b.length >= 25) {
|
|
9803
|
+
const bits = b[21] | b[22] << 8 | b[23] << 16 | b[24] << 24;
|
|
9804
|
+
return {
|
|
9805
|
+
width: (bits & 16383) + 1,
|
|
9806
|
+
height: (bits >>> 14 & 16383) + 1
|
|
9807
|
+
};
|
|
9808
|
+
}
|
|
9809
|
+
if (kind === "VP8X" && b.length >= 30) return {
|
|
9810
|
+
width: le24(24) + 1,
|
|
9811
|
+
height: le24(27) + 1
|
|
9812
|
+
};
|
|
9813
|
+
return null;
|
|
9814
|
+
}
|
|
9815
|
+
if (b.length >= 4 && b[0] === 255 && b[1] === 216) {
|
|
9816
|
+
let i = 2;
|
|
9817
|
+
while (i + 9 < b.length) {
|
|
9818
|
+
if (b[i] !== 255) return null;
|
|
9819
|
+
const marker = b[i + 1];
|
|
9820
|
+
if (marker === 216 || marker >= 208 && marker <= 215 || marker === 1) {
|
|
9821
|
+
i += 2;
|
|
9822
|
+
continue;
|
|
9823
|
+
}
|
|
9824
|
+
const len = be16(i + 2);
|
|
9825
|
+
if (marker >= 192 && marker <= 207 && marker !== 196 && marker !== 200 && marker !== 204) return {
|
|
9826
|
+
width: be16(i + 7),
|
|
9827
|
+
height: be16(i + 5)
|
|
9828
|
+
};
|
|
9829
|
+
i += 2 + len;
|
|
9830
|
+
}
|
|
9831
|
+
}
|
|
9832
|
+
return null;
|
|
9833
|
+
}
|
|
9193
9834
|
// agent/commands/render.ts
|
|
9194
9835
|
var SIZE_OPTION = {
|
|
9195
9836
|
name: "size",
|
|
@@ -9208,8 +9849,8 @@ function timeoutMs(options) {
|
|
|
9208
9849
|
var log = (m) => void process.stderr.write(`${m}\n`);
|
|
9209
9850
|
var renderCommand = {
|
|
9210
9851
|
name: "render",
|
|
9211
|
-
usage: "render [--frames 0,1.5,3 | --count 4] [--size 1200x300] [--scale 2] [--quality draft|standard|high|ultra] [--transparent] [--scroll 0.5] [--reduced-motion] [--segment <name>] [--sheet] [--input <json|@file>] [--isolate <objectId>] [--bg checker|<colour>|none] [--out renders/] | --video out.mp4|out.webm [--fps 30] [--duration 6] | --gif out.gif | --webp out.webp [--project <dir>]",
|
|
9212
|
-
summary: "Render the scene headless (installed Chrome, deterministic time) to PNGs — LOOK at them to check framing, colours, motion. Returns { dir, frames: [{ t, path }], sheet?, state, stats, inspect, issues, consoleErrors } (paths relative to the project folder `dir`). Games: --input plays a script of simulated keys / clicks / drags / swipes / HUD button clicks / emitted events and `state` shows the result (e.g. the score). Media: --video (MP4 H.264 / WebM VP9), --gif or --webp (animated) render every frame exactly at any --fps / --duration / --size (with --input, --segment, --scroll and --reduced-motion applied too) and return { path, format, codec, frames, fps, duration, size, bytes }. Scenes whose timeline waits for a click / interaction: --segment <name> plays that segment from the start.",
|
|
9852
|
+
usage: "render [--frames 0,1.5,3 | --count 4] [--size 1200x300] [--scale 2] [--quality draft|standard|high|ultra] [--transparent] [--scroll 0.5] [--reduced-motion] [--segment <name>] [--sheet] [--input <json|@file>] [--isolate <objectId>] [--bg checker|<colour>|none] [--out renders/] | --video out.mp4|out.webm [--preset vertical|square|landscape|story] [--fit cover|contain] [--fps 30] [--duration 6] | --gif out.gif | --webp out.webp [--project <dir>]",
|
|
9853
|
+
summary: "Render the scene headless (installed Chrome, deterministic time) to PNGs — LOOK at them to check framing, colours, motion. Returns { dir, frames: [{ t, path }], sheet?, state, stats, inspect, issues, consoleErrors } (paths relative to the project folder `dir`). Games: --input plays a script of simulated keys / clicks / drags / swipes / HUD button clicks / emitted events and `state` shows the result (e.g. the score). Media: --video (MP4 H.264 / WebM VP9), --gif or --webp (animated) render every frame exactly at any --fps / --duration / --size (with --input, --segment, --scroll and --reduced-motion applied too) and return { path, format, codec, frames, fps, duration, size, bytes }. Social video: --video out.mp4 --preset vertical (1080x1920) | square (1080x1080) | landscape (1920x1080) | story (1080x1920, max 15 s) — 30 fps, one seamless loop of the photo motion, a bitrate social networks keep sharp and a cover fit (3D photos fill the frame, no edges; `notes` say what was cropped / tightened). Scenes whose timeline waits for a click / interaction: --segment <name> plays that segment from the start.",
|
|
9213
9854
|
writes: true,
|
|
9214
9855
|
options: [
|
|
9215
9856
|
PROJECT_OPTION,
|
|
@@ -9327,7 +9968,17 @@ var renderCommand = {
|
|
|
9327
9968
|
{
|
|
9328
9969
|
name: "bitrate",
|
|
9329
9970
|
type: "string",
|
|
9330
|
-
description: "Video bitrate in Mbit/s (default from size, fps and --quality)."
|
|
9971
|
+
description: "Video bitrate in Mbit/s (default from size, fps and --quality; 10 with a 1080p --preset)."
|
|
9972
|
+
},
|
|
9973
|
+
{
|
|
9974
|
+
name: "preset",
|
|
9975
|
+
type: "string",
|
|
9976
|
+
description: "Social video preset: vertical (1080x1920, 9:16), square (1080x1080), landscape (1920x1080) or story (1080x1920, at most 15 s). Sets --size, fps 30, the duration (one seamless loop of the 3D photo motion, else the timeline, unless --duration), the bitrate and a cover fit. Without --video / --gif / --webp: PNG frames of that framing spread over the loop."
|
|
9977
|
+
},
|
|
9978
|
+
{
|
|
9979
|
+
name: "fit",
|
|
9980
|
+
type: "string",
|
|
9981
|
+
description: "cover (default with --preset when the scene has a 3D photo: render at the frame's aspect and tighten the camera until the photos fill it, no edges) or contain (the runtime's own fit: a narrower frame widens the view and may show the background around a photo)."
|
|
9331
9982
|
},
|
|
9332
9983
|
TIMEOUT_OPTION,
|
|
9333
9984
|
{
|
|
@@ -9337,14 +9988,16 @@ var renderCommand = {
|
|
|
9337
9988
|
],
|
|
9338
9989
|
async run({ io, options }) {
|
|
9339
9990
|
const fs = projectFs(options);
|
|
9340
|
-
const { parseQuality } = await import("./chunks/render-
|
|
9991
|
+
const { parseQuality } = await import("./chunks/render-CCKciCgu.mjs");
|
|
9341
9992
|
const quality = parseQuality(strOpt(options, "quality"));
|
|
9342
9993
|
const scroll = numOpt(options, "scroll");
|
|
9343
|
-
const { parseInputScript } = await import("./chunks/render-
|
|
9994
|
+
const { parseInputScript } = await import("./chunks/render-CCKciCgu.mjs");
|
|
9344
9995
|
const rawInput = strOpt(options, "input") !== void 0 ? jsonOpt(options, "input", `--input '[{"t": 0.5, "key": "ArrowRight", "hold": 1}]' or --input @inputs.json`) : void 0;
|
|
9345
9996
|
const input = rawInput === void 0 ? void 0 : parseInputScript(rawInput);
|
|
9346
9997
|
const segment = strOpt(options, "segment");
|
|
9347
9998
|
const reducedMotion = boolOpt(options, "reduced-motion");
|
|
9999
|
+
const preset = presetOpt(strOpt(options, "preset"));
|
|
10000
|
+
const fit = parseFit(strOpt(options, "fit"));
|
|
9348
10001
|
const mediaOpts = [
|
|
9349
10002
|
"video",
|
|
9350
10003
|
"gif",
|
|
@@ -9354,7 +10007,7 @@ var renderCommand = {
|
|
|
9354
10007
|
if (mediaOpts.length) {
|
|
9355
10008
|
const kind = mediaOpts[0];
|
|
9356
10009
|
const out = projectPath(fs.root, strOpt(options, kind));
|
|
9357
|
-
const { renderMedia, mediaFormatFromPath } = await import("./chunks/render-
|
|
10010
|
+
const { renderMedia, mediaFormatFromPath } = await import("./chunks/render-CCKciCgu.mjs");
|
|
9358
10011
|
const format = kind === "video" ? mediaFormatFromPath(out) : kind;
|
|
9359
10012
|
if (kind === "video" && format !== "mp4" && format !== "webm") usage(`--video needs a .mp4 or .webm file name, got "${strOpt(options, kind)}".`, "e.g. --video renders/banner.mp4");
|
|
9360
10013
|
if (existsSync(out) && !confirmOrPlan(io, options, { overwrite: [out] }, () => `Overwrite ${out}`)) return;
|
|
@@ -9377,6 +10030,8 @@ var renderCommand = {
|
|
|
9377
10030
|
segment,
|
|
9378
10031
|
reducedMotion,
|
|
9379
10032
|
scroll,
|
|
10033
|
+
preset,
|
|
10034
|
+
fit,
|
|
9380
10035
|
timeoutMs: timeoutMs(options),
|
|
9381
10036
|
log
|
|
9382
10037
|
});
|
|
@@ -9384,7 +10039,7 @@ var renderCommand = {
|
|
|
9384
10039
|
return printResult(io, {
|
|
9385
10040
|
...result,
|
|
9386
10041
|
path: out
|
|
9387
|
-
}, () => `${r.format.toUpperCase()} ${r.duration}s @ ${r.fps} fps (${r.frames} frames, ${r.size.width}x${r.size.height}, ${r.codec}${r.supersampling > 1 ? `, ${r.supersampling}× supersampled` : ""}, ${Math.round(r.bytes / 1024)} KB, ${Math.round(r.ms / 1e3)} s) → ${out}`);
|
|
10042
|
+
}, () => [`${r.format.toUpperCase()} ${r.duration}s @ ${r.fps} fps (${r.frames} frames, ${r.size.width}x${r.size.height}, ${r.codec}${r.supersampling > 1 ? `, ${r.supersampling}× supersampled` : ""}, ${Math.round(r.bytes / 1024)} KB, ${Math.round(r.ms / 1e3)} s) → ${out}`, ...(r.notes ?? []).map((n) => ` ${n}`)].join("\n"));
|
|
9388
10043
|
}
|
|
9389
10044
|
const capture = strOpt(options, "capture");
|
|
9390
10045
|
if (capture && ![
|
|
@@ -9392,13 +10047,23 @@ var renderCommand = {
|
|
|
9392
10047
|
"canvas",
|
|
9393
10048
|
"page"
|
|
9394
10049
|
].includes(capture)) usage(`--capture must be auto, canvas or page, got "${capture}".`);
|
|
9395
|
-
const { renderProject } = await import("./chunks/render-
|
|
9396
|
-
|
|
10050
|
+
const { renderProject, socialPlan } = await import("./chunks/render-CCKciCgu.mjs");
|
|
10051
|
+
let frames = renderFrames(strOpt(options, "frames"), numOpt(options, "count"), scroll);
|
|
10052
|
+
const social = preset || fit ? socialPlan({
|
|
10053
|
+
preset,
|
|
10054
|
+
fit,
|
|
10055
|
+
size: strOpt(options, "size"),
|
|
10056
|
+
width: numOpt(options, "width"),
|
|
10057
|
+
projectDir: fs.root,
|
|
10058
|
+
duration: numOpt(options, "duration")
|
|
10059
|
+
}) : void 0;
|
|
10060
|
+
if (social?.duration && !frames) frames = loopFrames(social.start, social.duration, numOpt(options, "count"));
|
|
9397
10061
|
const r = await renderProject({
|
|
9398
10062
|
projectDir: fs.root,
|
|
10063
|
+
...social ? { scene: social.scene } : {},
|
|
9399
10064
|
frames,
|
|
9400
10065
|
count: numOpt(options, "count"),
|
|
9401
|
-
size: strOpt(options, "size"),
|
|
10066
|
+
size: social?.size ?? strOpt(options, "size"),
|
|
9402
10067
|
width: numOpt(options, "width"),
|
|
9403
10068
|
scale: numOpt(options, "scale"),
|
|
9404
10069
|
sheet: boolOpt(options, "sheet"),
|
|
@@ -9424,8 +10089,10 @@ var renderCommand = {
|
|
|
9424
10089
|
...r.consoleErrors.length ? [`${r.consoleErrors.length} console error(s): see consoleErrors.`] : [],
|
|
9425
10090
|
...r.inputWarnings ?? []
|
|
9426
10091
|
];
|
|
10092
|
+
if (social?.notes.length) hints.push(...social.notes);
|
|
9427
10093
|
printResult(io, {
|
|
9428
10094
|
...r,
|
|
10095
|
+
...social?.preset ? { preset: social.preset } : {},
|
|
9429
10096
|
...hints.length ? { hints } : {}
|
|
9430
10097
|
}, () => [
|
|
9431
10098
|
...r.frames.map((f) => `${f.scroll !== void 0 ? `scroll=${f.scroll} ` : ""}t=${f.t}s ${resolve(r.dir, f.path)}`),
|
|
@@ -9437,6 +10104,24 @@ var renderCommand = {
|
|
|
9437
10104
|
].join("\n"));
|
|
9438
10105
|
}
|
|
9439
10106
|
};
|
|
10107
|
+
/** --preset: a social video preset id (usage error with did-you-mean otherwise). */
|
|
10108
|
+
function presetOpt(v) {
|
|
10109
|
+
if (v === void 0) return void 0;
|
|
10110
|
+
const p = parseSocialPreset(v);
|
|
10111
|
+
if ("error" in p) usage(p.error, p.hint);
|
|
10112
|
+
return p.id;
|
|
10113
|
+
}
|
|
10114
|
+
/** --fit: cover | contain. */
|
|
10115
|
+
function parseFit(v) {
|
|
10116
|
+
if (v === void 0) return void 0;
|
|
10117
|
+
if (v !== "cover" && v !== "contain") usage(`--fit must be cover or contain, got "${v}".`, "cover fills the frame with the 3D photo (cropping the scene); contain keeps the scene's design width visible.");
|
|
10118
|
+
return v;
|
|
10119
|
+
}
|
|
10120
|
+
/** `count` frame times (default 4) spread over one loop [start, start + duration). */
|
|
10121
|
+
function loopFrames(start, duration, count) {
|
|
10122
|
+
const n = Math.max(1, Math.min(64, Math.round(count ?? 4)));
|
|
10123
|
+
return Array.from({ length: n }, (_, i) => Math.round((start + i * duration / n) * 1e3) / 1e3).join(",");
|
|
10124
|
+
}
|
|
9440
10125
|
/** --frames to render: a --scroll position alone is one frame (t = 0). */
|
|
9441
10126
|
function renderFrames(frames, count, scroll) {
|
|
9442
10127
|
return frames ?? (scroll !== void 0 && count === void 0 ? "0" : void 0);
|
|
@@ -9452,7 +10137,7 @@ function dirNonEmpty(dir) {
|
|
|
9452
10137
|
}
|
|
9453
10138
|
var exportCommand = {
|
|
9454
10139
|
name: "export",
|
|
9455
|
-
usage: "export [--format embed|zip|single-html|poster|video|gif] [--out <path>] [--name <slug>] [--base-url <url>] [--cache-bust] [--no-integrity] [--no-poster] [--no-og] [--prune-runtime] [--yes] [--project <dir>]",
|
|
10140
|
+
usage: "export [--format embed|zip|single-html|poster|video|gif] [--preset vertical|square|landscape|story] [--out <path>] [--name <slug>] [--base-url <url>] [--cache-bust] [--no-integrity] [--no-poster] [--no-og] [--prune-runtime] [--runtime auto|full] [--yes] [--project <dir>]",
|
|
9456
10141
|
summary: "Export for a website: embed (Web Component + static files + EMBED.md + React/Vue/Svelte wrappers, default), zip (the embed folder as one .zip), single-html (one file), poster (still image), video (MP4 H.264 / WebM VP9) or gif. Reports pageKb / pageKbGzip (what a visitor downloads for this scene: runtime entry + the chunks it loads + scene, assets, scripts, poster) and folderKb (every file written). Overwriting a non-empty --out needs --yes.",
|
|
9457
10142
|
writes: true,
|
|
9458
10143
|
options: [
|
|
@@ -9502,6 +10187,11 @@ var exportCommand = {
|
|
|
9502
10187
|
type: "boolean",
|
|
9503
10188
|
description: "embed / zip: copy only the runtime chunks this scene loads (smaller folder). Only for a runtime folder used by this scene alone — other scenes sharing it may need the left-out chunks; kept whole when a chunk's feature is unknown."
|
|
9504
10189
|
},
|
|
10190
|
+
{
|
|
10191
|
+
name: "runtime",
|
|
10192
|
+
type: "string",
|
|
10193
|
+
description: "embed / zip / single-html: auto (default) ships the photo-only lite runtime (agent3d-photo.js, ~19 KB gzipped, no three.js) when the scene is a single 3D photo with a fixed camera and a plain background; full always ships agent3d-runtime.js. The result's runtime / runtimeReasons say which and why."
|
|
10194
|
+
},
|
|
9505
10195
|
{
|
|
9506
10196
|
name: "no-og",
|
|
9507
10197
|
type: "boolean",
|
|
@@ -9525,7 +10215,12 @@ var exportCommand = {
|
|
|
9525
10215
|
{
|
|
9526
10216
|
name: "duration",
|
|
9527
10217
|
type: "string",
|
|
9528
|
-
description: "video / gif: seconds (default the timeline duration, else 5)."
|
|
10218
|
+
description: "video / gif: seconds (default the timeline duration, else 5; with --preset one seamless loop of the 3D photo motion)."
|
|
10219
|
+
},
|
|
10220
|
+
{
|
|
10221
|
+
name: "preset",
|
|
10222
|
+
type: "string",
|
|
10223
|
+
description: "video / gif: social preset — vertical (1080x1920), square (1080x1080), landscape (1920x1080) or story (1080x1920, max 15 s): size, 30 fps, one seamless loop, bitrate and a cover fit (the 3D photo fills the frame). The default --out becomes dist/video-<preset>.mp4."
|
|
9529
10224
|
},
|
|
9530
10225
|
{
|
|
9531
10226
|
name: "fps",
|
|
@@ -9567,7 +10262,7 @@ var exportCommand = {
|
|
|
9567
10262
|
];
|
|
9568
10263
|
if (!FORMATS.includes(format)) usage(`Unknown --format "${format}".`, `Use ${FORMATS.join(", ")}.`);
|
|
9569
10264
|
const outOpt = strOpt(options, "out");
|
|
9570
|
-
const render = () => import("./chunks/render-
|
|
10265
|
+
const render = () => import("./chunks/render-CCKciCgu.mjs");
|
|
9571
10266
|
if (format === "poster" || format === "video" || format === "gif") {
|
|
9572
10267
|
const { parseQuality, mediaFormatFromPath } = await render();
|
|
9573
10268
|
const quality = parseQuality(strOpt(options, "quality"));
|
|
@@ -9577,7 +10272,8 @@ var exportCommand = {
|
|
|
9577
10272
|
"png",
|
|
9578
10273
|
"jpeg"
|
|
9579
10274
|
].includes(image)) usage("--image must be webp, png or jpeg.");
|
|
9580
|
-
const
|
|
10275
|
+
const preset = format === "poster" ? void 0 : presetOpt(strOpt(options, "preset"));
|
|
10276
|
+
const out = projectPath(fs.root, outOpt ?? join(fs.root, "dist", format === "poster" ? `poster.${image === "jpeg" ? "jpg" : image}` : format === "gif" ? preset ? `animation-${preset}.gif` : "animation.gif" : preset ? `video-${preset}.mp4` : "video.webm"));
|
|
9581
10277
|
if (existsSync(out) && !confirmOrPlan(io, options, { overwrite: [out] }, () => `Overwrite ${out}`)) return;
|
|
9582
10278
|
const r = await render();
|
|
9583
10279
|
if (format === "poster") {
|
|
@@ -9613,6 +10309,7 @@ var exportCommand = {
|
|
|
9613
10309
|
fps: numOpt(options, "fps"),
|
|
9614
10310
|
quality,
|
|
9615
10311
|
transparent: boolOpt(options, "transparent"),
|
|
10312
|
+
preset,
|
|
9616
10313
|
timeoutMs: timeoutMs(options),
|
|
9617
10314
|
log
|
|
9618
10315
|
});
|
|
@@ -9625,8 +10322,10 @@ var exportCommand = {
|
|
|
9625
10322
|
duration: m.duration,
|
|
9626
10323
|
size: m.size,
|
|
9627
10324
|
bytes: m.bytes,
|
|
9628
|
-
ms: m.ms
|
|
9629
|
-
|
|
10325
|
+
ms: m.ms,
|
|
10326
|
+
...m.preset ? { preset: m.preset } : {},
|
|
10327
|
+
...m.notes ? { notes: m.notes } : {}
|
|
10328
|
+
}, () => [`${media.toUpperCase()} ${m.duration}s @ ${m.fps} fps (${m.frames} frames, ${m.size.width}x${m.size.height}, ${m.codec}, ${Math.round(m.bytes / 1024)} KB) → ${out}`, ...(m.notes ?? []).map((n) => ` ${n}`)].join("\n"));
|
|
9630
10329
|
}
|
|
9631
10330
|
const out = projectPath(fs.root, outOpt ?? join(fs.root, "dist", format));
|
|
9632
10331
|
const existing = dirNonEmpty(out);
|
|
@@ -9649,18 +10348,20 @@ var exportCommand = {
|
|
|
9649
10348
|
const err = e;
|
|
9650
10349
|
warnings.push(`No poster: ${err.message}${err.hint ? ` (${err.hint})` : ""} — the export works without it (no image before load / without WebGL).`);
|
|
9651
10350
|
}
|
|
10351
|
+
const runtimeChoice = strOpt(options, "runtime") ?? "auto";
|
|
10352
|
+
if (runtimeChoice !== "auto" && runtimeChoice !== "full") usage(`Unknown --runtime "${runtimeChoice}".`, "Use auto (default: the photo-only lite runtime for single-3D-photo scenes) or full.");
|
|
9652
10353
|
const runtime = { files: readRuntimeFiles(format) };
|
|
9653
|
-
const { buildExport } = await import("./chunks/export-
|
|
9654
|
-
const { version } = (await import("./chunks/package-
|
|
10354
|
+
const { buildExport } = await import("./chunks/export-BSOqVfPT.mjs").then((n) => n.n);
|
|
10355
|
+
const { version } = (await import("./chunks/package-DzXqX5Oe.mjs").then((n) => n.n)).default;
|
|
9655
10356
|
let exportFs = fs;
|
|
9656
10357
|
let exportLibrary = libraryProvider();
|
|
9657
10358
|
let optimizeReport;
|
|
9658
10359
|
let closeCodec;
|
|
9659
10360
|
if (boolOpt(options, "optimize")) {
|
|
9660
|
-
const { optimizedExportSources } = await import("./chunks/assets-
|
|
10361
|
+
const { optimizedExportSources } = await import("./chunks/assets-DdzHgVcn.mjs").then((n) => n.d);
|
|
9661
10362
|
let codec;
|
|
9662
|
-
if ((await import("./chunks/browser-
|
|
9663
|
-
const c = await (await import("./chunks/imageCodec-
|
|
10363
|
+
if ((await import("./chunks/browser-nFaRUETt.mjs")).findBrowser()) {
|
|
10364
|
+
const c = await (await import("./chunks/imageCodec-DXxqkEQA.mjs")).openImageCodec({ log });
|
|
9664
10365
|
codec = c.codec;
|
|
9665
10366
|
closeCodec = c.close;
|
|
9666
10367
|
} else warnings.push("--optimize: no Chrome found, textures were not resized (geometry was compressed).");
|
|
@@ -9682,6 +10383,7 @@ var exportCommand = {
|
|
|
9682
10383
|
integrity: !boolOpt(options, "no-integrity"),
|
|
9683
10384
|
extras: !boolOpt(options, "no-extras"),
|
|
9684
10385
|
pruneRuntime: boolOpt(options, "prune-runtime"),
|
|
10386
|
+
runtimeChoice,
|
|
9685
10387
|
version
|
|
9686
10388
|
}).finally(() => closeCodec?.());
|
|
9687
10389
|
const optimized = optimizeReport?.();
|
|
@@ -9707,6 +10409,8 @@ var exportCommand = {
|
|
|
9707
10409
|
totalKb: r.totalKb,
|
|
9708
10410
|
sizes: r.sizes,
|
|
9709
10411
|
page: r.page,
|
|
10412
|
+
runtime: r.runtime,
|
|
10413
|
+
...r.runtimeReasons ? { runtimeReasons: r.runtimeReasons } : {},
|
|
9710
10414
|
...optimized ? { optimized } : {},
|
|
9711
10415
|
credits: r.credits,
|
|
9712
10416
|
issues: r.issues,
|
|
@@ -9714,7 +10418,7 @@ var exportCommand = {
|
|
|
9714
10418
|
...warnings.length ? { warnings } : {}
|
|
9715
10419
|
}, () => [
|
|
9716
10420
|
`Exported ${format} → ${out} (folder ${r.folderKb} KB, ${written.length} files)`,
|
|
9717
|
-
`Page weight: ${r.pageKb} KB${r.pageKbGzip !== void 0 ? ` (${r.pageKbGzip} KB gzipped)` : ""} — runtime ${r.page.runtimeKb} KB (${r.page.runtimeFiles.length} files; ${r.page.skippedChunks.length} lazy chunks this scene never loads${r.page.pruned ? ", left out" : ""}) + scene, assets, scripts, poster.`,
|
|
10421
|
+
r.runtime === "photo-lite" ? `Page weight: ${r.pageKb} KB${r.pageKbGzip !== void 0 ? ` (${r.pageKbGzip} KB gzipped)` : ""} — photo-only lite runtime ${r.page.runtimeKb} KB (agent3d-photo.js, no three.js) + scene, assets, poster.` : `Page weight: ${r.pageKb} KB${r.pageKbGzip !== void 0 ? ` (${r.pageKbGzip} KB gzipped)` : ""} — runtime ${r.page.runtimeKb} KB (${r.page.runtimeFiles.length} files; ${r.page.skippedChunks.length} lazy chunks this scene never loads${r.page.pruned ? ", left out" : ""}) + scene, assets, scripts, poster.`,
|
|
9718
10422
|
`Open: ${entry}`,
|
|
9719
10423
|
...optimized ? [`Optimised asset copies: ${optimized.beforeKb} → ${optimized.afterKb} KB (saved ${optimized.savedKb} KB; the project is unchanged).`] : [],
|
|
9720
10424
|
...format === "zip" ? [] : [
|
|
@@ -9749,7 +10453,7 @@ function issuesLine(issues) {
|
|
|
9749
10453
|
return issues.map((i) => ` ${i.severity === "error" ? "✗" : i.severity === "warning" ? "!" : "·"} ${i.path}: ${i.message}${i.hint ? ` (${i.hint})` : ""}`).join("\n");
|
|
9750
10454
|
}
|
|
9751
10455
|
async function runPatch(io, options, fs, ops, human, opts = {}) {
|
|
9752
|
-
const { patchScene, replacedCollections, getScene } = await import("./chunks/scene-
|
|
10456
|
+
const { patchScene, replacedCollections, getScene } = await import("./chunks/scene-DSjsun-3.mjs").then((n) => n.a);
|
|
9753
10457
|
const dry = await patchScene(fs, ops, { dryRun: true });
|
|
9754
10458
|
if (errorsOf(dry.issues).length) throw validationError(dry.issues, dry.plan);
|
|
9755
10459
|
if (dry.plan.empty) return printResult(io, {
|
|
@@ -9843,7 +10547,7 @@ var sceneCommand = {
|
|
|
9843
10547
|
}
|
|
9844
10548
|
const fs = projectFs(options);
|
|
9845
10549
|
if (action === "get") {
|
|
9846
|
-
const { getScene } = await import("./chunks/scene-
|
|
10550
|
+
const { getScene } = await import("./chunks/scene-DSjsun-3.mjs").then((n) => n.a);
|
|
9847
10551
|
const scene = await getScene(fs);
|
|
9848
10552
|
const path = strOpt(options, "path");
|
|
9849
10553
|
if (!path) return printResult(io, scene, () => JSON.stringify(scene, null, 2));
|
|
@@ -9856,13 +10560,13 @@ var sceneCommand = {
|
|
|
9856
10560
|
}, () => JSON.stringify(value, null, 2));
|
|
9857
10561
|
}
|
|
9858
10562
|
if (action === "summary") {
|
|
9859
|
-
const [{ getScene, summarizeScene }] = await Promise.all([import("./chunks/scene-
|
|
10563
|
+
const [{ getScene, summarizeScene }] = await Promise.all([import("./chunks/scene-DSjsun-3.mjs").then((n) => n.a)]);
|
|
9860
10564
|
const summary = summarizeScene(await getScene(fs));
|
|
9861
10565
|
return printResult(io, summary, () => JSON.stringify(summary, null, 2));
|
|
9862
10566
|
}
|
|
9863
10567
|
if (action === "apply") {
|
|
9864
10568
|
const next = jsonInput(options, rest, "the scene", "--file scene.json");
|
|
9865
|
-
const { applyScene } = await import("./chunks/scene-
|
|
10569
|
+
const { applyScene } = await import("./chunks/scene-DSjsun-3.mjs").then((n) => n.a);
|
|
9866
10570
|
const dry = await applyScene(fs, next, { dryRun: true });
|
|
9867
10571
|
if (errorsOf(dry.issues).length) throw validationError(dry.issues, dry.plan);
|
|
9868
10572
|
if (dry.plan.empty) return printResult(io, {
|
|
@@ -10066,7 +10770,7 @@ var objectCommand = {
|
|
|
10066
10770
|
const fs = projectFs(options);
|
|
10067
10771
|
const index = numOpt(options, "index");
|
|
10068
10772
|
if (action === "list" || action === "get") {
|
|
10069
|
-
const { listObjects, getObject } = await import("./chunks/objects-
|
|
10773
|
+
const { listObjects, getObject } = await import("./chunks/objects-DvzrcVmK.mjs").then((n) => n.r);
|
|
10070
10774
|
if (action === "list") {
|
|
10071
10775
|
const rows = await listObjects(fs);
|
|
10072
10776
|
return printResult(io, { objects: rows }, () => table(rows.map((r) => ({
|
|
@@ -10207,7 +10911,7 @@ var timelineCommand = {
|
|
|
10207
10911
|
const [action = "get", ...rest] = positionals;
|
|
10208
10912
|
const fs = projectFs(options);
|
|
10209
10913
|
if (action === "get") {
|
|
10210
|
-
const { getScene } = await import("./chunks/scene-
|
|
10914
|
+
const { getScene } = await import("./chunks/scene-DSjsun-3.mjs").then((n) => n.a);
|
|
10211
10915
|
const timeline = (await getScene(fs)).timeline ?? null;
|
|
10212
10916
|
return printResult(io, { timeline }, () => timeline ? JSON.stringify(timeline, null, 2) : "No timeline.");
|
|
10213
10917
|
}
|
|
@@ -10218,7 +10922,7 @@ var timelineCommand = {
|
|
|
10218
10922
|
value: jsonInput(options, rest, "the timeline", "--file timeline.json with {\"duration\":4,\"loop\":true,\"tracks\":[]}")
|
|
10219
10923
|
}], "Replace the timeline", { destructive: true });
|
|
10220
10924
|
const ops = [];
|
|
10221
|
-
const { getScene } = await import("./chunks/scene-
|
|
10925
|
+
const { getScene } = await import("./chunks/scene-DSjsun-3.mjs").then((n) => n.a);
|
|
10222
10926
|
const has = !!(await getScene(fs)).timeline;
|
|
10223
10927
|
const duration = numOpt(options, "duration");
|
|
10224
10928
|
const loop = strOpt(options, "loop");
|
|
@@ -10289,7 +10993,7 @@ function runtimeIssueToIssue(i) {
|
|
|
10289
10993
|
function nodeHost(fs) {
|
|
10290
10994
|
return {
|
|
10291
10995
|
...fs ? { async render(opts) {
|
|
10292
|
-
const { renderProject } = await import("./chunks/render-
|
|
10996
|
+
const { renderProject } = await import("./chunks/render-CCKciCgu.mjs");
|
|
10293
10997
|
const r = await renderProject({
|
|
10294
10998
|
projectDir: fs.root,
|
|
10295
10999
|
frames: opts.frames?.length ? opts.frames.join(",") : void 0,
|
|
@@ -10297,7 +11001,7 @@ function nodeHost(fs) {
|
|
|
10297
11001
|
size: opts.size,
|
|
10298
11002
|
sheet: opts.sheet ?? true,
|
|
10299
11003
|
outDir: opts.out ? fs.resolve(opts.out) : void 0,
|
|
10300
|
-
input: opts.input ? (await import("./chunks/render-
|
|
11004
|
+
input: opts.input ? (await import("./chunks/render-CCKciCgu.mjs")).parseInputScript(opts.input) : void 0,
|
|
10301
11005
|
previewWidth: opts.previewWidth,
|
|
10302
11006
|
isolate: opts.isolate,
|
|
10303
11007
|
bg: opts.bg,
|
|
@@ -10321,7 +11025,7 @@ function nodeHost(fs) {
|
|
|
10321
11025
|
};
|
|
10322
11026
|
} } : {},
|
|
10323
11027
|
...fs ? { async media(opts) {
|
|
10324
|
-
const render = await import("./chunks/render-
|
|
11028
|
+
const render = await import("./chunks/render-CCKciCgu.mjs");
|
|
10325
11029
|
const log = (m) => void process.stderr.write(`${m}\n`);
|
|
10326
11030
|
if (opts.format === "poster") {
|
|
10327
11031
|
const r = await render.renderPoster({
|
|
@@ -10369,6 +11073,7 @@ function nodeHost(fs) {
|
|
|
10369
11073
|
fps: opts.fps,
|
|
10370
11074
|
quality: opts.quality,
|
|
10371
11075
|
transparent: opts.transparent,
|
|
11076
|
+
preset: opts.preset,
|
|
10372
11077
|
write: false,
|
|
10373
11078
|
log
|
|
10374
11079
|
});
|
|
@@ -10381,7 +11086,8 @@ function nodeHost(fs) {
|
|
|
10381
11086
|
size: {
|
|
10382
11087
|
width: r.size.width,
|
|
10383
11088
|
height: r.size.height
|
|
10384
|
-
}
|
|
11089
|
+
},
|
|
11090
|
+
...r.notes ? { notes: r.notes } : {}
|
|
10385
11091
|
};
|
|
10386
11092
|
}
|
|
10387
11093
|
const r = await render.renderVideo({
|
|
@@ -10391,6 +11097,7 @@ function nodeHost(fs) {
|
|
|
10391
11097
|
fps: opts.fps,
|
|
10392
11098
|
format: opts.video,
|
|
10393
11099
|
quality: opts.quality,
|
|
11100
|
+
preset: opts.preset,
|
|
10394
11101
|
log
|
|
10395
11102
|
});
|
|
10396
11103
|
return {
|
|
@@ -10402,7 +11109,8 @@ function nodeHost(fs) {
|
|
|
10402
11109
|
size: {
|
|
10403
11110
|
width: r.size.width,
|
|
10404
11111
|
height: r.size.height
|
|
10405
|
-
}
|
|
11112
|
+
},
|
|
11113
|
+
...r.notes ? { notes: r.notes } : {}
|
|
10406
11114
|
};
|
|
10407
11115
|
} } : {},
|
|
10408
11116
|
runtimeFiles: async (format) => readRuntimeFiles(format),
|
|
@@ -10413,13 +11121,17 @@ function nodeHost(fs) {
|
|
|
10413
11121
|
},
|
|
10414
11122
|
inflate: (data) => new Uint8Array(inflateRawSync(data)),
|
|
10415
11123
|
async withImageCodec(fn) {
|
|
10416
|
-
const { withImageCodec } = await import("./chunks/imageCodec-
|
|
11124
|
+
const { withImageCodec } = await import("./chunks/imageCodec-DXxqkEQA.mjs");
|
|
10417
11125
|
return withImageCodec(fn, { log: (m) => void process.stderr.write(`${m}\n`) });
|
|
10418
11126
|
},
|
|
10419
11127
|
async withDepthEstimator(fn) {
|
|
10420
|
-
const { withDepthEstimator } = await import("./chunks/depth-
|
|
11128
|
+
const { withDepthEstimator } = await import("./chunks/depth-Bf7cHwod.mjs");
|
|
10421
11129
|
return withDepthEstimator(fn, { log: (m) => void process.stderr.write(`${m}\n`) });
|
|
10422
11130
|
},
|
|
11131
|
+
async withPixelCodec(fn) {
|
|
11132
|
+
const { withPixelCodec } = await import("./chunks/imageCodec-DXxqkEQA.mjs");
|
|
11133
|
+
return withPixelCodec(fn, { log: (m) => void process.stderr.write(`${m}\n`) });
|
|
11134
|
+
},
|
|
10423
11135
|
deflate: (data) => new Uint8Array(deflateSync(data)),
|
|
10424
11136
|
readLocalFile: async (path) => new Uint8Array(readFileSync(resolve(path)))
|
|
10425
11137
|
};
|
|
@@ -10432,7 +11144,7 @@ function toolContext(fs) {
|
|
|
10432
11144
|
};
|
|
10433
11145
|
}
|
|
10434
11146
|
async function listTools(opts = {}) {
|
|
10435
|
-
const { listAiTools } = await import("./chunks/tools-
|
|
11147
|
+
const { listAiTools } = await import("./chunks/tools-Vs74Xopx.mjs");
|
|
10436
11148
|
const host = nodeHost(null);
|
|
10437
11149
|
return listAiTools(opts.render === false ? host : {
|
|
10438
11150
|
...host,
|
|
@@ -10445,7 +11157,7 @@ async function listTools(opts = {}) {
|
|
|
10445
11157
|
}));
|
|
10446
11158
|
}
|
|
10447
11159
|
async function callTool(fs, name, input) {
|
|
10448
|
-
const { callAiTool } = await import("./chunks/tools-
|
|
11160
|
+
const { callAiTool } = await import("./chunks/tools-Vs74Xopx.mjs");
|
|
10449
11161
|
return callAiTool(toolContext(fs), name, input);
|
|
10450
11162
|
}
|
|
10451
11163
|
function previewImages(name, result, root = ".") {
|
|
@@ -11240,7 +11952,7 @@ var mcpCommand = {
|
|
|
11240
11952
|
const dir = projectDir(options);
|
|
11241
11953
|
const fs = new NodeFs(dir);
|
|
11242
11954
|
const log = (msg) => void process.stderr.write(`${msg}\n`);
|
|
11243
|
-
const { createMcpServer, serveStdio } = await import("./chunks/server-
|
|
11955
|
+
const { createMcpServer, serveStdio } = await import("./chunks/server-CLvLORgA.mjs");
|
|
11244
11956
|
const server = createMcpServer(mcpOptions(fs, readOnly, await listTools()));
|
|
11245
11957
|
log(`[agent3d mcp] project ${dir}${readOnly ? " (read-only)" : ""} on stdio — ${server.toolNames().length} tools`);
|
|
11246
11958
|
await serveStdio(server, process.stdin, (line) => process.stdout.write(line + "\n"), log);
|
|
@@ -11272,7 +11984,7 @@ function mcpOptions(fs, readOnly, tools) {
|
|
|
11272
11984
|
description: "Compact outline of the scene: objects, lights, camera, timeline, scripts.",
|
|
11273
11985
|
mimeType: "application/json",
|
|
11274
11986
|
read: async () => {
|
|
11275
|
-
const { getScene, summarizeScene } = await import("./chunks/scene-
|
|
11987
|
+
const { getScene, summarizeScene } = await import("./chunks/scene-DSjsun-3.mjs").then((n) => n.a);
|
|
11276
11988
|
return summarizeScene(await getScene(fs));
|
|
11277
11989
|
}
|
|
11278
11990
|
},
|
|
@@ -11425,4 +12137,4 @@ main(process.argv.slice(2)).then(exitWhenFlushed, (err) => {
|
|
|
11425
12137
|
console.error(err);
|
|
11426
12138
|
exitWhenFlushed(1);
|
|
11427
12139
|
});
|
|
11428
|
-
export {
|
|
12140
|
+
export { GENERATORS as A, validationError$1 as B, validateScene as C, isLibraryRef as D, findLibraryAsset as E, KB as F, ortDir as G, normalizePath as H, OpsError as I, CliError as J, runtimeBuilt as K, hasErrors as L, parseAspect$1 as M, isValidId as N, libraryId as O, slugify as P, nowIso as R, TARGET_KINDS$1 as S, postfxCost as T, ORT_FILES as U, writeJson as V, libraryDir as W, toCliError as Y, readSceneFile as _, SOCIAL_PRESET_IDS as a, DEFAULT_BUDGET_KB as b, parseSocialPreset as c, listTemplates as d, ASSET_MANIFEST_FILE as f, loadProject as g, createProject as h, SOCIAL_PRESETS as i, catalogEntry as j, CATALOG as k, socialDuration as l, SCENE_FILE as m, sendText as n, coverScene as o, MANIFEST_FILE as p, runtimeDir as q, startLocalServer as r, imageHeaderSize as s, mimeOf as t, findTemplate as u, saveScene as v, expandPostFx as w, MATERIAL_TEXTURE_SLOTS as x, DEFAULT_ASPECT as y, readJsonOr as z };
|