@react-three/fiber 10.0.0-canary.c6846c3 → 10.0.0-canary.ce4bd5f
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 +105 -53
- package/dist/index.d.cts +46 -12
- package/dist/index.d.mts +46 -12
- package/dist/index.d.ts +46 -12
- package/dist/index.mjs +105 -53
- package/dist/legacy.cjs +104 -57
- package/dist/legacy.d.cts +45 -15
- package/dist/legacy.d.mts +45 -15
- package/dist/legacy.d.ts +45 -15
- package/dist/legacy.mjs +104 -57
- package/dist/webgpu/index.cjs +158 -81
- package/dist/webgpu/index.d.cts +67 -61
- package/dist/webgpu/index.d.mts +67 -61
- package/dist/webgpu/index.d.ts +67 -61
- package/dist/webgpu/index.mjs +158 -81
- package/package.json +2 -2
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';
|
|
@@ -40,6 +41,8 @@ function _mergeNamespaces(n, m) {
|
|
|
40
41
|
declare const R3F_BUILD_LEGACY = false;
|
|
41
42
|
declare const R3F_BUILD_WEBGPU = true;
|
|
42
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>;
|
|
43
46
|
declare const WebGLRenderer: {
|
|
44
47
|
new (): {};
|
|
45
48
|
};
|
|
@@ -61,7 +64,8 @@ var THREE = /*#__PURE__*/_mergeNamespaces({
|
|
|
61
64
|
WebGLRenderTarget: WebGLRenderTarget,
|
|
62
65
|
WebGLRenderer: WebGLRenderer,
|
|
63
66
|
WebGLRendererParameters: WebGLRendererParameters,
|
|
64
|
-
WebGLShadowMap: WebGLShadowMap
|
|
67
|
+
WebGLShadowMap: WebGLShadowMap,
|
|
68
|
+
loadInspector: loadInspector
|
|
65
69
|
}, [three_webgpu]);
|
|
66
70
|
|
|
67
71
|
//* Utility Types ==============================
|
|
@@ -499,6 +503,18 @@ interface InternalState {
|
|
|
499
503
|
* @see https://threejs.org/docs/#api/en/renderers/common/CanvasTarget
|
|
500
504
|
*/
|
|
501
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
|
|
502
518
|
/**
|
|
503
519
|
* Whether multi-canvas rendering is active.
|
|
504
520
|
* True when any canvas uses `renderer={{ primaryCanvas: 'id' }}` to share a renderer.
|
|
@@ -708,12 +724,19 @@ type DefaultRendererProps = {
|
|
|
708
724
|
*/
|
|
709
725
|
interface CanvasSchedulerConfig {
|
|
710
726
|
/**
|
|
711
|
-
*
|
|
712
|
-
|
|
727
|
+
* Run this Canvas root before the referenced Canvas root id(s).
|
|
728
|
+
*/
|
|
729
|
+
before?: string | string[]
|
|
730
|
+
/**
|
|
731
|
+
* Run this Canvas root after the referenced Canvas root id(s).
|
|
732
|
+
*/
|
|
733
|
+
after?: string | string[]
|
|
734
|
+
/**
|
|
735
|
+
* Numeric root order. Lower values run first.
|
|
713
736
|
*/
|
|
714
|
-
|
|
737
|
+
order?: number
|
|
715
738
|
/**
|
|
716
|
-
* Limit this
|
|
739
|
+
* Limit this Canvas's default render job (frames per second).
|
|
717
740
|
*/
|
|
718
741
|
fps?: number
|
|
719
742
|
}
|
|
@@ -1317,11 +1340,16 @@ declare global {
|
|
|
1317
1340
|
/** Pass record - stores TSL pass nodes for render pipeline */
|
|
1318
1341
|
type PassRecord = Record<string, any>
|
|
1319
1342
|
|
|
1343
|
+
/** State passed to pipeline callbacks after the active pipeline has been created */
|
|
1344
|
+
type RenderPipelineCallbackState = RootState & {
|
|
1345
|
+
renderPipeline: ThreeRenderPipeline
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1320
1348
|
/** Setup callback - runs first to configure MRT, create additional passes */
|
|
1321
|
-
type RenderPipelineSetupCallback = (state:
|
|
1349
|
+
type RenderPipelineSetupCallback = (state: RenderPipelineCallbackState) => PassRecord | void
|
|
1322
1350
|
|
|
1323
1351
|
/** Main callback - runs second to configure outputNode, create effect passes */
|
|
1324
|
-
type RenderPipelineMainCallback = (state:
|
|
1352
|
+
type RenderPipelineMainCallback = (state: RenderPipelineCallbackState) => PassRecord | void
|
|
1325
1353
|
|
|
1326
1354
|
/** Return type for useRenderPipeline hook */
|
|
1327
1355
|
interface UseRenderPipelineReturn {
|
|
@@ -1868,50 +1896,6 @@ declare namespace useLoader {
|
|
|
1868
1896
|
var loader: typeof getLoader;
|
|
1869
1897
|
}
|
|
1870
1898
|
|
|
1871
|
-
/**
|
|
1872
|
-
* Frame hook with phase-based ordering, priority, and FPS throttling.
|
|
1873
|
-
*
|
|
1874
|
-
* Always delivers full RootState — works both inside and outside Canvas context:
|
|
1875
|
-
* - Inside Canvas: Full RootState (renderer, scene, camera, etc.)
|
|
1876
|
-
* - Outside Canvas: The job registers immediately but the callback is held until a
|
|
1877
|
-
* Canvas adopts it, then runs with full RootState. For hostless / standalone
|
|
1878
|
-
* frame loops with no Canvas, use `@pmndrs/scheduler` directly.
|
|
1879
|
-
*
|
|
1880
|
-
* Returns a controls object for manual stepping, pausing, and resuming.
|
|
1881
|
-
*
|
|
1882
|
-
* @param callback - Function called each frame with (state, delta). Optional if you only need scheduler access.
|
|
1883
|
-
* @param priorityOrOptions - Either a priority number (backwards compat) or options object
|
|
1884
|
-
* @returns Controls object with step(), stepAll(), pause(), resume(), isPaused, id, scheduler
|
|
1885
|
-
*
|
|
1886
|
-
* @example
|
|
1887
|
-
* // Simple priority (backwards compat)
|
|
1888
|
-
* useFrame((state, delta) => { ... }, 5)
|
|
1889
|
-
*
|
|
1890
|
-
* @example
|
|
1891
|
-
* // With phase-based ordering
|
|
1892
|
-
* useFrame((state, delta) => { ... }, { phase: 'physics' })
|
|
1893
|
-
*
|
|
1894
|
-
* @example
|
|
1895
|
-
* // Outside Canvas - callback waits for a Canvas, then always has full state
|
|
1896
|
-
* function UI() {
|
|
1897
|
-
* useFrame((state, delta) => { syncUI(state.camera) });
|
|
1898
|
-
* return <button>...</button>;
|
|
1899
|
-
* }
|
|
1900
|
-
*
|
|
1901
|
-
* @example
|
|
1902
|
-
* // Hostless / standalone loop (no Canvas) - use @pmndrs/scheduler directly
|
|
1903
|
-
* import { getScheduler } from '@pmndrs/scheduler'
|
|
1904
|
-
* getScheduler().register((state, delta) => { updateGame(delta) })
|
|
1905
|
-
*
|
|
1906
|
-
* @example
|
|
1907
|
-
* // Scheduler-only access (no callback)
|
|
1908
|
-
* const { scheduler } = useFrame()
|
|
1909
|
-
* scheduler.pauseJob('some-job-id')
|
|
1910
|
-
*
|
|
1911
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe
|
|
1912
|
-
*/
|
|
1913
|
-
declare function useFrame(callback?: FrameNextCallback, priorityOrOptions?: number | UseFrameNextOptions): FrameNextControls;
|
|
1914
|
-
|
|
1915
1899
|
declare const IsObject: (url: unknown) => url is Record<string, string>;
|
|
1916
1900
|
type TextureArray<T> = T extends string[] ? Texture$1[] : never;
|
|
1917
1901
|
type TextureRecord<T> = T extends Record<string, string> ? {
|
|
@@ -2097,11 +2081,6 @@ declare function useRenderTarget(width: number, height: number, options?: Render
|
|
|
2097
2081
|
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usestore
|
|
2098
2082
|
*/
|
|
2099
2083
|
declare function useStore(): RootStore;
|
|
2100
|
-
/**
|
|
2101
|
-
* Accesses R3F's internal state, containing renderer, canvas, scene, etc.
|
|
2102
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usethree
|
|
2103
|
-
*/
|
|
2104
|
-
declare function useThree<T = RootState>(selector?: (state: RootState) => T, equalityFn?: <T>(state: T, newState: T) => boolean): T;
|
|
2105
2084
|
/**
|
|
2106
2085
|
* Exposes an object's {@link Instance}.
|
|
2107
2086
|
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle
|
|
@@ -2177,7 +2156,10 @@ declare function addTail(callback: GlobalRenderCallback): () => void;
|
|
|
2177
2156
|
* Invalidates the view, requesting a frame to be rendered.
|
|
2178
2157
|
* In demand mode, this triggers the scheduler to run frames.
|
|
2179
2158
|
*
|
|
2180
|
-
*
|
|
2159
|
+
* With a state argument, only that root's jobs run on the requested frames; other
|
|
2160
|
+
* roots on 'demand' stay idle. Without one, every registered root is invalidated.
|
|
2161
|
+
*
|
|
2162
|
+
* @param state - Optional root state; targets the invalidation at that root
|
|
2181
2163
|
* @param frames - Number of frames to request (default: 1)
|
|
2182
2164
|
* @param stackFrames - If false, sets pendingFrames to frames. If true, adds to existing pendingFrames (default: false)
|
|
2183
2165
|
*
|
|
@@ -2188,14 +2170,16 @@ declare function invalidate(state?: RootState, frames?: number, stackFrames?: bo
|
|
|
2188
2170
|
* Advances the frameloop and runs render effects.
|
|
2189
2171
|
* Useful for when manually rendering via `frameloop="never"`.
|
|
2190
2172
|
*
|
|
2173
|
+
* With a state argument, only that root is stepped. Without one, every
|
|
2174
|
+
* registered root is stepped for backwards compatibility.
|
|
2175
|
+
*
|
|
2191
2176
|
* @param timestamp - The timestamp to use for this frame
|
|
2192
2177
|
* @param runGlobalEffects - Ignored (kept for backwards compat, global effects always run)
|
|
2193
|
-
* @param state -
|
|
2194
|
-
* @param frame - Ignored (kept for backwards compat)
|
|
2178
|
+
* @param state - Optional root state; targets the manual step at that root
|
|
2195
2179
|
*
|
|
2196
2180
|
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
|
|
2197
2181
|
*/
|
|
2198
|
-
declare function advance(timestamp: number): void;
|
|
2182
|
+
declare function advance(timestamp: number, runGlobalEffects?: boolean, state?: RootState): void;
|
|
2199
2183
|
|
|
2200
2184
|
/* eslint-disable @definitelytyped/no-unnecessary-generics */
|
|
2201
2185
|
declare function ReactReconciler<
|
|
@@ -4086,6 +4070,10 @@ declare function createTextureOperations(set: StoreApi<RootState>['setState']):
|
|
|
4086
4070
|
* - Callbacks receive full RootState for flexibility
|
|
4087
4071
|
* - No auto-cleanup on unmount - use reset() for explicit cleanup
|
|
4088
4072
|
* - Scene/camera changes trigger scenePass recreation
|
|
4073
|
+
* - A replaced scenePass is disposed once the new graph is installed, so rebuild() does not
|
|
4074
|
+
* strand its render target (and MRT attachments) on the GPU
|
|
4075
|
+
* - Any run that changes the output node sets RenderPipeline.needsUpdate, so rebuild() actually
|
|
4076
|
+
* recompiles instead of silently keeping the first compiled graph
|
|
4089
4077
|
*
|
|
4090
4078
|
* @param mainCB - Main callback to configure outputNode and create effect passes
|
|
4091
4079
|
* @param setupCB - Optional setup callback to configure MRT on scenePass
|
|
@@ -4163,5 +4151,23 @@ interface WebGPURootState extends Omit<RootState, 'renderer' | 'gl' | 'internal'
|
|
|
4163
4151
|
internal: WebGPUInternalState
|
|
4164
4152
|
}
|
|
4165
4153
|
|
|
4154
|
+
/**
|
|
4155
|
+
* @fileoverview WebGPU entry point - WebGPU only, no legacy WebGL
|
|
4156
|
+
*
|
|
4157
|
+
* This entry point is for apps that want to use ONLY WebGPURenderer.
|
|
4158
|
+
* Includes WebGPU-specific hooks (useUniforms, useNodes, useTextures).
|
|
4159
|
+
* Auto-extends THREE with WebGPU node materials (MeshBasicNodeMaterial, etc.)
|
|
4160
|
+
*
|
|
4161
|
+
* Usage:
|
|
4162
|
+
* import { Canvas, useFrame, useUniforms } from '@react-three/fiber/webgpu'
|
|
4163
|
+
*/
|
|
4164
|
+
|
|
4165
|
+
/** `useThree` narrowed to WebGPU state — `state.renderer` is a `WebGPURenderer`. */
|
|
4166
|
+
type UseThreeWebGPU = <T = WebGPURootState>(selector?: (state: WebGPURootState) => T, equalityFn?: <U>(state: U, newState: U) => boolean) => T;
|
|
4167
|
+
/** `useFrame` narrowed to WebGPU state — the callback's `state.renderer` is a `WebGPURenderer`. */
|
|
4168
|
+
type UseFrameWebGPU = (callback?: FrameCallback$1<WebGPURootState>, priorityOrOptions?: number | UseFrameNextOptions) => FrameNextControls;
|
|
4169
|
+
declare const useThree: UseThreeWebGPU;
|
|
4170
|
+
declare const useFrame: UseFrameWebGPU;
|
|
4171
|
+
|
|
4166
4172
|
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 };
|
|
4167
|
-
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 };
|
|
4173
|
+
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 };
|