@volter/editor-threejs 0.5.210 → 0.5.212

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 (133) hide show
  1. package/NOTICE +7 -2
  2. package/README.md +8 -13
  3. package/contributions/animation-mixers.service.ts +2 -4
  4. package/contributions/animation-timeline.utility.tsx +1 -2
  5. package/contributions/three.page.ts +50 -0
  6. package/dist-node/serving.mjs +84 -3
  7. package/dist-node/shared-three.mjs +145 -0
  8. package/package.json +296 -16
  9. package/serving/animation-stamp.ts +1 -1
  10. package/serving/index.ts +22 -5
  11. package/serving/model-import-conversion.ts +6 -3
  12. package/serving/shared-three.ts +176 -0
  13. package/src/adapter/constraint.ts +1 -18
  14. package/src/adapter/object3d-authoring-subject.ts +1 -12
  15. package/src/adapter/reflection-probe.ts +1 -9
  16. package/src/adapter/three-contract.ts +6 -60
  17. package/src/animation/live-mixers.ts +0 -4
  18. package/src/api.ts +7 -0
  19. package/src/asset-loaders.ts +2 -178
  20. package/src/capture/photograph-sampling.ts +333 -0
  21. package/src/capture/scene.ts +1 -1
  22. package/src/ecs/object-marks.ts +6 -14
  23. package/src/ecs/user-data.ts +3 -138
  24. package/src/kit/animation/three-clips-subject.ts +19 -42
  25. package/src/kit/asset-compare-core.ts +161 -0
  26. package/src/kit/asset-compare.ts +8 -27
  27. package/src/kit/asset-preview-command.ts +14 -19
  28. package/src/kit/asset-preview-framing.ts +8 -67
  29. package/src/kit/asset-preview.ts +109 -342
  30. package/src/kit/asset-workflow/model-inspection.ts +11 -154
  31. package/src/kit/asset-workflow/preview-resource-lifetime.ts +25 -0
  32. package/src/kit/authoring/component-instance-root.ts +3 -39
  33. package/src/kit/authoring/live-object-transform.ts +1 -30
  34. package/src/kit/authoring/object3d-document-session-registry.ts +7 -15
  35. package/src/kit/authoring/object3d-document-session.ts +471 -208
  36. package/src/kit/authoring/shell-viewport-policy.ts +18 -24
  37. package/src/kit/authoring/source-object3d-authoring-adapter.ts +6 -48
  38. package/src/kit/authoring/three-projection-core.ts +11 -40
  39. package/src/kit/authoring/viewport-pick-context.ts +5 -12
  40. package/src/kit/authoring/viewport-raycast.ts +15 -93
  41. package/src/kit/authoring/world-hidden-viewport.ts +8 -61
  42. package/src/kit/capture-camera-pose.ts +68 -0
  43. package/src/kit/collaboration-presence.ts +41 -0
  44. package/src/kit/components/CameraInfo.tsx +4 -6
  45. package/src/kit/components/InspectorObjectPreview.tsx +3 -30
  46. package/src/kit/components/Object3DDocumentToolbar.css +75 -0
  47. package/src/kit/components/Object3DDocumentToolbar.tsx +18 -84
  48. package/src/kit/components/Object3DDocumentViewport.tsx +5 -8
  49. package/src/kit/components/StageHost.css +40 -0
  50. package/src/kit/components/StageHost.tsx +181 -404
  51. package/src/kit/components/StageOverlays.tsx +1 -2
  52. package/src/kit/components/StatsOverlay.tsx +5 -17
  53. package/src/kit/components/ViewportFurniture.tsx +27 -154
  54. package/src/kit/components/ViewportOverlay.tsx +13 -17
  55. package/src/kit/components/ViewportOverlaysMenu.tsx +177 -0
  56. package/src/kit/components/ViewportShadingMenu.tsx +2 -42
  57. package/src/kit/components/ViewportViewMenu.tsx +7 -18
  58. package/src/kit/components/asset-viewers/EntityModelDocument.tsx +4 -13
  59. package/src/kit/components/asset-viewers/EnvironmentAssetDocument.tsx +5 -5
  60. package/src/kit/components/asset-viewers/LiveModuleDocument.tsx +24 -102
  61. package/src/kit/components/asset-viewers/LutAssetDocument.tsx +6 -6
  62. package/src/kit/components/asset-viewers/Object3DPreview.tsx +10 -45
  63. package/src/kit/components/asset-viewers/QuarksAssetDocument.tsx +2 -2
  64. package/src/kit/components/asset-viewers/ShaderAssetDocument.tsx +11 -10
  65. package/src/kit/components/asset-viewers/shader-source.ts +144 -0
  66. package/src/kit/components/asset-viewers/three-asset-viewers.tsx +2 -14
  67. package/src/kit/components/object3d-contribution-surfaces.tsx +1 -1
  68. package/src/kit/components/stage-keyboard.tsx +6 -12
  69. package/src/kit/components/stage-overlay-set.tsx +11 -20
  70. package/src/kit/components/stage-presence-markers.ts +9 -32
  71. package/src/kit/components/stage-transform-chrome.ts +4 -4
  72. package/src/kit/components/stage-transform-tools.tsx +7 -14
  73. package/src/kit/components/standard-viewport-dressing.ts +47 -167
  74. package/src/kit/components/world-root-binding.ts +2 -7
  75. package/src/kit/constraint-helper.ts +1 -1
  76. package/src/kit/document-renderer-session.ts +114 -0
  77. package/src/kit/editor-presentation-activity.ts +58 -0
  78. package/src/kit/editor-shell-store.ts +31 -403
  79. package/src/kit/editor-viewport.ts +476 -1762
  80. package/src/kit/entity-lod.ts +3 -16
  81. package/src/kit/entity-object.ts +1 -39
  82. package/src/kit/hierarchy-mark-reader.ts +13 -30
  83. package/src/kit/instanced-presentation.ts +1 -47
  84. package/src/kit/live-gesture-lock.ts +35 -0
  85. package/src/kit/live-module-source.ts +12 -52
  86. package/src/kit/model-thumbnail.ts +7 -35
  87. package/src/kit/play-camera-flight.ts +7 -16
  88. package/src/kit/projection/three.ts +13 -366
  89. package/src/kit/retained-document-states.ts +91 -0
  90. package/src/kit/scene-document-viewport.ts +3 -3
  91. package/src/kit/scene-framing.ts +11 -152
  92. package/src/kit/scene-view-fog.ts +2 -47
  93. package/src/kit/spatial-handle-visuals.ts +19 -28
  94. package/src/kit/stories/three-story-model.ts +5 -33
  95. package/src/kit/three-canvas-render.ts +3 -4
  96. package/src/kit/three-hierarchy-row-media.ts +3 -11
  97. package/src/kit/three-inspection-media.ts +6 -6
  98. package/src/kit/three-integration.ts +18 -18
  99. package/src/kit/three-state.ts +2 -19
  100. package/src/kit/three-viewport/camera-fit.ts +2 -6
  101. package/src/kit/three-viewport/selection-brackets.ts +5 -20
  102. package/src/kit/three-viewport/selection-outline.ts +4 -56
  103. package/src/kit/three-viewport/skeleton-helper.ts +1 -32
  104. package/src/kit/three-viewport/source-color.ts +1 -33
  105. package/src/kit/three-viewport/studio-environment.ts +4 -55
  106. package/src/kit/three-viewport-presentation.ts +23 -0
  107. package/src/kit/transport-strip.tsx +147 -0
  108. package/src/kit/viewport-actions.ts +8 -50
  109. package/src/kit/viewport-authoring-policy.ts +5 -52
  110. package/src/kit/viewport-commands.ts +28 -57
  111. package/src/kit/viewport-hotkeys.ts +29 -31
  112. package/src/kit/viewport-status-facet.ts +4 -5
  113. package/src/kit/viewport-surface-status.tsx +44 -0
  114. package/src/loader.ts +8 -71
  115. package/src/object3d-contributions.ts +18 -34
  116. package/src/viewport/clip-planes.ts +4 -32
  117. package/src/viewport/content-bounds.ts +13 -142
  118. package/src/viewport/editor-layers.ts +4 -26
  119. package/src/viewport/environment.ts +1 -1
  120. package/src/viewport/preview-renderer.ts +7 -45
  121. package/src/viewport/renderer-ownership.ts +14 -62
  122. package/src/viewport-api.ts +14 -33
  123. package/src/viewport-door.ts +16 -86
  124. package/contributions/three-integration.service.ts +0 -13
  125. package/src/adapter/hierarchy-marks.ts +0 -156
  126. package/src/adapter/ingest/scene-capture.ts +0 -843
  127. package/src/adapter/ingest/structural-ids.ts +0 -139
  128. package/src/adapter/ingest/visible-capture-window.ts +0 -302
  129. package/src/adapter/renderer-config.ts +0 -115
  130. package/src/asset-parse-error.ts +0 -29
  131. package/src/host-hierarchy-objects.ts +0 -31
  132. package/src/kit/authoring/design-time-settle.ts +0 -343
  133. package/src/kit/camera-authoring.ts +0 -175
@@ -1,27 +1,8 @@
1
1
  /**
2
- * The asset-preview capture engine's FRAMING MATH, extracted from
3
- * `asset-preview.ts` so it can be exercised without a WebGL context.
4
- *
5
- * Everything here is pure: it takes points, a camera basis and an output
6
- * aspect, and returns frustum half-extents or a configured
7
- * `THREE.OrthographicCamera`. Nothing in this module traverses a scene,
8
- * renders, or allocates GPU resources — the traversal that FEEDS it
9
- * (`forEachRenderableVertex`) stays in `asset-preview.ts`, because that is
10
- * scene-graph knowledge rather than geometry.
11
- *
12
- * Two facts drove the extraction:
13
- *
14
- * 1. A turntable shot must be framed from the subject's ACTUAL projected
15
- * extent along that shot's own camera axes. The engine used to derive
16
- * every yaw's frame from ONE world-axis-aligned bounding box, which is a
17
- * proxy: it is conservative for a compact subject and wasteful for a
18
- * long one held in a bent pose, and it centres every yaw on the AABB's
19
- * centre rather than on what that yaw actually sees.
20
- * 2. A `bone-zoom` crop needs the same freedom of angle the turntable has.
21
- * Its basis used to be hardcoded to +Z, so a crop anchored on the tail of
22
- * an 8 m quadruped photographed the hind legs standing in front of it.
23
- *
24
- * @see {@link turntableViewBasis} for the yaw convention both shot kinds share.
2
+ * Pure asset-preview framing math: take projected points, a camera basis and output aspect, and
3
+ * return frustum extents or an orthographic camera. Each shot measures the subject in its own view
4
+ * basis, including angled bone crops. Scene traversal and GPU rendering belong to asset-preview.ts.
5
+ * See turntableViewBasis for the shared yaw convention.
25
6
  */
26
7
  import * as THREE from 'three';
27
8
 
@@ -43,16 +24,7 @@ export interface OrthographicViewBasis {
43
24
  up: THREE.Vector3;
44
25
  }
45
26
 
46
- /**
47
- * The turntable yaw convention, shared by `turntable` shots and — since the
48
- * `bone-zoom` yaw was added — by bone-anchored crops too, so a definition
49
- * reads one angle convention rather than two.
50
- *
51
- * `yaw = 0` puts the camera on +Z looking at the subject's front (the
52
- * direction `faceFrontSubject` normalises the model's own forward to face),
53
- * and yaw increases toward +X: `PI` is the back, `-PI/2` and `+PI/2` the two
54
- * sides — the angles shot sets already label 'left' and 'right'.
55
- */
27
+ /** Shared turntable and bone-crop yaw convention: zero faces +Z and increasing yaw moves toward +X; PI is the back and ±PI/2 are the sides. */
56
28
  export function turntableViewBasis(yaw: number): OrthographicViewBasis {
57
29
  const direction = new THREE.Vector3(Math.sin(yaw), 0, Math.cos(yaw));
58
30
  const worldUp = new THREE.Vector3(0, 1, 0);
@@ -152,9 +124,8 @@ export function fitOrthographicFrame(
152
124
  halfRight: number,
153
125
  halfUp: number,
154
126
  aspect: number,
155
- padding: number = ASSET_PREVIEW_PADDING,
156
127
  ): OrthographicFrame {
157
- const halfHeight = Math.max(halfUp, halfRight / aspect, MIN_HALF_EXTENT) * padding;
128
+ const halfHeight = Math.max(halfUp, halfRight / aspect, MIN_HALF_EXTENT) * ASSET_PREVIEW_PADDING;
158
129
  return { halfHeight, halfWidth: halfHeight * aspect };
159
130
  }
160
131
 
@@ -162,7 +133,6 @@ export function fitOrthographicFrame(
162
133
  export function fitProjectedSpanFrame(
163
134
  span: ProjectedSpan,
164
135
  aspect: number,
165
- padding: number = ASSET_PREVIEW_PADDING,
166
136
  ): OrthographicFrame {
167
137
  if (isProjectedSpanEmpty(span)) {
168
138
  throw new Error('Asset preview cannot frame an empty projected span.');
@@ -171,29 +141,10 @@ export function fitProjectedSpanFrame(
171
141
  (span.maxRight - span.minRight) / 2,
172
142
  (span.maxUp - span.minUp) / 2,
173
143
  aspect,
174
- padding,
175
144
  );
176
145
  }
177
146
 
178
- /**
179
- * The frame every turntable shot of one staged subject shares: the UNION of
180
- * what each yaw needs.
181
- *
182
- * Why the union rather than a per-shot exact fit. A verify shot set is read
183
- * as a SET — the reviewer compares the same junction across yaws (and, on a
184
- * contact sheet, side by side). A per-shot fit silently rescales the subject
185
- * between frames, so a wing that looks thicker at yaw 0 than at yaw PI/2
186
- * would be a framing artefact rather than geometry, which is exactly the
187
- * kind of false signal a verify render exists to eliminate. The union keeps
188
- * ONE scale for every turntable shot of a staged subject while each shot is
189
- * still CENTRED on its own projected span — so nothing clips and nothing
190
- * rescales.
191
- *
192
- * The union is per staged subject (the rest scene, and each named pose's
193
- * disposable snapshot) rather than across poses: poses are separately
194
- * staged already, and a single extreme pose must not shrink every other
195
- * frame in the set.
196
- */
147
+ /** Use the union of all yaw projections for one staged subject’s scale while centring each shot on its own span. Stage poses independently so one extreme pose does not shrink other subjects. */
197
148
  export function unionOrthographicFrames(frames: readonly OrthographicFrame[]): OrthographicFrame {
198
149
  if (frames.length === 0) {
199
150
  throw new Error('Asset preview cannot union an empty set of frames.');
@@ -207,17 +158,7 @@ export function unionOrthographicFrames(frames: readonly OrthographicFrame[]): O
207
158
  return { halfWidth, halfHeight };
208
159
  }
209
160
 
210
- /**
211
- * The frame a bone-anchored crop needs: a margin proportional to the WHOLE
212
- * model's own bounding radius (never a fixed reference-human height, so a
213
- * goblin's crop stays goblin-scaled), widened until it actually contains
214
- * every anchor.
215
- *
216
- * Offsets are measured along the SHOT's basis, so a crop taken from the side
217
- * frames the anchors it names from the side. At the default yaw the basis is
218
- * (+X, +Y, +Z) and this reduces exactly to the world-axis arithmetic it
219
- * replaced.
220
- */
161
+ /** Fit bone crops with a margin proportional to the whole model’s bounding radius. Measure offsets in the shot’s own basis and widen until every anchor fits. */
221
162
  export function fitBoneZoomFrame(
222
163
  anchors: readonly THREE.Vector3[],
223
164
  center: THREE.Vector3,