softbox 4.25.1 → 4.26.1
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 +1 -1
- package/dist/{ThreePathTracingService-yCaEtW_f.js → ThreePathTracingService-WxrUCt06.js} +446 -453
- package/dist/{ThreePathTracingService-CamzPwtW.cjs → ThreePathTracingService-vIumWBEY.cjs} +4 -4
- package/dist/{UnrealBloomPass-BTHiW_Y8.js → UnrealBloomPass-CTDMA_YD.js} +22 -6
- package/dist/UnrealBloomPass-hgOwlQJl.cjs +114 -0
- package/dist/index.d.cts +0 -564
- package/dist/index.d.ts +0 -564
- package/dist/simple-viewer.cjs +7 -17
- package/dist/simple-viewer.es.js +3781 -4362
- package/dist/{smoothstep-gC155W8-.js → smoothstep-DJLgqxNL.js} +272 -362
- package/dist/smoothstep-DoPxvpnb.cjs +2 -0
- package/package.json +4 -4
- package/dist/UnrealBloomPass-CQHHa-s_.cjs +0 -115
- package/dist/smoothstep-BsyRnZAu.cjs +0 -2
package/dist/index.d.ts
CHANGED
|
@@ -2,59 +2,25 @@ import { default as default_2 } from 'react';
|
|
|
2
2
|
import * as React_2 from 'react';
|
|
3
3
|
import * as THREE from 'three';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* A soft, shadowless directional light used for the fill and rim/back roles of
|
|
7
|
-
* a studio three-point rig. Same direction semantics as the key, but it never
|
|
8
|
-
* casts shadows (only the key does — see `findDirectionalLight`, which resolves
|
|
9
|
-
* the first directional as the shadow/contact-shadow source).
|
|
10
|
-
*/
|
|
11
5
|
export declare interface AccentLightOptions {
|
|
12
6
|
color?: string | number;
|
|
13
7
|
intensity?: number;
|
|
14
|
-
/** Direction is position → origin; distance does not attenuate. */
|
|
15
8
|
position?: Vec3Like | [number, number, number];
|
|
16
9
|
}
|
|
17
10
|
|
|
18
|
-
/** Uniform fill from every direction; lifts shadows, adds no shading. */
|
|
19
11
|
export declare interface AmbientLightOptions {
|
|
20
12
|
color?: string | number;
|
|
21
13
|
intensity?: number;
|
|
22
14
|
}
|
|
23
15
|
|
|
24
16
|
export declare interface AnimationOptions {
|
|
25
|
-
/**
|
|
26
|
-
* Start playback when a model with clips loads: `true` plays ALL clips
|
|
27
|
-
* (looped), a string plays the clip with that name.
|
|
28
|
-
*/
|
|
29
17
|
autoplay?: boolean | string;
|
|
30
|
-
/** Playback rate multiplier (1 = authored speed). Applied live. */
|
|
31
18
|
speed?: number;
|
|
32
19
|
}
|
|
33
20
|
|
|
34
|
-
/**
|
|
35
|
-
* AR handoff configuration: a small button over the canvas that opens the
|
|
36
|
-
* model in the platform's native AR viewer — AR Quick Look on iOS, Scene
|
|
37
|
-
* Viewer on Android. UI-only: the button never touches the WebGL viewer, and
|
|
38
|
-
* toggling it never rebuilds anything. The button only renders on devices
|
|
39
|
-
* that can actually hand off (never on desktop).
|
|
40
|
-
*/
|
|
41
21
|
export declare interface AROptions {
|
|
42
|
-
/**
|
|
43
|
-
* USDZ counterpart of the model, for iOS AR Quick Look — Quick Look cannot
|
|
44
|
-
* read GLB, so without this the button stays hidden on iOS. Android Scene
|
|
45
|
-
* Viewer instead reuses the loaded model's own URL and needs nothing here
|
|
46
|
-
* (but requires the model to be loaded from a network URL — a dropped
|
|
47
|
-
* `blob:` file has no address a native app could fetch).
|
|
48
|
-
*/
|
|
49
22
|
iosSrc?: string;
|
|
50
|
-
/** Title shown on Android Scene Viewer's info card. */
|
|
51
23
|
title?: string;
|
|
52
|
-
/**
|
|
53
|
-
* Corner the button floats in (default `bottom-left`). When the built-in
|
|
54
|
-
* preset picker is enabled, a bottom-placed button lifts above the chip
|
|
55
|
-
* row on its own — pick a top corner if it must clear other chrome (e.g.
|
|
56
|
-
* a `bottom-left` gizmo).
|
|
57
|
-
*/
|
|
58
24
|
placement?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
59
25
|
}
|
|
60
26
|
|
|
@@ -62,50 +28,24 @@ export declare interface AxesHelperOptions {
|
|
|
62
28
|
size?: number;
|
|
63
29
|
}
|
|
64
30
|
|
|
65
|
-
/** Perspective camera setup. World units are meters (see `units`). */
|
|
66
31
|
export declare interface CameraOptions {
|
|
67
|
-
/** Starting camera position as `[x, y, z]`. */
|
|
68
32
|
position?: [number, number, number];
|
|
69
|
-
/** Point the camera looks at and the controls orbit around. */
|
|
70
33
|
target?: [number, number, number];
|
|
71
|
-
/** Vertical field of view in degrees. */
|
|
72
34
|
fov?: number;
|
|
73
|
-
/** Near clipping plane distance. */
|
|
74
35
|
near?: number;
|
|
75
|
-
/** Far clipping plane distance. */
|
|
76
36
|
far?: number;
|
|
77
|
-
/**
|
|
78
|
-
* Frame the loaded model automatically (default `true`): the camera moves
|
|
79
|
-
* to a standard product-shot view — left-front, slightly elevated — around
|
|
80
|
-
* the model's center, at a distance computed from its bounds, and the
|
|
81
|
-
* controls re-target the center. This OVERRIDES `position`/`target`;
|
|
82
|
-
* disable it to keep your configured view exactly.
|
|
83
|
-
*/
|
|
84
37
|
autoFitToObject?: boolean;
|
|
85
38
|
}
|
|
86
39
|
|
|
87
|
-
/**
|
|
88
|
-
* Output size for `captureStill`, in pixels. When only one dimension is given
|
|
89
|
-
* the other follows the canvas aspect ratio; when both are omitted the still
|
|
90
|
-
* matches the canvas drawing buffer.
|
|
91
|
-
*/
|
|
92
40
|
export declare interface CaptureStillOptions {
|
|
93
41
|
width?: number;
|
|
94
42
|
height?: number;
|
|
95
43
|
}
|
|
96
44
|
|
|
97
45
|
export declare interface CaptureVideoOptions {
|
|
98
|
-
/** Capture length in seconds. Default 3. */
|
|
99
46
|
duration?: number;
|
|
100
|
-
/** Frame rate handed to `canvas.captureStream()`. Default 30. */
|
|
101
47
|
fps?: number;
|
|
102
|
-
/**
|
|
103
|
-
* Preferred container/codec (e.g. `'video/webm;codecs=vp9'`). When omitted
|
|
104
|
-
* or unsupported the best supported WebM flavor is picked, falling back to
|
|
105
|
-
* MP4 (Safari) and finally the browser default.
|
|
106
|
-
*/
|
|
107
48
|
mimeType?: string;
|
|
108
|
-
/** Encoder bitrate hint in bits per second. */
|
|
109
49
|
videoBitsPerSecond?: number;
|
|
110
50
|
}
|
|
111
51
|
|
|
@@ -117,40 +57,19 @@ export declare type ControlsInstance = {
|
|
|
117
57
|
getThreeControls?(): unknown;
|
|
118
58
|
};
|
|
119
59
|
|
|
120
|
-
/** Mouse/touch camera controls (three.js OrbitControls semantics). */
|
|
121
60
|
export declare interface ControlsOptions {
|
|
122
|
-
/**
|
|
123
|
-
* `OrbitControls` (default) orbits around the model like a turntable;
|
|
124
|
-
* `MapControls` pans on drag instead — the map/floor-plan idiom.
|
|
125
|
-
*/
|
|
126
61
|
type?: ControlType;
|
|
127
|
-
/** Master switch: `false` freezes all user camera input. */
|
|
128
62
|
enabled?: boolean;
|
|
129
|
-
/** Inertial easing after a drag ends, instead of an instant stop. */
|
|
130
63
|
enableDamping?: boolean;
|
|
131
|
-
/** Damping strength: lower = longer glide (softbox default 0.25). */
|
|
132
64
|
dampingFactor?: number;
|
|
133
|
-
/** Allow dolly/zoom (wheel, pinch). */
|
|
134
65
|
enableZoom?: boolean;
|
|
135
|
-
/** Allow orbiting (primary-button drag). */
|
|
136
66
|
enableRotate?: boolean;
|
|
137
|
-
/** Allow panning (secondary-button or two-finger drag). */
|
|
138
67
|
enablePan?: boolean;
|
|
139
|
-
/**
|
|
140
|
-
* Turntable mode: the camera orbits the model on its own. Runtime-tunable
|
|
141
|
-
* via `updateOptions`. While spinning, a path-traced `captureStill()`
|
|
142
|
-
* rejects — the accumulation resets every frame and can never converge.
|
|
143
|
-
*/
|
|
144
68
|
autoRotate?: boolean;
|
|
145
|
-
/** Turntable speed: 2.0 ≈ one full orbit in 30 s at 60 fps. */
|
|
146
69
|
autoRotateSpeed?: number;
|
|
147
|
-
/** Closest dolly distance to the target. */
|
|
148
70
|
minDistance?: number;
|
|
149
|
-
/** Farthest dolly distance from the target. */
|
|
150
71
|
maxDistance?: number;
|
|
151
|
-
/** Lowest vertical orbit angle in radians (0 = looking straight down from above). */
|
|
152
72
|
minPolarAngle?: number;
|
|
153
|
-
/** Highest vertical orbit angle in radians (π = from below; π/2 stops at the horizon). */
|
|
154
73
|
maxPolarAngle?: number;
|
|
155
74
|
}
|
|
156
75
|
|
|
@@ -159,64 +78,30 @@ export declare enum ControlType {
|
|
|
159
78
|
OrbitControls = "OrbitControls"
|
|
160
79
|
}
|
|
161
80
|
|
|
162
|
-
/**
|
|
163
|
-
* Photographic PBR maps for the outdoor concrete ground (CC0, Poly Haven;
|
|
164
|
-
* ~600 KB total, same CDN and override/self-host contract as the HDRI).
|
|
165
|
-
* Captured micro-structure is what reads as real concrete; the procedural
|
|
166
|
-
* generator stays as the offline fallback when these fail to fetch.
|
|
167
|
-
*/
|
|
168
81
|
export declare const DEFAULT_OUTDOOR_CONCRETE_TEXTURES: {
|
|
169
82
|
readonly texture: "https://dl.polyhaven.org/file/ph-assets/Textures/jpg/1k/concrete_floor_02/concrete_floor_02_diff_1k.jpg";
|
|
170
83
|
readonly normalMap: "https://dl.polyhaven.org/file/ph-assets/Textures/jpg/1k/concrete_floor_02/concrete_floor_02_nor_gl_1k.jpg";
|
|
171
84
|
readonly roughnessMap: "https://dl.polyhaven.org/file/ph-assets/Textures/jpg/1k/concrete_floor_02/concrete_floor_02_rough_1k.jpg";
|
|
172
85
|
};
|
|
173
86
|
|
|
174
|
-
/**
|
|
175
|
-
* The daylight HDRI `outdoor_concrete` lights with when no explicit
|
|
176
|
-
* `environment.url` is given: a bright partly-cloudy sky (CC0, Poly Haven;
|
|
177
|
-
* the projection shows its soft open terrain at the horizon), fetched on
|
|
178
|
-
* demand from their CDN — the one network request the outdoor scene makes.
|
|
179
|
-
* Pass your own `environment.url` to override or self-host, exactly like
|
|
180
|
-
* the DRACO/KTX2 decoder paths. (Urban candidates — potsdamer_platz,
|
|
181
|
-
* quarry_01 — were rejected visually: dusk-dark and olive-tinted grounds.)
|
|
182
|
-
*/
|
|
183
87
|
export declare const DEFAULT_OUTDOOR_HDRI_URL = "https://dl.polyhaven.org/file/ph-assets/HDRIs/hdr/2k/kloofendal_48d_partly_cloudy_puresky_2k.hdr";
|
|
184
88
|
|
|
185
|
-
/** The scene every viewer stands in when none is set. */
|
|
186
89
|
export declare const DEFAULT_SCENE: ViewerScene;
|
|
187
90
|
|
|
188
|
-
/** The grade the studio environment is built with when none is set. */
|
|
189
91
|
export declare const DEFAULT_STUDIO_LOOK: StudioLook;
|
|
190
92
|
|
|
191
|
-
/**
|
|
192
|
-
* Default options using the new format structure
|
|
193
|
-
*/
|
|
194
93
|
export declare const defaultOptions: SimpleViewerOptions;
|
|
195
94
|
|
|
196
|
-
/**
|
|
197
|
-
* The key light: parallel rays from `position` toward the origin. The only
|
|
198
|
-
* light that casts shadows — the contact-shadow bake samples it as an area
|
|
199
|
-
* light, so its direction sets where the floor shadow falls.
|
|
200
|
-
*/
|
|
201
95
|
export declare interface DirectionalLightOptions {
|
|
202
96
|
color?: string | number;
|
|
203
97
|
intensity?: number;
|
|
204
|
-
/** Direction is position → origin; distance does not attenuate. */
|
|
205
98
|
position?: Vec3Like | [number, number, number];
|
|
206
|
-
/** Cast real-time shadows (and feed the baked contact shadow). */
|
|
207
99
|
castShadow?: boolean;
|
|
208
|
-
/** three.js DirectionalLight.shadow tuning; the shadow camera is auto-fitted to the model on load. */
|
|
209
100
|
shadow?: {
|
|
210
|
-
/** Shadow map resolution — higher is crisper and costs GPU memory. */
|
|
211
101
|
mapSize?: {
|
|
212
102
|
width: number;
|
|
213
103
|
height: number;
|
|
214
104
|
};
|
|
215
|
-
/**
|
|
216
|
-
* Orthographic frustum: every plane (left/right/top/bottom AND near/far)
|
|
217
|
-
* is overridden by the auto-fit on load, so the shadow-map texel density
|
|
218
|
-
* and the bias's world-space offset both scale with the model.
|
|
219
|
-
*/
|
|
220
105
|
camera?: {
|
|
221
106
|
near?: number;
|
|
222
107
|
far?: number;
|
|
@@ -225,55 +110,18 @@ export declare interface DirectionalLightOptions {
|
|
|
225
110
|
top?: number;
|
|
226
111
|
bottom?: number;
|
|
227
112
|
};
|
|
228
|
-
/** Depth offset against shadow acne (self-shadowing stripes). */
|
|
229
113
|
bias?: number;
|
|
230
|
-
/**
|
|
231
|
-
* WORLD-SPACE offset along the receiver's normal against shadow acne.
|
|
232
|
-
* Unlike `bias` (normalized depth, whose world effect scales with the
|
|
233
|
-
* fitted camera range), this is absolute — the scale-correct escape hatch
|
|
234
|
-
* if acne ever shows on a model's own surfaces.
|
|
235
|
-
*/
|
|
236
114
|
normalBias?: number;
|
|
237
|
-
/** Shadow edge blur in shadow-map texels. */
|
|
238
115
|
radius?: number;
|
|
239
116
|
};
|
|
240
117
|
}
|
|
241
118
|
|
|
242
|
-
/**
|
|
243
|
-
* Image-based lighting and background. Without a `url` the viewer lights the
|
|
244
|
-
* scene with its built-in procedural studio environment — zero network
|
|
245
|
-
* requests.
|
|
246
|
-
*/
|
|
247
119
|
export declare interface EnvironmentOptions {
|
|
248
|
-
/**
|
|
249
|
-
* Equirectangular environment map (`.hdr`, `.exr`, or an LDR image) used
|
|
250
|
-
* for both lighting and the background.
|
|
251
|
-
*/
|
|
252
120
|
url?: string;
|
|
253
|
-
/** Blurs the background rendering only (0–1); lighting stays sharp. */
|
|
254
121
|
backgroundBlurriness?: number;
|
|
255
|
-
/** Brightness multiplier for the background rendering only. */
|
|
256
122
|
backgroundIntensity?: number;
|
|
257
|
-
/**
|
|
258
|
-
* Lighting intensity multiplier the environment applies to materials.
|
|
259
|
-
* Runtime-tunable via `updateOptions` — presets drive this live.
|
|
260
|
-
*/
|
|
261
123
|
environmentIntensity?: number;
|
|
262
|
-
/** Grade of the built-in studio environment; ignored when `url` is set. */
|
|
263
124
|
studioLook?: StudioLook;
|
|
264
|
-
/**
|
|
265
|
-
* Project the environment map onto a virtual ground plane so the model
|
|
266
|
-
* appears to STAND in the environment instead of floating in front of it —
|
|
267
|
-
* the outdoor scenes' horizon treatment (three's GroundedSkybox). `true`
|
|
268
|
-
* uses the defaults (height 2m — a typical eye-level HDRI shot — and a
|
|
269
|
-
* 120m world radius); pass numbers to match an HDRI shot from another
|
|
270
|
-
* height or a larger set. Only applies when `url` is set. Structural —
|
|
271
|
-
* changing it rebuilds the viewer.
|
|
272
|
-
*
|
|
273
|
-
* While active the projection mesh IS the visible backdrop, so
|
|
274
|
-
* `backgroundBlurriness` has no effect (`backgroundIntensity` is emulated
|
|
275
|
-
* by dimming the projection).
|
|
276
|
-
*/
|
|
277
125
|
groundProjection?: boolean | {
|
|
278
126
|
height?: number;
|
|
279
127
|
radius?: number;
|
|
@@ -347,147 +195,53 @@ export declare interface HelperOptions {
|
|
|
347
195
|
darkStudioMode?: boolean;
|
|
348
196
|
}
|
|
349
197
|
|
|
350
|
-
/**
|
|
351
|
-
* Two-tone gradient fill: one color arriving from above, another bouncing up
|
|
352
|
-
* from below. The default rig uses a warm pale-yellow sky over a dark navy
|
|
353
|
-
* ground.
|
|
354
|
-
*/
|
|
355
198
|
export declare interface HemisphereLightOptions {
|
|
356
|
-
/** Color arriving from above. */
|
|
357
199
|
skyColor?: string | number;
|
|
358
|
-
/** Color bouncing up from below. */
|
|
359
200
|
groundColor?: string | number;
|
|
360
201
|
intensity?: number;
|
|
361
202
|
}
|
|
362
203
|
|
|
363
|
-
/**
|
|
364
|
-
* A DOM annotation anchored to a world-space point of the scene. Render it as
|
|
365
|
-
* a child of `SimpleViewer`; the anchor is projected through the camera after
|
|
366
|
-
* every rendered frame, so it tracks orbiting, zooming and resizes. Points
|
|
367
|
-
* behind the camera are hidden; `occlude` also hides it when the model covers
|
|
368
|
-
* the anchor. The projection math lives behind the viewer's anchor-projection
|
|
369
|
-
* port — this component only wires events to DOM styles.
|
|
370
|
-
*/
|
|
371
204
|
export declare function Hotspot({ position, occlude, children }: HotspotProps): default_2.JSX.Element;
|
|
372
205
|
|
|
373
206
|
export declare interface HotspotProps {
|
|
374
|
-
/** World-space anchor point, e.g. a `point` from the `object:selected` event. */
|
|
375
207
|
position: [number, number, number];
|
|
376
|
-
/**
|
|
377
|
-
* Hide the hotspot when the model occludes its anchor point (a raycast per
|
|
378
|
-
* rendered frame). Off by default.
|
|
379
|
-
*/
|
|
380
208
|
occlude?: boolean;
|
|
381
|
-
/** Pin content; without children a default dot pin is rendered. */
|
|
382
209
|
children?: default_2.ReactNode;
|
|
383
210
|
}
|
|
384
211
|
|
|
385
|
-
/**
|
|
386
|
-
* The studio rig. Every light is optional; the defaults are a balanced
|
|
387
|
-
* product-shot three-point setup (see `defaultOptions.lighting`): a shadow-
|
|
388
|
-
* casting key, a soft opposite-side fill that opens the shadow, and a rim/back
|
|
389
|
-
* light behind the subject that separates its silhouette from the background.
|
|
390
|
-
* Ambient + hemisphere add a gentle omnidirectional base.
|
|
391
|
-
*/
|
|
392
212
|
export declare interface LightingOptions {
|
|
393
213
|
ambientLight?: AmbientLightOptions;
|
|
394
214
|
hemisphereLight?: HemisphereLightOptions;
|
|
395
215
|
directionalLight?: DirectionalLightOptions;
|
|
396
|
-
/** Soft opposite-side fill; opens the shadow side without a second shadow. */
|
|
397
216
|
fillLight?: AccentLightOptions;
|
|
398
|
-
/** Rim/back light behind the subject; separates the silhouette from the backdrop. */
|
|
399
217
|
rimLight?: AccentLightOptions;
|
|
400
218
|
}
|
|
401
219
|
|
|
402
|
-
/**
|
|
403
|
-
* Compression-decoder configuration for the built-in glTF/GLB loader.
|
|
404
|
-
*
|
|
405
|
-
* DRACO (geometry), KTX2/Basis (textures) and Meshopt (geometry) are all wired
|
|
406
|
-
* into the loader by default, so compressed assets exported by Blender,
|
|
407
|
-
* `gltfpack`, `gltf-transform`, etc. load without any extra setup.
|
|
408
|
-
*
|
|
409
|
-
* Meshopt is bundled and needs no external file. DRACO and KTX2 require a small
|
|
410
|
-
* WebAssembly decoder that is fetched **on demand** — only the first time an
|
|
411
|
-
* asset actually uses that compression — from a version-pinned CDN by default.
|
|
412
|
-
* Point `dracoDecoderPath` / `ktx2TranscoderPath` at a self-hosted copy (e.g.
|
|
413
|
-
* `three/examples/jsm/libs/draco/` and `.../basis/` copied into your public dir)
|
|
414
|
-
* for a fully offline, no-CDN setup.
|
|
415
|
-
*/
|
|
416
220
|
export declare interface LoaderOptions {
|
|
417
|
-
/** Decode DRACO-compressed geometry. Default: `true`. */
|
|
418
221
|
draco?: boolean;
|
|
419
|
-
/** Decode KTX2 / Basis-compressed textures. Default: `true`. */
|
|
420
222
|
ktx2?: boolean;
|
|
421
|
-
/** Decode Meshopt-compressed geometry. Default: `true`. */
|
|
422
223
|
meshopt?: boolean;
|
|
423
|
-
/**
|
|
424
|
-
* Directory holding the DRACO decoder (`draco_wasm_wrapper.js` +
|
|
425
|
-
* `draco_decoder.wasm`). Must end with a trailing slash. Defaults to a
|
|
426
|
-
* version-pinned jsDelivr URL matching the installed Three.js revision.
|
|
427
|
-
*/
|
|
428
224
|
dracoDecoderPath?: string;
|
|
429
|
-
/**
|
|
430
|
-
* Directory holding the KTX2 Basis transcoder (`basis_transcoder.js` +
|
|
431
|
-
* `basis_transcoder.wasm`). Must end with a trailing slash. Defaults to a
|
|
432
|
-
* version-pinned jsDelivr URL matching the installed Three.js revision.
|
|
433
|
-
*/
|
|
434
225
|
ktx2TranscoderPath?: string;
|
|
435
226
|
}
|
|
436
227
|
|
|
437
|
-
/**
|
|
438
|
-
* Configuration for the built-in loading overlay shown while a model loads.
|
|
439
|
-
*
|
|
440
|
-
* Pass a boolean on `SimpleViewerOptions.loadingIndicator` to toggle the
|
|
441
|
-
* default overlay, or this object to customize it. Set `loadingIndicator: false`
|
|
442
|
-
* to render your own using the `model:loading` / `model:loaded` / `model:error`
|
|
443
|
-
* events on the viewer handle.
|
|
444
|
-
*/
|
|
445
228
|
export declare interface LoadingIndicatorOptions {
|
|
446
|
-
/** Show the built-in overlay. Default: `true`. */
|
|
447
229
|
enabled?: boolean;
|
|
448
|
-
/** Text under the spinner while loading. Default: `'Loading…'`. */
|
|
449
230
|
label?: string;
|
|
450
|
-
/** Message shown if the model fails to load. Default: the error message. */
|
|
451
231
|
errorLabel?: string;
|
|
452
|
-
/** Spinner and text color. Default: `'#ffffff'`. */
|
|
453
232
|
color?: string;
|
|
454
|
-
/** Backdrop scrim behind the spinner. Default: a subtle dark scrim. */
|
|
455
233
|
backdrop?: string;
|
|
456
234
|
}
|
|
457
235
|
|
|
458
|
-
/** Length unit the model's geometry is authored in. */
|
|
459
236
|
export declare type ModelUnits = 'meters' | 'centimeters' | 'millimeters' | 'feet' | 'inches';
|
|
460
237
|
|
|
461
|
-
/**
|
|
462
|
-
* Progressive path tracing for photoreal rendering (three-gpu-pathtracer).
|
|
463
|
-
* Interactive: while the camera moves you see a fast preview, and whenever it
|
|
464
|
-
* rests the tracer re-accumulates to a converged frame — orbiting after
|
|
465
|
-
* convergence starts a fresh accumulation from the new viewpoint. The tracer
|
|
466
|
-
* stays warm for the viewer's lifetime; it ships in a lazy chunk that loads
|
|
467
|
-
* only when enabled. While animations play, accumulation is suspended (the
|
|
468
|
-
* raster renderer shows the motion) and resumes on the paused pose.
|
|
469
|
-
*
|
|
470
|
-
* The whole object is structural in `<SimpleViewer>`: changing ANY field
|
|
471
|
-
* rebuilds the viewer (and reloads the model).
|
|
472
|
-
*/
|
|
473
238
|
export declare interface PathTracingOptions {
|
|
474
|
-
/** Builds the tracer at viewer construction. */
|
|
475
239
|
enabled?: boolean;
|
|
476
|
-
/**
|
|
477
|
-
* Samples to accumulate before the frame counts as converged
|
|
478
|
-
* (`pathtracing:complete`, and what a path-traced `captureStill()` awaits).
|
|
479
|
-
* More samples = cleaner image, linearly more GPU time.
|
|
480
|
-
*/
|
|
481
240
|
maxSamples?: number;
|
|
482
|
-
/** Light-path depth: how many surface bounces each ray may take. */
|
|
483
241
|
bounces?: number;
|
|
484
|
-
/** Extra ray depth through transmissive (glass-like) materials. */
|
|
485
242
|
transmissiveBounces?: number;
|
|
486
|
-
/** Accumulation resolution as a fraction of canvas size (0.5 = quarter pixels, 4× faster). */
|
|
487
243
|
renderScale?: number;
|
|
488
|
-
/** Resolution fraction of the fast preview shown while the camera moves. */
|
|
489
244
|
lowResScale?: number;
|
|
490
|
-
/** Drop to the low-res preview during interaction instead of stalling. */
|
|
491
245
|
dynamicLowRes?: boolean;
|
|
492
246
|
}
|
|
493
247
|
|
|
@@ -495,98 +249,40 @@ export declare interface RendererOptions {
|
|
|
495
249
|
antialias?: boolean;
|
|
496
250
|
alpha?: boolean;
|
|
497
251
|
premultipliedAlpha?: boolean;
|
|
498
|
-
/**
|
|
499
|
-
* Note: the viewer forces this ON regardless — a completed path-traced
|
|
500
|
-
* frame must survive on the canvas for captureStill to read back.
|
|
501
|
-
*/
|
|
502
252
|
preserveDrawingBuffer?: boolean;
|
|
503
253
|
powerPreference?: 'high-performance' | 'low-power' | 'default';
|
|
504
254
|
shadowMapEnabled?: boolean;
|
|
505
255
|
pixelRatio?: number;
|
|
506
|
-
/** A `THREE.ShadowMapType` constant (e.g. `THREE.PCFShadowMap` === 1). */
|
|
507
256
|
shadowMapType?: number;
|
|
508
|
-
/** A `THREE.ToneMapping` constant (e.g. `THREE.ACESFilmicToneMapping` === 6). */
|
|
509
257
|
toneMapping?: number;
|
|
510
258
|
toneMappingExposure?: number;
|
|
511
|
-
/** A `THREE.ColorSpace` value (e.g. `'srgb'`, `'srgb-linear'`). */
|
|
512
259
|
outputColorSpace?: string;
|
|
513
|
-
/** Opt-in soft glow on bright highlights (UnrealBloom). */
|
|
514
260
|
bloom?: boolean;
|
|
515
|
-
/** Opt-in edge darkening that focuses attention on the subject. */
|
|
516
261
|
vignette?: boolean;
|
|
517
|
-
/** Opt-in subtle photographic film grain. */
|
|
518
262
|
filmGrain?: boolean;
|
|
519
|
-
/**
|
|
520
|
-
* Opt-in contrast + saturation grade applied after tone mapping — adds punch
|
|
521
|
-
* (a more "hero" read) while keeping the tone-mapping operator's hue. Pass
|
|
522
|
-
* `true` for a balanced default, or an object to tune each amount (roughly
|
|
523
|
-
* `-1..1`, `0` = no change). Off by default.
|
|
524
|
-
*/
|
|
525
263
|
colorGrade?: boolean | {
|
|
526
264
|
contrast?: number;
|
|
527
265
|
saturation?: number;
|
|
528
266
|
};
|
|
529
267
|
}
|
|
530
268
|
|
|
531
|
-
/**
|
|
532
|
-
* Rendering behavior options
|
|
533
|
-
*/
|
|
534
269
|
export declare interface RenderingOptions {
|
|
535
|
-
/**
|
|
536
|
-
* Enable idle detection to stop rendering when inactive
|
|
537
|
-
* @default true for static scenes, false for non-static scenes
|
|
538
|
-
*/
|
|
539
270
|
enableIdleDetection?: boolean;
|
|
540
|
-
/**
|
|
541
|
-
* Time in milliseconds before entering idle state
|
|
542
|
-
* @default 1000
|
|
543
|
-
*/
|
|
544
271
|
idleDelay?: number;
|
|
545
|
-
/**
|
|
546
|
-
* Target frames per second
|
|
547
|
-
* @default 60
|
|
548
|
-
*/
|
|
549
272
|
targetFPS?: number;
|
|
550
|
-
/**
|
|
551
|
-
* Enable frame rate limiting
|
|
552
|
-
* @default true
|
|
553
|
-
*/
|
|
554
273
|
enableFrameRateLimiting?: boolean;
|
|
555
274
|
}
|
|
556
275
|
|
|
557
|
-
/** The partial options for a preset, or an empty object when none is set. */
|
|
558
276
|
export declare function resolvePreset(preset?: ViewerPreset): Partial<SimpleViewerOptions>;
|
|
559
277
|
|
|
560
|
-
/** The partial options for a scene, or an empty object when none is set. */
|
|
561
278
|
export declare function resolveScene(scene?: ViewerScene): Partial<SimpleViewerOptions>;
|
|
562
279
|
|
|
563
|
-
/**
|
|
564
|
-
* Click-picking and hotspot-occlusion raycast options.
|
|
565
|
-
*/
|
|
566
280
|
export declare interface SelectionOptions {
|
|
567
|
-
/**
|
|
568
|
-
* Build a BVH (bounding volume hierarchy) for each loaded model, making
|
|
569
|
-
* raycasts logarithmic instead of linear — noticeable on high-poly models.
|
|
570
|
-
* Costs one synchronous build pass at load time (or on the first click for
|
|
571
|
-
* models passed as raw objects) and ~25% extra geometry memory. The build
|
|
572
|
-
* sorts each geometry's index in place (triangle order changes; rendering
|
|
573
|
-
* is unaffected) and adds an index to non-indexed geometry. Disable on
|
|
574
|
-
* memory-constrained targets or when the index order matters. Default on.
|
|
575
|
-
*/
|
|
576
281
|
bvh?: boolean;
|
|
577
282
|
}
|
|
578
283
|
|
|
579
|
-
/**
|
|
580
|
-
* Public entry component for the viewer. Thin forwardRef pass-through to the
|
|
581
|
-
* clean-architecture SimpleViewer implementation.
|
|
582
|
-
*/
|
|
583
284
|
export declare const SimpleViewer: default_2.ForwardRefExoticComponent<SimpleViewerProps & default_2.RefAttributes<SimpleViewerHandle>>;
|
|
584
285
|
|
|
585
|
-
/**
|
|
586
|
-
* Imperative handle exposed via `ref` on the `SimpleViewer` component. Lives in a
|
|
587
|
-
* dedicated type module (not the component file) so cross-cutting modules such as
|
|
588
|
-
* `events/ViewerEvents` can reference it without depending on a React component.
|
|
589
|
-
*/
|
|
590
286
|
export declare interface SimpleViewerHandle {
|
|
591
287
|
scene: THREE.Scene | null;
|
|
592
288
|
camera: THREE.Camera | null;
|
|
@@ -594,106 +290,29 @@ export declare interface SimpleViewerHandle {
|
|
|
594
290
|
controls: ControlsInstance | null;
|
|
595
291
|
events: TypedEventEmitter<ViewerEventMap>;
|
|
596
292
|
loadModel: (source: string | THREE.Object3D) => Promise<void>;
|
|
597
|
-
/**
|
|
598
|
-
* Capture a PNG still of the current scene (data URL). Pass `width`/`height`
|
|
599
|
-
* for a high-resolution raster capture; in path-traced mode omit them — the
|
|
600
|
-
* still is taken at canvas resolution once the accumulation completes.
|
|
601
|
-
*/
|
|
602
293
|
captureStill: (options?: CaptureStillOptions) => Promise<string>;
|
|
603
|
-
/**
|
|
604
|
-
* Record the live canvas for a few seconds (default 3) and resolve with the
|
|
605
|
-
* encoded clip — WebM in Chromium/Firefox, MP4 in Safari. Motion (turntable,
|
|
606
|
-
* animations, user orbiting) is captured as it happens.
|
|
607
|
-
*/
|
|
608
294
|
captureVideo: (options?: CaptureVideoOptions) => Promise<Blob>;
|
|
609
|
-
/** Clip names of the loaded model, in file order (empty when none). */
|
|
610
295
|
getAnimationNames: () => string[];
|
|
611
|
-
/** KHR_materials_variants names of the loaded model (empty when none). */
|
|
612
296
|
getVariantNames: () => string[];
|
|
613
|
-
/**
|
|
614
|
-
* Switch the loaded model to a material variant; `null` restores the
|
|
615
|
-
* authored materials. Applies live (no reload). Throws `INVALID_PARAMETER`
|
|
616
|
-
* on a variant name the model does not carry.
|
|
617
|
-
*/
|
|
618
297
|
setVariant: (variant: string | null) => void;
|
|
619
|
-
/**
|
|
620
|
-
* Plays one clip by name, or ALL clips when no name is given (looped).
|
|
621
|
-
* Throws `INVALID_PARAMETER` on a clip name the model does not carry.
|
|
622
|
-
*/
|
|
623
298
|
playAnimations: (clipName?: string) => void;
|
|
624
|
-
/** Freezes playback on the current pose; playAnimations() resumes. */
|
|
625
299
|
pauseAnimations: () => void;
|
|
626
|
-
/**
|
|
627
|
-
* Replace the environment map (reflections + background) at runtime with the
|
|
628
|
-
* equirectangular HDRI/LDR image at `url`. Cached by URL, so re-applying is cheap.
|
|
629
|
-
*
|
|
630
|
-
* Like the capture APIs, the environment APIs throw (async ones reject) with
|
|
631
|
-
* INVALID_STATE when the viewer was disposed — including a dispose that lands
|
|
632
|
-
* while the map is still loading. Fire-and-forget callers should attach a
|
|
633
|
-
* `.catch` if unmount races are possible (e.g. React StrictMode in dev).
|
|
634
|
-
*/
|
|
635
300
|
setEnvironmentMap: (url: string) => Promise<void>;
|
|
636
|
-
/** Restore the built-in studio environment and clean gradient background. */
|
|
637
301
|
resetEnvironment: () => void;
|
|
638
|
-
/**
|
|
639
|
-
* Paint an uploaded image (URL, File, or HTMLImageElement) as the scene backdrop
|
|
640
|
-
* without changing the environment lighting. Clear it with setBackgroundColor.
|
|
641
|
-
*/
|
|
642
302
|
setBackgroundImage: (source: string | File | HTMLImageElement) => Promise<void>;
|
|
643
|
-
/** Set a solid background color (also clears a background image). */
|
|
644
303
|
setBackgroundColor: (color: string | number) => void;
|
|
645
304
|
dispose: () => void;
|
|
646
305
|
}
|
|
647
306
|
|
|
648
307
|
export declare interface SimpleViewerOptions {
|
|
649
|
-
/**
|
|
650
|
-
* A one-word visual preset (`studio`, `product`, `neutral`, `dark`, `outdoor`)
|
|
651
|
-
* that sets a cohesive lighting/environment/tone look. Any other option you
|
|
652
|
-
* pass overrides the preset's values.
|
|
653
|
-
*/
|
|
654
308
|
preset?: ViewerPreset;
|
|
655
|
-
/**
|
|
656
|
-
* A one-word scene (`studio_dome`, `studio_soft`) that selects the physical
|
|
657
|
-
* set — floor, backdrop and how the studio environment is built. The
|
|
658
|
-
* structural counterpart of `preset`: switching a scene rebuilds the viewer.
|
|
659
|
-
* Any other option you pass overrides the scene's values.
|
|
660
|
-
*/
|
|
661
309
|
scene?: ViewerScene;
|
|
662
|
-
/**
|
|
663
|
-
* KHR_materials_variants variant to show (e.g. a product colorway baked
|
|
664
|
-
* into the GLB). Applies LIVE — switching never rebuilds the viewer or
|
|
665
|
-
* reloads the model. `null` shows the authored default materials; leaving
|
|
666
|
-
* the option out is "uncontrolled" (an imperative `handle.setVariant()`
|
|
667
|
-
* pick survives other option changes); an unknown name warns and keeps
|
|
668
|
-
* the defaults. Enumerate the model's variants via
|
|
669
|
-
* `handle.getVariantNames()`.
|
|
670
|
-
*/
|
|
671
310
|
variant?: string | null;
|
|
672
|
-
/**
|
|
673
|
-
* Length unit the model geometry is authored in (default `'meters'`).
|
|
674
|
-
* Non-meter models are rescaled on load — without touching the model's own
|
|
675
|
-
* transform — to the viewer's 1-unit-=-1-meter convention that the
|
|
676
|
-
* real-scale floor, contact shadows and framing rely on.
|
|
677
|
-
*/
|
|
678
311
|
units?: ModelUnits;
|
|
679
|
-
/**
|
|
680
|
-
* Drop the loaded model onto the floor at y=0 on load (default `true`). Set
|
|
681
|
-
* `false` for a model that carries its own ground and must keep its authored
|
|
682
|
-
* Y — otherwise softbox snaps the model's lowest point (e.g. the bottom of an
|
|
683
|
-
* embedded ground slab) to the floor, shifting everything above it upward.
|
|
684
|
-
*/
|
|
685
312
|
floorAlignment?: boolean;
|
|
686
313
|
backgroundColor?: string | number;
|
|
687
|
-
/**
|
|
688
|
-
* Optional darker edge colour for a RADIAL backdrop vignette. When set,
|
|
689
|
-
* `backgroundColor` is painted as the centre (behind the subject) and this as
|
|
690
|
-
* the corners/bottom, floating the model in a soft cove instead of a flat
|
|
691
|
-
* fill. Omit for a flat background. Runtime-tunable (applies on a live preset
|
|
692
|
-
* switch without a rebuild), same as `backgroundColor`.
|
|
693
|
-
*/
|
|
694
314
|
backgroundColorEdge?: string | number;
|
|
695
315
|
staticScene?: boolean;
|
|
696
|
-
/** GLTF animation playback (autoplay, speed). */
|
|
697
316
|
animations?: AnimationOptions;
|
|
698
317
|
camera?: CameraOptions;
|
|
699
318
|
controls?: ControlsOptions;
|
|
@@ -703,18 +322,8 @@ export declare interface SimpleViewerOptions {
|
|
|
703
322
|
pathTracing?: PathTracingOptions;
|
|
704
323
|
renderer?: RendererOptions;
|
|
705
324
|
rendering?: RenderingOptions;
|
|
706
|
-
/** Called when a model finishes loading (each load, including replacements). */
|
|
707
325
|
onLoad?: () => void;
|
|
708
|
-
/**
|
|
709
|
-
* Download progress for URL-loaded models as a 0–1 fraction. Only called
|
|
710
|
-
* when the server reports a total size (Content-Length).
|
|
711
|
-
*/
|
|
712
326
|
onProgress?: (progress: number) => void;
|
|
713
|
-
/**
|
|
714
|
-
* Called on viewer construction/initialization failures (e.g. WebGL
|
|
715
|
-
* unavailable) and on model load errors. The built-in overlay shows an
|
|
716
|
-
* error state either way; use this to render your own affordance or report.
|
|
717
|
-
*/
|
|
718
327
|
onError?: (error: Error) => void;
|
|
719
328
|
/**
|
|
720
329
|
* @deprecated Never functional since the 3.x architecture rewrite — the
|
|
@@ -722,118 +331,26 @@ export declare interface SimpleViewerOptions {
|
|
|
722
331
|
* Ignored; will be removed in 5.0.
|
|
723
332
|
*/
|
|
724
333
|
animationLoop?: ((time: number) => void) | null;
|
|
725
|
-
/**
|
|
726
|
-
* Replace the canvas with an `<img>` snapshot when a path-traced
|
|
727
|
-
* accumulation completes; the first click restores the live viewer by
|
|
728
|
-
* reloading the model (default `false`). A legacy from one-shot path
|
|
729
|
-
* tracing — the interactive tracer keeps the converged frame on the live
|
|
730
|
-
* canvas and re-accumulates on camera moves, so most consumers should
|
|
731
|
-
* leave this off.
|
|
732
|
-
*/
|
|
733
334
|
replaceWithScreenshotOnComplete?: boolean;
|
|
734
|
-
/**
|
|
735
|
-
* When to boot the WebGL engine and fetch the model (default `'eager'`).
|
|
736
|
-
* `'lazy'` defers everything until the viewer first approaches the
|
|
737
|
-
* viewport (like `<img loading="lazy">`) — on pages with many viewers
|
|
738
|
-
* only the visible ones pay for a GL context and a model download. Once
|
|
739
|
-
* booted a viewer stays booted; where IntersectionObserver is unavailable
|
|
740
|
-
* the option gracefully degrades to eager.
|
|
741
|
-
*/
|
|
742
335
|
loading?: 'eager' | 'lazy';
|
|
743
|
-
/**
|
|
744
|
-
* Built-in loading overlay shown while a model loads. `true`/omitted shows the
|
|
745
|
-
* default spinner; `false` hides it (render your own via the loading events);
|
|
746
|
-
* an object customizes it. UI-only — changing it never rebuilds the viewer.
|
|
747
|
-
*/
|
|
748
336
|
loadingIndicator?: boolean | LoadingIndicatorOptions;
|
|
749
|
-
/**
|
|
750
|
-
* Compression decoders for the glTF/GLB loader (DRACO, KTX2/Basis, Meshopt).
|
|
751
|
-
* All enabled by default so compressed assets load with no setup; pass this to
|
|
752
|
-
* disable a decoder or self-host the DRACO/KTX2 WebAssembly files offline.
|
|
753
|
-
*/
|
|
754
337
|
loaders?: LoaderOptions;
|
|
755
|
-
/**
|
|
756
|
-
* Built-in UI chrome over the canvas (e.g. `ui: { presets: true }` for the
|
|
757
|
-
* live preset picker). All opt-in; UI-only — never rebuilds the viewer.
|
|
758
|
-
*/
|
|
759
338
|
ui?: UIOptions;
|
|
760
|
-
/**
|
|
761
|
-
* Poster image (URL) shown over the canvas until the model's first painted
|
|
762
|
-
* frame. Composes with `loading: 'lazy'`: the poster is the instant,
|
|
763
|
-
* WebGL-free first paint while the real viewer boots and the GLB
|
|
764
|
-
* downloads. Generate one with `handle.captureStill()`. Stays up as the
|
|
765
|
-
* backdrop if the load errs (the error overlay renders above it).
|
|
766
|
-
* UI-only — changing it never rebuilds the viewer.
|
|
767
|
-
*/
|
|
768
339
|
poster?: string;
|
|
769
|
-
/**
|
|
770
|
-
* AR handoff button: opens the model in the platform's native AR viewer —
|
|
771
|
-
* AR Quick Look on iOS (needs `iosSrc`, a USDZ counterpart), Scene Viewer
|
|
772
|
-
* on Android (reuses the model's own URL). `true` enables with defaults.
|
|
773
|
-
* The button renders only on devices that can actually hand off, so it is
|
|
774
|
-
* safe to set unconditionally. UI-only — never rebuilds the viewer.
|
|
775
|
-
*/
|
|
776
340
|
ar?: boolean | AROptions;
|
|
777
|
-
/**
|
|
778
|
-
* Click-picking / hotspot-occlusion raycast tuning (e.g. `selection: { bvh:
|
|
779
|
-
* false }` to skip the load-time BVH build on memory-constrained targets).
|
|
780
|
-
*/
|
|
781
341
|
selection?: SelectionOptions;
|
|
782
342
|
}
|
|
783
343
|
|
|
784
344
|
export declare interface SimpleViewerProps {
|
|
785
|
-
/**
|
|
786
|
-
* A URL to a glb/gltf file, or a Three.js object. The viewer takes
|
|
787
|
-
* OWNERSHIP of objects you pass: their geometries, materials and textures
|
|
788
|
-
* are disposed when the object is replaced or the viewer unmounts. Pass a
|
|
789
|
-
* `.clone()` if you need to keep using the original elsewhere.
|
|
790
|
-
*/
|
|
791
345
|
object: THREE.Object3D | null | string;
|
|
792
346
|
options?: SimpleViewerOptions;
|
|
793
|
-
/**
|
|
794
|
-
* Shorthand for `options.preset` — a one-word look
|
|
795
|
-
* (`studio` / `product` / `neutral` / `dark` / `outdoor`).
|
|
796
|
-
* `options.preset` takes precedence if both are set.
|
|
797
|
-
*/
|
|
798
347
|
preset?: ViewerPreset;
|
|
799
|
-
/**
|
|
800
|
-
* Shorthand for `options.pathTracing.enabled = true` — photoreal progressive
|
|
801
|
-
* path tracing (a construction-time render mode). Composes with a partial
|
|
802
|
-
* `options.pathTracing` (tuning fields are kept); an explicit
|
|
803
|
-
* `options.pathTracing.enabled` wins. Pair with `handle.captureStill()` for
|
|
804
|
-
* a photoreal still once the accumulation completes.
|
|
805
|
-
*/
|
|
806
348
|
pathTraced?: boolean;
|
|
807
|
-
/**
|
|
808
|
-
* Shorthand for `options.controls.autoRotate = true` — a showcase turntable
|
|
809
|
-
* that slowly orbits the camera around the model. Toggling it never rebuilds
|
|
810
|
-
* the viewer (applied live), and rotation pauses automatically while the
|
|
811
|
-
* user is dragging. Speed is tuned via `options.controls.autoRotateSpeed`
|
|
812
|
-
* (2 ≈ one orbit per 30s). An explicit `options.controls.autoRotate` wins.
|
|
813
|
-
*/
|
|
814
349
|
turntable?: boolean;
|
|
815
|
-
/**
|
|
816
|
-
* Shorthand for `options.animations.autoplay = true` — plays ALL of the
|
|
817
|
-
* model's animation clips, looped, as soon as it loads. Toggling is live
|
|
818
|
-
* (pause/resume without a rebuild). Pick a single clip or tune the speed
|
|
819
|
-
* via `options.animations`; an explicit `options.animations.autoplay` wins.
|
|
820
|
-
*/
|
|
821
350
|
animations?: boolean;
|
|
822
|
-
/**
|
|
823
|
-
* Overlay children rendered inside the viewer container (over the canvas),
|
|
824
|
-
* e.g. `<Hotspot>` annotations.
|
|
825
|
-
*/
|
|
826
351
|
children?: React_2.ReactNode;
|
|
827
352
|
}
|
|
828
353
|
|
|
829
|
-
/**
|
|
830
|
-
* How the built-in procedural studio environment is graded when it is built.
|
|
831
|
-
* `crisp` (the default) darkens the surround and boosts the soft-box panels so
|
|
832
|
-
* glossy materials show distinct highlights; `soft` uses the studio room
|
|
833
|
-
* as-built for an even, low-contrast wraparound light. Structural — the
|
|
834
|
-
* environment is baked once at construction, so changing it rebuilds the
|
|
835
|
-
* viewer. Scenes (`SimpleViewerOptions.scene`) drive this.
|
|
836
|
-
*/
|
|
837
354
|
export declare type StudioLook = 'crisp' | 'soft';
|
|
838
355
|
|
|
839
356
|
export declare class ThreeViewerError extends Error {
|
|
@@ -851,70 +368,27 @@ export declare class TypedEventEmitter<T> {
|
|
|
851
368
|
once<K extends keyof T>(event: K, listener: (data: T[K]) => void): () => void;
|
|
852
369
|
removeAllListeners(event?: keyof T): void;
|
|
853
370
|
listenerCount(event: keyof T): number;
|
|
854
|
-
/**
|
|
855
|
-
* Alias for removing a listener (compatible with Node.js EventEmitter)
|
|
856
|
-
*/
|
|
857
371
|
off<K extends keyof T>(event: K, listener: (data: T[K]) => void): void;
|
|
858
|
-
/**
|
|
859
|
-
* Alias for on (compatible with Node.js EventEmitter)
|
|
860
|
-
*/
|
|
861
372
|
removeListener<K extends keyof T>(event: K, listener: (data: T[K]) => void): void;
|
|
862
373
|
}
|
|
863
374
|
|
|
864
|
-
/**
|
|
865
|
-
* Built-in UI chrome rendered over the canvas. Everything here is opt-in and
|
|
866
|
-
* UI-only — toggling it never rebuilds the viewer or reloads the model.
|
|
867
|
-
*/
|
|
868
375
|
export declare interface UIOptions {
|
|
869
|
-
/**
|
|
870
|
-
* Show the built-in preset picker: a row of chips over the canvas that
|
|
871
|
-
* switches the visual preset live. Off by default. Turning the picker off
|
|
872
|
-
* also clears any preset picked through it — your own `preset` takes over.
|
|
873
|
-
*/
|
|
874
376
|
presets?: boolean;
|
|
875
|
-
/**
|
|
876
|
-
* Called when the user picks a preset via the built-in picker, e.g. to
|
|
877
|
-
* persist the choice. A later change to your own `preset` prop/option
|
|
878
|
-
* overrides the picked one; echoing a reported pick back into `preset`
|
|
879
|
-
* (even asynchronously) is safe and never reverts a newer pick.
|
|
880
|
-
*/
|
|
881
377
|
onPresetChange?: (preset: ViewerPreset) => void;
|
|
882
378
|
}
|
|
883
379
|
|
|
884
|
-
/** A plain, engine-agnostic 3D point. */
|
|
885
380
|
declare interface Vec3Like {
|
|
886
381
|
x: number;
|
|
887
382
|
y: number;
|
|
888
383
|
z: number;
|
|
889
384
|
}
|
|
890
385
|
|
|
891
|
-
/**
|
|
892
|
-
* Visual presets: cohesive deltas layered over the defaults (deep-merged) so a
|
|
893
|
-
* model looks intentional on first paint. Each preset only sets **runtime** look
|
|
894
|
-
* fields — background color (plus an optional radial-vignette edge colour),
|
|
895
|
-
* tone-mapping exposure and environment intensity — so switching presets is
|
|
896
|
-
* applied live (no viewer rebuild, no model reload) and everything else (camera
|
|
897
|
-
* auto-framing, lighting rig, controls, grid) is inherited from the defaults.
|
|
898
|
-
* Explicit user options always win.
|
|
899
|
-
*/
|
|
900
386
|
export declare const VIEWER_PRESETS: Record<ViewerPreset, Partial<SimpleViewerOptions>>;
|
|
901
387
|
|
|
902
388
|
export declare const VIEWER_SCENES: Record<ViewerScene, Partial<SimpleViewerOptions>>;
|
|
903
389
|
|
|
904
|
-
/**
|
|
905
|
-
* The public, Three.js-typed view of the viewer event contract — the shape
|
|
906
|
-
* consumers see on the viewer handle's `events` emitter. Shares its single
|
|
907
|
-
* source of truth with the core map via the generic {@link GenericViewerEventMap}.
|
|
908
|
-
*/
|
|
909
390
|
export declare type ViewerEventMap = ViewerEventMap_2<THREE.Object3D, THREE.Camera, ControlsInstance, SimpleViewerHandle>;
|
|
910
391
|
|
|
911
|
-
/**
|
|
912
|
-
* The viewer's event contract, generic over the layer-specific representations
|
|
913
|
-
* of a 3D object, camera, controls, and viewer handle. The engine-agnostic core
|
|
914
|
-
* instantiates it with its interfaces (`IObject3D`/`ICamera`/…); the public
|
|
915
|
-
* surface instantiates it with the concrete Three.js types. Keeping a single
|
|
916
|
-
* generic definition is what stops the two instantiations from drifting apart.
|
|
917
|
-
*/
|
|
918
392
|
declare interface ViewerEventMap_2<TObject, TCamera, TControls, THandle> {
|
|
919
393
|
'initialized': {
|
|
920
394
|
viewer: THandle;
|
|
@@ -925,7 +399,6 @@ declare interface ViewerEventMap_2<TObject, TCamera, TControls, THandle> {
|
|
|
925
399
|
'model:loading': {
|
|
926
400
|
url: string;
|
|
927
401
|
};
|
|
928
|
-
/** Download progress for URL loads; emitted only when the server reports a total size. */
|
|
929
402
|
'model:progress': {
|
|
930
403
|
url: string;
|
|
931
404
|
loaded: number;
|
|
@@ -959,7 +432,6 @@ declare interface ViewerEventMap_2<TObject, TCamera, TControls, THandle> {
|
|
|
959
432
|
camera?: TCamera;
|
|
960
433
|
controls?: TControls;
|
|
961
434
|
};
|
|
962
|
-
/** A click (not a drag) hit the loaded model; `point` is the world-space hit. */
|
|
963
435
|
'object:selected': {
|
|
964
436
|
object: TObject;
|
|
965
437
|
point: Vec3Like;
|
|
@@ -969,44 +441,8 @@ declare interface ViewerEventMap_2<TObject, TCamera, TControls, THandle> {
|
|
|
969
441
|
};
|
|
970
442
|
}
|
|
971
443
|
|
|
972
|
-
/**
|
|
973
|
-
* A one-word visual preset that sets the background, tone-mapping exposure and
|
|
974
|
-
* environment intensity as a cohesive "look", so a model looks intentional on
|
|
975
|
-
* first paint with zero manual tuning. Set it on `SimpleViewerOptions.preset`
|
|
976
|
-
* (or the `preset` prop). Presets apply live, so switching one never rebuilds
|
|
977
|
-
* the viewer or reloads the model. Any explicit option you pass overrides it.
|
|
978
|
-
*
|
|
979
|
-
* - `studio` — clean, neutral light-grey backdrop; the balanced default look.
|
|
980
|
-
* - `product` — bright, high-key white backdrop for e-commerce hero shots.
|
|
981
|
-
* - `neutral` — flat, even, low-drama lighting for accurate inspection.
|
|
982
|
-
* - `dark` — dramatic dark backdrop for portfolios and glossy materials.
|
|
983
|
-
* - `outdoor` — brighter, daylight-leaning sky tint.
|
|
984
|
-
*
|
|
985
|
-
* Path-traced output is a construction-time render mode (`pathTracing.enabled`),
|
|
986
|
-
* not a live-switchable preset.
|
|
987
|
-
*/
|
|
988
444
|
export declare type ViewerPreset = 'studio' | 'product' | 'neutral' | 'dark' | 'outdoor';
|
|
989
445
|
|
|
990
|
-
/**
|
|
991
|
-
* A one-word scene that selects the physical SET the model stands in — the
|
|
992
|
-
* floor, the backdrop geometry and how the built-in studio environment is
|
|
993
|
-
* built. Set it on `SimpleViewerOptions.scene`. The scene is the structural
|
|
994
|
-
* counterpart of the tonal `preset` axis: presets grade the picture live,
|
|
995
|
-
* scenes swap the set (switching one rebuilds the viewer). Any explicit
|
|
996
|
-
* option you pass overrides the scene's values.
|
|
997
|
-
*
|
|
998
|
-
* - `studio_dome` — the default set: invisible shadow-catcher floor, baked
|
|
999
|
-
* soft contact shadow, crisp contrast-pushed studio environment (distinct
|
|
1000
|
-
* highlights on glossy materials) and the path-traced infinity dome.
|
|
1001
|
-
* - `studio_soft` — the same set lit softly: the studio environment is used
|
|
1002
|
-
* as-built, without the contrast push, plus a rebalanced rig (the key steps
|
|
1003
|
-
* back, the rim edge nearly goes, the fill opens the shadows) for an even,
|
|
1004
|
-
* low-drama read that flatters matte materials.
|
|
1005
|
-
* - `outdoor_concrete` — open air: a real daylight HDRI lights the model and
|
|
1006
|
-
* paints the sky, standing on a large matte concrete ground disc. The HDRI
|
|
1007
|
-
* is fetched from a CDN by default (the one network request this scene
|
|
1008
|
-
* makes); pass your own `environment.url` to override or self-host it.
|
|
1009
|
-
*/
|
|
1010
446
|
export declare type ViewerScene = 'studio_dome' | 'studio_soft' | 'outdoor_concrete';
|
|
1011
447
|
|
|
1012
448
|
export { }
|