@react-three/fiber 10.0.0-canary.494048e → 10.0.0-canary.4b18a0a
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/dist/extension.cjs +1 -1
- package/dist/extension.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +3 -3
- package/dist/legacy.cjs +2 -2
- package/dist/legacy.d.cts +2 -2
- package/dist/legacy.d.mts +2 -2
- package/dist/legacy.d.ts +2 -2
- package/dist/legacy.mjs +4 -4
- package/dist/shared/{fiber.BC5FRLu-.mjs → fiber.BdIbKbh7.mjs} +87 -73
- package/dist/shared/{fiber.DlH05gco.mjs → fiber.Biz9olEe.mjs} +100 -10
- package/dist/shared/{fiber.B_KQAb3I.d.ts → fiber.CtivZ3IY.d.ts} +7 -6
- package/dist/shared/{fiber.3jeDXXYd.d.mts → fiber.CvlK0a1Z.d.mts} +7 -6
- package/dist/shared/{fiber.CsZ092z_.cjs → fiber.DfiCufha.cjs} +104 -9
- package/dist/shared/{fiber.fR3DaJb1.d.cts → fiber.VTTQNnlj.d.cts} +7 -6
- package/dist/shared/{fiber.BybcfIwy.cjs → fiber.nDnBf1np.cjs} +88 -74
- package/dist/webgpu/index.cjs +2 -2
- package/dist/webgpu/index.d.cts +2 -2
- package/dist/webgpu/index.d.mts +2 -2
- package/dist/webgpu/index.d.ts +2 -2
- package/dist/webgpu/index.mjs +4 -4
- package/package.json +1 -1
|
@@ -131,6 +131,99 @@ function isDevelopment() {
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
+
const INTERNAL_LIB_MARKERS = [
|
|
135
|
+
"zustand",
|
|
136
|
+
"setState",
|
|
137
|
+
"Object.assign",
|
|
138
|
+
"@pmndrs/scheduler",
|
|
139
|
+
"Scheduler.tickRoot",
|
|
140
|
+
"Scheduler.stepJob"
|
|
141
|
+
];
|
|
142
|
+
function isInternalRendererAccess(stack, callerDepth = 2) {
|
|
143
|
+
if (!stack) return false;
|
|
144
|
+
const caller = stack.split("\n")[callerDepth] ?? "";
|
|
145
|
+
return INTERNAL_LIB_MARKERS.some((m) => caller.includes(m));
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const isAccessorDescriptor = (descriptor) => !!descriptor && (descriptor.get !== void 0 || descriptor.set !== void 0);
|
|
149
|
+
const isAccessor = (object, key) => isAccessorDescriptor(Object.getOwnPropertyDescriptor(object, key));
|
|
150
|
+
function cloneState(...sources) {
|
|
151
|
+
const target = {};
|
|
152
|
+
for (const source of sources) {
|
|
153
|
+
if (source) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
154
|
+
}
|
|
155
|
+
return target;
|
|
156
|
+
}
|
|
157
|
+
function preserveAccessors(rawSet, get) {
|
|
158
|
+
return ((partial, replace) => {
|
|
159
|
+
const previous = get();
|
|
160
|
+
const patch = typeof partial === "function" ? partial(previous) : partial;
|
|
161
|
+
if (replace || !previous || patch == null || Object.is(patch, previous)) {
|
|
162
|
+
return rawSet(patch, replace);
|
|
163
|
+
}
|
|
164
|
+
const next = cloneState(previous);
|
|
165
|
+
const viaSetter = [];
|
|
166
|
+
for (const key of Reflect.ownKeys(patch)) {
|
|
167
|
+
const descriptor = Object.getOwnPropertyDescriptor(patch, key);
|
|
168
|
+
if (!descriptor.enumerable) continue;
|
|
169
|
+
if (isAccessorDescriptor(descriptor)) {
|
|
170
|
+
Object.defineProperty(next, key, descriptor);
|
|
171
|
+
} else if (isAccessor(next, key)) {
|
|
172
|
+
viaSetter.push(key);
|
|
173
|
+
} else {
|
|
174
|
+
Object.defineProperty(next, key, {
|
|
175
|
+
value: descriptor.value,
|
|
176
|
+
writable: true,
|
|
177
|
+
enumerable: true,
|
|
178
|
+
configurable: true
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
for (const key of viaSetter) next[key] = patch[key];
|
|
183
|
+
rawSet(next, true);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
const keepAccessors = (initializer) => (rawSet, get, api) => {
|
|
187
|
+
const set = preserveAccessors(rawSet, get);
|
|
188
|
+
api.setState = set;
|
|
189
|
+
return initializer(set, get, api);
|
|
190
|
+
};
|
|
191
|
+
let glNoticeShown = false;
|
|
192
|
+
function defineRendererAccessors(state) {
|
|
193
|
+
Object.defineProperty(state, "gl", {
|
|
194
|
+
get() {
|
|
195
|
+
const renderer = this.internal?.actualRenderer;
|
|
196
|
+
if (!glNoticeShown && renderer && !this.isLegacy) {
|
|
197
|
+
const stack = new Error().stack || "";
|
|
198
|
+
if (!isInternalRendererAccess(stack)) {
|
|
199
|
+
glNoticeShown = true;
|
|
200
|
+
const cleanedStack = stack.split("\n").slice(2).join("\n") || "Stack trace unavailable";
|
|
201
|
+
notifyDepreciated({
|
|
202
|
+
heading: "Accessing state.gl in WebGPU mode",
|
|
203
|
+
body: "Please use state.renderer instead. state.gl is deprecated and will be removed in future versions.\n\nFor backwards compatibility, state.gl currently maps to state.renderer, but this may cause issues with libraries expecting WebGLRenderer.\n\nAccessed from:\n" + cleanedStack
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return renderer;
|
|
208
|
+
},
|
|
209
|
+
set(value) {
|
|
210
|
+
this.internal.actualRenderer = value;
|
|
211
|
+
},
|
|
212
|
+
enumerable: true,
|
|
213
|
+
configurable: true
|
|
214
|
+
});
|
|
215
|
+
Object.defineProperty(state, "renderer", {
|
|
216
|
+
get() {
|
|
217
|
+
return this.internal?.actualRenderer;
|
|
218
|
+
},
|
|
219
|
+
set(value) {
|
|
220
|
+
this.internal.actualRenderer = value;
|
|
221
|
+
},
|
|
222
|
+
enumerable: true,
|
|
223
|
+
configurable: true
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
134
227
|
const R3F_CONTEXT = Symbol.for("@react-three/fiber.context");
|
|
135
228
|
const context = globalThis[R3F_CONTEXT] ?? (globalThis[R3F_CONTEXT] = React.createContext(null));
|
|
136
229
|
|
|
@@ -242,15 +335,12 @@ function useFrame(callback, priorityOrOptions) {
|
|
|
242
335
|
});
|
|
243
336
|
}
|
|
244
337
|
const wrappedCallback = (frameState, delta) => {
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
frame: frameState.frame,
|
|
252
|
-
overstep: frameState.overstep
|
|
253
|
-
};
|
|
338
|
+
const mergedState = cloneState(store.getState());
|
|
339
|
+
mergedState.time = frameState.time;
|
|
340
|
+
mergedState.delta = frameState.delta;
|
|
341
|
+
mergedState.elapsed = frameState.elapsed;
|
|
342
|
+
mergedState.frame = frameState.frame;
|
|
343
|
+
mergedState.overstep = frameState.overstep;
|
|
254
344
|
callbackRef.current?.(mergedState, delta);
|
|
255
345
|
};
|
|
256
346
|
const unregister = scheduler.register(wrappedCallback, {
|
|
@@ -388,4 +478,4 @@ function getTextureView(store) {
|
|
|
388
478
|
return view;
|
|
389
479
|
}
|
|
390
480
|
|
|
391
|
-
export { Block as B, ErrorBoundary as E, useThree as a, useFrame as b, context as c, useIsomorphicLayoutEffect as d, useMutableCallback as e, useBridge as f, getTextureView as g,
|
|
481
|
+
export { Block as B, ErrorBoundary as E, useThree as a, useFrame as b, context as c, useIsomorphicLayoutEffect as d, useMutableCallback as e, useBridge as f, getTextureView as g, defineRendererAccessors as h, isDevelopment as i, detachRootExtensions as j, attachRootExtensions as k, unstageTextures as l, stageTextures as m, notifyDepreciated as n, isAccessor as o, preserveAccessors as p, cloneState as q, registerRootExtension as r, setRenderOverride as s, keepAccessors as t, useStore as u, useGate as v, notifyAlpha as w, notifyRootExtensionsHmr as x };
|
|
@@ -35,7 +35,7 @@ type PresetsType = keyof typeof presetsObj;
|
|
|
35
35
|
interface BackgroundConfig {
|
|
36
36
|
/** HDRI preset name: 'apartment', 'city', 'dawn', 'forest', 'lobby', 'night', 'park', 'studio', 'sunset', 'warehouse' */
|
|
37
37
|
preset?: PresetsType
|
|
38
|
-
/** Files for cube texture (6 faces) or single
|
|
38
|
+
/** Files for cube texture (6 faces) or a single equirect (.hdr, .exr, .jpg, .png, .webp, .avif, .gif) */
|
|
39
39
|
files?: string | string[]
|
|
40
40
|
/** Separate files for scene.background (visual backdrop) */
|
|
41
41
|
backgroundMap?: string | string[]
|
|
@@ -55,7 +55,7 @@ interface BackgroundConfig {
|
|
|
55
55
|
*
|
|
56
56
|
* String detection priority:
|
|
57
57
|
* 1. Preset - exact match against known presets (apartment, city, dawn, forest, lobby, night, park, studio, sunset, warehouse)
|
|
58
|
-
* 2. URL - starts with /, ./, ../, http://, https://, OR has image extension
|
|
58
|
+
* 2. URL - starts with /, ./, ../, http://, https://, data:, OR has an image extension (a query or hash may follow)
|
|
59
59
|
* 3. Color - default fallback (CSS color names, hex values, rgb(), etc.)
|
|
60
60
|
*
|
|
61
61
|
* @example Color
|
|
@@ -270,7 +270,7 @@ type EnvironmentLoaderClearOptions = Pick<EnvironmentLoaderProps, 'files' | 'pre
|
|
|
270
270
|
* - scale: Scale of backside projected sphere (default: 1000)
|
|
271
271
|
*
|
|
272
272
|
* Additional loader props:
|
|
273
|
-
* @property files - File path(s) for environment. Supports .hdr, .exr, Ultra HDR .
|
|
273
|
+
* @property files - File path(s) for environment. Supports .hdr, .exr, .jpg (Ultra HDR or plain), an LDR .png/.webp/.avif/.gif, or array of 6 cube faces
|
|
274
274
|
* @property path - Base path for file loading
|
|
275
275
|
* @property extensions - Texture extensions override
|
|
276
276
|
*/
|
|
@@ -313,8 +313,9 @@ type EnvironmentProps = {
|
|
|
313
313
|
declare function EnvironmentMap({ scene, background, map, ...config }: EnvironmentProps): null;
|
|
314
314
|
/**
|
|
315
315
|
* Internal component that loads environment textures from files or presets.
|
|
316
|
-
* Uses HDRLoader for .hdr, EXRLoader for .exr, UltraHDRLoader for .jpg/.jpeg
|
|
317
|
-
*
|
|
316
|
+
* Uses HDRLoader for .hdr, EXRLoader for .exr, UltraHDRLoader for .jpg/.jpeg (a JPEG without a gain
|
|
317
|
+
* map loads as a plain image), TextureLoader for an LDR .png/.webp/.avif/.gif, or CubeTextureLoader
|
|
318
|
+
* for arrays of images.
|
|
318
319
|
*
|
|
319
320
|
* @example With preset
|
|
320
321
|
* ```jsx
|
|
@@ -375,7 +376,7 @@ declare function EnvironmentPortal({ children, near, far, resolution, frames, ma
|
|
|
375
376
|
*
|
|
376
377
|
* Supports multiple input methods:
|
|
377
378
|
* - **Presets**: Selection of HDRI Haven assets (apartment, city, dawn, forest, lobby, night, park, studio, sunset, warehouse)
|
|
378
|
-
* - **Files**: HDR (.hdr), EXR (.exr), Ultra HDR
|
|
379
|
+
* - **Files**: HDR (.hdr), EXR (.exr), JPEG (.jpg, Ultra HDR when it carries a gain map), LDR image (.png, .webp, .avif, .gif), or cube faces (array of 6 images)
|
|
379
380
|
* - **Texture**: Pre-existing cube texture via `map` prop
|
|
380
381
|
* - **Custom Scene**: Render children into environment using portal and cube camera
|
|
381
382
|
* - **Ground Projection**: Project environment onto ground plane
|
|
@@ -35,7 +35,7 @@ type PresetsType = keyof typeof presetsObj;
|
|
|
35
35
|
interface BackgroundConfig {
|
|
36
36
|
/** HDRI preset name: 'apartment', 'city', 'dawn', 'forest', 'lobby', 'night', 'park', 'studio', 'sunset', 'warehouse' */
|
|
37
37
|
preset?: PresetsType
|
|
38
|
-
/** Files for cube texture (6 faces) or single
|
|
38
|
+
/** Files for cube texture (6 faces) or a single equirect (.hdr, .exr, .jpg, .png, .webp, .avif, .gif) */
|
|
39
39
|
files?: string | string[]
|
|
40
40
|
/** Separate files for scene.background (visual backdrop) */
|
|
41
41
|
backgroundMap?: string | string[]
|
|
@@ -55,7 +55,7 @@ interface BackgroundConfig {
|
|
|
55
55
|
*
|
|
56
56
|
* String detection priority:
|
|
57
57
|
* 1. Preset - exact match against known presets (apartment, city, dawn, forest, lobby, night, park, studio, sunset, warehouse)
|
|
58
|
-
* 2. URL - starts with /, ./, ../, http://, https://, OR has image extension
|
|
58
|
+
* 2. URL - starts with /, ./, ../, http://, https://, data:, OR has an image extension (a query or hash may follow)
|
|
59
59
|
* 3. Color - default fallback (CSS color names, hex values, rgb(), etc.)
|
|
60
60
|
*
|
|
61
61
|
* @example Color
|
|
@@ -270,7 +270,7 @@ type EnvironmentLoaderClearOptions = Pick<EnvironmentLoaderProps, 'files' | 'pre
|
|
|
270
270
|
* - scale: Scale of backside projected sphere (default: 1000)
|
|
271
271
|
*
|
|
272
272
|
* Additional loader props:
|
|
273
|
-
* @property files - File path(s) for environment. Supports .hdr, .exr, Ultra HDR .
|
|
273
|
+
* @property files - File path(s) for environment. Supports .hdr, .exr, .jpg (Ultra HDR or plain), an LDR .png/.webp/.avif/.gif, or array of 6 cube faces
|
|
274
274
|
* @property path - Base path for file loading
|
|
275
275
|
* @property extensions - Texture extensions override
|
|
276
276
|
*/
|
|
@@ -313,8 +313,9 @@ type EnvironmentProps = {
|
|
|
313
313
|
declare function EnvironmentMap({ scene, background, map, ...config }: EnvironmentProps): null;
|
|
314
314
|
/**
|
|
315
315
|
* Internal component that loads environment textures from files or presets.
|
|
316
|
-
* Uses HDRLoader for .hdr, EXRLoader for .exr, UltraHDRLoader for .jpg/.jpeg
|
|
317
|
-
*
|
|
316
|
+
* Uses HDRLoader for .hdr, EXRLoader for .exr, UltraHDRLoader for .jpg/.jpeg (a JPEG without a gain
|
|
317
|
+
* map loads as a plain image), TextureLoader for an LDR .png/.webp/.avif/.gif, or CubeTextureLoader
|
|
318
|
+
* for arrays of images.
|
|
318
319
|
*
|
|
319
320
|
* @example With preset
|
|
320
321
|
* ```jsx
|
|
@@ -375,7 +376,7 @@ declare function EnvironmentPortal({ children, near, far, resolution, frames, ma
|
|
|
375
376
|
*
|
|
376
377
|
* Supports multiple input methods:
|
|
377
378
|
* - **Presets**: Selection of HDRI Haven assets (apartment, city, dawn, forest, lobby, night, park, studio, sunset, warehouse)
|
|
378
|
-
* - **Files**: HDR (.hdr), EXR (.exr), Ultra HDR
|
|
379
|
+
* - **Files**: HDR (.hdr), EXR (.exr), JPEG (.jpg, Ultra HDR when it carries a gain map), LDR image (.png, .webp, .avif, .gif), or cube faces (array of 6 images)
|
|
379
380
|
* - **Texture**: Pre-existing cube texture via `map` prop
|
|
380
381
|
* - **Custom Scene**: Render children into environment using portal and cube camera
|
|
381
382
|
* - **Ground Projection**: Project environment onto ground plane
|
|
@@ -146,6 +146,99 @@ function isDevelopment() {
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
+
const INTERNAL_LIB_MARKERS = [
|
|
150
|
+
"zustand",
|
|
151
|
+
"setState",
|
|
152
|
+
"Object.assign",
|
|
153
|
+
"@pmndrs/scheduler",
|
|
154
|
+
"Scheduler.tickRoot",
|
|
155
|
+
"Scheduler.stepJob"
|
|
156
|
+
];
|
|
157
|
+
function isInternalRendererAccess(stack, callerDepth = 2) {
|
|
158
|
+
if (!stack) return false;
|
|
159
|
+
const caller = stack.split("\n")[callerDepth] ?? "";
|
|
160
|
+
return INTERNAL_LIB_MARKERS.some((m) => caller.includes(m));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const isAccessorDescriptor = (descriptor) => !!descriptor && (descriptor.get !== void 0 || descriptor.set !== void 0);
|
|
164
|
+
const isAccessor = (object, key) => isAccessorDescriptor(Object.getOwnPropertyDescriptor(object, key));
|
|
165
|
+
function cloneState(...sources) {
|
|
166
|
+
const target = {};
|
|
167
|
+
for (const source of sources) {
|
|
168
|
+
if (source) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
169
|
+
}
|
|
170
|
+
return target;
|
|
171
|
+
}
|
|
172
|
+
function preserveAccessors(rawSet, get) {
|
|
173
|
+
return ((partial, replace) => {
|
|
174
|
+
const previous = get();
|
|
175
|
+
const patch = typeof partial === "function" ? partial(previous) : partial;
|
|
176
|
+
if (replace || !previous || patch == null || Object.is(patch, previous)) {
|
|
177
|
+
return rawSet(patch, replace);
|
|
178
|
+
}
|
|
179
|
+
const next = cloneState(previous);
|
|
180
|
+
const viaSetter = [];
|
|
181
|
+
for (const key of Reflect.ownKeys(patch)) {
|
|
182
|
+
const descriptor = Object.getOwnPropertyDescriptor(patch, key);
|
|
183
|
+
if (!descriptor.enumerable) continue;
|
|
184
|
+
if (isAccessorDescriptor(descriptor)) {
|
|
185
|
+
Object.defineProperty(next, key, descriptor);
|
|
186
|
+
} else if (isAccessor(next, key)) {
|
|
187
|
+
viaSetter.push(key);
|
|
188
|
+
} else {
|
|
189
|
+
Object.defineProperty(next, key, {
|
|
190
|
+
value: descriptor.value,
|
|
191
|
+
writable: true,
|
|
192
|
+
enumerable: true,
|
|
193
|
+
configurable: true
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
for (const key of viaSetter) next[key] = patch[key];
|
|
198
|
+
rawSet(next, true);
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
const keepAccessors = (initializer) => (rawSet, get, api) => {
|
|
202
|
+
const set = preserveAccessors(rawSet, get);
|
|
203
|
+
api.setState = set;
|
|
204
|
+
return initializer(set, get, api);
|
|
205
|
+
};
|
|
206
|
+
let glNoticeShown = false;
|
|
207
|
+
function defineRendererAccessors(state) {
|
|
208
|
+
Object.defineProperty(state, "gl", {
|
|
209
|
+
get() {
|
|
210
|
+
const renderer = this.internal?.actualRenderer;
|
|
211
|
+
if (!glNoticeShown && renderer && !this.isLegacy) {
|
|
212
|
+
const stack = new Error().stack || "";
|
|
213
|
+
if (!isInternalRendererAccess(stack)) {
|
|
214
|
+
glNoticeShown = true;
|
|
215
|
+
const cleanedStack = stack.split("\n").slice(2).join("\n") || "Stack trace unavailable";
|
|
216
|
+
notifyDepreciated({
|
|
217
|
+
heading: "Accessing state.gl in WebGPU mode",
|
|
218
|
+
body: "Please use state.renderer instead. state.gl is deprecated and will be removed in future versions.\n\nFor backwards compatibility, state.gl currently maps to state.renderer, but this may cause issues with libraries expecting WebGLRenderer.\n\nAccessed from:\n" + cleanedStack
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return renderer;
|
|
223
|
+
},
|
|
224
|
+
set(value) {
|
|
225
|
+
this.internal.actualRenderer = value;
|
|
226
|
+
},
|
|
227
|
+
enumerable: true,
|
|
228
|
+
configurable: true
|
|
229
|
+
});
|
|
230
|
+
Object.defineProperty(state, "renderer", {
|
|
231
|
+
get() {
|
|
232
|
+
return this.internal?.actualRenderer;
|
|
233
|
+
},
|
|
234
|
+
set(value) {
|
|
235
|
+
this.internal.actualRenderer = value;
|
|
236
|
+
},
|
|
237
|
+
enumerable: true,
|
|
238
|
+
configurable: true
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
|
|
149
242
|
const R3F_CONTEXT = Symbol.for("@react-three/fiber.context");
|
|
150
243
|
const context = globalThis[R3F_CONTEXT] ?? (globalThis[R3F_CONTEXT] = React__namespace.createContext(null));
|
|
151
244
|
|
|
@@ -257,15 +350,12 @@ function useFrame(callback, priorityOrOptions) {
|
|
|
257
350
|
});
|
|
258
351
|
}
|
|
259
352
|
const wrappedCallback = (frameState, delta) => {
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
frame: frameState.frame,
|
|
267
|
-
overstep: frameState.overstep
|
|
268
|
-
};
|
|
353
|
+
const mergedState = cloneState(store.getState());
|
|
354
|
+
mergedState.time = frameState.time;
|
|
355
|
+
mergedState.delta = frameState.delta;
|
|
356
|
+
mergedState.elapsed = frameState.elapsed;
|
|
357
|
+
mergedState.frame = frameState.frame;
|
|
358
|
+
mergedState.overstep = frameState.overstep;
|
|
269
359
|
callbackRef.current?.(mergedState, delta);
|
|
270
360
|
};
|
|
271
361
|
const unregister = scheduler$1.register(wrappedCallback, {
|
|
@@ -406,13 +496,18 @@ function getTextureView(store) {
|
|
|
406
496
|
exports.Block = Block;
|
|
407
497
|
exports.ErrorBoundary = ErrorBoundary;
|
|
408
498
|
exports.attachRootExtensions = attachRootExtensions;
|
|
499
|
+
exports.cloneState = cloneState;
|
|
409
500
|
exports.context = context;
|
|
501
|
+
exports.defineRendererAccessors = defineRendererAccessors;
|
|
410
502
|
exports.detachRootExtensions = detachRootExtensions;
|
|
411
503
|
exports.getTextureView = getTextureView;
|
|
504
|
+
exports.isAccessor = isAccessor;
|
|
412
505
|
exports.isDevelopment = isDevelopment;
|
|
506
|
+
exports.keepAccessors = keepAccessors;
|
|
413
507
|
exports.notifyAlpha = notifyAlpha;
|
|
414
508
|
exports.notifyDepreciated = notifyDepreciated;
|
|
415
509
|
exports.notifyRootExtensionsHmr = notifyRootExtensionsHmr;
|
|
510
|
+
exports.preserveAccessors = preserveAccessors;
|
|
416
511
|
exports.registerRootExtension = registerRootExtension;
|
|
417
512
|
exports.setRenderOverride = setRenderOverride;
|
|
418
513
|
exports.stageTextures = stageTextures;
|
|
@@ -35,7 +35,7 @@ type PresetsType = keyof typeof presetsObj;
|
|
|
35
35
|
interface BackgroundConfig {
|
|
36
36
|
/** HDRI preset name: 'apartment', 'city', 'dawn', 'forest', 'lobby', 'night', 'park', 'studio', 'sunset', 'warehouse' */
|
|
37
37
|
preset?: PresetsType
|
|
38
|
-
/** Files for cube texture (6 faces) or single
|
|
38
|
+
/** Files for cube texture (6 faces) or a single equirect (.hdr, .exr, .jpg, .png, .webp, .avif, .gif) */
|
|
39
39
|
files?: string | string[]
|
|
40
40
|
/** Separate files for scene.background (visual backdrop) */
|
|
41
41
|
backgroundMap?: string | string[]
|
|
@@ -55,7 +55,7 @@ interface BackgroundConfig {
|
|
|
55
55
|
*
|
|
56
56
|
* String detection priority:
|
|
57
57
|
* 1. Preset - exact match against known presets (apartment, city, dawn, forest, lobby, night, park, studio, sunset, warehouse)
|
|
58
|
-
* 2. URL - starts with /, ./, ../, http://, https://, OR has image extension
|
|
58
|
+
* 2. URL - starts with /, ./, ../, http://, https://, data:, OR has an image extension (a query or hash may follow)
|
|
59
59
|
* 3. Color - default fallback (CSS color names, hex values, rgb(), etc.)
|
|
60
60
|
*
|
|
61
61
|
* @example Color
|
|
@@ -270,7 +270,7 @@ type EnvironmentLoaderClearOptions = Pick<EnvironmentLoaderProps, 'files' | 'pre
|
|
|
270
270
|
* - scale: Scale of backside projected sphere (default: 1000)
|
|
271
271
|
*
|
|
272
272
|
* Additional loader props:
|
|
273
|
-
* @property files - File path(s) for environment. Supports .hdr, .exr, Ultra HDR .
|
|
273
|
+
* @property files - File path(s) for environment. Supports .hdr, .exr, .jpg (Ultra HDR or plain), an LDR .png/.webp/.avif/.gif, or array of 6 cube faces
|
|
274
274
|
* @property path - Base path for file loading
|
|
275
275
|
* @property extensions - Texture extensions override
|
|
276
276
|
*/
|
|
@@ -313,8 +313,9 @@ type EnvironmentProps = {
|
|
|
313
313
|
declare function EnvironmentMap({ scene, background, map, ...config }: EnvironmentProps): null;
|
|
314
314
|
/**
|
|
315
315
|
* Internal component that loads environment textures from files or presets.
|
|
316
|
-
* Uses HDRLoader for .hdr, EXRLoader for .exr, UltraHDRLoader for .jpg/.jpeg
|
|
317
|
-
*
|
|
316
|
+
* Uses HDRLoader for .hdr, EXRLoader for .exr, UltraHDRLoader for .jpg/.jpeg (a JPEG without a gain
|
|
317
|
+
* map loads as a plain image), TextureLoader for an LDR .png/.webp/.avif/.gif, or CubeTextureLoader
|
|
318
|
+
* for arrays of images.
|
|
318
319
|
*
|
|
319
320
|
* @example With preset
|
|
320
321
|
* ```jsx
|
|
@@ -375,7 +376,7 @@ declare function EnvironmentPortal({ children, near, far, resolution, frames, ma
|
|
|
375
376
|
*
|
|
376
377
|
* Supports multiple input methods:
|
|
377
378
|
* - **Presets**: Selection of HDRI Haven assets (apartment, city, dawn, forest, lobby, night, park, studio, sunset, warehouse)
|
|
378
|
-
* - **Files**: HDR (.hdr), EXR (.exr), Ultra HDR
|
|
379
|
+
* - **Files**: HDR (.hdr), EXR (.exr), JPEG (.jpg, Ultra HDR when it carries a gain map), LDR image (.png, .webp, .avif, .gif), or cube faces (array of 6 images)
|
|
379
380
|
* - **Texture**: Pre-existing cube texture via `map` prop
|
|
380
381
|
* - **Custom Scene**: Render children into environment using portal and cube camera
|
|
381
382
|
* - **Ground Projection**: Project environment onto ground plane
|