@react-three/fiber 10.0.0-canary.2b511a5 → 10.0.0-canary.aecbafb
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 +290 -73
- package/dist/index.d.cts +138 -21
- package/dist/index.d.mts +138 -21
- package/dist/index.d.ts +138 -21
- package/dist/index.mjs +290 -73
- package/dist/legacy.cjs +284 -73
- package/dist/legacy.d.cts +138 -21
- package/dist/legacy.d.mts +138 -21
- package/dist/legacy.d.ts +138 -21
- package/dist/legacy.mjs +284 -73
- package/dist/webgpu/index.cjs +665 -84
- package/dist/webgpu/index.d.cts +223 -34
- package/dist/webgpu/index.d.mts +223 -34
- package/dist/webgpu/index.d.ts +223 -34
- package/dist/webgpu/index.mjs +661 -84
- package/package.json +1 -1
package/dist/webgpu/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as three_webgpu from 'three/webgpu';
|
|
2
|
-
import { RenderTarget, WebGPURenderer,
|
|
2
|
+
import { 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
3
|
import { Inspector } from 'three/addons/inspector/Inspector.js';
|
|
4
4
|
import * as THREE$1 from 'three';
|
|
5
5
|
import { Color as Color$1, ColorRepresentation, Euler as Euler$1, Loader, RenderTargetOptions as RenderTargetOptions$1 } from 'three';
|
|
@@ -151,6 +151,8 @@ interface IntersectionEvent<TSourceEvent> extends Intersection {
|
|
|
151
151
|
unprojectedPoint: THREE$1.Vector3
|
|
152
152
|
/** Normalized event coordinates */
|
|
153
153
|
pointer: THREE$1.Vector2
|
|
154
|
+
/** pointerId of the original event for multiple pointer events */
|
|
155
|
+
pointerId: number
|
|
154
156
|
/** Delta between first click and this event */
|
|
155
157
|
delta: number
|
|
156
158
|
/** The ray that pierced it */
|
|
@@ -227,6 +229,18 @@ interface EventHandlers {
|
|
|
227
229
|
type FilterFunction = (items: THREE$1.Intersection[], state: RootState) => THREE$1.Intersection[]
|
|
228
230
|
type ComputeFunction = (event: DomEvent, root: RootState, previous?: RootState) => void
|
|
229
231
|
|
|
232
|
+
/** Configuration for XR pointer registration (controllers/hands) */
|
|
233
|
+
interface XRPointerConfig {
|
|
234
|
+
/** Ray origin (updated each frame by XR system) */
|
|
235
|
+
ray: THREE$1.Ray
|
|
236
|
+
/** Optional: custom compute function for this pointer */
|
|
237
|
+
compute?: (state: RootState) => void
|
|
238
|
+
/** Pointer type identifier */
|
|
239
|
+
type: 'controller' | 'hand' | 'gaze'
|
|
240
|
+
/** Which hand (for controller/hand types) */
|
|
241
|
+
handedness?: 'left' | 'right'
|
|
242
|
+
}
|
|
243
|
+
|
|
230
244
|
interface EventManager<TTarget> {
|
|
231
245
|
/** Determines if the event layer is active */
|
|
232
246
|
enabled: boolean
|
|
@@ -246,8 +260,21 @@ interface EventManager<TTarget> {
|
|
|
246
260
|
disconnect?: () => void
|
|
247
261
|
/** Triggers a onPointerMove with the last known event. This can be useful to enable raycasting without
|
|
248
262
|
* explicit user interaction, for instance when the camera moves a hoverable object underneath the cursor.
|
|
263
|
+
* @param pointerId - Optional pointer ID to update specific pointer only
|
|
249
264
|
*/
|
|
250
|
-
update?: () => void
|
|
265
|
+
update?: (pointerId?: number) => void
|
|
266
|
+
/** Defer pointer move raycasting to frame start (default: true) */
|
|
267
|
+
frameTimedRaycasts?: boolean
|
|
268
|
+
/** Always fire raycaster immediately on scroll events (default: true) */
|
|
269
|
+
alwaysFireOnScroll?: boolean
|
|
270
|
+
/** Automatically re-raycast every frame to detect hover changes from moving objects/camera (default: false) */
|
|
271
|
+
updateOnFrame?: boolean
|
|
272
|
+
/** Flush deferred pointer raycasts. Called by scheduler at frame start (input phase). */
|
|
273
|
+
flush?: () => void
|
|
274
|
+
/** Register an XR pointer (controller/hand). Returns assigned pointerId */
|
|
275
|
+
registerPointer?: (config: XRPointerConfig) => number
|
|
276
|
+
/** Unregister an XR pointer */
|
|
277
|
+
unregisterPointer?: (pointerId: number) => void
|
|
251
278
|
}
|
|
252
279
|
|
|
253
280
|
interface PointerCaptureTarget {
|
|
@@ -489,6 +516,68 @@ interface SchedulerApi {
|
|
|
489
516
|
subscribeJobState(id: string, listener: () => void): () => void
|
|
490
517
|
}
|
|
491
518
|
|
|
519
|
+
//* Buffer Types (useBuffers) ========================================
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* Buffer-like types for GPU compute and storage operations.
|
|
523
|
+
* Includes raw CPU arrays, Three.js buffer attributes, and TSL buffer nodes.
|
|
524
|
+
*
|
|
525
|
+
* @example
|
|
526
|
+
* ```tsx
|
|
527
|
+
* const { positions, velocities } = useBuffers(() => ({
|
|
528
|
+
* positions: instancedArray(count, 'vec3'), // StorageBufferNode
|
|
529
|
+
* velocities: new Float32Array(count * 3), // TypedArray
|
|
530
|
+
* }), 'particles')
|
|
531
|
+
* ```
|
|
532
|
+
*/
|
|
533
|
+
type BufferLike =
|
|
534
|
+
| Float32Array
|
|
535
|
+
| Uint32Array
|
|
536
|
+
| Int32Array
|
|
537
|
+
| Float64Array
|
|
538
|
+
| Uint8Array
|
|
539
|
+
| Int8Array
|
|
540
|
+
| Uint16Array
|
|
541
|
+
| Int16Array
|
|
542
|
+
| THREE$1.BufferAttribute // Base class for all buffer attributes
|
|
543
|
+
| Node // TSL buffer nodes (instancedArray, storage)
|
|
544
|
+
|
|
545
|
+
/** Flat record of buffer-like values (no nested scopes) */
|
|
546
|
+
type BufferRecord = Record<string, BufferLike>
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* Buffer store that can contain both root-level buffers and scoped buffer objects.
|
|
550
|
+
* Structure: { positions: Float32Array, particles: { vel: StorageBufferNode } }
|
|
551
|
+
*/
|
|
552
|
+
type BufferStore = Record<string, BufferLike | BufferRecord>
|
|
553
|
+
|
|
554
|
+
//* Storage Types (useGPUStorage) ========================================
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* GPU storage types for texture-based storage operations.
|
|
558
|
+
* Includes Three.js storage textures and TSL storage texture nodes.
|
|
559
|
+
*
|
|
560
|
+
* @example
|
|
561
|
+
* ```tsx
|
|
562
|
+
* const { heightMap } = useGPUStorage(() => ({
|
|
563
|
+
* heightMap: new StorageTexture(512, 512),
|
|
564
|
+
* }), 'terrain')
|
|
565
|
+
* ```
|
|
566
|
+
*/
|
|
567
|
+
type StorageLike =
|
|
568
|
+
| StorageTexture // GPU storage texture
|
|
569
|
+
| Data3DTexture // 3D texture (can be used as storage)
|
|
570
|
+
| Node // TSL storage texture nodes (storageTexture)
|
|
571
|
+
|
|
572
|
+
/** Flat record of storage-like values (no nested scopes) */
|
|
573
|
+
type StorageRecord = Record<string, StorageLike>
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* Storage store that can contain both root-level storage and scoped storage objects.
|
|
577
|
+
* Structure: { heightMap: StorageTexture, terrain: { normal: StorageTextureNode } }
|
|
578
|
+
*/
|
|
579
|
+
type StorageStore = Record<string, StorageLike | StorageRecord>
|
|
580
|
+
|
|
492
581
|
//* Renderer Types ========================================
|
|
493
582
|
|
|
494
583
|
/** Default renderer type - union of WebGL and WebGPU renderers */
|
|
@@ -502,6 +591,18 @@ type Subscription = {
|
|
|
502
591
|
store: RootStore
|
|
503
592
|
}
|
|
504
593
|
|
|
594
|
+
/** Per-pointer state for multi-touch and XR support */
|
|
595
|
+
type PointerState = {
|
|
596
|
+
/** Objects currently hovered by this pointer */
|
|
597
|
+
hovered: Map<string, ThreeEvent<DomEvent>>
|
|
598
|
+
/** Objects capturing this pointer */
|
|
599
|
+
captured: Map<THREE$1.Object3D, PointerCaptureTarget>
|
|
600
|
+
/** Initial click position [x, y] */
|
|
601
|
+
initialClick: [x: number, y: number]
|
|
602
|
+
/** Objects hit on initial click */
|
|
603
|
+
initialHits: THREE$1.Object3D[]
|
|
604
|
+
}
|
|
605
|
+
|
|
505
606
|
type Dpr = number | [min: number, max: number]
|
|
506
607
|
|
|
507
608
|
interface Size {
|
|
@@ -543,12 +644,21 @@ interface Performance {
|
|
|
543
644
|
|
|
544
645
|
interface InternalState {
|
|
545
646
|
interaction: THREE$1.Object3D[]
|
|
546
|
-
hovered: Map<string, ThreeEvent<DomEvent>>
|
|
547
647
|
subscribers: Subscription[]
|
|
648
|
+
/** Per-pointer state (hover, capture, click tracking) - replaces hovered, capturedMap, initialClick, initialHits */
|
|
649
|
+
pointerMap: Map<number, PointerState>
|
|
650
|
+
/** Pointers needing raycast this frame (used with frameTimedRaycasts) */
|
|
651
|
+
pointerDirty: Map<number, DomEvent>
|
|
652
|
+
/** Last event received (for events.update() compatibility) */
|
|
653
|
+
lastEvent: React$1.RefObject<DomEvent | null>
|
|
654
|
+
/** @deprecated Use pointerMap.get(pointerId).hovered instead */
|
|
655
|
+
hovered: Map<string, ThreeEvent<DomEvent>>
|
|
656
|
+
/** @deprecated Use pointerMap.get(pointerId).captured instead */
|
|
548
657
|
capturedMap: Map<number, Map<THREE$1.Object3D, PointerCaptureTarget>>
|
|
658
|
+
/** @deprecated Use pointerMap.get(pointerId).initialClick instead */
|
|
549
659
|
initialClick: [x: number, y: number]
|
|
660
|
+
/** @deprecated Use pointerMap.get(pointerId).initialHits instead */
|
|
550
661
|
initialHits: THREE$1.Object3D[]
|
|
551
|
-
lastEvent: React$1.RefObject<DomEvent | null>
|
|
552
662
|
/** Visibility event registry (onFramed, onOccluded, onVisible) */
|
|
553
663
|
visibilityRegistry: Map<string, VisibilityEntry>
|
|
554
664
|
/** Whether occlusion queries are enabled (WebGPU only) */
|
|
@@ -689,11 +799,15 @@ interface RootState {
|
|
|
689
799
|
uniforms: UniformStore
|
|
690
800
|
/** Global TSL nodes - root-level nodes + scoped sub-objects. Use useNodes() hook */
|
|
691
801
|
nodes: Record<string, any>
|
|
802
|
+
/** Global TSL buffer nodes - root-level buffers + scoped sub-objects. Use useBuffers() hook */
|
|
803
|
+
buffers: BufferStore
|
|
804
|
+
/** Global GPU storage (textures, etc.) - root-level storage + scoped sub-objects. Use useGPUStorage() hook */
|
|
805
|
+
gpuStorage: StorageStore
|
|
692
806
|
/** Global TSL texture nodes - use useTextures() hook for operations */
|
|
693
807
|
textures: Map<string, any>
|
|
694
|
-
/** WebGPU
|
|
695
|
-
|
|
696
|
-
/** Global TSL pass nodes for
|
|
808
|
+
/** WebGPU RenderPipeline instance - use useRenderPipeline() hook */
|
|
809
|
+
renderPipeline: any | null // THREE.PostProcessing (will be THREE.RenderPipeline in future Three.js release)
|
|
810
|
+
/** Global TSL pass nodes for render pipeline - use useRenderPipeline() hook */
|
|
697
811
|
passes: Record<string, any>
|
|
698
812
|
/** Internal version counter for HMR - incremented by rebuildNodes/rebuildUniforms to bust memoization */
|
|
699
813
|
_hmrVersion: number
|
|
@@ -1314,6 +1428,7 @@ declare global {
|
|
|
1314
1428
|
| three_webgpu.Euler
|
|
1315
1429
|
| three_webgpu.Quaternion
|
|
1316
1430
|
| { x: number; y?: number; z?: number; w?: number } // Plain objects converted to vectors
|
|
1431
|
+
| { r: number; g: number; b: number; a?: number } // Plain objects converted to Color
|
|
1317
1432
|
| Node // TSL nodes like color(), vec3(), float() for type casting
|
|
1318
1433
|
| UniformNode
|
|
1319
1434
|
|
|
@@ -1359,34 +1474,34 @@ declare module 'three/tsl' {
|
|
|
1359
1474
|
}
|
|
1360
1475
|
|
|
1361
1476
|
/**
|
|
1362
|
-
*
|
|
1477
|
+
* RenderPipeline Types for useRenderPipeline hook (WebGPU only)
|
|
1363
1478
|
*/
|
|
1364
1479
|
|
|
1365
1480
|
|
|
1366
1481
|
|
|
1367
1482
|
declare global {
|
|
1368
|
-
/** Pass record - stores TSL pass nodes for
|
|
1483
|
+
/** Pass record - stores TSL pass nodes for render pipeline */
|
|
1369
1484
|
type PassRecord = Record<string, any>
|
|
1370
1485
|
|
|
1371
1486
|
/** Setup callback - runs first to configure MRT, create additional passes */
|
|
1372
|
-
type
|
|
1487
|
+
type RenderPipelineSetupCallback = (state: RootState) => PassRecord | void
|
|
1373
1488
|
|
|
1374
1489
|
/** Main callback - runs second to configure outputNode, create effect passes */
|
|
1375
|
-
type
|
|
1490
|
+
type RenderPipelineMainCallback = (state: RootState) => PassRecord | void
|
|
1376
1491
|
|
|
1377
|
-
/** Return type for
|
|
1378
|
-
interface
|
|
1492
|
+
/** Return type for useRenderPipeline hook */
|
|
1493
|
+
interface UseRenderPipelineReturn {
|
|
1379
1494
|
/** Current passes from state */
|
|
1380
1495
|
passes: PassRecord
|
|
1381
|
-
/**
|
|
1382
|
-
|
|
1496
|
+
/** RenderPipeline instance (null if not initialized) */
|
|
1497
|
+
renderPipeline: any | null // THREE.PostProcessing (will be THREE.RenderPipeline in future Three.js release)
|
|
1383
1498
|
/** Clear all passes from state */
|
|
1384
1499
|
clearPasses: () => void
|
|
1385
|
-
/** Reset
|
|
1500
|
+
/** Reset RenderPipeline entirely (clears PP + passes) */
|
|
1386
1501
|
reset: () => void
|
|
1387
1502
|
/** Re-run setup/main callbacks with current closure values */
|
|
1388
1503
|
rebuild: () => void
|
|
1389
|
-
/** True when
|
|
1504
|
+
/** True when RenderPipeline is configured and ready */
|
|
1390
1505
|
isReady: boolean
|
|
1391
1506
|
}
|
|
1392
1507
|
}
|
|
@@ -2006,6 +2121,8 @@ declare function Environment(props: EnvironmentProps): react_jsx_runtime.JSX.Ele
|
|
|
2006
2121
|
declare function removeInteractivity(store: RootStore, object: Object3D): void;
|
|
2007
2122
|
declare function createEvents(store: RootStore): {
|
|
2008
2123
|
handlePointer: (name: string) => (event: DomEvent) => void;
|
|
2124
|
+
flushDeferredPointers: () => void;
|
|
2125
|
+
processDeferredPointer: (event: DomEvent, pointerId: number) => void;
|
|
2009
2126
|
};
|
|
2010
2127
|
/** Default R3F event manager for web */
|
|
2011
2128
|
declare function createPointerEvents(store: RootStore): EventManager<HTMLElement>;
|
|
@@ -2585,9 +2702,9 @@ declare function useTextures(): UseTexturesReturn;
|
|
|
2585
2702
|
* const fbo = useRenderTarget(512, 256, { samples: 4 })
|
|
2586
2703
|
* ```
|
|
2587
2704
|
*/
|
|
2588
|
-
declare function useRenderTarget(options?: RenderTargetOptions): RenderTarget
|
|
2589
|
-
declare function useRenderTarget(size: number, options?: RenderTargetOptions): RenderTarget
|
|
2590
|
-
declare function useRenderTarget(width: number, height: number, options?: RenderTargetOptions): RenderTarget
|
|
2705
|
+
declare function useRenderTarget(options?: RenderTargetOptions): RenderTarget;
|
|
2706
|
+
declare function useRenderTarget(size: number, options?: RenderTargetOptions): RenderTarget;
|
|
2707
|
+
declare function useRenderTarget(width: number, height: number, options?: RenderTargetOptions): RenderTarget;
|
|
2591
2708
|
|
|
2592
2709
|
/**
|
|
2593
2710
|
* Returns the R3F Canvas' Zustand store. Useful for [transient updates](https://github.com/pmndrs/zustand#transient-updates-for-often-occurring-state-changes).
|
|
@@ -4300,13 +4417,17 @@ type ScopedStoreType<T> = {
|
|
|
4300
4417
|
declare function createScopedStore<T>(data: Record<string, any>): ScopedStoreType<T>;
|
|
4301
4418
|
/**
|
|
4302
4419
|
* State type passed to creator functions with ScopedStore wrappers.
|
|
4303
|
-
* Provides type-safe access to uniforms and
|
|
4420
|
+
* Provides type-safe access to uniforms, nodes, buffers, and gpuStorage without manual casting.
|
|
4304
4421
|
*/
|
|
4305
|
-
type CreatorState = Omit<RootState, 'uniforms' | 'nodes'> & {
|
|
4422
|
+
type CreatorState = Omit<RootState, 'uniforms' | 'nodes' | 'buffers' | 'gpuStorage'> & {
|
|
4306
4423
|
/** Type-safe uniform access - property access returns UniformNode */
|
|
4307
4424
|
uniforms: ScopedStoreType<UniformNode>;
|
|
4308
4425
|
/** Type-safe node access - property access returns TSLNodeType (Node | ShaderCallable | ShaderNodeObject) */
|
|
4309
4426
|
nodes: ScopedStoreType<TSLNodeType>;
|
|
4427
|
+
/** Type-safe buffer access - property access returns BufferLike (TypedArrays, BufferAttributes, TSL nodes) */
|
|
4428
|
+
buffers: ScopedStoreType<BufferLike>;
|
|
4429
|
+
/** Type-safe GPU storage access - property access returns StorageLike (StorageTexture, TSL nodes) */
|
|
4430
|
+
gpuStorage: ScopedStoreType<StorageLike>;
|
|
4310
4431
|
};
|
|
4311
4432
|
|
|
4312
4433
|
/** Creator function that returns uniform inputs (can be raw values or UniformNodes) */
|
|
@@ -4470,6 +4591,74 @@ type LocalNodeCreator<T extends Record<string, unknown>> = (state: CreatorState)
|
|
|
4470
4591
|
*/
|
|
4471
4592
|
declare function useLocalNodes<T extends Record<string, unknown>>(creator: LocalNodeCreator<T>): T;
|
|
4472
4593
|
|
|
4594
|
+
/**
|
|
4595
|
+
* Creator function that returns a record of buffers.
|
|
4596
|
+
* Receives CreatorState with access to existing buffers, gpuStorage, uniforms, nodes, etc.
|
|
4597
|
+
*/
|
|
4598
|
+
type BufferCreator<T extends Record<string, BufferLike>> = (state: CreatorState) => T;
|
|
4599
|
+
/** Function signature for removeBuffers util */
|
|
4600
|
+
type RemoveBuffersFn = (names: string | string[], scope?: string) => void;
|
|
4601
|
+
/** Function signature for clearBuffers util */
|
|
4602
|
+
type ClearBuffersFn = (scope?: string) => void;
|
|
4603
|
+
/** Function signature for rebuildBuffers util */
|
|
4604
|
+
type RebuildBuffersFn = (scope?: string) => void;
|
|
4605
|
+
/** Function signature for disposeBuffers util - releases GPU resources */
|
|
4606
|
+
type DisposeBuffersFn = (names: string | string[], scope?: string) => void;
|
|
4607
|
+
/** Return type with utils included */
|
|
4608
|
+
type BuffersWithUtils<T extends Record<string, BufferLike> = Record<string, BufferLike>> = T & {
|
|
4609
|
+
removeBuffers: RemoveBuffersFn;
|
|
4610
|
+
clearBuffers: ClearBuffersFn;
|
|
4611
|
+
rebuildBuffers: RebuildBuffersFn;
|
|
4612
|
+
disposeBuffers: DisposeBuffersFn;
|
|
4613
|
+
};
|
|
4614
|
+
declare function useBuffers(): BuffersWithUtils<Record<string, BufferLike> & Record<string, Record<string, BufferLike>>>;
|
|
4615
|
+
declare function useBuffers(scope: string): BuffersWithUtils<Record<string, BufferLike>>;
|
|
4616
|
+
declare function useBuffers<T extends Record<string, BufferLike>>(creator: BufferCreator<T>): BuffersWithUtils<T>;
|
|
4617
|
+
declare function useBuffers<T extends Record<string, BufferLike>>(creator: BufferCreator<T>, scope: string): BuffersWithUtils<T>;
|
|
4618
|
+
/**
|
|
4619
|
+
* Global rebuildBuffers function for HMR integration.
|
|
4620
|
+
* Clears cached buffers and increments _hmrVersion to trigger re-creation.
|
|
4621
|
+
* Call this when HMR is detected to refresh all buffer creators.
|
|
4622
|
+
*
|
|
4623
|
+
* @param store - The R3F store (from useStore or context)
|
|
4624
|
+
* @param scope - Optional scope to rebuild ('root' for root only, string for specific scope, undefined for all)
|
|
4625
|
+
*/
|
|
4626
|
+
declare function rebuildAllBuffers(store: ReturnType<typeof useStore>, scope?: string): void;
|
|
4627
|
+
|
|
4628
|
+
/**
|
|
4629
|
+
* Creator function that returns a record of GPU storage objects.
|
|
4630
|
+
* Receives CreatorState with access to existing buffers, gpuStorage, uniforms, nodes, etc.
|
|
4631
|
+
*/
|
|
4632
|
+
type StorageCreator<T extends Record<string, StorageLike>> = (state: CreatorState) => T;
|
|
4633
|
+
/** Function signature for removeStorage util */
|
|
4634
|
+
type RemoveStorageFn = (names: string | string[], scope?: string) => void;
|
|
4635
|
+
/** Function signature for clearStorage util */
|
|
4636
|
+
type ClearStorageFn = (scope?: string) => void;
|
|
4637
|
+
/** Function signature for rebuildStorage util */
|
|
4638
|
+
type RebuildStorageFn = (scope?: string) => void;
|
|
4639
|
+
/** Function signature for disposeStorage util - releases GPU resources */
|
|
4640
|
+
type DisposeStorageFn = (names: string | string[], scope?: string) => void;
|
|
4641
|
+
/** Return type with utils included */
|
|
4642
|
+
type StorageWithUtils<T extends Record<string, StorageLike> = Record<string, StorageLike>> = T & {
|
|
4643
|
+
removeStorage: RemoveStorageFn;
|
|
4644
|
+
clearStorage: ClearStorageFn;
|
|
4645
|
+
rebuildStorage: RebuildStorageFn;
|
|
4646
|
+
disposeStorage: DisposeStorageFn;
|
|
4647
|
+
};
|
|
4648
|
+
declare function useGPUStorage(): StorageWithUtils<Record<string, StorageLike> & Record<string, Record<string, StorageLike>>>;
|
|
4649
|
+
declare function useGPUStorage(scope: string): StorageWithUtils<Record<string, StorageLike>>;
|
|
4650
|
+
declare function useGPUStorage<T extends Record<string, StorageLike>>(creator: StorageCreator<T>): StorageWithUtils<T>;
|
|
4651
|
+
declare function useGPUStorage<T extends Record<string, StorageLike>>(creator: StorageCreator<T>, scope: string): StorageWithUtils<T>;
|
|
4652
|
+
/**
|
|
4653
|
+
* Global rebuildStorage function for HMR integration.
|
|
4654
|
+
* Clears cached storage and increments _hmrVersion to trigger re-creation.
|
|
4655
|
+
* Call this when HMR is detected to refresh all storage creators.
|
|
4656
|
+
*
|
|
4657
|
+
* @param store - The R3F store (from useStore or context)
|
|
4658
|
+
* @param scope - Optional scope to rebuild ('root' for root only, string for specific scope, undefined for all)
|
|
4659
|
+
*/
|
|
4660
|
+
declare function rebuildAllStorage(store: ReturnType<typeof useStore>, scope?: string): void;
|
|
4661
|
+
|
|
4473
4662
|
interface TextureOperations {
|
|
4474
4663
|
add: (key: string, value: any) => void;
|
|
4475
4664
|
addMultiple: (items: Map<string, any> | Record<string, any>) => void;
|
|
@@ -4479,10 +4668,10 @@ interface TextureOperations {
|
|
|
4479
4668
|
declare function createTextureOperations(set: StoreApi<RootState>['setState']): TextureOperations;
|
|
4480
4669
|
|
|
4481
4670
|
/**
|
|
4482
|
-
* Hook for managing WebGPU
|
|
4671
|
+
* Hook for managing WebGPU RenderPipeline with automatic scenePass setup.
|
|
4483
4672
|
*
|
|
4484
4673
|
* Features:
|
|
4485
|
-
* - Creates
|
|
4674
|
+
* - Creates RenderPipeline instance if not exists
|
|
4486
4675
|
* - Creates default scenePass (no MRT) automatically
|
|
4487
4676
|
* - Callbacks receive full RootState for flexibility
|
|
4488
4677
|
* - No auto-cleanup on unmount - use reset() for explicit cleanup
|
|
@@ -4490,21 +4679,21 @@ declare function createTextureOperations(set: StoreApi<RootState>['setState']):
|
|
|
4490
4679
|
*
|
|
4491
4680
|
* @param mainCB - Main callback to configure outputNode and create effect passes
|
|
4492
4681
|
* @param setupCB - Optional setup callback to configure MRT on scenePass
|
|
4493
|
-
* @returns { passes,
|
|
4682
|
+
* @returns { passes, renderPipeline, clearPasses, reset, rebuild }
|
|
4494
4683
|
*
|
|
4495
4684
|
* @example
|
|
4496
4685
|
* ```tsx
|
|
4497
4686
|
* // Simple effect
|
|
4498
|
-
*
|
|
4499
|
-
*
|
|
4687
|
+
* useRenderPipeline(({ renderPipeline, passes }) => {
|
|
4688
|
+
* renderPipeline.outputNode = bloom(passes.scenePass.getTextureNode())
|
|
4500
4689
|
* })
|
|
4501
4690
|
*
|
|
4502
4691
|
* // With MRT setup
|
|
4503
|
-
*
|
|
4504
|
-
* ({
|
|
4692
|
+
* useRenderPipeline(
|
|
4693
|
+
* ({ renderPipeline, passes }) => {
|
|
4505
4694
|
* const beauty = passes.scenePass.getTextureNode().toInspector('Color')
|
|
4506
4695
|
* const vel = passes.scenePass.getTextureNode('velocity')
|
|
4507
|
-
*
|
|
4696
|
+
* renderPipeline.outputNode = motionBlur(beauty, vel)
|
|
4508
4697
|
* },
|
|
4509
4698
|
* ({ passes }) => {
|
|
4510
4699
|
* passes.scenePass.setMRT(mrt({ output, velocity }))
|
|
@@ -4512,10 +4701,10 @@ declare function createTextureOperations(set: StoreApi<RootState>['setState']):
|
|
|
4512
4701
|
* )
|
|
4513
4702
|
*
|
|
4514
4703
|
* // Read-only access
|
|
4515
|
-
* const {
|
|
4704
|
+
* const { renderPipeline, passes } = useRenderPipeline()
|
|
4516
4705
|
* ```
|
|
4517
4706
|
*/
|
|
4518
|
-
declare function
|
|
4707
|
+
declare function useRenderPipeline(mainCB?: RenderPipelineMainCallback, setupCB?: RenderPipelineSetupCallback): UseRenderPipelineReturn;
|
|
4519
4708
|
|
|
4520
4709
|
//* Renderer Props ========================================
|
|
4521
4710
|
|
|
@@ -4564,5 +4753,5 @@ interface WebGPURootState extends Omit<RootState, 'renderer' | 'gl' | 'internal'
|
|
|
4564
4753
|
internal: WebGPUInternalState
|
|
4565
4754
|
}
|
|
4566
4755
|
|
|
4567
|
-
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, Scheduler, Texture, _roots, act, 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, getScheduler, getUuidPrefix, hasConstructor, hasPrimary, invalidate, invalidateInstance, is, isColorRepresentation, isCopyable, isFromRef, isObject3D, isOnce, isOrthographicCamera, isRef, isRenderer, isTexture, isVectorLike, once, prepare, presetsObj, rebuildAllNodes, rebuildAllUniforms, reconciler, registerPrimary, removeInteractivity, removeNodes, removeUniforms, resolve, unmountComponentAtNode, unregisterPrimary, updateCamera, updateFrustum, useBridge, useEnvironment, useFrame, useGraph, useInstanceHandle, useIsomorphicLayoutEffect, useLoader, useLocalNodes, useMutableCallback, useNodes,
|
|
4568
|
-
export type { Act, AddPhaseOptions, Args, ArgsProp, AttachFnType, AttachType, BackgroundConfig, BackgroundProp, BaseRendererProps, Bridge, Camera, CameraProps, CanvasProps, CanvasSchedulerConfig, Catalogue, ClearNodesFn, ClearUniformsFn, Color, ComputeFunction, ConstructorRepresentation, CreatorState, DefaultGLProps, DefaultRendererProps, Disposable, DomEvent, Dpr, ElementProps, EnvironmentLoaderProps, EnvironmentProps, EquConfig, Euler, EventHandlers, EventManager, EventProps, Events, Extensions, FiberRoot, FilterFunction, FrameCallback, FrameControls, FrameNextCallback, FrameNextControls, FrameNextState, FrameState, FrameTimingState, Frameloop, GLProps, GLTFLike, GeometryProps, GeometryTransformProps, GlobalEffectType, GlobalRenderCallback, HostConfig, InferLoadResult, InjectState, InputLike, Instance, InstanceProps, WebGPUInternalState as InternalState, Intersection, IntersectionEvent, IsAllOptional, IsOptional, Layers, LegacyInternalState, LegacyRenderer, LegacyRootState, LoaderInstance, LoaderLike, LoaderResult, LocalNodeCreator, MappedTextureType, MathProps, MathRepresentation, MathType, MathTypes, Matrix3, Matrix4, Mutable, MutableOrReadonlyParameters, NodeCreator, NodeProps, NodeRecord, NodesWithUtils, NonFunctionKeys, ObjectMap, OffscreenCanvas$1 as OffscreenCanvas, Overwrite, Performance, PointerCaptureTarget, PresetsType, PrimaryCanvasEntry, Properties, Quaternion, WebGPUR3FRenderer as R3FRenderer, RaycastableRepresentation, ReactProps, RebuildNodesFn, RebuildUniformsFn, ReconcilerRoot, RemoveNodesFn, RemoveUniformsFn, RenderCallback, RenderProps, RenderTargetOptions, Renderer, RendererConfigExtended, RendererFactory, RendererProps, Root, RootOptions, WebGPURootState as RootState, RootStore, SchedulerApi, ScopedStoreType, SetBlock, Size, Subscription, TSLNode, TSLNodeInput, TextureEntry, TextureOperations, ThreeCamera, ThreeElement, ThreeElements, ThreeElementsImpl, ThreeEvent, ThreeExports, ThreeToJSXElements, UnblockProps, UniformCreator, UniformValue, UniformsWithUtils, UseFrameNextOptions, UseFrameOptions, UseTextureOptions, UseTexturesReturn, Vector2, Vector3, Vector4, VectorRepresentation, Viewport, VisibilityEntry, WebGLDefaultProps, WebGLProps, WebGLShadowConfig, WebGPUDefaultProps, WebGPUProps, WebGPUShadowConfig, XRManager };
|
|
4756
|
+
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, Scheduler, Texture, _roots, act, 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, getScheduler, 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, 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 };
|
|
4757
|
+
export type { Act, AddPhaseOptions, Args, ArgsProp, AttachFnType, AttachType, BackgroundConfig, BackgroundProp, BaseRendererProps, Bridge, BufferCreator, BufferLike, BufferRecord, BufferStore, BuffersWithUtils, Camera, CameraProps, CanvasProps, CanvasSchedulerConfig, Catalogue, ClearBuffersFn, ClearNodesFn, ClearStorageFn, ClearUniformsFn, Color, ComputeFunction, ConstructorRepresentation, CreatorState, DefaultGLProps, DefaultRendererProps, Disposable, DisposeBuffersFn, DisposeStorageFn, DomEvent, Dpr, ElementProps, EnvironmentLoaderProps, EnvironmentProps, EquConfig, Euler, EventHandlers, EventManager, EventProps, Events, Extensions, FiberRoot, FilterFunction, FrameCallback, FrameControls, FrameNextCallback, FrameNextControls, FrameNextState, FrameState, FrameTimingState, Frameloop, GLProps, GLTFLike, GeometryProps, GeometryTransformProps, GlobalEffectType, GlobalRenderCallback, HostConfig, InferLoadResult, InjectState, InputLike, Instance, InstanceProps, WebGPUInternalState as InternalState, Intersection, IntersectionEvent, IsAllOptional, IsOptional, Layers, LegacyInternalState, LegacyRenderer, LegacyRootState, LoaderInstance, LoaderLike, LoaderResult, LocalNodeCreator, MappedTextureType, MathProps, MathRepresentation, MathType, MathTypes, Matrix3, Matrix4, Mutable, MutableOrReadonlyParameters, NodeCreator, NodeProps, NodeRecord, NodesWithUtils, NonFunctionKeys, ObjectMap, OffscreenCanvas$1 as OffscreenCanvas, Overwrite, Performance, PointerCaptureTarget, PointerState, PresetsType, PrimaryCanvasEntry, Properties, Quaternion, WebGPUR3FRenderer as R3FRenderer, RaycastableRepresentation, ReactProps, RebuildBuffersFn, RebuildNodesFn, RebuildStorageFn, RebuildUniformsFn, ReconcilerRoot, RemoveBuffersFn, RemoveNodesFn, RemoveStorageFn, RemoveUniformsFn, RenderCallback, RenderProps, RenderTargetOptions, Renderer, RendererConfigExtended, RendererFactory, RendererProps, Root, RootOptions, WebGPURootState as RootState, RootStore, SchedulerApi, ScopedStoreType, SetBlock, Size, StorageCreator, StorageLike, StorageRecord, StorageStore, StorageWithUtils, Subscription, TSLNode, TSLNodeInput, TextureEntry, TextureOperations, ThreeCamera, ThreeElement, ThreeElements, ThreeElementsImpl, ThreeEvent, ThreeExports, ThreeToJSXElements, UnblockProps, UniformCreator, UniformValue, UniformsWithUtils, UseFrameNextOptions, UseFrameOptions, UseTextureOptions, UseTexturesReturn, Vector2, Vector3, Vector4, VectorRepresentation, Viewport, VisibilityEntry, WebGLDefaultProps, WebGLProps, WebGLShadowConfig, WebGPUDefaultProps, WebGPUProps, WebGPUShadowConfig, XRManager, XRPointerConfig };
|