@react-three/fiber 10.0.0-canary.ba354c7 → 10.0.0-canary.c385e9f
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 +173 -24
- package/dist/index.d.mts +173 -24
- package/dist/index.d.ts +173 -24
- package/dist/index.mjs +105 -53
- package/dist/legacy.cjs +104 -57
- package/dist/legacy.d.cts +172 -27
- package/dist/legacy.d.mts +172 -27
- package/dist/legacy.d.ts +172 -27
- package/dist/legacy.mjs +104 -57
- package/dist/webgpu/index.cjs +168 -90
- package/dist/webgpu/index.d.cts +197 -88
- package/dist/webgpu/index.d.mts +197 -88
- package/dist/webgpu/index.d.ts +197 -88
- package/dist/webgpu/index.mjs +168 -90
- package/package.json +2 -2
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';
|
|
@@ -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
|
/**
|
|
@@ -499,6 +530,18 @@ interface InternalState {
|
|
|
499
530
|
* @see https://threejs.org/docs/#api/en/renderers/common/CanvasTarget
|
|
500
531
|
*/
|
|
501
532
|
canvasTarget?: CanvasTarget
|
|
533
|
+
/**
|
|
534
|
+
* Set when this root's canvas target has been resized and the backend's cached render pass
|
|
535
|
+
* descriptor (which holds a depth-stencil view built once per canvas) is therefore stale.
|
|
536
|
+
*
|
|
537
|
+
* Flushed by the canvas-target job in the `start` phase, which is the only place this root's
|
|
538
|
+
* target is guaranteed to be the renderer's active one — `backend.updateSize()` operates on
|
|
539
|
+
* whatever `getCanvasTarget()` returns, so calling it from the resize subscription would
|
|
540
|
+
* invalidate some other canvas's descriptor instead.
|
|
541
|
+
*
|
|
542
|
+
* @see https://github.com/pmndrs/react-three-fiber/issues/3847
|
|
543
|
+
*/
|
|
544
|
+
canvasTargetSizeDirty?: boolean
|
|
502
545
|
/**
|
|
503
546
|
* Whether multi-canvas rendering is active.
|
|
504
547
|
* True when any canvas uses `renderer={{ primaryCanvas: 'id' }}` to share a renderer.
|
|
@@ -608,7 +651,7 @@ interface RootState {
|
|
|
608
651
|
/** Global TSL uniform nodes - root-level uniforms + scoped sub-objects. Use useUniforms() hook */
|
|
609
652
|
uniforms: UniformStore
|
|
610
653
|
/** Global TSL nodes - root-level nodes + scoped sub-objects. Use useNodes() hook */
|
|
611
|
-
nodes:
|
|
654
|
+
nodes: NodeStore
|
|
612
655
|
/** Global TSL buffer nodes - root-level buffers + scoped sub-objects. Use useBuffers() hook */
|
|
613
656
|
buffers: BufferStore
|
|
614
657
|
/** Global GPU storage (textures, etc.) - root-level storage + scoped sub-objects. Use useGPUStorage() hook */
|
|
@@ -620,7 +663,7 @@ interface RootState {
|
|
|
620
663
|
/** WebGPU RenderPipeline instance - use useRenderPipeline() hook */
|
|
621
664
|
renderPipeline: ThreeRenderPipeline | null
|
|
622
665
|
/** Global TSL pass nodes for render pipeline - use useRenderPipeline() hook */
|
|
623
|
-
passes:
|
|
666
|
+
passes: PassRecord
|
|
624
667
|
/** Internal version counter for HMR - incremented by rebuildNodes/rebuildUniforms to bust memoization */
|
|
625
668
|
_hmrVersion: number
|
|
626
669
|
/** Internal: whether setSize() has taken ownership of canvas dimensions */
|
|
@@ -708,12 +751,19 @@ type DefaultRendererProps = {
|
|
|
708
751
|
*/
|
|
709
752
|
interface CanvasSchedulerConfig {
|
|
710
753
|
/**
|
|
711
|
-
*
|
|
712
|
-
* Pass the `id` of another canvas.
|
|
754
|
+
* Run this Canvas root before the referenced Canvas root id(s).
|
|
713
755
|
*/
|
|
714
|
-
|
|
756
|
+
before?: string | string[]
|
|
715
757
|
/**
|
|
716
|
-
*
|
|
758
|
+
* Run this Canvas root after the referenced Canvas root id(s).
|
|
759
|
+
*/
|
|
760
|
+
after?: string | string[]
|
|
761
|
+
/**
|
|
762
|
+
* Numeric root order. Lower values run first.
|
|
763
|
+
*/
|
|
764
|
+
order?: number
|
|
765
|
+
/**
|
|
766
|
+
* Limit this Canvas's default render job (frames per second).
|
|
717
767
|
*/
|
|
718
768
|
fps?: number
|
|
719
769
|
}
|
|
@@ -1161,7 +1211,33 @@ declare global {
|
|
|
1161
1211
|
* ergonomics. The result is three's structural type, so members stay in sync with the
|
|
1162
1212
|
* installed three instead of needing to be mirrored by hand.
|
|
1163
1213
|
*/
|
|
1164
|
-
type UniformNode<T = unknown> = three_webgpu.UniformNode<
|
|
1214
|
+
type UniformNode<T = unknown> = three_webgpu.UniformNode<UniformNodeTypeFor<T>, T>
|
|
1215
|
+
|
|
1216
|
+
/**
|
|
1217
|
+
* three's node type name for a uniform value type, mirroring the `uniform()` overloads.
|
|
1218
|
+
* A `UniformNode<number>` is a `Node<'float'>`, so TSL math (`.mul`, `.add`, ...) accepts it.
|
|
1219
|
+
* Unknown or unlisted value types resolve to `unknown`, which TSL math rejects: narrow with
|
|
1220
|
+
* `as UniformNode<number>` (or the matching value type) at the call site.
|
|
1221
|
+
*/
|
|
1222
|
+
type UniformNodeTypeFor<T> = T extends number
|
|
1223
|
+
? 'float'
|
|
1224
|
+
: T extends boolean
|
|
1225
|
+
? 'bool'
|
|
1226
|
+
: T extends three_webgpu.Color
|
|
1227
|
+
? 'color'
|
|
1228
|
+
: T extends three_webgpu.Vector2
|
|
1229
|
+
? 'vec2'
|
|
1230
|
+
: T extends three_webgpu.Vector3
|
|
1231
|
+
? 'vec3'
|
|
1232
|
+
: T extends three_webgpu.Vector4
|
|
1233
|
+
? 'vec4'
|
|
1234
|
+
: T extends three_webgpu.Matrix2
|
|
1235
|
+
? 'mat2'
|
|
1236
|
+
: T extends three_webgpu.Matrix3
|
|
1237
|
+
? 'mat3'
|
|
1238
|
+
: T extends three_webgpu.Matrix4
|
|
1239
|
+
? 'mat4'
|
|
1240
|
+
: unknown
|
|
1165
1241
|
|
|
1166
1242
|
/**
|
|
1167
1243
|
* ShaderCallable - the return type of Fn()
|
|
@@ -1314,30 +1390,97 @@ declare global {
|
|
|
1314
1390
|
*/
|
|
1315
1391
|
type ThreeRenderPipeline = three_webgpu.RenderPipeline
|
|
1316
1392
|
|
|
1317
|
-
/**
|
|
1318
|
-
|
|
1393
|
+
/**
|
|
1394
|
+
* The pass `useRenderPipeline` creates for you: three's own `PassNode`, as returned by
|
|
1395
|
+
* `pass(scene, camera)` from `three/tsl`. Referenced from three so members like
|
|
1396
|
+
* `getTextureNode`, `setMRT` and `dispose` track the installed version.
|
|
1397
|
+
*/
|
|
1398
|
+
type ScenePassNode = three_webgpu.PassNode
|
|
1399
|
+
|
|
1400
|
+
/**
|
|
1401
|
+
* Pass record - stores TSL pass nodes for render pipeline.
|
|
1402
|
+
*
|
|
1403
|
+
* `scenePass` is the only key the library owns. It is optional here because this is also the
|
|
1404
|
+
* shape of `state.passes`, which is `{}` before the pipeline exists and again after `reset()`
|
|
1405
|
+
* or `clearPasses()`. Inside the callbacks it is always present; see
|
|
1406
|
+
* {@link RenderPipelineCallbackState}.
|
|
1407
|
+
*
|
|
1408
|
+
* Every other key is user-registered, via a callback's return value. Those are TSL nodes of
|
|
1409
|
+
* any kind, not only passes: texture reads of an MRT attachment, effect nodes, extra
|
|
1410
|
+
* `pass()` instances. `Node` is the common base, so that is the bound. Narrow at the call
|
|
1411
|
+
* site when you need a member, e.g. `passes.velocity as TextureNode`.
|
|
1412
|
+
*/
|
|
1413
|
+
interface PassRecord {
|
|
1414
|
+
scenePass?: ScenePassNode
|
|
1415
|
+
[key: string]: three_webgpu.Node
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
/**
|
|
1419
|
+
* State passed to pipeline callbacks after the active pipeline has been created.
|
|
1420
|
+
*
|
|
1421
|
+
* `passes.scenePass` is required here: the hook installs the default scene pass before either
|
|
1422
|
+
* callback runs, so callbacks can use it without a guard or a cast.
|
|
1423
|
+
*
|
|
1424
|
+
* `renderer` is narrowed to `WebGPURenderer` and `isLegacy` to `false`: the hook throws under
|
|
1425
|
+
* the legacy renderer before either callback can run, so a callback never sees WebGL.
|
|
1426
|
+
*/
|
|
1427
|
+
type RenderPipelineCallbackState = RootState & {
|
|
1428
|
+
renderPipeline: ThreeRenderPipeline
|
|
1429
|
+
passes: PassRecord & { scenePass: ScenePassNode }
|
|
1430
|
+
renderer: three_webgpu.WebGPURenderer
|
|
1431
|
+
isLegacy: false
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
/**
|
|
1435
|
+
* What a callback may return to register entries into `state.passes`.
|
|
1436
|
+
*
|
|
1437
|
+
* `scenePass` is reserved. The hook owns that entry and its lifecycle: it caches the pass it
|
|
1438
|
+
* created, and `rebuild()` / `reset()` dispose that cached pass. A callback overwriting the
|
|
1439
|
+
* store entry would leave the store pointing at a node the hook never disposes, and the hook
|
|
1440
|
+
* disposing a pass nothing references. So returning it is a type error.
|
|
1441
|
+
*/
|
|
1442
|
+
type RegisteredPasses = Record<string, three_webgpu.Node> & { scenePass?: never }
|
|
1319
1443
|
|
|
1320
1444
|
/** Setup callback - runs first to configure MRT, create additional passes */
|
|
1321
|
-
type RenderPipelineSetupCallback = (state:
|
|
1445
|
+
type RenderPipelineSetupCallback = (state: RenderPipelineCallbackState) => RegisteredPasses | void
|
|
1322
1446
|
|
|
1323
1447
|
/** Main callback - runs second to configure outputNode, create effect passes */
|
|
1324
|
-
type RenderPipelineMainCallback = (state:
|
|
1448
|
+
type RenderPipelineMainCallback = (state: RenderPipelineCallbackState) => RegisteredPasses | void
|
|
1325
1449
|
|
|
1326
|
-
/**
|
|
1327
|
-
interface
|
|
1450
|
+
/** The imperative half of useRenderPipeline's return value, present in every state */
|
|
1451
|
+
interface UseRenderPipelineActions {
|
|
1328
1452
|
/** Current passes from state */
|
|
1329
1453
|
passes: PassRecord
|
|
1330
|
-
/** RenderPipeline instance (null if not initialized) */
|
|
1331
|
-
renderPipeline: ThreeRenderPipeline | null
|
|
1332
1454
|
/** Clear all passes from state */
|
|
1333
1455
|
clearPasses: () => void
|
|
1334
1456
|
/** Reset RenderPipeline entirely (clears PP + passes) */
|
|
1335
1457
|
reset: () => void
|
|
1336
1458
|
/** Re-run setup/main callbacks with current closure values */
|
|
1337
1459
|
rebuild: () => void
|
|
1338
|
-
/** True when RenderPipeline is configured and ready */
|
|
1339
|
-
isReady: boolean
|
|
1340
1460
|
}
|
|
1461
|
+
|
|
1462
|
+
/**
|
|
1463
|
+
* Return type for useRenderPipeline hook, discriminated on `isReady`.
|
|
1464
|
+
*
|
|
1465
|
+
* `if (isReady)` narrows `renderPipeline` to non-null, which is what the docs already tell
|
|
1466
|
+
* callers to check. `passes.scenePass` deliberately stays optional in the ready branch:
|
|
1467
|
+
* `clearPasses()` empties the record while leaving the pipeline in place.
|
|
1468
|
+
*/
|
|
1469
|
+
type UseRenderPipelineReturn = UseRenderPipelineActions &
|
|
1470
|
+
(
|
|
1471
|
+
| {
|
|
1472
|
+
/** True when RenderPipeline is configured and ready */
|
|
1473
|
+
isReady: true
|
|
1474
|
+
/** RenderPipeline instance */
|
|
1475
|
+
renderPipeline: ThreeRenderPipeline
|
|
1476
|
+
}
|
|
1477
|
+
| {
|
|
1478
|
+
/** False until the pipeline has been created */
|
|
1479
|
+
isReady: false
|
|
1480
|
+
/** Not initialized yet, or torn down by reset() */
|
|
1481
|
+
renderPipeline: null
|
|
1482
|
+
}
|
|
1483
|
+
)
|
|
1341
1484
|
}
|
|
1342
1485
|
|
|
1343
1486
|
type MutableOrReadonlyParameters<T extends (...args: any) => any> = Parameters<T> | Readonly<Parameters<T>>
|
|
@@ -1868,50 +2011,6 @@ declare namespace useLoader {
|
|
|
1868
2011
|
var loader: typeof getLoader;
|
|
1869
2012
|
}
|
|
1870
2013
|
|
|
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
2014
|
declare const IsObject: (url: unknown) => url is Record<string, string>;
|
|
1916
2015
|
type TextureArray<T> = T extends string[] ? Texture$1[] : never;
|
|
1917
2016
|
type TextureRecord<T> = T extends Record<string, string> ? {
|
|
@@ -2097,11 +2196,6 @@ declare function useRenderTarget(width: number, height: number, options?: Render
|
|
|
2097
2196
|
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usestore
|
|
2098
2197
|
*/
|
|
2099
2198
|
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
2199
|
/**
|
|
2106
2200
|
* Exposes an object's {@link Instance}.
|
|
2107
2201
|
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle
|
|
@@ -2177,7 +2271,10 @@ declare function addTail(callback: GlobalRenderCallback): () => void;
|
|
|
2177
2271
|
* Invalidates the view, requesting a frame to be rendered.
|
|
2178
2272
|
* In demand mode, this triggers the scheduler to run frames.
|
|
2179
2273
|
*
|
|
2180
|
-
*
|
|
2274
|
+
* With a state argument, only that root's jobs run on the requested frames; other
|
|
2275
|
+
* roots on 'demand' stay idle. Without one, every registered root is invalidated.
|
|
2276
|
+
*
|
|
2277
|
+
* @param state - Optional root state; targets the invalidation at that root
|
|
2181
2278
|
* @param frames - Number of frames to request (default: 1)
|
|
2182
2279
|
* @param stackFrames - If false, sets pendingFrames to frames. If true, adds to existing pendingFrames (default: false)
|
|
2183
2280
|
*
|
|
@@ -2188,14 +2285,16 @@ declare function invalidate(state?: RootState, frames?: number, stackFrames?: bo
|
|
|
2188
2285
|
* Advances the frameloop and runs render effects.
|
|
2189
2286
|
* Useful for when manually rendering via `frameloop="never"`.
|
|
2190
2287
|
*
|
|
2288
|
+
* With a state argument, only that root is stepped. Without one, every
|
|
2289
|
+
* registered root is stepped for backwards compatibility.
|
|
2290
|
+
*
|
|
2191
2291
|
* @param timestamp - The timestamp to use for this frame
|
|
2192
2292
|
* @param runGlobalEffects - Ignored (kept for backwards compat, global effects always run)
|
|
2193
|
-
* @param state -
|
|
2194
|
-
* @param frame - Ignored (kept for backwards compat)
|
|
2293
|
+
* @param state - Optional root state; targets the manual step at that root
|
|
2195
2294
|
*
|
|
2196
2295
|
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
|
|
2197
2296
|
*/
|
|
2198
|
-
declare function advance(timestamp: number): void;
|
|
2297
|
+
declare function advance(timestamp: number, runGlobalEffects?: boolean, state?: RootState): void;
|
|
2199
2298
|
|
|
2200
2299
|
/* eslint-disable @definitelytyped/no-unnecessary-generics */
|
|
2201
2300
|
declare function ReactReconciler<
|
|
@@ -3879,25 +3978,13 @@ declare function useUniform<T extends UniformValue>(name: string): UniformNode<T
|
|
|
3879
3978
|
declare function useUniform<T extends UniformValue>(name: string, value: T): UniformNode<Widen<T>>;
|
|
3880
3979
|
|
|
3881
3980
|
/**
|
|
3882
|
-
* Minimal interface for TSL nodes.
|
|
3883
|
-
*
|
|
3884
|
-
*
|
|
3885
|
-
* extend Node with all required properties.
|
|
3981
|
+
* Minimal interface for TSL nodes. The definition lives with the store types as `NodeLike`, so
|
|
3982
|
+
* the shape creators may return and the shape `state.nodes` holds are the same type by
|
|
3983
|
+
* construction. See `NodeLike` for why this is structural rather than three's `Node`.
|
|
3886
3984
|
*/
|
|
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
|
-
}
|
|
3985
|
+
type TSLNodeLike = NodeLike;
|
|
3894
3986
|
/** TSL node type - alias for compatibility */
|
|
3895
3987
|
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
3988
|
/**
|
|
3902
3989
|
* Creator function that returns a record of nodes.
|
|
3903
3990
|
* Uses TSLNodeLike constraint to allow mixed node types
|
|
@@ -4086,6 +4173,10 @@ declare function createTextureOperations(set: StoreApi<RootState>['setState']):
|
|
|
4086
4173
|
* - Callbacks receive full RootState for flexibility
|
|
4087
4174
|
* - No auto-cleanup on unmount - use reset() for explicit cleanup
|
|
4088
4175
|
* - Scene/camera changes trigger scenePass recreation
|
|
4176
|
+
* - A replaced scenePass is disposed once the new graph is installed, so rebuild() does not
|
|
4177
|
+
* strand its render target (and MRT attachments) on the GPU
|
|
4178
|
+
* - Any run that changes the output node sets RenderPipeline.needsUpdate, so rebuild() actually
|
|
4179
|
+
* recompiles instead of silently keeping the first compiled graph
|
|
4089
4180
|
*
|
|
4090
4181
|
* @param mainCB - Main callback to configure outputNode and create effect passes
|
|
4091
4182
|
* @param setupCB - Optional setup callback to configure MRT on scenePass
|
|
@@ -4163,5 +4254,23 @@ interface WebGPURootState extends Omit<RootState, 'renderer' | 'gl' | 'internal'
|
|
|
4163
4254
|
internal: WebGPUInternalState
|
|
4164
4255
|
}
|
|
4165
4256
|
|
|
4257
|
+
/**
|
|
4258
|
+
* @fileoverview WebGPU entry point - WebGPU only, no legacy WebGL
|
|
4259
|
+
*
|
|
4260
|
+
* This entry point is for apps that want to use ONLY WebGPURenderer.
|
|
4261
|
+
* Includes WebGPU-specific hooks (useUniforms, useNodes, useTextures).
|
|
4262
|
+
* Auto-extends THREE with WebGPU node materials (MeshBasicNodeMaterial, etc.)
|
|
4263
|
+
*
|
|
4264
|
+
* Usage:
|
|
4265
|
+
* import { Canvas, useFrame, useUniforms } from '@react-three/fiber/webgpu'
|
|
4266
|
+
*/
|
|
4267
|
+
|
|
4268
|
+
/** `useThree` narrowed to WebGPU state — `state.renderer` is a `WebGPURenderer`. */
|
|
4269
|
+
type UseThreeWebGPU = <T = WebGPURootState>(selector?: (state: WebGPURootState) => T, equalityFn?: <U>(state: U, newState: U) => boolean) => T;
|
|
4270
|
+
/** `useFrame` narrowed to WebGPU state — the callback's `state.renderer` is a `WebGPURenderer`. */
|
|
4271
|
+
type UseFrameWebGPU = (callback?: FrameCallback$1<WebGPURootState>, priorityOrOptions?: number | UseFrameNextOptions) => FrameNextControls;
|
|
4272
|
+
declare const useThree: UseThreeWebGPU;
|
|
4273
|
+
declare const useFrame: UseFrameWebGPU;
|
|
4274
|
+
|
|
4166
4275
|
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,
|
|
4276
|
+
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 };
|