@react-three/fiber 10.0.0-canary.4a21acb → 10.0.0-canary.4f316e6
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 +2617 -2423
- package/dist/index.d.cts +202 -36
- package/dist/index.d.mts +202 -36
- package/dist/index.d.ts +202 -36
- package/dist/index.mjs +2619 -2425
- package/dist/legacy.cjs +2610 -2420
- package/dist/legacy.d.cts +201 -39
- package/dist/legacy.d.mts +201 -39
- package/dist/legacy.d.ts +201 -39
- package/dist/legacy.mjs +2612 -2422
- package/dist/webgpu/index.cjs +2663 -2443
- package/dist/webgpu/index.d.cts +226 -100
- package/dist/webgpu/index.d.mts +226 -100
- package/dist/webgpu/index.d.ts +226 -100
- package/dist/webgpu/index.mjs +2667 -2447
- 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 ==============================
|
|
@@ -362,6 +365,33 @@ type BufferRecord = Record<string, BufferLike>
|
|
|
362
365
|
*/
|
|
363
366
|
type BufferStore = Record<string, BufferLike | BufferRecord>
|
|
364
367
|
|
|
368
|
+
//* Node Types (useNodes) ========================================
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Structural shape of a TSL node as stored on `state.nodes`.
|
|
372
|
+
*
|
|
373
|
+
* Deliberately minimal rather than three's nominal `Node`: in @types/three several node classes
|
|
374
|
+
* TSL hands back (OperatorNode, ConstNode, ...) do not extend `Node` cleanly, so a `Node` bound
|
|
375
|
+
* would reject values `useNodes` creators legitimately return. This is the same shape
|
|
376
|
+
* `useNodes` already constrains creators to (`TSLNodeLike`).
|
|
377
|
+
*/
|
|
378
|
+
interface NodeLike {
|
|
379
|
+
uuid?: string
|
|
380
|
+
nodeType?: string | null
|
|
381
|
+
/** label method for chaining - sets the node's label and returns self */
|
|
382
|
+
label?: ((label: string) => NodeLike) | string
|
|
383
|
+
setName?: (name: string) => this
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/** Flat record of TSL nodes (no nested scopes) */
|
|
387
|
+
type NodeRecord = Record<string, NodeLike>
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Node store that can contain both root-level nodes and scoped node objects.
|
|
391
|
+
* Structure: { wobble: OperatorNode, fx: { blur: ShaderCallable } }
|
|
392
|
+
*/
|
|
393
|
+
type NodeStore = Record<string, NodeLike | NodeRecord>
|
|
394
|
+
|
|
365
395
|
//* Storage Types (useGPUStorage) ========================================
|
|
366
396
|
|
|
367
397
|
/**
|
|
@@ -495,11 +525,28 @@ interface InternalState {
|
|
|
495
525
|
/** Container for child attachment (scene for root, original container for portals) */
|
|
496
526
|
container?: THREE$1.Object3D
|
|
497
527
|
/**
|
|
498
|
-
* CanvasTarget
|
|
499
|
-
*
|
|
528
|
+
* The CanvasTarget this root sizes and renders through.
|
|
529
|
+
*
|
|
530
|
+
* A primary (`<Canvas id>`) owns the renderer's default target -- the one three itself built
|
|
531
|
+
* around the canvas element -- so sizing it is sizing the renderer. A secondary owns a target
|
|
532
|
+
* R3F created for its own element. Either way there is exactly one target per canvas element,
|
|
533
|
+
* and the canvas-target job makes it the renderer's active one before this root renders.
|
|
534
|
+
* Absent on WebGL and on an id-less WebGPU canvas, where the renderer is sized directly.
|
|
500
535
|
* @see https://threejs.org/docs/#api/en/renderers/common/CanvasTarget
|
|
501
536
|
*/
|
|
502
537
|
canvasTarget?: CanvasTarget
|
|
538
|
+
/**
|
|
539
|
+
* Set when this root's canvas target has been resized and the backend's cached render pass
|
|
540
|
+
* descriptor (which holds a depth-stencil view built once per canvas) is therefore stale.
|
|
541
|
+
*
|
|
542
|
+
* Flushed by the canvas-target job in the `start` phase, which is the only place this root's
|
|
543
|
+
* target is guaranteed to be the renderer's active one — `backend.updateSize()` operates on
|
|
544
|
+
* whatever `getCanvasTarget()` returns, so calling it from the resize subscription would
|
|
545
|
+
* invalidate some other canvas's descriptor instead.
|
|
546
|
+
*
|
|
547
|
+
* @see https://github.com/pmndrs/react-three-fiber/issues/3847
|
|
548
|
+
*/
|
|
549
|
+
canvasTargetSizeDirty?: boolean
|
|
503
550
|
/**
|
|
504
551
|
* Whether multi-canvas rendering is active.
|
|
505
552
|
* True when any canvas uses `renderer={{ primaryCanvas: 'id' }}` to share a renderer.
|
|
@@ -609,7 +656,7 @@ interface RootState {
|
|
|
609
656
|
/** Global TSL uniform nodes - root-level uniforms + scoped sub-objects. Use useUniforms() hook */
|
|
610
657
|
uniforms: UniformStore
|
|
611
658
|
/** Global TSL nodes - root-level nodes + scoped sub-objects. Use useNodes() hook */
|
|
612
|
-
nodes:
|
|
659
|
+
nodes: NodeStore
|
|
613
660
|
/** Global TSL buffer nodes - root-level buffers + scoped sub-objects. Use useBuffers() hook */
|
|
614
661
|
buffers: BufferStore
|
|
615
662
|
/** Global GPU storage (textures, etc.) - root-level storage + scoped sub-objects. Use useGPUStorage() hook */
|
|
@@ -621,7 +668,7 @@ interface RootState {
|
|
|
621
668
|
/** WebGPU RenderPipeline instance - use useRenderPipeline() hook */
|
|
622
669
|
renderPipeline: ThreeRenderPipeline | null
|
|
623
670
|
/** Global TSL pass nodes for render pipeline - use useRenderPipeline() hook */
|
|
624
|
-
passes:
|
|
671
|
+
passes: PassRecord
|
|
625
672
|
/** Internal version counter for HMR - incremented by rebuildNodes/rebuildUniforms to bust memoization */
|
|
626
673
|
_hmrVersion: number
|
|
627
674
|
/** Internal: whether setSize() has taken ownership of canvas dimensions */
|
|
@@ -709,12 +756,19 @@ type DefaultRendererProps = {
|
|
|
709
756
|
*/
|
|
710
757
|
interface CanvasSchedulerConfig {
|
|
711
758
|
/**
|
|
712
|
-
*
|
|
713
|
-
|
|
759
|
+
* Run this Canvas root before the referenced Canvas root id(s).
|
|
760
|
+
*/
|
|
761
|
+
before?: string | string[]
|
|
762
|
+
/**
|
|
763
|
+
* Run this Canvas root after the referenced Canvas root id(s).
|
|
764
|
+
*/
|
|
765
|
+
after?: string | string[]
|
|
766
|
+
/**
|
|
767
|
+
* Numeric root order. Lower values run first.
|
|
714
768
|
*/
|
|
715
|
-
|
|
769
|
+
order?: number
|
|
716
770
|
/**
|
|
717
|
-
* Limit this
|
|
771
|
+
* Limit this Canvas's default render job (frames per second).
|
|
718
772
|
*/
|
|
719
773
|
fps?: number
|
|
720
774
|
}
|
|
@@ -1162,7 +1216,33 @@ declare global {
|
|
|
1162
1216
|
* ergonomics. The result is three's structural type, so members stay in sync with the
|
|
1163
1217
|
* installed three instead of needing to be mirrored by hand.
|
|
1164
1218
|
*/
|
|
1165
|
-
type UniformNode<T = unknown> = three_webgpu.UniformNode<
|
|
1219
|
+
type UniformNode<T = unknown> = three_webgpu.UniformNode<UniformNodeTypeFor<T>, T>
|
|
1220
|
+
|
|
1221
|
+
/**
|
|
1222
|
+
* three's node type name for a uniform value type, mirroring the `uniform()` overloads.
|
|
1223
|
+
* A `UniformNode<number>` is a `Node<'float'>`, so TSL math (`.mul`, `.add`, ...) accepts it.
|
|
1224
|
+
* Unknown or unlisted value types resolve to `unknown`, which TSL math rejects: narrow with
|
|
1225
|
+
* `as UniformNode<number>` (or the matching value type) at the call site.
|
|
1226
|
+
*/
|
|
1227
|
+
type UniformNodeTypeFor<T> = T extends number
|
|
1228
|
+
? 'float'
|
|
1229
|
+
: T extends boolean
|
|
1230
|
+
? 'bool'
|
|
1231
|
+
: T extends three_webgpu.Color
|
|
1232
|
+
? 'color'
|
|
1233
|
+
: T extends three_webgpu.Vector2
|
|
1234
|
+
? 'vec2'
|
|
1235
|
+
: T extends three_webgpu.Vector3
|
|
1236
|
+
? 'vec3'
|
|
1237
|
+
: T extends three_webgpu.Vector4
|
|
1238
|
+
? 'vec4'
|
|
1239
|
+
: T extends three_webgpu.Matrix2
|
|
1240
|
+
? 'mat2'
|
|
1241
|
+
: T extends three_webgpu.Matrix3
|
|
1242
|
+
? 'mat3'
|
|
1243
|
+
: T extends three_webgpu.Matrix4
|
|
1244
|
+
? 'mat4'
|
|
1245
|
+
: unknown
|
|
1166
1246
|
|
|
1167
1247
|
/**
|
|
1168
1248
|
* ShaderCallable - the return type of Fn()
|
|
@@ -1315,30 +1395,97 @@ declare global {
|
|
|
1315
1395
|
*/
|
|
1316
1396
|
type ThreeRenderPipeline = three_webgpu.RenderPipeline
|
|
1317
1397
|
|
|
1318
|
-
/**
|
|
1319
|
-
|
|
1398
|
+
/**
|
|
1399
|
+
* The pass `useRenderPipeline` creates for you: three's own `PassNode`, as returned by
|
|
1400
|
+
* `pass(scene, camera)` from `three/tsl`. Referenced from three so members like
|
|
1401
|
+
* `getTextureNode`, `setMRT` and `dispose` track the installed version.
|
|
1402
|
+
*/
|
|
1403
|
+
type ScenePassNode = three_webgpu.PassNode
|
|
1404
|
+
|
|
1405
|
+
/**
|
|
1406
|
+
* Pass record - stores TSL pass nodes for render pipeline.
|
|
1407
|
+
*
|
|
1408
|
+
* `scenePass` is the only key the library owns. It is optional here because this is also the
|
|
1409
|
+
* shape of `state.passes`, which is `{}` before the pipeline exists and again after `reset()`
|
|
1410
|
+
* or `clearPasses()`. Inside the callbacks it is always present; see
|
|
1411
|
+
* {@link RenderPipelineCallbackState}.
|
|
1412
|
+
*
|
|
1413
|
+
* Every other key is user-registered, via a callback's return value. Those are TSL nodes of
|
|
1414
|
+
* any kind, not only passes: texture reads of an MRT attachment, effect nodes, extra
|
|
1415
|
+
* `pass()` instances. `Node` is the common base, so that is the bound. Narrow at the call
|
|
1416
|
+
* site when you need a member, e.g. `passes.velocity as TextureNode`.
|
|
1417
|
+
*/
|
|
1418
|
+
interface PassRecord {
|
|
1419
|
+
scenePass?: ScenePassNode
|
|
1420
|
+
[key: string]: three_webgpu.Node
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
/**
|
|
1424
|
+
* State passed to pipeline callbacks after the active pipeline has been created.
|
|
1425
|
+
*
|
|
1426
|
+
* `passes.scenePass` is required here: the hook installs the default scene pass before either
|
|
1427
|
+
* callback runs, so callbacks can use it without a guard or a cast.
|
|
1428
|
+
*
|
|
1429
|
+
* `renderer` is narrowed to `WebGPURenderer` and `isLegacy` to `false`: the hook throws under
|
|
1430
|
+
* the legacy renderer before either callback can run, so a callback never sees WebGL.
|
|
1431
|
+
*/
|
|
1432
|
+
type RenderPipelineCallbackState = RootState & {
|
|
1433
|
+
renderPipeline: ThreeRenderPipeline
|
|
1434
|
+
passes: PassRecord & { scenePass: ScenePassNode }
|
|
1435
|
+
renderer: three_webgpu.WebGPURenderer
|
|
1436
|
+
isLegacy: false
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
/**
|
|
1440
|
+
* What a callback may return to register entries into `state.passes`.
|
|
1441
|
+
*
|
|
1442
|
+
* `scenePass` is reserved. The hook owns that entry and its lifecycle: it caches the pass it
|
|
1443
|
+
* created, and `rebuild()` / `reset()` dispose that cached pass. A callback overwriting the
|
|
1444
|
+
* store entry would leave the store pointing at a node the hook never disposes, and the hook
|
|
1445
|
+
* disposing a pass nothing references. So returning it is a type error.
|
|
1446
|
+
*/
|
|
1447
|
+
type RegisteredPasses = Record<string, three_webgpu.Node> & { scenePass?: never }
|
|
1320
1448
|
|
|
1321
1449
|
/** Setup callback - runs first to configure MRT, create additional passes */
|
|
1322
|
-
type RenderPipelineSetupCallback = (state:
|
|
1450
|
+
type RenderPipelineSetupCallback = (state: RenderPipelineCallbackState) => RegisteredPasses | void
|
|
1323
1451
|
|
|
1324
1452
|
/** Main callback - runs second to configure outputNode, create effect passes */
|
|
1325
|
-
type RenderPipelineMainCallback = (state:
|
|
1453
|
+
type RenderPipelineMainCallback = (state: RenderPipelineCallbackState) => RegisteredPasses | void
|
|
1326
1454
|
|
|
1327
|
-
/**
|
|
1328
|
-
interface
|
|
1455
|
+
/** The imperative half of useRenderPipeline's return value, present in every state */
|
|
1456
|
+
interface UseRenderPipelineActions {
|
|
1329
1457
|
/** Current passes from state */
|
|
1330
1458
|
passes: PassRecord
|
|
1331
|
-
/** RenderPipeline instance (null if not initialized) */
|
|
1332
|
-
renderPipeline: ThreeRenderPipeline | null
|
|
1333
1459
|
/** Clear all passes from state */
|
|
1334
1460
|
clearPasses: () => void
|
|
1335
1461
|
/** Reset RenderPipeline entirely (clears PP + passes) */
|
|
1336
1462
|
reset: () => void
|
|
1337
1463
|
/** Re-run setup/main callbacks with current closure values */
|
|
1338
1464
|
rebuild: () => void
|
|
1339
|
-
/** True when RenderPipeline is configured and ready */
|
|
1340
|
-
isReady: boolean
|
|
1341
1465
|
}
|
|
1466
|
+
|
|
1467
|
+
/**
|
|
1468
|
+
* Return type for useRenderPipeline hook, discriminated on `isReady`.
|
|
1469
|
+
*
|
|
1470
|
+
* `if (isReady)` narrows `renderPipeline` to non-null, which is what the docs already tell
|
|
1471
|
+
* callers to check. `passes.scenePass` deliberately stays optional in the ready branch:
|
|
1472
|
+
* `clearPasses()` empties the record while leaving the pipeline in place.
|
|
1473
|
+
*/
|
|
1474
|
+
type UseRenderPipelineReturn = UseRenderPipelineActions &
|
|
1475
|
+
(
|
|
1476
|
+
| {
|
|
1477
|
+
/** True when RenderPipeline is configured and ready */
|
|
1478
|
+
isReady: true
|
|
1479
|
+
/** RenderPipeline instance */
|
|
1480
|
+
renderPipeline: ThreeRenderPipeline
|
|
1481
|
+
}
|
|
1482
|
+
| {
|
|
1483
|
+
/** False until the pipeline has been created */
|
|
1484
|
+
isReady: false
|
|
1485
|
+
/** Not initialized yet, or torn down by reset() */
|
|
1486
|
+
renderPipeline: null
|
|
1487
|
+
}
|
|
1488
|
+
)
|
|
1342
1489
|
}
|
|
1343
1490
|
|
|
1344
1491
|
type MutableOrReadonlyParameters<T extends (...args: any) => any> = Parameters<T> | Readonly<Parameters<T>>
|
|
@@ -1638,9 +1785,9 @@ type EnvironmentProps = {
|
|
|
1638
1785
|
blur?: number;
|
|
1639
1786
|
backgroundBlurriness?: number;
|
|
1640
1787
|
backgroundIntensity?: number;
|
|
1641
|
-
backgroundRotation?: Euler
|
|
1788
|
+
backgroundRotation?: Euler;
|
|
1642
1789
|
environmentIntensity?: number;
|
|
1643
|
-
environmentRotation?: Euler
|
|
1790
|
+
environmentRotation?: Euler;
|
|
1644
1791
|
map?: Texture$1;
|
|
1645
1792
|
preset?: PresetsType;
|
|
1646
1793
|
scene?: Scene | React$1.RefObject<Scene>;
|
|
@@ -1724,7 +1871,7 @@ declare function EnvironmentCube({ background, scene, blur, backgroundBlurriness
|
|
|
1724
1871
|
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
1872
|
declare module '@react-three/fiber' {
|
|
1726
1873
|
interface ThreeElements {
|
|
1727
|
-
groundProjectedEnvImpl: ThreeElement
|
|
1874
|
+
groundProjectedEnvImpl: ThreeElement<typeof GroundedSkybox>;
|
|
1728
1875
|
}
|
|
1729
1876
|
}
|
|
1730
1877
|
/**
|
|
@@ -1824,6 +1971,24 @@ declare module '@react-three/fiber' {
|
|
|
1824
1971
|
*/
|
|
1825
1972
|
declare function Environment(props: EnvironmentProps): react_jsx_runtime.JSX.Element;
|
|
1826
1973
|
|
|
1974
|
+
/**
|
|
1975
|
+
* Moves every trace of interactivity from one object to its replacement, for reconstruction.
|
|
1976
|
+
*
|
|
1977
|
+
* When `args` or a `primitive`'s `object` changes, R3F builds a new three object and keeps the same
|
|
1978
|
+
* instance. Removing the old object from the interaction state and registering the new one from
|
|
1979
|
+
* scratch makes events *work* again (#3778), but it forgets what was in flight: a pointer resting on
|
|
1980
|
+
* the object fires a second `onPointerEnter` without ever having left, and an active pointer capture
|
|
1981
|
+
* is dropped mid-drag. Rewriting the references instead keeps the interaction continuous across a
|
|
1982
|
+
* swap the user never asked to see (#3744).
|
|
1983
|
+
*
|
|
1984
|
+
* Captures are re-keyed rather than released, so the DOM-level capture on `captureData.target` is
|
|
1985
|
+
* left alone — releasing and re-acquiring it is precisely the glitch being avoided.
|
|
1986
|
+
*
|
|
1987
|
+
* Visibility handlers are deliberately not transferred: that registry is keyed by `object.uuid`, so
|
|
1988
|
+
* the replacement re-registers itself through `applyProps`. The old entry is dropped here so it
|
|
1989
|
+
* cannot outlive the object it described.
|
|
1990
|
+
*/
|
|
1991
|
+
declare function swapInteractivity(store: RootStore, object: Object3D, newObject: Object3D): void;
|
|
1827
1992
|
declare function removeInteractivity(store: RootStore, object: Object3D): void;
|
|
1828
1993
|
declare function createEvents(store: RootStore): {
|
|
1829
1994
|
handlePointer: (name: string) => (event: DomEvent) => void;
|
|
@@ -1851,50 +2016,6 @@ declare namespace useLoader {
|
|
|
1851
2016
|
var loader: typeof getLoader;
|
|
1852
2017
|
}
|
|
1853
2018
|
|
|
1854
|
-
/**
|
|
1855
|
-
* Frame hook with phase-based ordering, priority, and FPS throttling.
|
|
1856
|
-
*
|
|
1857
|
-
* Always delivers full RootState — works both inside and outside Canvas context:
|
|
1858
|
-
* - Inside Canvas: Full RootState (renderer, scene, camera, etc.)
|
|
1859
|
-
* - Outside Canvas: The job registers immediately but the callback is held until a
|
|
1860
|
-
* Canvas adopts it, then runs with full RootState. For hostless / standalone
|
|
1861
|
-
* frame loops with no Canvas, use `@pmndrs/scheduler` directly.
|
|
1862
|
-
*
|
|
1863
|
-
* Returns a controls object for manual stepping, pausing, and resuming.
|
|
1864
|
-
*
|
|
1865
|
-
* @param callback - Function called each frame with (state, delta). Optional if you only need scheduler access.
|
|
1866
|
-
* @param priorityOrOptions - Either a priority number (backwards compat) or options object
|
|
1867
|
-
* @returns Controls object with step(), stepAll(), pause(), resume(), isPaused, id, scheduler
|
|
1868
|
-
*
|
|
1869
|
-
* @example
|
|
1870
|
-
* // Simple priority (backwards compat)
|
|
1871
|
-
* useFrame((state, delta) => { ... }, 5)
|
|
1872
|
-
*
|
|
1873
|
-
* @example
|
|
1874
|
-
* // With phase-based ordering
|
|
1875
|
-
* useFrame((state, delta) => { ... }, { phase: 'physics' })
|
|
1876
|
-
*
|
|
1877
|
-
* @example
|
|
1878
|
-
* // Outside Canvas - callback waits for a Canvas, then always has full state
|
|
1879
|
-
* function UI() {
|
|
1880
|
-
* useFrame((state, delta) => { syncUI(state.camera) });
|
|
1881
|
-
* return <button>...</button>;
|
|
1882
|
-
* }
|
|
1883
|
-
*
|
|
1884
|
-
* @example
|
|
1885
|
-
* // Hostless / standalone loop (no Canvas) - use @pmndrs/scheduler directly
|
|
1886
|
-
* import { getScheduler } from '@pmndrs/scheduler'
|
|
1887
|
-
* getScheduler().register((state, delta) => { updateGame(delta) })
|
|
1888
|
-
*
|
|
1889
|
-
* @example
|
|
1890
|
-
* // Scheduler-only access (no callback)
|
|
1891
|
-
* const { scheduler } = useFrame()
|
|
1892
|
-
* scheduler.pauseJob('some-job-id')
|
|
1893
|
-
*
|
|
1894
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe
|
|
1895
|
-
*/
|
|
1896
|
-
declare function useFrame(callback?: FrameNextCallback, priorityOrOptions?: number | UseFrameNextOptions): FrameNextControls;
|
|
1897
|
-
|
|
1898
2019
|
declare const IsObject: (url: unknown) => url is Record<string, string>;
|
|
1899
2020
|
type TextureArray<T> = T extends string[] ? Texture$1[] : never;
|
|
1900
2021
|
type TextureRecord<T> = T extends Record<string, string> ? {
|
|
@@ -2080,11 +2201,6 @@ declare function useRenderTarget(width: number, height: number, options?: Render
|
|
|
2080
2201
|
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usestore
|
|
2081
2202
|
*/
|
|
2082
2203
|
declare function useStore(): RootStore;
|
|
2083
|
-
/**
|
|
2084
|
-
* Accesses R3F's internal state, containing renderer, canvas, scene, etc.
|
|
2085
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usethree
|
|
2086
|
-
*/
|
|
2087
|
-
declare function useThree<T = RootState>(selector?: (state: RootState) => T, equalityFn?: <T>(state: T, newState: T) => boolean): T;
|
|
2088
2204
|
/**
|
|
2089
2205
|
* Exposes an object's {@link Instance}.
|
|
2090
2206
|
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle
|
|
@@ -2160,7 +2276,10 @@ declare function addTail(callback: GlobalRenderCallback): () => void;
|
|
|
2160
2276
|
* Invalidates the view, requesting a frame to be rendered.
|
|
2161
2277
|
* In demand mode, this triggers the scheduler to run frames.
|
|
2162
2278
|
*
|
|
2163
|
-
*
|
|
2279
|
+
* With a state argument, only that root's jobs run on the requested frames; other
|
|
2280
|
+
* roots on 'demand' stay idle. Without one, every registered root is invalidated.
|
|
2281
|
+
*
|
|
2282
|
+
* @param state - Optional root state; targets the invalidation at that root
|
|
2164
2283
|
* @param frames - Number of frames to request (default: 1)
|
|
2165
2284
|
* @param stackFrames - If false, sets pendingFrames to frames. If true, adds to existing pendingFrames (default: false)
|
|
2166
2285
|
*
|
|
@@ -2171,14 +2290,16 @@ declare function invalidate(state?: RootState, frames?: number, stackFrames?: bo
|
|
|
2171
2290
|
* Advances the frameloop and runs render effects.
|
|
2172
2291
|
* Useful for when manually rendering via `frameloop="never"`.
|
|
2173
2292
|
*
|
|
2293
|
+
* With a state argument, only that root is stepped. Without one, every
|
|
2294
|
+
* registered root is stepped for backwards compatibility.
|
|
2295
|
+
*
|
|
2174
2296
|
* @param timestamp - The timestamp to use for this frame
|
|
2175
2297
|
* @param runGlobalEffects - Ignored (kept for backwards compat, global effects always run)
|
|
2176
|
-
* @param state -
|
|
2177
|
-
* @param frame - Ignored (kept for backwards compat)
|
|
2298
|
+
* @param state - Optional root state; targets the manual step at that root
|
|
2178
2299
|
*
|
|
2179
2300
|
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
|
|
2180
2301
|
*/
|
|
2181
|
-
declare function advance(timestamp: number): void;
|
|
2302
|
+
declare function advance(timestamp: number, runGlobalEffects?: boolean, state?: RootState): void;
|
|
2182
2303
|
|
|
2183
2304
|
/* eslint-disable @definitelytyped/no-unnecessary-generics */
|
|
2184
2305
|
declare function ReactReconciler<
|
|
@@ -3249,11 +3370,6 @@ declare function flushSync<R>(fn: () => R): R;
|
|
|
3249
3370
|
declare const context: React$1.Context<RootStore>;
|
|
3250
3371
|
declare const createStore: (invalidate: (state?: RootState, frames?: number, stackFrames?: boolean) => void, advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState, frame?: XRFrame) => void) => RootStore;
|
|
3251
3372
|
|
|
3252
|
-
/**
|
|
3253
|
-
* Safely flush async effects when testing, simulating a legacy root.
|
|
3254
|
-
* @deprecated Import from React instead. import { act } from 'react'
|
|
3255
|
-
*/
|
|
3256
|
-
declare const act: typeof React$1.act;
|
|
3257
3373
|
/**
|
|
3258
3374
|
* An SSR-friendly useLayoutEffect.
|
|
3259
3375
|
*
|
|
@@ -3867,25 +3983,13 @@ declare function useUniform<T extends UniformValue>(name: string): UniformNode<T
|
|
|
3867
3983
|
declare function useUniform<T extends UniformValue>(name: string, value: T): UniformNode<Widen<T>>;
|
|
3868
3984
|
|
|
3869
3985
|
/**
|
|
3870
|
-
* Minimal interface for TSL nodes.
|
|
3871
|
-
*
|
|
3872
|
-
*
|
|
3873
|
-
* extend Node with all required properties.
|
|
3986
|
+
* Minimal interface for TSL nodes. The definition lives with the store types as `NodeLike`, so
|
|
3987
|
+
* the shape creators may return and the shape `state.nodes` holds are the same type by
|
|
3988
|
+
* construction. See `NodeLike` for why this is structural rather than three's `Node`.
|
|
3874
3989
|
*/
|
|
3875
|
-
|
|
3876
|
-
uuid?: string;
|
|
3877
|
-
nodeType?: string | null;
|
|
3878
|
-
/** label method for chaining - sets the node's label and returns self */
|
|
3879
|
-
label?: ((label: string) => TSLNodeLike) | string;
|
|
3880
|
-
setName?: (name: string) => this;
|
|
3881
|
-
}
|
|
3990
|
+
type TSLNodeLike = NodeLike;
|
|
3882
3991
|
/** TSL node type - alias for compatibility */
|
|
3883
3992
|
type TSLNode = TSLNodeLike;
|
|
3884
|
-
/**
|
|
3885
|
-
* A record of TSL nodes - allows mixed node types (OperatorNode, ConstNode, etc.)
|
|
3886
|
-
* Uses TSLNodeLike for broader compatibility with Three.js's TSL type definitions.
|
|
3887
|
-
*/
|
|
3888
|
-
type NodeRecord<T extends TSLNodeLike = TSLNodeLike> = Record<string, T>;
|
|
3889
3993
|
/**
|
|
3890
3994
|
* Creator function that returns a record of nodes.
|
|
3891
3995
|
* Uses TSLNodeLike constraint to allow mixed node types
|
|
@@ -4074,6 +4178,10 @@ declare function createTextureOperations(set: StoreApi<RootState>['setState']):
|
|
|
4074
4178
|
* - Callbacks receive full RootState for flexibility
|
|
4075
4179
|
* - No auto-cleanup on unmount - use reset() for explicit cleanup
|
|
4076
4180
|
* - Scene/camera changes trigger scenePass recreation
|
|
4181
|
+
* - A replaced scenePass is disposed once the new graph is installed, so rebuild() does not
|
|
4182
|
+
* strand its render target (and MRT attachments) on the GPU
|
|
4183
|
+
* - Any run that changes the output node sets RenderPipeline.needsUpdate, so rebuild() actually
|
|
4184
|
+
* recompiles instead of silently keeping the first compiled graph
|
|
4077
4185
|
*
|
|
4078
4186
|
* @param mainCB - Main callback to configure outputNode and create effect passes
|
|
4079
4187
|
* @param setupCB - Optional setup callback to configure MRT on scenePass
|
|
@@ -4151,5 +4259,23 @@ interface WebGPURootState extends Omit<RootState, 'renderer' | 'gl' | 'internal'
|
|
|
4151
4259
|
internal: WebGPUInternalState
|
|
4152
4260
|
}
|
|
4153
4261
|
|
|
4154
|
-
|
|
4155
|
-
|
|
4262
|
+
/**
|
|
4263
|
+
* @fileoverview WebGPU entry point - WebGPU only, no legacy WebGL
|
|
4264
|
+
*
|
|
4265
|
+
* This entry point is for apps that want to use ONLY WebGPURenderer.
|
|
4266
|
+
* Includes WebGPU-specific hooks (useUniforms, useNodes, useTextures).
|
|
4267
|
+
* Auto-extends THREE with WebGPU node materials (MeshBasicNodeMaterial, etc.)
|
|
4268
|
+
*
|
|
4269
|
+
* Usage:
|
|
4270
|
+
* import { Canvas, useFrame, useUniforms } from '@react-three/fiber/webgpu'
|
|
4271
|
+
*/
|
|
4272
|
+
|
|
4273
|
+
/** `useThree` narrowed to WebGPU state — `state.renderer` is a `WebGPURenderer`. */
|
|
4274
|
+
type UseThreeWebGPU = <T = WebGPURootState>(selector?: (state: WebGPURootState) => T, equalityFn?: <U>(state: U, newState: U) => boolean) => T;
|
|
4275
|
+
/** `useFrame` narrowed to WebGPU state — the callback's `state.renderer` is a `WebGPURenderer`. */
|
|
4276
|
+
type UseFrameWebGPU = (callback?: FrameCallback$1<WebGPURootState>, priorityOrOptions?: number | UseFrameNextOptions) => FrameNextControls;
|
|
4277
|
+
declare const useThree: UseThreeWebGPU;
|
|
4278
|
+
declare const useFrame: UseFrameWebGPU;
|
|
4279
|
+
|
|
4280
|
+
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 };
|
|
4281
|
+
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, NodeLike, NodeProps, NodeStore, 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 };
|