@liveroom-tech/react-immersive 1.0.3 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -25,7 +25,7 @@ import {
25
25
  } from "@liveroom-tech/react-immersive";
26
26
  ```
27
27
 
28
- It also exports types for `ObjectBinding`, `ObjectBindingMaterial`, `ObjectActionEvent`, `SceneConfig`, `AnimationControls`, and related shapes used throughout this document.
28
+ It also exports types for `ObjectBinding`, `ObjectBindingMaterial`, `ObjectActionEvent`, `SceneConfig`, `AnimationControls`, `CinematicConfig` / `CinematicWaypoint`, and related shapes used throughout this document.
29
29
 
30
30
  `ModelViewer` provides:
31
31
 
@@ -42,6 +42,8 @@ It also exports types for `ObjectBinding`, `ObjectBindingMaterial`, `ObjectActio
42
42
  - optional hiding of either built-in panel through `showObjectBindingDataPanel` and `showSceneObjectsPanel`
43
43
  - optional model export button through `showDownloadButton` and `downloadFilename`, plus independent `showResetButton` / `showDownloadButtons` toggles for the rest of that action bar
44
44
  - click-to-measure distance tool and a bounding-box dimensions overlay through `showMeasureTools` and `measurementUnit`
45
+ - an exploded-view slider that slides each bound part outward from the model center to reveal interior/assembly structure through `showExplodeControls`
46
+ - a cinematic auto-camera that glides the camera along authored waypoints (or a zero-config showcase orbit), like a film, through `cinematic` — with a play/pause control that yields the moment you touch the camera
45
47
  - a guided-tour control cluster (Previous/Stop/Next) for stepping through annotations, toggleable via `showAnnotationNavigation`
46
48
  - a `sceneConfig` prop accepting the same scene-wide config (lighting, environment, background, post-processing, animations, annotations) authored by `BindingBuilder`'s Scene tab
47
49
  - render-loop and perf tuning through `renderMode`, `maxDpr`, `performanceProfile`, and compressed-asset decoder options (`dracoDecoderPath`, `ktx2TranscoderPath`, `meshopt`)
@@ -71,7 +73,8 @@ It also exports types for `ObjectBinding`, `ObjectBindingMaterial`, `ObjectActio
71
73
  - editable binding fields for identity, basics, style, actions, metrics, metadata, and saved camera state
72
74
  - a one-click material preset gallery (wood, metal, chrome, glass, plastic, fabric, ceramic, concrete, etc.)
73
75
  - undo/redo for both the Object tab's bindings and the Scene tab's config, independently, with `Cmd/Ctrl+Z` / `Cmd/Ctrl+Shift+Z` shortcuts
74
- - a Scene tab for the same `sceneConfig` shape `ModelViewer` accepts (lighting, environment, background, post-processing, animations, annotations)
76
+ - a Scene tab for the same `sceneConfig` shape `ModelViewer` accepts (lighting, environment, background, post-processing, animations, annotations, and cinematic camera paths)
77
+ - a Cinematic sub-tab for authoring a camera path visually — frame the model, capture the current view as a waypoint, reorder/preview/delete waypoints, and toggle loop/auto-play; stored on `sceneConfig.cinematic` and replayed by `ModelViewer`'s `cinematic` prop
75
78
  - import a previously exported `objectBindings.json` or `sceneConfig.json` and merge it back onto the current model/config
76
79
  - live preview using `ModelViewer`
77
80
  - export as JSON or TypeScript — bundled into a `.zip` with a `materials/` folder automatically when any texture field was filled by file upload, otherwise a plain file
@@ -694,6 +697,8 @@ type Props = {
694
697
  ktx2TranscoderPath?: string | false;
695
698
  meshopt?: boolean;
696
699
  showMeasureTools?: boolean;
700
+ showExplodeControls?: boolean;
701
+ cinematic?: boolean | CinematicConfig;
697
702
  measurementUnit?: string;
698
703
  enableXR?: boolean;
699
704
  usdzUrl?: string;
@@ -1390,6 +1395,66 @@ Default:
1390
1395
  "m";
1391
1396
  ```
1392
1397
 
1398
+ ### `showExplodeControls`
1399
+
1400
+ Optional boolean that shows an exploded-view slider over the canvas. It slides each bound part outward from the model center to reveal interior/assembly structure, then back to reassemble. Best suited to static product/CAD models — the offset writes node positions each frame, so it conflicts with a playing skeletal animation.
1401
+
1402
+ Default:
1403
+
1404
+ ```ts
1405
+ false;
1406
+ ```
1407
+
1408
+ ### `cinematic`
1409
+
1410
+ Optional cinematic auto-camera. The camera glides along a path on its own, like a film — ideal for showing off a gallery, apartment, or product with no user interaction. Renders a play/pause button over the canvas; grabbing the camera (or selecting a part) pauses it.
1411
+
1412
+ ```ts
1413
+ cinematic?: boolean | CinematicConfig;
1414
+
1415
+ type CinematicConfig = {
1416
+ waypoints?: CinematicWaypoint[]; // camera keyframes to glide through
1417
+ duration?: number; // seconds for one full pass (auto-scales when omitted)
1418
+ loop?: boolean; // default true
1419
+ autoPlay?: boolean; // start once the model has loaded and framed (default false)
1420
+ };
1421
+
1422
+ type CinematicWaypoint = {
1423
+ position: [number, number, number];
1424
+ target: [number, number, number]; // world-space look-at point
1425
+ };
1426
+ ```
1427
+
1428
+ - Boolean `true` (or an object with fewer than two waypoints) gives a zero-config **showcase orbit** around the model's bounding sphere.
1429
+ - Two or more `waypoints` author a **walkthrough**: the camera follows a smooth Catmull-Rom spline through them at a constant on-screen speed, looping seamlessly.
1430
+ - Waypoints are easiest to capture visually in `BindingBuilder`'s **Cinematic** tab, which stores them on `sceneConfig.cinematic`.
1431
+
1432
+ A path can also come from `sceneConfig.cinematic`. The `cinematic` prop overrides it: a boolean toggles the feature (`true` keeps any authored waypoints, `false` forces it off), and an object overrides field-by-field — so you can keep the authored waypoints while overriding, say, `autoPlay` or `loop`.
1433
+
1434
+ ```tsx
1435
+ // Zero-config showcase orbit
1436
+ <ModelViewer cinematic ... />
1437
+
1438
+ // Authored walkthrough
1439
+ <ModelViewer
1440
+ cinematic={{
1441
+ waypoints: [
1442
+ { position: [4, 2, 6], target: [0, 1, 0] },
1443
+ { position: [-3, 2, 4], target: [0, 1, 0] },
1444
+ { position: [-5, 2, -2], target: [0, 1, 0] },
1445
+ ],
1446
+ loop: true,
1447
+ autoPlay: true,
1448
+ }}
1449
+ ...
1450
+ />
1451
+
1452
+ // Keep the BindingBuilder-authored path, just autoplay it
1453
+ <ModelViewer sceneConfig={sceneConfig} cinematic={{ autoPlay: true }} ... />
1454
+ ```
1455
+
1456
+ Default: disabled.
1457
+
1393
1458
  ### `enableXR`
1394
1459
 
1395
1460
  Optional boolean that enables XR entry points. On WebXR-capable browsers, the viewer shows a **"View in your space"** (AR) and/or **"Enter VR"** button once `navigator.xr.isSessionSupported(...)` resolves `true` for that mode. On iPhone/iPad, WebXR AR is not available, but if you also pass [`usdzUrl`](#usdzUrl), the viewer shows a **"View in AR"** button that launches Apple Quick Look instead.
package/dist/index.d.mts CHANGED
@@ -291,6 +291,17 @@ type SceneAnnotationMarker = {
291
291
  title: string;
292
292
  description: string;
293
293
  };
294
+ type SceneCinematicWaypoint = {
295
+ position: [number, number, number];
296
+ target: [number, number, number];
297
+ };
298
+ type SceneCinematicConfig = {
299
+ enabled: boolean;
300
+ waypoints: SceneCinematicWaypoint[];
301
+ duration?: number;
302
+ loop: boolean;
303
+ autoPlay: boolean;
304
+ };
294
305
  type SceneConfig = {
295
306
  model: SceneModelConfig;
296
307
  camera: SceneCameraConfig;
@@ -303,6 +314,7 @@ type SceneConfig = {
303
314
  postProcessing: ScenePostProcessingConfig;
304
315
  animations: SceneAnimationConfig;
305
316
  annotations: SceneAnnotationMarker[];
317
+ cinematic?: SceneCinematicConfig;
306
318
  };
307
319
 
308
320
  type CanvasCamera = ComponentProps<typeof Canvas>["camera"];
@@ -332,6 +344,17 @@ declare function Viewer({ children, camera, backgroundColor, shadows, sceneConfi
332
344
 
333
345
  type PerformanceProfile = "auto" | "high" | "low";
334
346
 
347
+ type CinematicWaypoint = {
348
+ position: [number, number, number];
349
+ target: [number, number, number];
350
+ };
351
+ type CinematicConfig = {
352
+ waypoints?: CinematicWaypoint[];
353
+ duration?: number;
354
+ loop?: boolean;
355
+ autoPlay?: boolean;
356
+ };
357
+
335
358
  type MouseControllerPosition = 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right' | 'center' | 'center-bottom' | 'center-top';
336
359
 
337
360
  type ObjectBindingAction = {
@@ -578,12 +601,13 @@ type ModelViewerProps = {
578
601
  meshopt?: boolean;
579
602
  showMeasureTools?: boolean;
580
603
  showExplodeControls?: boolean;
604
+ cinematic?: boolean | CinematicConfig;
581
605
  measurementUnit?: string;
582
606
  enableXR?: boolean;
583
607
  usdzUrl?: string;
584
608
  showAnnotationNavigation?: boolean;
585
609
  };
586
- declare function ModelViewer({ modelUrl, licenseKey, objectBindings, selectedObject, panelHoveredObject, onObjectBindingsChange, onObjectSelect, onObjectHover, onModelLoaded, onLoadError, onAction, onHiddenObjectsChange, onCameraChange, onViewerReady, onTextureUpload, onAnimationsReady, onAnnotationsChange, activeAnnotation: controlledActiveAnnotation, onActiveAnnotationChange, lights, camera, backgroundColor, shadows, showObjectBindingDataPanel, customObjectBindingDataPanel, customSceneObjectsPanel, showSceneObjectsPanel, showDownloadButton, downloadFilename, showResetButton, showDownloadButtons, showLoadingOverlay, showMouseController, mouseControllerPosition, mouseControllerOpacity, moveSensitivity, zoomSensitivity, sceneConfig, disableZoom, zoomOnSelected, highlightOnHover, onAutoFit, refitOnResize, renderMode, maxDpr, performanceProfile, dracoDecoderPath, ktx2TranscoderPath, meshopt, showMeasureTools, showExplodeControls, measurementUnit, enableXR, usdzUrl, showAnnotationNavigation, }: ModelViewerProps): react_jsx_runtime.JSX.Element;
610
+ declare function ModelViewer({ modelUrl, licenseKey, objectBindings, selectedObject, panelHoveredObject, onObjectBindingsChange, onObjectSelect, onObjectHover, onModelLoaded, onLoadError, onAction, onHiddenObjectsChange, onCameraChange, onViewerReady, onTextureUpload, onAnimationsReady, onAnnotationsChange, activeAnnotation: controlledActiveAnnotation, onActiveAnnotationChange, lights, camera, backgroundColor, shadows, showObjectBindingDataPanel, customObjectBindingDataPanel, customSceneObjectsPanel, showSceneObjectsPanel, showDownloadButton, downloadFilename, showResetButton, showDownloadButtons, showLoadingOverlay, showMouseController, mouseControllerPosition, mouseControllerOpacity, moveSensitivity, zoomSensitivity, sceneConfig, disableZoom, zoomOnSelected, highlightOnHover, onAutoFit, refitOnResize, renderMode, maxDpr, performanceProfile, dracoDecoderPath, ktx2TranscoderPath, meshopt, showMeasureTools, showExplodeControls, cinematic, measurementUnit, enableXR, usdzUrl, showAnnotationNavigation, }: ModelViewerProps): react_jsx_runtime.JSX.Element;
587
611
 
588
612
  declare function BindingBuilder({ licenseKey }: {
589
613
  licenseKey: string;
@@ -688,4 +712,4 @@ type ShareableViewerStateProps = {
688
712
  };
689
713
  declare function useShareableViewerState({ cameraState, setCameraState, objectBindings, onObjectBindingsChange, selectedObjectBinding, setSelectedObjectBinding, paramKey, debounceMs, autoSync, }: UseShareableViewerStateOptions): ShareableViewerStateProps;
690
714
 
691
- export { type AnimationClipInfo, type AnimationControls, type AnimationLoopMode, type AnimationPlaybackState, BindingBuilder, type CaptureImageOptions, type CustomObjectBindingDataPanelProps, type CustomSceneObjectsPanelProps, type HiddenObjectsState, type HomeCameraState, MATERIAL_BLENDING_MODES, MATERIAL_SIDES, ModelViewer, type ModelViewerProps, type ObjectActionEvent, type ObjectBinding, type ObjectBindingAction, type ObjectBindingMaterial, type ObjectBindingMaterialBlendingMode, type ObjectBindingMaterialSide, type ObjectBindingTextureSlot, type ObjectVisibilityProps, type SceneAnimationClipConfig, type SceneAnimationConfig, type SceneConfig, SimpleModelViewer, type SimpleModelViewerProps, type ViewerActionsOptions, type ViewerActionsProps, type ViewerAnimationsProps, type ViewerCameraProps, type ViewerCameraState, type ViewerModelBounds, type ViewerModelProps, type ViewerReadyState, type ViewerSelectionProps, useObjectBinding, useObjectBindingIds, useObjectVisibility, useShareableViewerState, useViewerActions, useViewerAnimations, useViewerCamera, useViewerHover, useViewerModel, useViewerSelection };
715
+ export { type AnimationClipInfo, type AnimationControls, type AnimationLoopMode, type AnimationPlaybackState, BindingBuilder, type CaptureImageOptions, type CinematicConfig, type CinematicWaypoint, type CustomObjectBindingDataPanelProps, type CustomSceneObjectsPanelProps, type HiddenObjectsState, type HomeCameraState, MATERIAL_BLENDING_MODES, MATERIAL_SIDES, ModelViewer, type ModelViewerProps, type ObjectActionEvent, type ObjectBinding, type ObjectBindingAction, type ObjectBindingMaterial, type ObjectBindingMaterialBlendingMode, type ObjectBindingMaterialSide, type ObjectBindingTextureSlot, type ObjectVisibilityProps, type SceneAnimationClipConfig, type SceneAnimationConfig, type SceneCinematicConfig, type SceneCinematicWaypoint, type SceneConfig, SimpleModelViewer, type SimpleModelViewerProps, type ViewerActionsOptions, type ViewerActionsProps, type ViewerAnimationsProps, type ViewerCameraProps, type ViewerCameraState, type ViewerModelBounds, type ViewerModelProps, type ViewerReadyState, type ViewerSelectionProps, useObjectBinding, useObjectBindingIds, useObjectVisibility, useShareableViewerState, useViewerActions, useViewerAnimations, useViewerCamera, useViewerHover, useViewerModel, useViewerSelection };
package/dist/index.d.ts CHANGED
@@ -291,6 +291,17 @@ type SceneAnnotationMarker = {
291
291
  title: string;
292
292
  description: string;
293
293
  };
294
+ type SceneCinematicWaypoint = {
295
+ position: [number, number, number];
296
+ target: [number, number, number];
297
+ };
298
+ type SceneCinematicConfig = {
299
+ enabled: boolean;
300
+ waypoints: SceneCinematicWaypoint[];
301
+ duration?: number;
302
+ loop: boolean;
303
+ autoPlay: boolean;
304
+ };
294
305
  type SceneConfig = {
295
306
  model: SceneModelConfig;
296
307
  camera: SceneCameraConfig;
@@ -303,6 +314,7 @@ type SceneConfig = {
303
314
  postProcessing: ScenePostProcessingConfig;
304
315
  animations: SceneAnimationConfig;
305
316
  annotations: SceneAnnotationMarker[];
317
+ cinematic?: SceneCinematicConfig;
306
318
  };
307
319
 
308
320
  type CanvasCamera = ComponentProps<typeof Canvas>["camera"];
@@ -332,6 +344,17 @@ declare function Viewer({ children, camera, backgroundColor, shadows, sceneConfi
332
344
 
333
345
  type PerformanceProfile = "auto" | "high" | "low";
334
346
 
347
+ type CinematicWaypoint = {
348
+ position: [number, number, number];
349
+ target: [number, number, number];
350
+ };
351
+ type CinematicConfig = {
352
+ waypoints?: CinematicWaypoint[];
353
+ duration?: number;
354
+ loop?: boolean;
355
+ autoPlay?: boolean;
356
+ };
357
+
335
358
  type MouseControllerPosition = 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right' | 'center' | 'center-bottom' | 'center-top';
336
359
 
337
360
  type ObjectBindingAction = {
@@ -578,12 +601,13 @@ type ModelViewerProps = {
578
601
  meshopt?: boolean;
579
602
  showMeasureTools?: boolean;
580
603
  showExplodeControls?: boolean;
604
+ cinematic?: boolean | CinematicConfig;
581
605
  measurementUnit?: string;
582
606
  enableXR?: boolean;
583
607
  usdzUrl?: string;
584
608
  showAnnotationNavigation?: boolean;
585
609
  };
586
- declare function ModelViewer({ modelUrl, licenseKey, objectBindings, selectedObject, panelHoveredObject, onObjectBindingsChange, onObjectSelect, onObjectHover, onModelLoaded, onLoadError, onAction, onHiddenObjectsChange, onCameraChange, onViewerReady, onTextureUpload, onAnimationsReady, onAnnotationsChange, activeAnnotation: controlledActiveAnnotation, onActiveAnnotationChange, lights, camera, backgroundColor, shadows, showObjectBindingDataPanel, customObjectBindingDataPanel, customSceneObjectsPanel, showSceneObjectsPanel, showDownloadButton, downloadFilename, showResetButton, showDownloadButtons, showLoadingOverlay, showMouseController, mouseControllerPosition, mouseControllerOpacity, moveSensitivity, zoomSensitivity, sceneConfig, disableZoom, zoomOnSelected, highlightOnHover, onAutoFit, refitOnResize, renderMode, maxDpr, performanceProfile, dracoDecoderPath, ktx2TranscoderPath, meshopt, showMeasureTools, showExplodeControls, measurementUnit, enableXR, usdzUrl, showAnnotationNavigation, }: ModelViewerProps): react_jsx_runtime.JSX.Element;
610
+ declare function ModelViewer({ modelUrl, licenseKey, objectBindings, selectedObject, panelHoveredObject, onObjectBindingsChange, onObjectSelect, onObjectHover, onModelLoaded, onLoadError, onAction, onHiddenObjectsChange, onCameraChange, onViewerReady, onTextureUpload, onAnimationsReady, onAnnotationsChange, activeAnnotation: controlledActiveAnnotation, onActiveAnnotationChange, lights, camera, backgroundColor, shadows, showObjectBindingDataPanel, customObjectBindingDataPanel, customSceneObjectsPanel, showSceneObjectsPanel, showDownloadButton, downloadFilename, showResetButton, showDownloadButtons, showLoadingOverlay, showMouseController, mouseControllerPosition, mouseControllerOpacity, moveSensitivity, zoomSensitivity, sceneConfig, disableZoom, zoomOnSelected, highlightOnHover, onAutoFit, refitOnResize, renderMode, maxDpr, performanceProfile, dracoDecoderPath, ktx2TranscoderPath, meshopt, showMeasureTools, showExplodeControls, cinematic, measurementUnit, enableXR, usdzUrl, showAnnotationNavigation, }: ModelViewerProps): react_jsx_runtime.JSX.Element;
587
611
 
588
612
  declare function BindingBuilder({ licenseKey }: {
589
613
  licenseKey: string;
@@ -688,4 +712,4 @@ type ShareableViewerStateProps = {
688
712
  };
689
713
  declare function useShareableViewerState({ cameraState, setCameraState, objectBindings, onObjectBindingsChange, selectedObjectBinding, setSelectedObjectBinding, paramKey, debounceMs, autoSync, }: UseShareableViewerStateOptions): ShareableViewerStateProps;
690
714
 
691
- export { type AnimationClipInfo, type AnimationControls, type AnimationLoopMode, type AnimationPlaybackState, BindingBuilder, type CaptureImageOptions, type CustomObjectBindingDataPanelProps, type CustomSceneObjectsPanelProps, type HiddenObjectsState, type HomeCameraState, MATERIAL_BLENDING_MODES, MATERIAL_SIDES, ModelViewer, type ModelViewerProps, type ObjectActionEvent, type ObjectBinding, type ObjectBindingAction, type ObjectBindingMaterial, type ObjectBindingMaterialBlendingMode, type ObjectBindingMaterialSide, type ObjectBindingTextureSlot, type ObjectVisibilityProps, type SceneAnimationClipConfig, type SceneAnimationConfig, type SceneConfig, SimpleModelViewer, type SimpleModelViewerProps, type ViewerActionsOptions, type ViewerActionsProps, type ViewerAnimationsProps, type ViewerCameraProps, type ViewerCameraState, type ViewerModelBounds, type ViewerModelProps, type ViewerReadyState, type ViewerSelectionProps, useObjectBinding, useObjectBindingIds, useObjectVisibility, useShareableViewerState, useViewerActions, useViewerAnimations, useViewerCamera, useViewerHover, useViewerModel, useViewerSelection };
715
+ export { type AnimationClipInfo, type AnimationControls, type AnimationLoopMode, type AnimationPlaybackState, BindingBuilder, type CaptureImageOptions, type CinematicConfig, type CinematicWaypoint, type CustomObjectBindingDataPanelProps, type CustomSceneObjectsPanelProps, type HiddenObjectsState, type HomeCameraState, MATERIAL_BLENDING_MODES, MATERIAL_SIDES, ModelViewer, type ModelViewerProps, type ObjectActionEvent, type ObjectBinding, type ObjectBindingAction, type ObjectBindingMaterial, type ObjectBindingMaterialBlendingMode, type ObjectBindingMaterialSide, type ObjectBindingTextureSlot, type ObjectVisibilityProps, type SceneAnimationClipConfig, type SceneAnimationConfig, type SceneCinematicConfig, type SceneCinematicWaypoint, type SceneConfig, SimpleModelViewer, type SimpleModelViewerProps, type ViewerActionsOptions, type ViewerActionsProps, type ViewerAnimationsProps, type ViewerCameraProps, type ViewerCameraState, type ViewerModelBounds, type ViewerModelProps, type ViewerReadyState, type ViewerSelectionProps, useObjectBinding, useObjectBindingIds, useObjectVisibility, useShareableViewerState, useViewerActions, useViewerAnimations, useViewerCamera, useViewerHover, useViewerModel, useViewerSelection };