@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
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { c as createRoot$1, C as Canvas$1 } from './shared/fiber.
|
|
3
|
-
export { s as Environment, p as EnvironmentCube, E as EnvironmentMap, q as EnvironmentPortal,
|
|
4
|
-
|
|
2
|
+
import { c as createRoot$1, C as Canvas$1 } from './shared/fiber.BuWl08aJ.mjs';
|
|
3
|
+
export { s as Environment, p as EnvironmentCube, E as EnvironmentMap, q as EnvironmentPortal, ah as FROM_REF, I as IsObject, ak as ONCE, P as Portal, S as REACT_INTERNAL_PROPS, a0 as RESERVED_PROPS, T as Texture, _ as _roots, d as addAfterEffect, b as addEffect, e as addTail, f as advance, a5 as applyProps, a2 as attach, W as buildGraph, N as calculateDpr, y as createEvents, a as createPointerEvents, M as createPortal, l as createStore, a3 as detach, a4 as diffProps, X as dispose, a as events, H as extend, U as findInitialRoot, K as flushSync, ai as fromRef, Y as getInstanceProps, h as getPrimary, k as getPrimaryIds, V as getRootState, m as getThree, O as getUuidPrefix, ag as hasConstructor, j as hasPrimary, n as hasThree, i as invalidate, $ as invalidateInstance, a6 as is, a9 as isColorRepresentation, af as isCopyable, aj as isFromRef, ac as isLayers, aa as isObject3D, am as isOnce, a7 as isOrthographicCamera, a8 as isRef, g as isRenderer, ab as isTexture, ad as isUniform, ae as isVectorLike, al as once, Z as prepare, t as presetsObj, J as reconciler, r as registerPrimary, x as removeInteractivity, a1 as resolve, v as swapInteractivity, L as unmountComponentAtNode, u as unregisterPrimary, Q as updateCamera, R as updateFrustum, G as useEnvironment, A as useGraph, z as useInstanceHandle, B as useLoader, D as useTexture, F as useTextures, w as waitForPrimary, o as whenThree } from './shared/fiber.BuWl08aJ.mjs';
|
|
4
|
+
import { a as asWebGPUCanvas } from './shared/fiber.DEWBFQJe.mjs';
|
|
5
|
+
export { b as useFrame, c as useRenderTarget, u as useThree } from './shared/fiber.DEWBFQJe.mjs';
|
|
6
|
+
export { B as Block, E as ErrorBoundary, c as context, r as registerRootExtension, s as setRenderOverride, f as useBridge, d as useIsomorphicLayoutEffect, e as useMutableCallback, u as useStore } from './shared/fiber.C-3TIsF8.mjs';
|
|
5
7
|
export { Scheduler, getScheduler } from '@pmndrs/scheduler';
|
|
6
8
|
|
|
7
9
|
const R3F_BUILD_LEGACY = false;
|
|
@@ -12,8 +14,6 @@ const provider = {
|
|
|
12
14
|
function createRoot(canvas) {
|
|
13
15
|
return createRoot$1(canvas, provider);
|
|
14
16
|
}
|
|
15
|
-
|
|
16
|
-
return /* @__PURE__ */ jsx(Canvas$1, { ...props, provider });
|
|
17
|
-
}
|
|
17
|
+
const Canvas = asWebGPUCanvas((props) => /* @__PURE__ */ jsx(Canvas$1, { ...props, provider }));
|
|
18
18
|
|
|
19
19
|
export { Canvas, R3F_BUILD_LEGACY, R3F_BUILD_WEBGPU, createRoot };
|
package/dist/legacy.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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 THREE = require('three');
|
|
6
|
-
const textureStaging = require('./shared/fiber.
|
|
6
|
+
const textureStaging = require('./shared/fiber.BO8-26r8.cjs');
|
|
7
7
|
const scheduler = require('@pmndrs/scheduler');
|
|
8
8
|
|
|
9
9
|
function _interopNamespaceCompat(e) {
|
package/dist/legacy.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import { WebGLRenderTarget } from 'three';
|
|
3
|
-
import { M as MutableOrReadonlyParameters$1, a as MathRepresentation$1, V as VectorRepresentation$1, b as MathTypes$1, c as MathType$1, d as MathProps$1, e as Vector2$1, f as Vector3$1, g as Vector4$1, C as Color$1, L as Layers$1, Q as Quaternion$1, E as Euler$1, h as Matrix3$1, i as Matrix4$1, R as RaycastableRepresentation$1, j as EventProps$1, G as GeometryTransformProps$1, k as GeometryProps$1, T as TSLNodeInput$1, N as NodeProps$1, l as ReactProps$1, m as ConstructorRepresentation, n as ElementProps$1, o as ThreeElement$1, p as ThreeToJSXElements$1, O as Object3DMethod$1, q as ThreeElementsOf$1, r as ElementOf$1,
|
|
4
|
-
export {
|
|
5
|
-
import {
|
|
6
|
-
export { B as BackgroundConfig, p as BackgroundProp,
|
|
3
|
+
import { M as MutableOrReadonlyParameters$1, a as MathRepresentation$1, V as VectorRepresentation$1, b as MathTypes$1, c as MathType$1, d as MathProps$1, e as Vector2$1, f as Vector3$1, g as Vector4$1, C as Color$1, L as Layers$1, Q as Quaternion$1, E as Euler$1, h as Matrix3$1, i as Matrix4$1, R as RaycastableRepresentation$1, j as EventProps$1, G as GeometryTransformProps$1, k as GeometryProps$1, T as TSLNodeInput$1, N as NodeProps$1, l as ReactProps$1, m as ConstructorRepresentation, n as ElementProps$1, o as ThreeElement$1, p as ThreeToJSXElements$1, O as Object3DMethod$1, q as ThreeElementsOf$1, r as ElementOf$1, s as ReconcilerRoot } from './shared/fiber.DQTSZ24m.cjs';
|
|
4
|
+
export { aE as Act, as as Args, at as ArgsProp, ap as AttachFnType, aq as AttachType, a7 as BaseRendererProps, aF as Bridge, U as Camera, aj as CameraProps, ag as CanvasSchedulerConfig, ar as Catalogue, aa as ColorManagementConfig, a1 as ComputeFunction, ad as DefaultGLProps, af as DefaultRendererProps, aK as Disposable, Z as DomEvent, D as Dpr, aJ as EquConfig, $ as EventHandlers, a3 as EventManager, _ as Events, am as FiberRoot, a0 as FilterFunction, aY as ForRegisteredRenderer, aO as FrameCallback, aN as FrameNextCallback, aL as FrameNextState, aM as FrameState, F as Frameloop, ae as GLProps, aw as HostConfig, al as InjectState, av as Instance, au as InstanceProps, K as Intersection, W as IntersectionEvent, aC as IsAllOptional, aB as IsOptional, aA as Mutable, ax as NonFunctionKeys, aI as ObjectMap, aR as OcclusionSupport, a6 as OffscreenCanvas, ay as Overwrite, B as Performance, a4 as PointerCaptureTarget, P as PointerState, az as Properties, aZ as R3FRenderTarget, a_ as R3FRendererSupport, aW as Register, aX as RegisteredRenderer, A as RenderCallback, ak as RenderProps, a9 as Renderer, ah as RendererConfigExtended, a8 as RendererFactory, ai as RendererProps, aV as RendererProvider, ac as RendererSettingsConfig, aU as RendererSupport, ao as Root, v as RootExtension, J as RootStore, aG as SetBlock, ab as ShadowsConfig, y as Size, S as Subscription, aD as ThreeCamera, aQ as ThreeCore, Y as ThreeEvent, aP as ThreeNamespace, an as TrackedPromise, aH as UnblockProps, z as Viewport, a5 as VisibilityEntry, aS as WebGLSupport, aT as WebGPUSupport, X as XRManager, a2 as XRPointerConfig, w as context, t as registerRootExtension, u as setRenderOverride, a$ as useStore } from './shared/fiber.DQTSZ24m.cjs';
|
|
5
|
+
import { aU as CanvasProps, C as LegacyRootState, R as RenderTargetOptions } from './shared/fiber.34TOMPo3.cjs';
|
|
6
|
+
export { B as BackgroundConfig, p as BackgroundProp, ah as Block, a2 as DisposeOptions, K as Environment, H as EnvironmentCube, a5 as EnvironmentLoaderProps, F as EnvironmentMap, J as EnvironmentPortal, D as EnvironmentProps, ai as ErrorBoundary, E as Extensions, aM as FROM_REF, aN as FromRefMarker, q as GLTFLike, o as GlobalEffectType, G as GlobalRenderCallback, t as InferLoadResult, I as InputLike, A as InternalState, X as IsObject, A as LegacyInternalState, z as LegacyRenderer, s as LoaderInstance, L as LoaderLike, v as LoaderResult, Y as MappedTextureType, aQ as ONCE, aS as OnceValue, ad as Portal, N as PresetsType, P as PrimaryCanvasEntry, z as R3FRenderer, an as REACT_INTERNAL_PROPS, av as RESERVED_PROPS, $ as Texture, a0 as TextureInput, a1 as TextureResult, Z as UseTextureOptions, a3 as UseTexturesReturn, W as WebGLDefaultProps, x as WebGLProps, y as WebGLShadowConfig, aa as _roots, b as addAfterEffect, a as addEffect, d as addTail, e as advance, aA as applyProps, ax as attach, aq as buildGraph, aj as calculateDpr, S as createEvents, c as createPointerEvents, ac as createPortal, k as createStore, ay as detach, az as diffProps, ar as dispose, c as events, a7 as extend, ao as findInitialRoot, a9 as flushSync, aO as fromRef, as as getInstanceProps, g as getPrimary, j as getPrimaryIds, ap as getRootState, l as getThree, ak as getUuidPrefix, aL as hasConstructor, h as hasPrimary, m as hasThree, i as invalidate, au as invalidateInstance, aB as is, aE as isColorRepresentation, aK as isCopyable, aP as isFromRef, aH as isLayers, aF as isObject3D, aT as isOnce, aC as isOrthographicCamera, aD as isRef, f as isRenderer, aG as isTexture, aI as isUniform, aJ as isVectorLike, aR as once, at as prepare, M as presetsObj, a8 as reconciler, r as registerPrimary, Q as removeInteractivity, aw as resolve, O as swapInteractivity, ab as unmountComponentAtNode, u as unregisterPrimary, al as updateCamera, am as updateFrustum, ag as useBridge, a6 as useEnvironment, U as useGraph, T as useInstanceHandle, ae as useIsomorphicLayoutEffect, V as useLoader, af as useMutableCallback, _ as useTexture, a4 as useTextures, w as waitForPrimary, n as whenThree } from './shared/fiber.34TOMPo3.cjs';
|
|
7
7
|
import { FrameCallback, UseFrameNextOptions, FrameNextControls } from '@pmndrs/scheduler';
|
|
8
8
|
export { AddPhaseOptions, FrameControls, FrameNextControls, FrameTimingState, RootOptions, Scheduler, SchedulerApi, UseFrameNextOptions, UseFrameOptions, getScheduler } from '@pmndrs/scheduler';
|
|
9
9
|
import { JSX } from 'react';
|
package/dist/legacy.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import { WebGLRenderTarget } from 'three';
|
|
3
|
-
import { M as MutableOrReadonlyParameters$1, a as MathRepresentation$1, V as VectorRepresentation$1, b as MathTypes$1, c as MathType$1, d as MathProps$1, e as Vector2$1, f as Vector3$1, g as Vector4$1, C as Color$1, L as Layers$1, Q as Quaternion$1, E as Euler$1, h as Matrix3$1, i as Matrix4$1, R as RaycastableRepresentation$1, j as EventProps$1, G as GeometryTransformProps$1, k as GeometryProps$1, T as TSLNodeInput$1, N as NodeProps$1, l as ReactProps$1, m as ConstructorRepresentation, n as ElementProps$1, o as ThreeElement$1, p as ThreeToJSXElements$1, O as Object3DMethod$1, q as ThreeElementsOf$1, r as ElementOf$1,
|
|
4
|
-
export {
|
|
5
|
-
import {
|
|
6
|
-
export { B as BackgroundConfig, p as BackgroundProp,
|
|
3
|
+
import { M as MutableOrReadonlyParameters$1, a as MathRepresentation$1, V as VectorRepresentation$1, b as MathTypes$1, c as MathType$1, d as MathProps$1, e as Vector2$1, f as Vector3$1, g as Vector4$1, C as Color$1, L as Layers$1, Q as Quaternion$1, E as Euler$1, h as Matrix3$1, i as Matrix4$1, R as RaycastableRepresentation$1, j as EventProps$1, G as GeometryTransformProps$1, k as GeometryProps$1, T as TSLNodeInput$1, N as NodeProps$1, l as ReactProps$1, m as ConstructorRepresentation, n as ElementProps$1, o as ThreeElement$1, p as ThreeToJSXElements$1, O as Object3DMethod$1, q as ThreeElementsOf$1, r as ElementOf$1, s as ReconcilerRoot } from './shared/fiber.DQTSZ24m.mjs';
|
|
4
|
+
export { aE as Act, as as Args, at as ArgsProp, ap as AttachFnType, aq as AttachType, a7 as BaseRendererProps, aF as Bridge, U as Camera, aj as CameraProps, ag as CanvasSchedulerConfig, ar as Catalogue, aa as ColorManagementConfig, a1 as ComputeFunction, ad as DefaultGLProps, af as DefaultRendererProps, aK as Disposable, Z as DomEvent, D as Dpr, aJ as EquConfig, $ as EventHandlers, a3 as EventManager, _ as Events, am as FiberRoot, a0 as FilterFunction, aY as ForRegisteredRenderer, aO as FrameCallback, aN as FrameNextCallback, aL as FrameNextState, aM as FrameState, F as Frameloop, ae as GLProps, aw as HostConfig, al as InjectState, av as Instance, au as InstanceProps, K as Intersection, W as IntersectionEvent, aC as IsAllOptional, aB as IsOptional, aA as Mutable, ax as NonFunctionKeys, aI as ObjectMap, aR as OcclusionSupport, a6 as OffscreenCanvas, ay as Overwrite, B as Performance, a4 as PointerCaptureTarget, P as PointerState, az as Properties, aZ as R3FRenderTarget, a_ as R3FRendererSupport, aW as Register, aX as RegisteredRenderer, A as RenderCallback, ak as RenderProps, a9 as Renderer, ah as RendererConfigExtended, a8 as RendererFactory, ai as RendererProps, aV as RendererProvider, ac as RendererSettingsConfig, aU as RendererSupport, ao as Root, v as RootExtension, J as RootStore, aG as SetBlock, ab as ShadowsConfig, y as Size, S as Subscription, aD as ThreeCamera, aQ as ThreeCore, Y as ThreeEvent, aP as ThreeNamespace, an as TrackedPromise, aH as UnblockProps, z as Viewport, a5 as VisibilityEntry, aS as WebGLSupport, aT as WebGPUSupport, X as XRManager, a2 as XRPointerConfig, w as context, t as registerRootExtension, u as setRenderOverride, a$ as useStore } from './shared/fiber.DQTSZ24m.mjs';
|
|
5
|
+
import { aU as CanvasProps, C as LegacyRootState, R as RenderTargetOptions } from './shared/fiber.Dy7Uz273.mjs';
|
|
6
|
+
export { B as BackgroundConfig, p as BackgroundProp, ah as Block, a2 as DisposeOptions, K as Environment, H as EnvironmentCube, a5 as EnvironmentLoaderProps, F as EnvironmentMap, J as EnvironmentPortal, D as EnvironmentProps, ai as ErrorBoundary, E as Extensions, aM as FROM_REF, aN as FromRefMarker, q as GLTFLike, o as GlobalEffectType, G as GlobalRenderCallback, t as InferLoadResult, I as InputLike, A as InternalState, X as IsObject, A as LegacyInternalState, z as LegacyRenderer, s as LoaderInstance, L as LoaderLike, v as LoaderResult, Y as MappedTextureType, aQ as ONCE, aS as OnceValue, ad as Portal, N as PresetsType, P as PrimaryCanvasEntry, z as R3FRenderer, an as REACT_INTERNAL_PROPS, av as RESERVED_PROPS, $ as Texture, a0 as TextureInput, a1 as TextureResult, Z as UseTextureOptions, a3 as UseTexturesReturn, W as WebGLDefaultProps, x as WebGLProps, y as WebGLShadowConfig, aa as _roots, b as addAfterEffect, a as addEffect, d as addTail, e as advance, aA as applyProps, ax as attach, aq as buildGraph, aj as calculateDpr, S as createEvents, c as createPointerEvents, ac as createPortal, k as createStore, ay as detach, az as diffProps, ar as dispose, c as events, a7 as extend, ao as findInitialRoot, a9 as flushSync, aO as fromRef, as as getInstanceProps, g as getPrimary, j as getPrimaryIds, ap as getRootState, l as getThree, ak as getUuidPrefix, aL as hasConstructor, h as hasPrimary, m as hasThree, i as invalidate, au as invalidateInstance, aB as is, aE as isColorRepresentation, aK as isCopyable, aP as isFromRef, aH as isLayers, aF as isObject3D, aT as isOnce, aC as isOrthographicCamera, aD as isRef, f as isRenderer, aG as isTexture, aI as isUniform, aJ as isVectorLike, aR as once, at as prepare, M as presetsObj, a8 as reconciler, r as registerPrimary, Q as removeInteractivity, aw as resolve, O as swapInteractivity, ab as unmountComponentAtNode, u as unregisterPrimary, al as updateCamera, am as updateFrustum, ag as useBridge, a6 as useEnvironment, U as useGraph, T as useInstanceHandle, ae as useIsomorphicLayoutEffect, V as useLoader, af as useMutableCallback, _ as useTexture, a4 as useTextures, w as waitForPrimary, n as whenThree } from './shared/fiber.Dy7Uz273.mjs';
|
|
7
7
|
import { FrameCallback, UseFrameNextOptions, FrameNextControls } from '@pmndrs/scheduler';
|
|
8
8
|
export { AddPhaseOptions, FrameControls, FrameNextControls, FrameTimingState, RootOptions, Scheduler, SchedulerApi, UseFrameNextOptions, UseFrameOptions, getScheduler } from '@pmndrs/scheduler';
|
|
9
9
|
import { JSX } from 'react';
|
package/dist/legacy.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import { WebGLRenderTarget } from 'three';
|
|
3
|
-
import { M as MutableOrReadonlyParameters$1, a as MathRepresentation$1, V as VectorRepresentation$1, b as MathTypes$1, c as MathType$1, d as MathProps$1, e as Vector2$1, f as Vector3$1, g as Vector4$1, C as Color$1, L as Layers$1, Q as Quaternion$1, E as Euler$1, h as Matrix3$1, i as Matrix4$1, R as RaycastableRepresentation$1, j as EventProps$1, G as GeometryTransformProps$1, k as GeometryProps$1, T as TSLNodeInput$1, N as NodeProps$1, l as ReactProps$1, m as ConstructorRepresentation, n as ElementProps$1, o as ThreeElement$1, p as ThreeToJSXElements$1, O as Object3DMethod$1, q as ThreeElementsOf$1, r as ElementOf$1,
|
|
4
|
-
export {
|
|
5
|
-
import {
|
|
6
|
-
export { B as BackgroundConfig, p as BackgroundProp,
|
|
3
|
+
import { M as MutableOrReadonlyParameters$1, a as MathRepresentation$1, V as VectorRepresentation$1, b as MathTypes$1, c as MathType$1, d as MathProps$1, e as Vector2$1, f as Vector3$1, g as Vector4$1, C as Color$1, L as Layers$1, Q as Quaternion$1, E as Euler$1, h as Matrix3$1, i as Matrix4$1, R as RaycastableRepresentation$1, j as EventProps$1, G as GeometryTransformProps$1, k as GeometryProps$1, T as TSLNodeInput$1, N as NodeProps$1, l as ReactProps$1, m as ConstructorRepresentation, n as ElementProps$1, o as ThreeElement$1, p as ThreeToJSXElements$1, O as Object3DMethod$1, q as ThreeElementsOf$1, r as ElementOf$1, s as ReconcilerRoot } from './shared/fiber.DQTSZ24m.js';
|
|
4
|
+
export { aE as Act, as as Args, at as ArgsProp, ap as AttachFnType, aq as AttachType, a7 as BaseRendererProps, aF as Bridge, U as Camera, aj as CameraProps, ag as CanvasSchedulerConfig, ar as Catalogue, aa as ColorManagementConfig, a1 as ComputeFunction, ad as DefaultGLProps, af as DefaultRendererProps, aK as Disposable, Z as DomEvent, D as Dpr, aJ as EquConfig, $ as EventHandlers, a3 as EventManager, _ as Events, am as FiberRoot, a0 as FilterFunction, aY as ForRegisteredRenderer, aO as FrameCallback, aN as FrameNextCallback, aL as FrameNextState, aM as FrameState, F as Frameloop, ae as GLProps, aw as HostConfig, al as InjectState, av as Instance, au as InstanceProps, K as Intersection, W as IntersectionEvent, aC as IsAllOptional, aB as IsOptional, aA as Mutable, ax as NonFunctionKeys, aI as ObjectMap, aR as OcclusionSupport, a6 as OffscreenCanvas, ay as Overwrite, B as Performance, a4 as PointerCaptureTarget, P as PointerState, az as Properties, aZ as R3FRenderTarget, a_ as R3FRendererSupport, aW as Register, aX as RegisteredRenderer, A as RenderCallback, ak as RenderProps, a9 as Renderer, ah as RendererConfigExtended, a8 as RendererFactory, ai as RendererProps, aV as RendererProvider, ac as RendererSettingsConfig, aU as RendererSupport, ao as Root, v as RootExtension, J as RootStore, aG as SetBlock, ab as ShadowsConfig, y as Size, S as Subscription, aD as ThreeCamera, aQ as ThreeCore, Y as ThreeEvent, aP as ThreeNamespace, an as TrackedPromise, aH as UnblockProps, z as Viewport, a5 as VisibilityEntry, aS as WebGLSupport, aT as WebGPUSupport, X as XRManager, a2 as XRPointerConfig, w as context, t as registerRootExtension, u as setRenderOverride, a$ as useStore } from './shared/fiber.DQTSZ24m.js';
|
|
5
|
+
import { aU as CanvasProps, C as LegacyRootState, R as RenderTargetOptions } from './shared/fiber.CjMAAsJy.js';
|
|
6
|
+
export { B as BackgroundConfig, p as BackgroundProp, ah as Block, a2 as DisposeOptions, K as Environment, H as EnvironmentCube, a5 as EnvironmentLoaderProps, F as EnvironmentMap, J as EnvironmentPortal, D as EnvironmentProps, ai as ErrorBoundary, E as Extensions, aM as FROM_REF, aN as FromRefMarker, q as GLTFLike, o as GlobalEffectType, G as GlobalRenderCallback, t as InferLoadResult, I as InputLike, A as InternalState, X as IsObject, A as LegacyInternalState, z as LegacyRenderer, s as LoaderInstance, L as LoaderLike, v as LoaderResult, Y as MappedTextureType, aQ as ONCE, aS as OnceValue, ad as Portal, N as PresetsType, P as PrimaryCanvasEntry, z as R3FRenderer, an as REACT_INTERNAL_PROPS, av as RESERVED_PROPS, $ as Texture, a0 as TextureInput, a1 as TextureResult, Z as UseTextureOptions, a3 as UseTexturesReturn, W as WebGLDefaultProps, x as WebGLProps, y as WebGLShadowConfig, aa as _roots, b as addAfterEffect, a as addEffect, d as addTail, e as advance, aA as applyProps, ax as attach, aq as buildGraph, aj as calculateDpr, S as createEvents, c as createPointerEvents, ac as createPortal, k as createStore, ay as detach, az as diffProps, ar as dispose, c as events, a7 as extend, ao as findInitialRoot, a9 as flushSync, aO as fromRef, as as getInstanceProps, g as getPrimary, j as getPrimaryIds, ap as getRootState, l as getThree, ak as getUuidPrefix, aL as hasConstructor, h as hasPrimary, m as hasThree, i as invalidate, au as invalidateInstance, aB as is, aE as isColorRepresentation, aK as isCopyable, aP as isFromRef, aH as isLayers, aF as isObject3D, aT as isOnce, aC as isOrthographicCamera, aD as isRef, f as isRenderer, aG as isTexture, aI as isUniform, aJ as isVectorLike, aR as once, at as prepare, M as presetsObj, a8 as reconciler, r as registerPrimary, Q as removeInteractivity, aw as resolve, O as swapInteractivity, ab as unmountComponentAtNode, u as unregisterPrimary, al as updateCamera, am as updateFrustum, ag as useBridge, a6 as useEnvironment, U as useGraph, T as useInstanceHandle, ae as useIsomorphicLayoutEffect, V as useLoader, af as useMutableCallback, _ as useTexture, a4 as useTextures, w as waitForPrimary, n as whenThree } from './shared/fiber.CjMAAsJy.js';
|
|
7
7
|
import { FrameCallback, UseFrameNextOptions, FrameNextControls } from '@pmndrs/scheduler';
|
|
8
8
|
export { AddPhaseOptions, FrameControls, FrameNextControls, FrameTimingState, RootOptions, Scheduler, SchedulerApi, UseFrameNextOptions, UseFrameOptions, getScheduler } from '@pmndrs/scheduler';
|
|
9
9
|
import { JSX } from 'react';
|
package/dist/legacy.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
export { s as Environment, p as EnvironmentCube, E as EnvironmentMap, q as EnvironmentPortal,
|
|
2
|
+
import { an as useRenderTarget$1, c as createRoot$1, C as Canvas$1 } from './shared/fiber.BuWl08aJ.mjs';
|
|
3
|
+
export { s as Environment, p as EnvironmentCube, E as EnvironmentMap, q as EnvironmentPortal, ah as FROM_REF, I as IsObject, ak as ONCE, P as Portal, S as REACT_INTERNAL_PROPS, a0 as RESERVED_PROPS, T as Texture, _ as _roots, d as addAfterEffect, b as addEffect, e as addTail, f as advance, a5 as applyProps, a2 as attach, W as buildGraph, N as calculateDpr, y as createEvents, a as createPointerEvents, M as createPortal, l as createStore, a3 as detach, a4 as diffProps, X as dispose, a as events, H as extend, U as findInitialRoot, K as flushSync, ai as fromRef, Y as getInstanceProps, h as getPrimary, k as getPrimaryIds, V as getRootState, m as getThree, O as getUuidPrefix, ag as hasConstructor, j as hasPrimary, n as hasThree, i as invalidate, $ as invalidateInstance, a6 as is, a9 as isColorRepresentation, af as isCopyable, aj as isFromRef, ac as isLayers, aa as isObject3D, am as isOnce, a7 as isOrthographicCamera, a8 as isRef, g as isRenderer, ab as isTexture, ad as isUniform, ae as isVectorLike, al as once, Z as prepare, t as presetsObj, J as reconciler, r as registerPrimary, x as removeInteractivity, a1 as resolve, v as swapInteractivity, L as unmountComponentAtNode, u as unregisterPrimary, Q as updateCamera, R as updateFrustum, G as useEnvironment, A as useGraph, z as useInstanceHandle, B as useLoader, D as useTexture, F as useTextures, w as waitForPrimary, o as whenThree } from './shared/fiber.BuWl08aJ.mjs';
|
|
4
4
|
import * as THREE from 'three';
|
|
5
|
-
import { a as useThree$1, b as useFrame$1 } from './shared/fiber.
|
|
6
|
-
export { B as Block, E as ErrorBoundary, c as context, r as registerRootExtension, s as setRenderOverride, f as useBridge, d as useIsomorphicLayoutEffect, e as useMutableCallback, u as useStore } from './shared/fiber.
|
|
5
|
+
import { a as useThree$1, b as useFrame$1 } from './shared/fiber.C-3TIsF8.mjs';
|
|
6
|
+
export { B as Block, E as ErrorBoundary, c as context, r as registerRootExtension, s as setRenderOverride, f as useBridge, d as useIsomorphicLayoutEffect, e as useMutableCallback, u as useStore } from './shared/fiber.C-3TIsF8.mjs';
|
|
7
7
|
export { Scheduler, getScheduler } from '@pmndrs/scheduler';
|
|
8
8
|
|
|
9
9
|
const webglSupport = {
|
|
@@ -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.cjs';
|
|
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 };
|
|
@@ -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.cjs';
|
|
4
|
+
import { R as RenderTargetOptions, aU as CanvasProps } from './fiber.34TOMPo3.cjs';
|
|
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 };
|
|
@@ -146,6 +146,118 @@ 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
|
+
const schedulerViews = /* @__PURE__ */ new WeakMap();
|
|
208
|
+
function stateForScheduler(state) {
|
|
209
|
+
let view = schedulerViews.get(state);
|
|
210
|
+
if (!view) {
|
|
211
|
+
view = cloneState(state);
|
|
212
|
+
Object.defineProperty(view, "gl", {
|
|
213
|
+
get() {
|
|
214
|
+
return this.internal?.actualRenderer;
|
|
215
|
+
},
|
|
216
|
+
set(value) {
|
|
217
|
+
this.internal.actualRenderer = value;
|
|
218
|
+
},
|
|
219
|
+
enumerable: true,
|
|
220
|
+
configurable: true
|
|
221
|
+
});
|
|
222
|
+
schedulerViews.set(state, view);
|
|
223
|
+
}
|
|
224
|
+
return view;
|
|
225
|
+
}
|
|
226
|
+
function defineRendererAccessors(state) {
|
|
227
|
+
Object.defineProperty(state, "gl", {
|
|
228
|
+
get() {
|
|
229
|
+
const renderer = this.internal?.actualRenderer;
|
|
230
|
+
if (!glNoticeShown && renderer && !this.isLegacy) {
|
|
231
|
+
const stack = new Error().stack || "";
|
|
232
|
+
if (!isInternalRendererAccess(stack)) {
|
|
233
|
+
glNoticeShown = true;
|
|
234
|
+
const cleanedStack = stack.split("\n").slice(2).join("\n") || "Stack trace unavailable";
|
|
235
|
+
notifyDepreciated({
|
|
236
|
+
heading: "Accessing state.gl in WebGPU mode",
|
|
237
|
+
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
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return renderer;
|
|
242
|
+
},
|
|
243
|
+
set(value) {
|
|
244
|
+
this.internal.actualRenderer = value;
|
|
245
|
+
},
|
|
246
|
+
enumerable: true,
|
|
247
|
+
configurable: true
|
|
248
|
+
});
|
|
249
|
+
Object.defineProperty(state, "renderer", {
|
|
250
|
+
get() {
|
|
251
|
+
return this.internal?.actualRenderer;
|
|
252
|
+
},
|
|
253
|
+
set(value) {
|
|
254
|
+
this.internal.actualRenderer = value;
|
|
255
|
+
},
|
|
256
|
+
enumerable: true,
|
|
257
|
+
configurable: true
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
|
|
149
261
|
const R3F_CONTEXT = Symbol.for("@react-three/fiber.context");
|
|
150
262
|
const context = globalThis[R3F_CONTEXT] ?? (globalThis[R3F_CONTEXT] = React__namespace.createContext(null));
|
|
151
263
|
|
|
@@ -257,15 +369,12 @@ function useFrame(callback, priorityOrOptions) {
|
|
|
257
369
|
});
|
|
258
370
|
}
|
|
259
371
|
const wrappedCallback = (frameState, delta) => {
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
frame: frameState.frame,
|
|
267
|
-
overstep: frameState.overstep
|
|
268
|
-
};
|
|
372
|
+
const mergedState = cloneState(store.getState());
|
|
373
|
+
mergedState.time = frameState.time;
|
|
374
|
+
mergedState.delta = frameState.delta;
|
|
375
|
+
mergedState.elapsed = frameState.elapsed;
|
|
376
|
+
mergedState.frame = frameState.frame;
|
|
377
|
+
mergedState.overstep = frameState.overstep;
|
|
269
378
|
callbackRef.current?.(mergedState, delta);
|
|
270
379
|
};
|
|
271
380
|
const unregister = scheduler$1.register(wrappedCallback, {
|
|
@@ -406,16 +515,22 @@ function getTextureView(store) {
|
|
|
406
515
|
exports.Block = Block;
|
|
407
516
|
exports.ErrorBoundary = ErrorBoundary;
|
|
408
517
|
exports.attachRootExtensions = attachRootExtensions;
|
|
518
|
+
exports.cloneState = cloneState;
|
|
409
519
|
exports.context = context;
|
|
520
|
+
exports.defineRendererAccessors = defineRendererAccessors;
|
|
410
521
|
exports.detachRootExtensions = detachRootExtensions;
|
|
411
522
|
exports.getTextureView = getTextureView;
|
|
523
|
+
exports.isAccessor = isAccessor;
|
|
412
524
|
exports.isDevelopment = isDevelopment;
|
|
525
|
+
exports.keepAccessors = keepAccessors;
|
|
413
526
|
exports.notifyAlpha = notifyAlpha;
|
|
414
527
|
exports.notifyDepreciated = notifyDepreciated;
|
|
415
528
|
exports.notifyRootExtensionsHmr = notifyRootExtensionsHmr;
|
|
529
|
+
exports.preserveAccessors = preserveAccessors;
|
|
416
530
|
exports.registerRootExtension = registerRootExtension;
|
|
417
531
|
exports.setRenderOverride = setRenderOverride;
|
|
418
532
|
exports.stageTextures = stageTextures;
|
|
533
|
+
exports.stateForScheduler = stateForScheduler;
|
|
419
534
|
exports.unstageTextures = unstageTextures;
|
|
420
535
|
exports.useBridge = useBridge;
|
|
421
536
|
exports.useFrame = useFrame;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const Canvas = require('./fiber.TRm3lZ7I.cjs');
|
|
4
|
+
const textureStaging = require('./fiber.BO8-26r8.cjs');
|
|
5
|
+
|
|
6
|
+
const useThree = textureStaging.useThree;
|
|
7
|
+
const useFrame = textureStaging.useFrame;
|
|
8
|
+
const useRenderTarget = Canvas.useRenderTarget;
|
|
9
|
+
const asWebGPUCanvas = (Canvas) => Canvas;
|
|
10
|
+
|
|
11
|
+
exports.asWebGPUCanvas = asWebGPUCanvas;
|
|
12
|
+
exports.useFrame = useFrame;
|
|
13
|
+
exports.useRenderTarget = useRenderTarget;
|
|
14
|
+
exports.useThree = useThree;
|
|
@@ -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.mjs';
|
|
4
|
+
import { R as RenderTargetOptions, aU as CanvasProps } from './fiber.Dy7Uz273.mjs';
|
|
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 };
|