@nodetool-ai/timeline 0.8.18 → 0.8.19

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.
Files changed (94) hide show
  1. package/dist/.nodetool-build-stamp +1 -1
  2. package/dist/animation/custom.d.ts.map +1 -1
  3. package/dist/animation/custom.js +35 -0
  4. package/dist/animation/custom.js.map +1 -1
  5. package/dist/animation/sample.d.ts +14 -0
  6. package/dist/animation/sample.d.ts.map +1 -1
  7. package/dist/animation/sample.js +22 -1
  8. package/dist/animation/sample.js.map +1 -1
  9. package/dist/animation/types.d.ts +8 -1
  10. package/dist/animation/types.d.ts.map +1 -1
  11. package/dist/animation/types.js +31 -3
  12. package/dist/animation/types.js.map +1 -1
  13. package/dist/authoredStyles.d.ts +7 -1
  14. package/dist/authoredStyles.d.ts.map +1 -1
  15. package/dist/authoredStyles.js +6 -1
  16. package/dist/authoredStyles.js.map +1 -1
  17. package/dist/finish-storyboard.d.ts.map +1 -1
  18. package/dist/finish-storyboard.js +6 -1
  19. package/dist/finish-storyboard.js.map +1 -1
  20. package/dist/index.d.ts +5 -0
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +5 -0
  23. package/dist/index.js.map +1 -1
  24. package/dist/keyframes.d.ts +12 -2
  25. package/dist/keyframes.d.ts.map +1 -1
  26. package/dist/keyframes.js +24 -1
  27. package/dist/keyframes.js.map +1 -1
  28. package/dist/model3d.d.ts +132 -8
  29. package/dist/model3d.d.ts.map +1 -1
  30. package/dist/model3d.js +230 -7
  31. package/dist/model3d.js.map +1 -1
  32. package/dist/model3dBake.d.ts +41 -11
  33. package/dist/model3dBake.d.ts.map +1 -1
  34. package/dist/model3dBake.js +58 -21
  35. package/dist/model3dBake.js.map +1 -1
  36. package/dist/model3dBlockout.d.ts +62 -0
  37. package/dist/model3dBlockout.d.ts.map +1 -0
  38. package/dist/model3dBlockout.js +59 -0
  39. package/dist/model3dBlockout.js.map +1 -0
  40. package/dist/model3dCameraDescription.d.ts +27 -0
  41. package/dist/model3dCameraDescription.d.ts.map +1 -0
  42. package/dist/model3dCameraDescription.js +171 -0
  43. package/dist/model3dCameraDescription.js.map +1 -0
  44. package/dist/model3dCameraKeys.d.ts +47 -0
  45. package/dist/model3dCameraKeys.d.ts.map +1 -0
  46. package/dist/model3dCameraKeys.js +156 -0
  47. package/dist/model3dCameraKeys.js.map +1 -0
  48. package/dist/model3dCameraMoves.d.ts +97 -0
  49. package/dist/model3dCameraMoves.d.ts.map +1 -0
  50. package/dist/model3dCameraMoves.js +329 -0
  51. package/dist/model3dCameraMoves.js.map +1 -0
  52. package/dist/model3dReference.d.ts +75 -0
  53. package/dist/model3dReference.d.ts.map +1 -0
  54. package/dist/model3dReference.js +100 -0
  55. package/dist/model3dReference.js.map +1 -0
  56. package/dist/ops/apply.d.ts.map +1 -1
  57. package/dist/ops/apply.js +168 -2
  58. package/dist/ops/apply.js.map +1 -1
  59. package/dist/ops/op.d.ts +35 -2
  60. package/dist/ops/op.d.ts.map +1 -1
  61. package/dist/ops/op.js +2 -0
  62. package/dist/ops/op.js.map +1 -1
  63. package/dist/ops/parse.d.ts.map +1 -1
  64. package/dist/ops/parse.js +8 -0
  65. package/dist/ops/parse.js.map +1 -1
  66. package/dist/ops/types.d.ts +22 -0
  67. package/dist/ops/types.d.ts.map +1 -1
  68. package/dist/render/index.d.ts +1 -0
  69. package/dist/render/index.d.ts.map +1 -1
  70. package/dist/render/index.js +1 -0
  71. package/dist/render/index.js.map +1 -1
  72. package/dist/render/model3dReferenceSamples.d.ts +25 -0
  73. package/dist/render/model3dReferenceSamples.d.ts.map +1 -0
  74. package/dist/render/model3dReferenceSamples.js +25 -0
  75. package/dist/render/model3dReferenceSamples.js.map +1 -0
  76. package/dist/render/sceneModel.d.ts +1 -1
  77. package/dist/render/sceneModel.d.ts.map +1 -1
  78. package/dist/render/sceneModel.js +10 -5
  79. package/dist/render/sceneModel.js.map +1 -1
  80. package/dist/scene.d.ts +1 -0
  81. package/dist/scene.d.ts.map +1 -1
  82. package/dist/scene.js +1 -0
  83. package/dist/scene.js.map +1 -1
  84. package/dist/shotLink.d.ts +35 -0
  85. package/dist/shotLink.d.ts.map +1 -1
  86. package/dist/shotLink.js +100 -0
  87. package/dist/shotLink.js.map +1 -1
  88. package/dist/testing/ops.d.ts.map +1 -1
  89. package/dist/testing/ops.js +49 -2
  90. package/dist/testing/ops.js.map +1 -1
  91. package/dist/types.d.ts +30 -2
  92. package/dist/types.d.ts.map +1 -1
  93. package/dist/types.js.map +1 -1
  94. package/package.json +5 -5
@@ -0,0 +1,329 @@
1
+ /**
2
+ * Camera move presets for a `model3d` clip's free camera.
3
+ *
4
+ * A move is a pure function from a start pose to the pose at each instant of
5
+ * the move. `model3dCameraMoveCurves` turns one into keyframe curves on the
6
+ * free camera channels, in the curve shape a custom animation stores, and
7
+ * `applyModel3DCameraMove` writes them into the clip's keyframe animation.
8
+ *
9
+ * The channels are additive, so every curve value is an offset from the start
10
+ * pose: 0 at the start of the move.
11
+ */
12
+ import { ease } from "./animation/easing.js";
13
+ import { keyframeValueAt, replaceKeyframeSpan } from "./keyframes.js";
14
+ import { IDENTITY_MODEL3D_CAMERA_CHANNELS, MODEL3D_CAMERA_PROPERTIES, model3dFreeCameraBasis, resolveModel3DCamera, model3dFreeCameraPose } from "./model3d.js";
15
+ const POSITION = ["cameraPosX", "cameraPosY", "cameraPosZ"];
16
+ const TARGET = ["cameraTargetX", "cameraTargetY", "cameraTargetZ"];
17
+ export const MODEL3D_CAMERA_MOVES = [
18
+ {
19
+ id: "pan",
20
+ label: "Pan",
21
+ unit: "degrees",
22
+ defaultAmount: 30,
23
+ describe: "Turns the camera to its right around the vertical axis. The eye stays put.",
24
+ properties: ["cameraTargetX", "cameraTargetZ"],
25
+ sampled: true
26
+ },
27
+ {
28
+ id: "tilt",
29
+ label: "Tilt",
30
+ unit: "degrees",
31
+ defaultAmount: 15,
32
+ describe: "Turns the camera upward. The eye stays put.",
33
+ properties: TARGET,
34
+ sampled: true
35
+ },
36
+ {
37
+ id: "orbit",
38
+ label: "Orbit",
39
+ unit: "degrees",
40
+ defaultAmount: 45,
41
+ describe: "Moves the eye to the camera's right on a circle around the target.",
42
+ properties: ["cameraPosX", "cameraPosZ"],
43
+ sampled: true
44
+ },
45
+ {
46
+ id: "pushIn",
47
+ label: "Push in",
48
+ unit: "distance",
49
+ defaultAmount: 0.3,
50
+ describe: "Moves the eye toward the target. A negative amount pulls out.",
51
+ properties: POSITION,
52
+ sampled: false
53
+ },
54
+ {
55
+ id: "truck",
56
+ label: "Truck",
57
+ unit: "distance",
58
+ defaultAmount: 0.25,
59
+ describe: "Slides the eye and the target to the camera's right.",
60
+ properties: ["cameraPosX", "cameraPosZ", "cameraTargetX", "cameraTargetZ"],
61
+ sampled: false
62
+ },
63
+ {
64
+ id: "crane",
65
+ label: "Crane",
66
+ unit: "distance",
67
+ defaultAmount: 0.25,
68
+ describe: "Raises the eye while it keeps looking at the target.",
69
+ properties: ["cameraPosY"],
70
+ sampled: false
71
+ },
72
+ {
73
+ id: "pedestal",
74
+ label: "Pedestal",
75
+ unit: "distance",
76
+ defaultAmount: 0.25,
77
+ describe: "Raises the eye and the target together.",
78
+ properties: ["cameraPosY", "cameraTargetY"],
79
+ sampled: false
80
+ },
81
+ {
82
+ id: "zoom",
83
+ label: "Zoom",
84
+ unit: "factor",
85
+ defaultAmount: 1.5,
86
+ describe: "Multiplies the focal length. Above 1 zooms in, below 1 zooms out.",
87
+ properties: ["cameraFov"],
88
+ sampled: true
89
+ },
90
+ {
91
+ id: "dollyZoom",
92
+ label: "Dolly zoom",
93
+ unit: "distance",
94
+ defaultAmount: 0.4,
95
+ describe: "Moves the eye toward the target and widens the lens so the subject at the target keeps its size.",
96
+ properties: [...POSITION, "cameraFov"],
97
+ sampled: true
98
+ },
99
+ {
100
+ id: "dutch",
101
+ label: "Dutch",
102
+ unit: "degrees",
103
+ defaultAmount: 15,
104
+ describe: "Rolls the camera so the horizon turns clockwise in the picture.",
105
+ properties: ["cameraRoll"],
106
+ sampled: false
107
+ }
108
+ ];
109
+ /** How many segments a sampled move is cut into by default. */
110
+ export const MODEL3D_CAMERA_MOVE_SAMPLES = 24;
111
+ const DEG = Math.PI / 180;
112
+ /** A dolly never reaches the target: the eye stops at 5% of the distance. */
113
+ export const MODEL3D_MAX_DOLLY_FRACTION = 0.95;
114
+ const MAX_DOLLY_FRACTION = MODEL3D_MAX_DOLLY_FRACTION;
115
+ const MAX_TILT_ELEVATION_DEG = 89;
116
+ const MIN_FOV_DEG = 1;
117
+ const MAX_FOV_DEG = 170;
118
+ export function model3dCameraMoveSpec(move) {
119
+ const spec = MODEL3D_CAMERA_MOVES.find((entry) => entry.id === move);
120
+ if (!spec) {
121
+ throw new Error(`Unknown camera move "${String(move)}". Moves: ${MODEL3D_CAMERA_MOVES.map((entry) => entry.id).join(", ")}`);
122
+ }
123
+ return spec;
124
+ }
125
+ function add(a, b) {
126
+ return [a[0] + b[0], a[1] + b[1], a[2] + b[2]];
127
+ }
128
+ function sub(a, b) {
129
+ return [a[0] - b[0], a[1] - b[1], a[2] - b[2]];
130
+ }
131
+ function scaled(v, s) {
132
+ return [v[0] * s, v[1] * s, v[2] * s];
133
+ }
134
+ /** Rotate `v` around world +Y by `deg`, counter-clockwise seen from above. */
135
+ function rotateY(v, deg) {
136
+ const cos = Math.cos(deg * DEG);
137
+ const sin = Math.sin(deg * DEG);
138
+ return [v[0] * cos + v[2] * sin, v[1], -v[0] * sin + v[2] * cos];
139
+ }
140
+ function clampFov(fovDeg) {
141
+ return Math.min(Math.max(fovDeg, MIN_FOV_DEG), MAX_FOV_DEG);
142
+ }
143
+ /**
144
+ * The pose `progress` of the way through a move, 0 at the start and 1 at the
145
+ * end. `amount` defaults to the move's `defaultAmount`.
146
+ *
147
+ * Directions are the camera's own at the start of the move, with roll left
148
+ * out: "right" is horizontal and "up" is world +Y.
149
+ */
150
+ export function model3dCameraMovePoseAt(move, start, progress, amount) {
151
+ const spec = model3dCameraMoveSpec(move);
152
+ const total = amount ?? spec.defaultAmount;
153
+ const pose = {
154
+ position: [...start.position],
155
+ target: [...start.target],
156
+ rollDeg: start.rollDeg,
157
+ fovDeg: start.fovDeg
158
+ };
159
+ const toTarget = sub(start.target, start.position);
160
+ const distance = Math.hypot(toTarget[0], toTarget[1], toTarget[2]);
161
+ const basis = model3dFreeCameraBasis(start.position, start.target, 0);
162
+ switch (move) {
163
+ case "pan":
164
+ pose.target = add(start.position, rotateY(toTarget, -total * progress));
165
+ break;
166
+ case "tilt": {
167
+ const elevation = Math.asin(basis.forward[1]) / DEG;
168
+ const end = Math.min(Math.max(elevation + total, -MAX_TILT_ELEVATION_DEG), MAX_TILT_ELEVATION_DEG);
169
+ const angle = (end - elevation) * progress * DEG;
170
+ const forward = add(scaled(basis.forward, Math.cos(angle)), scaled(basis.up, Math.sin(angle)));
171
+ pose.target = add(start.position, scaled(forward, distance));
172
+ break;
173
+ }
174
+ case "orbit":
175
+ pose.position = add(start.target, rotateY(scaled(toTarget, -1), total * progress));
176
+ break;
177
+ case "pushIn": {
178
+ const fraction = Math.min(total, MAX_DOLLY_FRACTION) * progress;
179
+ pose.position = add(start.position, scaled(toTarget, fraction));
180
+ break;
181
+ }
182
+ case "truck": {
183
+ const slide = scaled(basis.right, total * distance * progress);
184
+ pose.position = add(start.position, slide);
185
+ pose.target = add(start.target, slide);
186
+ break;
187
+ }
188
+ case "crane":
189
+ pose.position[1] += total * distance * progress;
190
+ break;
191
+ case "pedestal":
192
+ pose.position[1] += total * distance * progress;
193
+ pose.target[1] += total * distance * progress;
194
+ break;
195
+ case "zoom": {
196
+ const factor = Math.max(total, 1e-3) ** progress;
197
+ pose.fovDeg = clampFov((2 * Math.atan(Math.tan((start.fovDeg * DEG) / 2) / factor)) / DEG);
198
+ break;
199
+ }
200
+ case "dollyZoom": {
201
+ const fraction = Math.min(total, MAX_DOLLY_FRACTION) * progress;
202
+ pose.position = add(start.position, scaled(toTarget, fraction));
203
+ // distance * tan(fov / 2) is the half height of the frame at the target.
204
+ pose.fovDeg = clampFov((2 * Math.atan(Math.tan((start.fovDeg * DEG) / 2) / (1 - fraction))) /
205
+ DEG);
206
+ break;
207
+ }
208
+ case "dutch":
209
+ pose.rollDeg = start.rollDeg + total * progress;
210
+ break;
211
+ }
212
+ return pose;
213
+ }
214
+ function channelValue(property, pose, start) {
215
+ switch (property) {
216
+ case "cameraPosX":
217
+ return pose.position[0] - start.position[0];
218
+ case "cameraPosY":
219
+ return pose.position[1] - start.position[1];
220
+ case "cameraPosZ":
221
+ return pose.position[2] - start.position[2];
222
+ case "cameraTargetX":
223
+ return pose.target[0] - start.target[0];
224
+ case "cameraTargetY":
225
+ return pose.target[1] - start.target[1];
226
+ case "cameraTargetZ":
227
+ return pose.target[2] - start.target[2];
228
+ case "cameraRoll":
229
+ return pose.rollDeg - start.rollDeg;
230
+ case "cameraFov":
231
+ return pose.fovDeg - start.fovDeg;
232
+ default:
233
+ return 0;
234
+ }
235
+ }
236
+ /**
237
+ * The curves of one move, in the shape `CustomClipAnimation.curves` stores:
238
+ * `t` runs 0..1 over the move and every value is an offset from the start
239
+ * pose, 0 at `t` 0.
240
+ *
241
+ * A straight move is two keyframes, with `easing` on the second, which is the
242
+ * keyframe that eases the segment arriving at it. A sampled move is evenly
243
+ * spaced linear keyframes with the easing folded into their values, because an
244
+ * arc cut into eased chords would not follow the arc.
245
+ */
246
+ export function model3dCameraMoveCurves(move, start, options = {}) {
247
+ const spec = model3dCameraMoveSpec(move);
248
+ const easing = options.easing ?? "linear";
249
+ if (!spec.sampled) {
250
+ const end = model3dCameraMovePoseAt(move, start, 1, options.amount);
251
+ return spec.properties.map((property) => ({
252
+ property,
253
+ keyframes: [
254
+ { t: 0, value: 0 },
255
+ easing === "linear"
256
+ ? { t: 1, value: channelValue(property, end, start) }
257
+ : { t: 1, value: channelValue(property, end, start), easing }
258
+ ]
259
+ }));
260
+ }
261
+ const segments = Math.max(1, Math.round(options.samples ?? MODEL3D_CAMERA_MOVE_SAMPLES));
262
+ const poses = [];
263
+ for (let i = 0; i <= segments; i += 1) {
264
+ poses.push(model3dCameraMovePoseAt(move, start, ease(easing, i / segments), options.amount));
265
+ }
266
+ return spec.properties.map((property) => ({
267
+ property,
268
+ keyframes: poses.map((pose, i) => ({
269
+ t: i / segments,
270
+ value: channelValue(property, pose, start)
271
+ }))
272
+ }));
273
+ }
274
+ /**
275
+ * The clip's free camera at a clip-relative time, folded with its keyframe
276
+ * curves. Preset animations on the clip are not read: they add onto whatever
277
+ * the keyframes say, before and after a move alike.
278
+ */
279
+ export function model3dKeyframedFreeCameraPose(clip, atMs) {
280
+ const style = clip.model3dStyle;
281
+ if (!style) {
282
+ throw new Error(`Clip "${clip.name}" has no model3dStyle, so it has no camera.`);
283
+ }
284
+ const channels = { ...IDENTITY_MODEL3D_CAMERA_CHANNELS };
285
+ for (const property of MODEL3D_CAMERA_PROPERTIES) {
286
+ channels[property] = keyframeValueAt(clip, property, atMs);
287
+ }
288
+ return model3dFreeCameraPose(resolveModel3DCamera(style, channels));
289
+ }
290
+ /**
291
+ * Write a camera move into the clip's keyframe animation and return the
292
+ * clip's new animation list, the way `setKeyframe` does.
293
+ *
294
+ * The move starts from the camera the clip's keyframes give at `startMs`, and
295
+ * each written value is the channel's value there plus the move's offset, so
296
+ * the picture does not jump at the start. Keyframes the move's channels
297
+ * already had inside its span are replaced. The clip has to be in `free` mode:
298
+ * convert an orbit camera with `orbitCameraToFree` first.
299
+ */
300
+ export function applyModel3DCameraMove(clip, move, options = {}) {
301
+ const mode = clip.model3dStyle?.camera.mode;
302
+ if (mode !== "free") {
303
+ throw new Error(`Camera move "${move}" needs a free camera, and clip "${clip.name}" ` +
304
+ `has ${mode === undefined ? "no camera" : `a ${mode} camera`}. ` +
305
+ `Set model3dStyle.camera.mode to "free" first.`);
306
+ }
307
+ const startMs = Math.min(Math.max(options.startMs ?? 0, 0), clip.durationMs);
308
+ const endMs = Math.min(startMs + Math.max(options.durationMs ?? clip.durationMs - startMs, 0), clip.durationMs);
309
+ if (!(endMs > startMs)) {
310
+ throw new Error(`Camera move "${move}" has no time to run: it starts at ${startMs} ms ` +
311
+ `and clip "${clip.name}" is ${clip.durationMs} ms long.`);
312
+ }
313
+ const start = model3dKeyframedFreeCameraPose(clip, startMs);
314
+ let working = clip;
315
+ for (const curve of model3dCameraMoveCurves(move, start, options)) {
316
+ const property = curve.property;
317
+ const base = keyframeValueAt(clip, property, startMs);
318
+ working = {
319
+ ...working,
320
+ animations: replaceKeyframeSpan(working, property, curve.keyframes.map((keyframe) => ({
321
+ atMs: startMs + keyframe.t * (endMs - startMs),
322
+ value: base + keyframe.value,
323
+ easing: keyframe.easing
324
+ })))
325
+ };
326
+ }
327
+ return working.animations ?? [];
328
+ }
329
+ //# sourceMappingURL=model3dCameraMoves.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model3dCameraMoves.js","sourceRoot":"","sources":["../src/model3dCameraMoves.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EACL,gCAAgC,EAChC,yBAAyB,EACzB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EAKtB,MAAM,cAAc,CAAC;AA0CtB,MAAM,QAAQ,GAAG,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,CAAU,CAAC;AACrE,MAAM,MAAM,GAAG,CAAC,eAAe,EAAE,eAAe,EAAE,eAAe,CAAU,CAAC;AAE5E,MAAM,CAAC,MAAM,oBAAoB,GAAqC;IACpE;QACE,EAAE,EAAE,KAAK;QACT,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,SAAS;QACf,aAAa,EAAE,EAAE;QACjB,QAAQ,EAAE,4EAA4E;QACtF,UAAU,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC;QAC9C,OAAO,EAAE,I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Q,EACR,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;gBACjC,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,KAAK,GAAG,OAAO,CAAC;gBAC9C,KAAK,EAAE,IAAI,GAAG,QAAQ,CAAC,KAAK;gBAC5B,MAAM,EAAE,QAAQ,CAAC,MAAM;aACxB,CAAC,CAAC,CACJ;SACF,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;AAClC,CAAC"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * The Blockout reference of a `model3d` clip: a grey render of the clip's span
3
+ * that a video model follows when a storyboard shot is generated.
4
+ *
5
+ * Nothing here renders. This module holds what every host has to agree on: the
6
+ * passes a reference can be drawn in, the fixed look it is drawn with, the
7
+ * size it is drawn at, and the hash that decides whether a stored reference
8
+ * still shows the clip. The per-frame sample list is
9
+ * `computeModel3DReferenceFrames` in `render/`, because it samples the clip's
10
+ * animation curves through the scene model.
11
+ */
12
+ import type { Model3DBakeSequence } from "./model3dBake.js";
13
+ import type { ClipModel3DAnimation, ClipModel3DStyle, TimelineClip } from "./types.js";
14
+ /** What a reference frame draws. See `Model3DRenderPass` in the render core. */
15
+ export type Model3DReferencePass = "clay" | "depth" | "normal";
16
+ export declare const MODEL3D_REFERENCE_PASSES: readonly ["clay", "depth", "normal"];
17
+ export declare const DEFAULT_MODEL3D_REFERENCE_PASS: Model3DReferencePass;
18
+ /** Whether a value names a reference pass. */
19
+ export declare function isModel3DReferencePass(value: unknown): value is Model3DReferencePass;
20
+ /**
21
+ * The background every reference is drawn on. Opaque, neutral and darker than
22
+ * the lit clay grey, so a figure reads against it whatever background the clip
23
+ * itself uses.
24
+ */
25
+ export declare const MODEL3D_REFERENCE_BACKGROUND = "#3c3c3c";
26
+ /** The longest side of a reference frame, in pixels. */
27
+ export declare const MODEL3D_REFERENCE_MAX_SIDE = 1280;
28
+ /** The renderer settings a reference fixes, in the shape a render session takes. */
29
+ export interface Model3DReferenceSession {
30
+ lighting: "studio";
31
+ lightIntensity: 1;
32
+ background: {
33
+ transparent: false;
34
+ color: string;
35
+ };
36
+ animation: ClipModel3DAnimation;
37
+ }
38
+ /**
39
+ * The session a reference is rendered with. The lighting and the background
40
+ * are constants: the clip's own lighting, intensity and background are look
41
+ * choices for the timeline picture and must not change what the video model
42
+ * is shown. Only the animation selection comes from the clip.
43
+ */
44
+ export declare function model3dReferenceSession(style: Pick<ClipModel3DStyle, "animation">): Model3DReferenceSession;
45
+ /**
46
+ * The pixel size of a reference frame: the sequence's aspect ratio, scaled
47
+ * down so the longest side is at most {@link MODEL3D_REFERENCE_MAX_SIDE}, with
48
+ * both sides even because H.264 4:2:0 needs that.
49
+ */
50
+ export declare function model3dReferenceSize(sequence: Pick<Model3DBakeSequence, "width" | "height">): {
51
+ width: number;
52
+ height: number;
53
+ };
54
+ /**
55
+ * The hash a reference is stored under.
56
+ *
57
+ * It covers what {@link computeModel3DBakeHash} covers, through the same
58
+ * record, with two differences. The style is narrowed to the camera and the
59
+ * animation, because the lighting and the background of a reference are fixed
60
+ * by {@link model3dReferenceSession}. And the pass is added, because a depth
61
+ * render of an unchanged clip is a different video from a clay one.
62
+ */
63
+ export declare function computeModel3DReferenceHash(clip: TimelineClip, sequence: Model3DBakeSequence, pass: Model3DReferencePass): string;
64
+ /** Where a clip's reference stands against the live document. */
65
+ export type Model3DReferenceStatus = "missing" | "stale" | "current";
66
+ /**
67
+ * `missing` when the clip stores no reference, `stale` when the stored one was
68
+ * rendered from a different set, camera, span, sequence or pass, and `current`
69
+ * otherwise. `pass` overrides the stored pass, for a caller that wants to know
70
+ * whether a reference in another pass has to be rendered.
71
+ */
72
+ export declare function model3dReferenceStatus(clip: TimelineClip, sequence: Model3DBakeSequence, pass?: Model3DReferencePass): Model3DReferenceStatus;
73
+ /** Whether the clip stores a reference that no longer shows the clip. */
74
+ export declare function isModel3DReferenceStale(clip: TimelineClip, sequence: Model3DBakeSequence): boolean;
75
+ //# sourceMappingURL=model3dReference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model3dReference.d.ts","sourceRoot":"","sources":["../src/model3dReference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB,gFAAgF;AAChF,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE/D,eAAO,MAAM,wBAAwB,sCAIe,CAAC;AAErD,eAAO,MAAM,8BAA8B,EAAE,oBAA6B,CAAC;AAE3E,8CAA8C;AAC9C,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,oBAAoB,CAE/B;AAED;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,YAAY,CAAC;AAEtD,wDAAwD;AACxD,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C,oFAAoF;AACpF,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,QAAQ,CAAC;IACnB,cAAc,EAAE,CAAC,CAAC;IAClB,UAAU,EAAE;QAAE,WAAW,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAClD,SAAS,EAAE,oBAAoB,CAAC;CACjC;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,IAAI,CAAC,gBAAgB,EAAE,WAAW,CAAC,GACzC,uBAAuB,CAOzB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,IAAI,CAAC,mBAAmB,EAAE,OAAO,GAAG,QAAQ,CAAC,GACtD;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAOnC;AAID;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,mBAAmB,EAC7B,IAAI,EAAE,oBAAoB,GACzB,MAAM,CAUR;AAED,iEAAiE;AACjE,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAErE;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,mBAAmB,EAC7B,IAAI,CAAC,EAAE,oBAAoB,GAC1B,sBAAsB,CAQxB;AAED,yEAAyE;AACzE,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,mBAAmB,GAC5B,OAAO,CAET"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * The Blockout reference of a `model3d` clip: a grey render of the clip's span
3
+ * that a video model follows when a storyboard shot is generated.
4
+ *
5
+ * Nothing here renders. This module holds what every host has to agree on: the
6
+ * passes a reference can be drawn in, the fixed look it is drawn with, the
7
+ * size it is drawn at, and the hash that decides whether a stored reference
8
+ * still shows the clip. The per-frame sample list is
9
+ * `computeModel3DReferenceFrames` in `render/`, because it samples the clip's
10
+ * animation curves through the scene model.
11
+ */
12
+ import { model3dPictureDigest, model3dPictureInputs } from "./model3dBake.js";
13
+ import { stableSerialize } from "./stableSerialize.js";
14
+ export const MODEL3D_REFERENCE_PASSES = [
15
+ "clay",
16
+ "depth",
17
+ "normal"
18
+ ];
19
+ export const DEFAULT_MODEL3D_REFERENCE_PASS = "clay";
20
+ /** Whether a value names a reference pass. */
21
+ export function isModel3DReferencePass(value) {
22
+ return MODEL3D_REFERENCE_PASSES.some((pass) => pass === value);
23
+ }
24
+ /**
25
+ * The background every reference is drawn on. Opaque, neutral and darker than
26
+ * the lit clay grey, so a figure reads against it whatever background the clip
27
+ * itself uses.
28
+ */
29
+ export const MODEL3D_REFERENCE_BACKGROUND = "#3c3c3c";
30
+ /** The longest side of a reference frame, in pixels. */
31
+ export const MODEL3D_REFERENCE_MAX_SIDE = 1280;
32
+ /**
33
+ * The session a reference is rendered with. The lighting and the background
34
+ * are constants: the clip's own lighting, intensity and background are look
35
+ * choices for the timeline picture and must not change what the video model
36
+ * is shown. Only the animation selection comes from the clip.
37
+ */
38
+ export function model3dReferenceSession(style) {
39
+ return {
40
+ lighting: "studio",
41
+ lightIntensity: 1,
42
+ background: { transparent: false, color: MODEL3D_REFERENCE_BACKGROUND },
43
+ animation: { ...style.animation }
44
+ };
45
+ }
46
+ /**
47
+ * The pixel size of a reference frame: the sequence's aspect ratio, scaled
48
+ * down so the longest side is at most {@link MODEL3D_REFERENCE_MAX_SIDE}, with
49
+ * both sides even because H.264 4:2:0 needs that.
50
+ */
51
+ export function model3dReferenceSize(sequence) {
52
+ const width = Math.max(2, sequence.width);
53
+ const height = Math.max(2, sequence.height);
54
+ const scale = Math.min(1, MODEL3D_REFERENCE_MAX_SIDE / Math.max(width, height));
55
+ const even = (value) => Math.max(2, Math.round((value * scale) / 2) * 2);
56
+ return { width: even(width), height: even(height) };
57
+ }
58
+ const MODEL3D_REFERENCE_HASH_VERSION_PREFIX = "model3d-reference-v1:";
59
+ /**
60
+ * The hash a reference is stored under.
61
+ *
62
+ * It covers what {@link computeModel3DBakeHash} covers, through the same
63
+ * record, with two differences. The style is narrowed to the camera and the
64
+ * animation, because the lighting and the background of a reference are fixed
65
+ * by {@link model3dReferenceSession}. And the pass is added, because a depth
66
+ * render of an unchanged clip is a different video from a clay one.
67
+ */
68
+ export function computeModel3DReferenceHash(clip, sequence, pass) {
69
+ const style = clip.model3dStyle;
70
+ const picture = style
71
+ ? { camera: style.camera, animation: style.animation }
72
+ : {};
73
+ const payload = `${MODEL3D_REFERENCE_HASH_VERSION_PREFIX}${stableSerialize({
74
+ ...model3dPictureInputs(clip, sequence, picture),
75
+ pass
76
+ })}`;
77
+ return model3dPictureDigest(payload);
78
+ }
79
+ /**
80
+ * `missing` when the clip stores no reference, `stale` when the stored one was
81
+ * rendered from a different set, camera, span, sequence or pass, and `current`
82
+ * otherwise. `pass` overrides the stored pass, for a caller that wants to know
83
+ * whether a reference in another pass has to be rendered.
84
+ */
85
+ export function model3dReferenceStatus(clip, sequence, pass) {
86
+ const reference = clip.model3dStyle?.reference;
87
+ if (!reference)
88
+ return "missing";
89
+ if (pass !== undefined && pass !== reference.pass)
90
+ return "stale";
91
+ return reference.dependencyHash ===
92
+ computeModel3DReferenceHash(clip, sequence, reference.pass)
93
+ ? "current"
94
+ : "stale";
95
+ }
96
+ /** Whether the clip stores a reference that no longer shows the clip. */
97
+ export function isModel3DReferenceStale(clip, sequence) {
98
+ return model3dReferenceStatus(clip, sequence) === "stale";
99
+ }
100
+ //# sourceMappingURL=model3dReference.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model3dReference.js","sourceRoot":"","sources":["../src/model3dReference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE9E,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAUvD,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,MAAM;IACN,OAAO;IACP,QAAQ;CAC0C,CAAC;AAErD,MAAM,CAAC,MAAM,8BAA8B,GAAyB,MAAM,CAAC;AAE3E,8CAA8C;AAC9C,MAAM,UAAU,sBAAsB,CACpC,KAAc;IAEd,OAAO,wBAAwB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;AACjE,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,SAAS,CAAC;AAEtD,wDAAwD;AACxD,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,CAAC;AAU/C;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACrC,KAA0C;IAE1C,OAAO;QACL,QAAQ,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