@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
@@ -14,7 +14,7 @@ import type { IBuildInstancedFormationProps } from "./IBuildInstancedFormationPr
14
14
  *
15
15
  * @evidence contracts/development/implementation.md#principled-implementation Uses engine compact slot regeneration, cue sampling, cadence integration and hysteretic LOD, projecting metre placements into chunk InstancedMeshes and baked Float32 part tables; admitted models/anchors/tiers are premises, stride is heuristic and cadence matrix interpolation is approximate, while anonymous and caller-supplied hero ownership stay distinct.
16
16
  * @evidence contracts/development/implementation.md#clear-and-simple-structure Builds shared tier resources once and per-chunk matrix/phase buffers separately, with sparse slot exception lookup and hero rest snapshots for updates; no in-tree production shot host consumes this producer, and that unresolved wiring is not repaired by another runtime layer.
17
- * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Regenerates authored seeded slots and actual cues without fixture frames or per-member surrogate nodes. The 0.01 chunk-radius and 0.001 distance/depth floors are numerical conventions; culling uses original chunk bounds and supplied projection radius, without recomputing bounds for reform or sparse offsets. Containment of the current deformed arrangement is therefore a remaining premise, not an independently established visibility guarantee.
17
+ * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Regenerates authored seeded slots and actual cues without fixture frames or per-member surrogate nodes. Culling encloses current placements through base arrangement bounds and sparse member distances. Enclosure of displayed geometry depends on the supplied model projection radius.
18
18
  * @evidence contracts/development/common.md#meaningful-documentation States anonymous versus promoted members, metre/phase buffer roles, shared gait repertoire and cadence approximation, update work beyond uniform writes and the currently absent production consumer.
19
19
  * @evidence contracts/development/implementation.md#efficient-algorithms Construction regenerates N anonymous slots and fills each resident tier, bakes each tier once and locates E exceptions by scanning C chunks then the matching chunk's slots. Updates visit chunks/tiers and heroes, sample cue lists for each exception, and rewrite N matrices when spacing/reform changes. Cue sampling and native graph updates add their actual costs; retained buffers scale with N times resident tiers rather than one Object3D per member.
20
20
  * @evidence contracts/development/implementation.md#reuse-equivalent-work Shares tier geometry/material/cycle textures across chunk meshes, retains tier hysteresis and only rewrites arrangement when spacing/reform inputs change; absolute cue/cadence inputs drive updates, and failed/successful disposal completion is reused without physical retries.
@@ -63,7 +63,7 @@ const vector_js_1 = require("./vector.js");
63
63
  *
64
64
  * @evidence contracts/development/implementation.md#principled-implementation Uses engine compact slot regeneration, cue sampling, cadence integration and hysteretic LOD, projecting metre placements into chunk InstancedMeshes and baked Float32 part tables; admitted models/anchors/tiers are premises, stride is heuristic and cadence matrix interpolation is approximate, while anonymous and caller-supplied hero ownership stay distinct.
65
65
  * @evidence contracts/development/implementation.md#clear-and-simple-structure Builds shared tier resources once and per-chunk matrix/phase buffers separately, with sparse slot exception lookup and hero rest snapshots for updates; no in-tree production shot host consumes this producer, and that unresolved wiring is not repaired by another runtime layer.
66
- * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Regenerates authored seeded slots and actual cues without fixture frames or per-member surrogate nodes. The 0.01 chunk-radius and 0.001 distance/depth floors are numerical conventions; culling uses original chunk bounds and supplied projection radius, without recomputing bounds for reform or sparse offsets. Containment of the current deformed arrangement is therefore a remaining premise, not an independently established visibility guarantee.
66
+ * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Regenerates authored seeded slots and actual cues without fixture frames or per-member surrogate nodes. Culling encloses current placements through base arrangement bounds and sparse member distances. Enclosure of displayed geometry depends on the supplied model projection radius.
67
67
  * @evidence contracts/development/common.md#meaningful-documentation States anonymous versus promoted members, metre/phase buffer roles, shared gait repertoire and cadence approximation, update work beyond uniform writes and the currently absent production consumer.
68
68
  * @evidence contracts/development/implementation.md#efficient-algorithms Construction regenerates N anonymous slots and fills each resident tier, bakes each tier once and locates E exceptions by scanning C chunks then the matching chunk's slots. Updates visit chunks/tiers and heroes, sample cue lists for each exception, and rewrite N matrices when spacing/reform changes. Cue sampling and native graph updates add their actual costs; retained buffers scale with N times resident tiers rather than one Object3D per member.
69
69
  * @evidence contracts/development/implementation.md#reuse-equivalent-work Shares tier geometry/material/cycle textures across chunk meshes, retains tier hysteresis and only rewrites arrangement when spacing/reform inputs change; absolute cue/cadence inputs drive updates, and failed/successful disposal completion is reused without physical retries.
@@ -110,9 +110,13 @@ const buildInstancedFormation = (input) => {
110
110
  root.add(mesh);
111
111
  tiers.set(lod.tier, mesh);
112
112
  }
113
+ const restRadius = Math.max(0.01, ...[chunk.bounds.min.x, chunk.bounds.max.x].flatMap((x) => [chunk.bounds.min.y, chunk.bounds.max.y].flatMap((y) => [chunk.bounds.min.z, chunk.bounds.max.z].map((z) => Math.hypot(x - chunk.centroid.x, y - chunk.centroid.y, z - chunk.centroid.z)))));
113
114
  return {
114
115
  runtime: chunk,
115
- radius: Math.max(0.01, ...[chunk.bounds.min.x, chunk.bounds.max.x].flatMap((x) => [chunk.bounds.min.y, chunk.bounds.max.y].flatMap((y) => [chunk.bounds.min.z, chunk.bounds.max.z].map((z) => Math.hypot(x - chunk.centroid.x, y - chunk.centroid.y, z - chunk.centroid.z))))),
116
+ center: (0, vector_js_1.vector)(chunk.centroid).sub(root.position),
117
+ restRadius,
118
+ radius: restRadius,
119
+ exceptionRadius: 0,
116
120
  slots,
117
121
  tiers,
118
122
  selected: null,
@@ -231,21 +235,39 @@ const buildInstancedFormation = (input) => {
231
235
  if (sampled.spacingScale.lateral !== spacing.lateral ||
232
236
  sampled.spacingScale.depth !== spacing.depth ||
233
237
  sampled.reform?.layout !== reform?.layout ||
238
+ sampled.reform?.fromLayout !== reform?.fromLayout ||
234
239
  sampled.reform?.progress !== reform?.progress) {
235
240
  spacing = { ...sampled.spacingScale };
236
241
  reform = sampled.reform;
237
- for (const chunk of chunks)
242
+ for (const chunk of chunks) {
243
+ const bounds = new THREE.Box3();
244
+ const position = new THREE.Vector3();
245
+ chunk.slots.forEach((slot, index) => {
246
+ const matrix = (0, slotMatrix_js_1.slotMatrix)(reform === null
247
+ ? slot
248
+ : {
249
+ ...slot,
250
+ position: (0, engine_1.formationSlotPosition)(input.formation, slot.slot, reform),
251
+ }, input.formation.anchor, spacing, input.formation.facingDeg);
252
+ if (reform !== null)
253
+ bounds.expandByPoint(position.setFromMatrixPosition(matrix));
254
+ for (const mesh of chunk.tiers.values())
255
+ mesh.setMatrixAt(index, matrix);
256
+ });
257
+ if (reform === null) {
258
+ chunk.center.copy((0, formationSpacingOffset_js_1.formationSpacingOffset)(chunk.runtime.centroid, input.formation.anchor, spacing, input.formation.facingDeg));
259
+ chunk.radius =
260
+ chunk.restRadius *
261
+ Math.max(1, spacing.lateral, spacing.depth);
262
+ }
263
+ else if (bounds.isEmpty() === false) {
264
+ bounds.getCenter(chunk.center);
265
+ chunk.radius = bounds.max.distanceTo(chunk.center);
266
+ }
238
267
  for (const mesh of chunk.tiers.values()) {
239
- chunk.slots.forEach((slot, index) => {
240
- mesh.setMatrixAt(index, (0, slotMatrix_js_1.slotMatrix)(reform === null
241
- ? slot
242
- : {
243
- ...slot,
244
- position: (0, engine_1.formationSlotPosition)(input.formation, slot.slot, reform),
245
- }, input.formation.anchor, spacing, input.formation.facingDeg));
246
- });
247
268
  mesh.instanceMatrix.needsUpdate = true;
248
269
  }
270
+ }
249
271
  }
250
272
  // The members singled out, written after the unit-wide pass so a spacing
251
273
  // rewrite cannot undo them. Only the exceptions are touched, so this costs
@@ -256,12 +278,16 @@ const buildInstancedFormation = (input) => {
256
278
  // carries the cue's own turn and its travel. That is the same composition
257
279
  // the engine's placement performs in one step for a gate that has no
258
280
  // scene graph to carry half of it.
259
- for (const exception of exceptions)
260
- exception.chunk.removed = 0;
281
+ for (const { chunk } of exceptions) {
282
+ chunk.removed = 0;
283
+ chunk.exceptionRadius = 0;
284
+ }
261
285
  for (const exception of exceptions) {
262
286
  const state = (0, engine_1.sampleFormationSlotMotion)(slotMotions, input.formation.id, exception.slot, time ?? 0);
263
287
  const offset = (0, engine_1.rotateFormationLocalOffset)(state.offset, input.formation.facingDeg);
264
- const position = (0, formationSpacingOffset_js_1.formationSpacingOffset)(exception.designed.position, input.formation.anchor, spacing, input.formation.facingDeg);
288
+ const position = (0, formationSpacingOffset_js_1.formationSpacingOffset)(reform === null
289
+ ? exception.designed.position
290
+ : (0, engine_1.formationSlotPosition)(input.formation, exception.slot, reform), input.formation.anchor, spacing, input.formation.facingDeg);
265
291
  position.x += offset.x;
266
292
  position.y += offset.y;
267
293
  position.z += offset.z;
@@ -280,6 +306,8 @@ const buildInstancedFormation = (input) => {
280
306
  ++exception.chunk.removed;
281
307
  ++stats.removed;
282
308
  }
309
+ else
310
+ exception.chunk.exceptionRadius = Math.max(exception.chunk.exceptionRadius, position.distanceTo(exception.chunk.center));
283
311
  }
284
312
  root.updateMatrixWorld(true);
285
313
  camera.updateMatrixWorld(true);
@@ -342,11 +370,8 @@ const buildInstancedFormation = (input) => {
342
370
  ++stats.visible.hero;
343
371
  }
344
372
  for (const chunk of chunks) {
345
- const localCenter = (0, formationSpacingOffset_js_1.formationSpacingOffset)(chunk.runtime.centroid, input.formation.anchor, spacing, input.formation.facingDeg);
346
- const center = root.localToWorld(localCenter);
347
- const sphere = new THREE.Sphere(center, chunk.radius *
348
- Math.max(sampled.spacingScale.lateral, sampled.spacingScale.depth) +
349
- selectionRadius);
373
+ const center = root.localToWorld(chunk.center.clone());
374
+ const sphere = new THREE.Sphere(center, Math.max(chunk.radius, chunk.exceptionRadius) + selectionRadius);
350
375
  if (frustum.intersectsSphere(sphere) === false) {
351
376
  for (const mesh of chunk.tiers.values())
352
377
  mesh.visible = false;
@@ -1 +1 @@
1
- {"version":3,"file":"buildInstancedFormation.js","sourceRoot":"","sources":["../../src/scene/buildInstancedFormation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAS2B;AAe3B,MAAY,KAAK,kCAAc;AAS/B,2EAAqE;AACrE,+FAAyF;AACzF,2FAAqF;AACrF,uDAA8D;AAC9D,6FAAuF;AACvF,6FAAuF;AACvF,wDAAuE;AACvE,2EAAqE;AACrE,6DAAuD;AACvD,6EAAuE;AACvE,iGAA2F;AAC3F,mDAA6C;AAC7C,2CAAqC;AAErC;;;;;;;;;;;;;;;;;;;GAmBG;AACI,MAAM,uBAAuB,GAEG,CACrC,KAAoC,EACH,EAAE;IACnC,OAAO,IAAA,sEAAgC,EACrC,CACE,GAEa,EACoB,EAAE;QACnC,MAAM,IAAI,GAAwC,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QACpE,IAAI,CAAC,IAAI,GAAG,aAAa,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC;QAC9C,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAA,kBAAM,EAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;QACnD,MAAM,MAAM,GAAgB,IAAI,GAAG,CACjC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CACxB,CAAC,IAAqC,EAAU,EAAE,CAAC,IAAI,CAAC,IAAI,CAC7D,CACF,CAAC;QACF,MAAM,eAAe,GAGjB,IAAA,kEAA8B,EAAC,KAAK,CAAC,CAAC;QAC1C,GAAG,CAAC;YACF,OAAO,EAAE,GAAS,EAAE,CAClB,IAAA,oEAA+B,EAAC,eAAe,CAAC,MAAM,EAAE,CAAC;SAC5D,CAAC,CAAC;QACH,MAAM,MAAM,GAA+B;YACzC,GAAG,eAAe,CAAC,MAAM,EAAE;SAC5B,C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ACH,CAAC;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AAljBW,QAAA,uBAAuB,GAAvB,uBAAuB,CAkjBlC"}
@@ -30,7 +30,7 @@ import * as THREE from "three";
30
30
  *
31
31
  * @evidence contracts/development/implementation.md#principled-implementation Uses engine compact slot regeneration, cue sampling, cadence integration and hysteretic LOD, projecting metre placements into chunk InstancedMeshes and baked Float32 part tables; admitted models/anchors/tiers are premises, stride is heuristic and cadence matrix interpolation is approximate, while anonymous and caller-supplied hero ownership stay distinct.
32
32
  * @evidence contracts/development/implementation.md#clear-and-simple-structure Builds shared tier resources once and per-chunk matrix/phase buffers separately, with sparse slot exception lookup and hero rest snapshots for updates; no in-tree production shot host consumes this producer, and that unresolved wiring is not repaired by another runtime layer.
33
- * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Regenerates authored seeded slots and actual cues without fixture frames or per-member surrogate nodes. The 0.01 chunk-radius and 0.001 distance/depth floors are numerical conventions; culling uses original chunk bounds and supplied projection radius, without recomputing bounds for reform or sparse offsets. Containment of the current deformed arrangement is therefore a remaining premise, not an independently established visibility guarantee.
33
+ * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Regenerates authored seeded slots and actual cues without fixture frames or per-member surrogate nodes. Culling encloses current placements through base arrangement bounds and sparse member distances. Enclosure of displayed geometry depends on the supplied model projection radius.
34
34
  * @evidence contracts/development/common.md#meaningful-documentation States anonymous versus promoted members, metre/phase buffer roles, shared gait repertoire and cadence approximation, update work beyond uniform writes and the currently absent production consumer.
35
35
  * @evidence contracts/development/implementation.md#efficient-algorithms Construction regenerates N anonymous slots and fills each resident tier, bakes each tier once and locates E exceptions by scanning C chunks then the matching chunk's slots. Updates visit chunks/tiers and heroes, sample cue lists for each exception, and rewrite N matrices when spacing/reform changes. Cue sampling and native graph updates add their actual costs; retained buffers scale with N times resident tiers rather than one Object3D per member.
36
36
  * @evidence contracts/development/implementation.md#reuse-equivalent-work Shares tier geometry/material/cycle textures across chunk meshes, retains tier hysteresis and only rewrites arrangement when spacing/reform inputs change; absolute cue/cadence inputs drive updates, and failed/successful disposal completion is reused without physical retries.
@@ -71,9 +71,13 @@ const buildInstancedFormation = (input) => {
71
71
  root.add(mesh);
72
72
  tiers.set(lod.tier, mesh);
73
73
  }
74
+ const restRadius = Math.max(.01, ...[chunk.bounds.min.x, chunk.bounds.max.x].flatMap((x) => [chunk.bounds.min.y, chunk.bounds.max.y].flatMap((y) => [chunk.bounds.min.z, chunk.bounds.max.z].map((z) => Math.hypot(x - chunk.centroid.x, y - chunk.centroid.y, z - chunk.centroid.z)))));
74
75
  return {
75
76
  runtime: chunk,
76
- radius: Math.max(.01, ...[chunk.bounds.min.x, chunk.bounds.max.x].flatMap((x) => [chunk.bounds.min.y, chunk.bounds.max.y].flatMap((y) => [chunk.bounds.min.z, chunk.bounds.max.z].map((z) => Math.hypot(x - chunk.centroid.x, y - chunk.centroid.y, z - chunk.centroid.z))))),
77
+ center: vector(chunk.centroid).sub(root.position),
78
+ restRadius,
79
+ radius: restRadius,
80
+ exceptionRadius: 0,
77
81
  slots,
78
82
  tiers,
79
83
  selected: null,
@@ -166,24 +170,38 @@ const buildInstancedFormation = (input) => {
166
170
  for (const cycle of cycles) applyFormationCycleCadence(cycle, cadence);
167
171
  root.position.set(input.formation.anchor.x + sampled.translation.x, input.formation.anchor.y + sampled.translation.y, input.formation.anchor.z + sampled.translation.z);
168
172
  root.quaternion.setFromAxisAngle(new THREE.Vector3(0, 1, 0), THREE.MathUtils.degToRad(sampled.facingOffsetDeg));
169
- if (sampled.spacingScale.lateral !== spacing.lateral || sampled.spacingScale.depth !== spacing.depth || sampled.reform?.layout !== reform?.layout || sampled.reform?.progress !== reform?.progress) {
173
+ if (sampled.spacingScale.lateral !== spacing.lateral || sampled.spacingScale.depth !== spacing.depth || sampled.reform?.layout !== reform?.layout || sampled.reform?.fromLayout !== reform?.fromLayout || sampled.reform?.progress !== reform?.progress) {
170
174
  spacing = { ...sampled.spacingScale };
171
175
  reform = sampled.reform;
172
- for (const chunk of chunks) for (const mesh of chunk.tiers.values()) {
176
+ for (const chunk of chunks) {
177
+ const bounds = new THREE.Box3();
178
+ const position = new THREE.Vector3();
173
179
  chunk.slots.forEach((slot, index) => {
174
- mesh.setMatrixAt(index, slotMatrix(reform === null ? slot : {
180
+ const matrix = slotMatrix(reform === null ? slot : {
175
181
  ...slot,
176
182
  position: formationSlotPosition(input.formation, slot.slot, reform)
177
- }, input.formation.anchor, spacing, input.formation.facingDeg));
183
+ }, input.formation.anchor, spacing, input.formation.facingDeg);
184
+ if (reform !== null) bounds.expandByPoint(position.setFromMatrixPosition(matrix));
185
+ for (const mesh of chunk.tiers.values()) mesh.setMatrixAt(index, matrix);
178
186
  });
179
- mesh.instanceMatrix.needsUpdate = true;
187
+ if (reform === null) {
188
+ chunk.center.copy(formationSpacingOffset(chunk.runtime.centroid, input.formation.anchor, spacing, input.formation.facingDeg));
189
+ chunk.radius = chunk.restRadius * Math.max(1, spacing.lateral, spacing.depth);
190
+ } else if (bounds.isEmpty() === false) {
191
+ bounds.getCenter(chunk.center);
192
+ chunk.radius = bounds.max.distanceTo(chunk.center);
193
+ }
194
+ for (const mesh of chunk.tiers.values()) mesh.instanceMatrix.needsUpdate = true;
180
195
  }
181
196
  }
182
- for (const exception of exceptions) exception.chunk.removed = 0;
197
+ for (const { chunk } of exceptions) {
198
+ chunk.removed = 0;
199
+ chunk.exceptionRadius = 0;
200
+ }
183
201
  for (const exception of exceptions) {
184
202
  const state = sampleFormationSlotMotion(slotMotions, input.formation.id, exception.slot, time ?? 0);
185
203
  const offset = rotateFormationLocalOffset(state.offset, input.formation.facingDeg);
186
- const position = formationSpacingOffset(exception.designed.position, input.formation.anchor, spacing, input.formation.facingDeg);
204
+ const position = formationSpacingOffset(reform === null ? exception.designed.position : formationSlotPosition(input.formation, exception.slot, reform), input.formation.anchor, spacing, input.formation.facingDeg);
187
205
  position.x += offset.x;
188
206
  position.y += offset.y;
189
207
  position.z += offset.z;
@@ -195,7 +213,7 @@ const buildInstancedFormation = (input) => {
195
213
  if (state.present === false) {
196
214
  ++exception.chunk.removed;
197
215
  ++stats.removed;
198
- }
216
+ } else exception.chunk.exceptionRadius = Math.max(exception.chunk.exceptionRadius, position.distanceTo(exception.chunk.center));
199
217
  }
200
218
  root.updateMatrixWorld(true);
201
219
  camera.updateMatrixWorld(true);
@@ -251,9 +269,8 @@ const buildInstancedFormation = (input) => {
251
269
  if (object.visible) ++stats.visible.hero;
252
270
  }
253
271
  for (const chunk of chunks) {
254
- const localCenter = formationSpacingOffset(chunk.runtime.centroid, input.formation.anchor, spacing, input.formation.facingDeg);
255
- const center = root.localToWorld(localCenter);
256
- const sphere = new THREE.Sphere(center, chunk.radius * Math.max(sampled.spacingScale.lateral, sampled.spacingScale.depth) + selectionRadius);
272
+ const center = root.localToWorld(chunk.center.clone());
273
+ const sphere = new THREE.Sphere(center, Math.max(chunk.radius, chunk.exceptionRadius) + selectionRadius);
257
274
  if (frustum.intersectsSphere(sphere) === false) {
258
275
  for (const mesh of chunk.tiers.values()) mesh.visible = false;
259
276
  stats.culled += chunk.runtime.anonymousCount - chunk.removed;
@@ -1 +1 @@
1
- {"version":3,"file":"buildInstancedFormation.mjs","names":[],"sources":["../../src/scene/buildInstancedFormation.ts"],"sourcesContent":["import {\n composeFormationHeroTransform,\n formationCadenceSegments,\n formationSlotPosition,\n intersectsPerspectiveFrustumSphere,\n rotateFormationLocalOffset,\n sampleFormationMotion,\n sampleFormationSlotMotion,\n selectFormationLod,\n} from \"@automovie/engine\";\nimport {\n IAutoMovieCompiledFormationHero,\n IAutoMovieCompiledFormationLod,\n IAutoMovieDeliveryCrop,\n type IAutoMovieFormationCadenceSegment,\n IAutoMovieFormationChunk,\n type IAutoMovieFormationReform,\n IAutoMovieFormationSlot,\n IAutoMovieFormationSlotMotion,\n IAutoMovieFormationSlotState,\n type IAutoMovieSampledFormationMotion,\n IAutoMovieTransform,\n IAutoMovieVector3,\n} from \"@automovie/interface\";\nimport * as THREE from \"three\";\n\nimport type { IAutoMovieFormationCycle } from \"./IAutoMovieFormationCycle.js\";\nimport type { IAutoMovieFormationViewerObject } from \"./IAutoMovieFormationViewerObject.js\";\nimport type { IAutoMovieFormationViewerStats } from \"./IAutoMovieFormationViewerStats.js\";\nimport type { IBuildInstancedFormationProps } from \"./IBuildInstancedFormationProps.js\";\nimport type { IChunkObject } from \"./IChunkObject.js\";\nimport type { IFormationTierRepresentation } from \"./IFormationTierRepresentation.js\";\nimport type { ISlotException } from \"./ISlotException.js\";\nimport { bindFormationTierCycle } from \"./bindFormationTierCycle.js\";\nimport { constructAutoMovieOwnedResources } from \"./constructAutoMovieOwnedResources.js\";\nimport { createFormationRepresentations } from \"./createFormationRepresentations.js\";\nimport { readAutoMovieDeliveryCrop } from \"./deliveryCrop.js\";\nimport { describeFormationTextureSources } from \"./describeFormationTextureSources.js\";\nimport { disposeFormationRepresentations } from \"./disposeFormationRepresentations.js\";\nimport { applyFormationCycleCadence } from \"./formationCycle/index.js\";\nimport { formationSpacingOffset } from \"./formationSpacingOffset.js\";\nimport { objectTransform } from \"./objectTransform.js\";\nimport { regenerateFormationSlot } from \"./regenerateFormationSlot.js\";\nimport { reportAutoMovieResourceRetirement } from \"./reportAutoMovieResourceRetirement.js\";\nimport { slotMatrix } from \"./slotMatrix.js\";\nimport { vector } from \"./vector.js\";\n\n/**\n * Build one compact formation as chunked instance batches.\n *\n * Heroes are deliberately absent: the builder promoted them to explicit scene\n * nodes. Each LOD tier's model is flattened into one mesh, keeping exactly one\n * 64-byte instance matrix and one 4-byte phase scalar per anonymous slot and\n * tier.\n *\n * Declared gaits are baked into part-matrix tables and each member reads the selected table at its seeded phase. Positive-stride takes advance by cue travel/turn and the stride heuristic; zero-stride takes instead advance by elapsed time and their declared period. Two scalar uniforms and one texture reference carry a tier's cadence, while culling, spacing/reform and sparse cues require additional update work.\n *\n * No production scene/film caller is connected in the current tree; direct users and owning tests exercise this producer, so this API alone does not establish that compiled shot populations reach the capture application.\n *\n * @evidence contracts/development/implementation.md#principled-implementation Uses engine compact slot regeneration, cue sampling, cadence integration and hysteretic LOD, projecting metre placements into chunk InstancedMeshes and baked Float32 part tables; admitted models/anchors/tiers are premises, stride is heuristic and cadence matrix interpolation is approximate, while anonymous and caller-supplied hero ownership stay distinct.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure Builds shared tier resources once and per-chunk matrix/phase buffers separately, with sparse slot exception lookup and hero rest snapshots for updates; no in-tree production shot host consumes this producer, and that unresolved wiring is not repaired by another runtime layer.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Regenerates authored seeded slots and actual cues without fixture frames or per-member surrogate nodes. The 0.01 chunk-radius and 0.001 distance/depth floors are numerical conventions; culling uses original chunk bounds and supplied projection radius, without recomputing bounds for reform or sparse offsets. Containment of the current deformed arrangement is therefore a remaining premise, not an independently established visibility guarantee.\n * @evidence contracts/development/common.md#meaningful-documentation States anonymous versus promoted members, metre/phase buffer roles, shared gait repertoire and cadence approximation, update work beyond uniform writes and the currently absent production consumer.\n * @evidence contracts/development/implementation.md#efficient-algorithms Construction regenerates N anonymous slots and fills each resident tier, bakes each tier once and locates E exceptions by scanning C chunks then the matching chunk's slots. Updates visit chunks/tiers and heroes, sample cue lists for each exception, and rewrite N matrices when spacing/reform changes. Cue sampling and native graph updates add their actual costs; retained buffers scale with N times resident tiers rather than one Object3D per member.\n * @evidence contracts/development/implementation.md#reuse-equivalent-work Shares tier geometry/material/cycle textures across chunk meshes, retains tier hysteresis and only rewrites arrangement when spacing/reform inputs change; absolute cue/cadence inputs drive updates, and failed/successful disposal completion is reused without physical retries.\n * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Construction scope immediately owns tier retirement and each chunk geometry/mesh, rolling them back independently on later refusal; returned runtime owns all anonymous resources until disposal and borrows hero objects. Disposal stops updates, attempts every unique resource, retains operation closures on failed release and preserves its original completion until the runtime is released.\n */\nexport const buildInstancedFormation: (\n input: IBuildInstancedFormationProps,\n) => IAutoMovieFormationViewerObject = (\n input: IBuildInstancedFormationProps,\n): IAutoMovieFormationViewerObject => {\n return constructAutoMovieOwnedResources(\n (\n own: <Resource extends { dispose(): void }>(\n resource: Resource,\n ) => Resource,\n ): IAutoMovieFormationViewerObject => {\n const root: THREE.Group<THREE.Object3DEventMap> = new THREE.Group();\n root.name = `formation:${input.formation.id}`;\n root.position.copy(vector(input.formation.anchor));\n const heroes: Set<number> = new Set(\n input.formation.heroes.map(\n (hero: IAutoMovieCompiledFormationHero): number => hero.slot,\n ),\n );\n const representations: Map<\n \"hero\" | \"near\" | \"far\",\n IFormationTierRepresentation\n > = createFormationRepresentations(input);\n own({\n dispose: (): void =>\n disposeFormationRepresentations(representations.values()),\n });\n const cycles: IAutoMovieFormationCycle[] = [\n ...representations.values(),\n ].flatMap(\n (\n representation: IFormationTierRepresentation,\n ): IAutoMovieFormationCycle[] => {\n const cycle: IAutoMovieFormationCycle | null = representation.cycle;\n return cycle === null ? [] : [cycle];\n },\n );\n const selectionRadius: number = input.formation.projectionRadius;\n const chunks: IChunkObject[] = input.formation.chunks.map(\n (chunk: IAutoMovieFormationChunk): IChunkObject => {\n const slots: IAutoMovieFormationSlot[] = [];\n for (\n let slot: number = chunk.start;\n slot < chunk.start + chunk.count;\n ++slot\n )\n if (heroes.has(slot) === false)\n slots.push(regenerateFormationSlot(input.formation, slot));\n const tiers: Map<\n \"hero\" | \"near\" | \"far\",\n THREE.InstancedMesh<\n THREE.BufferGeometry<\n THREE.NormalBufferAttributes,\n THREE.BufferGeometryEventMap\n >,\n | THREE.Material<THREE.MaterialEventMap>\n | THREE.Material<THREE.MaterialEventMap>[],\n THREE.Object3DEventMap\n >\n > = new Map<\n IAutoMovieCompiledFormationLod[\"tier\"],\n THREE.InstancedMesh\n >();\n for (const lod of slots.length === 0 ? [] : input.formation.lod) {\n const representation: IFormationTierRepresentation =\n representations.get(lod.tier)!;\n const geometry: THREE.BufferGeometry<\n THREE.NormalBufferAttributes,\n THREE.BufferGeometryEventMap\n > = own(representation.geometry.clone());\n geometry.setAttribute(\n \"automoviePhase\",\n new THREE.InstancedBufferAttribute(\n new Float32Array(\n slots.map(\n (slot: IAutoMovieFormationSlot): number => slot.motionPhase,\n ),\n ),\n 1,\n ),\n );\n const mesh: THREE.InstancedMesh<\n THREE.BufferGeometry<\n THREE.NormalBufferAttributes,\n THREE.BufferGeometryEventMap\n >,\n THREE.Material<THREE.MaterialEventMap>[],\n THREE.Object3DEventMap\n > = own(\n new THREE.InstancedMesh(\n geometry,\n representation.materials,\n slots.length,\n ),\n );\n mesh.name = `${input.formation.id}:${chunk.index}:${lod.tier}`;\n bindFormationTierCycle(mesh, representation);\n slots.forEach(\n (slot: IAutoMovieFormationSlot, index: number): void => {\n mesh.setMatrixAt(\n index,\n slotMatrix(slot, input.formation.anchor),\n );\n },\n );\n mesh.instanceMatrix.needsUpdate = true;\n mesh.computeBoundingBox();\n mesh.computeBoundingSphere();\n mesh.frustumCulled = false;\n mesh.visible = false;\n root.add(mesh);\n tiers.set(lod.tier, mesh);\n }\n return {\n runtime: chunk,\n radius: Math.max(\n 0.01,\n ...[chunk.bounds.min.x, chunk.bounds.max.x].flatMap(\n (x: number): number[] =>\n [chunk.bounds.min.y, chunk.bounds.max.y].flatMap(\n (y: number): number[] =>\n [chunk.bounds.min.z, chunk.bounds.max.z].map(\n (z: number): number =>\n Math.hypot(\n x - chunk.centroid.x,\n y - chunk.centroid.y,\n z - chunk.centroid.z,\n ),\n ),\n ),\n ),\n ),\n slots,\n tiers,\n selected: null,\n removed: 0,\n };\n },\n );\n const drawableTiers: Set<\"hero\" | \"near\" | \"far\"> = new Set(\n chunks.flatMap((chunk: IChunkObject): (\"hero\" | \"near\" | \"far\")[] => [\n ...chunk.tiers.keys(),\n ]),\n );\n // The cues a unit was built with are the cues it performs, resolved once.\n // Which members are singled out is settled here and never revisited, so a\n // frame that re-read the caller's list would sample cues against a set of\n // exceptions that no longer answers to them: a member named after the build\n // has no instance to write, and one named before it would keep performing\n // whatever the new list happened to say. Reading it twice also left the second\n // `?? []` an arm no input could take, since a unit whose cues are absent has\n // no exception to sample for.\n const slotMotions: readonly IAutoMovieFormationSlotMotion[] =\n input.slotMotions ?? [];\n // Every member a cue singles out, located once. Nothing is stored for the\n // members no cue names, which is what keeps a crowd of a hundred thousand\n // paying for the three exceptions it has and not for its own size.\n const exceptions: ISlotException[] = [];\n for (const slot of new Set(\n slotMotions.flatMap((cue: IAutoMovieFormationSlotMotion): number[] =>\n cue.formation === input.formation.id ? cue.slots : [],\n ),\n )) {\n const chunk: IChunkObject | undefined = chunks.find(\n (candidate: IChunkObject): boolean =>\n slot >= candidate.runtime.start &&\n slot < candidate.runtime.start + candidate.runtime.count,\n );\n const index: number =\n chunk?.slots.findIndex(\n (member: IAutoMovieFormationSlot): boolean => member.slot === slot,\n ) ?? -1;\n if (chunk === undefined || index < 0) continue;\n exceptions.push({ slot, chunk, index, designed: chunk.slots[index]! });\n }\n let spacing: { lateral: number; depth: number } = {\n lateral: 1,\n depth: 1,\n };\n // The arrangement currently written into the instance matrices, so a\n // frame that changes neither spacing nor arrangement writes nothing.\n let reform: IAutoMovieFormationReform | null = null;\n const initialHeroSources: Map<string, IAutoMovieTransform> = new Map(\n [...(input.heroObjects ?? [])].map(\n ([actor, object]: [\n string,\n THREE.Object3D<THREE.Object3DEventMap>,\n ]): readonly [string, IAutoMovieTransform] =>\n [actor, objectTransform(object)] as const,\n ),\n );\n const stats: IAutoMovieFormationViewerStats = {\n visible: { hero: 0, near: 0, far: 0 },\n culled: 0,\n removed: 0,\n heroes: input.formation.heroes.length,\n };\n let disposed: boolean = false;\n let disposalFailure: { error: unknown } | undefined;\n let retirements: (() => void)[] | undefined;\n return {\n object: root,\n stats,\n describeTextureSources: (): ReturnType<\n typeof describeFormationTextureSources\n > =>\n describeFormationTextureSources(\n input.formation.id,\n representations,\n drawableTiers,\n ),\n dispose(): void {\n if (disposed) {\n if (disposalFailure !== undefined) throw disposalFailure.error;\n return;\n }\n disposed = true;\n const ownedTiers: IFormationTierRepresentation[] = [\n ...representations.values(),\n ];\n retirements = [\n (): void => {\n root.removeFromParent();\n },\n ...chunks.flatMap((chunk: IChunkObject): (() => void)[] =>\n [...chunk.tiers.values()].flatMap(\n (mesh: THREE.InstancedMesh): (() => void)[] => [\n (): void => mesh.geometry.dispose(),\n (): void => mesh.dispose(),\n ],\n ),\n ),\n (): void => disposeFormationRepresentations(ownedTiers),\n (): void => {\n root.clear();\n },\n ];\n try {\n reportAutoMovieResourceRetirement(retirements);\n for (const chunk of chunks) {\n chunk.tiers.clear();\n chunk.slots.length = 0;\n }\n representations.clear();\n drawableTiers.clear();\n cycles.length = 0;\n chunks.length = 0;\n exceptions.length = 0;\n initialHeroSources.clear();\n retirements = undefined;\n } catch (error) {\n disposalFailure = { error };\n throw error;\n }\n },\n update(\n camera: THREE.PerspectiveCamera,\n viewportHeight: number,\n time: number | undefined,\n heroSources: ReadonlyMap<string, IAutoMovieTransform> | undefined,\n ): void {\n if (disposed)\n throw new Error(`Formation \"${input.formation.id}\" is disposed.`);\n stats.visible = { hero: 0, near: 0, far: 0 };\n stats.culled = 0;\n stats.removed = 0;\n const sampled: IAutoMovieSampledFormationMotion =\n sampleFormationMotion(\n input.motions ?? [],\n input.formation.id,\n time ?? 0,\n );\n // What the unit has done up to this instant, cut into the intervals its\n // cadence is made of. Every member lands somewhere else in the resulting\n // cycle, because the phase it adds is its own; every tier folds the same\n // intervals against its own figure's strides, because a near stickman and\n // a far one cover ground with the same feet.\n const cadence: IAutoMovieFormationCadenceSegment[] =\n formationCadenceSegments(\n input.motions ?? [],\n input.formation.id,\n time ?? 0,\n );\n for (const cycle of cycles)\n applyFormationCycleCadence(cycle, cadence);\n root.position.set(\n input.formation.anchor.x + sampled.translation.x,\n input.formation.anchor.y + sampled.translation.y,\n input.formation.anchor.z + sampled.translation.z,\n );\n root.quaternion.setFromAxisAngle(\n new THREE.Vector3(0, 1, 0),\n THREE.MathUtils.degToRad(sampled.facingOffsetDeg),\n );\n // Spacing opens and closes an arrangement; a re-form changes which\n // arrangement it is. Both move a member relative to its neighbours, so\n // neither can ride on the group transform above and both rewrite the\n // same instance matrices -- together, so a frame that changes both pays\n // for one pass and cannot apply one against the other's stale reading.\n if (\n sampled.spacingScale.lateral !== spacing.lateral ||\n sampled.spacingScale.depth !== spacing.depth ||\n sampled.reform?.layout !== reform?.layout ||\n sampled.reform?.progress !== reform?.progress\n ) {\n spacing = { ...sampled.spacingScale };\n reform = sampled.reform;\n for (const chunk of chunks)\n for (const mesh of chunk.tiers.values()) {\n chunk.slots.forEach(\n (slot: IAutoMovieFormationSlot, index: number): void => {\n mesh.setMatrixAt(\n index,\n slotMatrix(\n reform === null\n ? slot\n : {\n ...slot,\n position: formationSlotPosition(\n input.formation,\n slot.slot,\n reform,\n ),\n },\n input.formation.anchor,\n spacing,\n input.formation.facingDeg,\n ),\n );\n },\n );\n mesh.instanceMatrix.needsUpdate = true;\n }\n }\n // The members singled out, written after the unit-wide pass so a spacing\n // rewrite cannot undo them. Only the exceptions are touched, so this costs\n // what the author authored rather than what the crowd holds.\n //\n // The offset is authored in the unit's own frame and is turned by the\n // unit's designed heading alone, because the scene graph above already\n // carries the cue's own turn and its travel. That is the same composition\n // the engine's placement performs in one step for a gate that has no\n // scene graph to carry half of it.\n for (const exception of exceptions) exception.chunk.removed = 0;\n for (const exception of exceptions) {\n const state: IAutoMovieFormationSlotState =\n sampleFormationSlotMotion(\n slotMotions,\n input.formation.id,\n exception.slot,\n time ?? 0,\n );\n const offset: IAutoMovieVector3 = rotateFormationLocalOffset(\n state.offset,\n input.formation.facingDeg,\n );\n const position: THREE.Vector3 = formationSpacingOffset(\n exception.designed.position,\n input.formation.anchor,\n spacing,\n input.formation.facingDeg,\n );\n position.x += offset.x;\n position.y += offset.y;\n position.z += offset.z;\n // A member out of the shot is written at zero scale rather than dropped\n // from the buffer. Restacking an instance buffer would renumber every\n // member after it and cost the crowd's own size every time one member\n // left; a degenerate matrix rasterizes nothing and costs one write.\n const matrix: THREE.Matrix4 = new THREE.Matrix4().compose(\n position,\n new THREE.Quaternion().setFromAxisAngle(\n new THREE.Vector3(0, 1, 0),\n THREE.MathUtils.degToRad(\n exception.designed.facingDeg + state.facingOffsetDeg,\n ),\n ),\n state.present\n ? new THREE.Vector3(1, 1, 1)\n : new THREE.Vector3(0, 0, 0),\n );\n for (const mesh of exception.chunk.tiers.values()) {\n mesh.setMatrixAt(exception.index, matrix);\n mesh.instanceMatrix.needsUpdate = true;\n }\n if (state.present === false) {\n ++exception.chunk.removed;\n ++stats.removed;\n }\n }\n root.updateMatrixWorld(true);\n camera.updateMatrixWorld(true);\n camera.updateProjectionMatrix();\n const projection: THREE.Matrix4 =\n new THREE.Matrix4().multiplyMatrices(\n camera.projectionMatrix,\n camera.matrixWorldInverse,\n );\n const frustum: THREE.Frustum =\n new THREE.Frustum().setFromProjectionMatrix(projection);\n const cameraPosition: THREE.Vector3 = new THREE.Vector3();\n const cameraRotation: THREE.Quaternion = new THREE.Quaternion();\n camera.getWorldPosition(cameraPosition);\n camera.getWorldQuaternion(cameraRotation);\n const halfY: number = Math.tan(\n THREE.MathUtils.degToRad(camera.fov) / 2,\n );\n const deliveryCrop: IAutoMovieDeliveryCrop | undefined =\n readAutoMovieDeliveryCrop(camera);\n const effectiveHalfY: number =\n halfY *\n (deliveryCrop === undefined\n ? 1\n : deliveryCrop.bottom - deliveryCrop.top);\n for (const hero of input.formation.heroes) {\n const object: THREE.Object3D<THREE.Object3DEventMap> | undefined =\n input.heroObjects?.get(hero.actor);\n if (object === undefined) continue;\n const source: IAutoMovieTransform = (heroSources?.get(hero.actor) ??\n initialHeroSources.get(hero.actor))!;\n const transformed: IAutoMovieTransform =\n composeFormationHeroTransform(\n hero.transform,\n source,\n input.formation.anchor,\n sampled,\n input.formation.facingDeg,\n );\n object.position.copy(vector(transformed.translation));\n object.quaternion.set(\n transformed.rotation.x,\n transformed.rotation.y,\n transformed.rotation.z,\n transformed.rotation.w,\n );\n object.scale.set(\n transformed.scale.x,\n transformed.scale.y,\n transformed.scale.z,\n );\n object.updateMatrixWorld(true);\n const visualObject: THREE.Object3D<THREE.Object3DEventMap> =\n input.heroVisualObjects?.get(hero.actor) ?? object;\n const worldPosition: THREE.Vector3 = new THREE.Vector3();\n visualObject.getWorldPosition(worldPosition);\n const worldRadius: number =\n selectionRadius *\n Math.max(\n Math.abs(transformed.scale.x),\n Math.abs(transformed.scale.y),\n Math.abs(transformed.scale.z),\n );\n object.visible = intersectsPerspectiveFrustumSphere({\n camera: {\n position: {\n x: cameraPosition.x,\n y: cameraPosition.y,\n z: cameraPosition.z,\n },\n rotation: {\n x: cameraRotation.x,\n y: cameraRotation.y,\n z: cameraRotation.z,\n w: cameraRotation.w,\n },\n },\n center: {\n x: worldPosition.x,\n y: worldPosition.y,\n z: worldPosition.z,\n },\n radius: worldRadius,\n near: camera.near,\n far: camera.far,\n halfY,\n aspect: camera.aspect,\n crop: deliveryCrop,\n });\n if (object.visible) ++stats.visible.hero;\n }\n for (const chunk of chunks) {\n const localCenter: THREE.Vector3 = formationSpacingOffset(\n chunk.runtime.centroid,\n input.formation.anchor,\n spacing,\n input.formation.facingDeg,\n );\n const center: THREE.Vector3 = root.localToWorld(localCenter);\n const sphere: THREE.Sphere = new THREE.Sphere(\n center,\n chunk.radius *\n Math.max(\n sampled.spacingScale.lateral,\n sampled.spacingScale.depth,\n ) +\n selectionRadius,\n );\n if (frustum.intersectsSphere(sphere) === false) {\n for (const mesh of chunk.tiers.values()) mesh.visible = false;\n stats.culled += chunk.runtime.anonymousCount - chunk.removed;\n continue;\n }\n const distance: number = Math.max(\n 0.001,\n cameraPosition.distanceTo(center),\n );\n const cameraDepth: number = Math.max(\n 0.001,\n -center.clone().applyMatrix4(camera.matrixWorldInverse).z,\n );\n const projectedPixels: number =\n (selectionRadius * viewportHeight) /\n (effectiveHalfY * cameraDepth);\n const selected: IAutoMovieCompiledFormationLod = selectFormationLod(\n {\n lod: input.formation.lod,\n distance,\n projectedPixels,\n previous: chunk.selected,\n },\n ).lod;\n chunk.selected = selected.tier;\n for (const [tier, mesh] of chunk.tiers)\n mesh.visible = tier === selected.tier;\n stats.visible[selected.tier] +=\n chunk.runtime.anonymousCount - chunk.removed;\n }\n },\n };\n },\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmEA,MAAa,2BAGX,UACoC;CACpC,OAAO,kCAEH,QAGoC;EACpC,MAAM,OAA4C,IAAI,MAAM,MAAM;EAClE,KAAK,OAAO,aAAa,MAAM,UAAU;EACzC,KAAK,SAAS,KAAK,OAAO,MAAM,UAAU,MAAM,CAAC;EACjD,MAAM,SAAsB,IAAI,IAC9B,MAAM,UAAU,OAAO,KACpB,SAAkD,KAAK,IAC1D,CACF;EACA,MAAM,kBAGF,+BAA+B,KAAK;EACxC,IAAI,EACF,eACE,gCAAgC,gBAAgB,OAAO,CAAC,EAC5D,CAAC;EACD,MAAM,SAAqC,CACzC,GAAG,gBAAgB,OAAO,CAC5B,CAAC,CAAC,SAEE,mBAC+B;GAC/B,MAAM,QAAyC,eAAe;GAC9D,OAAO,UAAU,OAAO,CAAC,IAAI,CAAC,KAAK;EACrC,CACF;EACA,MAAM,kBAA0B,MAAM,UAAU;EAChD,MAAM,SAAyB,MAAM,UAAU,OAAO,KACnD,UAAkD;GACjD,MAAM,QAAmC,CAAC;GAC1C,KACE,IAAI,OAAe,MAAM,OACzB,OAAO,MAAM,QAAQ,MAAM,OAC3B,EAAE,MAEF,IAAI,OAAO,IAAI,IAAI,MAAM,OACvB,MAAM,KAAK,wBAAwB,MAAM,WAAW,IAAI,CAAC;GAC7D,MAAM,wBAWF,IAAI,IAGN;GACF,KAAK,MAAM,OAAO,MAAM,WAAW,IAAI,CAAC,IAAI,MAAM,UAAU,KAAK;IAC/D,MAAM,iBACJ,gBAAgB,IAAI,IAAI,IAAI;IAC9B,MAAM,WAGF,IAAI,eAAe,SAAS,MAAM,CAAC;IACvC,SAA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ACF;AACF"}
1
+ {"version":3,"file":"buildInstancedFormation.mjs","names":[],"sources":["../../src/scene/buildInstancedFormation.ts"],"sourcesContent":["import {\n composeFormationHeroTransform,\n formationCadenceSegments,\n formationSlotPosition,\n intersectsPerspectiveFrustumSphere,\n rotateFormationLocalOffset,\n sampleFormationMotion,\n sampleFormationSlotMotion,\n selectFormationLod,\n} from \"@automovie/engine\";\nimport {\n IAutoMovieCompiledFormationHero,\n IAutoMovieCompiledFormationLod,\n IAutoMovieDeliveryCrop,\n type IAutoMovieFormationCadenceSegment,\n IAutoMovieFormationChunk,\n type IAutoMovieFormationReform,\n IAutoMovieFormationSlot,\n IAutoMovieFormationSlotMotion,\n IAutoMovieFormationSlotState,\n type IAutoMovieSampledFormationMotion,\n IAutoMovieTransform,\n IAutoMovieVector3,\n} from \"@automovie/interface\";\nimport * as THREE from \"three\";\n\nimport type { IAutoMovieFormationCycle } from \"./IAutoMovieFormationCycle.js\";\nimport type { IAutoMovieFormationViewerObject } from \"./IAutoMovieFormationViewerObject.js\";\nimport type { IAutoMovieFormationViewerStats } from \"./IAutoMovieFormationViewerStats.js\";\nimport type { IBuildInstancedFormationProps } from \"./IBuildInstancedFormationProps.js\";\nimport type { IChunkObject } from \"./IChunkObject.js\";\nimport type { IFormationTierRepresentation } from \"./IFormationTierRepresentation.js\";\nimport type { ISlotException } from \"./ISlotException.js\";\nimport { bindFormationTierCycle } from \"./bindFormationTierCycle.js\";\nimport { constructAutoMovieOwnedResources } from \"./constructAutoMovieOwnedResources.js\";\nimport { createFormationRepresentations } from \"./createFormationRepresentations.js\";\nimport { readAutoMovieDeliveryCrop } from \"./deliveryCrop.js\";\nimport { describeFormationTextureSources } from \"./describeFormationTextureSources.js\";\nimport { disposeFormationRepresentations } from \"./disposeFormationRepresentations.js\";\nimport { applyFormationCycleCadence } from \"./formationCycle/index.js\";\nimport { formationSpacingOffset } from \"./formationSpacingOffset.js\";\nimport { objectTransform } from \"./objectTransform.js\";\nimport { regenerateFormationSlot } from \"./regenerateFormationSlot.js\";\nimport { reportAutoMovieResourceRetirement } from \"./reportAutoMovieResourceRetirement.js\";\nimport { slotMatrix } from \"./slotMatrix.js\";\nimport { vector } from \"./vector.js\";\n\n/**\n * Build one compact formation as chunked instance batches.\n *\n * Heroes are deliberately absent: the builder promoted them to explicit scene\n * nodes. Each LOD tier's model is flattened into one mesh, keeping exactly one\n * 64-byte instance matrix and one 4-byte phase scalar per anonymous slot and\n * tier.\n *\n * Declared gaits are baked into part-matrix tables and each member reads the selected table at its seeded phase. Positive-stride takes advance by cue travel/turn and the stride heuristic; zero-stride takes instead advance by elapsed time and their declared period. Two scalar uniforms and one texture reference carry a tier's cadence, while culling, spacing/reform and sparse cues require additional update work.\n *\n * No production scene/film caller is connected in the current tree; direct users and owning tests exercise this producer, so this API alone does not establish that compiled shot populations reach the capture application.\n *\n * @evidence contracts/development/implementation.md#principled-implementation Uses engine compact slot regeneration, cue sampling, cadence integration and hysteretic LOD, projecting metre placements into chunk InstancedMeshes and baked Float32 part tables; admitted models/anchors/tiers are premises, stride is heuristic and cadence matrix interpolation is approximate, while anonymous and caller-supplied hero ownership stay distinct.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure Builds shared tier resources once and per-chunk matrix/phase buffers separately, with sparse slot exception lookup and hero rest snapshots for updates; no in-tree production shot host consumes this producer, and that unresolved wiring is not repaired by another runtime layer.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Regenerates authored seeded slots and actual cues without fixture frames or per-member surrogate nodes. Culling encloses current placements through base arrangement bounds and sparse member distances. Enclosure of displayed geometry depends on the supplied model projection radius.\n * @evidence contracts/development/common.md#meaningful-documentation States anonymous versus promoted members, metre/phase buffer roles, shared gait repertoire and cadence approximation, update work beyond uniform writes and the currently absent production consumer.\n * @evidence contracts/development/implementation.md#efficient-algorithms Construction regenerates N anonymous slots and fills each resident tier, bakes each tier once and locates E exceptions by scanning C chunks then the matching chunk's slots. Updates visit chunks/tiers and heroes, sample cue lists for each exception, and rewrite N matrices when spacing/reform changes. Cue sampling and native graph updates add their actual costs; retained buffers scale with N times resident tiers rather than one Object3D per member.\n * @evidence contracts/development/implementation.md#reuse-equivalent-work Shares tier geometry/material/cycle textures across chunk meshes, retains tier hysteresis and only rewrites arrangement when spacing/reform inputs change; absolute cue/cadence inputs drive updates, and failed/successful disposal completion is reused without physical retries.\n * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Construction scope immediately owns tier retirement and each chunk geometry/mesh, rolling them back independently on later refusal; returned runtime owns all anonymous resources until disposal and borrows hero objects. Disposal stops updates, attempts every unique resource, retains operation closures on failed release and preserves its original completion until the runtime is released.\n */\nexport const buildInstancedFormation: (\n input: IBuildInstancedFormationProps,\n) => IAutoMovieFormationViewerObject = (\n input: IBuildInstancedFormationProps,\n): IAutoMovieFormationViewerObject => {\n return constructAutoMovieOwnedResources(\n (\n own: <Resource extends { dispose(): void }>(\n resource: Resource,\n ) => Resource,\n ): IAutoMovieFormationViewerObject => {\n const root: THREE.Group<THREE.Object3DEventMap> = new THREE.Group();\n root.name = `formation:${input.formation.id}`;\n root.position.copy(vector(input.formation.anchor));\n const heroes: Set<number> = new Set(\n input.formation.heroes.map(\n (hero: IAutoMovieCompiledFormationHero): number => hero.slot,\n ),\n );\n const representations: Map<\n \"hero\" | \"near\" | \"far\",\n IFormationTierRepresentation\n > = createFormationRepresentations(input);\n own({\n dispose: (): void =>\n disposeFormationRepresentations(representations.values()),\n });\n const cycles: IAutoMovieFormationCycle[] = [\n ...representations.values(),\n ].flatMap(\n (\n representation: IFormationTierRepresentation,\n ): IAutoMovieFormationCycle[] => {\n const cycle: IAutoMovieFormationCycle | null = representation.cycle;\n return cycle === null ? [] : [cycle];\n },\n );\n const selectionRadius: number = input.formation.projectionRadius;\n const chunks: IChunkObject[] = input.formation.chunks.map(\n (chunk: IAutoMovieFormationChunk): IChunkObject => {\n const slots: IAutoMovieFormationSlot[] = [];\n for (\n let slot: number = chunk.start;\n slot < chunk.start + chunk.count;\n ++slot\n )\n if (heroes.has(slot) === false)\n slots.push(regenerateFormationSlot(input.formation, slot));\n const tiers: Map<\n \"hero\" | \"near\" | \"far\",\n THREE.InstancedMesh<\n THREE.BufferGeometry<\n THREE.NormalBufferAttributes,\n THREE.BufferGeometryEventMap\n >,\n | THREE.Material<THREE.MaterialEventMap>\n | THREE.Material<THREE.MaterialEventMap>[],\n THREE.Object3DEventMap\n >\n > = new Map<\n IAutoMovieCompiledFormationLod[\"tier\"],\n THREE.InstancedMesh\n >();\n for (const lod of slots.length === 0 ? [] : input.formation.lod) {\n const representation: IFormationTierRepresentation =\n representations.get(lod.tier)!;\n const geometry: THREE.BufferGeometry<\n THREE.NormalBufferAttributes,\n THREE.BufferGeometryEventMap\n > = own(representation.geometry.clone());\n geometry.setAttribute(\n \"automoviePhase\",\n new THREE.InstancedBufferAttribute(\n new Float32Array(\n slots.map(\n (slot: IAutoMovieFormationSlot): number => slot.motionPhase,\n ),\n ),\n 1,\n ),\n );\n const mesh: THREE.InstancedMesh<\n THREE.BufferGeometry<\n THREE.NormalBufferAttributes,\n THREE.BufferGeometryEventMap\n >,\n THREE.Material<THREE.MaterialEventMap>[],\n THREE.Object3DEventMap\n > = own(\n new THREE.InstancedMesh(\n geometry,\n representation.materials,\n slots.length,\n ),\n );\n mesh.name = `${input.formation.id}:${chunk.index}:${lod.tier}`;\n bindFormationTierCycle(mesh, representation);\n slots.forEach(\n (slot: IAutoMovieFormationSlot, index: number): void => {\n mesh.setMatrixAt(\n index,\n slotMatrix(slot, input.formation.anchor),\n );\n },\n );\n mesh.instanceMatrix.needsUpdate = true;\n mesh.computeBoundingBox();\n mesh.computeBoundingSphere();\n mesh.frustumCulled = false;\n mesh.visible = false;\n root.add(mesh);\n tiers.set(lod.tier, mesh);\n }\n const restRadius: number = Math.max(\n 0.01,\n ...[chunk.bounds.min.x, chunk.bounds.max.x].flatMap(\n (x: number): number[] =>\n [chunk.bounds.min.y, chunk.bounds.max.y].flatMap(\n (y: number): number[] =>\n [chunk.bounds.min.z, chunk.bounds.max.z].map(\n (z: number): number =>\n Math.hypot(\n x - chunk.centroid.x,\n y - chunk.centroid.y,\n z - chunk.centroid.z,\n ),\n ),\n ),\n ),\n );\n return {\n runtime: chunk,\n center: vector(chunk.centroid).sub(root.position),\n restRadius,\n radius: restRadius,\n exceptionRadius: 0,\n slots,\n tiers,\n selected: null,\n removed: 0,\n };\n },\n );\n const drawableTiers: Set<\"hero\" | \"near\" | \"far\"> = new Set(\n chunks.flatMap((chunk: IChunkObject): (\"hero\" | \"near\" | \"far\")[] => [\n ...chunk.tiers.keys(),\n ]),\n );\n // The cues a unit was built with are the cues it performs, resolved once.\n // Which members are singled out is settled here and never revisited, so a\n // frame that re-read the caller's list would sample cues against a set of\n // exceptions that no longer answers to them: a member named after the build\n // has no instance to write, and one named before it would keep performing\n // whatever the new list happened to say. Reading it twice also left the second\n // `?? []` an arm no input could take, since a unit whose cues are absent has\n // no exception to sample for.\n const slotMotions: readonly IAutoMovieFormationSlotMotion[] =\n input.slotMotions ?? [];\n // Every member a cue singles out, located once. Nothing is stored for the\n // members no cue names, which is what keeps a crowd of a hundred thousand\n // paying for the three exceptions it has and not for its own size.\n const exceptions: ISlotException[] = [];\n for (const slot of new Set(\n slotMotions.flatMap((cue: IAutoMovieFormationSlotMotion): number[] =>\n cue.formation === input.formation.id ? cue.slots : [],\n ),\n )) {\n const chunk: IChunkObject | undefined = chunks.find(\n (candidate: IChunkObject): boolean =>\n slot >= candidate.runtime.start &&\n slot < candidate.runtime.start + candidate.runtime.count,\n );\n const index: number =\n chunk?.slots.findIndex(\n (member: IAutoMovieFormationSlot): boolean => member.slot === slot,\n ) ?? -1;\n if (chunk === undefined || index < 0) continue;\n exceptions.push({ slot, chunk, index, designed: chunk.slots[index]! });\n }\n let spacing: { lateral: number; depth: number } = {\n lateral: 1,\n depth: 1,\n };\n // The arrangement currently written into the instance matrices, so a\n // frame that changes neither spacing nor arrangement writes nothing.\n let reform: IAutoMovieFormationReform | null = null;\n const initialHeroSources: Map<string, IAutoMovieTransform> = new Map(\n [...(input.heroObjects ?? [])].map(\n ([actor, object]: [\n string,\n THREE.Object3D<THREE.Object3DEventMap>,\n ]): readonly [string, IAutoMovieTransform] =>\n [actor, objectTransform(object)] as const,\n ),\n );\n const stats: IAutoMovieFormationViewerStats = {\n visible: { hero: 0, near: 0, far: 0 },\n culled: 0,\n removed: 0,\n heroes: input.formation.heroes.length,\n };\n let disposed: boolean = false;\n let disposalFailure: { error: unknown } | undefined;\n let retirements: (() => void)[] | undefined;\n return {\n object: root,\n stats,\n describeTextureSources: (): ReturnType<\n typeof describeFormationTextureSources\n > =>\n describeFormationTextureSources(\n input.formation.id,\n representations,\n drawableTiers,\n ),\n dispose(): void {\n if (disposed) {\n if (disposalFailure !== undefined) throw disposalFailure.error;\n return;\n }\n disposed = true;\n const ownedTiers: IFormationTierRepresentation[] = [\n ...representations.values(),\n ];\n retirements = [\n (): void => {\n root.removeFromParent();\n },\n ...chunks.flatMap((chunk: IChunkObject): (() => void)[] =>\n [...chunk.tiers.values()].flatMap(\n (mesh: THREE.InstancedMesh): (() => void)[] => [\n (): void => mesh.geometry.dispose(),\n (): void => mesh.dispose(),\n ],\n ),\n ),\n (): void => disposeFormationRepresentations(ownedTiers),\n (): void => {\n root.clear();\n },\n ];\n try {\n reportAutoMovieResourceRetirement(retirements);\n for (const chunk of chunks) {\n chunk.tiers.clear();\n chunk.slots.length = 0;\n }\n representations.clear();\n drawableTiers.clear();\n cycles.length = 0;\n chunks.length = 0;\n exceptions.length = 0;\n initialHeroSources.clear();\n retirements = undefined;\n } catch (error) {\n disposalFailure = { error };\n throw error;\n }\n },\n update(\n camera: THREE.PerspectiveCamera,\n viewportHeight: number,\n time: number | undefined,\n heroSources: ReadonlyMap<string, IAutoMovieTransform> | undefined,\n ): void {\n if (disposed)\n throw new Error(`Formation \"${input.formation.id}\" is disposed.`);\n stats.visible = { hero: 0, near: 0, far: 0 };\n stats.culled = 0;\n stats.removed = 0;\n const sampled: IAutoMovieSampledFormationMotion =\n sampleFormationMotion(\n input.motions ?? [],\n input.formation.id,\n time ?? 0,\n );\n // What the unit has done up to this instant, cut into the intervals its\n // cadence is made of. Every member lands somewhere else in the resulting\n // cycle, because the phase it adds is its own; every tier folds the same\n // intervals against its own figure's strides, because a near stickman and\n // a far one cover ground with the same feet.\n const cadence: IAutoMovieFormationCadenceSegment[] =\n formationCadenceSegments(\n input.motions ?? [],\n input.formation.id,\n time ?? 0,\n );\n for (const cycle of cycles)\n applyFormationCycleCadence(cycle, cadence);\n root.position.set(\n input.formation.anchor.x + sampled.translation.x,\n input.formation.anchor.y + sampled.translation.y,\n input.formation.anchor.z + sampled.translation.z,\n );\n root.quaternion.setFromAxisAngle(\n new THREE.Vector3(0, 1, 0),\n THREE.MathUtils.degToRad(sampled.facingOffsetDeg),\n );\n // Spacing opens and closes an arrangement; a re-form changes which\n // arrangement it is. Both move a member relative to its neighbours, so\n // neither can ride on the group transform above and both rewrite the\n // same instance matrices -- together, so a frame that changes both pays\n // for one pass and cannot apply one against the other's stale reading.\n if (\n sampled.spacingScale.lateral !== spacing.lateral ||\n sampled.spacingScale.depth !== spacing.depth ||\n sampled.reform?.layout !== reform?.layout ||\n sampled.reform?.fromLayout !== reform?.fromLayout ||\n sampled.reform?.progress !== reform?.progress\n ) {\n spacing = { ...sampled.spacingScale };\n reform = sampled.reform;\n for (const chunk of chunks) {\n const bounds: THREE.Box3 = new THREE.Box3();\n const position: THREE.Vector3 = new THREE.Vector3();\n chunk.slots.forEach(\n (slot: IAutoMovieFormationSlot, index: number): void => {\n const matrix: THREE.Matrix4 = slotMatrix(\n reform === null\n ? slot\n : {\n ...slot,\n position: formationSlotPosition(\n input.formation,\n slot.slot,\n reform,\n ),\n },\n input.formation.anchor,\n spacing,\n input.formation.facingDeg,\n );\n if (reform !== null)\n bounds.expandByPoint(\n position.setFromMatrixPosition(matrix),\n );\n for (const mesh of chunk.tiers.values())\n mesh.setMatrixAt(index, matrix);\n },\n );\n if (reform === null) {\n chunk.center.copy(\n formationSpacingOffset(\n chunk.runtime.centroid,\n input.formation.anchor,\n spacing,\n input.formation.facingDeg,\n ),\n );\n chunk.radius =\n chunk.restRadius *\n Math.max(1, spacing.lateral, spacing.depth);\n } else if (bounds.isEmpty() === false) {\n bounds.getCenter(chunk.center);\n chunk.radius = bounds.max.distanceTo(chunk.center);\n }\n for (const mesh of chunk.tiers.values()) {\n mesh.instanceMatrix.needsUpdate = true;\n }\n }\n }\n // The members singled out, written after the unit-wide pass so a spacing\n // rewrite cannot undo them. Only the exceptions are touched, so this costs\n // what the author authored rather than what the crowd holds.\n //\n // The offset is authored in the unit's own frame and is turned by the\n // unit's designed heading alone, because the scene graph above already\n // carries the cue's own turn and its travel. That is the same composition\n // the engine's placement performs in one step for a gate that has no\n // scene graph to carry half of it.\n for (const { chunk } of exceptions) {\n chunk.removed = 0;\n chunk.exceptionRadius = 0;\n }\n for (const exception of exceptions) {\n const state: IAutoMovieFormationSlotState =\n sampleFormationSlotMotion(\n slotMotions,\n input.formation.id,\n exception.slot,\n time ?? 0,\n );\n const offset: IAutoMovieVector3 = rotateFormationLocalOffset(\n state.offset,\n input.formation.facingDeg,\n );\n const position: THREE.Vector3 = formationSpacingOffset(\n reform === null\n ? exception.designed.position\n : formationSlotPosition(\n input.formation,\n exception.slot,\n reform,\n ),\n input.formation.anchor,\n spacing,\n input.formation.facingDeg,\n );\n position.x += offset.x;\n position.y += offset.y;\n position.z += offset.z;\n // A member out of the shot is written at zero scale rather than dropped\n // from the buffer. Restacking an instance buffer would renumber every\n // member after it and cost the crowd's own size every time one member\n // left; a degenerate matrix rasterizes nothing and costs one write.\n const matrix: THREE.Matrix4 = new THREE.Matrix4().compose(\n position,\n new THREE.Quaternion().setFromAxisAngle(\n new THREE.Vector3(0, 1, 0),\n THREE.MathUtils.degToRad(\n exception.designed.facingDeg + state.facingOffsetDeg,\n ),\n ),\n state.present\n ? new THREE.Vector3(1, 1, 1)\n : new THREE.Vector3(0, 0, 0),\n );\n for (const mesh of exception.chunk.tiers.values()) {\n mesh.setMatrixAt(exception.index, matrix);\n mesh.instanceMatrix.needsUpdate = true;\n }\n if (state.present === false) {\n ++exception.chunk.removed;\n ++stats.removed;\n } else\n exception.chunk.exceptionRadius = Math.max(\n exception.chunk.exceptionRadius,\n position.distanceTo(exception.chunk.center),\n );\n }\n root.updateMatrixWorld(true);\n camera.updateMatrixWorld(true);\n camera.updateProjectionMatrix();\n const projection: THREE.Matrix4 =\n new THREE.Matrix4().multiplyMatrices(\n camera.projectionMatrix,\n camera.matrixWorldInverse,\n );\n const frustum: THREE.Frustum =\n new THREE.Frustum().setFromProjectionMatrix(projection);\n const cameraPosition: THREE.Vector3 = new THREE.Vector3();\n const cameraRotation: THREE.Quaternion = new THREE.Quaternion();\n camera.getWorldPosition(cameraPosition);\n camera.getWorldQuaternion(cameraRotation);\n const halfY: number = Math.tan(\n THREE.MathUtils.degToRad(camera.fov) / 2,\n );\n const deliveryCrop: IAutoMovieDeliveryCrop | undefined =\n readAutoMovieDeliveryCrop(camera);\n const effectiveHalfY: number =\n halfY *\n (deliveryCrop === undefined\n ? 1\n : deliveryCrop.bottom - deliveryCrop.top);\n for (const hero of input.formation.heroes) {\n const object: THREE.Object3D<THREE.Object3DEventMap> | undefined =\n input.heroObjects?.get(hero.actor);\n if (object === undefined) continue;\n const source: IAutoMovieTransform = (heroSources?.get(hero.actor) ??\n initialHeroSources.get(hero.actor))!;\n const transformed: IAutoMovieTransform =\n composeFormationHeroTransform(\n hero.transform,\n source,\n input.formation.anchor,\n sampled,\n input.formation.facingDeg,\n );\n object.position.copy(vector(transformed.translation));\n object.quaternion.set(\n transformed.rotation.x,\n transformed.rotation.y,\n transformed.rotation.z,\n transformed.rotation.w,\n );\n object.scale.set(\n transformed.scale.x,\n transformed.scale.y,\n transformed.scale.z,\n );\n object.updateMatrixWorld(true);\n const visualObject: THREE.Object3D<THREE.Object3DEventMap> =\n input.heroVisualObjects?.get(hero.actor) ?? object;\n const worldPosition: THREE.Vector3 = new THREE.Vector3();\n visualObject.getWorldPosition(worldPosition);\n const worldRadius: number =\n selectionRadius *\n Math.max(\n Math.abs(transformed.scale.x),\n Math.abs(transformed.scale.y),\n Math.abs(transformed.scale.z),\n );\n object.visible = intersectsPerspectiveFrustumSphere({\n camera: {\n position: {\n x: cameraPosition.x,\n y: cameraPosition.y,\n z: cameraPosition.z,\n },\n rotation: {\n x: cameraRotation.x,\n y: cameraRotation.y,\n z: cameraRotation.z,\n w: cameraRotation.w,\n },\n },\n center: {\n x: worldPosition.x,\n y: worldPosition.y,\n z: worldPosition.z,\n },\n radius: worldRadius,\n near: camera.near,\n far: camera.far,\n halfY,\n aspect: camera.aspect,\n crop: deliveryCrop,\n });\n if (object.visible) ++stats.visible.hero;\n }\n for (const chunk of chunks) {\n const center: THREE.Vector3 = root.localToWorld(\n chunk.center.clone(),\n );\n const sphere: THREE.Sphere = new THREE.Sphere(\n center,\n Math.max(chunk.radius, chunk.exceptionRadius) + selectionRadius,\n );\n if (frustum.intersectsSphere(sphere) === false) {\n for (const mesh of chunk.tiers.values()) mesh.visible = false;\n stats.culled += chunk.runtime.anonymousCount - chunk.removed;\n continue;\n }\n const distance: number = Math.max(\n 0.001,\n cameraPosition.distanceTo(center),\n );\n const cameraDepth: number = Math.max(\n 0.001,\n -center.clone().applyMatrix4(camera.matrixWorldInverse).z,\n );\n const projectedPixels: number =\n (selectionRadius * viewportHeight) /\n (effectiveHalfY * cameraDepth);\n const selected: IAutoMovieCompiledFormationLod = selectFormationLod(\n {\n lod: input.formation.lod,\n distance,\n projectedPixels,\n previous: chunk.selected,\n },\n ).lod;\n chunk.selected = selected.tier;\n for (const [tier, mesh] of chunk.tiers)\n mesh.visible = tier === selected.tier;\n stats.visible[selected.tier] +=\n chunk.runtime.anonymousCount - chunk.removed;\n }\n },\n };\n },\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmEA,MAAa,2BAGX,UAC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;KACF;KACA,MAAM,WAAmB,KAAK,IAC5B,MACA,eAAe,WAAW,MAAM,CAClC;KACA,MAAM,cAAsB,KAAK,IAC/B,MACA,CAAC,OAAO,MAAM,CAAC,CAAC,aAAa,OAAO,kBAAkB,CAAC,CAAC,CAC1D;KACA,MAAM,kBACH,kBAAkB,kBAClB,iBAAiB;KACpB,MAAM,WAA2C,mBAC/C;MACE,KAAK,MAAM,UAAU;MACrB;MACA;MACA,UAAU,MAAM;KAClB,CACF,CAAC,CAAC;KACF,MAAM,WAAW,SAAS;KAC1B,KAAK,MAAM,CAAC,MAAM,SAAS,MAAM,OAC/B,KAAK,UAAU,SAAS,SAAS;KACnC,MAAM,QAAQ,SAAS,SACrB,MAAM,QAAQ,iBAAiB,MAAM;IACzC;GACF;EACF;CACF,CACF;AACF"}
@@ -1,4 +1,4 @@
1
- import type { IAutoMovieScene } from "@automovie/interface";
1
+ import type { IAutoMovieRenderSoftPropFrame, IAutoMovieScene } from "@automovie/interface";
2
2
  import * as THREE from "three";
3
3
  import type { IAutoMovieModelObject } from "./IAutoMovieModelObject.js";
4
4
  import type { IAutoMovieSceneObject } from "./IAutoMovieSceneObject.js";
@@ -27,18 +27,21 @@ import type { IAutoMovieSceneObject } from "./IAutoMovieSceneObject.js";
27
27
  * {@link buildSpaceObject}), so guide passes describe a world instead of actors
28
28
  * floating in a void. Their ordinary material writes no beauty colour or depth,
29
29
  * because a semantic support declaration is not evidence that physical floor
30
- * geometry exists. The group is added LAST, after the nodes and lights, for
31
- * that reason, and so the whole ground reads as one mask colour rather than one
32
- * per surface.
30
+ * geometry exists. The group follows the nodes and lights so the whole
31
+ * ground reads as one mask colour rather than one per surface.
32
+ *
33
+ * An optional frame of soft props follows the designed scene objects.
34
+ * Its returned handle updates plain surfaces at later times and releases
35
+ * the meshes. Pass an empty frame to opt in before the first prop appears.
33
36
  *
34
37
  * The cited refusal contribution covers the supplied shadow profile and unresolved node model. Complete hierarchy, material and numeric admission, lowering receipts and structured safe-retry policy remain with their corresponding owners.
35
38
  *
36
39
  * @evidence contracts/development/implementation.md#principled-implementation Preserves authored node order under placement groups, admits the shadow profile, builds native lights/cameras, optional semantic support, fog and environment; each resolver call must supply a distinct mutable model object and valid admitted TRS. Static pose/props/compiled populations are not lowered here and current production pages assemble their own graph rather than calling this producer.
37
- * @evidence contracts/development/implementation.md#clear-and-simple-structure Owns the scene graph join and camera/light lookup result while model loading/building, articulation, temporal sampling and rendering remain external; leading node-child order exposes the existing positional semantic-mask dependency.
40
+ * @evidence contracts/development/implementation.md#clear-and-simple-structure Owns the scene graph join and camera/light lookup while model loading, articulation, temporal sampling and rendering remain external. The soft layer uses its own owner and follows the designed children.
38
41
  * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Refuses unresolved models rather than dropping an authored child and shifting mask indices; no fixture nodes/lights are invented, but complete admission and partial-construction rollback are not supplied by this scene wrapper.
39
42
  * @evidence contracts/development/common.md#meaningful-documentation States resolver uniqueness, authored node order, placement/root composition, semantic-ground beauty exclusion, static-pose caller duty and explicit refusal/admission ownership boundary.
40
43
  * @evidence contracts/development/implementation.md#efficient-algorithms Builds N placement groups, L lights and C cameras with id maps plus support tessellation and shadow participation traversal; dominant memory follows actual model/support resources returned by producers, and no anonymous member runtime is created here.
41
44
  * @evidence contracts/development/implementation.md#reuse-equivalent-work Reuses canonical transform/light/fog/environment/space adapters and maps lights by semantic id; model object reuse across placements is invalid because native parenting is exclusive, and scene-level effectful construction is not cached.
42
- * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Transfers new scene/group/light/camera/support references and adopts resolver model objects into the result; environment texture handoff has its separate exclusive owner. No universal scene disposer or late-refusal rollback is returned, so callers must own both retirement and partially assembled graph recovery rather than assuming this wrapper frees them.
45
+ * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Transfers new scene, group, light, camera and support references and adopts resolver model objects. Failed soft-prop mounting retires that layer. The caller otherwise owns retirement and partial graph recovery; environment texture handoff has a separate owner.
43
46
  */
44
- export declare const buildScene: (scene: IAutoMovieScene, getModelObject: (modelId: string) => IAutoMovieModelObject | undefined, environmentTexture?: THREE.Texture) => IAutoMovieSceneObject;
47
+ export declare const buildScene: (scene: IAutoMovieScene, getModelObject: (modelId: string) => IAutoMovieModelObject | undefined, environmentTexture?: THREE.Texture, softFrame?: readonly IAutoMovieRenderSoftPropFrame[]) => IAutoMovieSceneObject;
@@ -41,7 +41,9 @@ const applySceneEnvironment_js_1 = require("./applySceneEnvironment.js");
41
41
  const applySceneFog_js_1 = require("./applySceneFog.js");
42
42
  const applyTransform_js_1 = require("./applyTransform.js");
43
43
  const buildLight_js_1 = require("./buildLight.js");
44
+ const buildSceneSoftProps_js_1 = require("./buildSceneSoftProps.js");
44
45
  const buildSpace_js_1 = require("./buildSpace.js");
46
+ const restoreAutoMovieRenderModeState_js_1 = require("./restoreAutoMovieRenderModeState.js");
45
47
  /**
46
48
  * Build a `three.js` scene from an {@link IAutoMovieScene}.
47
49
  *
@@ -67,21 +69,24 @@ const buildSpace_js_1 = require("./buildSpace.js");
67
69
  * {@link buildSpaceObject}), so guide passes describe a world instead of actors
68
70
  * floating in a void. Their ordinary material writes no beauty colour or depth,
69
71
  * because a semantic support declaration is not evidence that physical floor
70
- * geometry exists. The group is added LAST, after the nodes and lights, for
71
- * that reason, and so the whole ground reads as one mask colour rather than one
72
- * per surface.
72
+ * geometry exists. The group follows the nodes and lights so the whole
73
+ * ground reads as one mask colour rather than one per surface.
74
+ *
75
+ * An optional frame of soft props follows the designed scene objects.
76
+ * Its returned handle updates plain surfaces at later times and releases
77
+ * the meshes. Pass an empty frame to opt in before the first prop appears.
73
78
  *
74
79
  * The cited refusal contribution covers the supplied shadow profile and unresolved node model. Complete hierarchy, material and numeric admission, lowering receipts and structured safe-retry policy remain with their corresponding owners.
75
80
  *
76
81
  * @evidence contracts/development/implementation.md#principled-implementation Preserves authored node order under placement groups, admits the shadow profile, builds native lights/cameras, optional semantic support, fog and environment; each resolver call must supply a distinct mutable model object and valid admitted TRS. Static pose/props/compiled populations are not lowered here and current production pages assemble their own graph rather than calling this producer.
77
- * @evidence contracts/development/implementation.md#clear-and-simple-structure Owns the scene graph join and camera/light lookup result while model loading/building, articulation, temporal sampling and rendering remain external; leading node-child order exposes the existing positional semantic-mask dependency.
82
+ * @evidence contracts/development/implementation.md#clear-and-simple-structure Owns the scene graph join and camera/light lookup while model loading, articulation, temporal sampling and rendering remain external. The soft layer uses its own owner and follows the designed children.
78
83
  * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Refuses unresolved models rather than dropping an authored child and shifting mask indices; no fixture nodes/lights are invented, but complete admission and partial-construction rollback are not supplied by this scene wrapper.
79
84
  * @evidence contracts/development/common.md#meaningful-documentation States resolver uniqueness, authored node order, placement/root composition, semantic-ground beauty exclusion, static-pose caller duty and explicit refusal/admission ownership boundary.
80
85
  * @evidence contracts/development/implementation.md#efficient-algorithms Builds N placement groups, L lights and C cameras with id maps plus support tessellation and shadow participation traversal; dominant memory follows actual model/support resources returned by producers, and no anonymous member runtime is created here.
81
86
  * @evidence contracts/development/implementation.md#reuse-equivalent-work Reuses canonical transform/light/fog/environment/space adapters and maps lights by semantic id; model object reuse across placements is invalid because native parenting is exclusive, and scene-level effectful construction is not cached.
82
- * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Transfers new scene/group/light/camera/support references and adopts resolver model objects into the result; environment texture handoff has its separate exclusive owner. No universal scene disposer or late-refusal rollback is returned, so callers must own both retirement and partially assembled graph recovery rather than assuming this wrapper frees them.
87
+ * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Transfers new scene, group, light, camera and support references and adopts resolver model objects. Failed soft-prop mounting retires that layer. The caller otherwise owns retirement and partial graph recovery; environment texture handoff has a separate owner.
83
88
  */
84
- const buildScene = (scene, getModelObject, environmentTexture) => {
89
+ const buildScene = (scene, getModelObject, environmentTexture, softFrame) => {
85
90
  const shadowProfile = (0, engine_1.resolveAutoMovieShadowProfile)({
86
91
  lights: scene.lights,
87
92
  shadows: scene.environment?.shadows,
@@ -128,7 +133,16 @@ const buildScene = (scene, getModelObject, environmentTexture) => {
128
133
  (0, applySceneEnvironment_js_1.applySceneEnvironment)(root, scene.environment, environmentTexture);
129
134
  (0, applyAutoMovieShadowParticipation_js_1.applyAutoMovieShadowParticipation)(root);
130
135
  const cameras = scene.cameras.map(buildCamera);
131
- return { scene: root, cameras, lights };
136
+ if (softFrame === undefined)
137
+ return { scene: root, cameras, lights };
138
+ const softProps = (0, buildSceneSoftProps_js_1.buildSceneSoftProps)(root);
139
+ try {
140
+ softProps.update(softFrame);
141
+ }
142
+ catch (error) {
143
+ (0, restoreAutoMovieRenderModeState_js_1.restoreAutoMovieRenderModeState)([softProps.dispose], { error });
144
+ }
145
+ return { scene: root, cameras, lights, softProps };
132
146
  };
133
147
  exports.buildScene = buildScene;
134
148
  const buildCamera = (cam) => {
@@ -1 +1 @@
1
- {"version":3,"file":"buildScene.js","sourceRoot":"","sources":["../../src/scene/buildScene.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAkE;AAMlE,MAAY,KAAK,kCAAc;AAI/B,iGAA2F;AAC3F,yEAAmE;AACnE,yDAAmD;AACnD,2DAAqD;AACrD,mDAA6C;AAC7C,mDAAmD;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACI,MAAM,UAAU,GAIM,CAC3B,KAAsB,EACtB,cAAsE,EACtE,kBAAkC,EACX,EAAE;IACzB,MAAM,aAAa,GACjB,IAAA,sCAA6B,EAAC;QAC5B,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,OAAO,EAAE,KAAK,CAAC,WAAW,EAAE,OAAO;KACpC,CAAC,CAAC;IACL,IAAI,CAAC,aAAa,CAAC,OAAO;QACxB,MAAM,IAAI,KAAK,CACb,8BAA8B,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,UAAU,CAAC,CAC1E,CAAC;IACJ,MAAM,IAAI,GAAwC,I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