@nodetool-ai/timeline 0.8.18 → 0.8.20

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 (383) 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/autoCrossfade.d.ts +30 -0
  18. package/dist/autoCrossfade.d.ts.map +1 -0
  19. package/dist/autoCrossfade.js +130 -0
  20. package/dist/autoCrossfade.js.map +1 -0
  21. package/dist/automation.d.ts +32 -1
  22. package/dist/automation.d.ts.map +1 -1
  23. package/dist/automation.js +78 -1
  24. package/dist/automation.js.map +1 -1
  25. package/dist/automationRanges.d.ts +375 -0
  26. package/dist/automationRanges.d.ts.map +1 -0
  27. package/dist/automationRanges.js +375 -0
  28. package/dist/automationRanges.js.map +1 -0
  29. package/dist/clipAudio.d.ts +3 -1
  30. package/dist/clipAudio.d.ts.map +1 -1
  31. package/dist/clipAudio.js.map +1 -1
  32. package/dist/clipLoop.d.ts +67 -0
  33. package/dist/clipLoop.d.ts.map +1 -0
  34. package/dist/clipLoop.js +339 -0
  35. package/dist/clipLoop.js.map +1 -0
  36. package/dist/clipSpeed.d.ts.map +1 -1
  37. package/dist/clipSpeed.js +7 -0
  38. package/dist/clipSpeed.js.map +1 -1
  39. package/dist/defaults.d.ts.map +1 -1
  40. package/dist/defaults.js +9 -0
  41. package/dist/defaults.js.map +1 -1
  42. package/dist/dropResolve.d.ts.map +1 -1
  43. package/dist/dropResolve.js +56 -17
  44. package/dist/dropResolve.js.map +1 -1
  45. package/dist/finish-storyboard.d.ts.map +1 -1
  46. package/dist/finish-storyboard.js +6 -1
  47. package/dist/finish-storyboard.js.map +1 -1
  48. package/dist/harmony/chordChart.d.ts +25 -0
  49. package/dist/harmony/chordChart.d.ts.map +1 -0
  50. package/dist/harmony/chordChart.js +99 -0
  51. package/dist/harmony/chordChart.js.map +1 -0
  52. package/dist/harmony/chordRange.d.ts +9 -0
  53. package/dist/harmony/chordRange.d.ts.map +1 -0
  54. package/dist/harmony/chordRange.js +32 -0
  55. package/dist/harmony/chordRange.js.map +1 -0
  56. package/dist/harmony/chordSymbols.d.ts +28 -0
  57. package/dist/harmony/chordSymbols.d.ts.map +1 -0
  58. package/dist/harmony/chordSymbols.js +147 -0
  59. package/dist/harmony/chordSymbols.js.map +1 -0
  60. package/dist/harmony/chordTrack.d.ts +13 -0
  61. package/dist/harmony/chordTrack.d.ts.map +1 -0
  62. package/dist/harmony/chordTrack.js +11 -0
  63. package/dist/harmony/chordTrack.js.map +1 -0
  64. package/dist/harmony/detect.d.ts +35 -0
  65. package/dist/harmony/detect.d.ts.map +1 -0
  66. package/dist/harmony/detect.js +138 -0
  67. package/dist/harmony/detect.js.map +1 -0
  68. package/dist/harmony/detectAudio.d.ts +62 -0
  69. package/dist/harmony/detectAudio.d.ts.map +1 -0
  70. package/dist/harmony/detectAudio.js +226 -0
  71. package/dist/harmony/detectAudio.js.map +1 -0
  72. package/dist/harmony/expand.d.ts +7 -12
  73. package/dist/harmony/expand.d.ts.map +1 -1
  74. package/dist/harmony/expand.js +63 -11
  75. package/dist/harmony/expand.js.map +1 -1
  76. package/dist/harmony/index.d.ts +7 -0
  77. package/dist/harmony/index.d.ts.map +1 -1
  78. package/dist/harmony/index.js +7 -0
  79. package/dist/harmony/index.js.map +1 -1
  80. package/dist/harmony/progressionLibrary.d.ts +33 -0
  81. package/dist/harmony/progressionLibrary.d.ts.map +1 -0
  82. package/dist/harmony/progressionLibrary.js +71 -0
  83. package/dist/harmony/progressionLibrary.js.map +1 -0
  84. package/dist/harmony/summary.d.ts +4 -0
  85. package/dist/harmony/summary.d.ts.map +1 -0
  86. package/dist/harmony/summary.js +22 -0
  87. package/dist/harmony/summary.js.map +1 -0
  88. package/dist/index.d.ts +8 -0
  89. package/dist/index.d.ts.map +1 -1
  90. package/dist/index.js +8 -0
  91. package/dist/index.js.map +1 -1
  92. package/dist/interchange.d.ts.map +1 -1
  93. package/dist/interchange.js +3 -0
  94. package/dist/interchange.js.map +1 -1
  95. package/dist/keyframes.d.ts +12 -2
  96. package/dist/keyframes.d.ts.map +1 -1
  97. package/dist/keyframes.js +24 -1
  98. package/dist/keyframes.js.map +1 -1
  99. package/dist/loopWindow.d.ts +17 -0
  100. package/dist/loopWindow.d.ts.map +1 -0
  101. package/dist/loopWindow.js +34 -0
  102. package/dist/loopWindow.js.map +1 -0
  103. package/dist/midi/cacheKey.d.ts +11 -2
  104. package/dist/midi/cacheKey.d.ts.map +1 -1
  105. package/dist/midi/cacheKey.js +69 -9
  106. package/dist/midi/cacheKey.js.map +1 -1
  107. package/dist/midi/controllerEdit.d.ts +35 -0
  108. package/dist/midi/controllerEdit.d.ts.map +1 -0
  109. package/dist/midi/controllerEdit.js +94 -0
  110. package/dist/midi/controllerEdit.js.map +1 -0
  111. package/dist/midi/controllerRange.d.ts +13 -0
  112. package/dist/midi/controllerRange.d.ts.map +1 -0
  113. package/dist/midi/controllerRange.js +13 -0
  114. package/dist/midi/controllerRange.js.map +1 -0
  115. package/dist/midi/controllers.d.ts +95 -0
  116. package/dist/midi/controllers.d.ts.map +1 -0
  117. package/dist/midi/controllers.js +421 -0
  118. package/dist/midi/controllers.js.map +1 -0
  119. package/dist/midi/curveCut.d.ts +17 -0
  120. package/dist/midi/curveCut.d.ts.map +1 -0
  121. package/dist/midi/curveCut.js +45 -0
  122. package/dist/midi/curveCut.js.map +1 -0
  123. package/dist/midi/edit.d.ts +13 -1
  124. package/dist/midi/edit.d.ts.map +1 -1
  125. package/dist/midi/edit.js +19 -3
  126. package/dist/midi/edit.js.map +1 -1
  127. package/dist/midi/engines/bl1.d.ts +10 -1
  128. package/dist/midi/engines/bl1.d.ts.map +1 -1
  129. package/dist/midi/engines/bl1.js +26 -6
  130. package/dist/midi/engines/bl1.js.map +1 -1
  131. package/dist/midi/engines/dr1.d.ts +11 -1
  132. package/dist/midi/engines/dr1.d.ts.map +1 -1
  133. package/dist/midi/engines/dr1.js +21 -3
  134. package/dist/midi/engines/dr1.js.map +1 -1
  135. package/dist/midi/engines/dsp.d.ts +1 -1
  136. package/dist/midi/engines/dsp.d.ts.map +1 -1
  137. package/dist/midi/engines/dsp.js +10 -2
  138. package/dist/midi/engines/dsp.js.map +1 -1
  139. package/dist/midi/engines/wt1.d.ts +10 -1
  140. package/dist/midi/engines/wt1.d.ts.map +1 -1
  141. package/dist/midi/engines/wt1.js +28 -5
  142. package/dist/midi/engines/wt1.js.map +1 -1
  143. package/dist/midi/events.d.ts +13 -4
  144. package/dist/midi/events.d.ts.map +1 -1
  145. package/dist/midi/events.js +33 -6
  146. package/dist/midi/events.js.map +1 -1
  147. package/dist/midi/expression.d.ts +25 -0
  148. package/dist/midi/expression.d.ts.map +1 -0
  149. package/dist/midi/expression.js +69 -0
  150. package/dist/midi/expression.js.map +1 -0
  151. package/dist/midi/index.d.ts +8 -0
  152. package/dist/midi/index.d.ts.map +1 -1
  153. package/dist/midi/index.js +8 -0
  154. package/dist/midi/index.js.map +1 -1
  155. package/dist/midi/instrument.d.ts.map +1 -1
  156. package/dist/midi/instrument.js +4 -0
  157. package/dist/midi/instrument.js.map +1 -1
  158. package/dist/midi/noteFunctions.d.ts +29 -0
  159. package/dist/midi/noteFunctions.d.ts.map +1 -0
  160. package/dist/midi/noteFunctions.js +213 -0
  161. package/dist/midi/noteFunctions.js.map +1 -0
  162. package/dist/midi/notes.d.ts +7 -1
  163. package/dist/midi/notes.d.ts.map +1 -1
  164. package/dist/midi/notes.js +43 -1
  165. package/dist/midi/notes.js.map +1 -1
  166. package/dist/midi/notesEdit.d.ts +13 -0
  167. package/dist/midi/notesEdit.d.ts.map +1 -1
  168. package/dist/midi/notesEdit.js +73 -2
  169. package/dist/midi/notesEdit.js.map +1 -1
  170. package/dist/midi/presets.d.ts +1 -1
  171. package/dist/midi/regionParams.d.ts +41 -0
  172. package/dist/midi/regionParams.d.ts.map +1 -0
  173. package/dist/midi/regionParams.js +164 -0
  174. package/dist/midi/regionParams.js.map +1 -0
  175. package/dist/midi/sampler.d.ts +2 -2
  176. package/dist/midi/sampler.d.ts.map +1 -1
  177. package/dist/midi/sampler.js +99 -21
  178. package/dist/midi/sampler.js.map +1 -1
  179. package/dist/midi/stepEditor.d.ts +50 -0
  180. package/dist/midi/stepEditor.d.ts.map +1 -0
  181. package/dist/midi/stepEditor.js +118 -0
  182. package/dist/midi/stepEditor.js.map +1 -0
  183. package/dist/midi/stepPattern.d.ts +173 -0
  184. package/dist/midi/stepPattern.d.ts.map +1 -0
  185. package/dist/midi/stepPattern.js +1390 -0
  186. package/dist/midi/stepPattern.js.map +1 -0
  187. package/dist/midi/stepPatternExpand.d.ts +149 -0
  188. package/dist/midi/stepPatternExpand.d.ts.map +1 -0
  189. package/dist/midi/stepPatternExpand.js +1068 -0
  190. package/dist/midi/stepPatternExpand.js.map +1 -0
  191. package/dist/midi/stepPatternLibrary.d.ts +65 -0
  192. package/dist/midi/stepPatternLibrary.d.ts.map +1 -0
  193. package/dist/midi/stepPatternLibrary.js +640 -0
  194. package/dist/midi/stepPatternLibrary.js.map +1 -0
  195. package/dist/midi/tempo.d.ts.map +1 -1
  196. package/dist/midi/tempo.js +3 -0
  197. package/dist/midi/tempo.js.map +1 -1
  198. package/dist/midi/voice.d.ts +51 -5
  199. package/dist/midi/voice.d.ts.map +1 -1
  200. package/dist/midi/voice.js +191 -21
  201. package/dist/midi/voice.js.map +1 -1
  202. package/dist/model3d.d.ts +132 -8
  203. package/dist/model3d.d.ts.map +1 -1
  204. package/dist/model3d.js +230 -7
  205. package/dist/model3d.js.map +1 -1
  206. package/dist/model3dBake.d.ts +41 -11
  207. package/dist/model3dBake.d.ts.map +1 -1
  208. package/dist/model3dBake.js +58 -21
  209. package/dist/model3dBake.js.map +1 -1
  210. package/dist/model3dBlockout.d.ts +62 -0
  211. package/dist/model3dBlockout.d.ts.map +1 -0
  212. package/dist/model3dBlockout.js +59 -0
  213. package/dist/model3dBlockout.js.map +1 -0
  214. package/dist/model3dCameraDescription.d.ts +32 -0
  215. package/dist/model3dCameraDescription.d.ts.map +1 -0
  216. package/dist/model3dCameraDescription.js +253 -0
  217. package/dist/model3dCameraDescription.js.map +1 -0
  218. package/dist/model3dCameraKeys.d.ts +47 -0
  219. package/dist/model3dCameraKeys.d.ts.map +1 -0
  220. package/dist/model3dCameraKeys.js +156 -0
  221. package/dist/model3dCameraKeys.js.map +1 -0
  222. package/dist/model3dCameraMoves.d.ts +97 -0
  223. package/dist/model3dCameraMoves.d.ts.map +1 -0
  224. package/dist/model3dCameraMoves.js +329 -0
  225. package/dist/model3dCameraMoves.js.map +1 -0
  226. package/dist/model3dReference.d.ts +96 -0
  227. package/dist/model3dReference.d.ts.map +1 -0
  228. package/dist/model3dReference.js +113 -0
  229. package/dist/model3dReference.js.map +1 -0
  230. package/dist/music/align.d.ts +111 -0
  231. package/dist/music/align.d.ts.map +1 -0
  232. package/dist/music/align.js +282 -0
  233. package/dist/music/align.js.map +1 -0
  234. package/dist/music/cut.d.ts +33 -0
  235. package/dist/music/cut.d.ts.map +1 -0
  236. package/dist/music/cut.js +50 -0
  237. package/dist/music/cut.js.map +1 -0
  238. package/dist/music/frames.d.ts +51 -0
  239. package/dist/music/frames.d.ts.map +1 -0
  240. package/dist/music/frames.js +110 -0
  241. package/dist/music/frames.js.map +1 -0
  242. package/dist/music/gain.d.ts +24 -0
  243. package/dist/music/gain.d.ts.map +1 -0
  244. package/dist/music/gain.js +38 -0
  245. package/dist/music/gain.js.map +1 -0
  246. package/dist/music/index.d.ts +9 -0
  247. package/dist/music/index.d.ts.map +1 -0
  248. package/dist/music/index.js +9 -0
  249. package/dist/music/index.js.map +1 -0
  250. package/dist/music/plan.d.ts +106 -0
  251. package/dist/music/plan.d.ts.map +1 -0
  252. package/dist/music/plan.js +304 -0
  253. package/dist/music/plan.js.map +1 -0
  254. package/dist/music/process.d.ts +9 -0
  255. package/dist/music/process.d.ts.map +1 -0
  256. package/dist/music/process.js +9 -0
  257. package/dist/music/process.js.map +1 -0
  258. package/dist/music/roles.d.ts +14 -0
  259. package/dist/music/roles.d.ts.map +1 -0
  260. package/dist/music/roles.js +30 -0
  261. package/dist/music/roles.js.map +1 -0
  262. package/dist/music/splice.d.ts +37 -0
  263. package/dist/music/splice.d.ts.map +1 -0
  264. package/dist/music/splice.js +67 -0
  265. package/dist/music/splice.js.map +1 -0
  266. package/dist/music/tempoRules.d.ts +41 -0
  267. package/dist/music/tempoRules.d.ts.map +1 -0
  268. package/dist/music/tempoRules.js +59 -0
  269. package/dist/music/tempoRules.js.map +1 -0
  270. package/dist/ops/apply.d.ts.map +1 -1
  271. package/dist/ops/apply.js +1009 -230
  272. package/dist/ops/apply.js.map +1 -1
  273. package/dist/ops/automation.d.ts +6 -0
  274. package/dist/ops/automation.d.ts.map +1 -0
  275. package/dist/ops/automation.js +217 -0
  276. package/dist/ops/automation.js.map +1 -0
  277. package/dist/ops/barTime.d.ts +14 -0
  278. package/dist/ops/barTime.d.ts.map +1 -0
  279. package/dist/ops/barTime.js +33 -0
  280. package/dist/ops/barTime.js.map +1 -0
  281. package/dist/ops/chords.d.ts +43 -0
  282. package/dist/ops/chords.d.ts.map +1 -0
  283. package/dist/ops/chords.js +691 -0
  284. package/dist/ops/chords.js.map +1 -0
  285. package/dist/ops/groupBake.d.ts +24 -0
  286. package/dist/ops/groupBake.d.ts.map +1 -0
  287. package/dist/ops/groupBake.js +81 -0
  288. package/dist/ops/groupBake.js.map +1 -0
  289. package/dist/ops/index.d.ts +7 -0
  290. package/dist/ops/index.d.ts.map +1 -1
  291. package/dist/ops/index.js +5 -0
  292. package/dist/ops/index.js.map +1 -1
  293. package/dist/ops/join.d.ts +20 -0
  294. package/dist/ops/join.d.ts.map +1 -0
  295. package/dist/ops/join.js +265 -0
  296. package/dist/ops/join.js.map +1 -0
  297. package/dist/ops/loop.d.ts +29 -0
  298. package/dist/ops/loop.d.ts.map +1 -0
  299. package/dist/ops/loop.js +107 -0
  300. package/dist/ops/loop.js.map +1 -0
  301. package/dist/ops/midiMix.d.ts +41 -0
  302. package/dist/ops/midiMix.d.ts.map +1 -0
  303. package/dist/ops/midiMix.js +522 -0
  304. package/dist/ops/midiMix.js.map +1 -0
  305. package/dist/ops/op.d.ts +94 -11
  306. package/dist/ops/op.d.ts.map +1 -1
  307. package/dist/ops/op.js +62 -1
  308. package/dist/ops/op.js.map +1 -1
  309. package/dist/ops/parse.d.ts.map +1 -1
  310. package/dist/ops/parse.js +316 -4
  311. package/dist/ops/parse.js.map +1 -1
  312. package/dist/ops/pasteRange.d.ts +46 -0
  313. package/dist/ops/pasteRange.d.ts.map +1 -0
  314. package/dist/ops/pasteRange.js +276 -0
  315. package/dist/ops/pasteRange.js.map +1 -0
  316. package/dist/ops/plugin.d.ts +57 -0
  317. package/dist/ops/plugin.d.ts.map +1 -0
  318. package/dist/ops/plugin.js +875 -0
  319. package/dist/ops/plugin.js.map +1 -0
  320. package/dist/ops/sections.d.ts +98 -0
  321. package/dist/ops/sections.d.ts.map +1 -0
  322. package/dist/ops/sections.js +930 -0
  323. package/dist/ops/sections.js.map +1 -0
  324. package/dist/ops/serialize.d.ts +79 -1
  325. package/dist/ops/serialize.d.ts.map +1 -1
  326. package/dist/ops/serialize.js +85 -3
  327. package/dist/ops/serialize.js.map +1 -1
  328. package/dist/ops/stepPattern.d.ts +44 -0
  329. package/dist/ops/stepPattern.d.ts.map +1 -0
  330. package/dist/ops/stepPattern.js +2106 -0
  331. package/dist/ops/stepPattern.js.map +1 -0
  332. package/dist/ops/stepPatternFolders.d.ts +54 -0
  333. package/dist/ops/stepPatternFolders.d.ts.map +1 -0
  334. package/dist/ops/stepPatternFolders.js +299 -0
  335. package/dist/ops/stepPatternFolders.js.map +1 -0
  336. package/dist/ops/types.d.ts +260 -2
  337. package/dist/ops/types.d.ts.map +1 -1
  338. package/dist/render/index.d.ts +1 -0
  339. package/dist/render/index.d.ts.map +1 -1
  340. package/dist/render/index.js +1 -0
  341. package/dist/render/index.js.map +1 -1
  342. package/dist/render/model3dReferenceSamples.d.ts +25 -0
  343. package/dist/render/model3dReferenceSamples.d.ts.map +1 -0
  344. package/dist/render/model3dReferenceSamples.js +25 -0
  345. package/dist/render/model3dReferenceSamples.js.map +1 -0
  346. package/dist/render/sceneModel.d.ts +1 -1
  347. package/dist/render/sceneModel.d.ts.map +1 -1
  348. package/dist/render/sceneModel.js +10 -5
  349. package/dist/render/sceneModel.js.map +1 -1
  350. package/dist/rippleEdit.d.ts +5 -1
  351. package/dist/rippleEdit.d.ts.map +1 -1
  352. package/dist/rippleEdit.js +24 -9
  353. package/dist/rippleEdit.js.map +1 -1
  354. package/dist/scene.d.ts +1 -0
  355. package/dist/scene.d.ts.map +1 -1
  356. package/dist/scene.js +1 -0
  357. package/dist/scene.js.map +1 -1
  358. package/dist/shotLink.d.ts +35 -0
  359. package/dist/shotLink.d.ts.map +1 -1
  360. package/dist/shotLink.js +100 -0
  361. package/dist/shotLink.js.map +1 -1
  362. package/dist/splitClip.d.ts +29 -1
  363. package/dist/splitClip.d.ts.map +1 -1
  364. package/dist/splitClip.js +231 -1
  365. package/dist/splitClip.js.map +1 -1
  366. package/dist/testing/host-ops.js +3 -3
  367. package/dist/testing/host-ops.js.map +1 -1
  368. package/dist/testing/ops.d.ts +6 -1
  369. package/dist/testing/ops.d.ts.map +1 -1
  370. package/dist/testing/ops.js +872 -13
  371. package/dist/testing/ops.js.map +1 -1
  372. package/dist/timeRemap.d.ts +2 -2
  373. package/dist/timeRemap.d.ts.map +1 -1
  374. package/dist/timeRemap.js +18 -0
  375. package/dist/timeRemap.js.map +1 -1
  376. package/dist/trimClip.d.ts +1 -1
  377. package/dist/trimClip.d.ts.map +1 -1
  378. package/dist/trimClip.js +41 -7
  379. package/dist/trimClip.js.map +1 -1
  380. package/dist/types.d.ts +331 -15
  381. package/dist/types.d.ts.map +1 -1
  382. package/dist/types.js.map +1 -1
  383. package/package.json +11 -5
package/dist/model3d.d.ts CHANGED
@@ -1,13 +1,15 @@
1
1
  /**
2
2
  * The camera a `model3d` clip is drawn with: its authored pose folded with the
3
- * four animated camera channels (D4).
3
+ * animated camera channels (D4), plus the pure camera math every host shares.
4
4
  *
5
5
  * Every host that renders a 3D layer — the browser session pool, the headless
6
6
  * Chromium one the agent frame preview drives, and the Blender bake — needs the
7
7
  * same number, so the fold lives here and not in any of them. Pure, and out of
8
8
  * `render/` so both the root export and the render surface can reach it.
9
9
  */
10
- import type { ClipModel3DCamera, ClipModel3DStyle } from "./types.js";
10
+ import type { ClipModel3DCamera, ClipModel3DStyle, Model3DCameraMode } from "./types.js";
11
+ /** A point or direction in glTF world space: right-handed, Y up. */
12
+ export type Model3DVec3 = [number, number, number];
11
13
  /**
12
14
  * The animated camera channels of one sample. Named the way `AnimationSample`
13
15
  * names them, so a caller passes the sample — or the resolved layer props that
@@ -20,22 +22,144 @@ export interface Model3DCameraChannels {
20
22
  cameraElevation: number;
21
23
  /** Multiplier on the framing distance multiplier. */
22
24
  cameraZoom: number;
23
- /** Degrees, added to the field of view. */
25
+ /** Degrees, added to the field of view. Orbit and free mode both read it. */
24
26
  cameraFov: number;
27
+ /** World units, added to the free camera's `position[0]`. */
28
+ cameraPosX: number;
29
+ /** World units, added to the free camera's `position[1]`. */
30
+ cameraPosY: number;
31
+ /** World units, added to the free camera's `position[2]`. */
32
+ cameraPosZ: number;
33
+ /** World units, added to the free camera's `target[0]`. */
34
+ cameraTargetX: number;
35
+ /** World units, added to the free camera's `target[1]`. */
36
+ cameraTargetY: number;
37
+ /** World units, added to the free camera's `target[2]`. */
38
+ cameraTargetZ: number;
39
+ /** Degrees, added to the free camera's `rollDeg`. */
40
+ cameraRoll: number;
25
41
  }
42
+ /** The channels at identity: a camera that no animation moves. */
43
+ export declare const IDENTITY_MODEL3D_CAMERA_CHANNELS: Readonly<Model3DCameraChannels>;
44
+ /** The channels an `orbit` camera reads. */
45
+ export declare const MODEL3D_ORBIT_CAMERA_PROPERTIES: readonly ["cameraAzimuth", "cameraElevation", "cameraZoom", "cameraFov"];
46
+ /** The channels a `free` camera reads. `cameraFov` is its lens. */
47
+ export declare const MODEL3D_FREE_CAMERA_PROPERTIES: readonly ["cameraPosX", "cameraPosY", "cameraPosZ", "cameraTargetX", "cameraTargetY", "cameraTargetZ", "cameraRoll", "cameraFov"];
26
48
  /**
27
- * The four channels as a runtime list, for the surfaces that offer them to a
28
- * user: the keyframe inspector and the animatable-property docs.
49
+ * Every camera channel as a runtime list, for the surfaces that offer them to
50
+ * a user: the keyframe inspector and the animatable-property docs.
29
51
  */
30
- export declare const MODEL3D_CAMERA_PROPERTIES: readonly ["cameraAzimuth", "cameraElevation", "cameraZoom", "cameraFov"];
52
+ export declare const MODEL3D_CAMERA_PROPERTIES: readonly ["cameraAzimuth", "cameraElevation", "cameraZoom", "cameraFov", "cameraPosX", "cameraPosY", "cameraPosZ", "cameraTargetX", "cameraTargetY", "cameraTargetZ", "cameraRoll"];
53
+ export type Model3DCameraProperty = (typeof MODEL3D_CAMERA_PROPERTIES)[number];
54
+ /** The channels a camera in `mode` reads. `scene` reads none. */
55
+ export declare function model3dCameraPropertiesFor(mode: Model3DCameraMode): readonly Model3DCameraProperty[];
56
+ /** Where a free camera sits when the clip stores no `position`. */
57
+ export declare const DEFAULT_FREE_CAMERA_POSITION: Readonly<Model3DVec3>;
58
+ /** Where a free camera looks when the clip stores no `target`. */
59
+ export declare const DEFAULT_FREE_CAMERA_TARGET: Readonly<Model3DVec3>;
60
+ /** A free camera with every field present. */
61
+ export interface Model3DFreeCameraPose {
62
+ /** Camera eye, world units. */
63
+ position: Model3DVec3;
64
+ /** Look-at point, world units. */
65
+ target: Model3DVec3;
66
+ /** Roll around the view axis, degrees. Positive turns the horizon clockwise. */
67
+ rollDeg: number;
68
+ /** Vertical field of view, degrees. */
69
+ fovDeg: number;
70
+ }
71
+ /**
72
+ * The free pose a camera describes, with the defaults filled in: `position`
73
+ * `[0, 1.6, 5]`, `target` `[0, 1, 0]`, `rollDeg` 0. It reads the same fields in
74
+ * every mode, so call it on a camera that is in `free` mode.
75
+ */
76
+ export declare function model3dFreeCameraPose(camera: ClipModel3DCamera): Model3DFreeCameraPose;
31
77
  /**
32
78
  * Fold the sampled camera channels onto the clip's authored camera. Additive
33
79
  * channels add and `cameraZoom` multiplies, exactly as `ANIMATED_PROPERTY_FOLD`
34
80
  * declares — an animation moves the camera from wherever the clip parks it,
35
81
  * so re-posing the clip keeps the move.
36
82
  *
37
- * `scene` mode keeps `sceneCameraName` and the orbit terms it does not use;
38
- * nothing is dropped, because a mode switch must not lose the pose.
83
+ * `free` mode adds the position, target and roll channels onto the authored
84
+ * `position`, `target` and `rollDeg`, and returns all three filled in. The
85
+ * other modes leave those three fields as stored. Every mode keeps the terms it
86
+ * does not use, because a mode switch must not lose the pose.
39
87
  */
40
88
  export declare function resolveModel3DCamera(style: ClipModel3DStyle, anim: Model3DCameraChannels): ClipModel3DCamera;
89
+ /** The camera's axes in world space, each of unit length. */
90
+ export interface Model3DCameraBasis {
91
+ /** From the eye toward the target. */
92
+ forward: Model3DVec3;
93
+ /** Toward the right edge of the picture. */
94
+ right: Model3DVec3;
95
+ /** Toward the top edge of the picture. */
96
+ up: Model3DVec3;
97
+ }
98
+ /**
99
+ * The axes of a free camera at `position` looking at `target`, rolled by
100
+ * `rollDeg`.
101
+ *
102
+ * With no roll, `right` is horizontal and `up` leans toward world +Y. A
103
+ * positive roll turns the camera counter-clockwise around its view axis as
104
+ * seen from behind it, so the horizon turns clockwise in the picture:
105
+ * `up = cos(roll) * up0 - sin(roll) * right0`. This is `lookAt` followed by
106
+ * `rotateZ(roll)` in three.js.
107
+ *
108
+ * A camera with `position` equal to `target` looks down -Z. A camera looking
109
+ * straight up or down has no horizontal right, so it takes world +X.
110
+ */
111
+ export declare function model3dFreeCameraBasis(position: Readonly<Model3DVec3>, target: Readonly<Model3DVec3>, rollDeg?: number): Model3DCameraBasis;
112
+ /** The sensor height the lens conversions assume: a full-frame 36 x 24 mm. */
113
+ export declare const MODEL3D_SENSOR_HEIGHT_MM = 24;
114
+ /**
115
+ * The vertical field of view, in degrees, of a lens `focalLengthMm` long on a
116
+ * 24 mm tall sensor: `2 * atan(12 / f)`. A 50 mm lens is about 27 degrees.
117
+ */
118
+ export declare function focalLengthMmToFovDeg(focalLengthMm: number): number;
119
+ /** The inverse of {@link focalLengthMmToFovDeg}: `12 / tan(fov / 2)`. */
120
+ export declare function fovDegToFocalLengthMm(fovDeg: number): number;
121
+ /** How far an orbit camera stands from its target. */
122
+ export interface Model3DOrbitFraming {
123
+ /** Distance from the look-at point to the camera. */
124
+ distance: number;
125
+ near: number;
126
+ far: number;
127
+ }
128
+ /**
129
+ * The distance that fits a bounding sphere of `radius` into a camera with the
130
+ * given vertical fov and aspect, with `zoom` applied (above 1 moves closer).
131
+ *
132
+ * The same math as `computeFraming` in
133
+ * `packages/video-nodes/src/nodes/model3d/render3d-core.ts` and
134
+ * `compute_framing` in `packages/blender-nodes/blender_ops/framing.py`. The
135
+ * render core keeps its own copy because its headless page bundle must not
136
+ * pull this package in, and `packages/video-nodes/tests/model3d-render.test.ts`
137
+ * pins the two to each other.
138
+ */
139
+ export declare function computeModel3DOrbitFraming(radius: number, fovDeg: number, aspect: number, zoom: number): Model3DOrbitFraming;
140
+ /**
141
+ * The offset from the look-at point to an orbit camera `distance` away.
142
+ * Azimuth 0 sits on +Z and looks down -Z, and a growing azimuth moves the
143
+ * camera toward +X. The same math as `orbitOffset` in the render core.
144
+ */
145
+ export declare function model3dOrbitOffset(azimuthDeg: number, elevationDeg: number, distance: number): Model3DVec3;
146
+ /** What an orbit camera is fitted against, as the render session measures it. */
147
+ export interface Model3DOrbitFit {
148
+ /** Center of the model's rest-pose bounding sphere, world units. */
149
+ center: Readonly<Model3DVec3>;
150
+ /** Radius of that sphere, world units. */
151
+ radius: number;
152
+ /** Picture width divided by height. */
153
+ aspect: number;
154
+ }
155
+ /**
156
+ * The `free` camera that draws the picture an `orbit` camera draws.
157
+ *
158
+ * The orbit terms stay on the result, so switching back to `orbit` restores
159
+ * the old pose. `fit` has to describe the model the clip renders: the bounding
160
+ * sphere of its rest pose and the aspect of the picture. Pass a camera already
161
+ * folded by {@link resolveModel3DCamera} to convert the animated pose at one
162
+ * instant. A camera that is not in `orbit` mode is returned as a copy.
163
+ */
164
+ export declare function orbitCameraToFree(camera: ClipModel3DCamera, fit: Model3DOrbitFit): ClipModel3DCamera;
41
165
  //# sourceMappingURL=model3d.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"model3d.d.ts","sourceRoot":"","sources":["../src/model3d.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEtE;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,2CAA2C;IAC3C,aAAa,EAAE,MAAM,CAAC;IACtB,6CAA6C;IAC7C,eAAe,EAAE,MAAM,CAAC;IACxB,qDAAqD;IACrD,UAAU,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,eAAO,MAAM,yBAAyB,0EAKuB,CAAC;AAE9D;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,gBAAgB,EACvB,IAAI,EAAE,qBAAqB,GAC1B,iBAAiB,CASnB"}
1
+ {"version":3,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,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GACX,mBAAmB,CAYrB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,GACf,WAAW,CAQb;AAED,iFAAiF;AACjF,MAAM,WAAW,eAAe;IAC9B,oEAAoE;IACpE,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;IAC9B,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,iBAAiB,EACzB,GAAG,EAAE,eAAe,GACnB,iBAAiB,CA8BnB"}
package/dist/model3d.js CHANGED
@@ -1,39 +1,262 @@
1
1
  /**
2
2
  * The camera a `model3d` clip is drawn with: its authored pose folded with the
3
- * four animated camera channels (D4).
3
+ * animated camera channels (D4), plus the pure camera math every host shares.
4
4
  *
5
5
  * Every host that renders a 3D layer — the browser session pool, the headless
6
6
  * Chromium one the agent frame preview drives, and the Blender bake — needs the
7
7
  * same number, so the fold lives here and not in any of them. Pure, and out of
8
8
  * `render/` so both the root export and the render surface can reach it.
9
9
  */
10
+ /** The channels at identity: a camera that no animation moves. */
11
+ export const IDENTITY_MODEL3D_CAMERA_CHANNELS = Object.freeze({
12
+ cameraAzimuth: 0,
13
+ cameraElevation: 0,
14
+ cameraZoom: 1,
15
+ cameraFov: 0,
16
+ cameraPosX: 0,
17
+ cameraPosY: 0,
18
+ cameraPosZ: 0,
19
+ cameraTargetX: 0,
20
+ cameraTargetY: 0,
21
+ cameraTargetZ: 0,
22
+ cameraRoll: 0
23
+ });
24
+ /** The channels an `orbit` camera reads. */
25
+ export const MODEL3D_ORBIT_CAMERA_PROPERTIES = [
26
+ "cameraAzimuth",
27
+ "cameraElevation",
28
+ "cameraZoom",
29
+ "cameraFov"
30
+ ];
31
+ /** The channels a `free` camera reads. `cameraFov` is its lens. */
32
+ export const MODEL3D_FREE_CAMERA_PROPERTIES = [
33
+ "cameraPosX",
34
+ "cameraPosY",
35
+ "cameraPosZ",
36
+ "cameraTargetX",
37
+ "cameraTargetY",
38
+ "cameraTargetZ",
39
+ "cameraRoll",
40
+ "cameraFov"
41
+ ];
10
42
  /**
11
- * The four channels as a runtime list, for the surfaces that offer them to a
12
- * user: the keyframe inspector and the animatable-property docs.
43
+ * Every camera channel as a runtime list, for the surfaces that offer them to
44
+ * a user: the keyframe inspector and the animatable-property docs.
13
45
  */
14
46
  export const MODEL3D_CAMERA_PROPERTIES = [
15
47
  "cameraAzimuth",
16
48
  "cameraElevation",
17
49
  "cameraZoom",
18
- "cameraFov"
50
+ "cameraFov",
51
+ "cameraPosX",
52
+ "cameraPosY",
53
+ "cameraPosZ",
54
+ "cameraTargetX",
55
+ "cameraTargetY",
56
+ "cameraTargetZ",
57
+ "cameraRoll"
19
58
  ];
59
+ /** The channels a camera in `mode` reads. `scene` reads none. */
60
+ export function model3dCameraPropertiesFor(mode) {
61
+ if (mode === "free")
62
+ return MODEL3D_FREE_CAMERA_PROPERTIES;
63
+ if (mode === "orbit")
64
+ return MODEL3D_ORBIT_CAMERA_PROPERTIES;
65
+ return [];
66
+ }
67
+ /** Where a free camera sits when the clip stores no `position`. */
68
+ export const DEFAULT_FREE_CAMERA_POSITION = Object.freeze([0, 1.6, 5]);
69
+ /** Where a free camera looks when the clip stores no `target`. */
70
+ export const DEFAULT_FREE_CAMERA_TARGET = Object.freeze([
71
+ 0, 1, 0
72
+ ]);
73
+ /**
74
+ * The free pose a camera describes, with the defaults filled in: `position`
75
+ * `[0, 1.6, 5]`, `target` `[0, 1, 0]`, `rollDeg` 0. It reads the same fields in
76
+ * every mode, so call it on a camera that is in `free` mode.
77
+ */
78
+ export function model3dFreeCameraPose(camera) {
79
+ return {
80
+ position: [...(camera.position ?? DEFAULT_FREE_CAMERA_POSITION)],
81
+ target: [...(camera.target ?? DEFAULT_FREE_CAMERA_TARGET)],
82
+ rollDeg: camera.rollDeg ?? 0,
83
+ fovDeg: camera.fovDeg
84
+ };
85
+ }
20
86
  /**
21
87
  * Fold the sampled camera channels onto the clip's authored camera. Additive
22
88
  * channels add and `cameraZoom` multiplies, exactly as `ANIMATED_PROPERTY_FOLD`
23
89
  * declares — an animation moves the camera from wherever the clip parks it,
24
90
  * so re-posing the clip keeps the move.
25
91
  *
26
- * `scene` mode keeps `sceneCameraName` and the orbit terms it does not use;
27
- * nothing is dropped, because a mode switch must not lose the pose.
92
+ * `free` mode adds the position, target and roll channels onto the authored
93
+ * `position`, `target` and `rollDeg`, and returns all three filled in. The
94
+ * other modes leave those three fields as stored. Every mode keeps the terms it
95
+ * does not use, because a mode switch must not lose the pose.
28
96
  */
29
97
  export function resolveModel3DCamera(style, anim) {
30
98
  const camera = style.camera;
31
- return {
99
+ const resolved = {
32
100
  ...camera,
33
101
  azimuthDeg: camera.azimuthDeg + anim.cameraAzimuth,
34
102
  elevationDeg: camera.elevationDeg + anim.cameraElevation,
35
103
  fovDeg: camera.fovDeg + anim.cameraFov,
36
104
  zoom: camera.zoom * anim.cameraZoom
37
105
  };
106
+ if (camera.mode !== "free")
107
+ return resolved;
108
+ const pose = model3dFreeCameraPose(camera);
109
+ resolved.position = [
110
+ pose.position[0] + anim.cameraPosX,
111
+ pose.position[1] + anim.cameraPosY,
112
+ pose.position[2] + anim.cameraPosZ
113
+ ];
114
+ resolved.target = [
115
+ pose.target[0] + anim.cameraTargetX,
116
+ pose.target[1] + anim.cameraTargetY,
117
+ pose.target[2] + anim.cameraTargetZ
118
+ ];
119
+ resolved.rollDeg = pose.rollDeg + anim.cameraRoll;
120
+ return resolved;
121
+ }
122
+ const DEG = Math.PI / 180;
123
+ function sub(a, b) {
124
+ return [a[0] - b[0], a[1] - b[1], a[2] - b[2]];
125
+ }
126
+ function cross(a, b) {
127
+ return [
128
+ a[1] * b[2] - a[2] * b[1],
129
+ a[2] * b[0] - a[0] * b[2],
130
+ a[0] * b[1] - a[1] * b[0]
131
+ ];
132
+ }
133
+ function length(v) {
134
+ return Math.hypot(v[0], v[1], v[2]);
135
+ }
136
+ function scaled(v, s) {
137
+ return [v[0] * s, v[1] * s, v[2] * s];
138
+ }
139
+ /**
140
+ * The axes of a free camera at `position` looking at `target`, rolled by
141
+ * `rollDeg`.
142
+ *
143
+ * With no roll, `right` is horizontal and `up` leans toward world +Y. A
144
+ * positive roll turns the camera counter-clockwise around its view axis as
145
+ * seen from behind it, so the horizon turns clockwise in the picture:
146
+ * `up = cos(roll) * up0 - sin(roll) * right0`. This is `lookAt` followed by
147
+ * `rotateZ(roll)` in three.js.
148
+ *
149
+ * A camera with `position` equal to `target` looks down -Z. A camera looking
150
+ * straight up or down has no horizontal right, so it takes world +X.
151
+ */
152
+ export function model3dFreeCameraBasis(position, target, rollDeg = 0) {
153
+ const toTarget = sub(target, position);
154
+ const distance = length(toTarget);
155
+ const forward = distance > 1e-9 ? scaled(toTarget, 1 / distance) : [0, 0, -1];
156
+ const flat = cross(forward, [0, 1, 0]);
157
+ const flatLength = length(flat);
158
+ const right0 = flatLength > 1e-6 ? scaled(flat, 1 / flatLength) : [1, 0, 0];
159
+ const up0 = cross(right0, forward);
160
+ const cos = Math.cos(rollDeg * DEG);
161
+ const sin = Math.sin(rollDeg * DEG);
162
+ return {
163
+ forward,
164
+ right: [
165
+ cos * right0[0] + sin * up0[0],
166
+ cos * right0[1] + sin * up0[1],
167
+ cos * right0[2] + sin * up0[2]
168
+ ],
169
+ up: [
170
+ cos * up0[0] - sin * right0[0],
171
+ cos * up0[1] - sin * right0[1],
172
+ cos * up0[2] - sin * right0[2]
173
+ ]
174
+ };
175
+ }
176
+ /** The sensor height the lens conversions assume: a full-frame 36 x 24 mm. */
177
+ export const MODEL3D_SENSOR_HEIGHT_MM = 24;
178
+ /**
179
+ * The vertical field of view, in degrees, of a lens `focalLengthMm` long on a
180
+ * 24 mm tall sensor: `2 * atan(12 / f)`. A 50 mm lens is about 27 degrees.
181
+ */
182
+ export function focalLengthMmToFovDeg(focalLengthMm) {
183
+ const half = MODEL3D_SENSOR_HEIGHT_MM / 2;
184
+ return (2 * Math.atan(half / Math.max(focalLengthMm, 1e-6))) / DEG;
185
+ }
186
+ /** The inverse of {@link focalLengthMmToFovDeg}: `12 / tan(fov / 2)`. */
187
+ export function fovDegToFocalLengthMm(fovDeg) {
188
+ const half = MODEL3D_SENSOR_HEIGHT_MM / 2;
189
+ const clamped = Math.min(Math.max(fovDeg, 1e-6), 179.999);
190
+ return half / Math.tan((clamped * DEG) / 2);
191
+ }
192
+ /**
193
+ * The distance that fits a bounding sphere of `radius` into a camera with the
194
+ * given vertical fov and aspect, with `zoom` applied (above 1 moves closer).
195
+ *
196
+ * The same math as `computeFraming` in
197
+ * `packages/video-nodes/src/nodes/model3d/render3d-core.ts` and
198
+ * `compute_framing` in `packages/blender-nodes/blender_ops/framing.py`. The
199
+ * render core keeps its own copy because its headless page bundle must not
200
+ * pull this package in, and `packages/video-nodes/tests/model3d-render.test.ts`
201
+ * pins the two to each other.
202
+ */
203
+ export function computeModel3DOrbitFraming(radius, fovDeg, aspect, zoom) {
204
+ const safeRadius = Math.max(radius, 1e-6);
205
+ const vFov = Math.max(fovDeg, 1) * DEG;
206
+ const hFov = 2 * Math.atan(Math.tan(vFov / 2) * Math.max(aspect, 1e-6));
207
+ const fitV = safeRadius / Math.sin(vFov / 2);
208
+ const fitH = safeRadius / Math.sin(hFov / 2);
209
+ const distance = Math.max(fitV, fitH) / Math.max(zoom, 1e-3);
210
+ return {
211
+ distance,
212
+ near: Math.max(distance - safeRadius * 4, distance / 100, 1e-4),
213
+ far: distance + safeRadius * 10
214
+ };
215
+ }
216
+ /**
217
+ * The offset from the look-at point to an orbit camera `distance` away.
218
+ * Azimuth 0 sits on +Z and looks down -Z, and a growing azimuth moves the
219
+ * camera toward +X. The same math as `orbitOffset` in the render core.
220
+ */
221
+ export function model3dOrbitOffset(azimuthDeg, elevationDeg, distance) {
222
+ const az = azimuthDeg * DEG;
223
+ const el = Math.min(Math.max(elevationDeg, -89.9), 89.9) * DEG;
224
+ return [
225
+ distance * Math.cos(el) * Math.sin(az),
226
+ distance * Math.sin(el),
227
+ distance * Math.cos(el) * Math.cos(az)
228
+ ];
229
+ }
230
+ /**
231
+ * The `free` camera that draws the picture an `orbit` camera draws.
232
+ *
233
+ * The orbit terms stay on the result, so switching back to `orbit` restores
234
+ * the old pose. `fit` has to describe the model the clip renders: the bounding
235
+ * sphere of its rest pose and the aspect of the picture. Pass a camera already
236
+ * folded by {@link resolveModel3DCamera} to convert the animated pose at one
237
+ * instant. A camera that is not in `orbit` mode is returned as a copy.
238
+ */
239
+ export function orbitCameraToFree(camera, fit) {
240
+ if (camera.mode !== "orbit")
241
+ return { ...camera };
242
+ const offsetToTarget = camera.targetOffset ?? [0, 0, 0];
243
+ const target = [
244
+ fit.center[0] + offsetToTarget[0],
245
+ fit.center[1] + offsetToTarget[1],
246
+ fit.center[2] + offsetToTarget[2]
247
+ ];
248
+ const framing = computeModel3DOrbitFraming(fit.radius, camera.fovDeg, fit.aspect, camera.zoom);
249
+ const offset = model3dOrbitOffset(camera.azimuthDeg, camera.elevationDeg, framing.distance);
250
+ return {
251
+ ...camera,
252
+ mode: "free",
253
+ position: [
254
+ target[0] + offset[0],
255
+ target[1] + offset[1],
256
+ target[2] + offset[2]
257
+ ],
258
+ target,
259
+ rollDeg: 0
260
+ };
38
261
  }
39
262
  //# sourceMappingURL=model3d.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"model3d.js","sourceRoot":"","sources":["../src/model3d.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAoBH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AC,GAAG,cAAc,CAAC,CAAC,CAAC;QACjC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC;QACjC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC;KAClC,CAAC;IACF,MAAM,OAAO,GAAG,0BAA0B,CACxC,GAAG,CAAC,MAAM,EACV,MAAM,CAAC,MAAM,EACb,GAAG,CAAC,MAAM,EACV,MAAM,CAAC,IAAI,CACZ,CAAC;IACF,MAAM,MAAM,GAAG,kBAAkB,CAC/B,MAAM,CAAC,UAAU,EACjB,MAAM,CAAC,YAAY,EACnB,OAAO,CAAC,QAAQ,CACjB,CAAC;IACF,OAAO;QACL,GAAG,MAAM;QACT,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE;YACR,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;YACrB,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;YACrB,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;SACtB;QACD,MAAM;QACN,OAAO,EAAE,CAAC;KACX,CAAC;AACJ,CAAC"}
@@ -25,13 +25,13 @@ export interface Model3DBakeRenderSettings {
25
25
  }
26
26
  /**
27
27
  * One frame's camera as the Blender job takes it: `CameraParams` from
28
- * `@nodetool-ai/blender-nodes`, plus the two fields `ClipModel3DCamera`
29
- * carries that the DTO did not have. Declared here rather than imported
30
- * because this package is pure TypeScript and knows nothing about a runner;
28
+ * `@nodetool-ai/blender-nodes`, plus the fields `ClipModel3DCamera` carries
29
+ * that the DTO did not have, the free camera's pose among them. Declared here
30
+ * rather than imported because this package is pure TypeScript and knows nothing about a runner;
31
31
  * the two shapes are checked against each other where they meet.
32
32
  */
33
33
  export interface Model3DBakeCameraParams {
34
- camera_mode: "auto" | "scene" | "orbit";
34
+ camera_mode: "auto" | "scene" | "orbit" | "free";
35
35
  azimuth: number;
36
36
  elevation: number;
37
37
  fov: number;
@@ -48,11 +48,22 @@ export interface Model3DBakeCameraParams {
48
48
  scene_camera_name?: string;
49
49
  /** Look-at offset from the bounding-sphere center, world units. */
50
50
  target_offset?: [number, number, number];
51
+ /** `free` mode: the camera eye, glTF world units (Y up). */
52
+ position?: [number, number, number];
53
+ /** `free` mode: the look-at point, glTF world units (Y up). */
54
+ target?: [number, number, number];
55
+ /** `free` mode: roll in degrees. Positive turns the horizon clockwise. */
56
+ roll?: number;
51
57
  }
52
58
  /**
53
- * The clip's camera as one frame of the bake job. `orbit` and `scene` are the
54
- * only two modes a clip has; the job's `auto` is not reachable from a clip,
59
+ * The clip's camera as one frame of the bake job. `orbit`, `scene` and `free`
60
+ * are the modes a clip has; the job's `auto` is not reachable from a clip,
55
61
  * which is what makes the reverse mapping total.
62
+ *
63
+ * A `free` camera always sends `position`, `target` and `roll`, with the
64
+ * defaults of {@link model3dFreeCameraPose} filled in, so the Blender op never
65
+ * has to know them. The other modes send those fields only when the clip
66
+ * stores them.
56
67
  */
57
68
  export declare function model3dBakeCameraParams(camera: ClipModel3DCamera, style: ClipModel3DStyle, render: Model3DBakeRenderSettings): Model3DBakeCameraParams;
58
69
  /**
@@ -62,19 +73,38 @@ export declare function model3dBakeCameraParams(camera: ClipModel3DCamera, style
62
73
  * request, not to the camera, so they are not read back.
63
74
  */
64
75
  export declare function clipModel3DCameraFromBakeParams(params: Model3DBakeCameraParams): ClipModel3DCamera;
76
+ /**
77
+ * FNV-1a over the payload, twice with different offsets, as 16 hex digits.
78
+ *
79
+ * Not a cryptographic digest, and deliberately not one: the browser preview,
80
+ * the browser export and the server validator all compare this value, they
81
+ * compare it synchronously once per layer per frame, and `node:crypto` does
82
+ * not exist in a bundle while Web Crypto only digests asynchronously. What
83
+ * the value has to be is identical on every host for the same input, which a
84
+ * pure-arithmetic hash over a canonically ordered payload is.
85
+ */
86
+ export declare function model3dPictureDigest(payload: string): string;
87
+ /**
88
+ * Everything about a clip and its sequence that a render of the clip's span
89
+ * depends on, apart from the style, which each caller narrows first. The
90
+ * Blender bake and the Blockout reference both hash this record, so a field
91
+ * added here makes both stale.
92
+ */
93
+ export declare function model3dPictureInputs(clip: TimelineClip, sequence: Model3DBakeSequence, style: Partial<ClipModel3DStyle>): Record<string, unknown>;
65
94
  /**
66
95
  * The hash a `model3d` clip's bake is stored under, and checked against.
67
96
  *
68
97
  * It names every input the baked picture depends on (§D6): the style without
69
- * `bake` itself, the glTF asset, the clip's animations (the camera curves and
70
- * the `orbit` preset among them), the trim window, the duration, the speed,
71
- * the time remap, and the sequence's fps and size. A change to any of them
72
- * makes the bake stale and the live 3D layer draws again.
98
+ * `bake` and `reference`, the glTF asset, the clip's animations (the camera
99
+ * curves and the `orbit` preset among them), the trim window, the duration,
100
+ * the speed, the time remap, and the sequence's fps and size. A change to any
101
+ * of them makes the bake stale and the live 3D layer draws again.
73
102
  *
74
103
  * Everything else about the clip is deliberately absent: start, track,
75
104
  * transform, opacity, effects, mask and matte apply to the baked layer the
76
105
  * way they apply to any video clip, so a change to one of them does not need
77
- * a re-render.
106
+ * a re-render. `reference` is a render of the clip, not an input to one, so
107
+ * storing a Blockout reference leaves a bake current.
78
108
  */
79
109
  export declare function computeModel3DBakeHash(clip: TimelineClip, sequence: Model3DBakeSequence): string;
80
110
  //# sourceMappingURL=model3dBake.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"model3dBake.d.ts","sourceRoot":"","sources":["../src/model3dBake.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB,mDAAmD;AACnD,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,0EAA0E;AAC1E,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,O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