@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.
- package/dist/.nodetool-build-stamp +1 -1
- package/dist/animation/custom.d.ts.map +1 -1
- package/dist/animation/custom.js +35 -0
- package/dist/animation/custom.js.map +1 -1
- package/dist/animation/sample.d.ts +14 -0
- package/dist/animation/sample.d.ts.map +1 -1
- package/dist/animation/sample.js +22 -1
- package/dist/animation/sample.js.map +1 -1
- package/dist/animation/types.d.ts +8 -1
- package/dist/animation/types.d.ts.map +1 -1
- package/dist/animation/types.js +31 -3
- package/dist/animation/types.js.map +1 -1
- package/dist/authoredStyles.d.ts +7 -1
- package/dist/authoredStyles.d.ts.map +1 -1
- package/dist/authoredStyles.js +6 -1
- package/dist/authoredStyles.js.map +1 -1
- package/dist/autoCrossfade.d.ts +30 -0
- package/dist/autoCrossfade.d.ts.map +1 -0
- package/dist/autoCrossfade.js +130 -0
- package/dist/autoCrossfade.js.map +1 -0
- package/dist/automation.d.ts +32 -1
- package/dist/automation.d.ts.map +1 -1
- package/dist/automation.js +78 -1
- package/dist/automation.js.map +1 -1
- package/dist/automationRanges.d.ts +375 -0
- package/dist/automationRanges.d.ts.map +1 -0
- package/dist/automationRanges.js +375 -0
- package/dist/automationRanges.js.map +1 -0
- package/dist/clipAudio.d.ts +3 -1
- package/dist/clipAudio.d.ts.map +1 -1
- package/dist/clipAudio.js.map +1 -1
- package/dist/clipLoop.d.ts +67 -0
- package/dist/clipLoop.d.ts.map +1 -0
- package/dist/clipLoop.js +339 -0
- package/dist/clipLoop.js.map +1 -0
- package/dist/clipSpeed.d.ts.map +1 -1
- package/dist/clipSpeed.js +7 -0
- package/dist/clipSpeed.js.map +1 -1
- package/dist/defaults.d.ts.map +1 -1
- package/dist/defaults.js +9 -0
- package/dist/defaults.js.map +1 -1
- package/dist/dropResolve.d.ts.map +1 -1
- package/dist/dropResolve.js +56 -17
- package/dist/dropResolve.js.map +1 -1
- package/dist/finish-storyboard.d.ts.map +1 -1
- package/dist/finish-storyboard.js +6 -1
- package/dist/finish-storyboard.js.map +1 -1
- package/dist/harmony/chordChart.d.ts +25 -0
- package/dist/harmony/chordChart.d.ts.map +1 -0
- package/dist/harmony/chordChart.js +99 -0
- package/dist/harmony/chordChart.js.map +1 -0
- package/dist/harmony/chordRange.d.ts +9 -0
- package/dist/harmony/chordRange.d.ts.map +1 -0
- package/dist/harmony/chordRange.js +32 -0
- package/dist/harmony/chordRange.js.map +1 -0
- package/dist/harmony/chordSymbols.d.ts +28 -0
- package/dist/harmony/chordSymbols.d.ts.map +1 -0
- package/dist/harmony/chordSymbols.js +147 -0
- package/dist/harmony/chordSymbols.js.map +1 -0
- package/dist/harmony/chordTrack.d.ts +13 -0
- package/dist/harmony/chordTrack.d.ts.map +1 -0
- package/dist/harmony/chordTrack.js +11 -0
- package/dist/harmony/chordTrack.js.map +1 -0
- package/dist/harmony/detect.d.ts +35 -0
- package/dist/harmony/detect.d.ts.map +1 -0
- package/dist/harmony/detect.js +138 -0
- package/dist/harmony/detect.js.map +1 -0
- package/dist/harmony/detectAudio.d.ts +62 -0
- package/dist/harmony/detectAudio.d.ts.map +1 -0
- package/dist/harmony/detectAudio.js +226 -0
- package/dist/harmony/detectAudio.js.map +1 -0
- package/dist/harmony/expand.d.ts +7 -12
- package/dist/harmony/expand.d.ts.map +1 -1
- package/dist/harmony/expand.js +63 -11
- package/dist/harmony/expand.js.map +1 -1
- package/dist/harmony/index.d.ts +7 -0
- package/dist/harmony/index.d.ts.map +1 -1
- package/dist/harmony/index.js +7 -0
- package/dist/harmony/index.js.map +1 -1
- package/dist/harmony/progressionLibrary.d.ts +33 -0
- package/dist/harmony/progressionLibrary.d.ts.map +1 -0
- package/dist/harmony/progressionLibrary.js +71 -0
- package/dist/harmony/progressionLibrary.js.map +1 -0
- package/dist/harmony/summary.d.ts +4 -0
- package/dist/harmony/summary.d.ts.map +1 -0
- package/dist/harmony/summary.js +22 -0
- package/dist/harmony/summary.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/interchange.d.ts.map +1 -1
- package/dist/interchange.js +3 -0
- package/dist/interchange.js.map +1 -1
- package/dist/keyframes.d.ts +12 -2
- package/dist/keyframes.d.ts.map +1 -1
- package/dist/keyframes.js +24 -1
- package/dist/keyframes.js.map +1 -1
- package/dist/loopWindow.d.ts +17 -0
- package/dist/loopWindow.d.ts.map +1 -0
- package/dist/loopWindow.js +34 -0
- package/dist/loopWindow.js.map +1 -0
- package/dist/midi/cacheKey.d.ts +11 -2
- package/dist/midi/cacheKey.d.ts.map +1 -1
- package/dist/midi/cacheKey.js +69 -9
- package/dist/midi/cacheKey.js.map +1 -1
- package/dist/midi/controllerEdit.d.ts +35 -0
- package/dist/midi/controllerEdit.d.ts.map +1 -0
- package/dist/midi/controllerEdit.js +94 -0
- package/dist/midi/controllerEdit.js.map +1 -0
- package/dist/midi/controllerRange.d.ts +13 -0
- package/dist/midi/controllerRange.d.ts.map +1 -0
- package/dist/midi/controllerRange.js +13 -0
- package/dist/midi/controllerRange.js.map +1 -0
- package/dist/midi/controllers.d.ts +95 -0
- package/dist/midi/controllers.d.ts.map +1 -0
- package/dist/midi/controllers.js +421 -0
- package/dist/midi/controllers.js.map +1 -0
- package/dist/midi/curveCut.d.ts +17 -0
- package/dist/midi/curveCut.d.ts.map +1 -0
- package/dist/midi/curveCut.js +45 -0
- package/dist/midi/curveCut.js.map +1 -0
- package/dist/midi/edit.d.ts +13 -1
- package/dist/midi/edit.d.ts.map +1 -1
- package/dist/midi/edit.js +19 -3
- package/dist/midi/edit.js.map +1 -1
- package/dist/midi/engines/bl1.d.ts +10 -1
- package/dist/midi/engines/bl1.d.ts.map +1 -1
- package/dist/midi/engines/bl1.js +26 -6
- package/dist/midi/engines/bl1.js.map +1 -1
- package/dist/midi/engines/dr1.d.ts +11 -1
- package/dist/midi/engines/dr1.d.ts.map +1 -1
- package/dist/midi/engines/dr1.js +21 -3
- package/dist/midi/engines/dr1.js.map +1 -1
- package/dist/midi/engines/dsp.d.ts +1 -1
- package/dist/midi/engines/dsp.d.ts.map +1 -1
- package/dist/midi/engines/dsp.js +10 -2
- package/dist/midi/engines/dsp.js.map +1 -1
- package/dist/midi/engines/wt1.d.ts +10 -1
- package/dist/midi/engines/wt1.d.ts.map +1 -1
- package/dist/midi/engines/wt1.js +28 -5
- package/dist/midi/engines/wt1.js.map +1 -1
- package/dist/midi/events.d.ts +13 -4
- package/dist/midi/events.d.ts.map +1 -1
- package/dist/midi/events.js +33 -6
- package/dist/midi/events.js.map +1 -1
- package/dist/midi/expression.d.ts +25 -0
- package/dist/midi/expression.d.ts.map +1 -0
- package/dist/midi/expression.js +69 -0
- package/dist/midi/expression.js.map +1 -0
- package/dist/midi/index.d.ts +8 -0
- package/dist/midi/index.d.ts.map +1 -1
- package/dist/midi/index.js +8 -0
- package/dist/midi/index.js.map +1 -1
- package/dist/midi/instrument.d.ts.map +1 -1
- package/dist/midi/instrument.js +4 -0
- package/dist/midi/instrument.js.map +1 -1
- package/dist/midi/noteFunctions.d.ts +29 -0
- package/dist/midi/noteFunctions.d.ts.map +1 -0
- package/dist/midi/noteFunctions.js +213 -0
- package/dist/midi/noteFunctions.js.map +1 -0
- package/dist/midi/notes.d.ts +7 -1
- package/dist/midi/notes.d.ts.map +1 -1
- package/dist/midi/notes.js +43 -1
- package/dist/midi/notes.js.map +1 -1
- package/dist/midi/notesEdit.d.ts +13 -0
- package/dist/midi/notesEdit.d.ts.map +1 -1
- package/dist/midi/notesEdit.js +73 -2
- package/dist/midi/notesEdit.js.map +1 -1
- package/dist/midi/presets.d.ts +1 -1
- package/dist/midi/regionParams.d.ts +41 -0
- package/dist/midi/regionParams.d.ts.map +1 -0
- package/dist/midi/regionParams.js +164 -0
- package/dist/midi/regionParams.js.map +1 -0
- package/dist/midi/sampler.d.ts +2 -2
- package/dist/midi/sampler.d.ts.map +1 -1
- package/dist/midi/sampler.js +99 -21
- package/dist/midi/sampler.js.map +1 -1
- package/dist/midi/stepEditor.d.ts +50 -0
- package/dist/midi/stepEditor.d.ts.map +1 -0
- package/dist/midi/stepEditor.js +118 -0
- package/dist/midi/stepEditor.js.map +1 -0
- package/dist/midi/stepPattern.d.ts +173 -0
- package/dist/midi/stepPattern.d.ts.map +1 -0
- package/dist/midi/stepPattern.js +1390 -0
- package/dist/midi/stepPattern.js.map +1 -0
- package/dist/midi/stepPatternExpand.d.ts +149 -0
- package/dist/midi/stepPatternExpand.d.ts.map +1 -0
- package/dist/midi/stepPatternExpand.js +1068 -0
- package/dist/midi/stepPatternExpand.js.map +1 -0
- package/dist/midi/stepPatternLibrary.d.ts +65 -0
- package/dist/midi/stepPatternLibrary.d.ts.map +1 -0
- package/dist/midi/stepPatternLibrary.js +640 -0
- package/dist/midi/stepPatternLibrary.js.map +1 -0
- package/dist/midi/tempo.d.ts.map +1 -1
- package/dist/midi/tempo.js +3 -0
- package/dist/midi/tempo.js.map +1 -1
- package/dist/midi/voice.d.ts +51 -5
- package/dist/midi/voice.d.ts.map +1 -1
- package/dist/midi/voice.js +191 -21
- package/dist/midi/voice.js.map +1 -1
- package/dist/model3d.d.ts +132 -8
- package/dist/model3d.d.ts.map +1 -1
- package/dist/model3d.js +230 -7
- package/dist/model3d.js.map +1 -1
- package/dist/model3dBake.d.ts +41 -11
- package/dist/model3dBake.d.ts.map +1 -1
- package/dist/model3dBake.js +58 -21
- package/dist/model3dBake.js.map +1 -1
- package/dist/model3dBlockout.d.ts +62 -0
- package/dist/model3dBlockout.d.ts.map +1 -0
- package/dist/model3dBlockout.js +59 -0
- package/dist/model3dBlockout.js.map +1 -0
- package/dist/model3dCameraDescription.d.ts +32 -0
- package/dist/model3dCameraDescription.d.ts.map +1 -0
- package/dist/model3dCameraDescription.js +253 -0
- package/dist/model3dCameraDescription.js.map +1 -0
- package/dist/model3dCameraKeys.d.ts +47 -0
- package/dist/model3dCameraKeys.d.ts.map +1 -0
- package/dist/model3dCameraKeys.js +156 -0
- package/dist/model3dCameraKeys.js.map +1 -0
- package/dist/model3dCameraMoves.d.ts +97 -0
- package/dist/model3dCameraMoves.d.ts.map +1 -0
- package/dist/model3dCameraMoves.js +329 -0
- package/dist/model3dCameraMoves.js.map +1 -0
- package/dist/model3dReference.d.ts +96 -0
- package/dist/model3dReference.d.ts.map +1 -0
- package/dist/model3dReference.js +113 -0
- package/dist/model3dReference.js.map +1 -0
- package/dist/music/align.d.ts +111 -0
- package/dist/music/align.d.ts.map +1 -0
- package/dist/music/align.js +282 -0
- package/dist/music/align.js.map +1 -0
- package/dist/music/cut.d.ts +33 -0
- package/dist/music/cut.d.ts.map +1 -0
- package/dist/music/cut.js +50 -0
- package/dist/music/cut.js.map +1 -0
- package/dist/music/frames.d.ts +51 -0
- package/dist/music/frames.d.ts.map +1 -0
- package/dist/music/frames.js +110 -0
- package/dist/music/frames.js.map +1 -0
- package/dist/music/gain.d.ts +24 -0
- package/dist/music/gain.d.ts.map +1 -0
- package/dist/music/gain.js +38 -0
- package/dist/music/gain.js.map +1 -0
- package/dist/music/index.d.ts +9 -0
- package/dist/music/index.d.ts.map +1 -0
- package/dist/music/index.js +9 -0
- package/dist/music/index.js.map +1 -0
- package/dist/music/plan.d.ts +106 -0
- package/dist/music/plan.d.ts.map +1 -0
- package/dist/music/plan.js +304 -0
- package/dist/music/plan.js.map +1 -0
- package/dist/music/process.d.ts +9 -0
- package/dist/music/process.d.ts.map +1 -0
- package/dist/music/process.js +9 -0
- package/dist/music/process.js.map +1 -0
- package/dist/music/roles.d.ts +14 -0
- package/dist/music/roles.d.ts.map +1 -0
- package/dist/music/roles.js +30 -0
- package/dist/music/roles.js.map +1 -0
- package/dist/music/splice.d.ts +37 -0
- package/dist/music/splice.d.ts.map +1 -0
- package/dist/music/splice.js +67 -0
- package/dist/music/splice.js.map +1 -0
- package/dist/music/tempoRules.d.ts +41 -0
- package/dist/music/tempoRules.d.ts.map +1 -0
- package/dist/music/tempoRules.js +59 -0
- package/dist/music/tempoRules.js.map +1 -0
- package/dist/ops/apply.d.ts.map +1 -1
- package/dist/ops/apply.js +1009 -230
- package/dist/ops/apply.js.map +1 -1
- package/dist/ops/automation.d.ts +6 -0
- package/dist/ops/automation.d.ts.map +1 -0
- package/dist/ops/automation.js +217 -0
- package/dist/ops/automation.js.map +1 -0
- package/dist/ops/barTime.d.ts +14 -0
- package/dist/ops/barTime.d.ts.map +1 -0
- package/dist/ops/barTime.js +33 -0
- package/dist/ops/barTime.js.map +1 -0
- package/dist/ops/chords.d.ts +43 -0
- package/dist/ops/chords.d.ts.map +1 -0
- package/dist/ops/chords.js +691 -0
- package/dist/ops/chords.js.map +1 -0
- package/dist/ops/groupBake.d.ts +24 -0
- package/dist/ops/groupBake.d.ts.map +1 -0
- package/dist/ops/groupBake.js +81 -0
- package/dist/ops/groupBake.js.map +1 -0
- package/dist/ops/index.d.ts +7 -0
- package/dist/ops/index.d.ts.map +1 -1
- package/dist/ops/index.js +5 -0
- package/dist/ops/index.js.map +1 -1
- package/dist/ops/join.d.ts +20 -0
- package/dist/ops/join.d.ts.map +1 -0
- package/dist/ops/join.js +265 -0
- package/dist/ops/join.js.map +1 -0
- package/dist/ops/loop.d.ts +29 -0
- package/dist/ops/loop.d.ts.map +1 -0
- package/dist/ops/loop.js +107 -0
- package/dist/ops/loop.js.map +1 -0
- package/dist/ops/midiMix.d.ts +41 -0
- package/dist/ops/midiMix.d.ts.map +1 -0
- package/dist/ops/midiMix.js +522 -0
- package/dist/ops/midiMix.js.map +1 -0
- package/dist/ops/op.d.ts +94 -11
- package/dist/ops/op.d.ts.map +1 -1
- package/dist/ops/op.js +62 -1
- package/dist/ops/op.js.map +1 -1
- package/dist/ops/parse.d.ts.map +1 -1
- package/dist/ops/parse.js +316 -4
- package/dist/ops/parse.js.map +1 -1
- package/dist/ops/pasteRange.d.ts +46 -0
- package/dist/ops/pasteRange.d.ts.map +1 -0
- package/dist/ops/pasteRange.js +276 -0
- package/dist/ops/pasteRange.js.map +1 -0
- package/dist/ops/plugin.d.ts +57 -0
- package/dist/ops/plugin.d.ts.map +1 -0
- package/dist/ops/plugin.js +875 -0
- package/dist/ops/plugin.js.map +1 -0
- package/dist/ops/sections.d.ts +98 -0
- package/dist/ops/sections.d.ts.map +1 -0
- package/dist/ops/sections.js +930 -0
- package/dist/ops/sections.js.map +1 -0
- package/dist/ops/serialize.d.ts +79 -1
- package/dist/ops/serialize.d.ts.map +1 -1
- package/dist/ops/serialize.js +85 -3
- package/dist/ops/serialize.js.map +1 -1
- package/dist/ops/stepPattern.d.ts +44 -0
- package/dist/ops/stepPattern.d.ts.map +1 -0
- package/dist/ops/stepPattern.js +2106 -0
- package/dist/ops/stepPattern.js.map +1 -0
- package/dist/ops/stepPatternFolders.d.ts +54 -0
- package/dist/ops/stepPatternFolders.d.ts.map +1 -0
- package/dist/ops/stepPatternFolders.js +299 -0
- package/dist/ops/stepPatternFolders.js.map +1 -0
- package/dist/ops/types.d.ts +260 -2
- package/dist/ops/types.d.ts.map +1 -1
- package/dist/render/index.d.ts +1 -0
- package/dist/render/index.d.ts.map +1 -1
- package/dist/render/index.js +1 -0
- package/dist/render/index.js.map +1 -1
- package/dist/render/model3dReferenceSamples.d.ts +25 -0
- package/dist/render/model3dReferenceSamples.d.ts.map +1 -0
- package/dist/render/model3dReferenceSamples.js +25 -0
- package/dist/render/model3dReferenceSamples.js.map +1 -0
- package/dist/render/sceneModel.d.ts +1 -1
- package/dist/render/sceneModel.d.ts.map +1 -1
- package/dist/render/sceneModel.js +10 -5
- package/dist/render/sceneModel.js.map +1 -1
- package/dist/rippleEdit.d.ts +5 -1
- package/dist/rippleEdit.d.ts.map +1 -1
- package/dist/rippleEdit.js +24 -9
- package/dist/rippleEdit.js.map +1 -1
- package/dist/scene.d.ts +1 -0
- package/dist/scene.d.ts.map +1 -1
- package/dist/scene.js +1 -0
- package/dist/scene.js.map +1 -1
- package/dist/shotLink.d.ts +35 -0
- package/dist/shotLink.d.ts.map +1 -1
- package/dist/shotLink.js +100 -0
- package/dist/shotLink.js.map +1 -1
- package/dist/splitClip.d.ts +29 -1
- package/dist/splitClip.d.ts.map +1 -1
- package/dist/splitClip.js +231 -1
- package/dist/splitClip.js.map +1 -1
- package/dist/testing/host-ops.js +3 -3
- package/dist/testing/host-ops.js.map +1 -1
- package/dist/testing/ops.d.ts +6 -1
- package/dist/testing/ops.d.ts.map +1 -1
- package/dist/testing/ops.js +872 -13
- package/dist/testing/ops.js.map +1 -1
- package/dist/timeRemap.d.ts +2 -2
- package/dist/timeRemap.d.ts.map +1 -1
- package/dist/timeRemap.js +18 -0
- package/dist/timeRemap.js.map +1 -1
- package/dist/trimClip.d.ts +1 -1
- package/dist/trimClip.d.ts.map +1 -1
- package/dist/trimClip.js +41 -7
- package/dist/trimClip.js.map +1 -1
- package/dist/types.d.ts +331 -15
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- 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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
* `
|
|
38
|
-
*
|
|
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
|
package/dist/model3d.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model3d.d.ts","sourceRoot":"","sources":["../src/model3d.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"model3d.d.ts","sourceRoot":"","sources":["../src/model3d.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAEpB,oEAAoE;AACpE,MAAM,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,EAA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YrB;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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
* `
|
|
27
|
-
*
|
|
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
|
-
|
|
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
|
package/dist/model3d.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model3d.js","sourceRoot":"","sources":["../src/model3d.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"model3d.js","sourceRoot":"","sources":["../src/model3d.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAyCH,kEAAkE;AAClE,MAAM,CAAC,MAAM,gCAAgC,GAC3C,MAAM,CAAC,MAAM,CAAC;IACZ,aAAa,EAAE,CAAC;IAChB,eAAe,EAAE,CAAC;IAClB,UAAU,EAAE,CAAC;IACb,SAAS,EAAE,CAAC;IACZ,UAAU,EAAE,CAAC;IACb,UAAU,EAAE,CAAC;IACb,UAAU,EAAE,CAAC;IACb,aAAa,EAAE,CAAC;IAChB,aAAa,EAAE,CAAC;IAChB,aAAa,EAAE,CAAC;IAChB,UAAU,EAAE,CAAC;CACd,CAAC,CAAC;AAEL,4CAA4C;AAC5C,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,eAAe;IACf,iBAAiB;IACjB,YAAY;IACZ,WAAW;CACgD,CAAC;AAE9D,mEAAmE;AACnE,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,eAAe;IACf,eAAe;IACf,eAAe;IACf,YAAY;IACZ,WAAW;CACgD,CAAC;AAE9D;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,eAAe;IACf,iBAAiB;IACjB,YAAY;IACZ,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,Y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,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"}
|
package/dist/model3dBake.d.ts
CHANGED
|
@@ -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
|
|
29
|
-
*
|
|
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 `
|
|
54
|
-
*
|
|
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`
|
|
70
|
-
* the `orbit` preset among them), the trim window, the duration,
|
|
71
|
-
* the time remap, and the sequence's fps and size. A change to any
|
|
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;
|
|
1
|
+
{"version":3,"file":"model3dBake.d.ts","sourceRoot":"","sources":["../src/model3dBake.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,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,OAAO,GAAG,QAAQ,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,0DAA0D;IAC1D,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;IACrC,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,uDAAuD;IACvD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mEAAmE;IACnE,aAAa,C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