@oeave/bakery3 0.0.0-stage → 0.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/LICENSE +21 -0
- package/README.md +562 -2
- package/dist/animation-B1h0Ryvj.d.ts +97 -0
- package/dist/bake/index.d.ts +369 -0
- package/dist/bake/index.js +9 -0
- package/dist/bake/index.js.map +1 -0
- package/dist/bake-DaOlenyx.d.ts +1357 -0
- package/dist/catalog/index.d.ts +100 -0
- package/dist/catalog/index.js +154 -0
- package/dist/catalog/index.js.map +1 -0
- package/dist/catalog.gen-BM-aNf7n.d.ts +733 -0
- package/dist/chunk-25ZXSVQ3.js +1107 -0
- package/dist/chunk-25ZXSVQ3.js.map +1 -0
- package/dist/chunk-3G5QL4F4.js +145 -0
- package/dist/chunk-3G5QL4F4.js.map +1 -0
- package/dist/chunk-4E5VV4QY.js +12 -0
- package/dist/chunk-4E5VV4QY.js.map +1 -0
- package/dist/chunk-54WJDN5R.js +3286 -0
- package/dist/chunk-54WJDN5R.js.map +1 -0
- package/dist/chunk-6NYR73Y7.js +832 -0
- package/dist/chunk-6NYR73Y7.js.map +1 -0
- package/dist/chunk-6YVQANMW.js +1463 -0
- package/dist/chunk-6YVQANMW.js.map +1 -0
- package/dist/chunk-AF5BIELI.js +70 -0
- package/dist/chunk-AF5BIELI.js.map +1 -0
- package/dist/chunk-APBOWWSV.js +92 -0
- package/dist/chunk-APBOWWSV.js.map +1 -0
- package/dist/chunk-ARMTTZXZ.js +1157 -0
- package/dist/chunk-ARMTTZXZ.js.map +1 -0
- package/dist/chunk-CX4WTVGH.js +4492 -0
- package/dist/chunk-CX4WTVGH.js.map +1 -0
- package/dist/chunk-HQTUFVMM.js +1412 -0
- package/dist/chunk-HQTUFVMM.js.map +1 -0
- package/dist/chunk-MD2U6S4N.js +1952 -0
- package/dist/chunk-MD2U6S4N.js.map +1 -0
- package/dist/chunk-S4AJTLLN.js +23 -0
- package/dist/chunk-S4AJTLLN.js.map +1 -0
- package/dist/chunk-TGFNQBKC.js +551 -0
- package/dist/chunk-TGFNQBKC.js.map +1 -0
- package/dist/chunk-V3QINEEG.js +87 -0
- package/dist/chunk-V3QINEEG.js.map +1 -0
- package/dist/chunk-W6WQ5UP7.js +91 -0
- package/dist/chunk-W6WQ5UP7.js.map +1 -0
- package/dist/chunk-WBIAFIHV.js +346 -0
- package/dist/chunk-WBIAFIHV.js.map +1 -0
- package/dist/chunk-ZEBVAIJJ.js +156 -0
- package/dist/chunk-ZEBVAIJJ.js.map +1 -0
- package/dist/devtools/index.d.ts +536 -0
- package/dist/devtools/index.js +15 -0
- package/dist/devtools/index.js.map +1 -0
- package/dist/environments/index.d.ts +93 -0
- package/dist/environments/index.js +382 -0
- package/dist/environments/index.js.map +1 -0
- package/dist/hotspots/index.d.ts +111 -0
- package/dist/hotspots/index.js +285 -0
- package/dist/hotspots/index.js.map +1 -0
- package/dist/index.d.ts +944 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/node/index.cjs +5115 -0
- package/dist/node/index.cjs.map +1 -0
- package/dist/node/index.d.cts +4862 -0
- package/dist/node/index.d.ts +576 -0
- package/dist/node/index.js +1279 -0
- package/dist/node/index.js.map +1 -0
- package/dist/prepare-C5qVvaw4.d.ts +112 -0
- package/dist/presets/index.d.ts +526 -0
- package/dist/presets/index.js +14 -0
- package/dist/presets/index.js.map +1 -0
- package/dist/r3f/index.d.ts +159 -0
- package/dist/r3f/index.js +592 -0
- package/dist/r3f/index.js.map +1 -0
- package/dist/room-S5TLCK4F.js +9 -0
- package/dist/room-S5TLCK4F.js.map +1 -0
- package/dist/rooms.gen-vhj6sFW5.d.ts +1434 -0
- package/dist/session-YCQS4MRH.js +9 -0
- package/dist/session-YCQS4MRH.js.map +1 -0
- package/dist/shapes/index.d.ts +222 -0
- package/dist/shapes/index.js +836 -0
- package/dist/shapes/index.js.map +1 -0
- package/dist/testRun-BIPXaVPb.d.ts +1130 -0
- package/dist/timeline-ChwgD7bT.d.ts +470 -0
- package/dist/tsl/index.d.ts +165 -0
- package/dist/tsl/index.js +310 -0
- package/dist/tsl/index.js.map +1 -0
- package/package.json +170 -4
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
import { P as PedestalPresetName, M as MaterialPresetName, a as PresetTextureSize, H as HdriPresetName } from '../catalog.gen-BM-aNf7n.js';
|
|
2
|
+
export { b as HDRI_PRESETS, c as HdriPresetInfo, d as MATERIAL_PRESETS, e as MaterialPresetInfo, f as PEDESTAL_PRESETS, g as PedestalPresetInfo, h as PresetMapName } from '../catalog.gen-BM-aNf7n.js';
|
|
3
|
+
import { Group, ColorRepresentation, MeshStandardMaterial, DataTexture, Texture, Object3D, Vector3, PerspectiveCamera } from 'three';
|
|
4
|
+
import { a as RoomPresetLighting, R as RoomPresetName } from '../rooms.gen-vhj6sFW5.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Where the preset library is served from.
|
|
8
|
+
*
|
|
9
|
+
* A leaf on purpose: the bake session needs the base URL to fetch a preset
|
|
10
|
+
* room's lightmaps, and importing it from the presets entry would drag the
|
|
11
|
+
* room loader (GLTFLoader, GroundedSkybox) into every bundle that bakes.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Point the SDK at another copy of the preset library, for self-hosting or a
|
|
15
|
+
* local mirror. The host must send CORS headers: the SDK reads texture pixels
|
|
16
|
+
* back when it builds a manifest.
|
|
17
|
+
*/
|
|
18
|
+
declare function setPresetBaseUrl(url: string): void;
|
|
19
|
+
declare function presetBaseUrl(): string;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The implementation behind `@oeave/bakery3/presets`: materials, HDR
|
|
23
|
+
* environments, the parametric room and pedestals. `index.ts` lists what is
|
|
24
|
+
* public.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
type PresetEnvironmentOptions = {
|
|
28
|
+
/** Override the preset CDN, primarily for a local development server. */
|
|
29
|
+
baseUrl?: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Load the lightweight HDR preview while registering the EXR render master
|
|
33
|
+
* with the core SDK. Assign the returned texture to `scene.environment` (and
|
|
34
|
+
* optionally `scene.background`); render with
|
|
35
|
+
* `background: { type: 'environment' }` when the rendered output should show it.
|
|
36
|
+
* captureScene sends only the master URL, so the browser never downloads or
|
|
37
|
+
* uploads the EXR.
|
|
38
|
+
*/
|
|
39
|
+
declare function loadPresetEnvironment(name: HdriPresetName, options?: PresetEnvironmentOptions): Promise<Texture>;
|
|
40
|
+
type SkyEnvironmentOptions = {
|
|
41
|
+
/** Straight overhead. Default a deep clear-day blue. */
|
|
42
|
+
zenith?: ColorRepresentation;
|
|
43
|
+
/**
|
|
44
|
+
* At the horizon, where most of the light that comes through a window
|
|
45
|
+
* comes from. Default a saturated sky blue: a paler, more physical horizon
|
|
46
|
+
* vanishes against a room's sun.
|
|
47
|
+
*/
|
|
48
|
+
horizon?: ColorRepresentation;
|
|
49
|
+
/** Below the horizon: the ground's bounce. Default a warm gray. */
|
|
50
|
+
ground?: ColorRepresentation;
|
|
51
|
+
/**
|
|
52
|
+
* Multiplies the whole dome. 1 is a clear sky at exposure 0 seen through
|
|
53
|
+
* the window; a room that is also lit by a sun of 3 to 4 wants 4 to 6
|
|
54
|
+
* here before its shade turns cool, because the physical ratio between
|
|
55
|
+
* sun and sky is far larger than a single exposure can hold.
|
|
56
|
+
*/
|
|
57
|
+
intensity?: number;
|
|
58
|
+
/** Equirect width in pixels; height is half. A gradient needs no more than the default 128. */
|
|
59
|
+
width?: number;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* A sky to put outside the windows.
|
|
63
|
+
*
|
|
64
|
+
* A room with windows lit by a studio probe is lit by a studio through its
|
|
65
|
+
* windows, and it shows: the light that comes in is neutral, and the cool
|
|
66
|
+
* cast a real window throws (the blue of the sky against the warmth of the
|
|
67
|
+
* sun) is missing. This is a generated equirectangular gradient (blue
|
|
68
|
+
* overhead, paling to the horizon, a warm ground below) as an ordinary
|
|
69
|
+
* `DataTexture`, so `scene.environment = createSkyEnvironment()` lights the
|
|
70
|
+
* preview through PMREM like any HDRI, and the SDK ships the same pixels to
|
|
71
|
+
* the render as a small Radiance file: no download, no CDN.
|
|
72
|
+
*
|
|
73
|
+
* It is a sky, not a sun: pair it with `createRoom({ sun })`, which carries
|
|
74
|
+
* the crisp shadows. A room with a closed ceiling only ever sees this
|
|
75
|
+
* through its openings, which is the point.
|
|
76
|
+
*/
|
|
77
|
+
declare function createSkyEnvironment(options?: SkyEnvironmentOptions): DataTexture;
|
|
78
|
+
type PresetMaterialOptions = {
|
|
79
|
+
/** Texture resolution to load. 2k is the web default; 4k for close-ups. */
|
|
80
|
+
size?: PresetTextureSize;
|
|
81
|
+
/** Override the CDN base for this material only. */
|
|
82
|
+
baseUrl?: string;
|
|
83
|
+
/** Extra multiplier on the physical repeat (2 = pattern twice as dense). */
|
|
84
|
+
repeat?: number;
|
|
85
|
+
/** Skip the AO map (it needs a second render bounce to matter less). */
|
|
86
|
+
ao?: boolean;
|
|
87
|
+
anisotropy?: number;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* A MeshStandardMaterial wired to a preset's baked maps. Returns
|
|
91
|
+
* synchronously; textures stream in and the material fills out as they
|
|
92
|
+
* arrive (use loadPresetMaterial to await them). Tint `matte_paint`, or
|
|
93
|
+
* any preset, with `material.color`.
|
|
94
|
+
*/
|
|
95
|
+
declare function createPresetMaterial(name: MaterialPresetName, options?: PresetMaterialOptions): MeshStandardMaterial;
|
|
96
|
+
/** createPresetMaterial, resolved once every map has actually loaded. */
|
|
97
|
+
declare function loadPresetMaterial(name: MaterialPresetName, options?: PresetMaterialOptions): Promise<MeshStandardMaterial>;
|
|
98
|
+
type WindowSpec = {
|
|
99
|
+
/**
|
|
100
|
+
* Meters along the wall from its center; positive is to your right as you
|
|
101
|
+
* face the wall from inside the room. Default 0 (centered).
|
|
102
|
+
*/
|
|
103
|
+
offset?: number;
|
|
104
|
+
/** Opening width in meters. Default 1.2. */
|
|
105
|
+
width?: number;
|
|
106
|
+
/** Opening height in meters. Default 1.4. */
|
|
107
|
+
height?: number;
|
|
108
|
+
/** Meters from the floor to the bottom of the opening. Default 0.9. */
|
|
109
|
+
sill?: number;
|
|
110
|
+
/** Painted frame in the opening. Default true. */
|
|
111
|
+
frame?: boolean;
|
|
112
|
+
/** Glass pane (MeshPhysicalMaterial, transmission 1). Default false. */
|
|
113
|
+
glass?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Leaves outside the opening, so sun through it arrives dappled rather
|
|
116
|
+
* than as one hard rectangle, the way a window with something outside it
|
|
117
|
+
* does. Default true. Ordinary leaf geometry: it shows through the glass
|
|
118
|
+
* and traces like any other mesh.
|
|
119
|
+
*/
|
|
120
|
+
foliage?: boolean;
|
|
121
|
+
};
|
|
122
|
+
type RoomWallName = 'north' | 'south' | 'west' | 'east';
|
|
123
|
+
type SunOptions = {
|
|
124
|
+
/** Degrees above the horizon. Default 32. */
|
|
125
|
+
elevation?: number;
|
|
126
|
+
/**
|
|
127
|
+
* Degrees clockwise from north (the −z wall) as seen from above. Default
|
|
128
|
+
* 0: straight through a north-wall window.
|
|
129
|
+
*/
|
|
130
|
+
azimuth?: number;
|
|
131
|
+
/** Light intensity. Default 3.5. */
|
|
132
|
+
intensity?: number;
|
|
133
|
+
color?: ColorRepresentation;
|
|
134
|
+
/**
|
|
135
|
+
* Angular diameter in degrees: how crisp the shadows trace. Default 0.53,
|
|
136
|
+
* the real sun: a leaf two meters outside still draws a leaf on the floor.
|
|
137
|
+
* Without it the renderer's default is a studio-soft 12°, which turns sun
|
|
138
|
+
* through a window into a glow and a canopy into mottling.
|
|
139
|
+
*/
|
|
140
|
+
angleDeg?: number;
|
|
141
|
+
};
|
|
142
|
+
type RoomOptions = {
|
|
143
|
+
/** Meters. Defaults: 4 × 4 × 2.7. */
|
|
144
|
+
width?: number;
|
|
145
|
+
depth?: number;
|
|
146
|
+
height?: number;
|
|
147
|
+
floor?: MaterialPresetName;
|
|
148
|
+
walls?: MaterialPresetName;
|
|
149
|
+
/** Pass null for an open ceiling (studio lighting from above). */
|
|
150
|
+
ceiling?: MaterialPresetName | null;
|
|
151
|
+
/** Wall thickness in meters: the depth of window reveals. Default 0.15. */
|
|
152
|
+
wallThickness?: number;
|
|
153
|
+
/**
|
|
154
|
+
* Window openings per wall. north is the −z wall; offsets are measured to
|
|
155
|
+
* your right as you face each wall from inside.
|
|
156
|
+
*/
|
|
157
|
+
windows?: Partial<Record<RoomWallName, WindowSpec | readonly WindowSpec[]>>;
|
|
158
|
+
/**
|
|
159
|
+
* Add a shadow-casting sun outside the room. Aim it through a window
|
|
160
|
+
* (azimuth 0 = through the north wall) and the render traces real daylight
|
|
161
|
+
* falling in; the WebGL preview shows the same shafts, because every
|
|
162
|
+
* room surface casts shadows.
|
|
163
|
+
*/
|
|
164
|
+
sun?: SunOptions | true;
|
|
165
|
+
materialOptions?: PresetMaterialOptions;
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* An interior shell: floor at y = 0, centered on the origin, every surface
|
|
169
|
+
* facing inward (from outside the walls are backface-culled, which makes
|
|
170
|
+
* orbiting and debugging pleasant, but they still block light: traced
|
|
171
|
+
* geometry is two-sided, and the preview shadow pass renders both sides).
|
|
172
|
+
*
|
|
173
|
+
* Structure, all by name so surfaces can be restyled or removed:
|
|
174
|
+
* floor, ceiling: meshes
|
|
175
|
+
* wall-north (−z), wall-south, wall-west, wall-east: groups holding a
|
|
176
|
+
* 'face' mesh plus 'window-N' groups (reveal-*, frame and glass
|
|
177
|
+
* meshes, and a 'foliage' group, the canopy outside, on by default)
|
|
178
|
+
* sun: when requested, a group holding 'sun-light' and its aim target
|
|
179
|
+
*/
|
|
180
|
+
declare function createRoom(options?: RoomOptions): Group;
|
|
181
|
+
type PedestalOptions = {
|
|
182
|
+
/** Which pedestal. Default `pedestal_block`; or pass the name first. */
|
|
183
|
+
type?: PedestalPresetName;
|
|
184
|
+
material?: MaterialPresetName;
|
|
185
|
+
materialOptions?: PresetMaterialOptions;
|
|
186
|
+
baseUrl?: string;
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* A pedestal from `createPedestal()`: a plain three.js `Group`, with what a
|
|
190
|
+
* page needs from it typed on `userData`. Anything else on `userData` is
|
|
191
|
+
* yours, as on any object.
|
|
192
|
+
*/
|
|
193
|
+
interface PresetPedestal extends Group {
|
|
194
|
+
userData: {
|
|
195
|
+
/**
|
|
196
|
+
* The resting height for what it displays, in meters:
|
|
197
|
+
* `product.position.y = pedestal.userData.topY`.
|
|
198
|
+
*/
|
|
199
|
+
topY: number;
|
|
200
|
+
/**
|
|
201
|
+
* Resolves with the pedestal once its model is in. Await it before a
|
|
202
|
+
* render: one started earlier gets an empty group.
|
|
203
|
+
*/
|
|
204
|
+
ready: Promise<PresetPedestal>;
|
|
205
|
+
[key: string]: any;
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* A pedestal with a preset material, base at y = 0. Returns a Group
|
|
210
|
+
* immediately; the mesh streams in (await `userData.ready` to know when).
|
|
211
|
+
* `userData.topY` is the resting height for whatever it displays:
|
|
212
|
+
* `product.position.y = pedestal.userData.topY` and the product sits on it.
|
|
213
|
+
*
|
|
214
|
+
* createPedestal('pedestal_column', { material: 'carrara_marble' });
|
|
215
|
+
* createPedestal({ type: 'pedestal_column', material: 'carrara_marble' });
|
|
216
|
+
*/
|
|
217
|
+
declare function createPedestal(type: PedestalPresetName, options?: Omit<PedestalOptions, 'type'>): PresetPedestal;
|
|
218
|
+
declare function createPedestal(options?: PedestalOptions): PresetPedestal;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* A preset room lit by its own library lightmaps, the moment it is added.
|
|
222
|
+
*
|
|
223
|
+
* A room that has been prebaked under a lighting mode (`ROOM_PRESETS[name]
|
|
224
|
+
* .prebaked`) has its light on the preset CDN already: the same bundle a
|
|
225
|
+
* product bake in `room: 'preset'` mode stands on. `createPresetRoom` applies
|
|
226
|
+
* it to the stand-in through a bake session of the room's own, so the
|
|
227
|
+
* viewport shows traced bounce and contact shadows before anyone bakes
|
|
228
|
+
* anything, and costs nothing but the download.
|
|
229
|
+
*
|
|
230
|
+
* Two sessions, one set of materials. A developer's own bake session covers
|
|
231
|
+
* the whole scene, room included, and a bundle that stands its product in a
|
|
232
|
+
* preset room lays the same room lightmaps down again under its own. Two
|
|
233
|
+
* patches on one material would each record the other's edit as the thing to
|
|
234
|
+
* restore. So the room's patch is registered here, and a session about to
|
|
235
|
+
* light any of the room's objects suspends it first and resumes it after its
|
|
236
|
+
* own patch is gone: always nested, never interleaved.
|
|
237
|
+
*
|
|
238
|
+
* Only an unmodified room is lit this way, by the same rule the bake uses
|
|
239
|
+
* (`roomPrebakeChanges`): the library's light is a photograph of one
|
|
240
|
+
* arrangement, and another floor or another view outside is another light.
|
|
241
|
+
*/
|
|
242
|
+
|
|
243
|
+
/** What `createPresetRoom` resolves `userData.prebaked` to. */
|
|
244
|
+
type PresetRoomPrebake = {
|
|
245
|
+
/** Room surfaces that took their lightmap. */
|
|
246
|
+
applied: number;
|
|
247
|
+
/** Surfaces the library lit that found no mesh here: a stand-in that
|
|
248
|
+
* changed since the prebake. */
|
|
249
|
+
unmatched: number;
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* Show or hide a preset room's library lightmaps. Off, the room is lit by its
|
|
253
|
+
* stand-in lights alone, exactly as it was created; on puts them back. A room
|
|
254
|
+
* that was never prebaked is left as it is.
|
|
255
|
+
*/
|
|
256
|
+
declare function setPresetRoomPrebaked(room: Object3D, on: boolean): void;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Room presets: a staged interior around the product, in one call.
|
|
260
|
+
*
|
|
261
|
+
* import { createPresetRoom, applyPresetRoomCamera } from '@oeave/bakery3/presets';
|
|
262
|
+
*
|
|
263
|
+
* const room = createPresetRoom('loft_golden', {
|
|
264
|
+
* walls: { material: 'white_plaster', color: '#e9dfd0' },
|
|
265
|
+
* pedestal: 'pedestal_column',
|
|
266
|
+
* });
|
|
267
|
+
* scene.add(room);
|
|
268
|
+
* product.position.copy(room.userData.stand); // on the pedestal
|
|
269
|
+
* applyPresetRoomCamera(camera, room); // the published framing
|
|
270
|
+
* renderer.toneMappingExposure = room.userData.exposure; // as bright as designed
|
|
271
|
+
*
|
|
272
|
+
* What the browser gets is a stand-in: one compressed GLB from the preset
|
|
273
|
+
* CDN (a few MB: furniture with 1k textures, the shell wearing the same
|
|
274
|
+
* preset materials `createPresetMaterial` serves, a sun and a hemisphere
|
|
275
|
+
* fill). It is there so the product can be framed inside the room. None of
|
|
276
|
+
* it is captured. The manifest carries a small record instead (which room,
|
|
277
|
+
* which build, which lighting, which surfaces, which stand, the group's
|
|
278
|
+
* matrix) and the render worker rebuilds the whole set from its own
|
|
279
|
+
* full-resolution copy: 4k maps, the full geometry, the foliage outside the
|
|
280
|
+
* glass that dapples the sun, the light fixtures, the portals, the haze. A
|
|
281
|
+
* product in a room therefore uploads exactly what a bare product uploads.
|
|
282
|
+
*
|
|
283
|
+
* Two things follow. The foliage and the light rig are never in the
|
|
284
|
+
* preview, so the traced image is meant to be richer than the viewport, not
|
|
285
|
+
* identical to it, and the compatibility report says so once, as an info
|
|
286
|
+
* item, at capture. And a room's lights and sky replace the scene's
|
|
287
|
+
* environment for the render: the room owns its daylight.
|
|
288
|
+
*/
|
|
289
|
+
|
|
290
|
+
/** A preset material, optionally tinted (plaster and paint take a tint well). */
|
|
291
|
+
type RoomSurfaceOption = MaterialPresetName | {
|
|
292
|
+
material: MaterialPresetName;
|
|
293
|
+
color?: string;
|
|
294
|
+
};
|
|
295
|
+
type PresetRoomOptions = {
|
|
296
|
+
/** Day, golden, overcast or night. Defaults to the mode the room was designed under. */
|
|
297
|
+
lighting?: RoomPresetLighting;
|
|
298
|
+
floor?: RoomSurfaceOption;
|
|
299
|
+
walls?: RoomSurfaceOption;
|
|
300
|
+
ceiling?: RoomSurfaceOption;
|
|
301
|
+
/** Window sills: stone or timber. Never tinted. */
|
|
302
|
+
sill?: MaterialPresetName;
|
|
303
|
+
/**
|
|
304
|
+
* What the product stands on: a pedestal preset, or `null` for the floor.
|
|
305
|
+
* Defaults to the room's own stand.
|
|
306
|
+
*/
|
|
307
|
+
pedestal?: PedestalPresetName | null;
|
|
308
|
+
/** The pedestal's material. A room whose own stand is a table keeps the
|
|
309
|
+
* table's finish. */
|
|
310
|
+
pedestalMaterial?: MaterialPresetName;
|
|
311
|
+
/**
|
|
312
|
+
* Preview lights: the room's sun through its windows, a hemisphere fill,
|
|
313
|
+
* whatever fixtures the published rig had. Default true. Off, the group is
|
|
314
|
+
* geometry only, for an app that lights its own viewport.
|
|
315
|
+
*/
|
|
316
|
+
lights?: boolean;
|
|
317
|
+
/**
|
|
318
|
+
* Make the room bakeable. The stand-in's surfaces (floor, walls, ceiling,
|
|
319
|
+
* sills, the stand, the furniture) then ship in the capture like any mesh,
|
|
320
|
+
* so `bake()` lists them and the bake lightmaps the room itself:
|
|
321
|
+
* contact shadows under the product, bounce on the walls. The renderer
|
|
322
|
+
* still owns the light (sky, sun, portals, foliage, fixtures) and builds no
|
|
323
|
+
* shell of its own around the shipped one. Off by default: a plain render
|
|
324
|
+
* of a room uploads only the product.
|
|
325
|
+
*/
|
|
326
|
+
bake?: boolean;
|
|
327
|
+
/**
|
|
328
|
+
* What is outside the windows. By default the map the room was published
|
|
329
|
+
* with for its mode: its 1k preview on a dome projected onto the ground,
|
|
330
|
+
* so the view through the glass has a horizon and a floor, turned so the
|
|
331
|
+
* map's sun sits where the room's sun is. Name another `HDRI_PRESETS`
|
|
332
|
+
* entry to put that one there instead (the render turns it to the room's
|
|
333
|
+
* sun the same way), or `false` for nothing outside: the mode's plain sky,
|
|
334
|
+
* in the viewport and in the render alike.
|
|
335
|
+
* The dome never ships; the render builds its own from the 4k master.
|
|
336
|
+
*
|
|
337
|
+
* The dome is 60 m out, so the camera's `far` must reach past it (100 is
|
|
338
|
+
* plenty) or the sky is clipped to black. The console says so once.
|
|
339
|
+
* The render also lays aerial perspective over the distance when the room
|
|
340
|
+
* was published with air; the stand-in shows the map as shot.
|
|
341
|
+
*/
|
|
342
|
+
hdri?: HdriPresetName | false;
|
|
343
|
+
/**
|
|
344
|
+
* Let the room ask a bake to stand in for its own heavy pieces: a box
|
|
345
|
+
* where a shelf of books is, a low-poly planter and a flat card where a
|
|
346
|
+
* plant is. Default true, and it only ever applies to a bake that is
|
|
347
|
+
* covering the room's own surfaces.
|
|
348
|
+
*
|
|
349
|
+
* It is the room's geometry, so the room says how it would like to be
|
|
350
|
+
* stood in for. `false` bakes every piece as it is, which is what a bundle
|
|
351
|
+
* shared between pages wants: a card is drawn from one side, and a bundle
|
|
352
|
+
* everybody downloads has to hold up from all of them.
|
|
353
|
+
*/
|
|
354
|
+
simplify?: boolean;
|
|
355
|
+
/**
|
|
356
|
+
* Your own images in the room's frames, one per picture it hangs, in the
|
|
357
|
+
* order it hangs them (`ROOM_PRESETS[name].pictures` lists them). A URL
|
|
358
|
+
* the page can fetch, or a `Blob` you already have; `null` leaves that
|
|
359
|
+
* frame as published, and a short list leaves the rest.
|
|
360
|
+
*
|
|
361
|
+
* The frame stays where it is and the image is cropped to fill it, the
|
|
362
|
+
* way `object-fit: cover` fills a box, so a portrait photograph in a
|
|
363
|
+
* landscape frame is centred and cropped rather than letterboxed.
|
|
364
|
+
*/
|
|
365
|
+
pictures?: ReadonlyArray<PresetRoomPicture | null>;
|
|
366
|
+
/**
|
|
367
|
+
* Light the room with its prebaked lightmaps, when the library has them
|
|
368
|
+
* for this lighting mode (`ROOM_PRESETS[name].prebaked`). Default true.
|
|
369
|
+
* They arrive after `userData.ready`, and `userData.prebaked` resolves
|
|
370
|
+
* when they are on (or `null` when there are none). The room must be
|
|
371
|
+
* unmodified: another floor, walls, ceiling, sill, map outside or stand is
|
|
372
|
+
* other light, so the room keeps its preview lights. `false` never
|
|
373
|
+
* downloads them; `setPresetRoomPrebaked(room, false)` turns them off.
|
|
374
|
+
*/
|
|
375
|
+
prebaked?: boolean;
|
|
376
|
+
baseUrl?: string;
|
|
377
|
+
materialOptions?: PresetMaterialOptions;
|
|
378
|
+
};
|
|
379
|
+
/**
|
|
380
|
+
* A room from `createPresetRoom()`: a plain three.js `Group`, with what a
|
|
381
|
+
* page needs from it typed on `userData`. Anything else on `userData` is
|
|
382
|
+
* yours, as on any object.
|
|
383
|
+
*/
|
|
384
|
+
interface PresetRoom extends Group {
|
|
385
|
+
userData: {
|
|
386
|
+
/**
|
|
387
|
+
* Where the product goes: the top of the stand, in the room's own
|
|
388
|
+
* frame. `product.position.copy(room.userData.stand)`.
|
|
389
|
+
*/
|
|
390
|
+
stand: Vector3;
|
|
391
|
+
/** The height of `stand`, in meters. */
|
|
392
|
+
topY: number;
|
|
393
|
+
/**
|
|
394
|
+
* The `toneMappingExposure` the room was designed under. Set the
|
|
395
|
+
* renderer to it and the room is as bright as its published pictures.
|
|
396
|
+
*/
|
|
397
|
+
exposure: number;
|
|
398
|
+
/**
|
|
399
|
+
* Resolves with the room once its stand-in is in. Await it before a
|
|
400
|
+
* render: one started earlier gets an empty room.
|
|
401
|
+
*/
|
|
402
|
+
ready: Promise<PresetRoom>;
|
|
403
|
+
/**
|
|
404
|
+
* Resolves when the room's own traced light is on (see the `prebaked`
|
|
405
|
+
* option), or with `null` when there is none for this room as it is.
|
|
406
|
+
*/
|
|
407
|
+
prebaked: Promise<PresetRoomPrebake | null>;
|
|
408
|
+
[key: string]: any;
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/** An image to hang: a URL the page can fetch, or bytes you already have. */
|
|
413
|
+
type PresetRoomPicture = string | Blob;
|
|
414
|
+
/**
|
|
415
|
+
* A staged room around the origin: floor at y = 0, north wall at −z. Returns
|
|
416
|
+
* a Group immediately; the stand-in streams in (`userData.ready` resolves
|
|
417
|
+
* when it has). `userData.stand` is where the product goes (the top of the
|
|
418
|
+
* pedestal, in the room's own frame) and `userData.topY` is its height.
|
|
419
|
+
* `userData.exposure` is the `toneMappingExposure` the room was designed
|
|
420
|
+
* under: the render honors whatever the renderer is set to, so a scene that
|
|
421
|
+
* adopts it gets the room as bright as its published pictures, and one that
|
|
422
|
+
* keeps exposure 1 gets a faithful picture about a stop darker.
|
|
423
|
+
*
|
|
424
|
+
* Every choice is remembered on `userData.bakery3Preset.roomPreset`, which is
|
|
425
|
+
* what the capture reads; move or rotate the group freely, the render
|
|
426
|
+
* rebuilds the room at its world matrix.
|
|
427
|
+
*/
|
|
428
|
+
declare function createPresetRoom(name: RoomPresetName, options?: PresetRoomOptions): PresetRoom;
|
|
429
|
+
/**
|
|
430
|
+
* Put `camera` where the room was published from (its own framing, aimed at
|
|
431
|
+
* the stand), in world space, wherever the group sits.
|
|
432
|
+
*/
|
|
433
|
+
declare function applyPresetRoomCamera(camera: PerspectiveCamera, room: Object3D): void;
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* The public face of the room catalog: `ROOM_PRESETS` as a developer reads
|
|
437
|
+
* it.
|
|
438
|
+
*
|
|
439
|
+
* The generated record (`rooms.gen.ts`) carries everything the SDK and the
|
|
440
|
+
* renderer agree on: the published build hash, the stand-in's file, the
|
|
441
|
+
* preview's brightness and colour per mode, the sky's irradiance, the scene
|
|
442
|
+
* complexity the estimator prices. None of that is anything a page decides
|
|
443
|
+
* with, and all of it changes whenever a room is published again, so the
|
|
444
|
+
* public type names only what a developer chooses or places by. The object
|
|
445
|
+
* is the same one; the SDK's own code reads the full record from
|
|
446
|
+
* `rooms.gen.ts`.
|
|
447
|
+
*/
|
|
448
|
+
|
|
449
|
+
/** A preset surface: a preset material and its tint. */
|
|
450
|
+
type RoomPresetSurface = {
|
|
451
|
+
readonly material: string;
|
|
452
|
+
readonly color: string;
|
|
453
|
+
};
|
|
454
|
+
/** What a preset room is, as `ROOM_PRESETS[name]` lists it. */
|
|
455
|
+
type RoomPresetInfo = {
|
|
456
|
+
/** Its name for people, for a picker. */
|
|
457
|
+
readonly label: string;
|
|
458
|
+
/** A sentence about it, for a picker. */
|
|
459
|
+
readonly description: string;
|
|
460
|
+
/** Meters. Floor at y = 0, centered on the origin; north is −z. */
|
|
461
|
+
readonly size: {
|
|
462
|
+
readonly width: number;
|
|
463
|
+
readonly height: number;
|
|
464
|
+
readonly depth: number;
|
|
465
|
+
};
|
|
466
|
+
/** The lighting mode the room was designed under; any of the four can be asked for. */
|
|
467
|
+
readonly lighting: RoomPresetLighting;
|
|
468
|
+
/** The surfaces it comes with, which `createPresetRoom()` options replace. */
|
|
469
|
+
readonly surfaces: {
|
|
470
|
+
readonly floor: RoomPresetSurface;
|
|
471
|
+
readonly walls: RoomPresetSurface;
|
|
472
|
+
readonly ceiling: RoomPresetSurface;
|
|
473
|
+
readonly sill: {
|
|
474
|
+
readonly material: string;
|
|
475
|
+
};
|
|
476
|
+
};
|
|
477
|
+
/** What the product stands on, where, and how high its top is. */
|
|
478
|
+
readonly stand: {
|
|
479
|
+
readonly type: string | null;
|
|
480
|
+
readonly material: string | null;
|
|
481
|
+
readonly x: number;
|
|
482
|
+
readonly z: number;
|
|
483
|
+
readonly rotationDeg: number;
|
|
484
|
+
readonly top: number;
|
|
485
|
+
/** three.js axes, meters. `null` when the room has no stand. */
|
|
486
|
+
readonly size: {
|
|
487
|
+
readonly x: number;
|
|
488
|
+
readonly y: number;
|
|
489
|
+
readonly z: number;
|
|
490
|
+
} | null;
|
|
491
|
+
};
|
|
492
|
+
/** The framing the room was designed with, in its own frame (`applyPresetRoomCamera`). */
|
|
493
|
+
readonly camera: {
|
|
494
|
+
readonly position: readonly [number, number, number];
|
|
495
|
+
readonly target: readonly [number, number, number];
|
|
496
|
+
readonly lensMm: number;
|
|
497
|
+
readonly fstop: number | null;
|
|
498
|
+
};
|
|
499
|
+
/**
|
|
500
|
+
* The pictures the room hangs, in the order it hangs them: which wall, and
|
|
501
|
+
* how long the image's longest side is in meters. `createPresetRoom({
|
|
502
|
+
* pictures })` fills them in this order.
|
|
503
|
+
*/
|
|
504
|
+
readonly pictures: readonly {
|
|
505
|
+
readonly wall: string;
|
|
506
|
+
readonly size: number;
|
|
507
|
+
}[];
|
|
508
|
+
/**
|
|
509
|
+
* The `toneMappingExposure` the room is designed for, per lighting mode;
|
|
510
|
+
* `createPresetRoom()` leaves the current mode's on `userData.exposure`.
|
|
511
|
+
*/
|
|
512
|
+
readonly exposure: Readonly<Record<RoomPresetLighting, number>>;
|
|
513
|
+
/**
|
|
514
|
+
* The lighting modes this room's own traced light is published for. In
|
|
515
|
+
* those, `createPresetRoom()` shows it in the viewport, and a bake of a
|
|
516
|
+
* product in the unmodified room covers only the product, its stand and
|
|
517
|
+
* its shadow. In the others a bake lights the whole room.
|
|
518
|
+
*/
|
|
519
|
+
readonly prebaked: readonly RoomPresetLighting[];
|
|
520
|
+
};
|
|
521
|
+
/** Every preset room, by name. */
|
|
522
|
+
declare const ROOM_PRESETS: {
|
|
523
|
+
readonly [Name in RoomPresetName]: RoomPresetInfo;
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
export { HdriPresetName, MaterialPresetName, type PedestalOptions, PedestalPresetName, type PresetEnvironmentOptions, type PresetMaterialOptions, type PresetPedestal, type PresetRoom, type PresetRoomOptions, type PresetRoomPicture, type PresetRoomPrebake, PresetTextureSize, ROOM_PRESETS, type RoomOptions, type RoomPresetInfo, RoomPresetLighting, RoomPresetName, type RoomSurfaceOption, type RoomWallName, type SkyEnvironmentOptions, type SunOptions, type WindowSpec, applyPresetRoomCamera, createPedestal, createPresetMaterial, createPresetRoom, createRoom, createSkyEnvironment, loadPresetEnvironment, loadPresetMaterial, presetBaseUrl, setPresetBaseUrl, setPresetRoomPrebaked };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { applyPresetRoomCamera, createPedestal, createPresetMaterial, createPresetRoom, createRoom, createSkyEnvironment, loadPresetEnvironment, loadPresetMaterial } from '../chunk-6YVQANMW.js';
|
|
2
|
+
import '../chunk-AF5BIELI.js';
|
|
3
|
+
export { presetBaseUrl, setPresetBaseUrl } from '../chunk-4E5VV4QY.js';
|
|
4
|
+
export { setPresetRoomPrebaked } from '../chunk-W6WQ5UP7.js';
|
|
5
|
+
export { HDRI_PRESETS, MATERIAL_PRESETS, PEDESTAL_PRESETS } from '../chunk-6NYR73Y7.js';
|
|
6
|
+
import { ROOM_PRESETS } from '../chunk-MD2U6S4N.js';
|
|
7
|
+
import '../chunk-3G5QL4F4.js';
|
|
8
|
+
|
|
9
|
+
// src/presets/roomCatalog.ts
|
|
10
|
+
var ROOM_PRESETS2 = ROOM_PRESETS;
|
|
11
|
+
|
|
12
|
+
export { ROOM_PRESETS2 as ROOM_PRESETS };
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/presets/roomCatalog.ts"],"names":["ROOM_PRESETS"],"mappings":";;;;;;;;;AA6FO,IAAMA,aAAAA,GAET","file":"index.js","sourcesContent":["/**\n * The public face of the room catalog: `ROOM_PRESETS` as a developer reads\n * it.\n *\n * The generated record (`rooms.gen.ts`) carries everything the SDK and the\n * renderer agree on: the published build hash, the stand-in's file, the\n * preview's brightness and colour per mode, the sky's irradiance, the scene\n * complexity the estimator prices. None of that is anything a page decides\n * with, and all of it changes whenever a room is published again, so the\n * public type names only what a developer chooses or places by. The object\n * is the same one; the SDK's own code reads the full record from\n * `rooms.gen.ts`.\n */\n\nimport {\n ROOM_PRESETS as ROOM_RECORDS,\n type RoomPresetLighting,\n type RoomPresetName,\n} from './rooms.gen.js';\n\n/** A preset surface: a preset material and its tint. */\nexport type RoomPresetSurface = {\n readonly material: string;\n readonly color: string;\n};\n\n/** What a preset room is, as `ROOM_PRESETS[name]` lists it. */\nexport type RoomPresetInfo = {\n /** Its name for people, for a picker. */\n readonly label: string;\n /** A sentence about it, for a picker. */\n readonly description: string;\n /** Meters. Floor at y = 0, centered on the origin; north is −z. */\n readonly size: {\n readonly width: number;\n readonly height: number;\n readonly depth: number;\n };\n /** The lighting mode the room was designed under; any of the four can be asked for. */\n readonly lighting: RoomPresetLighting;\n /** The surfaces it comes with, which `createPresetRoom()` options replace. */\n readonly surfaces: {\n readonly floor: RoomPresetSurface;\n readonly walls: RoomPresetSurface;\n readonly ceiling: RoomPresetSurface;\n readonly sill: { readonly material: string };\n };\n /** What the product stands on, where, and how high its top is. */\n readonly stand: {\n readonly type: string | null;\n readonly material: string | null;\n readonly x: number;\n readonly z: number;\n readonly rotationDeg: number;\n readonly top: number;\n /** three.js axes, meters. `null` when the room has no stand. */\n readonly size: {\n readonly x: number;\n readonly y: number;\n readonly z: number;\n } | null;\n };\n /** The framing the room was designed with, in its own frame (`applyPresetRoomCamera`). */\n readonly camera: {\n readonly position: readonly [number, number, number];\n readonly target: readonly [number, number, number];\n readonly lensMm: number;\n readonly fstop: number | null;\n };\n /**\n * The pictures the room hangs, in the order it hangs them: which wall, and\n * how long the image's longest side is in meters. `createPresetRoom({\n * pictures })` fills them in this order.\n */\n readonly pictures: readonly {\n readonly wall: string;\n readonly size: number;\n }[];\n /**\n * The `toneMappingExposure` the room is designed for, per lighting mode;\n * `createPresetRoom()` leaves the current mode's on `userData.exposure`.\n */\n readonly exposure: Readonly<Record<RoomPresetLighting, number>>;\n /**\n * The lighting modes this room's own traced light is published for. In\n * those, `createPresetRoom()` shows it in the viewport, and a bake of a\n * product in the unmodified room covers only the product, its stand and\n * its shadow. In the others a bake lights the whole room.\n */\n readonly prebaked: readonly RoomPresetLighting[];\n};\n\n/** Every preset room, by name. */\nexport const ROOM_PRESETS: {\n readonly [Name in RoomPresetName]: RoomPresetInfo;\n} = ROOM_RECORDS;\n"]}
|