@react-three/fiber 10.0.0-canary.87166dc → 10.0.0-canary.88b1ca7
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.d.cts +49 -5
- package/dist/extension.d.mts +49 -5
- package/dist/extension.d.ts +49 -5
- package/dist/extension.mjs +1 -1
- package/dist/index.cjs +7 -8
- package/dist/index.d.cts +9 -42
- package/dist/index.d.mts +9 -42
- package/dist/index.d.ts +9 -42
- package/dist/index.mjs +6 -6
- package/dist/legacy.cjs +2 -2
- package/dist/legacy.d.cts +4 -4
- package/dist/legacy.d.mts +4 -4
- package/dist/legacy.d.ts +4 -4
- package/dist/legacy.mjs +4 -4
- package/dist/shared/{fiber.3jeDXXYd.d.mts → fiber.34TOMPo3.d.cts} +10 -9
- package/dist/shared/fiber.BFuGd7gN.d.cts +90 -0
- package/dist/shared/{fiber.CsZ092z_.cjs → fiber.BO8-26r8.cjs} +124 -9
- package/dist/shared/fiber.BSXtODQl.cjs +14 -0
- package/dist/shared/fiber.Bll9fqKA.d.mts +90 -0
- package/dist/shared/{fiber.BC5FRLu-.mjs → fiber.BuWl08aJ.mjs} +91 -76
- package/dist/shared/{fiber.DlH05gco.mjs → fiber.C-3TIsF8.mjs} +119 -10
- package/dist/shared/{fiber.fR3DaJb1.d.cts → fiber.CjMAAsJy.d.ts} +10 -9
- package/dist/shared/fiber.DEWBFQJe.mjs +9 -0
- package/dist/shared/{fiber.C_MFx7We.d.ts → fiber.DQTSZ24m.d.cts} +11 -8
- package/dist/shared/{fiber.C_MFx7We.d.cts → fiber.DQTSZ24m.d.mts} +11 -8
- package/dist/shared/{fiber.C_MFx7We.d.mts → fiber.DQTSZ24m.d.ts} +11 -8
- package/dist/shared/fiber.DuA4F8L5.d.ts +90 -0
- package/dist/shared/{fiber.B_KQAb3I.d.ts → fiber.Dy7Uz273.d.mts} +10 -9
- package/dist/shared/{fiber.BybcfIwy.cjs → fiber.TRm3lZ7I.cjs} +91 -76
- package/dist/webgpu/index.cjs +7 -9
- package/dist/webgpu/index.d.cts +11 -78
- package/dist/webgpu/index.d.mts +11 -78
- package/dist/webgpu/index.d.ts +11 -78
- package/dist/webgpu/index.mjs +7 -9
- package/package.json +1 -1
- package/readme.md +10 -1
- package/dist/shared/fiber.C6hitYDY.d.cts +0 -48
- package/dist/shared/fiber.D4fD6H74.d.mts +0 -48
- package/dist/shared/fiber.YgTUGbja.d.ts +0 -48
|
@@ -340,10 +340,14 @@ interface RendererProvider {
|
|
|
340
340
|
}
|
|
341
341
|
|
|
342
342
|
//* Register ==============================
|
|
343
|
-
// The
|
|
344
|
-
//
|
|
345
|
-
//
|
|
346
|
-
//
|
|
343
|
+
// The base RootState is typed for both renderers, so by default `state.renderer` is the union and a
|
|
344
|
+
// WebGPU-only member (`renderer.compute`, `renderer.backend`) needs a narrow. That base is what
|
|
345
|
+
// `@react-three/fiber/extension` (the entry for libraries) and the `RootState` type expose, so a
|
|
346
|
+
// library compiles for apps on either renderer.
|
|
347
|
+
//
|
|
348
|
+
// Apps rarely need this: each entry's hooks are already typed for the renderer it renders with
|
|
349
|
+
// (`@react-three/fiber` WebGPU, `/legacy` WebGL). Registering narrows the base types too, for code
|
|
350
|
+
// that goes through them (`/extension` hooks in an app, `RootState` annotations):
|
|
347
351
|
//
|
|
348
352
|
// declare module '@react-three/fiber' {
|
|
349
353
|
// interface Register {
|
|
@@ -352,8 +356,7 @@ interface RendererProvider {
|
|
|
352
356
|
// }
|
|
353
357
|
//
|
|
354
358
|
// Same pattern as `Register` in @react-three/tsl (and TanStack Router). Nothing registered means
|
|
355
|
-
// the union, unchanged.
|
|
356
|
-
// path; this is for apps on `@react-three/fiber` that want the narrowed types without changing it.
|
|
359
|
+
// the union, unchanged.
|
|
357
360
|
|
|
358
361
|
/**
|
|
359
362
|
* Augment this to type `RootState` for the renderer your app uses. Recognised keys:
|
|
@@ -1233,5 +1236,5 @@ declare function useThree<T = RootState>(selector?: (state: RootState) => T, equ
|
|
|
1233
1236
|
*/
|
|
1234
1237
|
declare const context: React$1.Context<RootStore>;
|
|
1235
1238
|
|
|
1236
|
-
export { useStore as a$, useThree as b0, registerRootExtension as
|
|
1237
|
-
export type {
|
|
1239
|
+
export { useStore as a$, useThree as b0, registerRootExtension as t, setRenderOverride as u, context as w };
|
|
1240
|
+
export type { EventHandlers as $, RenderCallback as A, Performance as B, Color as C, Dpr as D, Euler as E, Frameloop as F, GeometryTransformProps as G, RootState as H, InternalState as I, RootStore as J, Intersection as K, Layers as L, MutableOrReadonlyParameters as M, NodeProps as N, Object3DMethod as O, PointerState as P, Quaternion as Q, RaycastableRepresentation as R, Subscription as S, TSLNodeInput as T, Camera as U, VectorRepresentation as V, IntersectionEvent as W, XRManager as X, ThreeEvent as Y, DomEvent as Z, Events as _, MathRepresentation as a, FilterFunction as a0, ComputeFunction as a1, XRPointerConfig as a2, EventManager as a3, PointerCaptureTarget as a4, VisibilityEntry as a5, OffscreenCanvas$1 as a6, BaseRendererProps as a7, RendererFactory as a8, Renderer as a9, Mutable as aA, IsOptional as aB, IsAllOptional as aC, ThreeCamera as aD, Act as aE, Bridge as aF, SetBlock as aG, UnblockProps as aH, ObjectMap as aI, EquConfig as aJ, Disposable as aK, FrameNextState as aL, FrameState as aM, FrameNextCallback as aN, FrameCallback as aO, ThreeNamespace as aP, ThreeCore as aQ, OcclusionSupport as aR, WebGLSupport as aS, WebGPUSupport as aT, RendererSupport as aU, RendererProvider as aV, Register as aW, RegisteredRenderer as aX, ForRegisteredRenderer as aY, R3FRenderTarget as aZ, R3FRendererSupport as a_, ColorManagementConfig as aa, ShadowsConfig as ab, RendererSettingsConfig as ac, DefaultGLProps as ad, GLProps as ae, DefaultRendererProps as af, CanvasSchedulerConfig as ag, RendererConfigExtended as ah, RendererProps as ai, CameraProps as aj, RenderProps as ak, InjectState as al, FiberRoot as am, TrackedPromise as an, Root as ao, AttachFnType as ap, AttachType as aq, Catalogue as ar, Args as as, ArgsProp as at, InstanceProps as au, Instance as av, HostConfig as aw, NonFunctionKeys as ax, Overwrite as ay, Properties as az, MathTypes as b, MathType as c, MathProps as d, Vector2 as e, Vector3 as f, Vector4 as g, Matrix3 as h, Matrix4 as i, EventProps as j, GeometryProps as k, ReactProps as l, ConstructorRepresentation as m, ElementProps as n, ThreeElement as o, ThreeToJSXElements as p, ThreeElementsOf as q, ElementOf as r, ReconcilerRoot as s, RootExtension as v, R3FRenderer as x, Size as y, Viewport as z };
|
|
@@ -340,10 +340,14 @@ interface RendererProvider {
|
|
|
340
340
|
}
|
|
341
341
|
|
|
342
342
|
//* Register ==============================
|
|
343
|
-
// The
|
|
344
|
-
//
|
|
345
|
-
//
|
|
346
|
-
//
|
|
343
|
+
// The base RootState is typed for both renderers, so by default `state.renderer` is the union and a
|
|
344
|
+
// WebGPU-only member (`renderer.compute`, `renderer.backend`) needs a narrow. That base is what
|
|
345
|
+
// `@react-three/fiber/extension` (the entry for libraries) and the `RootState` type expose, so a
|
|
346
|
+
// library compiles for apps on either renderer.
|
|
347
|
+
//
|
|
348
|
+
// Apps rarely need this: each entry's hooks are already typed for the renderer it renders with
|
|
349
|
+
// (`@react-three/fiber` WebGPU, `/legacy` WebGL). Registering narrows the base types too, for code
|
|
350
|
+
// that goes through them (`/extension` hooks in an app, `RootState` annotations):
|
|
347
351
|
//
|
|
348
352
|
// declare module '@react-three/fiber' {
|
|
349
353
|
// interface Register {
|
|
@@ -352,8 +356,7 @@ interface RendererProvider {
|
|
|
352
356
|
// }
|
|
353
357
|
//
|
|
354
358
|
// Same pattern as `Register` in @react-three/tsl (and TanStack Router). Nothing registered means
|
|
355
|
-
// the union, unchanged.
|
|
356
|
-
// path; this is for apps on `@react-three/fiber` that want the narrowed types without changing it.
|
|
359
|
+
// the union, unchanged.
|
|
357
360
|
|
|
358
361
|
/**
|
|
359
362
|
* Augment this to type `RootState` for the renderer your app uses. Recognised keys:
|
|
@@ -1233,5 +1236,5 @@ declare function useThree<T = RootState>(selector?: (state: RootState) => T, equ
|
|
|
1233
1236
|
*/
|
|
1234
1237
|
declare const context: React$1.Context<RootStore>;
|
|
1235
1238
|
|
|
1236
|
-
export { useStore as a$, useThree as b0, registerRootExtension as
|
|
1237
|
-
export type {
|
|
1239
|
+
export { useStore as a$, useThree as b0, registerRootExtension as t, setRenderOverride as u, context as w };
|
|
1240
|
+
export type { EventHandlers as $, RenderCallback as A, Performance as B, Color as C, Dpr as D, Euler as E, Frameloop as F, GeometryTransformProps as G, RootState as H, InternalState as I, RootStore as J, Intersection as K, Layers as L, MutableOrReadonlyParameters as M, NodeProps as N, Object3DMethod as O, PointerState as P, Quaternion as Q, RaycastableRepresentation as R, Subscription as S, TSLNodeInput as T, Camera as U, VectorRepresentation as V, IntersectionEvent as W, XRManager as X, ThreeEvent as Y, DomEvent as Z, Events as _, MathRepresentation as a, FilterFunction as a0, ComputeFunction as a1, XRPointerConfig as a2, EventManager as a3, PointerCaptureTarget as a4, VisibilityEntry as a5, OffscreenCanvas$1 as a6, BaseRendererProps as a7, RendererFactory as a8, Renderer as a9, Mutable as aA, IsOptional as aB, IsAllOptional as aC, ThreeCamera as aD, Act as aE, Bridge as aF, SetBlock as aG, UnblockProps as aH, ObjectMap as aI, EquConfig as aJ, Disposable as aK, FrameNextState as aL, FrameState as aM, FrameNextCallback as aN, FrameCallback as aO, ThreeNamespace as aP, ThreeCore as aQ, OcclusionSupport as aR, WebGLSupport as aS, WebGPUSupport as aT, RendererSupport as aU, RendererProvider as aV, Register as aW, RegisteredRenderer as aX, ForRegisteredRenderer as aY, R3FRenderTarget as aZ, R3FRendererSupport as a_, ColorManagementConfig as aa, ShadowsConfig as ab, RendererSettingsConfig as ac, DefaultGLProps as ad, GLProps as ae, DefaultRendererProps as af, CanvasSchedulerConfig as ag, RendererConfigExtended as ah, RendererProps as ai, CameraProps as aj, RenderProps as ak, InjectState as al, FiberRoot as am, TrackedPromise as an, Root as ao, AttachFnType as ap, AttachType as aq, Catalogue as ar, Args as as, ArgsProp as at, InstanceProps as au, Instance as av, HostConfig as aw, NonFunctionKeys as ax, Overwrite as ay, Properties as az, MathTypes as b, MathType as c, MathProps as d, Vector2 as e, Vector3 as f, Vector4 as g, Matrix3 as h, Matrix4 as i, EventProps as j, GeometryProps as k, ReactProps as l, ConstructorRepresentation as m, ElementProps as n, ThreeElement as o, ThreeToJSXElements as p, ThreeElementsOf as q, ElementOf as r, ReconcilerRoot as s, RootExtension as v, R3FRenderer as x, Size as y, Viewport as z };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { FrameCallback, UseFrameNextOptions, FrameNextControls } from '@pmndrs/scheduler';
|
|
2
|
+
import { WebGPURenderer, WebGPURendererParameters, RenderTarget } from 'three/webgpu';
|
|
3
|
+
import { H as RootState, I as InternalState, a8 as RendererFactory, a7 as BaseRendererProps, az as Properties } from './fiber.DQTSZ24m.js';
|
|
4
|
+
import { R as RenderTargetOptions, aU as CanvasProps } from './fiber.CjMAAsJy.js';
|
|
5
|
+
|
|
6
|
+
//* Renderer Props ========================================
|
|
7
|
+
|
|
8
|
+
type WebGPUDefaultProps = Omit<WebGPURendererParameters, 'canvas'> & BaseRendererProps
|
|
9
|
+
|
|
10
|
+
type WebGPUProps =
|
|
11
|
+
| RendererFactory<WebGPURenderer, WebGPUDefaultProps>
|
|
12
|
+
| Partial<Properties<WebGPURenderer> | WebGPURendererParameters>
|
|
13
|
+
|
|
14
|
+
// WebGPU doesn't have shadow maps in the same way
|
|
15
|
+
interface WebGPUShadowConfig {
|
|
16
|
+
shadows?: boolean // Simplified for WebGPU
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//* WebGPU-specific Types ========================================
|
|
20
|
+
|
|
21
|
+
/** WebGPU renderer type - re-exported as R3FRenderer from @react-three/fiber/webgpu */
|
|
22
|
+
type WebGPUR3FRenderer = WebGPURenderer
|
|
23
|
+
|
|
24
|
+
/** WebGPU internal state with narrowed renderer type */
|
|
25
|
+
interface WebGPUInternalState extends Omit<InternalState, 'actualRenderer'> {
|
|
26
|
+
actualRenderer: WebGPURenderer
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* WebGPU-specific RootState with narrowed renderer type.
|
|
31
|
+
* Automatically used when importing from `@react-three/fiber/webgpu`.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* import { useThree } from '@react-three/fiber/webgpu'
|
|
36
|
+
*
|
|
37
|
+
* function MyComponent() {
|
|
38
|
+
* const { renderer } = useThree()
|
|
39
|
+
* // renderer is typed as WebGPURenderer
|
|
40
|
+
* renderer.compute(computePass)
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
// `gl` is not narrowed: it keeps the base type (WebGLRenderer, for code written against it), so a
|
|
45
|
+
// WebGPURootState stays assignable to RootState and `useFrame((state: RootState) => ...)` still
|
|
46
|
+
// compiles where the hooks are WebGPU-typed. At runtime it aliases `renderer`; use that instead.
|
|
47
|
+
interface WebGPURootState extends Omit<RootState, 'renderer' | 'internal'> {
|
|
48
|
+
/** The WebGPU renderer instance */
|
|
49
|
+
renderer: WebGPURenderer
|
|
50
|
+
/** Internals with WebGPU renderer */
|
|
51
|
+
internal: WebGPUInternalState
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @fileoverview WebGPU-narrowed hook and Canvas types, shared by the entries that render with WebGPU
|
|
56
|
+
*
|
|
57
|
+
* `@react-three/fiber` and `@react-three/fiber/webgpu` both render with WebGPURenderer. The core
|
|
58
|
+
* hooks are declared against the base RootState, whose `renderer` is the R3FRenderer union
|
|
59
|
+
* (WebGLRenderer included) so that libraries typed against it also compile for `/legacy` apps. On
|
|
60
|
+
* these entries that union is already resolved, so leaving it in place forced a cast for anything
|
|
61
|
+
* WebGPU-only:
|
|
62
|
+
*
|
|
63
|
+
* const renderer = useThree((s) => s.renderer)
|
|
64
|
+
* renderer.compute(node) // Property 'compute' does not exist on type 'R3FRenderer'
|
|
65
|
+
*
|
|
66
|
+
* The entries re-export the hooks below instead. Types only: the values are the core
|
|
67
|
+
* implementations untouched, so there is no runtime cost and no second code path to keep in sync.
|
|
68
|
+
* See https://github.com/pmndrs/react-three-fiber/issues/3851
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
/** `useThree` narrowed to WebGPU state — `state.renderer` is a `WebGPURenderer`. */
|
|
72
|
+
type UseThreeWebGPU = <T = WebGPURootState>(selector?: (state: WebGPURootState) => T, equalityFn?: <U>(state: U, newState: U) => boolean) => T;
|
|
73
|
+
/** `useFrame` narrowed to WebGPU state — the callback's `state.renderer` is a `WebGPURenderer`. */
|
|
74
|
+
type UseFrameWebGPU = (callback?: FrameCallback<WebGPURootState>, priorityOrOptions?: number | UseFrameNextOptions) => FrameNextControls;
|
|
75
|
+
declare const useThree: UseThreeWebGPU;
|
|
76
|
+
declare const useFrame: UseFrameWebGPU;
|
|
77
|
+
/** `useRenderTarget` narrowed to the target a WebGPU renderer produces. */
|
|
78
|
+
declare const useRenderTarget: {
|
|
79
|
+
(options?: RenderTargetOptions): RenderTarget;
|
|
80
|
+
(size: number, options?: RenderTargetOptions): RenderTarget;
|
|
81
|
+
(width: number, height: number, options?: RenderTargetOptions): RenderTarget;
|
|
82
|
+
};
|
|
83
|
+
/** Canvas props on a WebGPU entry: `onCreated` receives `WebGPURootState`. */
|
|
84
|
+
type WebGPUCanvasProps = Omit<CanvasProps, 'onCreated'> & {
|
|
85
|
+
/** Callback after the canvas has rendered (but not yet committed); `state.renderer` is a `WebGPURenderer` */
|
|
86
|
+
onCreated?: (state: WebGPURootState) => void;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export { useFrame as a, useRenderTarget as b, useThree as u };
|
|
90
|
+
export type { UseThreeWebGPU as U, WebGPUCanvasProps as W, UseFrameWebGPU as c, WebGPURootState as d, WebGPUInternalState as e, WebGPUR3FRenderer as f, WebGPUProps as g, WebGPUDefaultProps as h, WebGPUShadowConfig as i };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import { ReactNode, Component, RefObject, JSX } from 'react';
|
|
3
3
|
import { Options } from 'react-use-measure';
|
|
4
|
-
import {
|
|
4
|
+
import { ak as RenderProps, m as ConstructorRepresentation, aI as ObjectMap, a7 as BaseRendererProps, a8 as RendererFactory, az as Properties, I as InternalState, H as RootState, E as Euler$1, J as RootStore, a3 as EventManager, Z as DomEvent, av as Instance, o as ThreeElement, ar as Catalogue, ao as Root, al as InjectState, aQ as ThreeCore, aF as Bridge, aH as UnblockProps, aK as Disposable, D as Dpr, aD as ThreeCamera, y as Size, aJ as EquConfig } from './fiber.DQTSZ24m.mjs';
|
|
5
5
|
import * as THREE from 'three';
|
|
6
6
|
import { ColorRepresentation, Euler, Loader, RenderTargetOptions as RenderTargetOptions$1, ColorSpace, Texture as Texture$1, CubeTexture, Scene, Object3D } from 'three';
|
|
7
7
|
import { WebGPURenderer } from 'three/webgpu';
|
|
@@ -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
|
|
@@ -2489,5 +2490,5 @@ declare function isOnce(value: unknown): value is {
|
|
|
2489
2490
|
[ONCE]: any[] | true;
|
|
2490
2491
|
};
|
|
2491
2492
|
|
|
2492
|
-
export {
|
|
2493
|
-
export type { LegacyInternalState as A, BackgroundConfig as B,
|
|
2493
|
+
export { Texture as $, EnvironmentMap as F, EnvironmentCube as H, EnvironmentPortal as J, Environment as K, presetsObj as M, swapInteractivity as O, removeInteractivity as Q, createEvents as S, useInstanceHandle as T, useGraph as U, useLoader as V, IsObject as X, useTexture as _, addEffect as a, useTextures as a4, useEnvironment as a6, extend as a7, reconciler as a8, flushSync as a9, applyProps as aA, is as aB, isOrthographicCamera as aC, isRef as aD, isColorRepresentation as aE, isObject3D as aF, isTexture as aG, isLayers as aH, isUniform as aI, isVectorLike as aJ, isCopyable as aK, hasConstructor as aL, FROM_REF as aM, fromRef as aO, isFromRef as aP, ONCE as aQ, once as aR, isOnce as aT, _roots as aa, unmountComponentAtNode as ab, createPortal as ac, Portal as ad, useIsomorphicLayoutEffect as ae, useMutableCallback as af, useBridge as ag, Block as ah, ErrorBoundary as ai, calculateDpr as aj, getUuidPrefix as ak, updateCamera as al, updateFrustum as am, REACT_INTERNAL_PROPS as an, findInitialRoot as ao, getRootState as ap, buildGraph as aq, dispose as ar, getInstanceProps as as, prepare as at, invalidateInstance as au, RESERVED_PROPS as av, resolve as aw, attach as ax, detach as ay, diffProps as az, addAfterEffect as b, createPointerEvents as c, addTail as d, advance as e, isRenderer as f, getPrimary as g, hasPrimary as h, invalidate as i, getPrimaryIds as j, createStore as k, getThree as l, hasThree as m, whenThree as n, registerPrimary as r, unregisterPrimary as u, waitForPrimary as w };
|
|
2494
|
+
export type { LegacyInternalState as A, BackgroundConfig as B, LegacyRootState as C, EnvironmentProps as D, Extensions as E, GlobalRenderCallback as G, InputLike as I, LoaderLike as L, PresetsType as N, PrimaryCanvasEntry as P, RenderTargetOptions as R, WebGLDefaultProps as W, MappedTextureType as Y, UseTextureOptions as Z, TextureInput as a0, TextureResult as a1, DisposeOptions as a2, UseTexturesReturn as a3, EnvironmentLoaderProps as a5, FromRefMarker as aN, OnceValue as aS, CanvasProps as aU, GlobalEffectType as o, BackgroundProp as p, GLTFLike as q, LoaderInstance as s, InferLoadResult as t, LoaderResult as v, WebGLProps as x, WebGLShadowConfig as y, LegacyRenderer as z };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
const textureStaging = require('./fiber.
|
|
4
|
+
const textureStaging = require('./fiber.BO8-26r8.cjs');
|
|
5
5
|
const React = require('react');
|
|
6
6
|
const useMeasure = require('react-use-measure');
|
|
7
7
|
const itsFine = require('its-fine');
|
|
@@ -644,8 +644,9 @@ function applyProps(object, props) {
|
|
|
644
644
|
for (const name in nextUniforms) {
|
|
645
645
|
const uniform = nextUniforms[name];
|
|
646
646
|
const targetUniform = uniforms[name];
|
|
647
|
-
if (targetUniform)
|
|
648
|
-
|
|
647
|
+
if (targetUniform) {
|
|
648
|
+
Object.assign(targetUniform, uniform);
|
|
649
|
+
} else {
|
|
649
650
|
const nextUniform = isUniform(uniform) ? uniform.clone() : new (getThree()).Uniform(uniform.value);
|
|
650
651
|
uniforms[name] = nextUniform;
|
|
651
652
|
}
|
|
@@ -701,13 +702,6 @@ function applyProps(object, props) {
|
|
|
701
702
|
return object;
|
|
702
703
|
}
|
|
703
704
|
|
|
704
|
-
const INTERNAL_LIB_MARKERS = ["zustand", "setState", "Object.assign"];
|
|
705
|
-
function isInternalRendererAccess(stack, callerDepth = 2) {
|
|
706
|
-
if (!stack) return false;
|
|
707
|
-
const caller = stack.split("\n")[callerDepth] ?? "";
|
|
708
|
-
return INTERNAL_LIB_MARKERS.some((m) => caller.includes(m));
|
|
709
|
-
}
|
|
710
|
-
|
|
711
705
|
function updateSize(state, size, imperative) {
|
|
712
706
|
state.set((current) => ({
|
|
713
707
|
size,
|
|
@@ -722,7 +716,8 @@ function configureSize(store, size) {
|
|
|
722
716
|
updateSize(state, size, false);
|
|
723
717
|
}
|
|
724
718
|
const createStore = (invalidate, advance) => {
|
|
725
|
-
const rootStore = traditional.createWithEqualityFn((
|
|
719
|
+
const rootStore = traditional.createWithEqualityFn((rawSet, get, api) => {
|
|
720
|
+
const set = api.setState = textureStaging.preserveAccessors(rawSet, get);
|
|
726
721
|
let position;
|
|
727
722
|
let defaultTarget;
|
|
728
723
|
let tempTarget;
|
|
@@ -815,7 +810,7 @@ const createStore = (invalidate, advance) => {
|
|
|
815
810
|
factor: 0,
|
|
816
811
|
getCurrentViewport
|
|
817
812
|
},
|
|
818
|
-
setEvents: (events) => set((state2) => ({
|
|
813
|
+
setEvents: (events) => set((state2) => ({ events: { ...state2.events, ...events } })),
|
|
819
814
|
setSize: (width, height, top, left) => {
|
|
820
815
|
const state2 = get();
|
|
821
816
|
if (width === void 0) {
|
|
@@ -911,37 +906,7 @@ const createStore = (invalidate, advance) => {
|
|
|
911
906
|
return rootState;
|
|
912
907
|
});
|
|
913
908
|
const state = rootStore.getState();
|
|
914
|
-
|
|
915
|
-
get() {
|
|
916
|
-
const currentState = rootStore.getState();
|
|
917
|
-
if (!currentState.isLegacy && currentState.internal.actualRenderer) {
|
|
918
|
-
const stack = new Error().stack || "";
|
|
919
|
-
if (!isInternalRendererAccess(stack)) {
|
|
920
|
-
const cleanedStack = stack.split("\n").slice(2).join("\n") || "Stack trace unavailable";
|
|
921
|
-
textureStaging.notifyDepreciated({
|
|
922
|
-
heading: "Accessing state.gl in WebGPU mode",
|
|
923
|
-
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
|
|
924
|
-
});
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
return currentState.internal.actualRenderer;
|
|
928
|
-
},
|
|
929
|
-
set(value) {
|
|
930
|
-
rootStore.getState().internal.actualRenderer = value;
|
|
931
|
-
},
|
|
932
|
-
enumerable: true,
|
|
933
|
-
configurable: true
|
|
934
|
-
});
|
|
935
|
-
Object.defineProperty(state, "renderer", {
|
|
936
|
-
get() {
|
|
937
|
-
return rootStore.getState().internal.actualRenderer;
|
|
938
|
-
},
|
|
939
|
-
set(value) {
|
|
940
|
-
rootStore.getState().internal.actualRenderer = value;
|
|
941
|
-
},
|
|
942
|
-
enumerable: true,
|
|
943
|
-
configurable: true
|
|
944
|
-
});
|
|
909
|
+
textureStaging.defineRendererAccessors(state);
|
|
945
910
|
let oldScene = state.scene;
|
|
946
911
|
rootStore.subscribe(() => {
|
|
947
912
|
const currentState = rootStore.getState();
|
|
@@ -1000,7 +965,8 @@ function configureScheduler(store, canvasId, schedulerConfig, previous) {
|
|
|
1000
965
|
if (!rootId) {
|
|
1001
966
|
const newRootId = state.internal.pendingRootId ?? canvasId ?? scheduler$1.generateRootId();
|
|
1002
967
|
const unregisterRoot = scheduler$1.registerRoot(newRootId, {
|
|
1003
|
-
|
|
968
|
+
// The scheduler spreads this into each frame state; see stateForScheduler
|
|
969
|
+
getState: () => textureStaging.stateForScheduler(store.getState()),
|
|
1004
970
|
onError: (err) => store.getState().setError(err),
|
|
1005
971
|
frameloop: store.getState().frameloop,
|
|
1006
972
|
before: rootBefore,
|
|
@@ -1391,7 +1357,6 @@ function initializeRenderer(canvas, provider, store, props) {
|
|
|
1391
1357
|
state.set((prev) => ({
|
|
1392
1358
|
webGPUSupported: primaryEntry.store.getState().webGPUSupported,
|
|
1393
1359
|
renderer,
|
|
1394
|
-
gl: renderer,
|
|
1395
1360
|
primaryStore: primaryEntry.store,
|
|
1396
1361
|
internal: {
|
|
1397
1362
|
...prev.internal,
|
|
@@ -1422,7 +1387,6 @@ function initializeRenderer(canvas, provider, store, props) {
|
|
|
1422
1387
|
state.set((prev) => ({
|
|
1423
1388
|
webGPUSupported: isWebGPUBackend,
|
|
1424
1389
|
renderer,
|
|
1425
|
-
gl: renderer,
|
|
1426
1390
|
primaryStore: store,
|
|
1427
1391
|
internal: {
|
|
1428
1392
|
...prev.internal,
|
|
@@ -1442,12 +1406,7 @@ function initializeRenderer(canvas, provider, store, props) {
|
|
|
1442
1406
|
const isWebGPUBackend = backend && "isWebGPUBackend" in backend;
|
|
1443
1407
|
state.internal.actualRenderer = renderer;
|
|
1444
1408
|
state.internal.releaseRenderer = leaseRenderer(renderer, resolved.owned);
|
|
1445
|
-
state.set({
|
|
1446
|
-
webGPUSupported: isWebGPUBackend,
|
|
1447
|
-
renderer,
|
|
1448
|
-
gl: renderer,
|
|
1449
|
-
primaryStore: store
|
|
1450
|
-
});
|
|
1409
|
+
state.set({ webGPUSupported: isWebGPUBackend, renderer, primaryStore: store });
|
|
1451
1410
|
if (primary) {
|
|
1452
1411
|
const canvasTarget = renderer.getCanvasTarget?.();
|
|
1453
1412
|
(_a = state.internal).pendingRootId ?? (_a.pendingRootId = canvasId || scheduler.getScheduler().generateRootId());
|
|
@@ -1879,14 +1838,12 @@ function createRootConfiguration(store, canvas) {
|
|
|
1879
1838
|
};
|
|
1880
1839
|
const xr = {
|
|
1881
1840
|
connect() {
|
|
1882
|
-
const
|
|
1883
|
-
const xrManager = (renderer2 || gl).xr;
|
|
1841
|
+
const xrManager = store.getState().renderer.xr;
|
|
1884
1842
|
xrManager.addEventListener("sessionstart", handleSessionChange);
|
|
1885
1843
|
xrManager.addEventListener("sessionend", handleSessionChange);
|
|
1886
1844
|
},
|
|
1887
1845
|
disconnect() {
|
|
1888
|
-
const
|
|
1889
|
-
const xrManager = (renderer2 || gl).xr;
|
|
1846
|
+
const xrManager = store.getState().renderer.xr;
|
|
1890
1847
|
xrManager.removeEventListener("sessionstart", handleSessionChange);
|
|
1891
1848
|
xrManager.removeEventListener("sessionend", handleSessionChange);
|
|
1892
1849
|
}
|
|
@@ -1953,7 +1910,7 @@ function createRootConfiguration(store, canvas) {
|
|
|
1953
1910
|
};
|
|
1954
1911
|
}
|
|
1955
1912
|
|
|
1956
|
-
const version = "10.0.0-alpha.
|
|
1913
|
+
const version = "10.0.0-alpha.6";
|
|
1957
1914
|
const packageData = {
|
|
1958
1915
|
version: version};
|
|
1959
1916
|
|
|
@@ -15824,11 +15781,63 @@ async function importLoader(format) {
|
|
|
15824
15781
|
loader = (await import('three/examples/jsm/loaders/EXRLoader.js')).EXRLoader;
|
|
15825
15782
|
break;
|
|
15826
15783
|
case "jpg":
|
|
15827
|
-
loader = (await import('three/examples/jsm/loaders/UltraHDRLoader.js')).UltraHDRLoader;
|
|
15784
|
+
loader = createJpegLoader((await import('three/examples/jsm/loaders/UltraHDRLoader.js')).UltraHDRLoader);
|
|
15785
|
+
break;
|
|
15786
|
+
case "ldr":
|
|
15787
|
+
loader = getThree().TextureLoader;
|
|
15828
15788
|
break;
|
|
15829
15789
|
}
|
|
15830
15790
|
return loader;
|
|
15831
15791
|
}
|
|
15792
|
+
function createJpegLoader(UltraHDR) {
|
|
15793
|
+
return class JpegEnvironmentLoader extends UltraHDR {
|
|
15794
|
+
// @ts-expect-error A plain JPEG resolves to a Texture, not the DataTexture UltraHDRLoader declares
|
|
15795
|
+
load(url, onLoad, onProgress, onError) {
|
|
15796
|
+
const three = getThree();
|
|
15797
|
+
const file = new three.FileLoader(this.manager);
|
|
15798
|
+
file.setResponseType("arraybuffer");
|
|
15799
|
+
file.setRequestHeader(this.requestHeader);
|
|
15800
|
+
file.setPath(this.path);
|
|
15801
|
+
file.setWithCredentials(this.withCredentials);
|
|
15802
|
+
file.load(
|
|
15803
|
+
url,
|
|
15804
|
+
(buffer) => {
|
|
15805
|
+
try {
|
|
15806
|
+
this.parse(buffer, (texData) => {
|
|
15807
|
+
const { data } = texData;
|
|
15808
|
+
const texture = new three.DataTexture(data, texData.width, texData.height, three.RGBAFormat, texData.type);
|
|
15809
|
+
texture.minFilter = three.LinearMipMapLinearFilter;
|
|
15810
|
+
texture.magFilter = three.LinearFilter;
|
|
15811
|
+
texture.generateMipmaps = true;
|
|
15812
|
+
texture.flipY = true;
|
|
15813
|
+
texture.needsUpdate = true;
|
|
15814
|
+
onLoad?.(texture);
|
|
15815
|
+
});
|
|
15816
|
+
} catch {
|
|
15817
|
+
const objectURL = URL.createObjectURL(new Blob([buffer], { type: "image/jpeg" }));
|
|
15818
|
+
const settle = () => URL.revokeObjectURL(objectURL);
|
|
15819
|
+
new three.ImageLoader().load(
|
|
15820
|
+
objectURL,
|
|
15821
|
+
(image) => {
|
|
15822
|
+
settle();
|
|
15823
|
+
const texture = new three.Texture(image);
|
|
15824
|
+
texture.needsUpdate = true;
|
|
15825
|
+
onLoad?.(texture);
|
|
15826
|
+
},
|
|
15827
|
+
void 0,
|
|
15828
|
+
(error) => {
|
|
15829
|
+
settle();
|
|
15830
|
+
onError?.(error);
|
|
15831
|
+
}
|
|
15832
|
+
);
|
|
15833
|
+
}
|
|
15834
|
+
},
|
|
15835
|
+
onProgress,
|
|
15836
|
+
onError
|
|
15837
|
+
);
|
|
15838
|
+
}
|
|
15839
|
+
};
|
|
15840
|
+
}
|
|
15832
15841
|
const LOADER_KEY = Symbol("r3f-environment-loader");
|
|
15833
15842
|
function useEnvironmentLoader(format) {
|
|
15834
15843
|
return suspendReact.suspend(() => loadLoader(format), [LOADER_KEY, format]);
|
|
@@ -15863,7 +15872,8 @@ function useEnvironment({
|
|
|
15863
15872
|
) : loaderResult;
|
|
15864
15873
|
const three = getThree();
|
|
15865
15874
|
texture.mapping = isCubemap ? three.CubeReflectionMapping : three.EquirectangularReflectionMapping;
|
|
15866
|
-
|
|
15875
|
+
const hdr = format === "hdr-cube" || texture.isDataTexture === true;
|
|
15876
|
+
texture.colorSpace = colorSpace ?? (hdr ? "srgb-linear" : "srgb");
|
|
15867
15877
|
return texture;
|
|
15868
15878
|
}
|
|
15869
15879
|
const preloadDefaultOptions = {
|
|
@@ -15922,7 +15932,7 @@ function validatePreset(preset) {
|
|
|
15922
15932
|
function getFormat(files) {
|
|
15923
15933
|
const isCubemap = isArray(files) && files.length === 6;
|
|
15924
15934
|
const firstEntry = isArray(files) ? files[0] : files;
|
|
15925
|
-
const firstExtension = firstEntry.split(
|
|
15935
|
+
const firstExtension = firstEntry.split(/[?#]/)[0].split(".").pop()?.toLowerCase();
|
|
15926
15936
|
let format;
|
|
15927
15937
|
if (isCubemap) format = firstExtension === "hdr" ? "hdr-cube" : "cube";
|
|
15928
15938
|
else if (firstEntry.startsWith("data:application/exr")) format = "exr";
|
|
@@ -15930,6 +15940,8 @@ function getFormat(files) {
|
|
|
15930
15940
|
else if (firstEntry.startsWith("data:image/jpeg")) format = "jpg";
|
|
15931
15941
|
else if (firstExtension === "hdr" || firstExtension === "exr") format = firstExtension;
|
|
15932
15942
|
else if (firstExtension === "jpg" || firstExtension === "jpeg") format = "jpg";
|
|
15943
|
+
else if (/^data:image\/(png|webp|avif|gif)[;,]/.test(firstEntry)) format = "ldr";
|
|
15944
|
+
else if (["png", "webp", "avif", "gif"].includes(firstExtension)) format = "ldr";
|
|
15933
15945
|
return { format, isCubemap };
|
|
15934
15946
|
}
|
|
15935
15947
|
|
|
@@ -15993,6 +16005,7 @@ function PortalInner({ state = {}, children, container }) {
|
|
|
15993
16005
|
const lastRoot = lastRootState.current;
|
|
15994
16006
|
if (lastRoot) {
|
|
15995
16007
|
for (const key in rootState) {
|
|
16008
|
+
if (textureStaging.isAccessor(rootState, key)) continue;
|
|
15996
16009
|
const field = key;
|
|
15997
16010
|
const changed = rootState[field] !== lastRoot[field];
|
|
15998
16011
|
const inherited = !(key in rest) && injectState[field] === lastRoot[field];
|
|
@@ -16009,11 +16022,7 @@ function PortalInner({ state = {}, children, container }) {
|
|
|
16009
16022
|
if (camera !== rootState.camera) updateCamera(camera, resolvedSize);
|
|
16010
16023
|
}
|
|
16011
16024
|
const set = injectState.set;
|
|
16012
|
-
return {
|
|
16013
|
-
// The intersect consists of the previous root state
|
|
16014
|
-
...rootState,
|
|
16015
|
-
...injectState,
|
|
16016
|
-
...followed,
|
|
16025
|
+
return Object.assign(textureStaging.cloneState(rootState, injectState, followed), {
|
|
16017
16026
|
// Portals have their own scene - always a real THREE.Scene (injected if needed)
|
|
16018
16027
|
scene: portalScene,
|
|
16019
16028
|
// rootScene always points to the actual THREE.Scene, even inside portals
|
|
@@ -16028,13 +16037,19 @@ function PortalInner({ state = {}, children, container }) {
|
|
|
16028
16037
|
size: resolvedSize,
|
|
16029
16038
|
viewport: { ...rootState.viewport, ...viewport },
|
|
16030
16039
|
// Layers are allowed to override events
|
|
16031
|
-
setEvents: (events2) => set((state2) => ({
|
|
16032
|
-
// Container for child attachment - the portalScene (injected or container itself)
|
|
16033
|
-
|
|
16034
|
-
|
|
16040
|
+
setEvents: (events2) => set((state2) => ({ events: { ...state2.events, ...events2 } })),
|
|
16041
|
+
// Container for child attachment - the portalScene (injected or container itself). A portal
|
|
16042
|
+
// renders with its parent's renderer, which `renderer` / `gl` read from `actualRenderer`
|
|
16043
|
+
internal: {
|
|
16044
|
+
...rootState.internal,
|
|
16045
|
+
...injectState.internal,
|
|
16046
|
+
actualRenderer: rootState.internal.actualRenderer,
|
|
16047
|
+
container: portalScene
|
|
16048
|
+
}
|
|
16049
|
+
});
|
|
16035
16050
|
});
|
|
16036
16051
|
const usePortalStore = React.useMemo(() => {
|
|
16037
|
-
const store = traditional.createWithEqualityFn((set, get) => ({ ...rest, set, get }));
|
|
16052
|
+
const store = traditional.createWithEqualityFn(textureStaging.keepAccessors((set, get) => ({ ...rest, set, get })));
|
|
16038
16053
|
const onMutate = (prev) => store.setState((state2) => inject.current(prev, state2));
|
|
16039
16054
|
onMutate(previousRoot.getState());
|
|
16040
16055
|
return store;
|
|
@@ -16244,12 +16259,12 @@ function EnvironmentColor({ color, scene }) {
|
|
|
16244
16259
|
function EnvironmentDualSource(props) {
|
|
16245
16260
|
const { backgroundFiles, ...envProps } = props;
|
|
16246
16261
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
16247
|
-
/* @__PURE__ */ jsxRuntime.jsx(EnvironmentCube, { ...envProps, background: false }),
|
|
16248
|
-
/* @__PURE__ */ jsxRuntime.jsx(EnvironmentCube, { ...props, files: backgroundFiles, background: "only" })
|
|
16262
|
+
(envProps.files || envProps.preset) && /* @__PURE__ */ jsxRuntime.jsx(EnvironmentCube, { ...envProps, background: false }),
|
|
16263
|
+
/* @__PURE__ */ jsxRuntime.jsx(EnvironmentCube, { ...props, files: backgroundFiles, preset: void 0, background: "only" })
|
|
16249
16264
|
] });
|
|
16250
16265
|
}
|
|
16251
16266
|
function Environment(props) {
|
|
16252
|
-
if (props.color && !props.files && !props.preset && !props.map) {
|
|
16267
|
+
if (props.color !== void 0 && !props.files && !props.preset && !props.map) {
|
|
16253
16268
|
return /* @__PURE__ */ jsxRuntime.jsx(EnvironmentColor, { ...props });
|
|
16254
16269
|
}
|
|
16255
16270
|
if (props.backgroundFiles && props.backgroundFiles !== props.files) {
|
|
@@ -16259,7 +16274,7 @@ function Environment(props) {
|
|
|
16259
16274
|
}
|
|
16260
16275
|
|
|
16261
16276
|
function parseBackground(background) {
|
|
16262
|
-
if (
|
|
16277
|
+
if (background === void 0 || background === null || background === "") return null;
|
|
16263
16278
|
if (typeof background === "object" && !background.isColor) {
|
|
16264
16279
|
const { backgroundMap, envMap, files, preset, ...rest } = background;
|
|
16265
16280
|
return {
|
|
@@ -16277,7 +16292,7 @@ function parseBackground(background) {
|
|
|
16277
16292
|
if (background in presetsObj) {
|
|
16278
16293
|
return { preset: background, background: true };
|
|
16279
16294
|
}
|
|
16280
|
-
if (/^(https
|
|
16295
|
+
if (/^(https?:\/\/|\/|\.\/|\.\.\/|data:)|\.(hdr|exr|jpg|jpeg|png|webp|avif|gif)([?#].*)?$/i.test(background)) {
|
|
16281
16296
|
return { files: background, background: true };
|
|
16282
16297
|
}
|
|
16283
16298
|
return { color: background, background: true };
|
|
@@ -16517,7 +16532,7 @@ function CanvasImpl({
|
|
|
16517
16532
|
if (rootEntry?.store) textureStaging.notifyRootExtensionsHmr(rootEntry.store);
|
|
16518
16533
|
});
|
|
16519
16534
|
};
|
|
16520
|
-
if (typeof ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/fiber.
|
|
16535
|
+
if (typeof ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/fiber.TRm3lZ7I.cjs', document.baseURI).href)) }) !== "undefined" && undefined) {
|
|
16521
16536
|
const hot = undefined;
|
|
16522
16537
|
hot.on("vite:afterUpdate", handleHMR);
|
|
16523
16538
|
return () => hot.off?.("vite:afterUpdate", handleHMR);
|
package/dist/webgpu/index.cjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
const Canvas$1 = require('../shared/fiber.
|
|
4
|
+
const Canvas$1 = require('../shared/fiber.TRm3lZ7I.cjs');
|
|
5
5
|
const webgpu = require('../chunks/webgpu.cjs');
|
|
6
|
-
const
|
|
6
|
+
const narrowed = require('../shared/fiber.BSXtODQl.cjs');
|
|
7
|
+
const textureStaging = require('../shared/fiber.BO8-26r8.cjs');
|
|
7
8
|
const scheduler = require('@pmndrs/scheduler');
|
|
8
9
|
|
|
9
10
|
function addTexture(set, key, value) {
|
|
@@ -54,10 +55,7 @@ const provider = {
|
|
|
54
55
|
function createRoot(canvas) {
|
|
55
56
|
return Canvas$1.createRoot(canvas, provider);
|
|
56
57
|
}
|
|
57
|
-
const
|
|
58
|
-
const useFrame = textureStaging.useFrame;
|
|
59
|
-
const useRenderTarget = Canvas$1.useRenderTarget;
|
|
60
|
-
const Canvas = ((props) => /* @__PURE__ */ jsxRuntime.jsx(Canvas$1.Canvas, { ...props, provider }));
|
|
58
|
+
const Canvas = narrowed.asWebGPUCanvas((props) => /* @__PURE__ */ jsxRuntime.jsx(Canvas$1.Canvas, { ...props, provider }));
|
|
61
59
|
|
|
62
60
|
exports.Environment = Canvas$1.Environment;
|
|
63
61
|
exports.EnvironmentCube = Canvas$1.EnvironmentCube;
|
|
@@ -135,6 +133,9 @@ exports.useTexture = Canvas$1.useTexture;
|
|
|
135
133
|
exports.useTextures = Canvas$1.useTextures;
|
|
136
134
|
exports.waitForPrimary = Canvas$1.waitForPrimary;
|
|
137
135
|
exports.whenThree = Canvas$1.whenThree;
|
|
136
|
+
exports.useFrame = narrowed.useFrame;
|
|
137
|
+
exports.useRenderTarget = narrowed.useRenderTarget;
|
|
138
|
+
exports.useThree = narrowed.useThree;
|
|
138
139
|
exports.Block = textureStaging.Block;
|
|
139
140
|
exports.ErrorBoundary = textureStaging.ErrorBoundary;
|
|
140
141
|
exports.context = textureStaging.context;
|
|
@@ -151,6 +152,3 @@ exports.R3F_BUILD_LEGACY = R3F_BUILD_LEGACY;
|
|
|
151
152
|
exports.R3F_BUILD_WEBGPU = R3F_BUILD_WEBGPU;
|
|
152
153
|
exports.createRoot = createRoot;
|
|
153
154
|
exports.createTextureOperations = createTextureOperations;
|
|
154
|
-
exports.useFrame = useFrame;
|
|
155
|
-
exports.useRenderTarget = useRenderTarget;
|
|
156
|
-
exports.useThree = useThree;
|