softbox 4.9.0 → 4.10.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.
@@ -628,7 +628,7 @@ class Dc {
628
628
  }
629
629
  class Nc {
630
630
  constructor(e) {
631
- this.currentModel = null, this.modelLoader = e.modelLoader, this.scene = e.scene, this.camera = e.camera, this.controls = e.controls, this.floorAlignmentService = e.floorAlignmentService, this.sceneSetupService = e.sceneSetupService, this.renderer = e.renderer, this.autoFitToObject = e.autoFitToObject ?? !1, this.unitsScaleToMeters = e.unitsScaleToMeters ?? 1;
631
+ this.currentModel = null, this.modelLoader = e.modelLoader, this.scene = e.scene, this.camera = e.camera, this.controls = e.controls, this.floorAlignmentService = e.floorAlignmentService, this.sceneSetupService = e.sceneSetupService, this.renderer = e.renderer, this.autoFitToObject = e.autoFitToObject ?? !1, this.floorAlignment = e.floorAlignment ?? !0, this.unitsScaleToMeters = e.unitsScaleToMeters ?? 1;
632
632
  }
633
633
  /**
634
634
  * Get current model
@@ -674,7 +674,7 @@ class Nc {
674
674
  const r = this.scene.add(s);
675
675
  if (!r.ok)
676
676
  throw r.error;
677
- if (this.floorAlignmentService) {
677
+ if (this.floorAlignment && this.floorAlignmentService) {
678
678
  const a = this.floorAlignmentService.alignToFloor(s);
679
679
  a.ok || console.warn("Failed to align model to floor:", a.error);
680
680
  }
@@ -682,13 +682,14 @@ class Nc {
682
682
  "castShadow" in a && "receiveShadow" in a && (a.castShadow = !0, a.receiveShadow = !0);
683
683
  }), this.currentModel = s, this.sceneSetupService) {
684
684
  const a = this.sceneSetupService.addDynamicGrid(this.scene, s, 2);
685
- a.ok || console.warn("Failed to add dynamic grid:", a.error);
686
- const c = this.sceneSetupService.snapObjectToFloor(this.scene, s);
687
- c.ok || console.warn("Failed to snap object to floor:", c.error);
688
- const h = this.sceneSetupService.fitShadowCameraToObject(this.scene, s);
689
- if (h.ok || console.warn("Failed to fit shadow camera to object:", h.error), this.renderer) {
690
- const d = this.sceneSetupService.bakeContactShadow(this.scene, s, this.renderer);
691
- d.ok || console.warn("Failed to bake contact shadow:", d.error);
685
+ if (a.ok || console.warn("Failed to add dynamic grid:", a.error), this.floorAlignment) {
686
+ const h = this.sceneSetupService.snapObjectToFloor(this.scene, s);
687
+ h.ok || console.warn("Failed to snap object to floor:", h.error);
688
+ }
689
+ const c = this.sceneSetupService.fitShadowCameraToObject(this.scene, s);
690
+ if (c.ok || console.warn("Failed to fit shadow camera to object:", c.error), this.renderer) {
691
+ const h = this.sceneSetupService.bakeContactShadow(this.scene, s, this.renderer);
692
+ h.ok || console.warn("Failed to bake contact shadow:", h.error);
692
693
  }
693
694
  }
694
695
  if (this.autoFitToObject && this.sceneSetupService) {
@@ -1191,6 +1192,7 @@ class Uc {
1191
1192
  sceneSetupService: this.sceneSetupService,
1192
1193
  renderer: this.renderer,
1193
1194
  autoFitToObject: (r = this.options.camera) == null ? void 0 : r.autoFitToObject,
1195
+ floorAlignment: this.options.floorAlignment,
1194
1196
  unitsScaleToMeters: t
1195
1197
  }), this.resourceManager = new kc({
1196
1198
  scene: this.scene,
@@ -8264,7 +8266,7 @@ class mu {
8264
8266
  this.events = new rr(), this.disposed = !1;
8265
8267
  }
8266
8268
  async initialize(e) {
8267
- const { ThreePathTracingService: t } = await import("./ThreePathTracingService-CZdztwad.js");
8269
+ const { ThreePathTracingService: t } = await import("./ThreePathTracingService-Dj2JP7gs.js");
8268
8270
  if (this.disposed)
8269
8271
  return N.ok(void 0);
8270
8272
  const n = new t();
@@ -10587,6 +10589,9 @@ const Yi = {
10587
10589
  // Authored unit of incoming models; non-meter models are rescaled on load
10588
10590
  // to the viewer's 1-unit-=-1-meter convention (real-scale floor, shadows).
10589
10591
  units: "meters",
10592
+ // Drop the model onto the floor at y=0 on load; disable for models that
10593
+ // carry their own ground and must keep their authored Y.
10594
+ floorAlignment: !0,
10590
10595
  // Path tracing
10591
10596
  pathTracing: {
10592
10597
  enabled: !1,
package/dist/index.d.cts CHANGED
@@ -508,6 +508,13 @@ export declare interface SimpleViewerOptions {
508
508
  * real-scale floor, contact shadows and framing rely on.
509
509
  */
510
510
  units?: ModelUnits;
511
+ /**
512
+ * Drop the loaded model onto the floor at y=0 on load (default `true`). Set
513
+ * `false` for a model that carries its own ground and must keep its authored
514
+ * Y — otherwise softbox snaps the model's lowest point (e.g. the bottom of an
515
+ * embedded ground slab) to the floor, shifting everything above it upward.
516
+ */
517
+ floorAlignment?: boolean;
511
518
  backgroundColor?: string | number;
512
519
  staticScene?: boolean;
513
520
  /** GLTF animation playback (autoplay, speed). */
package/dist/index.d.ts CHANGED
@@ -508,6 +508,13 @@ export declare interface SimpleViewerOptions {
508
508
  * real-scale floor, contact shadows and framing rely on.
509
509
  */
510
510
  units?: ModelUnits;
511
+ /**
512
+ * Drop the loaded model onto the floor at y=0 on load (default `true`). Set
513
+ * `false` for a model that carries its own ground and must keep its authored
514
+ * Y — otherwise softbox snaps the model's lowest point (e.g. the bottom of an
515
+ * embedded ground slab) to the floor, shifting everything above it upward.
516
+ */
517
+ floorAlignment?: boolean;
511
518
  backgroundColor?: string | number;
512
519
  staticScene?: boolean;
513
520
  /** GLTF animation playback (autoplay, speed). */
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BgkyK2Uk.cjs");exports.ControlType=e.ControlType;exports.ErrorCode=e.ErrorCode;exports.Hotspot=e.Hotspot;exports.SimpleViewer=e.SimpleViewerWrapper;exports.ThreeViewerError=e.ThreeViewerError;exports.TypedEventEmitter=e.TypedEventEmitter;exports.VIEWER_PRESETS=e.VIEWER_PRESETS;exports.defaultOptions=e.defaultOptions;exports.resolvePreset=e.resolvePreset;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DC_xAbSh.cjs");exports.ControlType=e.ControlType;exports.ErrorCode=e.ErrorCode;exports.Hotspot=e.Hotspot;exports.SimpleViewer=e.SimpleViewerWrapper;exports.ThreeViewerError=e.ThreeViewerError;exports.TypedEventEmitter=e.TypedEventEmitter;exports.VIEWER_PRESETS=e.VIEWER_PRESETS;exports.defaultOptions=e.defaultOptions;exports.resolvePreset=e.resolvePreset;
@@ -1,4 +1,4 @@
1
- import { f as s, E as o, H as a, h as t, e as E, T as i, V as p, i as T, r as l } from "./index-op1Vhyk7.js";
1
+ import { f as s, E as o, H as a, h as t, e as E, T as i, V as p, i as T, r as l } from "./index-DOb7Peb_.js";
2
2
  export {
3
3
  s as ControlType,
4
4
  o as ErrorCode,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "softbox",
3
3
  "private": false,
4
- "version": "4.9.0",
4
+ "version": "4.10.0",
5
5
  "homepage": "https://leming.github.io/softbox/",
6
6
  "type": "module",
7
7
  "description": "Batteries-included React 3D viewer — any GLB looks studio-shot in one line",