@react-three/fiber 10.0.0-canary.7b7cecd → 10.0.0-canary.7dfc4e4
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/index.cjs +2436 -2394
- package/dist/index.d.cts +31 -10
- package/dist/index.d.mts +31 -10
- package/dist/index.d.ts +31 -10
- package/dist/index.mjs +2436 -2394
- package/dist/legacy.cjs +2430 -2393
- package/dist/legacy.d.cts +30 -13
- package/dist/legacy.d.mts +30 -13
- package/dist/legacy.d.ts +30 -13
- package/dist/legacy.mjs +2433 -2396
- package/dist/webgpu/index.cjs +2469 -2408
- package/dist/webgpu/index.d.cts +52 -59
- package/dist/webgpu/index.d.mts +52 -59
- package/dist/webgpu/index.d.ts +52 -59
- package/dist/webgpu/index.mjs +2475 -2414
- package/package.json +4 -4
- package/readme.md +1 -1
- package/react-reconciler/constants.d.ts +0 -7
- package/react-reconciler/constants.js +0 -1
- package/react-reconciler/index.d.ts +0 -1044
- package/react-reconciler/index.js +0 -208
package/dist/webgpu/index.d.cts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as three_examples_jsm_inspector_Inspector_js from 'three/examples/jsm/inspector/Inspector.js';
|
|
1
2
|
import * as three_webgpu from 'three/webgpu';
|
|
2
3
|
import { CubeRenderTarget, RenderTarget, WebGPURenderer, Node, StorageTexture, Data3DTexture, CanvasTarget, ShaderNodeObject, Euler as Euler$2, Color as Color$2, ColorRepresentation as ColorRepresentation$1, Layers as Layers$1, Raycaster, Intersection as Intersection$1, BufferGeometry, Matrix4 as Matrix4$1, Quaternion as Quaternion$1, Vector2 as Vector2$1, Vector3 as Vector3$1, Vector4 as Vector4$1, Matrix3 as Matrix3$1, Loader as Loader$1, ColorSpace, Texture as Texture$1, CubeTexture, Scene, Object3D, Frustum, OrthographicCamera, WebGPURendererParameters } from 'three/webgpu';
|
|
3
4
|
import { Inspector } from 'three/addons/inspector/Inspector.js';
|
|
@@ -11,7 +12,6 @@ import { FrameTimingState, FrameCallback as FrameCallback$1, SchedulerApi, UseFr
|
|
|
11
12
|
export { AddPhaseOptions, FrameControls, FrameNextControls, FrameTimingState, RootOptions, Scheduler, SchedulerApi, UseFrameNextOptions, UseFrameOptions, getScheduler } from '@pmndrs/scheduler';
|
|
12
13
|
import { Options } from 'react-use-measure';
|
|
13
14
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
14
|
-
import { ThreeElement as ThreeElement$1, Euler as Euler$3 } from '@react-three/fiber';
|
|
15
15
|
import { GroundedSkybox } from 'three/examples/jsm/objects/GroundedSkybox.js';
|
|
16
16
|
|
|
17
17
|
function _mergeNamespaces(n, m) {
|
|
@@ -41,6 +41,8 @@ function _mergeNamespaces(n, m) {
|
|
|
41
41
|
declare const R3F_BUILD_LEGACY = false;
|
|
42
42
|
declare const R3F_BUILD_WEBGPU = true;
|
|
43
43
|
|
|
44
|
+
/** Lazily load the three Inspector. Keeps it out of the eager module graph — see note above. */
|
|
45
|
+
declare function loadInspector(): Promise<typeof three_examples_jsm_inspector_Inspector_js.Inspector>;
|
|
44
46
|
declare const WebGLRenderer: {
|
|
45
47
|
new (): {};
|
|
46
48
|
};
|
|
@@ -62,7 +64,8 @@ var THREE = /*#__PURE__*/_mergeNamespaces({
|
|
|
62
64
|
WebGLRenderTarget: WebGLRenderTarget,
|
|
63
65
|
WebGLRenderer: WebGLRenderer,
|
|
64
66
|
WebGLRendererParameters: WebGLRendererParameters,
|
|
65
|
-
WebGLShadowMap: WebGLShadowMap
|
|
67
|
+
WebGLShadowMap: WebGLShadowMap,
|
|
68
|
+
loadInspector: loadInspector
|
|
66
69
|
}, [three_webgpu]);
|
|
67
70
|
|
|
68
71
|
//* Utility Types ==============================
|
|
@@ -500,6 +503,18 @@ interface InternalState {
|
|
|
500
503
|
* @see https://threejs.org/docs/#api/en/renderers/common/CanvasTarget
|
|
501
504
|
*/
|
|
502
505
|
canvasTarget?: CanvasTarget
|
|
506
|
+
/**
|
|
507
|
+
* Set when this root's canvas target has been resized and the backend's cached render pass
|
|
508
|
+
* descriptor (which holds a depth-stencil view built once per canvas) is therefore stale.
|
|
509
|
+
*
|
|
510
|
+
* Flushed by the canvas-target job in the `start` phase, which is the only place this root's
|
|
511
|
+
* target is guaranteed to be the renderer's active one — `backend.updateSize()` operates on
|
|
512
|
+
* whatever `getCanvasTarget()` returns, so calling it from the resize subscription would
|
|
513
|
+
* invalidate some other canvas's descriptor instead.
|
|
514
|
+
*
|
|
515
|
+
* @see https://github.com/pmndrs/react-three-fiber/issues/3847
|
|
516
|
+
*/
|
|
517
|
+
canvasTargetSizeDirty?: boolean
|
|
503
518
|
/**
|
|
504
519
|
* Whether multi-canvas rendering is active.
|
|
505
520
|
* True when any canvas uses `renderer={{ primaryCanvas: 'id' }}` to share a renderer.
|
|
@@ -1638,9 +1653,9 @@ type EnvironmentProps = {
|
|
|
1638
1653
|
blur?: number;
|
|
1639
1654
|
backgroundBlurriness?: number;
|
|
1640
1655
|
backgroundIntensity?: number;
|
|
1641
|
-
backgroundRotation?: Euler
|
|
1656
|
+
backgroundRotation?: Euler;
|
|
1642
1657
|
environmentIntensity?: number;
|
|
1643
|
-
environmentRotation?: Euler
|
|
1658
|
+
environmentRotation?: Euler;
|
|
1644
1659
|
map?: Texture$1;
|
|
1645
1660
|
preset?: PresetsType;
|
|
1646
1661
|
scene?: Scene | React$1.RefObject<Scene>;
|
|
@@ -1724,7 +1739,7 @@ declare function EnvironmentCube({ background, scene, blur, backgroundBlurriness
|
|
|
1724
1739
|
declare function EnvironmentPortal({ children, near, far, resolution, frames, map, background, blur, backgroundBlurriness, backgroundIntensity, backgroundRotation, environmentIntensity, environmentRotation, scene, files, path, preset, extensions, }: EnvironmentProps): react_jsx_runtime.JSX.Element;
|
|
1725
1740
|
declare module '@react-three/fiber' {
|
|
1726
1741
|
interface ThreeElements {
|
|
1727
|
-
groundProjectedEnvImpl: ThreeElement
|
|
1742
|
+
groundProjectedEnvImpl: ThreeElement<typeof GroundedSkybox>;
|
|
1728
1743
|
}
|
|
1729
1744
|
}
|
|
1730
1745
|
/**
|
|
@@ -1869,50 +1884,6 @@ declare namespace useLoader {
|
|
|
1869
1884
|
var loader: typeof getLoader;
|
|
1870
1885
|
}
|
|
1871
1886
|
|
|
1872
|
-
/**
|
|
1873
|
-
* Frame hook with phase-based ordering, priority, and FPS throttling.
|
|
1874
|
-
*
|
|
1875
|
-
* Always delivers full RootState — works both inside and outside Canvas context:
|
|
1876
|
-
* - Inside Canvas: Full RootState (renderer, scene, camera, etc.)
|
|
1877
|
-
* - Outside Canvas: The job registers immediately but the callback is held until a
|
|
1878
|
-
* Canvas adopts it, then runs with full RootState. For hostless / standalone
|
|
1879
|
-
* frame loops with no Canvas, use `@pmndrs/scheduler` directly.
|
|
1880
|
-
*
|
|
1881
|
-
* Returns a controls object for manual stepping, pausing, and resuming.
|
|
1882
|
-
*
|
|
1883
|
-
* @param callback - Function called each frame with (state, delta). Optional if you only need scheduler access.
|
|
1884
|
-
* @param priorityOrOptions - Either a priority number (backwards compat) or options object
|
|
1885
|
-
* @returns Controls object with step(), stepAll(), pause(), resume(), isPaused, id, scheduler
|
|
1886
|
-
*
|
|
1887
|
-
* @example
|
|
1888
|
-
* // Simple priority (backwards compat)
|
|
1889
|
-
* useFrame((state, delta) => { ... }, 5)
|
|
1890
|
-
*
|
|
1891
|
-
* @example
|
|
1892
|
-
* // With phase-based ordering
|
|
1893
|
-
* useFrame((state, delta) => { ... }, { phase: 'physics' })
|
|
1894
|
-
*
|
|
1895
|
-
* @example
|
|
1896
|
-
* // Outside Canvas - callback waits for a Canvas, then always has full state
|
|
1897
|
-
* function UI() {
|
|
1898
|
-
* useFrame((state, delta) => { syncUI(state.camera) });
|
|
1899
|
-
* return <button>...</button>;
|
|
1900
|
-
* }
|
|
1901
|
-
*
|
|
1902
|
-
* @example
|
|
1903
|
-
* // Hostless / standalone loop (no Canvas) - use @pmndrs/scheduler directly
|
|
1904
|
-
* import { getScheduler } from '@pmndrs/scheduler'
|
|
1905
|
-
* getScheduler().register((state, delta) => { updateGame(delta) })
|
|
1906
|
-
*
|
|
1907
|
-
* @example
|
|
1908
|
-
* // Scheduler-only access (no callback)
|
|
1909
|
-
* const { scheduler } = useFrame()
|
|
1910
|
-
* scheduler.pauseJob('some-job-id')
|
|
1911
|
-
*
|
|
1912
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe
|
|
1913
|
-
*/
|
|
1914
|
-
declare function useFrame(callback?: FrameNextCallback, priorityOrOptions?: number | UseFrameNextOptions): FrameNextControls;
|
|
1915
|
-
|
|
1916
1887
|
declare const IsObject: (url: unknown) => url is Record<string, string>;
|
|
1917
1888
|
type TextureArray<T> = T extends string[] ? Texture$1[] : never;
|
|
1918
1889
|
type TextureRecord<T> = T extends Record<string, string> ? {
|
|
@@ -2098,11 +2069,6 @@ declare function useRenderTarget(width: number, height: number, options?: Render
|
|
|
2098
2069
|
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usestore
|
|
2099
2070
|
*/
|
|
2100
2071
|
declare function useStore(): RootStore;
|
|
2101
|
-
/**
|
|
2102
|
-
* Accesses R3F's internal state, containing renderer, canvas, scene, etc.
|
|
2103
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usethree
|
|
2104
|
-
*/
|
|
2105
|
-
declare function useThree<T = RootState>(selector?: (state: RootState) => T, equalityFn?: <T>(state: T, newState: T) => boolean): T;
|
|
2106
2072
|
/**
|
|
2107
2073
|
* Exposes an object's {@link Instance}.
|
|
2108
2074
|
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle
|
|
@@ -2178,7 +2144,10 @@ declare function addTail(callback: GlobalRenderCallback): () => void;
|
|
|
2178
2144
|
* Invalidates the view, requesting a frame to be rendered.
|
|
2179
2145
|
* In demand mode, this triggers the scheduler to run frames.
|
|
2180
2146
|
*
|
|
2181
|
-
*
|
|
2147
|
+
* With a state argument, only that root's jobs run on the requested frames; other
|
|
2148
|
+
* roots on 'demand' stay idle. Without one, every registered root is invalidated.
|
|
2149
|
+
*
|
|
2150
|
+
* @param state - Optional root state; targets the invalidation at that root
|
|
2182
2151
|
* @param frames - Number of frames to request (default: 1)
|
|
2183
2152
|
* @param stackFrames - If false, sets pendingFrames to frames. If true, adds to existing pendingFrames (default: false)
|
|
2184
2153
|
*
|
|
@@ -2189,14 +2158,16 @@ declare function invalidate(state?: RootState, frames?: number, stackFrames?: bo
|
|
|
2189
2158
|
* Advances the frameloop and runs render effects.
|
|
2190
2159
|
* Useful for when manually rendering via `frameloop="never"`.
|
|
2191
2160
|
*
|
|
2161
|
+
* With a state argument, only that root is stepped. Without one, every
|
|
2162
|
+
* registered root is stepped for backwards compatibility.
|
|
2163
|
+
*
|
|
2192
2164
|
* @param timestamp - The timestamp to use for this frame
|
|
2193
2165
|
* @param runGlobalEffects - Ignored (kept for backwards compat, global effects always run)
|
|
2194
|
-
* @param state -
|
|
2195
|
-
* @param frame - Ignored (kept for backwards compat)
|
|
2166
|
+
* @param state - Optional root state; targets the manual step at that root
|
|
2196
2167
|
*
|
|
2197
2168
|
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
|
|
2198
2169
|
*/
|
|
2199
|
-
declare function advance(timestamp: number): void;
|
|
2170
|
+
declare function advance(timestamp: number, runGlobalEffects?: boolean, state?: RootState): void;
|
|
2200
2171
|
|
|
2201
2172
|
/* eslint-disable @definitelytyped/no-unnecessary-generics */
|
|
2202
2173
|
declare function ReactReconciler<
|
|
@@ -4087,6 +4058,10 @@ declare function createTextureOperations(set: StoreApi<RootState>['setState']):
|
|
|
4087
4058
|
* - Callbacks receive full RootState for flexibility
|
|
4088
4059
|
* - No auto-cleanup on unmount - use reset() for explicit cleanup
|
|
4089
4060
|
* - Scene/camera changes trigger scenePass recreation
|
|
4061
|
+
* - A replaced scenePass is disposed once the new graph is installed, so rebuild() does not
|
|
4062
|
+
* strand its render target (and MRT attachments) on the GPU
|
|
4063
|
+
* - Any run that changes the output node sets RenderPipeline.needsUpdate, so rebuild() actually
|
|
4064
|
+
* recompiles instead of silently keeping the first compiled graph
|
|
4090
4065
|
*
|
|
4091
4066
|
* @param mainCB - Main callback to configure outputNode and create effect passes
|
|
4092
4067
|
* @param setupCB - Optional setup callback to configure MRT on scenePass
|
|
@@ -4164,5 +4139,23 @@ interface WebGPURootState extends Omit<RootState, 'renderer' | 'gl' | 'internal'
|
|
|
4164
4139
|
internal: WebGPUInternalState
|
|
4165
4140
|
}
|
|
4166
4141
|
|
|
4142
|
+
/**
|
|
4143
|
+
* @fileoverview WebGPU entry point - WebGPU only, no legacy WebGL
|
|
4144
|
+
*
|
|
4145
|
+
* This entry point is for apps that want to use ONLY WebGPURenderer.
|
|
4146
|
+
* Includes WebGPU-specific hooks (useUniforms, useNodes, useTextures).
|
|
4147
|
+
* Auto-extends THREE with WebGPU node materials (MeshBasicNodeMaterial, etc.)
|
|
4148
|
+
*
|
|
4149
|
+
* Usage:
|
|
4150
|
+
* import { Canvas, useFrame, useUniforms } from '@react-three/fiber/webgpu'
|
|
4151
|
+
*/
|
|
4152
|
+
|
|
4153
|
+
/** `useThree` narrowed to WebGPU state — `state.renderer` is a `WebGPURenderer`. */
|
|
4154
|
+
type UseThreeWebGPU = <T = WebGPURootState>(selector?: (state: WebGPURootState) => T, equalityFn?: <U>(state: U, newState: U) => boolean) => T;
|
|
4155
|
+
/** `useFrame` narrowed to WebGPU state — the callback's `state.renderer` is a `WebGPURenderer`. */
|
|
4156
|
+
type UseFrameWebGPU = (callback?: FrameCallback$1<WebGPURootState>, priorityOrOptions?: number | UseFrameNextOptions) => FrameNextControls;
|
|
4157
|
+
declare const useThree: UseThreeWebGPU;
|
|
4158
|
+
declare const useFrame: UseFrameWebGPU;
|
|
4159
|
+
|
|
4167
4160
|
export { Block, Canvas, Environment, EnvironmentCube, EnvironmentMap, EnvironmentPortal, ErrorBoundary, FROM_REF, IsObject, ONCE, Portal, R3F_BUILD_LEGACY, R3F_BUILD_WEBGPU, REACT_INTERNAL_PROPS, RESERVED_PROPS, three_d as ReactThreeFiber, Texture, _roots, addAfterEffect, addEffect, addTail, advance, applyProps, attach, buildGraph, calculateDpr, clearNodeScope, clearRootNodes, clearRootUniforms, clearScope, context, createEvents, createPointerEvents, createPortal, createRoot, createScopedStore, createStore, createTextureOperations, detach, diffProps, dispose, createPointerEvents as events, extend, findInitialRoot, flushSync, fromRef, getInstanceProps, getPrimary, getPrimaryIds, getRootState, getUuidPrefix, hasConstructor, hasPrimary, invalidate, invalidateInstance, is, isColorRepresentation, isCopyable, isFromRef, isObject3D, isOnce, isOrthographicCamera, isRef, isRenderer, isTexture, isVectorLike, once, prepare, presetsObj, rebuildAllBuffers, rebuildAllNodes, rebuildAllStorage, rebuildAllUniforms, reconciler, registerPrimary, removeInteractivity, removeNodes, removeUniforms, resolve, swapInteractivity, unmountComponentAtNode, unregisterPrimary, updateCamera, updateFrustum, useBridge, useBuffers, useEnvironment, useFrame, useGPUStorage, useGraph, useInstanceHandle, useIsomorphicLayoutEffect, useLoader, useLocalNodes, useMutableCallback, useNodes, useRenderPipeline, useRenderTarget, useStore, useTexture, useTextures, useThree, useUniform, useUniforms, waitForPrimary };
|
|
4168
|
-
export type { Act, Args, ArgsProp, AttachFnType, AttachType, BackgroundConfig, BackgroundProp, BaseRendererProps, Bridge, BufferCreator, BufferLike, BufferRecord, BufferStore, BuffersWithUtils, Camera, CameraProps, CanvasProps, CanvasSchedulerConfig, Catalogue, ClearBuffersFn, ClearNodesFn, ClearStorageFn, ClearUniformsFn, Color, ColorManagementConfig, ComputeFunction, ConstructorRepresentation, CreatorState, DefaultGLProps, DefaultRendererProps, Disposable, DisposeBuffersFn, DisposeOptions, DisposeStorageFn, DomEvent, Dpr, ElementProps, EnvironmentLoaderProps, EnvironmentProps, EquConfig, Euler, EventHandlers, EventManager, EventProps, Events, Extensions, FiberRoot, FilterFunction, FrameCallback, FrameNextCallback, FrameNextState, FrameState, Frameloop, GLProps, GLTFLike, GeometryProps, GeometryTransformProps, GlobalEffectType, GlobalRenderCallback, HostConfig, InferLoadResult, InjectState, InputLike, Instance, InstanceProps, WebGPUInternalState as InternalState, Intersection, IntersectionEvent, IsAllOptional, IsOptional, Layers, LegacyInternalState, LegacyRenderer, LegacyRootState, LoaderInstance, LoaderLike, LoaderResult, LocalNodeCreator, MappedTextureType, MathProps, MathRepresentation, MathType, MathTypes, Matrix3, Matrix4, Mutable, MutableOrReadonlyParameters, NodeCreator, NodeProps, NodeRecord, NodesWithUtils, NonFunctionKeys, ObjectMap, OffscreenCanvas$1 as OffscreenCanvas, Overwrite, Performance, PointerCaptureTarget, PointerState, PresetsType, PrimaryCanvasEntry, Properties, Quaternion, WebGPUR3FRenderer as R3FRenderer, RaycastableRepresentation, ReactProps, RebuildBuffersFn, RebuildNodesFn, RebuildStorageFn, RebuildUniformsFn, ReconcilerRoot, RemoveBuffersFn, RemoveNodesFn, RemoveStorageFn, RemoveUniformsFn, RenderCallback, RenderProps, RenderTargetOptions, Renderer, RendererConfigExtended, RendererFactory, RendererProps, Root, WebGPURootState as RootState, RootStore, ScopedStoreType, SetBlock, Size, StorageCreator, StorageLike, StorageRecord, StorageStore, StorageWithUtils, Subscription, TSLNode, TSLNodeInput, TextureEntry, TextureInput, TextureNode, TextureOperations, TextureResult, ThreeCamera, ThreeElement, ThreeElements, ThreeElementsImpl, ThreeEvent, ThreeExports, ThreeToJSXElements, UnblockProps, UniformCreator, UniformValue, UniformsWithUtils, UseTextureOptions, UseTexturesReturn, Vector2, Vector3, Vector4, VectorRepresentation, Viewport, VisibilityEntry, WebGLDefaultProps, WebGLProps, WebGLShadowConfig, WebGPUDefaultProps, WebGPUProps, WebGPUShadowConfig, XRManager, XRPointerConfig };
|
|
4161
|
+
export type { Act, Args, ArgsProp, AttachFnType, AttachType, BackgroundConfig, BackgroundProp, BaseRendererProps, Bridge, BufferCreator, BufferLike, BufferRecord, BufferStore, BuffersWithUtils, Camera, CameraProps, CanvasProps, CanvasSchedulerConfig, Catalogue, ClearBuffersFn, ClearNodesFn, ClearStorageFn, ClearUniformsFn, Color, ColorManagementConfig, ComputeFunction, ConstructorRepresentation, CreatorState, DefaultGLProps, DefaultRendererProps, Disposable, DisposeBuffersFn, DisposeOptions, DisposeStorageFn, DomEvent, Dpr, ElementProps, EnvironmentLoaderProps, EnvironmentProps, EquConfig, Euler, EventHandlers, EventManager, EventProps, Events, Extensions, FiberRoot, FilterFunction, FrameCallback, FrameNextCallback, FrameNextState, FrameState, Frameloop, GLProps, GLTFLike, GeometryProps, GeometryTransformProps, GlobalEffectType, GlobalRenderCallback, HostConfig, InferLoadResult, InjectState, InputLike, Instance, InstanceProps, WebGPUInternalState as InternalState, Intersection, IntersectionEvent, IsAllOptional, IsOptional, Layers, LegacyInternalState, LegacyRenderer, LegacyRootState, LoaderInstance, LoaderLike, LoaderResult, LocalNodeCreator, MappedTextureType, MathProps, MathRepresentation, MathType, MathTypes, Matrix3, Matrix4, Mutable, MutableOrReadonlyParameters, NodeCreator, NodeProps, NodeRecord, NodesWithUtils, NonFunctionKeys, ObjectMap, OffscreenCanvas$1 as OffscreenCanvas, Overwrite, Performance, PointerCaptureTarget, PointerState, PresetsType, PrimaryCanvasEntry, Properties, Quaternion, WebGPUR3FRenderer as R3FRenderer, RaycastableRepresentation, ReactProps, RebuildBuffersFn, RebuildNodesFn, RebuildStorageFn, RebuildUniformsFn, ReconcilerRoot, RemoveBuffersFn, RemoveNodesFn, RemoveStorageFn, RemoveUniformsFn, RenderCallback, RenderProps, RenderTargetOptions, Renderer, RendererConfigExtended, RendererFactory, RendererProps, Root, WebGPURootState as RootState, RootStore, ScopedStoreType, SetBlock, Size, StorageCreator, StorageLike, StorageRecord, StorageStore, StorageWithUtils, Subscription, TSLNode, TSLNodeInput, TextureEntry, TextureInput, TextureNode, TextureOperations, TextureResult, ThreeCamera, ThreeElement, ThreeElements, ThreeElementsImpl, ThreeEvent, ThreeExports, ThreeToJSXElements, UnblockProps, UniformCreator, UniformValue, UniformsWithUtils, UseFrameWebGPU, UseTextureOptions, UseTexturesReturn, UseThreeWebGPU, Vector2, Vector3, Vector4, VectorRepresentation, Viewport, VisibilityEntry, WebGLDefaultProps, WebGLProps, WebGLShadowConfig, WebGPUDefaultProps, WebGPUProps, WebGPUShadowConfig, XRManager, XRPointerConfig };
|
package/dist/webgpu/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as three_examples_jsm_inspector_Inspector_js from 'three/examples/jsm/inspector/Inspector.js';
|
|
1
2
|
import * as three_webgpu from 'three/webgpu';
|
|
2
3
|
import { CubeRenderTarget, RenderTarget, WebGPURenderer, Node, StorageTexture, Data3DTexture, CanvasTarget, ShaderNodeObject, Euler as Euler$2, Color as Color$2, ColorRepresentation as ColorRepresentation$1, Layers as Layers$1, Raycaster, Intersection as Intersection$1, BufferGeometry, Matrix4 as Matrix4$1, Quaternion as Quaternion$1, Vector2 as Vector2$1, Vector3 as Vector3$1, Vector4 as Vector4$1, Matrix3 as Matrix3$1, Loader as Loader$1, ColorSpace, Texture as Texture$1, CubeTexture, Scene, Object3D, Frustum, OrthographicCamera, WebGPURendererParameters } from 'three/webgpu';
|
|
3
4
|
import { Inspector } from 'three/addons/inspector/Inspector.js';
|
|
@@ -11,7 +12,6 @@ import { FrameTimingState, FrameCallback as FrameCallback$1, SchedulerApi, UseFr
|
|
|
11
12
|
export { AddPhaseOptions, FrameControls, FrameNextControls, FrameTimingState, RootOptions, Scheduler, SchedulerApi, UseFrameNextOptions, UseFrameOptions, getScheduler } from '@pmndrs/scheduler';
|
|
12
13
|
import { Options } from 'react-use-measure';
|
|
13
14
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
14
|
-
import { ThreeElement as ThreeElement$1, Euler as Euler$3 } from '@react-three/fiber';
|
|
15
15
|
import { GroundedSkybox } from 'three/examples/jsm/objects/GroundedSkybox.js';
|
|
16
16
|
|
|
17
17
|
function _mergeNamespaces(n, m) {
|
|
@@ -41,6 +41,8 @@ function _mergeNamespaces(n, m) {
|
|
|
41
41
|
declare const R3F_BUILD_LEGACY = false;
|
|
42
42
|
declare const R3F_BUILD_WEBGPU = true;
|
|
43
43
|
|
|
44
|
+
/** Lazily load the three Inspector. Keeps it out of the eager module graph — see note above. */
|
|
45
|
+
declare function loadInspector(): Promise<typeof three_examples_jsm_inspector_Inspector_js.Inspector>;
|
|
44
46
|
declare const WebGLRenderer: {
|
|
45
47
|
new (): {};
|
|
46
48
|
};
|
|
@@ -62,7 +64,8 @@ var THREE = /*#__PURE__*/_mergeNamespaces({
|
|
|
62
64
|
WebGLRenderTarget: WebGLRenderTarget,
|
|
63
65
|
WebGLRenderer: WebGLRenderer,
|
|
64
66
|
WebGLRendererParameters: WebGLRendererParameters,
|
|
65
|
-
WebGLShadowMap: WebGLShadowMap
|
|
67
|
+
WebGLShadowMap: WebGLShadowMap,
|
|
68
|
+
loadInspector: loadInspector
|
|
66
69
|
}, [three_webgpu]);
|
|
67
70
|
|
|
68
71
|
//* Utility Types ==============================
|
|
@@ -500,6 +503,18 @@ interface InternalState {
|
|
|
500
503
|
* @see https://threejs.org/docs/#api/en/renderers/common/CanvasTarget
|
|
501
504
|
*/
|
|
502
505
|
canvasTarget?: CanvasTarget
|
|
506
|
+
/**
|
|
507
|
+
* Set when this root's canvas target has been resized and the backend's cached render pass
|
|
508
|
+
* descriptor (which holds a depth-stencil view built once per canvas) is therefore stale.
|
|
509
|
+
*
|
|
510
|
+
* Flushed by the canvas-target job in the `start` phase, which is the only place this root's
|
|
511
|
+
* target is guaranteed to be the renderer's active one — `backend.updateSize()` operates on
|
|
512
|
+
* whatever `getCanvasTarget()` returns, so calling it from the resize subscription would
|
|
513
|
+
* invalidate some other canvas's descriptor instead.
|
|
514
|
+
*
|
|
515
|
+
* @see https://github.com/pmndrs/react-three-fiber/issues/3847
|
|
516
|
+
*/
|
|
517
|
+
canvasTargetSizeDirty?: boolean
|
|
503
518
|
/**
|
|
504
519
|
* Whether multi-canvas rendering is active.
|
|
505
520
|
* True when any canvas uses `renderer={{ primaryCanvas: 'id' }}` to share a renderer.
|
|
@@ -1638,9 +1653,9 @@ type EnvironmentProps = {
|
|
|
1638
1653
|
blur?: number;
|
|
1639
1654
|
backgroundBlurriness?: number;
|
|
1640
1655
|
backgroundIntensity?: number;
|
|
1641
|
-
backgroundRotation?: Euler
|
|
1656
|
+
backgroundRotation?: Euler;
|
|
1642
1657
|
environmentIntensity?: number;
|
|
1643
|
-
environmentRotation?: Euler
|
|
1658
|
+
environmentRotation?: Euler;
|
|
1644
1659
|
map?: Texture$1;
|
|
1645
1660
|
preset?: PresetsType;
|
|
1646
1661
|
scene?: Scene | React$1.RefObject<Scene>;
|
|
@@ -1724,7 +1739,7 @@ declare function EnvironmentCube({ background, scene, blur, backgroundBlurriness
|
|
|
1724
1739
|
declare function EnvironmentPortal({ children, near, far, resolution, frames, map, background, blur, backgroundBlurriness, backgroundIntensity, backgroundRotation, environmentIntensity, environmentRotation, scene, files, path, preset, extensions, }: EnvironmentProps): react_jsx_runtime.JSX.Element;
|
|
1725
1740
|
declare module '@react-three/fiber' {
|
|
1726
1741
|
interface ThreeElements {
|
|
1727
|
-
groundProjectedEnvImpl: ThreeElement
|
|
1742
|
+
groundProjectedEnvImpl: ThreeElement<typeof GroundedSkybox>;
|
|
1728
1743
|
}
|
|
1729
1744
|
}
|
|
1730
1745
|
/**
|
|
@@ -1869,50 +1884,6 @@ declare namespace useLoader {
|
|
|
1869
1884
|
var loader: typeof getLoader;
|
|
1870
1885
|
}
|
|
1871
1886
|
|
|
1872
|
-
/**
|
|
1873
|
-
* Frame hook with phase-based ordering, priority, and FPS throttling.
|
|
1874
|
-
*
|
|
1875
|
-
* Always delivers full RootState — works both inside and outside Canvas context:
|
|
1876
|
-
* - Inside Canvas: Full RootState (renderer, scene, camera, etc.)
|
|
1877
|
-
* - Outside Canvas: The job registers immediately but the callback is held until a
|
|
1878
|
-
* Canvas adopts it, then runs with full RootState. For hostless / standalone
|
|
1879
|
-
* frame loops with no Canvas, use `@pmndrs/scheduler` directly.
|
|
1880
|
-
*
|
|
1881
|
-
* Returns a controls object for manual stepping, pausing, and resuming.
|
|
1882
|
-
*
|
|
1883
|
-
* @param callback - Function called each frame with (state, delta). Optional if you only need scheduler access.
|
|
1884
|
-
* @param priorityOrOptions - Either a priority number (backwards compat) or options object
|
|
1885
|
-
* @returns Controls object with step(), stepAll(), pause(), resume(), isPaused, id, scheduler
|
|
1886
|
-
*
|
|
1887
|
-
* @example
|
|
1888
|
-
* // Simple priority (backwards compat)
|
|
1889
|
-
* useFrame((state, delta) => { ... }, 5)
|
|
1890
|
-
*
|
|
1891
|
-
* @example
|
|
1892
|
-
* // With phase-based ordering
|
|
1893
|
-
* useFrame((state, delta) => { ... }, { phase: 'physics' })
|
|
1894
|
-
*
|
|
1895
|
-
* @example
|
|
1896
|
-
* // Outside Canvas - callback waits for a Canvas, then always has full state
|
|
1897
|
-
* function UI() {
|
|
1898
|
-
* useFrame((state, delta) => { syncUI(state.camera) });
|
|
1899
|
-
* return <button>...</button>;
|
|
1900
|
-
* }
|
|
1901
|
-
*
|
|
1902
|
-
* @example
|
|
1903
|
-
* // Hostless / standalone loop (no Canvas) - use @pmndrs/scheduler directly
|
|
1904
|
-
* import { getScheduler } from '@pmndrs/scheduler'
|
|
1905
|
-
* getScheduler().register((state, delta) => { updateGame(delta) })
|
|
1906
|
-
*
|
|
1907
|
-
* @example
|
|
1908
|
-
* // Scheduler-only access (no callback)
|
|
1909
|
-
* const { scheduler } = useFrame()
|
|
1910
|
-
* scheduler.pauseJob('some-job-id')
|
|
1911
|
-
*
|
|
1912
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe
|
|
1913
|
-
*/
|
|
1914
|
-
declare function useFrame(callback?: FrameNextCallback, priorityOrOptions?: number | UseFrameNextOptions): FrameNextControls;
|
|
1915
|
-
|
|
1916
1887
|
declare const IsObject: (url: unknown) => url is Record<string, string>;
|
|
1917
1888
|
type TextureArray<T> = T extends string[] ? Texture$1[] : never;
|
|
1918
1889
|
type TextureRecord<T> = T extends Record<string, string> ? {
|
|
@@ -2098,11 +2069,6 @@ declare function useRenderTarget(width: number, height: number, options?: Render
|
|
|
2098
2069
|
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usestore
|
|
2099
2070
|
*/
|
|
2100
2071
|
declare function useStore(): RootStore;
|
|
2101
|
-
/**
|
|
2102
|
-
* Accesses R3F's internal state, containing renderer, canvas, scene, etc.
|
|
2103
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usethree
|
|
2104
|
-
*/
|
|
2105
|
-
declare function useThree<T = RootState>(selector?: (state: RootState) => T, equalityFn?: <T>(state: T, newState: T) => boolean): T;
|
|
2106
2072
|
/**
|
|
2107
2073
|
* Exposes an object's {@link Instance}.
|
|
2108
2074
|
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle
|
|
@@ -2178,7 +2144,10 @@ declare function addTail(callback: GlobalRenderCallback): () => void;
|
|
|
2178
2144
|
* Invalidates the view, requesting a frame to be rendered.
|
|
2179
2145
|
* In demand mode, this triggers the scheduler to run frames.
|
|
2180
2146
|
*
|
|
2181
|
-
*
|
|
2147
|
+
* With a state argument, only that root's jobs run on the requested frames; other
|
|
2148
|
+
* roots on 'demand' stay idle. Without one, every registered root is invalidated.
|
|
2149
|
+
*
|
|
2150
|
+
* @param state - Optional root state; targets the invalidation at that root
|
|
2182
2151
|
* @param frames - Number of frames to request (default: 1)
|
|
2183
2152
|
* @param stackFrames - If false, sets pendingFrames to frames. If true, adds to existing pendingFrames (default: false)
|
|
2184
2153
|
*
|
|
@@ -2189,14 +2158,16 @@ declare function invalidate(state?: RootState, frames?: number, stackFrames?: bo
|
|
|
2189
2158
|
* Advances the frameloop and runs render effects.
|
|
2190
2159
|
* Useful for when manually rendering via `frameloop="never"`.
|
|
2191
2160
|
*
|
|
2161
|
+
* With a state argument, only that root is stepped. Without one, every
|
|
2162
|
+
* registered root is stepped for backwards compatibility.
|
|
2163
|
+
*
|
|
2192
2164
|
* @param timestamp - The timestamp to use for this frame
|
|
2193
2165
|
* @param runGlobalEffects - Ignored (kept for backwards compat, global effects always run)
|
|
2194
|
-
* @param state -
|
|
2195
|
-
* @param frame - Ignored (kept for backwards compat)
|
|
2166
|
+
* @param state - Optional root state; targets the manual step at that root
|
|
2196
2167
|
*
|
|
2197
2168
|
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
|
|
2198
2169
|
*/
|
|
2199
|
-
declare function advance(timestamp: number): void;
|
|
2170
|
+
declare function advance(timestamp: number, runGlobalEffects?: boolean, state?: RootState): void;
|
|
2200
2171
|
|
|
2201
2172
|
/* eslint-disable @definitelytyped/no-unnecessary-generics */
|
|
2202
2173
|
declare function ReactReconciler<
|
|
@@ -4087,6 +4058,10 @@ declare function createTextureOperations(set: StoreApi<RootState>['setState']):
|
|
|
4087
4058
|
* - Callbacks receive full RootState for flexibility
|
|
4088
4059
|
* - No auto-cleanup on unmount - use reset() for explicit cleanup
|
|
4089
4060
|
* - Scene/camera changes trigger scenePass recreation
|
|
4061
|
+
* - A replaced scenePass is disposed once the new graph is installed, so rebuild() does not
|
|
4062
|
+
* strand its render target (and MRT attachments) on the GPU
|
|
4063
|
+
* - Any run that changes the output node sets RenderPipeline.needsUpdate, so rebuild() actually
|
|
4064
|
+
* recompiles instead of silently keeping the first compiled graph
|
|
4090
4065
|
*
|
|
4091
4066
|
* @param mainCB - Main callback to configure outputNode and create effect passes
|
|
4092
4067
|
* @param setupCB - Optional setup callback to configure MRT on scenePass
|
|
@@ -4164,5 +4139,23 @@ interface WebGPURootState extends Omit<RootState, 'renderer' | 'gl' | 'internal'
|
|
|
4164
4139
|
internal: WebGPUInternalState
|
|
4165
4140
|
}
|
|
4166
4141
|
|
|
4142
|
+
/**
|
|
4143
|
+
* @fileoverview WebGPU entry point - WebGPU only, no legacy WebGL
|
|
4144
|
+
*
|
|
4145
|
+
* This entry point is for apps that want to use ONLY WebGPURenderer.
|
|
4146
|
+
* Includes WebGPU-specific hooks (useUniforms, useNodes, useTextures).
|
|
4147
|
+
* Auto-extends THREE with WebGPU node materials (MeshBasicNodeMaterial, etc.)
|
|
4148
|
+
*
|
|
4149
|
+
* Usage:
|
|
4150
|
+
* import { Canvas, useFrame, useUniforms } from '@react-three/fiber/webgpu'
|
|
4151
|
+
*/
|
|
4152
|
+
|
|
4153
|
+
/** `useThree` narrowed to WebGPU state — `state.renderer` is a `WebGPURenderer`. */
|
|
4154
|
+
type UseThreeWebGPU = <T = WebGPURootState>(selector?: (state: WebGPURootState) => T, equalityFn?: <U>(state: U, newState: U) => boolean) => T;
|
|
4155
|
+
/** `useFrame` narrowed to WebGPU state — the callback's `state.renderer` is a `WebGPURenderer`. */
|
|
4156
|
+
type UseFrameWebGPU = (callback?: FrameCallback$1<WebGPURootState>, priorityOrOptions?: number | UseFrameNextOptions) => FrameNextControls;
|
|
4157
|
+
declare const useThree: UseThreeWebGPU;
|
|
4158
|
+
declare const useFrame: UseFrameWebGPU;
|
|
4159
|
+
|
|
4167
4160
|
export { Block, Canvas, Environment, EnvironmentCube, EnvironmentMap, EnvironmentPortal, ErrorBoundary, FROM_REF, IsObject, ONCE, Portal, R3F_BUILD_LEGACY, R3F_BUILD_WEBGPU, REACT_INTERNAL_PROPS, RESERVED_PROPS, three_d as ReactThreeFiber, Texture, _roots, addAfterEffect, addEffect, addTail, advance, applyProps, attach, buildGraph, calculateDpr, clearNodeScope, clearRootNodes, clearRootUniforms, clearScope, context, createEvents, createPointerEvents, createPortal, createRoot, createScopedStore, createStore, createTextureOperations, detach, diffProps, dispose, createPointerEvents as events, extend, findInitialRoot, flushSync, fromRef, getInstanceProps, getPrimary, getPrimaryIds, getRootState, getUuidPrefix, hasConstructor, hasPrimary, invalidate, invalidateInstance, is, isColorRepresentation, isCopyable, isFromRef, isObject3D, isOnce, isOrthographicCamera, isRef, isRenderer, isTexture, isVectorLike, once, prepare, presetsObj, rebuildAllBuffers, rebuildAllNodes, rebuildAllStorage, rebuildAllUniforms, reconciler, registerPrimary, removeInteractivity, removeNodes, removeUniforms, resolve, swapInteractivity, unmountComponentAtNode, unregisterPrimary, updateCamera, updateFrustum, useBridge, useBuffers, useEnvironment, useFrame, useGPUStorage, useGraph, useInstanceHandle, useIsomorphicLayoutEffect, useLoader, useLocalNodes, useMutableCallback, useNodes, useRenderPipeline, useRenderTarget, useStore, useTexture, useTextures, useThree, useUniform, useUniforms, waitForPrimary };
|
|
4168
|
-
export type { Act, Args, ArgsProp, AttachFnType, AttachType, BackgroundConfig, BackgroundProp, BaseRendererProps, Bridge, BufferCreator, BufferLike, BufferRecord, BufferStore, BuffersWithUtils, Camera, CameraProps, CanvasProps, CanvasSchedulerConfig, Catalogue, ClearBuffersFn, ClearNodesFn, ClearStorageFn, ClearUniformsFn, Color, ColorManagementConfig, ComputeFunction, ConstructorRepresentation, CreatorState, DefaultGLProps, DefaultRendererProps, Disposable, DisposeBuffersFn, DisposeOptions, DisposeStorageFn, DomEvent, Dpr, ElementProps, EnvironmentLoaderProps, EnvironmentProps, EquConfig, Euler, EventHandlers, EventManager, EventProps, Events, Extensions, FiberRoot, FilterFunction, FrameCallback, FrameNextCallback, FrameNextState, FrameState, Frameloop, GLProps, GLTFLike, GeometryProps, GeometryTransformProps, GlobalEffectType, GlobalRenderCallback, HostConfig, InferLoadResult, InjectState, InputLike, Instance, InstanceProps, WebGPUInternalState as InternalState, Intersection, IntersectionEvent, IsAllOptional, IsOptional, Layers, LegacyInternalState, LegacyRenderer, LegacyRootState, LoaderInstance, LoaderLike, LoaderResult, LocalNodeCreator, MappedTextureType, MathProps, MathRepresentation, MathType, MathTypes, Matrix3, Matrix4, Mutable, MutableOrReadonlyParameters, NodeCreator, NodeProps, NodeRecord, NodesWithUtils, NonFunctionKeys, ObjectMap, OffscreenCanvas$1 as OffscreenCanvas, Overwrite, Performance, PointerCaptureTarget, PointerState, PresetsType, PrimaryCanvasEntry, Properties, Quaternion, WebGPUR3FRenderer as R3FRenderer, RaycastableRepresentation, ReactProps, RebuildBuffersFn, RebuildNodesFn, RebuildStorageFn, RebuildUniformsFn, ReconcilerRoot, RemoveBuffersFn, RemoveNodesFn, RemoveStorageFn, RemoveUniformsFn, RenderCallback, RenderProps, RenderTargetOptions, Renderer, RendererConfigExtended, RendererFactory, RendererProps, Root, WebGPURootState as RootState, RootStore, ScopedStoreType, SetBlock, Size, StorageCreator, StorageLike, StorageRecord, StorageStore, StorageWithUtils, Subscription, TSLNode, TSLNodeInput, TextureEntry, TextureInput, TextureNode, TextureOperations, TextureResult, ThreeCamera, ThreeElement, ThreeElements, ThreeElementsImpl, ThreeEvent, ThreeExports, ThreeToJSXElements, UnblockProps, UniformCreator, UniformValue, UniformsWithUtils, UseTextureOptions, UseTexturesReturn, Vector2, Vector3, Vector4, VectorRepresentation, Viewport, VisibilityEntry, WebGLDefaultProps, WebGLProps, WebGLShadowConfig, WebGPUDefaultProps, WebGPUProps, WebGPUShadowConfig, XRManager, XRPointerConfig };
|
|
4161
|
+
export type { Act, Args, ArgsProp, AttachFnType, AttachType, BackgroundConfig, BackgroundProp, BaseRendererProps, Bridge, BufferCreator, BufferLike, BufferRecord, BufferStore, BuffersWithUtils, Camera, CameraProps, CanvasProps, CanvasSchedulerConfig, Catalogue, ClearBuffersFn, ClearNodesFn, ClearStorageFn, ClearUniformsFn, Color, ColorManagementConfig, ComputeFunction, ConstructorRepresentation, CreatorState, DefaultGLProps, DefaultRendererProps, Disposable, DisposeBuffersFn, DisposeOptions, DisposeStorageFn, DomEvent, Dpr, ElementProps, EnvironmentLoaderProps, EnvironmentProps, EquConfig, Euler, EventHandlers, EventManager, EventProps, Events, Extensions, FiberRoot, FilterFunction, FrameCallback, FrameNextCallback, FrameNextState, FrameState, Frameloop, GLProps, GLTFLike, GeometryProps, GeometryTransformProps, GlobalEffectType, GlobalRenderCallback, HostConfig, InferLoadResult, InjectState, InputLike, Instance, InstanceProps, WebGPUInternalState as InternalState, Intersection, IntersectionEvent, IsAllOptional, IsOptional, Layers, LegacyInternalState, LegacyRenderer, LegacyRootState, LoaderInstance, LoaderLike, LoaderResult, LocalNodeCreator, MappedTextureType, MathProps, MathRepresentation, MathType, MathTypes, Matrix3, Matrix4, Mutable, MutableOrReadonlyParameters, NodeCreator, NodeProps, NodeRecord, NodesWithUtils, NonFunctionKeys, ObjectMap, OffscreenCanvas$1 as OffscreenCanvas, Overwrite, Performance, PointerCaptureTarget, PointerState, PresetsType, PrimaryCanvasEntry, Properties, Quaternion, WebGPUR3FRenderer as R3FRenderer, RaycastableRepresentation, ReactProps, RebuildBuffersFn, RebuildNodesFn, RebuildStorageFn, RebuildUniformsFn, ReconcilerRoot, RemoveBuffersFn, RemoveNodesFn, RemoveStorageFn, RemoveUniformsFn, RenderCallback, RenderProps, RenderTargetOptions, Renderer, RendererConfigExtended, RendererFactory, RendererProps, Root, WebGPURootState as RootState, RootStore, ScopedStoreType, SetBlock, Size, StorageCreator, StorageLike, StorageRecord, StorageStore, StorageWithUtils, Subscription, TSLNode, TSLNodeInput, TextureEntry, TextureInput, TextureNode, TextureOperations, TextureResult, ThreeCamera, ThreeElement, ThreeElements, ThreeElementsImpl, ThreeEvent, ThreeExports, ThreeToJSXElements, UnblockProps, UniformCreator, UniformValue, UniformsWithUtils, UseFrameWebGPU, UseTextureOptions, UseTexturesReturn, UseThreeWebGPU, Vector2, Vector3, Vector4, VectorRepresentation, Viewport, VisibilityEntry, WebGLDefaultProps, WebGLProps, WebGLShadowConfig, WebGPUDefaultProps, WebGPUProps, WebGPUShadowConfig, XRManager, XRPointerConfig };
|
package/dist/webgpu/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as three_examples_jsm_inspector_Inspector_js from 'three/examples/jsm/inspector/Inspector.js';
|
|
1
2
|
import * as three_webgpu from 'three/webgpu';
|
|
2
3
|
import { CubeRenderTarget, RenderTarget, WebGPURenderer, Node, StorageTexture, Data3DTexture, CanvasTarget, ShaderNodeObject, Euler as Euler$2, Color as Color$2, ColorRepresentation as ColorRepresentation$1, Layers as Layers$1, Raycaster, Intersection as Intersection$1, BufferGeometry, Matrix4 as Matrix4$1, Quaternion as Quaternion$1, Vector2 as Vector2$1, Vector3 as Vector3$1, Vector4 as Vector4$1, Matrix3 as Matrix3$1, Loader as Loader$1, ColorSpace, Texture as Texture$1, CubeTexture, Scene, Object3D, Frustum, OrthographicCamera, WebGPURendererParameters } from 'three/webgpu';
|
|
3
4
|
import { Inspector } from 'three/addons/inspector/Inspector.js';
|
|
@@ -11,7 +12,6 @@ import { FrameTimingState, FrameCallback as FrameCallback$1, SchedulerApi, UseFr
|
|
|
11
12
|
export { AddPhaseOptions, FrameControls, FrameNextControls, FrameTimingState, RootOptions, Scheduler, SchedulerApi, UseFrameNextOptions, UseFrameOptions, getScheduler } from '@pmndrs/scheduler';
|
|
12
13
|
import { Options } from 'react-use-measure';
|
|
13
14
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
14
|
-
import { ThreeElement as ThreeElement$1, Euler as Euler$3 } from '@react-three/fiber';
|
|
15
15
|
import { GroundedSkybox } from 'three/examples/jsm/objects/GroundedSkybox.js';
|
|
16
16
|
|
|
17
17
|
function _mergeNamespaces(n, m) {
|
|
@@ -41,6 +41,8 @@ function _mergeNamespaces(n, m) {
|
|
|
41
41
|
declare const R3F_BUILD_LEGACY = false;
|
|
42
42
|
declare const R3F_BUILD_WEBGPU = true;
|
|
43
43
|
|
|
44
|
+
/** Lazily load the three Inspector. Keeps it out of the eager module graph — see note above. */
|
|
45
|
+
declare function loadInspector(): Promise<typeof three_examples_jsm_inspector_Inspector_js.Inspector>;
|
|
44
46
|
declare const WebGLRenderer: {
|
|
45
47
|
new (): {};
|
|
46
48
|
};
|
|
@@ -62,7 +64,8 @@ var THREE = /*#__PURE__*/_mergeNamespaces({
|
|
|
62
64
|
WebGLRenderTarget: WebGLRenderTarget,
|
|
63
65
|
WebGLRenderer: WebGLRenderer,
|
|
64
66
|
WebGLRendererParameters: WebGLRendererParameters,
|
|
65
|
-
WebGLShadowMap: WebGLShadowMap
|
|
67
|
+
WebGLShadowMap: WebGLShadowMap,
|
|
68
|
+
loadInspector: loadInspector
|
|
66
69
|
}, [three_webgpu]);
|
|
67
70
|
|
|
68
71
|
//* Utility Types ==============================
|
|
@@ -500,6 +503,18 @@ interface InternalState {
|
|
|
500
503
|
* @see https://threejs.org/docs/#api/en/renderers/common/CanvasTarget
|
|
501
504
|
*/
|
|
502
505
|
canvasTarget?: CanvasTarget
|
|
506
|
+
/**
|
|
507
|
+
* Set when this root's canvas target has been resized and the backend's cached render pass
|
|
508
|
+
* descriptor (which holds a depth-stencil view built once per canvas) is therefore stale.
|
|
509
|
+
*
|
|
510
|
+
* Flushed by the canvas-target job in the `start` phase, which is the only place this root's
|
|
511
|
+
* target is guaranteed to be the renderer's active one — `backend.updateSize()` operates on
|
|
512
|
+
* whatever `getCanvasTarget()` returns, so calling it from the resize subscription would
|
|
513
|
+
* invalidate some other canvas's descriptor instead.
|
|
514
|
+
*
|
|
515
|
+
* @see https://github.com/pmndrs/react-three-fiber/issues/3847
|
|
516
|
+
*/
|
|
517
|
+
canvasTargetSizeDirty?: boolean
|
|
503
518
|
/**
|
|
504
519
|
* Whether multi-canvas rendering is active.
|
|
505
520
|
* True when any canvas uses `renderer={{ primaryCanvas: 'id' }}` to share a renderer.
|
|
@@ -1638,9 +1653,9 @@ type EnvironmentProps = {
|
|
|
1638
1653
|
blur?: number;
|
|
1639
1654
|
backgroundBlurriness?: number;
|
|
1640
1655
|
backgroundIntensity?: number;
|
|
1641
|
-
backgroundRotation?: Euler
|
|
1656
|
+
backgroundRotation?: Euler;
|
|
1642
1657
|
environmentIntensity?: number;
|
|
1643
|
-
environmentRotation?: Euler
|
|
1658
|
+
environmentRotation?: Euler;
|
|
1644
1659
|
map?: Texture$1;
|
|
1645
1660
|
preset?: PresetsType;
|
|
1646
1661
|
scene?: Scene | React$1.RefObject<Scene>;
|
|
@@ -1724,7 +1739,7 @@ declare function EnvironmentCube({ background, scene, blur, backgroundBlurriness
|
|
|
1724
1739
|
declare function EnvironmentPortal({ children, near, far, resolution, frames, map, background, blur, backgroundBlurriness, backgroundIntensity, backgroundRotation, environmentIntensity, environmentRotation, scene, files, path, preset, extensions, }: EnvironmentProps): react_jsx_runtime.JSX.Element;
|
|
1725
1740
|
declare module '@react-three/fiber' {
|
|
1726
1741
|
interface ThreeElements {
|
|
1727
|
-
groundProjectedEnvImpl: ThreeElement
|
|
1742
|
+
groundProjectedEnvImpl: ThreeElement<typeof GroundedSkybox>;
|
|
1728
1743
|
}
|
|
1729
1744
|
}
|
|
1730
1745
|
/**
|
|
@@ -1869,50 +1884,6 @@ declare namespace useLoader {
|
|
|
1869
1884
|
var loader: typeof getLoader;
|
|
1870
1885
|
}
|
|
1871
1886
|
|
|
1872
|
-
/**
|
|
1873
|
-
* Frame hook with phase-based ordering, priority, and FPS throttling.
|
|
1874
|
-
*
|
|
1875
|
-
* Always delivers full RootState — works both inside and outside Canvas context:
|
|
1876
|
-
* - Inside Canvas: Full RootState (renderer, scene, camera, etc.)
|
|
1877
|
-
* - Outside Canvas: The job registers immediately but the callback is held until a
|
|
1878
|
-
* Canvas adopts it, then runs with full RootState. For hostless / standalone
|
|
1879
|
-
* frame loops with no Canvas, use `@pmndrs/scheduler` directly.
|
|
1880
|
-
*
|
|
1881
|
-
* Returns a controls object for manual stepping, pausing, and resuming.
|
|
1882
|
-
*
|
|
1883
|
-
* @param callback - Function called each frame with (state, delta). Optional if you only need scheduler access.
|
|
1884
|
-
* @param priorityOrOptions - Either a priority number (backwards compat) or options object
|
|
1885
|
-
* @returns Controls object with step(), stepAll(), pause(), resume(), isPaused, id, scheduler
|
|
1886
|
-
*
|
|
1887
|
-
* @example
|
|
1888
|
-
* // Simple priority (backwards compat)
|
|
1889
|
-
* useFrame((state, delta) => { ... }, 5)
|
|
1890
|
-
*
|
|
1891
|
-
* @example
|
|
1892
|
-
* // With phase-based ordering
|
|
1893
|
-
* useFrame((state, delta) => { ... }, { phase: 'physics' })
|
|
1894
|
-
*
|
|
1895
|
-
* @example
|
|
1896
|
-
* // Outside Canvas - callback waits for a Canvas, then always has full state
|
|
1897
|
-
* function UI() {
|
|
1898
|
-
* useFrame((state, delta) => { syncUI(state.camera) });
|
|
1899
|
-
* return <button>...</button>;
|
|
1900
|
-
* }
|
|
1901
|
-
*
|
|
1902
|
-
* @example
|
|
1903
|
-
* // Hostless / standalone loop (no Canvas) - use @pmndrs/scheduler directly
|
|
1904
|
-
* import { getScheduler } from '@pmndrs/scheduler'
|
|
1905
|
-
* getScheduler().register((state, delta) => { updateGame(delta) })
|
|
1906
|
-
*
|
|
1907
|
-
* @example
|
|
1908
|
-
* // Scheduler-only access (no callback)
|
|
1909
|
-
* const { scheduler } = useFrame()
|
|
1910
|
-
* scheduler.pauseJob('some-job-id')
|
|
1911
|
-
*
|
|
1912
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe
|
|
1913
|
-
*/
|
|
1914
|
-
declare function useFrame(callback?: FrameNextCallback, priorityOrOptions?: number | UseFrameNextOptions): FrameNextControls;
|
|
1915
|
-
|
|
1916
1887
|
declare const IsObject: (url: unknown) => url is Record<string, string>;
|
|
1917
1888
|
type TextureArray<T> = T extends string[] ? Texture$1[] : never;
|
|
1918
1889
|
type TextureRecord<T> = T extends Record<string, string> ? {
|
|
@@ -2098,11 +2069,6 @@ declare function useRenderTarget(width: number, height: number, options?: Render
|
|
|
2098
2069
|
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usestore
|
|
2099
2070
|
*/
|
|
2100
2071
|
declare function useStore(): RootStore;
|
|
2101
|
-
/**
|
|
2102
|
-
* Accesses R3F's internal state, containing renderer, canvas, scene, etc.
|
|
2103
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usethree
|
|
2104
|
-
*/
|
|
2105
|
-
declare function useThree<T = RootState>(selector?: (state: RootState) => T, equalityFn?: <T>(state: T, newState: T) => boolean): T;
|
|
2106
2072
|
/**
|
|
2107
2073
|
* Exposes an object's {@link Instance}.
|
|
2108
2074
|
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle
|
|
@@ -2178,7 +2144,10 @@ declare function addTail(callback: GlobalRenderCallback): () => void;
|
|
|
2178
2144
|
* Invalidates the view, requesting a frame to be rendered.
|
|
2179
2145
|
* In demand mode, this triggers the scheduler to run frames.
|
|
2180
2146
|
*
|
|
2181
|
-
*
|
|
2147
|
+
* With a state argument, only that root's jobs run on the requested frames; other
|
|
2148
|
+
* roots on 'demand' stay idle. Without one, every registered root is invalidated.
|
|
2149
|
+
*
|
|
2150
|
+
* @param state - Optional root state; targets the invalidation at that root
|
|
2182
2151
|
* @param frames - Number of frames to request (default: 1)
|
|
2183
2152
|
* @param stackFrames - If false, sets pendingFrames to frames. If true, adds to existing pendingFrames (default: false)
|
|
2184
2153
|
*
|
|
@@ -2189,14 +2158,16 @@ declare function invalidate(state?: RootState, frames?: number, stackFrames?: bo
|
|
|
2189
2158
|
* Advances the frameloop and runs render effects.
|
|
2190
2159
|
* Useful for when manually rendering via `frameloop="never"`.
|
|
2191
2160
|
*
|
|
2161
|
+
* With a state argument, only that root is stepped. Without one, every
|
|
2162
|
+
* registered root is stepped for backwards compatibility.
|
|
2163
|
+
*
|
|
2192
2164
|
* @param timestamp - The timestamp to use for this frame
|
|
2193
2165
|
* @param runGlobalEffects - Ignored (kept for backwards compat, global effects always run)
|
|
2194
|
-
* @param state -
|
|
2195
|
-
* @param frame - Ignored (kept for backwards compat)
|
|
2166
|
+
* @param state - Optional root state; targets the manual step at that root
|
|
2196
2167
|
*
|
|
2197
2168
|
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
|
|
2198
2169
|
*/
|
|
2199
|
-
declare function advance(timestamp: number): void;
|
|
2170
|
+
declare function advance(timestamp: number, runGlobalEffects?: boolean, state?: RootState): void;
|
|
2200
2171
|
|
|
2201
2172
|
/* eslint-disable @definitelytyped/no-unnecessary-generics */
|
|
2202
2173
|
declare function ReactReconciler<
|
|
@@ -4087,6 +4058,10 @@ declare function createTextureOperations(set: StoreApi<RootState>['setState']):
|
|
|
4087
4058
|
* - Callbacks receive full RootState for flexibility
|
|
4088
4059
|
* - No auto-cleanup on unmount - use reset() for explicit cleanup
|
|
4089
4060
|
* - Scene/camera changes trigger scenePass recreation
|
|
4061
|
+
* - A replaced scenePass is disposed once the new graph is installed, so rebuild() does not
|
|
4062
|
+
* strand its render target (and MRT attachments) on the GPU
|
|
4063
|
+
* - Any run that changes the output node sets RenderPipeline.needsUpdate, so rebuild() actually
|
|
4064
|
+
* recompiles instead of silently keeping the first compiled graph
|
|
4090
4065
|
*
|
|
4091
4066
|
* @param mainCB - Main callback to configure outputNode and create effect passes
|
|
4092
4067
|
* @param setupCB - Optional setup callback to configure MRT on scenePass
|
|
@@ -4164,5 +4139,23 @@ interface WebGPURootState extends Omit<RootState, 'renderer' | 'gl' | 'internal'
|
|
|
4164
4139
|
internal: WebGPUInternalState
|
|
4165
4140
|
}
|
|
4166
4141
|
|
|
4142
|
+
/**
|
|
4143
|
+
* @fileoverview WebGPU entry point - WebGPU only, no legacy WebGL
|
|
4144
|
+
*
|
|
4145
|
+
* This entry point is for apps that want to use ONLY WebGPURenderer.
|
|
4146
|
+
* Includes WebGPU-specific hooks (useUniforms, useNodes, useTextures).
|
|
4147
|
+
* Auto-extends THREE with WebGPU node materials (MeshBasicNodeMaterial, etc.)
|
|
4148
|
+
*
|
|
4149
|
+
* Usage:
|
|
4150
|
+
* import { Canvas, useFrame, useUniforms } from '@react-three/fiber/webgpu'
|
|
4151
|
+
*/
|
|
4152
|
+
|
|
4153
|
+
/** `useThree` narrowed to WebGPU state — `state.renderer` is a `WebGPURenderer`. */
|
|
4154
|
+
type UseThreeWebGPU = <T = WebGPURootState>(selector?: (state: WebGPURootState) => T, equalityFn?: <U>(state: U, newState: U) => boolean) => T;
|
|
4155
|
+
/** `useFrame` narrowed to WebGPU state — the callback's `state.renderer` is a `WebGPURenderer`. */
|
|
4156
|
+
type UseFrameWebGPU = (callback?: FrameCallback$1<WebGPURootState>, priorityOrOptions?: number | UseFrameNextOptions) => FrameNextControls;
|
|
4157
|
+
declare const useThree: UseThreeWebGPU;
|
|
4158
|
+
declare const useFrame: UseFrameWebGPU;
|
|
4159
|
+
|
|
4167
4160
|
export { Block, Canvas, Environment, EnvironmentCube, EnvironmentMap, EnvironmentPortal, ErrorBoundary, FROM_REF, IsObject, ONCE, Portal, R3F_BUILD_LEGACY, R3F_BUILD_WEBGPU, REACT_INTERNAL_PROPS, RESERVED_PROPS, three_d as ReactThreeFiber, Texture, _roots, addAfterEffect, addEffect, addTail, advance, applyProps, attach, buildGraph, calculateDpr, clearNodeScope, clearRootNodes, clearRootUniforms, clearScope, context, createEvents, createPointerEvents, createPortal, createRoot, createScopedStore, createStore, createTextureOperations, detach, diffProps, dispose, createPointerEvents as events, extend, findInitialRoot, flushSync, fromRef, getInstanceProps, getPrimary, getPrimaryIds, getRootState, getUuidPrefix, hasConstructor, hasPrimary, invalidate, invalidateInstance, is, isColorRepresentation, isCopyable, isFromRef, isObject3D, isOnce, isOrthographicCamera, isRef, isRenderer, isTexture, isVectorLike, once, prepare, presetsObj, rebuildAllBuffers, rebuildAllNodes, rebuildAllStorage, rebuildAllUniforms, reconciler, registerPrimary, removeInteractivity, removeNodes, removeUniforms, resolve, swapInteractivity, unmountComponentAtNode, unregisterPrimary, updateCamera, updateFrustum, useBridge, useBuffers, useEnvironment, useFrame, useGPUStorage, useGraph, useInstanceHandle, useIsomorphicLayoutEffect, useLoader, useLocalNodes, useMutableCallback, useNodes, useRenderPipeline, useRenderTarget, useStore, useTexture, useTextures, useThree, useUniform, useUniforms, waitForPrimary };
|
|
4168
|
-
export type { Act, Args, ArgsProp, AttachFnType, AttachType, BackgroundConfig, BackgroundProp, BaseRendererProps, Bridge, BufferCreator, BufferLike, BufferRecord, BufferStore, BuffersWithUtils, Camera, CameraProps, CanvasProps, CanvasSchedulerConfig, Catalogue, ClearBuffersFn, ClearNodesFn, ClearStorageFn, ClearUniformsFn, Color, ColorManagementConfig, ComputeFunction, ConstructorRepresentation, CreatorState, DefaultGLProps, DefaultRendererProps, Disposable, DisposeBuffersFn, DisposeOptions, DisposeStorageFn, DomEvent, Dpr, ElementProps, EnvironmentLoaderProps, EnvironmentProps, EquConfig, Euler, EventHandlers, EventManager, EventProps, Events, Extensions, FiberRoot, FilterFunction, FrameCallback, FrameNextCallback, FrameNextState, FrameState, Frameloop, GLProps, GLTFLike, GeometryProps, GeometryTransformProps, GlobalEffectType, GlobalRenderCallback, HostConfig, InferLoadResult, InjectState, InputLike, Instance, InstanceProps, WebGPUInternalState as InternalState, Intersection, IntersectionEvent, IsAllOptional, IsOptional, Layers, LegacyInternalState, LegacyRenderer, LegacyRootState, LoaderInstance, LoaderLike, LoaderResult, LocalNodeCreator, MappedTextureType, MathProps, MathRepresentation, MathType, MathTypes, Matrix3, Matrix4, Mutable, MutableOrReadonlyParameters, NodeCreator, NodeProps, NodeRecord, NodesWithUtils, NonFunctionKeys, ObjectMap, OffscreenCanvas$1 as OffscreenCanvas, Overwrite, Performance, PointerCaptureTarget, PointerState, PresetsType, PrimaryCanvasEntry, Properties, Quaternion, WebGPUR3FRenderer as R3FRenderer, RaycastableRepresentation, ReactProps, RebuildBuffersFn, RebuildNodesFn, RebuildStorageFn, RebuildUniformsFn, ReconcilerRoot, RemoveBuffersFn, RemoveNodesFn, RemoveStorageFn, RemoveUniformsFn, RenderCallback, RenderProps, RenderTargetOptions, Renderer, RendererConfigExtended, RendererFactory, RendererProps, Root, WebGPURootState as RootState, RootStore, ScopedStoreType, SetBlock, Size, StorageCreator, StorageLike, StorageRecord, StorageStore, StorageWithUtils, Subscription, TSLNode, TSLNodeInput, TextureEntry, TextureInput, TextureNode, TextureOperations, TextureResult, ThreeCamera, ThreeElement, ThreeElements, ThreeElementsImpl, ThreeEvent, ThreeExports, ThreeToJSXElements, UnblockProps, UniformCreator, UniformValue, UniformsWithUtils, UseTextureOptions, UseTexturesReturn, Vector2, Vector3, Vector4, VectorRepresentation, Viewport, VisibilityEntry, WebGLDefaultProps, WebGLProps, WebGLShadowConfig, WebGPUDefaultProps, WebGPUProps, WebGPUShadowConfig, XRManager, XRPointerConfig };
|
|
4161
|
+
export type { Act, Args, ArgsProp, AttachFnType, AttachType, BackgroundConfig, BackgroundProp, BaseRendererProps, Bridge, BufferCreator, BufferLike, BufferRecord, BufferStore, BuffersWithUtils, Camera, CameraProps, CanvasProps, CanvasSchedulerConfig, Catalogue, ClearBuffersFn, ClearNodesFn, ClearStorageFn, ClearUniformsFn, Color, ColorManagementConfig, ComputeFunction, ConstructorRepresentation, CreatorState, DefaultGLProps, DefaultRendererProps, Disposable, DisposeBuffersFn, DisposeOptions, DisposeStorageFn, DomEvent, Dpr, ElementProps, EnvironmentLoaderProps, EnvironmentProps, EquConfig, Euler, EventHandlers, EventManager, EventProps, Events, Extensions, FiberRoot, FilterFunction, FrameCallback, FrameNextCallback, FrameNextState, FrameState, Frameloop, GLProps, GLTFLike, GeometryProps, GeometryTransformProps, GlobalEffectType, GlobalRenderCallback, HostConfig, InferLoadResult, InjectState, InputLike, Instance, InstanceProps, WebGPUInternalState as InternalState, Intersection, IntersectionEvent, IsAllOptional, IsOptional, Layers, LegacyInternalState, LegacyRenderer, LegacyRootState, LoaderInstance, LoaderLike, LoaderResult, LocalNodeCreator, MappedTextureType, MathProps, MathRepresentation, MathType, MathTypes, Matrix3, Matrix4, Mutable, MutableOrReadonlyParameters, NodeCreator, NodeProps, NodeRecord, NodesWithUtils, NonFunctionKeys, ObjectMap, OffscreenCanvas$1 as OffscreenCanvas, Overwrite, Performance, PointerCaptureTarget, PointerState, PresetsType, PrimaryCanvasEntry, Properties, Quaternion, WebGPUR3FRenderer as R3FRenderer, RaycastableRepresentation, ReactProps, RebuildBuffersFn, RebuildNodesFn, RebuildStorageFn, RebuildUniformsFn, ReconcilerRoot, RemoveBuffersFn, RemoveNodesFn, RemoveStorageFn, RemoveUniformsFn, RenderCallback, RenderProps, RenderTargetOptions, Renderer, RendererConfigExtended, RendererFactory, RendererProps, Root, WebGPURootState as RootState, RootStore, ScopedStoreType, SetBlock, Size, StorageCreator, StorageLike, StorageRecord, StorageStore, StorageWithUtils, Subscription, TSLNode, TSLNodeInput, TextureEntry, TextureInput, TextureNode, TextureOperations, TextureResult, ThreeCamera, ThreeElement, ThreeElements, ThreeElementsImpl, ThreeEvent, ThreeExports, ThreeToJSXElements, UnblockProps, UniformCreator, UniformValue, UniformsWithUtils, UseFrameWebGPU, UseTextureOptions, UseTexturesReturn, UseThreeWebGPU, Vector2, Vector3, Vector4, VectorRepresentation, Viewport, VisibilityEntry, WebGLDefaultProps, WebGLProps, WebGLShadowConfig, WebGPUDefaultProps, WebGPUProps, WebGPUShadowConfig, XRManager, XRPointerConfig };
|