@automovie/render 0.3.0 → 0.3.2

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 (110) hide show
  1. package/lib/AutoMovieFrameGrid.d.ts +54 -0
  2. package/lib/AutoMovieFrameGrid.js +71 -0
  3. package/lib/AutoMovieFrameGrid.js.map +1 -0
  4. package/lib/AutoMovieFrameGrid.mjs +20 -0
  5. package/lib/AutoMovieFrameGrid.mjs.map +1 -0
  6. package/lib/caption/canonicalProductionWebVtt.d.ts +5 -3
  7. package/lib/caption/canonicalProductionWebVtt.js +19 -4
  8. package/lib/caption/canonicalProductionWebVtt.js.map +1 -1
  9. package/lib/caption/canonicalProductionWebVtt.mjs +15 -4
  10. package/lib/caption/canonicalProductionWebVtt.mjs.map +1 -1
  11. package/lib/draw/bindAutoMovieDrawSceneSoftProps.d.ts +15 -0
  12. package/lib/draw/bindAutoMovieDrawSceneSoftProps.js +41 -0
  13. package/lib/draw/bindAutoMovieDrawSceneSoftProps.js.map +1 -0
  14. package/lib/draw/bindAutoMovieDrawSceneSoftProps.mjs +36 -0
  15. package/lib/draw/bindAutoMovieDrawSceneSoftProps.mjs.map +1 -0
  16. package/lib/draw/index.d.ts +1 -0
  17. package/lib/draw/index.js +1 -0
  18. package/lib/draw/index.js.map +1 -1
  19. package/lib/draw/index.mjs +2 -1
  20. package/lib/index.d.ts +1 -0
  21. package/lib/index.js +1 -0
  22. package/lib/index.js.map +1 -1
  23. package/lib/index.mjs +12 -7
  24. package/lib/planSequenceRender.d.ts +5 -5
  25. package/lib/planSequenceRender.js +12 -6
  26. package/lib/planSequenceRender.js.map +1 -1
  27. package/lib/planSequenceRender.mjs +12 -8
  28. package/lib/planSequenceRender.mjs.map +1 -1
  29. package/lib/scene/IAutoMovieSceneObject.d.ts +4 -1
  30. package/lib/scene/IAutoMovieSceneSoftProps.d.ts +36 -0
  31. package/lib/scene/IAutoMovieSceneSoftProps.js +3 -0
  32. package/lib/scene/IAutoMovieSceneSoftProps.js.map +1 -0
  33. package/lib/scene/IAutoMovieSceneSoftProps.mjs +0 -0
  34. package/lib/scene/IChunkObject.d.ts +7 -3
  35. package/lib/scene/applyPracticalSurfaceMaterials.d.ts +31 -0
  36. package/lib/scene/applyPracticalSurfaceMaterials.js +87 -0
  37. package/lib/scene/applyPracticalSurfaceMaterials.js.map +1 -0
  38. package/lib/scene/applyPracticalSurfaceMaterials.mjs +47 -0
  39. package/lib/scene/applyPracticalSurfaceMaterials.mjs.map +1 -0
  40. package/lib/scene/buildInstancedFormation.d.ts +1 -1
  41. package/lib/scene/buildInstancedFormation.js +44 -19
  42. package/lib/scene/buildInstancedFormation.js.map +1 -1
  43. package/lib/scene/buildInstancedFormation.mjs +30 -13
  44. package/lib/scene/buildInstancedFormation.mjs.map +1 -1
  45. package/lib/scene/buildScene.d.ts +10 -7
  46. package/lib/scene/buildScene.js +21 -7
  47. package/lib/scene/buildScene.js.map +1 -1
  48. package/lib/scene/buildScene.mjs +27 -9
  49. package/lib/scene/buildScene.mjs.map +1 -1
  50. package/lib/scene/buildSceneSoftProps.d.ts +15 -0
  51. package/lib/scene/buildSceneSoftProps.js +71 -0
  52. package/lib/scene/buildSceneSoftProps.js.map +1 -0
  53. package/lib/scene/buildSceneSoftProps.mjs +67 -0
  54. package/lib/scene/buildSceneSoftProps.mjs.map +1 -0
  55. package/lib/scene/human-polygon/AutoMovieHumanPolygon.d.ts +52 -1
  56. package/lib/scene/human-polygon/buildHumanPolygon.d.ts +3 -1
  57. package/lib/scene/human-polygon/buildHumanPolygon.js +14 -2
  58. package/lib/scene/human-polygon/buildHumanPolygon.js.map +1 -1
  59. package/lib/scene/human-polygon/buildHumanPolygon.mjs +11 -2
  60. package/lib/scene/human-polygon/buildHumanPolygon.mjs.map +1 -1
  61. package/lib/scene/human-polygon/buildPolygonShotActor.d.ts +40 -0
  62. package/lib/scene/human-polygon/buildPolygonShotActor.js +69 -0
  63. package/lib/scene/human-polygon/buildPolygonShotActor.js.map +1 -0
  64. package/lib/scene/human-polygon/buildPolygonShotActor.mjs +74 -0
  65. package/lib/scene/human-polygon/buildPolygonShotActor.mjs.map +1 -0
  66. package/lib/scene/human-polygon/index.d.ts +1 -0
  67. package/lib/scene/human-polygon/index.js +3 -1
  68. package/lib/scene/human-polygon/index.js.map +1 -1
  69. package/lib/scene/human-polygon/index.mjs +2 -1
  70. package/lib/scene/human-polygon/prepareHumanPolygonPresentation.d.ts +17 -0
  71. package/lib/scene/human-polygon/prepareHumanPolygonPresentation.js +231 -0
  72. package/lib/scene/human-polygon/prepareHumanPolygonPresentation.js.map +1 -0
  73. package/lib/scene/human-polygon/prepareHumanPolygonPresentation.mjs +189 -0
  74. package/lib/scene/human-polygon/prepareHumanPolygonPresentation.mjs.map +1 -0
  75. package/lib/scene/index.d.ts +3 -0
  76. package/lib/scene/index.js +3 -0
  77. package/lib/scene/index.js.map +1 -1
  78. package/lib/scene/index.mjs +45 -42
  79. package/lib/scene/renderAutoMovieFilmFrame.d.ts +6 -4
  80. package/lib/scene/renderAutoMovieFilmFrame.js +12 -8
  81. package/lib/scene/renderAutoMovieFilmFrame.js.map +1 -1
  82. package/lib/scene/renderAutoMovieFilmFrame.mjs +12 -8
  83. package/lib/scene/renderAutoMovieFilmFrame.mjs.map +1 -1
  84. package/lib/scene/softPropCordSurface.d.ts +14 -0
  85. package/lib/scene/softPropCordSurface.js +128 -0
  86. package/lib/scene/softPropCordSurface.js.map +1 -0
  87. package/lib/scene/softPropCordSurface.mjs +88 -0
  88. package/lib/scene/softPropCordSurface.mjs.map +1 -0
  89. package/package.json +4 -4
  90. package/src/AutoMovieFrameGrid.ts +70 -0
  91. package/src/caption/canonicalProductionWebVtt.ts +20 -4
  92. package/src/draw/bindAutoMovieDrawSceneSoftProps.ts +43 -0
  93. package/src/draw/index.ts +1 -0
  94. package/src/index.ts +1 -0
  95. package/src/planSequenceRender.ts +21 -10
  96. package/src/scene/IAutoMovieSceneObject.ts +6 -1
  97. package/src/scene/IAutoMovieSceneSoftProps.ts +38 -0
  98. package/src/scene/IChunkObject.ts +10 -3
  99. package/src/scene/applyPracticalSurfaceMaterials.ts +79 -0
  100. package/src/scene/buildInstancedFormation.ts +86 -55
  101. package/src/scene/buildScene.ts +22 -6
  102. package/src/scene/buildSceneSoftProps.ts +83 -0
  103. package/src/scene/human-polygon/AutoMovieHumanPolygon.ts +61 -1
  104. package/src/scene/human-polygon/buildHumanPolygon.ts +22 -2
  105. package/src/scene/human-polygon/buildPolygonShotActor.ts +112 -0
  106. package/src/scene/human-polygon/index.ts +1 -0
  107. package/src/scene/human-polygon/prepareHumanPolygonPresentation.ts +328 -0
  108. package/src/scene/index.ts +3 -0
  109. package/src/scene/renderAutoMovieFilmFrame.ts +14 -9
  110. package/src/scene/softPropCordSurface.ts +132 -0
@@ -6,24 +6,28 @@ import { productionRenderLayersForPass } from "@automovie/engine";
6
6
  /**
7
7
  * Render already sampled film layers through one beauty/guide boundary.
8
8
  *
9
- * Layer sample fields are opaque to this owner. The callback resolves that source's exact state and owns its reversible pass configuration. Beauty preserves direct, fade and dissolve weights; structural passes consume the Engine's single full-weight dominant layer with incoming winning a tie. Input admission happens before any callback can alter the display.
9
+ * Layer sample fields are opaque to this owner. An optional preparation callback samples the selected source before its draw, including each source of a dissolve. The render callback owns its reversible pass configuration. Beauty preserves direct, fade and dissolve weights; structural passes consume the Engine's single full-weight dominant layer with incoming winning a tie. Input admission happens before either callback can alter the display.
10
10
  *
11
11
  * The sampled film inputs are explicit. Interactive display-clock updates and inspection CLI timestamp filenames remain host observations rather than deterministic delivered-frame identity.
12
12
  *
13
13
  * @evidence contracts/development/implementation.md#principled-implementation Admits sampled one/two-layer beauty composition before callbacks, dispatches direct/fade/dissolve beauty and uses the Engine full-weight dominant layer with incoming tie winner for structural passes.
14
- * @evidence contracts/development/implementation.md#clear-and-simple-structure Layer sampling/state resolution stays with caller callbacks while canonical pass selection and beauty compositor owners retain their separate responsibilities.
14
+ * @evidence contracts/development/implementation.md#clear-and-simple-structure The optional preparation callback applies each selected source's state immediately before the separate render callback. Canonical pass selection and beauty composition stay with their existing owners.
15
15
  * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Invalid weight/cardinality/complement sum refuse rather than clamp or blend structural classifications; host clock/filename observations do not become deterministic delivered-frame identity.
16
- * @evidence contracts/development/common.md#meaningful-documentation Documents opaque sampled fields, reversible source callback ownership, beauty weights, structural tie rule and pre-effect admission.
16
+ * @evidence contracts/development/common.md#meaningful-documentation Documents opaque sampled fields, per-source preparation order, reversible pass ownership, beauty weights, structural tie rule and pre-effect admission.
17
17
  * @evidence contracts/development/implementation.md#efficient-algorithms One/two admitted layers give fixed dispatch work; structural selection clones the selected layer payload and compositor draws/readbacks retain their actual pixel/native costs.
18
18
  * @evidence contracts/development/implementation.md#reuse-equivalent-work Canonical selection is reused by guide consumers and renderer-scoped beauty owners reuse their allocated copies; sampled source callbacks still execute for each actual requested frame.
19
19
  * @evidence contracts/development/implementation.md#bound-retention-and-release-resources The adapter acquires no scene or renderer; callbacks own reversible state and compositor owners retain/release their native display copies, including terminal failure uncertainty.
20
20
  */
21
- const renderAutoMovieFilmFrame = (renderer, layers, pass, renderLayer) => {
21
+ const renderAutoMovieFilmFrame = (renderer, layers, pass, renderLayer, prepareLayer) => {
22
22
  const composition = resolveAutoMovieFilmBeautyComposition(layers);
23
- if (pass !== "beauty") renderLayer(productionRenderLayersForPass({ layers }, pass)[0], pass);
24
- else if (composition.kind === "direct") renderLayer(composition.layer, pass);
25
- else if (composition.kind === "fade") renderFadeToBlackFrame(renderer, () => renderLayer(composition.layer, pass), composition.weight);
26
- else renderCrossDissolveFrames(renderer, () => renderLayer(composition.outgoing, pass), () => renderLayer(composition.incoming, pass), composition.alpha);
23
+ const draw = (layer) => {
24
+ prepareLayer?.(layer);
25
+ renderLayer(layer, pass);
26
+ };
27
+ if (pass !== "beauty") draw(productionRenderLayersForPass({ layers }, pass)[0]);
28
+ else if (composition.kind === "direct") draw(composition.layer);
29
+ else if (composition.kind === "fade") renderFadeToBlackFrame(renderer, () => draw(composition.layer), composition.weight);
30
+ else renderCrossDissolveFrames(renderer, () => draw(composition.outgoing), () => draw(composition.incoming), composition.alpha);
27
31
  };
28
32
  export { renderAutoMovieFilmFrame };
29
33
 
@@ -1 +1 @@
1
- {"version":3,"file":"renderAutoMovieFilmFrame.mjs","names":[],"sources":["../../src/scene/renderAutoMovieFilmFrame.ts"],"sourcesContent":["import { productionRenderLayersForPass } from \"@automovie/engine\";\nimport type { AutoMovieGuidePass } from \"@automovie/interface\";\nimport type * as THREE from \"three\";\n\nimport { renderCrossDissolveFrames } from \"./renderCrossDissolveFrames.js\";\nimport { renderFadeToBlackFrame } from \"./renderFadeToBlackFrame.js\";\nimport { resolveAutoMovieFilmBeautyComposition } from \"./resolveAutoMovieFilmBeautyComposition.js\";\n\n/**\n * Render already sampled film layers through one beauty/guide boundary.\n *\n * Layer sample fields are opaque to this owner. The callback resolves that source's exact state and owns its reversible pass configuration. Beauty preserves direct, fade and dissolve weights; structural passes consume the Engine's single full-weight dominant layer with incoming winning a tie. Input admission happens before any callback can alter the display.\n *\n * The sampled film inputs are explicit. Interactive display-clock updates and inspection CLI timestamp filenames remain host observations rather than deterministic delivered-frame identity.\n *\n * @evidence contracts/development/implementation.md#principled-implementation Admits sampled one/two-layer beauty composition before callbacks, dispatches direct/fade/dissolve beauty and uses the Engine full-weight dominant layer with incoming tie winner for structural passes.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure Layer sampling/state resolution stays with caller callbacks while canonical pass selection and beauty compositor owners retain their separate responsibilities.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Invalid weight/cardinality/complement sum refuse rather than clamp or blend structural classifications; host clock/filename observations do not become deterministic delivered-frame identity.\n * @evidence contracts/development/common.md#meaningful-documentation Documents opaque sampled fields, reversible source callback ownership, beauty weights, structural tie rule and pre-effect admission.\n * @evidence contracts/development/implementation.md#efficient-algorithms One/two admitted layers give fixed dispatch work; structural selection clones the selected layer payload and compositor draws/readbacks retain their actual pixel/native costs.\n * @evidence contracts/development/implementation.md#reuse-equivalent-work Canonical selection is reused by guide consumers and renderer-scoped beauty owners reuse their allocated copies; sampled source callbacks still execute for each actual requested frame.\n * @evidence contracts/development/implementation.md#bound-retention-and-release-resources The adapter acquires no scene or renderer; callbacks own reversible state and compositor owners retain/release their native display copies, including terminal failure uncertainty.\n */\nexport const renderAutoMovieFilmFrame: <Layer extends { weight: number }>(\n renderer: THREE.WebGLRenderer,\n layers: readonly Layer[],\n pass: AutoMovieGuidePass,\n renderLayer: (\n layer: Omit<Layer, \"weight\"> & { weight: number },\n pass: AutoMovieGuidePass,\n ) => void,\n) => void = <Layer extends { weight: number }>(\n renderer: THREE.WebGLRenderer,\n layers: readonly Layer[],\n pass: AutoMovieGuidePass,\n renderLayer: (\n layer: Omit<Layer, \"weight\"> & { weight: number },\n pass: AutoMovieGuidePass,\n ) => void,\n): void => {\n const composition: ReturnType<\n typeof resolveAutoMovieFilmBeautyComposition<Layer>\n > = resolveAutoMovieFilmBeautyComposition(layers);\n if (pass !== \"beauty\") {\n const selected: ReturnType<typeof productionRenderLayersForPass<Layer>> =\n productionRenderLayersForPass({ layers }, pass);\n renderLayer(selected[0]!, pass);\n } else if (composition.kind === \"direct\")\n renderLayer(composition.layer, pass);\n else if (composition.kind === \"fade\")\n renderFadeToBlackFrame(\n renderer,\n (): void => renderLayer(composition.layer, pass),\n composition.weight,\n );\n else\n renderCrossDissolveFrames(\n renderer,\n (): void => renderLayer(composition.outgoing, pass),\n (): void => renderLayer(composition.incoming, pass),\n composition.alpha,\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuBA,MAAa,4BASX,UACA,QACA,MACA,gBAIS;CACT,MAAM,cAEF,sCAAsC,MAAM;CAChD,IAAI,SAAS,UAGX,YADE,8BAA8B,EAAE,OAAO,GAAG,IACzB,CAAC,CAAC,IAAK,IAAI;MACzB,IAAI,YAAY,SAAS,UAC9B,YAAY,YAAY,OAAO,IAAI;MAChC,IAAI,YAAY,SAAS,QAC5B,uBACE,gBACY,YAAY,YAAY,OAAO,IAAI,GAC/C,YAAY,MACd;MAEA,0BACE,gBACY,YAAY,YAAY,UAAU,IAAI,SACtC,YAAY,YAAY,UAAU,IAAI,GAClD,YAAY,KACd;AACJ"}
1
+ {"version":3,"file":"renderAutoMovieFilmFrame.mjs","names":[],"sources":["../../src/scene/renderAutoMovieFilmFrame.ts"],"sourcesContent":["import { productionRenderLayersForPass } from \"@automovie/engine\";\nimport type { AutoMovieGuidePass } from \"@automovie/interface\";\nimport type * as THREE from \"three\";\n\nimport { renderCrossDissolveFrames } from \"./renderCrossDissolveFrames.js\";\nimport { renderFadeToBlackFrame } from \"./renderFadeToBlackFrame.js\";\nimport { resolveAutoMovieFilmBeautyComposition } from \"./resolveAutoMovieFilmBeautyComposition.js\";\n\n/**\n * Render already sampled film layers through one beauty/guide boundary.\n *\n * Layer sample fields are opaque to this owner. An optional preparation callback samples the selected source before its draw, including each source of a dissolve. The render callback owns its reversible pass configuration. Beauty preserves direct, fade and dissolve weights; structural passes consume the Engine's single full-weight dominant layer with incoming winning a tie. Input admission happens before either callback can alter the display.\n *\n * The sampled film inputs are explicit. Interactive display-clock updates and inspection CLI timestamp filenames remain host observations rather than deterministic delivered-frame identity.\n *\n * @evidence contracts/development/implementation.md#principled-implementation Admits sampled one/two-layer beauty composition before callbacks, dispatches direct/fade/dissolve beauty and uses the Engine full-weight dominant layer with incoming tie winner for structural passes.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure The optional preparation callback applies each selected source's state immediately before the separate render callback. Canonical pass selection and beauty composition stay with their existing owners.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Invalid weight/cardinality/complement sum refuse rather than clamp or blend structural classifications; host clock/filename observations do not become deterministic delivered-frame identity.\n * @evidence contracts/development/common.md#meaningful-documentation Documents opaque sampled fields, per-source preparation order, reversible pass ownership, beauty weights, structural tie rule and pre-effect admission.\n * @evidence contracts/development/implementation.md#efficient-algorithms One/two admitted layers give fixed dispatch work; structural selection clones the selected layer payload and compositor draws/readbacks retain their actual pixel/native costs.\n * @evidence contracts/development/implementation.md#reuse-equivalent-work Canonical selection is reused by guide consumers and renderer-scoped beauty owners reuse their allocated copies; sampled source callbacks still execute for each actual requested frame.\n * @evidence contracts/development/implementation.md#bound-retention-and-release-resources The adapter acquires no scene or renderer; callbacks own reversible state and compositor owners retain/release their native display copies, including terminal failure uncertainty.\n */\nexport const renderAutoMovieFilmFrame: <Layer extends { weight: number }>(\n renderer: THREE.WebGLRenderer,\n layers: readonly Layer[],\n pass: AutoMovieGuidePass,\n renderLayer: (\n layer: Omit<Layer, \"weight\"> & { weight: number },\n pass: AutoMovieGuidePass,\n ) => void,\n prepareLayer?: (layer: Omit<Layer, \"weight\"> & { weight: number }) => void,\n) => void = <Layer extends { weight: number }>(\n renderer: THREE.WebGLRenderer,\n layers: readonly Layer[],\n pass: AutoMovieGuidePass,\n renderLayer: (\n layer: Omit<Layer, \"weight\"> & { weight: number },\n pass: AutoMovieGuidePass,\n ) => void,\n prepareLayer?: (layer: Omit<Layer, \"weight\"> & { weight: number }) => void,\n): void => {\n const composition: ReturnType<\n typeof resolveAutoMovieFilmBeautyComposition<Layer>\n > = resolveAutoMovieFilmBeautyComposition(layers);\n const draw = (layer: Omit<Layer, \"weight\"> & { weight: number }): void => {\n prepareLayer?.(layer);\n renderLayer(layer, pass);\n };\n if (pass !== \"beauty\") {\n const selected: ReturnType<typeof productionRenderLayersForPass<Layer>> =\n productionRenderLayersForPass({ layers }, pass);\n draw(selected[0]!);\n } else if (composition.kind === \"direct\") draw(composition.layer);\n else if (composition.kind === \"fade\")\n renderFadeToBlackFrame(\n renderer,\n (): void => draw(composition.layer),\n composition.weight,\n );\n else\n renderCrossDissolveFrames(\n renderer,\n (): void => draw(composition.outgoing),\n (): void => draw(composition.incoming),\n composition.alpha,\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuBA,MAAa,4BAUX,UACA,QACA,MACA,aAIA,iBACS;CACT,MAAM,cAEF,sCAAsC,MAAM;CAChD,MAAM,QAAQ,UAA4D;EACxE,eAAe,KAAK;EACpB,YAAY,OAAO,IAAI;CACzB;CACA,IAAI,SAAS,UAGX,KADE,8BAA8B,EAAE,OAAO,GAAG,IAChC,CAAC,CAAC,EAAG;MACZ,IAAI,YAAY,SAAS,UAAU,KAAK,YAAY,KAAK;MAC3D,IAAI,YAAY,SAAS,QAC5B,uBACE,gBACY,KAAK,YAAY,KAAK,GAClC,YAAY,MACd;MAEA,0BACE,gBACY,KAAK,YAAY,QAAQ,SACzB,KAAK,YAAY,QAAQ,GACrC,YAAY,KACd;AACJ"}
@@ -0,0 +1,14 @@
1
+ import type { IAutoMovieSoftBodySurface } from "@automovie/interface";
2
+ /**
3
+ * Use a ring of the Three.js tube at each distinct adjoining particle.
4
+ * The input is an unindexed one-wide surface in world metres.
5
+ *
6
+ * @evidence contracts/development/common.md#meaningful-documentation States the source, coordinate frame and tube sampling rule.
7
+ * @evidence contracts/development/implementation.md#principled-implementation TubeGeometry transports its frame along a path parameterized by particle index, preserving nonuniform particle spacing in the ring centres up to Float32 conversion.
8
+ * @evidence contracts/development/implementation.md#clear-and-simple-structure The path defines the parameterization and tangents. Three.js owns ring construction, winding, normals and UVs.
9
+ * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The radius is the caller's in metres, and the radial tessellation is Three.js's default. Missing or unrepresentable coordinates and nonfinite tube output are refused. Consecutive identical points share a ring; a point-only configuration has no tube.
10
+ * @evidence contracts/development/implementation.md#efficient-algorithms Linear in particles and the SDK's fixed radial segments. Adjacent coincident points are removed once and all path samples use direct index addressing.
11
+ * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work The geometry represents one frame's particle positions, with no assumption that another frame has the same points.
12
+ * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Disposes the temporary buffer geometry after copying its attributes; the result retains only plain arrays and its extent.
13
+ */
14
+ export declare function softPropCordSurface(surface: IAutoMovieSoftBodySurface, radius: number): IAutoMovieSoftBodySurface;
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.softPropCordSurface = softPropCordSurface;
37
+ const THREE = __importStar(require("three"));
38
+ /**
39
+ * Use a ring of the Three.js tube at each distinct adjoining particle.
40
+ * The input is an unindexed one-wide surface in world metres.
41
+ *
42
+ * @evidence contracts/development/common.md#meaningful-documentation States the source, coordinate frame and tube sampling rule.
43
+ * @evidence contracts/development/implementation.md#principled-implementation TubeGeometry transports its frame along a path parameterized by particle index, preserving nonuniform particle spacing in the ring centres up to Float32 conversion.
44
+ * @evidence contracts/development/implementation.md#clear-and-simple-structure The path defines the parameterization and tangents. Three.js owns ring construction, winding, normals and UVs.
45
+ * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The radius is the caller's in metres, and the radial tessellation is Three.js's default. Missing or unrepresentable coordinates and nonfinite tube output are refused. Consecutive identical points share a ring; a point-only configuration has no tube.
46
+ * @evidence contracts/development/implementation.md#efficient-algorithms Linear in particles and the SDK's fixed radial segments. Adjacent coincident points are removed once and all path samples use direct index addressing.
47
+ * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work The geometry represents one frame's particle positions, with no assumption that another frame has the same points.
48
+ * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Disposes the temporary buffer geometry after copying its attributes; the result retains only plain arrays and its extent.
49
+ */
50
+ function softPropCordSurface(surface, radius) {
51
+ const positions = surface.mesh.positions;
52
+ const projectedRadius = Math.fround(radius);
53
+ if (!Number.isFinite(projectedRadius) ||
54
+ projectedRadius <= 0 ||
55
+ surface.bounds !== null ||
56
+ (surface.mesh.indices?.length ?? 0) !== 0 ||
57
+ positions.length < 6 ||
58
+ positions.length % 3 !== 0)
59
+ throw new Error(`Soft prop domain "${surface.domain}" needs an unindexed cord with finite particles and a positive finite radius.`);
60
+ const points = [];
61
+ for (let offset = 0; offset < positions.length; offset += 3) {
62
+ const point = new THREE.Vector3().fromArray(positions, offset);
63
+ if (!Number.isFinite(Math.fround(point.x)) ||
64
+ !Number.isFinite(Math.fround(point.y)) ||
65
+ !Number.isFinite(Math.fround(point.z)))
66
+ throw new Error(`Soft prop domain "${surface.domain}" has an unrepresentable cord particle.`);
67
+ const previous = points[points.length - 1];
68
+ if (previous === undefined || !point.equals(previous))
69
+ points.push(point);
70
+ }
71
+ if (points.length < 2)
72
+ return surface;
73
+ const geometry = new THREE.TubeGeometry(new ParticlePath(points), points.length - 1, radius);
74
+ try {
75
+ const vertices = Array.from(geometry.getAttribute("position").array);
76
+ const normals = Array.from(geometry.getAttribute("normal").array);
77
+ if (!vertices.every(Number.isFinite) || !normals.every(Number.isFinite))
78
+ throw new Error(`Soft prop domain "${surface.domain}" generated nonfinite tube geometry.`);
79
+ geometry.computeBoundingBox();
80
+ const box = geometry.boundingBox;
81
+ const bounds = {
82
+ min: { x: box.min.x, y: box.min.y, z: box.min.z },
83
+ max: { x: box.max.x, y: box.max.y, z: box.max.z },
84
+ };
85
+ return {
86
+ domain: surface.domain,
87
+ step: surface.step,
88
+ bounds,
89
+ mesh: {
90
+ positions: vertices,
91
+ normals,
92
+ uvs: Array.from(geometry.getAttribute("uv").array),
93
+ indices: Array.from(geometry.getIndex().array),
94
+ skin: null,
95
+ },
96
+ };
97
+ }
98
+ finally {
99
+ geometry.dispose();
100
+ }
101
+ }
102
+ /** A piecewise straight path with one uniformly indexed parameter per particle. */
103
+ class ParticlePath extends THREE.Curve {
104
+ points;
105
+ /** At least two points, with each consecutive pair distinct. */
106
+ constructor(points) {
107
+ super();
108
+ this.points = points;
109
+ }
110
+ /** Interpolate between the adjacent particle indices around this parameter. */
111
+ getPoint(t, target = new THREE.Vector3()) {
112
+ const scaled = t * (this.points.length - 1);
113
+ const from = Math.min(this.points.length - 2, Math.floor(scaled));
114
+ return target.lerpVectors(this.points[from], this.points[from + 1], scaled - from);
115
+ }
116
+ /** Tube rings use the authored particle spacing in place of arc-length spacing. */
117
+ getPointAt(u, target) {
118
+ return this.getPoint(u, target);
119
+ }
120
+ /** Use the outgoing segment at each SDK ring, with an incoming one at the end. */
121
+ getTangentAt(u, target = new THREE.Vector3()) {
122
+ const from = Math.min(this.points.length - 2, Math.round(u * (this.points.length - 1)));
123
+ return target
124
+ .subVectors(this.points[from + 1], this.points[from])
125
+ .normalize();
126
+ }
127
+ }
128
+ //# sourceMappingURL=softPropCordSurface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"softPropCordSurface.js","sourceRoot":"","sources":["../../src/scene/softPropCordSurface.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AC1D,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAClC,CAAC;IAED,kFAAkF;IAClE,YAAY,CAC1B,CAAS,EACT,MAAM,GAAkB,IAAI,KAAK,CAAC,OAAO,EAAE;QAE3C,MAAM,IAAI,GAAW,IAAI,CAAC,GAAG,CAC3B,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EACtB,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CACzC,CAAC;QACF,OAAO,MAAM;aACV,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,CAAE,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAE,CAAC;aACtD,SAAS,EAAE,CAAC;IACjB,CAAC;CACF"}
@@ -0,0 +1,88 @@
1
+ import * as THREE from "three";
2
+ // src/scene/softPropCordSurface.ts
3
+ /**
4
+ * Use a ring of the Three.js tube at each distinct adjoining particle.
5
+ * The input is an unindexed one-wide surface in world metres.
6
+ *
7
+ * @evidence contracts/development/common.md#meaningful-documentation States the source, coordinate frame and tube sampling rule.
8
+ * @evidence contracts/development/implementation.md#principled-implementation TubeGeometry transports its frame along a path parameterized by particle index, preserving nonuniform particle spacing in the ring centres up to Float32 conversion.
9
+ * @evidence contracts/development/implementation.md#clear-and-simple-structure The path defines the parameterization and tangents. Three.js owns ring construction, winding, normals and UVs.
10
+ * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The radius is the caller's in metres, and the radial tessellation is Three.js's default. Missing or unrepresentable coordinates and nonfinite tube output are refused. Consecutive identical points share a ring; a point-only configuration has no tube.
11
+ * @evidence contracts/development/implementation.md#efficient-algorithms Linear in particles and the SDK's fixed radial segments. Adjacent coincident points are removed once and all path samples use direct index addressing.
12
+ * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work The geometry represents one frame's particle positions, with no assumption that another frame has the same points.
13
+ * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Disposes the temporary buffer geometry after copying its attributes; the result retains only plain arrays and its extent.
14
+ */
15
+ function softPropCordSurface(surface, radius) {
16
+ const positions = surface.mesh.positions;
17
+ const projectedRadius = Math.fround(radius);
18
+ if (!Number.isFinite(projectedRadius) || projectedRadius <= 0 || surface.bounds !== null || (surface.mesh.indices?.length ?? 0) !== 0 || positions.length < 6 || positions.length % 3 !== 0) throw new Error(`Soft prop domain "${surface.domain}" needs an unindexed cord with finite particles and a positive finite radius.`);
19
+ const points = [];
20
+ for (let offset = 0; offset < positions.length; offset += 3) {
21
+ const point = new THREE.Vector3().fromArray(positions, offset);
22
+ if (!Number.isFinite(Math.fround(point.x)) || !Number.isFinite(Math.fround(point.y)) || !Number.isFinite(Math.fround(point.z))) throw new Error(`Soft prop domain "${surface.domain}" has an unrepresentable cord particle.`);
23
+ const previous = points[points.length - 1];
24
+ if (previous === void 0 || !point.equals(previous)) points.push(point);
25
+ }
26
+ if (points.length < 2) return surface;
27
+ const geometry = new THREE.TubeGeometry(new ParticlePath(points), points.length - 1, radius);
28
+ try {
29
+ const vertices = Array.from(geometry.getAttribute("position").array);
30
+ const normals = Array.from(geometry.getAttribute("normal").array);
31
+ if (!vertices.every(Number.isFinite) || !normals.every(Number.isFinite)) throw new Error(`Soft prop domain "${surface.domain}" generated nonfinite tube geometry.`);
32
+ geometry.computeBoundingBox();
33
+ const box = geometry.boundingBox;
34
+ const bounds = {
35
+ min: {
36
+ x: box.min.x,
37
+ y: box.min.y,
38
+ z: box.min.z
39
+ },
40
+ max: {
41
+ x: box.max.x,
42
+ y: box.max.y,
43
+ z: box.max.z
44
+ }
45
+ };
46
+ return {
47
+ domain: surface.domain,
48
+ step: surface.step,
49
+ bounds,
50
+ mesh: {
51
+ positions: vertices,
52
+ normals,
53
+ uvs: Array.from(geometry.getAttribute("uv").array),
54
+ indices: Array.from(geometry.getIndex().array),
55
+ skin: null
56
+ }
57
+ };
58
+ } finally {
59
+ geometry.dispose();
60
+ }
61
+ }
62
+ /** A piecewise straight path with one uniformly indexed parameter per particle. */
63
+ var ParticlePath = class extends THREE.Curve {
64
+ points;
65
+ /** At least two points, with each consecutive pair distinct. */
66
+ constructor(points) {
67
+ super();
68
+ this.points = points;
69
+ }
70
+ /** Interpolate between the adjacent particle indices around this parameter. */
71
+ getPoint(t, target = new THREE.Vector3()) {
72
+ const scaled = t * (this.points.length - 1);
73
+ const from = Math.min(this.points.length - 2, Math.floor(scaled));
74
+ return target.lerpVectors(this.points[from], this.points[from + 1], scaled - from);
75
+ }
76
+ /** Tube rings use the authored particle spacing in place of arc-length spacing. */
77
+ getPointAt(u, target) {
78
+ return this.getPoint(u, target);
79
+ }
80
+ /** Use the outgoing segment at each SDK ring, with an incoming one at the end. */
81
+ getTangentAt(u, target = new THREE.Vector3()) {
82
+ const from = Math.min(this.points.length - 2, Math.round(u * (this.points.length - 1)));
83
+ return target.subVectors(this.points[from + 1], this.points[from]).normalize();
84
+ }
85
+ };
86
+ export { softPropCordSurface };
87
+
88
+ //# sourceMappingURL=softPropCordSurface.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"softPropCordSurface.mjs","names":[],"sources":["../../src/scene/softPropCordSurface.ts"],"sourcesContent":["import type {\n IAutoMovieSoftBodySurface,\n IAutoMovieSoftBounds,\n} from \"@automovie/interface\";\nimport * as THREE from \"three\";\n\n/**\n * Use a ring of the Three.js tube at each distinct adjoining particle.\n * The input is an unindexed one-wide surface in world metres.\n *\n * @evidence contracts/development/common.md#meaningful-documentation States the source, coordinate frame and tube sampling rule.\n * @evidence contracts/development/implementation.md#principled-implementation TubeGeometry transports its frame along a path parameterized by particle index, preserving nonuniform particle spacing in the ring centres up to Float32 conversion.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure The path defines the parameterization and tangents. Three.js owns ring construction, winding, normals and UVs.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The radius is the caller's in metres, and the radial tessellation is Three.js's default. Missing or unrepresentable coordinates and nonfinite tube output are refused. Consecutive identical points share a ring; a point-only configuration has no tube.\n * @evidence contracts/development/implementation.md#efficient-algorithms Linear in particles and the SDK's fixed radial segments. Adjacent coincident points are removed once and all path samples use direct index addressing.\n * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work The geometry represents one frame's particle positions, with no assumption that another frame has the same points.\n * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Disposes the temporary buffer geometry after copying its attributes; the result retains only plain arrays and its extent.\n */\nexport function softPropCordSurface(\n surface: IAutoMovieSoftBodySurface,\n radius: number,\n): IAutoMovieSoftBodySurface {\n const positions: readonly number[] = surface.mesh.positions;\n const projectedRadius: number = Math.fround(radius);\n if (\n !Number.isFinite(projectedRadius) ||\n projectedRadius <= 0 ||\n surface.bounds !== null ||\n (surface.mesh.indices?.length ?? 0) !== 0 ||\n positions.length < 6 ||\n positions.length % 3 !== 0\n )\n throw new Error(\n `Soft prop domain \"${surface.domain}\" needs an unindexed cord with finite particles and a positive finite radius.`,\n );\n\n const points: THREE.Vector3[] = [];\n for (let offset: number = 0; offset < positions.length; offset += 3) {\n const point: THREE.Vector3 = new THREE.Vector3().fromArray(\n positions,\n offset,\n );\n if (\n !Number.isFinite(Math.fround(point.x)) ||\n !Number.isFinite(Math.fround(point.y)) ||\n !Number.isFinite(Math.fround(point.z))\n )\n throw new Error(\n `Soft prop domain \"${surface.domain}\" has an unrepresentable cord particle.`,\n );\n const previous: THREE.Vector3 | undefined = points[points.length - 1];\n if (previous === undefined || !point.equals(previous)) points.push(point);\n }\n if (points.length < 2) return surface;\n\n const geometry: THREE.TubeGeometry = new THREE.TubeGeometry(\n new ParticlePath(points),\n points.length - 1,\n radius,\n );\n try {\n const vertices: number[] = Array.from(\n geometry.getAttribute(\"position\").array,\n );\n const normals: number[] = Array.from(geometry.getAttribute(\"normal\").array);\n if (!vertices.every(Number.isFinite) || !normals.every(Number.isFinite))\n throw new Error(\n `Soft prop domain \"${surface.domain}\" generated nonfinite tube geometry.`,\n );\n geometry.computeBoundingBox();\n const box: THREE.Box3 = geometry.boundingBox!;\n const bounds: IAutoMovieSoftBounds = {\n min: { x: box.min.x, y: box.min.y, z: box.min.z },\n max: { x: box.max.x, y: box.max.y, z: box.max.z },\n };\n return {\n domain: surface.domain,\n step: surface.step,\n bounds,\n mesh: {\n positions: vertices,\n normals,\n uvs: Array.from(geometry.getAttribute(\"uv\").array),\n indices: Array.from(geometry.getIndex()!.array),\n skin: null,\n },\n };\n } finally {\n geometry.dispose();\n }\n}\n\n/** A piecewise straight path with one uniformly indexed parameter per particle. */\nclass ParticlePath extends THREE.Curve<THREE.Vector3> {\n /** At least two points, with each consecutive pair distinct. */\n public constructor(private readonly points: readonly THREE.Vector3[]) {\n super();\n }\n\n /** Interpolate between the adjacent particle indices around this parameter. */\n public override getPoint(\n t: number,\n target: THREE.Vector3 = new THREE.Vector3(),\n ): THREE.Vector3 {\n const scaled: number = t * (this.points.length - 1);\n const from: number = Math.min(this.points.length - 2, Math.floor(scaled));\n return target.lerpVectors(\n this.points[from]!,\n this.points[from + 1]!,\n scaled - from,\n );\n }\n\n /** Tube rings use the authored particle spacing in place of arc-length spacing. */\n public override getPointAt(u: number, target?: THREE.Vector3): THREE.Vector3 {\n return this.getPoint(u, target);\n }\n\n /** Use the outgoing segment at each SDK ring, with an incoming one at the end. */\n public override getTangentAt(\n u: number,\n target: THREE.Vector3 = new THREE.Vector3(),\n ): THREE.Vector3 {\n const from: number = Math.min(\n this.points.length - 2,\n Math.round(u * (this.points.length - 1)),\n );\n return target\n .subVectors(this.points[from + 1]!, this.points[from]!)\n .normalize();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAkBA,SAAgB,oBACd,SACA,QAC2B;CAC3B,MAAM,YAA+B,QAAQ,KAAK;CAClD,MAAM,kBAA0B,KAAK,OAAO,MAAM;CAClD,IACE,CAAC,OAAO,SAAS,eAAe,KAChC,mBAAmB,KACnB,QAAQ,WAAW,SAClB,QAAQ,KAAK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,GAAG,IAAI,IAAI;GAAE;EAClD;EACA,OAAO;GACL,QAAQ,QAAQ;GAChB,MAAM,QAAQ;GACd;GACA,MAAM;IACJ,WAAW;IACX;IACA,KAAK,MAAM,KAAK,SAAS,aAAa,IAAI,CAAC,CAAC,KAAK;IACjD,SAAS,MAAM,KAAK,SAAS,SAAS,CAAC,CAAE,KAAK;IAC9C,MAAM;GACR;EACF;CACF,UAAU;EACR,SAAS,QAAQ;CACnB;AACF;;AAGA,IAAM,eAAN,cAA2B,MAAM,MAAqB;CAEhB;;CAApC,YAAmB,QAAmD;EACpE,MAAM;EAD4B,KAAA,SAAA;CAEpC;;CAGA,SACE,GACA,SAAwB,IAAI,MAAM,QAAQ,GAC3B;EACf,MAAM,SAAiB,KAAK,KAAK,OAAO,SAAS;EACjD,MAAM,OAAe,KAAK,IAAI,KAAK,OAAO,SAAS,GAAG,KAAK,MAAM,MAAM,CAAC;EACxE,OAAO,OAAO,YACZ,KAAK,OAAO,OACZ,KAAK,OAAO,OAAO,IACnB,SAAS,IACX;CACF;;CAGA,WAA2B,GAAW,QAAuC;EAC3E,OAAO,KAAK,SAAS,GAAG,MAAM;CAChC;;CAGA,aACE,GACA,SAAwB,IAAI,MAAM,QAAQ,GAC3B;EACf,MAAM,OAAe,KAAK,IACxB,KAAK,OAAO,SAAS,GACrB,KAAK,MAAM,KAAK,KAAK,OAAO,SAAS,EAAE,CACzC;EACA,OAAO,OACJ,WAAW,KAAK,OAAO,OAAO,IAAK,KAAK,OAAO,KAAM,CAAC,CACtD,UAAU;CACf;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automovie/render",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "automovie render: deterministic frame schedule + encode plan from a render spec",
5
5
  "main": "lib/index.js",
6
6
  "exports": {
@@ -28,9 +28,9 @@
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
- "@automovie/engine": "^0.3.0",
32
- "@automovie/ingest": "^0.3.0",
33
- "@automovie/interface": "^0.3.0",
31
+ "@automovie/engine": "^0.3.2",
32
+ "@automovie/ingest": "^0.3.2",
33
+ "@automovie/interface": "^0.3.2",
34
34
  "three": "^0.186.0"
35
35
  },
36
36
  "devDependencies": {
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Zero-based, regularly spaced presentation frames followed by the exact end.
3
+ * Takes and preview controls share the grid, including an endpoint that falls
4
+ * between regular frame times.
5
+ *
6
+ * @evidence contracts/development/common.md#meaningful-documentation States the index origin, temporal spacing, endpoint, and consumers.
7
+ * @evidence contracts/development/design.md#principled-representation Frame indices are zero-based integers, timestamps and duration are seconds, and cadence is positive frames per second. JavaScript numbers do not enforce these constraints, so the caller supplies a valid presentation clock and index.
8
+ * @evidence contracts/development/design.md#minimal-and-owned-surface Render owns frame schedules. The take producer reads the last index and frame times, and the preview controls also map a playhead second to a displayed frame index.
9
+ * @evidence contracts/development/design.md#prohibited-design-shortcuts The endpoint rule works for both exact-grid and fractional durations and requires no caller-specific mode.
10
+ */
11
+ export namespace AutoMovieFrameGrid {
12
+ /**
13
+ * Find the final zero-based frame number for a nonnegative duration in
14
+ * seconds and a positive rate in frames per second. The exact end takes
15
+ * the place of the first regular frame at or past the end.
16
+ *
17
+ * @evidence contracts/development/common.md#meaningful-documentation Defines the units, index origin, and the final frame's relation to the regular cadence.
18
+ * @evidence contracts/development/implementation.md#principled-implementation Compares the candidate's canonical timestamp to the end since the product alone can round across an integer.
19
+ * @evidence contracts/development/implementation.md#clear-and-simple-structure Computes one candidate, then advances it if its timestamp is still before the end.
20
+ * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Keeps a fractional end distinct from the regular frame immediately before it without an arbitrary epsilon.
21
+ * @evidence contracts/development/implementation.md#efficient-algorithms Constant time and space.
22
+ * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Computes one candidate and its time.
23
+ * @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Retains no state.
24
+ */
25
+ export function last(duration: number, fps: number): number {
26
+ const nearest: number = Math.round(duration * fps);
27
+ return nearest / fps < duration ? nearest + 1 : nearest;
28
+ }
29
+
30
+ /**
31
+ * Read a zero-based frame's timestamp in seconds at the given rate in
32
+ * frames per second, clamped to the final timestamp, `duration`.
33
+ *
34
+ * @evidence contracts/development/common.md#meaningful-documentation Defines the index origin, input and return units, and the end clamp.
35
+ * @evidence contracts/development/implementation.md#principled-implementation One division yields the canonical timestamp without accumulating rounding error.
36
+ * @evidence contracts/development/implementation.md#clear-and-simple-structure Divides the index by the rate and clamps the result.
37
+ * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Returns the exact end when the next regular frame would run past it.
38
+ * @evidence contracts/development/implementation.md#efficient-algorithms Constant time and space.
39
+ * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Computes one timestamp.
40
+ * @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Retains no state.
41
+ */
42
+ export function time(frame: number, duration: number, fps: number): number {
43
+ return Math.min(frame / fps, duration);
44
+ }
45
+
46
+ /**
47
+ * Show the closest regular frame for an in-range second, reserving the
48
+ * final frame for the exact end. The caller supplies the duration in
49
+ * seconds, the rate in frames per second, and the already computed last
50
+ * frame number.
51
+ *
52
+ * @evidence contracts/development/common.md#meaningful-documentation Defines the rounding policy, the exact end, and the units of the supplied clock.
53
+ * @evidence contracts/development/implementation.md#principled-implementation Rounds within the regular grid and reserves the end index for the actual end, so it remains a separate scrubber position.
54
+ * @evidence contracts/development/implementation.md#clear-and-simple-structure Returns the last index at the end and otherwise rounds and caps the regular index.
55
+ * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A playhead just before the end cannot occupy the end index.
56
+ * @evidence contracts/development/implementation.md#efficient-algorithms Constant time and space.
57
+ * @evidence contracts/development/implementation.md#reuse-equivalent-work Uses the last frame number already computed for the grid.
58
+ * @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Retains no state.
59
+ */
60
+ export function nearest(
61
+ seconds: number,
62
+ duration: number,
63
+ fps: number,
64
+ last: number,
65
+ ): number {
66
+ return seconds >= duration
67
+ ? last
68
+ : Math.min(last - 1, Math.round(seconds * fps));
69
+ }
70
+ }
@@ -23,16 +23,18 @@ type ICaptionCue = IAutoMovieFilmTimeline["tracks"]["captions"][number];
23
23
  * The header carries the timeline id. Cues are ordered by start frame, then end
24
24
  * frame, then id in code-unit order, and each cue's frame interval maps to
25
25
  * whole milliseconds with nearest rounding on the exact production frame rate.
26
+ * An authored top or bottom placement selects the first or last snapped line
27
+ * of a horizontal cue. Omitted placement uses WebVTT automatic line placement.
26
28
  * The payload sits in a `<lang>` span, inside a `<v>` voice span when the cue
27
29
  * names a speaker, and every block ends with a blank line. Throws when an id is
28
30
  * not a WebVTT identifier, a language is not a well-formed RFC 5646 tag, the
29
31
  * timeline's `fps` disagrees with its exact frame rate, or a cue interval is
30
- * empty or collapses on the millisecond clock.
32
+ * empty or collapses on the millisecond clock, or a placement is unsupported.
31
33
  *
32
- * @evidence contracts/development/implementation.md#principled-implementation The cue syntax follows the W3C WebVTT file grammar: identifiers are preserved verbatim, cue text and annotations are escaped by the shared serializers, and times come from `productionFrameIntervalToGridTicks`, whose BigInt arithmetic maps each rational frame boundary to an exact integer millisecond before formatting.
34
+ * @evidence contracts/development/implementation.md#principled-implementation The cue syntax follows the W3C WebVTT file grammar: identifiers are preserved verbatim, cue text and annotations are escaped by the shared serializers, and times come from `productionFrameIntervalToGridTicks`, whose BigInt arithmetic maps each rational frame boundary to an exact integer millisecond before formatting. WebVTT counts nonnegative snapped lines from the top and negative snapped lines from the bottom for horizontal cues.
33
35
  * @evidence contracts/development/implementation.md#clear-and-simple-structure The function only orders cues and assembles lines; identifier refusal, text escaping, language validation, frame-to-tick mapping and timestamp spelling each live in the helper that owns them, so the delivery validator compares against the same bytes the writer emits.
34
36
  * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The only fixed values are WebVTT syntax and the 1000-tick millisecond clock WebVTT timestamps require; nothing is special-cased per cue, and a malformed cue throws instead of being skipped.
35
- * @evidence contracts/development/common.md#meaningful-documentation The doc states the byte-equality role, the header source, the cue order, the millisecond rounding, the span nesting, and every refusal.
37
+ * @evidence contracts/development/common.md#meaningful-documentation The doc states the byte-equality role, the header source, the cue order, the millisecond rounding, the placement mapping, the span nesting, and every refusal.
36
38
  * @evidence contracts/development/implementation.md#efficient-algorithms For C cues of text length L the cost is an O(C log C) sort of a copied array plus O(L) escaping per cue; the copy keeps the caller's timeline unmodified, and the sort is needed because the order is part of the canonical bytes.
37
39
  * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each call serializes one timeline into a fresh string and coordinates no phases or consumers whose work it could share.
38
40
  * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Only the sorted copy and the line array are held, both released on return; the output string, owned by the caller, grows linearly with cue count and text length.
@@ -63,7 +65,7 @@ export const canonicalProductionWebVtt: (
63
65
  const payload: string = serializeAutoMovieWebVttCueText(cue.text);
64
66
  return [
65
67
  serializeAutoMovieWebVttIdentifier(cue.id),
66
- `${webVttTime(interval.start)} --> ${webVttTime(interval.end)}`,
68
+ `${webVttTime(interval.start)} --> ${webVttTime(interval.end)}${lineSetting(cue)}`,
67
69
  `<lang ${webVttCaptionLanguage(cue.language)}>${
68
70
  cue.speaker === undefined
69
71
  ? payload
@@ -74,3 +76,17 @@ export const canonicalProductionWebVtt: (
74
76
  }),
75
77
  ].join("\n");
76
78
  };
79
+
80
+ /** Map the authored edge to a snapped line, with automatic placement for legacy cues. */
81
+ const lineSetting = (cue: ICaptionCue): string => {
82
+ switch (cue.placement) {
83
+ case undefined:
84
+ return "";
85
+ case "top":
86
+ return " line:0";
87
+ case "bottom":
88
+ return " line:-1";
89
+ default:
90
+ throw new Error(`Caption cue "${cue.id}" has an unsupported placement.`);
91
+ }
92
+ };
@@ -0,0 +1,43 @@
1
+ import type { IAutoMovieRenderSoftPropFrame } from "@automovie/interface";
2
+
3
+ import type { IAutoMovieSceneSoftProps } from "../scene/IAutoMovieSceneSoftProps.js";
4
+ import { buildSceneSoftProps } from "../scene/buildSceneSoftProps.js";
5
+ import { restoreAutoMovieRenderModeOnce } from "../scene/restoreAutoMovieRenderModeOnce.js";
6
+ import { restoreAutoMovieRenderModeState } from "../scene/restoreAutoMovieRenderModeState.js";
7
+ import type { IAutoMovieDrawScene } from "./IAutoMovieDrawScene.js";
8
+
9
+ /**
10
+ * Route soft prop surfaces from a producer into the draw subject's scene.
11
+ * Each requested second is read after the subject has placed its other objects.
12
+ *
13
+ * @evidence contracts/development/common.md#meaningful-documentation Documents exact-time reads, placement order and disposal ownership.
14
+ * @evidence contracts/development/implementation.md#principled-implementation The draw host already seeks at the capture cell's second, so this adapter hands that same second to the surface producer and never interpolates particle data.
15
+ * @evidence contracts/development/implementation.md#clear-and-simple-structure Keeps the existing subject's scene and presentation data and extends only its seek and disposal boundaries.
16
+ * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A placement refusal propagates before a surface read; each successful placement uses the producer's current surfaces and their analysis status.
17
+ * @evidence contracts/development/implementation.md#efficient-algorithms One awaited base seek and one producer call per requested second, plus the current frame's mesh projection.
18
+ * @evidence contracts/development/implementation.md#reuse-equivalent-work The mounted mesh owner serves every seek in the subject's lifetime. Surface reads follow the current seek without retaining equivalent-time snapshots.
19
+ * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Owns the attached soft-prop projection until disposal and independently retires it and the original subject in one attempt.
20
+ */
21
+ export function bindAutoMovieDrawSceneSoftProps(
22
+ subject: IAutoMovieDrawScene,
23
+ read: (seconds: number) => readonly IAutoMovieRenderSoftPropFrame[],
24
+ ): IAutoMovieDrawScene {
25
+ const props: IAutoMovieSceneSoftProps = buildSceneSoftProps(subject.scene);
26
+ let closed: boolean = false;
27
+ return {
28
+ ...subject,
29
+ seek: async (seconds: number): Promise<void> => {
30
+ if (closed) throw new Error("The soft prop draw subject is closed.");
31
+ await subject.seek(seconds);
32
+ if (closed) throw new Error("The soft prop draw subject is closed.");
33
+ props.update(read(seconds));
34
+ },
35
+ dispose: restoreAutoMovieRenderModeOnce((): void => {
36
+ closed = true;
37
+ restoreAutoMovieRenderModeState([
38
+ props.dispose,
39
+ (): void => subject.dispose(),
40
+ ]);
41
+ }),
42
+ };
43
+ }
package/src/draw/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./AUTO_MOVIE_DRAW_GLOBALS.js";
2
2
  export * from "./AutoMovieDrawSession.js";
3
3
  export * from "./AutoMovieDrawSubjects.js";
4
+ export * from "./bindAutoMovieDrawSceneSoftProps.js";
4
5
  export * from "./decodeAutoMovieDrawPixels.js";
5
6
  export * from "./describeAutoMovieDrawScene.js";
6
7
  export * from "./encodeAutoMovieDrawPixels.js";
package/src/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./caption/index.js";
2
2
  export * from "./capture/index.js";
3
3
  export * from "./delivery/index.js";
4
+ export * from "./AutoMovieFrameGrid.js";
4
5
  export * from "./draw/index.js";
5
6
  export * from "./film/index.js";
6
7
  export * from "./ffmpegArgs.js";
@@ -1,7 +1,13 @@
1
- import { playbackCursor, sequenceTimeline } from "@automovie/engine";
1
+ import {
2
+ playbackCursor,
3
+ preparePlaybackTimeline,
4
+ sequenceEditorialMarkerTimeline,
5
+ } from "@automovie/engine";
2
6
  import type {
3
7
  IAutoMoviePlanSequenceRenderProps,
8
+ IAutoMoviePlaybackEditorialMarker,
4
9
  IAutoMoviePlaybackTimeline,
10
+ IAutoMoviePreparePlaybackTimeline,
5
11
  IAutoMovieSequence,
6
12
  IAutoMovieSequenceRenderFrame,
7
13
  IAutoMovieSequenceRenderPlan,
@@ -15,15 +21,15 @@ import { frameTimes } from "./frameTimes.js";
15
21
  import { renderPathStem } from "./renderPathStem.js";
16
22
 
17
23
  /**
18
- * Build the render-layer manifest for a committed sequence. The output FPS is controlled by the render spec; the cut's fps is preserved as editorial metadata. Trim and transition arithmetic is delegated to the engine playback timeline, then copied into the manifest so the capture host has no hidden timing rules.
24
+ * Build the render-layer manifest for a committed sequence. The output FPS is controlled by the render spec; the cut's fps is preserved as editorial metadata. Trim, playback-rate and transition arithmetic is delegated to the engine playback timeline, then copied into the manifest so the capture host has no hidden timing rules.
19
25
  *
20
- * @evidence contracts/development/implementation.md#principled-implementation sequenceTimeline owns trim and overlap arithmetic, frameTimes supplies increasing half-open output samples, and one playbackCursor resolves those samples without changing the sequence's editorial fps.
26
+ * @evidence contracts/development/implementation.md#principled-implementation preparePlaybackTimeline owns trim, playback-rate and overlap arithmetic, and editorial markers use the prepared layout and shot index; frameTimes supplies increasing half-open output samples, and one playbackCursor resolves those samples without changing the sequence's editorial fps.
21
27
  * @evidence contracts/development/implementation.md#clear-and-simple-structure The manifest gathers timeline spans, resolved frame samples and paths so a capture host reads one plan instead of independently implementing the cut.
22
28
  * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A mismatched render target or empty schedule refuses; output path overrides are caller data and no sequence identity is specially recognized.
23
29
  * @evidence contracts/development/common.md#meaningful-documentation The planner documents editorial versus output fps and target equality; manifest members state seconds, trim offsets, blend weights and host paths.
24
- * @evidence contracts/development/implementation.md#efficient-algorithms For S supplied shots, E timeline entries and F output frames, the engine first indexes all S shots, including unused extras; layout and the forward cursor then cost O(E+F), for O(S+E+F) planning time and peak metadata space. The returned manifest retains O(E+F) records and no per-frame full timeline scan occurs.
25
- * @evidence contracts/development/implementation.md#reuse-equivalent-work One resolved timeline feeds shot spans, transitions and every frame sample; the forward cursor retains its current entry across increasing sample times only within this call.
26
- * @evidence contracts/development/implementation.md#bound-retention-and-release-resources The returned plan retains shot-span and frame metadata proportional to the output schedule; the temporary cursor and timeline are released on return, and planning opens no host resource.
30
+ * @evidence contracts/development/implementation.md#efficient-algorithms For S supplied shots, E timeline entries, F output frames, M marker visits across plays and K retained placements, planning takes O(S+E+F+M+K log K) time and O(S+E+F+K) peak metadata space. One forward cursor avoids a full timeline scan per frame.
31
+ * @evidence contracts/development/implementation.md#reuse-equivalent-work One prepared layout and index feed editorial marker placement, shot spans, transitions and every frame sample; the forward cursor retains its current entry across increasing sample times only within this call.
32
+ * @evidence contracts/development/implementation.md#bound-retention-and-release-resources The returned plan retains shot spans, frame metadata proportional to the output schedule, and retained editorial marker placements; the temporary cursor and timeline are released on return, and planning opens no host resource.
27
33
  */
28
34
  export const planSequenceRender: (
29
35
  props: IAutoMoviePlanSequenceRenderProps,
@@ -35,10 +41,9 @@ export const planSequenceRender: (
35
41
  `render spec target "${props.spec.target}" must equal sequence "${props.sequence.id}"`,
36
42
  );
37
43
 
38
- const timeline: IAutoMoviePlaybackTimeline = sequenceTimeline(
39
- props.sequence,
40
- props.shots,
41
- );
44
+ const playback: IAutoMoviePreparePlaybackTimeline.IResult =
45
+ preparePlaybackTimeline(props.sequence, props.shots);
46
+ const timeline: IAutoMoviePlaybackTimeline = playback.timeline;
42
47
  const times: number[] = frameTimes(
43
48
  props.spec.frameFormat.fps,
44
49
  timeline.runtime,
@@ -52,8 +57,11 @@ export const planSequenceRender: (
52
57
  const frameDir: string = props.frameDir ?? `frames/${stem}`;
53
58
  const outputPath: string = props.outputPath ?? `${stem}.mp4`;
54
59
  const inputPattern: string = `${frameDir}/${framePattern()}`;
60
+ const editorialMarkers: IAutoMoviePlaybackEditorialMarker[] =
61
+ sequenceEditorialMarkerTimeline(props.sequence, playback);
55
62
  return {
56
63
  target: { kind: "sequence", id: props.sequence.id },
64
+ ...(editorialMarkers.length === 0 ? {} : { editorialMarkers }),
57
65
  sequenceFps: props.sequence.fps,
58
66
  renderFps: props.spec.frameFormat.fps,
59
67
  durationSeconds: timeline.runtime,
@@ -70,6 +78,9 @@ export const planSequenceRender: (
70
78
  played: entry.played,
71
79
  offset: entry.offset,
72
80
  trim: props.sequence.shots[entry.entry]!.trim,
81
+ ...(entry.playbackRate === undefined
82
+ ? {}
83
+ : { playbackRate: entry.playbackRate }),
73
84
  }),
74
85
  ),
75
86
  transitionSpans: transitionSpans(props.sequence, timeline),