@react-three/fiber 10.0.0-canary.8f5b4d3 → 10.0.0-canary.979dc2d
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 +120 -62
- package/dist/index.d.cts +180 -26
- package/dist/index.d.mts +180 -26
- package/dist/index.d.ts +180 -26
- package/dist/index.mjs +120 -62
- package/dist/legacy.cjs +116 -62
- package/dist/legacy.d.cts +179 -29
- package/dist/legacy.d.mts +179 -29
- package/dist/legacy.d.ts +179 -29
- package/dist/legacy.mjs +116 -62
- package/dist/webgpu/index.cjs +183 -99
- package/dist/webgpu/index.d.cts +204 -90
- package/dist/webgpu/index.d.mts +204 -90
- package/dist/webgpu/index.d.ts +204 -90
- package/dist/webgpu/index.mjs +183 -99
- 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';
|
|
@@ -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 ==============================
|
|
@@ -361,6 +365,33 @@ type BufferRecord = Record<string, BufferLike>
|
|
|
361
365
|
*/
|
|
362
366
|
type BufferStore = Record<string, BufferLike | BufferRecord>
|
|
363
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
|
+
|
|
364
395
|
//* Storage Types (useGPUStorage) ========================================
|
|
365
396
|
|
|
366
397
|
/**
|
|
@@ -494,11 +525,28 @@ interface InternalState {
|
|
|
494
525
|
/** Container for child attachment (scene for root, original container for portals) */
|
|
495
526
|
container?: THREE$1.Object3D
|
|
496
527
|
/**
|
|
497
|
-
* CanvasTarget
|
|
498
|
-
*
|
|
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.
|
|
499
535
|
* @see https://threejs.org/docs/#api/en/renderers/common/CanvasTarget
|
|
500
536
|
*/
|
|
501
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
|
|
502
550
|
/**
|
|
503
551
|
* Whether multi-canvas rendering is active.
|
|
504
552
|
* True when any canvas uses `renderer={{ primaryCanvas: 'id' }}` to share a renderer.
|
|
@@ -608,7 +656,7 @@ interface RootState {
|
|
|
608
656
|
/** Global TSL uniform nodes - root-level uniforms + scoped sub-objects. Use useUniforms() hook */
|
|
609
657
|
uniforms: UniformStore
|
|
610
658
|
/** Global TSL nodes - root-level nodes + scoped sub-objects. Use useNodes() hook */
|
|
611
|
-
nodes:
|
|
659
|
+
nodes: NodeStore
|
|
612
660
|
/** Global TSL buffer nodes - root-level buffers + scoped sub-objects. Use useBuffers() hook */
|
|
613
661
|
buffers: BufferStore
|
|
614
662
|
/** Global GPU storage (textures, etc.) - root-level storage + scoped sub-objects. Use useGPUStorage() hook */
|
|
@@ -620,7 +668,7 @@ interface RootState {
|
|
|
620
668
|
/** WebGPU RenderPipeline instance - use useRenderPipeline() hook */
|
|
621
669
|
renderPipeline: ThreeRenderPipeline | null
|
|
622
670
|
/** Global TSL pass nodes for render pipeline - use useRenderPipeline() hook */
|
|
623
|
-
passes:
|
|
671
|
+
passes: PassRecord
|
|
624
672
|
/** Internal version counter for HMR - incremented by rebuildNodes/rebuildUniforms to bust memoization */
|
|
625
673
|
_hmrVersion: number
|
|
626
674
|
/** Internal: whether setSize() has taken ownership of canvas dimensions */
|
|
@@ -708,12 +756,19 @@ type DefaultRendererProps = {
|
|
|
708
756
|
*/
|
|
709
757
|
interface CanvasSchedulerConfig {
|
|
710
758
|
/**
|
|
711
|
-
*
|
|
712
|
-
|
|
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.
|
|
713
768
|
*/
|
|
714
|
-
|
|
769
|
+
order?: number
|
|
715
770
|
/**
|
|
716
|
-
* Limit this
|
|
771
|
+
* Limit this Canvas's default render job (frames per second).
|
|
717
772
|
*/
|
|
718
773
|
fps?: number
|
|
719
774
|
}
|
|
@@ -1161,7 +1216,33 @@ declare global {
|
|
|
1161
1216
|
* ergonomics. The result is three's structural type, so members stay in sync with the
|
|
1162
1217
|
* installed three instead of needing to be mirrored by hand.
|
|
1163
1218
|
*/
|
|
1164
|
-
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
|
|
1165
1246
|
|
|
1166
1247
|
/**
|
|
1167
1248
|
* ShaderCallable - the return type of Fn()
|
|
@@ -1314,30 +1395,97 @@ declare global {
|
|
|
1314
1395
|
*/
|
|
1315
1396
|
type ThreeRenderPipeline = three_webgpu.RenderPipeline
|
|
1316
1397
|
|
|
1317
|
-
/**
|
|
1318
|
-
|
|
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 }
|
|
1319
1448
|
|
|
1320
1449
|
/** Setup callback - runs first to configure MRT, create additional passes */
|
|
1321
|
-
type RenderPipelineSetupCallback = (state:
|
|
1450
|
+
type RenderPipelineSetupCallback = (state: RenderPipelineCallbackState) => RegisteredPasses | void
|
|
1322
1451
|
|
|
1323
1452
|
/** Main callback - runs second to configure outputNode, create effect passes */
|
|
1324
|
-
type RenderPipelineMainCallback = (state:
|
|
1453
|
+
type RenderPipelineMainCallback = (state: RenderPipelineCallbackState) => RegisteredPasses | void
|
|
1325
1454
|
|
|
1326
|
-
/**
|
|
1327
|
-
interface
|
|
1455
|
+
/** The imperative half of useRenderPipeline's return value, present in every state */
|
|
1456
|
+
interface UseRenderPipelineActions {
|
|
1328
1457
|
/** Current passes from state */
|
|
1329
1458
|
passes: PassRecord
|
|
1330
|
-
/** RenderPipeline instance (null if not initialized) */
|
|
1331
|
-
renderPipeline: ThreeRenderPipeline | null
|
|
1332
1459
|
/** Clear all passes from state */
|
|
1333
1460
|
clearPasses: () => void
|
|
1334
1461
|
/** Reset RenderPipeline entirely (clears PP + passes) */
|
|
1335
1462
|
reset: () => void
|
|
1336
1463
|
/** Re-run setup/main callbacks with current closure values */
|
|
1337
1464
|
rebuild: () => void
|
|
1338
|
-
/** True when RenderPipeline is configured and ready */
|
|
1339
|
-
isReady: boolean
|
|
1340
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
|
+
)
|
|
1341
1489
|
}
|
|
1342
1490
|
|
|
1343
1491
|
type MutableOrReadonlyParameters<T extends (...args: any) => any> = Parameters<T> | Readonly<Parameters<T>>
|
|
@@ -1868,50 +2016,6 @@ declare namespace useLoader {
|
|
|
1868
2016
|
var loader: typeof getLoader;
|
|
1869
2017
|
}
|
|
1870
2018
|
|
|
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
2019
|
declare const IsObject: (url: unknown) => url is Record<string, string>;
|
|
1916
2020
|
type TextureArray<T> = T extends string[] ? Texture$1[] : never;
|
|
1917
2021
|
type TextureRecord<T> = T extends Record<string, string> ? {
|
|
@@ -2097,11 +2201,6 @@ declare function useRenderTarget(width: number, height: number, options?: Render
|
|
|
2097
2201
|
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usestore
|
|
2098
2202
|
*/
|
|
2099
2203
|
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
2204
|
/**
|
|
2106
2205
|
* Exposes an object's {@link Instance}.
|
|
2107
2206
|
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle
|
|
@@ -2177,7 +2276,10 @@ declare function addTail(callback: GlobalRenderCallback): () => void;
|
|
|
2177
2276
|
* Invalidates the view, requesting a frame to be rendered.
|
|
2178
2277
|
* In demand mode, this triggers the scheduler to run frames.
|
|
2179
2278
|
*
|
|
2180
|
-
*
|
|
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
|
|
2181
2283
|
* @param frames - Number of frames to request (default: 1)
|
|
2182
2284
|
* @param stackFrames - If false, sets pendingFrames to frames. If true, adds to existing pendingFrames (default: false)
|
|
2183
2285
|
*
|
|
@@ -2188,14 +2290,16 @@ declare function invalidate(state?: RootState, frames?: number, stackFrames?: bo
|
|
|
2188
2290
|
* Advances the frameloop and runs render effects.
|
|
2189
2291
|
* Useful for when manually rendering via `frameloop="never"`.
|
|
2190
2292
|
*
|
|
2293
|
+
* With a state argument, only that root is stepped. Without one, every
|
|
2294
|
+
* registered root is stepped for backwards compatibility.
|
|
2295
|
+
*
|
|
2191
2296
|
* @param timestamp - The timestamp to use for this frame
|
|
2192
2297
|
* @param runGlobalEffects - Ignored (kept for backwards compat, global effects always run)
|
|
2193
|
-
* @param state -
|
|
2194
|
-
* @param frame - Ignored (kept for backwards compat)
|
|
2298
|
+
* @param state - Optional root state; targets the manual step at that root
|
|
2195
2299
|
*
|
|
2196
2300
|
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
|
|
2197
2301
|
*/
|
|
2198
|
-
declare function advance(timestamp: number): void;
|
|
2302
|
+
declare function advance(timestamp: number, runGlobalEffects?: boolean, state?: RootState): void;
|
|
2199
2303
|
|
|
2200
2304
|
/* eslint-disable @definitelytyped/no-unnecessary-generics */
|
|
2201
2305
|
declare function ReactReconciler<
|
|
@@ -3879,25 +3983,13 @@ declare function useUniform<T extends UniformValue>(name: string): UniformNode<T
|
|
|
3879
3983
|
declare function useUniform<T extends UniformValue>(name: string, value: T): UniformNode<Widen<T>>;
|
|
3880
3984
|
|
|
3881
3985
|
/**
|
|
3882
|
-
* Minimal interface for TSL nodes.
|
|
3883
|
-
*
|
|
3884
|
-
*
|
|
3885
|
-
* 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`.
|
|
3886
3989
|
*/
|
|
3887
|
-
|
|
3888
|
-
uuid?: string;
|
|
3889
|
-
nodeType?: string | null;
|
|
3890
|
-
/** label method for chaining - sets the node's label and returns self */
|
|
3891
|
-
label?: ((label: string) => TSLNodeLike) | string;
|
|
3892
|
-
setName?: (name: string) => this;
|
|
3893
|
-
}
|
|
3990
|
+
type TSLNodeLike = NodeLike;
|
|
3894
3991
|
/** TSL node type - alias for compatibility */
|
|
3895
3992
|
type TSLNode = TSLNodeLike;
|
|
3896
|
-
/**
|
|
3897
|
-
* A record of TSL nodes - allows mixed node types (OperatorNode, ConstNode, etc.)
|
|
3898
|
-
* Uses TSLNodeLike for broader compatibility with Three.js's TSL type definitions.
|
|
3899
|
-
*/
|
|
3900
|
-
type NodeRecord<T extends TSLNodeLike = TSLNodeLike> = Record<string, T>;
|
|
3901
3993
|
/**
|
|
3902
3994
|
* Creator function that returns a record of nodes.
|
|
3903
3995
|
* Uses TSLNodeLike constraint to allow mixed node types
|
|
@@ -4086,6 +4178,10 @@ declare function createTextureOperations(set: StoreApi<RootState>['setState']):
|
|
|
4086
4178
|
* - Callbacks receive full RootState for flexibility
|
|
4087
4179
|
* - No auto-cleanup on unmount - use reset() for explicit cleanup
|
|
4088
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
|
|
4089
4185
|
*
|
|
4090
4186
|
* @param mainCB - Main callback to configure outputNode and create effect passes
|
|
4091
4187
|
* @param setupCB - Optional setup callback to configure MRT on scenePass
|
|
@@ -4163,5 +4259,23 @@ interface WebGPURootState extends Omit<RootState, 'renderer' | 'gl' | 'internal'
|
|
|
4163
4259
|
internal: WebGPUInternalState
|
|
4164
4260
|
}
|
|
4165
4261
|
|
|
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
|
+
|
|
4166
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 };
|
|
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,
|
|
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 };
|