@react-three/fiber 10.0.0-canary.c3fa45d → 10.0.0-canary.c4ecb6a
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 +2207 -2954
- package/dist/index.d.cts +435 -924
- package/dist/index.d.mts +435 -924
- package/dist/index.d.ts +430 -947
- package/dist/index.mjs +2808 -3554
- package/dist/legacy.cjs +2609 -3357
- package/dist/legacy.d.cts +452 -972
- package/dist/legacy.d.mts +452 -972
- package/dist/legacy.d.ts +448 -994
- package/dist/legacy.mjs +3127 -3874
- package/dist/webgpu/index.cjs +2765 -3709
- package/dist/webgpu/index.d.cts +539 -1029
- package/dist/webgpu/index.d.mts +539 -1029
- package/dist/webgpu/index.d.ts +535 -1053
- package/dist/webgpu/index.mjs +4110 -5053
- package/package.json +6 -5
- package/readme.md +3 -4
- 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,5 +1,6 @@
|
|
|
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
|
-
import { RenderTarget, WebGPURenderer, Node, StorageTexture, Data3DTexture, CanvasTarget,
|
|
3
|
+
import { CubeRenderTarget, RenderTarget, WebGPURenderer, Node, StorageTexture, Storage3DTexture, StorageArrayTexture, Data3DTexture, CanvasTarget, 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, Object3D, 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, Frustum, OrthographicCamera, Matrix2, WebGPURendererParameters } from 'three/webgpu';
|
|
3
4
|
import { Inspector } from 'three/addons/inspector/Inspector.js';
|
|
4
5
|
import * as THREE$1 from 'three';
|
|
5
6
|
import { Color as Color$1, ColorRepresentation, Euler as Euler$1, Loader, RenderTargetOptions as RenderTargetOptions$1 } from 'three';
|
|
@@ -7,9 +8,10 @@ import * as React$1 from 'react';
|
|
|
7
8
|
import { ReactNode, Component, RefObject, JSX } from 'react';
|
|
8
9
|
import { StoreApi } from 'zustand';
|
|
9
10
|
import { UseBoundStoreWithEqualityFn } from 'zustand/traditional';
|
|
11
|
+
import { FrameTimingState, FrameCallback as FrameCallback$1, SchedulerApi, UseFrameNextOptions, FrameNextControls } from '@pmndrs/scheduler';
|
|
12
|
+
export { AddPhaseOptions, FrameControls, FrameNextControls, FrameTimingState, RootOptions, Scheduler, SchedulerApi, UseFrameNextOptions, UseFrameOptions, getScheduler } from '@pmndrs/scheduler';
|
|
10
13
|
import { Options } from 'react-use-measure';
|
|
11
14
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
12
|
-
import { ThreeElement as ThreeElement$1, Euler as Euler$3 } from '@react-three/fiber';
|
|
13
15
|
import { GroundedSkybox } from 'three/examples/jsm/objects/GroundedSkybox.js';
|
|
14
16
|
|
|
15
17
|
function _mergeNamespaces(n, m) {
|
|
@@ -39,6 +41,8 @@ function _mergeNamespaces(n, m) {
|
|
|
39
41
|
declare const R3F_BUILD_LEGACY = false;
|
|
40
42
|
declare const R3F_BUILD_WEBGPU = true;
|
|
41
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>;
|
|
42
46
|
declare const WebGLRenderer: {
|
|
43
47
|
new (): {};
|
|
44
48
|
};
|
|
@@ -47,16 +51,21 @@ type WebGLShadowMap = never;
|
|
|
47
51
|
|
|
48
52
|
declare const WebGLRenderTarget: any;
|
|
49
53
|
|
|
54
|
+
declare const WebGLCubeRenderTarget: any;
|
|
55
|
+
|
|
50
56
|
var THREE = /*#__PURE__*/_mergeNamespaces({
|
|
51
57
|
__proto__: null,
|
|
58
|
+
CubeRenderTargetCompat: CubeRenderTarget,
|
|
52
59
|
Inspector: Inspector,
|
|
53
60
|
R3F_BUILD_LEGACY: R3F_BUILD_LEGACY,
|
|
54
61
|
R3F_BUILD_WEBGPU: R3F_BUILD_WEBGPU,
|
|
55
62
|
RenderTargetCompat: RenderTarget,
|
|
63
|
+
WebGLCubeRenderTarget: WebGLCubeRenderTarget,
|
|
56
64
|
WebGLRenderTarget: WebGLRenderTarget,
|
|
57
65
|
WebGLRenderer: WebGLRenderer,
|
|
58
66
|
WebGLRendererParameters: WebGLRendererParameters,
|
|
59
|
-
WebGLShadowMap: WebGLShadowMap
|
|
67
|
+
WebGLShadowMap: WebGLShadowMap,
|
|
68
|
+
loadInspector: loadInspector
|
|
60
69
|
}, [three_webgpu]);
|
|
61
70
|
|
|
62
71
|
//* Utility Types ==============================
|
|
@@ -294,228 +303,33 @@ interface VisibilityEntry {
|
|
|
294
303
|
}
|
|
295
304
|
|
|
296
305
|
//* Scheduler Types (useFrame) ==============================
|
|
306
|
+
//
|
|
307
|
+
// The generic, framework-agnostic scheduler types now live in @pmndrs/scheduler.
|
|
308
|
+
// This file re-exports them and layers r3f's RootState-aware frame state on top,
|
|
309
|
+
// so existing `#types` imports across the codebase keep resolving unchanged.
|
|
297
310
|
|
|
298
311
|
|
|
299
312
|
|
|
300
|
-
//
|
|
313
|
+
// Frame State (r3f-specific) --------------------------------
|
|
301
314
|
|
|
302
315
|
/**
|
|
303
|
-
*
|
|
304
|
-
*/
|
|
305
|
-
interface UseFrameNextOptions {
|
|
306
|
-
/** Optional stable id for the job. Auto-generated if not provided */
|
|
307
|
-
id?: string
|
|
308
|
-
/** Named phase to run in. Default: 'update' */
|
|
309
|
-
phase?: string
|
|
310
|
-
/** Run before this phase or job id */
|
|
311
|
-
before?: string | string[]
|
|
312
|
-
/** Run after this phase or job id */
|
|
313
|
-
after?: string | string[]
|
|
314
|
-
/** Priority within phase. Higher runs first. Default: 0 */
|
|
315
|
-
priority?: number
|
|
316
|
-
/** Max frames per second for this job */
|
|
317
|
-
fps?: number
|
|
318
|
-
/** If true, skip frames when behind. If false, try to catch up. Default: true */
|
|
319
|
-
drop?: boolean
|
|
320
|
-
/** Enable/disable without unregistering. Default: true */
|
|
321
|
-
enabled?: boolean
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
/** Alias for UseFrameNextOptions */
|
|
325
|
-
type UseFrameOptions = UseFrameNextOptions
|
|
326
|
-
|
|
327
|
-
/**
|
|
328
|
-
* Options for addPhase
|
|
329
|
-
*/
|
|
330
|
-
interface AddPhaseOptions {
|
|
331
|
-
/** Insert this phase before the specified phase */
|
|
332
|
-
before?: string
|
|
333
|
-
/** Insert this phase after the specified phase */
|
|
334
|
-
after?: string
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
// Frame State --------------------------------
|
|
338
|
-
|
|
339
|
-
/**
|
|
340
|
-
* Timing-only state for independent/outside mode (no RootState)
|
|
341
|
-
*/
|
|
342
|
-
interface FrameTimingState {
|
|
343
|
-
/** High-resolution timestamp from RAF (ms) */
|
|
344
|
-
time: number
|
|
345
|
-
/** Time since last frame in seconds (for legacy compatibility with THREE.Clock) */
|
|
346
|
-
delta: number
|
|
347
|
-
/** Elapsed time since first frame in seconds (for legacy compatibility with THREE.Clock) */
|
|
348
|
-
elapsed: number
|
|
349
|
-
/** Incrementing frame counter */
|
|
350
|
-
frame: number
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* State passed to useFrame callbacks (extends RootState with timing)
|
|
316
|
+
* State passed to useFrame callbacks (extends RootState with timing).
|
|
355
317
|
*/
|
|
356
318
|
interface FrameNextState extends RootState, FrameTimingState {}
|
|
357
319
|
|
|
358
320
|
/** Alias for FrameNextState */
|
|
359
321
|
type FrameState = FrameNextState
|
|
360
322
|
|
|
361
|
-
//
|
|
323
|
+
// Callback Types (r3f-specific) --------------------------------
|
|
362
324
|
|
|
363
325
|
/**
|
|
364
|
-
*
|
|
326
|
+
* Callback function for useFrame. Receives the full r3f RootState plus timing.
|
|
365
327
|
*/
|
|
366
|
-
|
|
367
|
-
/** State provider for callbacks. Optional in independent mode. */
|
|
368
|
-
getState?: () => any
|
|
369
|
-
/** Error handler for job errors. Falls back to console.error if not provided. */
|
|
370
|
-
onError?: (error: Error) => void
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
// Callback Types --------------------------------
|
|
374
|
-
|
|
375
|
-
/**
|
|
376
|
-
* Callback function for useFrame
|
|
377
|
-
*/
|
|
378
|
-
type FrameNextCallback = (state: FrameNextState, delta: number) => void
|
|
328
|
+
type FrameNextCallback = FrameCallback$1<RootState>
|
|
379
329
|
|
|
380
330
|
/** Alias for FrameNextCallback */
|
|
381
331
|
type FrameCallback = FrameNextCallback
|
|
382
332
|
|
|
383
|
-
// Controls returned from useFrame --------------------------------
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* Controls object returned from useFrame hook
|
|
387
|
-
*/
|
|
388
|
-
interface FrameNextControls {
|
|
389
|
-
/** The job's unique ID */
|
|
390
|
-
id: string
|
|
391
|
-
/** Access to the global scheduler for frame loop control */
|
|
392
|
-
scheduler: SchedulerApi
|
|
393
|
-
/** Manually step this job only (bypasses FPS limiting) */
|
|
394
|
-
step(timestamp?: number): void
|
|
395
|
-
/** Manually step ALL jobs in the scheduler */
|
|
396
|
-
stepAll(timestamp?: number): void
|
|
397
|
-
/** Pause this job (set enabled=false) */
|
|
398
|
-
pause(): void
|
|
399
|
-
/** Resume this job (set enabled=true) */
|
|
400
|
-
resume(): void
|
|
401
|
-
/** Reactive paused state - automatically triggers re-render when changed */
|
|
402
|
-
isPaused: boolean
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
/** Alias for FrameNextControls */
|
|
406
|
-
type FrameControls = FrameNextControls
|
|
407
|
-
|
|
408
|
-
// Scheduler Interface --------------------------------
|
|
409
|
-
|
|
410
|
-
/**
|
|
411
|
-
* Public interface for the global Scheduler
|
|
412
|
-
*/
|
|
413
|
-
interface SchedulerApi {
|
|
414
|
-
//* Phase Management --------------------------------
|
|
415
|
-
|
|
416
|
-
/** Add a named phase to the scheduler */
|
|
417
|
-
addPhase(name: string, options?: AddPhaseOptions): void
|
|
418
|
-
/** Get the ordered list of phase names */
|
|
419
|
-
readonly phases: string[]
|
|
420
|
-
/** Check if a phase exists */
|
|
421
|
-
hasPhase(name: string): boolean
|
|
422
|
-
|
|
423
|
-
//* Root Management --------------------------------
|
|
424
|
-
|
|
425
|
-
/** Register a root (Canvas) with the scheduler. Returns unsubscribe function. */
|
|
426
|
-
registerRoot(id: string, options?: RootOptions): () => void
|
|
427
|
-
/** Unregister a root */
|
|
428
|
-
unregisterRoot(id: string): void
|
|
429
|
-
/** Generate a unique root ID */
|
|
430
|
-
generateRootId(): string
|
|
431
|
-
/** Get the number of registered roots */
|
|
432
|
-
getRootCount(): number
|
|
433
|
-
/** Check if any root is registered and ready */
|
|
434
|
-
readonly isReady: boolean
|
|
435
|
-
/** Subscribe to root-ready event. Fires immediately if already ready. Returns unsubscribe. */
|
|
436
|
-
onRootReady(callback: () => void): () => void
|
|
437
|
-
|
|
438
|
-
//* Job Registration --------------------------------
|
|
439
|
-
|
|
440
|
-
/** Register a job with the scheduler (returns unsubscribe function) */
|
|
441
|
-
register(
|
|
442
|
-
callback: FrameNextCallback,
|
|
443
|
-
options?: {
|
|
444
|
-
id?: string
|
|
445
|
-
rootId?: string
|
|
446
|
-
phase?: string
|
|
447
|
-
before?: string | string[]
|
|
448
|
-
after?: string | string[]
|
|
449
|
-
priority?: number
|
|
450
|
-
fps?: number
|
|
451
|
-
drop?: boolean
|
|
452
|
-
enabled?: boolean
|
|
453
|
-
},
|
|
454
|
-
): () => void
|
|
455
|
-
/** Update a job's options */
|
|
456
|
-
updateJob(
|
|
457
|
-
id: string,
|
|
458
|
-
options: {
|
|
459
|
-
priority?: number
|
|
460
|
-
fps?: number
|
|
461
|
-
drop?: boolean
|
|
462
|
-
enabled?: boolean
|
|
463
|
-
phase?: string
|
|
464
|
-
before?: string | string[]
|
|
465
|
-
after?: string | string[]
|
|
466
|
-
},
|
|
467
|
-
): void
|
|
468
|
-
/** Unregister a job by ID */
|
|
469
|
-
unregister(id: string, rootId?: string): void
|
|
470
|
-
/** Get the number of registered jobs */
|
|
471
|
-
getJobCount(): number
|
|
472
|
-
/** Get all job IDs */
|
|
473
|
-
getJobIds(): string[]
|
|
474
|
-
|
|
475
|
-
//* Global Jobs (for legacy addEffect/addAfterEffect) --------------------------------
|
|
476
|
-
|
|
477
|
-
/** Register a global job (runs once per frame, not per-root). Returns unsubscribe function. */
|
|
478
|
-
registerGlobal(phase: 'before' | 'after', id: string, callback: (timestamp: number) => void): () => void
|
|
479
|
-
|
|
480
|
-
//* Idle Callbacks (for legacy addTail) --------------------------------
|
|
481
|
-
|
|
482
|
-
/** Register an idle callback (fires when loop stops). Returns unsubscribe function. */
|
|
483
|
-
onIdle(callback: (timestamp: number) => void): () => void
|
|
484
|
-
|
|
485
|
-
//* Frame Loop Control --------------------------------
|
|
486
|
-
|
|
487
|
-
/** Start the scheduler loop */
|
|
488
|
-
start(): void
|
|
489
|
-
/** Stop the scheduler loop */
|
|
490
|
-
stop(): void
|
|
491
|
-
/** Check if the scheduler is running */
|
|
492
|
-
readonly isRunning: boolean
|
|
493
|
-
/** Get/set the frameloop mode ('always', 'demand', 'never') */
|
|
494
|
-
frameloop: Frameloop
|
|
495
|
-
/** Independent mode - runs without Canvas, callbacks receive timing-only state */
|
|
496
|
-
independent: boolean
|
|
497
|
-
|
|
498
|
-
//* Manual Stepping --------------------------------
|
|
499
|
-
|
|
500
|
-
/** Manually step all jobs once (for frameloop='never' or testing) */
|
|
501
|
-
step(timestamp?: number): void
|
|
502
|
-
/** Manually step a single job by ID */
|
|
503
|
-
stepJob(id: string, timestamp?: number): void
|
|
504
|
-
/** Request frame(s) to be rendered (for frameloop='demand') */
|
|
505
|
-
invalidate(frames?: number): void
|
|
506
|
-
|
|
507
|
-
//* Per-Job Control --------------------------------
|
|
508
|
-
|
|
509
|
-
/** Check if a job is paused */
|
|
510
|
-
isJobPaused(id: string): boolean
|
|
511
|
-
/** Pause a job */
|
|
512
|
-
pauseJob(id: string): void
|
|
513
|
-
/** Resume a job */
|
|
514
|
-
resumeJob(id: string): void
|
|
515
|
-
/** Subscribe to job state changes (for reactive isPaused). Returns unsubscribe function. */
|
|
516
|
-
subscribeJobState(id: string, listener: () => void): () => void
|
|
517
|
-
}
|
|
518
|
-
|
|
519
333
|
//* Buffer Types (useBuffers) ========================================
|
|
520
334
|
|
|
521
335
|
/**
|
|
@@ -540,6 +354,7 @@ type BufferLike =
|
|
|
540
354
|
| Uint16Array
|
|
541
355
|
| Int16Array
|
|
542
356
|
| THREE$1.BufferAttribute // Base class for all buffer attributes
|
|
357
|
+
| THREE$1.InterleavedBufferAttribute
|
|
543
358
|
| Node // TSL buffer nodes (instancedArray, storage)
|
|
544
359
|
|
|
545
360
|
/** Flat record of buffer-like values (no nested scopes) */
|
|
@@ -551,6 +366,25 @@ type BufferRecord = Record<string, BufferLike>
|
|
|
551
366
|
*/
|
|
552
367
|
type BufferStore = Record<string, BufferLike | BufferRecord>
|
|
553
368
|
|
|
369
|
+
//* Node Types (useNodes) ========================================
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Every node representation `useNodes` accepts and `state.nodes` holds: three's real `Node`,
|
|
373
|
+
* the callable proxy `Fn()` returns, and the legacy structural shape (`uuid`/`nodeType`) older
|
|
374
|
+
* code passes through. Creators are constrained to this same type, so the shape a creator returns
|
|
375
|
+
* and the shape the store holds are one type by construction.
|
|
376
|
+
*/
|
|
377
|
+
type NodeLike = TSLNodeType | LegacyTSLNodeLike
|
|
378
|
+
|
|
379
|
+
/** Flat record of TSL nodes (no nested scopes) */
|
|
380
|
+
type NodeRecord<T extends NodeLike = NodeLike> = Record<string, T>
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Node store that can contain both root-level nodes and scoped node objects.
|
|
384
|
+
* Structure: { wobble: OperatorNode, fx: { blur: ShaderCallable } }
|
|
385
|
+
*/
|
|
386
|
+
type NodeStore = Record<string, NodeLike | NodeRecord>
|
|
387
|
+
|
|
554
388
|
//* Storage Types (useGPUStorage) ========================================
|
|
555
389
|
|
|
556
390
|
/**
|
|
@@ -565,7 +399,9 @@ type BufferStore = Record<string, BufferLike | BufferRecord>
|
|
|
565
399
|
* ```
|
|
566
400
|
*/
|
|
567
401
|
type StorageLike =
|
|
568
|
-
| StorageTexture // GPU storage texture
|
|
402
|
+
| StorageTexture // 2D GPU storage texture
|
|
403
|
+
| Storage3DTexture // 3D GPU storage texture (volumes, fluid grids)
|
|
404
|
+
| StorageArrayTexture // 2D-array GPU storage texture
|
|
569
405
|
| Data3DTexture // 3D texture (can be used as storage)
|
|
570
406
|
| Node // TSL storage texture nodes (storageTexture)
|
|
571
407
|
|
|
@@ -684,14 +520,31 @@ interface InternalState {
|
|
|
684
520
|
/** Container for child attachment (scene for root, original container for portals) */
|
|
685
521
|
container?: THREE$1.Object3D
|
|
686
522
|
/**
|
|
687
|
-
* CanvasTarget
|
|
688
|
-
*
|
|
523
|
+
* The CanvasTarget this root sizes and renders through.
|
|
524
|
+
*
|
|
525
|
+
* A primary (`<Canvas id>`) owns the renderer's default target -- the one three itself built
|
|
526
|
+
* around the canvas element -- so sizing it is sizing the renderer. A secondary owns a target
|
|
527
|
+
* R3F created for its own element. Either way there is exactly one target per canvas element,
|
|
528
|
+
* and the canvas-target job makes it the renderer's active one before this root renders.
|
|
529
|
+
* Absent on WebGL and on an id-less WebGPU canvas, where the renderer is sized directly.
|
|
689
530
|
* @see https://threejs.org/docs/#api/en/renderers/common/CanvasTarget
|
|
690
531
|
*/
|
|
691
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
|
|
692
545
|
/**
|
|
693
546
|
* Whether multi-canvas rendering is active.
|
|
694
|
-
* True when any canvas uses `
|
|
547
|
+
* True when any canvas uses `renderer={{ primaryCanvas: 'id' }}` to share a renderer.
|
|
695
548
|
* When true, setCanvasTarget is called before each render.
|
|
696
549
|
*/
|
|
697
550
|
isMultiCanvas?: boolean
|
|
@@ -789,8 +642,8 @@ interface RootState {
|
|
|
789
642
|
setSize: (width?: number, height?: number, top?: number, left?: number) => void
|
|
790
643
|
/** Shortcut to manual setting the pixel ratio */
|
|
791
644
|
setDpr: (dpr: Dpr) => void
|
|
792
|
-
/** Shortcut to setting frameloop flags */
|
|
793
|
-
setFrameloop: (frameloop
|
|
645
|
+
/** Shortcut to setting frameloop flags. No args resets to 'always'. */
|
|
646
|
+
setFrameloop: (frameloop?: Frameloop) => void
|
|
794
647
|
/** Set error state to propagate to error boundary */
|
|
795
648
|
setError: (error: Error | null) => void
|
|
796
649
|
/** Current error state (null when no error) */
|
|
@@ -798,17 +651,19 @@ interface RootState {
|
|
|
798
651
|
/** Global TSL uniform nodes - root-level uniforms + scoped sub-objects. Use useUniforms() hook */
|
|
799
652
|
uniforms: UniformStore
|
|
800
653
|
/** Global TSL nodes - root-level nodes + scoped sub-objects. Use useNodes() hook */
|
|
801
|
-
nodes:
|
|
654
|
+
nodes: NodeStore
|
|
802
655
|
/** Global TSL buffer nodes - root-level buffers + scoped sub-objects. Use useBuffers() hook */
|
|
803
656
|
buffers: BufferStore
|
|
804
657
|
/** Global GPU storage (textures, etc.) - root-level storage + scoped sub-objects. Use useGPUStorage() hook */
|
|
805
658
|
gpuStorage: StorageStore
|
|
806
|
-
/** Global
|
|
807
|
-
textures: Map<string,
|
|
659
|
+
/** Global Texture registry (key → Texture, usually keyed by URL) - use useTextures() hook for access + lifecycle */
|
|
660
|
+
textures: Map<string, THREE$1.Texture>
|
|
661
|
+
/** Internal: refcount per texture key, driven by mounted useTexture consumers (registry enrollment is on by default) */
|
|
662
|
+
_textureRefs: Map<string, number>
|
|
808
663
|
/** WebGPU RenderPipeline instance - use useRenderPipeline() hook */
|
|
809
|
-
renderPipeline:
|
|
664
|
+
renderPipeline: ThreeRenderPipeline | null
|
|
810
665
|
/** Global TSL pass nodes for render pipeline - use useRenderPipeline() hook */
|
|
811
|
-
passes:
|
|
666
|
+
passes: PassRecord
|
|
812
667
|
/** Internal version counter for HMR - incremented by rebuildNodes/rebuildUniforms to bust memoization */
|
|
813
668
|
_hmrVersion: number
|
|
814
669
|
/** Internal: whether setSize() has taken ownership of canvas dimensions */
|
|
@@ -896,12 +751,19 @@ type DefaultRendererProps = {
|
|
|
896
751
|
*/
|
|
897
752
|
interface CanvasSchedulerConfig {
|
|
898
753
|
/**
|
|
899
|
-
*
|
|
900
|
-
|
|
754
|
+
* Run this Canvas root before the referenced Canvas root id(s).
|
|
755
|
+
*/
|
|
756
|
+
before?: string | string[]
|
|
757
|
+
/**
|
|
758
|
+
* Run this Canvas root after the referenced Canvas root id(s).
|
|
901
759
|
*/
|
|
902
|
-
after?: string
|
|
760
|
+
after?: string | string[]
|
|
761
|
+
/**
|
|
762
|
+
* Numeric root order. Lower values run first.
|
|
763
|
+
*/
|
|
764
|
+
order?: number
|
|
903
765
|
/**
|
|
904
|
-
* Limit this
|
|
766
|
+
* Limit this Canvas's default render job (frames per second).
|
|
905
767
|
*/
|
|
906
768
|
fps?: number
|
|
907
769
|
}
|
|
@@ -988,14 +850,17 @@ interface RenderProps<TCanvas extends HTMLCanvasElement | OffscreenCanvas$1> {
|
|
|
988
850
|
performance?: Partial<Omit<Performance, 'regress'>>
|
|
989
851
|
/** Target pixel ratio. Can clamp between a range: `[min, max]` */
|
|
990
852
|
dpr?: Dpr
|
|
991
|
-
/**
|
|
992
|
-
|
|
853
|
+
/**
|
|
854
|
+
* Props that go into the default raycaster. `params` is merged into the raycaster's defaults,
|
|
855
|
+
* so a single threshold can be set: `raycaster={{ params: { Points: { threshold: 0.2 } } }}`.
|
|
856
|
+
*/
|
|
857
|
+
raycaster?: Partial<Omit<THREE$1.Raycaster, 'params'>> & { params?: Partial<THREE$1.RaycasterParameters> }
|
|
993
858
|
/** A `THREE.Scene` instance or props that go into the default scene */
|
|
994
859
|
scene?: THREE$1.Scene | Partial<THREE$1.Scene>
|
|
995
860
|
/** A `THREE.Camera` instance or props that go into the default camera */
|
|
996
861
|
camera?: CameraProps
|
|
997
862
|
/** An R3F event manager to manage elements' pointer events */
|
|
998
|
-
events?: (store: RootStore) => EventManager<
|
|
863
|
+
events?: (store: RootStore) => EventManager<Element>
|
|
999
864
|
/** Callback after the canvas has rendered (but not yet committed) */
|
|
1000
865
|
onCreated?: (state: RootState) => void
|
|
1001
866
|
/** Response for pointer clicks that have missed any target */
|
|
@@ -1084,7 +949,6 @@ type InstanceProps<T = any, P = any> = ArgsProp<P> & {
|
|
|
1084
949
|
object?: T
|
|
1085
950
|
dispose?: null
|
|
1086
951
|
attach?: AttachType<T>
|
|
1087
|
-
onUpdate?: (self: T) => void
|
|
1088
952
|
}
|
|
1089
953
|
|
|
1090
954
|
interface Instance<O = any> {
|
|
@@ -1099,8 +963,6 @@ interface Instance<O = any> {
|
|
|
1099
963
|
attach?: AttachType<O>
|
|
1100
964
|
previousAttach?: any
|
|
1101
965
|
isHidden: boolean
|
|
1102
|
-
/** Deferred ref props to apply in commitMount */
|
|
1103
|
-
deferredRefs?: Array<{ prop: string; ref: React$1.RefObject<any> }>
|
|
1104
966
|
/** Set of props that have been applied via once() */
|
|
1105
967
|
appliedOnce?: Set<string>
|
|
1106
968
|
}
|
|
@@ -1226,7 +1088,7 @@ interface CanvasProps
|
|
|
1226
1088
|
*/
|
|
1227
1089
|
resize?: Options
|
|
1228
1090
|
/** The target where events are being subscribed to, default: the div that wraps canvas */
|
|
1229
|
-
eventSource?:
|
|
1091
|
+
eventSource?: Element | React$1.RefObject<Element | null>
|
|
1230
1092
|
/** The event prefix that is cast into canvas pointer x/y events, default: "offset" */
|
|
1231
1093
|
eventPrefix?: 'offset' | 'client' | 'page' | 'layer' | 'screen'
|
|
1232
1094
|
/** Enable/disable automatic HMR refresh for TSL nodes and uniforms, default: true in dev */
|
|
@@ -1334,70 +1196,86 @@ interface LegacyRootState extends Omit<RootState, 'renderer' | 'internal'> {
|
|
|
1334
1196
|
|
|
1335
1197
|
type RenderTargetOptions = RenderTargetOptions$1
|
|
1336
1198
|
|
|
1337
|
-
//* Global Types ==============================
|
|
1199
|
+
//* Global TSL Types ==============================
|
|
1338
1200
|
|
|
1339
1201
|
declare global {
|
|
1340
|
-
/** Uniform node type - a Node with a value property (matches Three.js UniformNode) */
|
|
1341
|
-
interface UniformNode<T = unknown> extends Node {
|
|
1342
|
-
value: T
|
|
1343
|
-
}
|
|
1344
|
-
|
|
1345
1202
|
/**
|
|
1346
|
-
*
|
|
1347
|
-
*
|
|
1348
|
-
* The function returns a ShaderNodeObject when called.
|
|
1349
|
-
*
|
|
1350
|
-
* @example
|
|
1351
|
-
* ```tsx
|
|
1352
|
-
* // Define a shader function
|
|
1353
|
-
* const blendColorFn = Fn(([color1, color2, factor]) => {
|
|
1354
|
-
* return mix(color1, color2, factor)
|
|
1355
|
-
* })
|
|
1356
|
-
*
|
|
1357
|
-
* // Type when retrieving from nodes store
|
|
1358
|
-
* const { blendColorFn } = nodes as { blendColorFn: ShaderCallable }
|
|
1359
|
-
*
|
|
1360
|
-
* // Or with specific return type
|
|
1361
|
-
* const { myFn } = nodes as { myFn: ShaderCallable<THREE.Node> }
|
|
1362
|
-
* ```
|
|
1203
|
+
* Broad callable-node fallback for dynamic store readers.
|
|
1204
|
+
* Creator hooks preserve the exact function signatures inferred from Three's `Fn`.
|
|
1363
1205
|
*/
|
|
1364
|
-
type
|
|
1206
|
+
type CallableTSLNode = ((...params: never[]) => unknown) & {
|
|
1207
|
+
readonly shaderNode: unknown
|
|
1208
|
+
readonly id: number
|
|
1209
|
+
}
|
|
1365
1210
|
|
|
1366
|
-
/**
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
*/
|
|
1375
|
-
type ShaderNodeRef<T extends Node = Node> = ShaderNodeObject<T>
|
|
1211
|
+
/** Legacy structural node accepted when at least one historical marker exists. */
|
|
1212
|
+
type LegacyTSLNodeLike = {
|
|
1213
|
+
label?: ((label: string) => unknown) | string
|
|
1214
|
+
setName?: (name: string) => unknown
|
|
1215
|
+
} & ({ uuid: string | undefined; nodeType?: string | null } | { uuid?: string; nodeType: string | null | undefined })
|
|
1216
|
+
|
|
1217
|
+
/** Node type accepted by broad dynamic node-store readers. */
|
|
1218
|
+
type TSLNodeType = three_webgpu.Node | CallableTSLNode
|
|
1376
1219
|
|
|
1377
1220
|
/**
|
|
1378
|
-
*
|
|
1379
|
-
*
|
|
1380
|
-
*
|
|
1381
|
-
*
|
|
1382
|
-
* - Node: base Three.js node type
|
|
1383
|
-
* - ShaderCallable: function nodes created with Fn()
|
|
1384
|
-
* - ShaderNodeObject: wrapped nodes from TSL operations (sin, mul, mix, etc.)
|
|
1385
|
-
*
|
|
1386
|
-
* @example
|
|
1387
|
-
* ```tsx
|
|
1388
|
-
* // In useLocalNodes, nodes are typed as TSLNodeType
|
|
1389
|
-
* const { positionNode, blendColorFn } = useLocalNodes(({ nodes }) => ({
|
|
1390
|
-
* positionNode: nodes.myPosition, // Works - Node is in union
|
|
1391
|
-
* blendColorFn: nodes.myFn, // Works - ShaderCallable is in union
|
|
1392
|
-
* }))
|
|
1393
|
-
*
|
|
1394
|
-
* // Can narrow with type guard or assertion when needed
|
|
1395
|
-
* if (typeof blendColorFn === 'function') {
|
|
1396
|
-
* blendColorFn(someColor, 0.5)
|
|
1397
|
-
* }
|
|
1398
|
-
* ```
|
|
1221
|
+
* Derive Three's shader node type from an existing node or a supported raw input.
|
|
1222
|
+
* Existing InputNode generics take precedence over structural value normalization.
|
|
1223
|
+
* Both generics must be inferred because Three's UniformNode intersects an unknown-typed
|
|
1224
|
+
* InputNode base with its concrete InputNode specialization.
|
|
1399
1225
|
*/
|
|
1400
|
-
type
|
|
1226
|
+
type UniformNodeType<T> = T extends three_webgpu.UniformNode<infer TNodeType, infer _TValue>
|
|
1227
|
+
? TNodeType
|
|
1228
|
+
: T extends three_webgpu.InputNode<infer TNodeType, infer _TValue>
|
|
1229
|
+
? TNodeType
|
|
1230
|
+
: T extends number
|
|
1231
|
+
? 'float'
|
|
1232
|
+
: T extends boolean
|
|
1233
|
+
? 'bool'
|
|
1234
|
+
: T extends string | three_webgpu.Color | { r: number; g: number; b: number }
|
|
1235
|
+
? 'color'
|
|
1236
|
+
: T extends three_webgpu.Vector4 | { x: number; y: number; z: number; w: number }
|
|
1237
|
+
? 'vec4'
|
|
1238
|
+
: T extends three_webgpu.Vector3 | { x: number; y: number; z: number }
|
|
1239
|
+
? 'vec3'
|
|
1240
|
+
: T extends three_webgpu.Vector2 | { x: number; y: number }
|
|
1241
|
+
? 'vec2'
|
|
1242
|
+
: T extends three_webgpu.Matrix4
|
|
1243
|
+
? 'mat4'
|
|
1244
|
+
: T extends three_webgpu.Matrix3
|
|
1245
|
+
? 'mat3'
|
|
1246
|
+
: T extends three_webgpu.Matrix2
|
|
1247
|
+
? 'mat2'
|
|
1248
|
+
: unknown
|
|
1249
|
+
|
|
1250
|
+
/** Derive the normalized JavaScript value stored by a uniform node. */
|
|
1251
|
+
type UniformNodeValue<T> = T extends three_webgpu.UniformNode<infer _TNodeType, infer TValue>
|
|
1252
|
+
? TValue
|
|
1253
|
+
: T extends three_webgpu.InputNode<infer _TNodeType, infer TValue>
|
|
1254
|
+
? TValue
|
|
1255
|
+
: T extends string | { r: number; g: number; b: number }
|
|
1256
|
+
? three_webgpu.Color
|
|
1257
|
+
: T extends { x: number; y: number; z: number; w: number }
|
|
1258
|
+
? three_webgpu.Vector4
|
|
1259
|
+
: T extends { x: number; y: number; z: number }
|
|
1260
|
+
? three_webgpu.Vector3
|
|
1261
|
+
: T extends { x: number; y: number }
|
|
1262
|
+
? three_webgpu.Vector2
|
|
1263
|
+
: T extends number
|
|
1264
|
+
? number
|
|
1265
|
+
: T extends boolean
|
|
1266
|
+
? boolean
|
|
1267
|
+
: T
|
|
1268
|
+
|
|
1269
|
+
/** Three's exact UniformNode with shader and value generics derived from an input. */
|
|
1270
|
+
type UniformNodeFor<T> = three_webgpu.UniformNode<UniformNodeType<T>, UniformNodeValue<T>>
|
|
1271
|
+
|
|
1272
|
+
/** Preserve every input key while mapping values to exact Three uniform nodes. */
|
|
1273
|
+
type UniformNodesFor<T extends UniformInputRecord> = {
|
|
1274
|
+
[K in keyof T]: UniformNodeFor<T[K]>
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
/** Backward-compatible single-parameter uniform alias. */
|
|
1278
|
+
type UniformNode<T = unknown> = UniformNodeFor<T>
|
|
1401
1279
|
|
|
1402
1280
|
/** Flat record of uniform nodes (no nested scopes) */
|
|
1403
1281
|
type UniformRecord<T extends UniformNode = UniformNode> = Record<string, T>
|
|
@@ -1422,7 +1300,7 @@ declare global {
|
|
|
1422
1300
|
* Acceptable input values for useUniforms - raw values that get converted to UniformNodes
|
|
1423
1301
|
* Supports:
|
|
1424
1302
|
* - Primitives: number, string (color), boolean
|
|
1425
|
-
* - Three.js types: Color, Vector2/3/4,
|
|
1303
|
+
* - Three.js types: Color, Vector2/3/4, Matrix2/3/4
|
|
1426
1304
|
* - Plain objects: { x, y, z, w } converted to vectors
|
|
1427
1305
|
* - TSL nodes: color(), vec3(), float() for type casting
|
|
1428
1306
|
* - UniformNode: existing uniforms (reused as-is)
|
|
@@ -1435,227 +1313,124 @@ declare global {
|
|
|
1435
1313
|
| three_webgpu.Vector2
|
|
1436
1314
|
| three_webgpu.Vector3
|
|
1437
1315
|
| three_webgpu.Vector4
|
|
1316
|
+
| three_webgpu.Matrix2
|
|
1438
1317
|
| three_webgpu.Matrix3
|
|
1439
1318
|
| three_webgpu.Matrix4
|
|
1440
|
-
|
|
|
1441
|
-
|
|
|
1442
|
-
| { x: number; y
|
|
1319
|
+
| { x: number; y: number }
|
|
1320
|
+
| { x: number; y: number; z: number }
|
|
1321
|
+
| { x: number; y: number; z: number; w: number }
|
|
1443
1322
|
| { r: number; g: number; b: number; a?: number } // Plain objects converted to Color
|
|
1444
|
-
| Node // TSL nodes like color(), vec3(), float() for type casting
|
|
1323
|
+
| three_webgpu.Node // TSL nodes like color(), vec3(), float() for type casting
|
|
1445
1324
|
| UniformNode
|
|
1446
1325
|
|
|
1447
1326
|
/** Input record for useUniforms - accepts raw values or UniformNodes */
|
|
1448
1327
|
type UniformInputRecord = Record<string, UniformValue>
|
|
1449
1328
|
}
|
|
1450
1329
|
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
declare module 'three/tsl' {
|
|
1330
|
+
declare global {
|
|
1454
1331
|
/**
|
|
1455
|
-
*
|
|
1456
|
-
*
|
|
1332
|
+
* three's own render pipeline type. Named here so the rest of R3F refers to three's shape
|
|
1333
|
+
* rather than `any`. three r183 renamed `PostProcessing` to `RenderPipeline`; our peer floor
|
|
1334
|
+
* is r185, so the new name is the only one.
|
|
1457
1335
|
*/
|
|
1458
|
-
|
|
1459
|
-
jsFunc: (inputs: ShaderNodeObject<Node>[]) => ShaderNodeObject<R>,
|
|
1460
|
-
): ShaderCallable<R>
|
|
1336
|
+
type ThreeRenderPipeline = three_webgpu.RenderPipeline
|
|
1461
1337
|
|
|
1462
1338
|
/**
|
|
1463
|
-
*
|
|
1464
|
-
*
|
|
1339
|
+
* The pass `useRenderPipeline` creates for you: three's own `PassNode`, as returned by
|
|
1340
|
+
* `pass(scene, camera)` from `three/tsl`. Referenced from three so members like
|
|
1341
|
+
* `getTextureNode`, `setMRT` and `dispose` track the installed version.
|
|
1465
1342
|
*/
|
|
1466
|
-
|
|
1467
|
-
jsFunc: (inputs: T) => ShaderNodeObject<R>,
|
|
1468
|
-
): ShaderCallable<R>
|
|
1343
|
+
type ScenePassNode = three_webgpu.PassNode
|
|
1469
1344
|
|
|
1470
1345
|
/**
|
|
1471
|
-
*
|
|
1472
|
-
*
|
|
1346
|
+
* Pass record - stores TSL pass nodes for render pipeline.
|
|
1347
|
+
*
|
|
1348
|
+
* `scenePass` is the only key the library owns. It is optional here because this is also the
|
|
1349
|
+
* shape of `state.passes`, which is `{}` before the pipeline exists and again after `reset()`
|
|
1350
|
+
* or `clearPasses()`. Inside the callbacks it is always present; see
|
|
1351
|
+
* {@link RenderPipelineCallbackState}.
|
|
1352
|
+
*
|
|
1353
|
+
* Every other key is user-registered, via a callback's return value. Those are TSL nodes of
|
|
1354
|
+
* any kind, not only passes: texture reads of an MRT attachment, effect nodes, extra
|
|
1355
|
+
* `pass()` instances. `Node` is the common base, so that is the bound. Narrow at the call
|
|
1356
|
+
* site when you need a member, e.g. `passes.velocity as TextureNode`.
|
|
1357
|
+
*
|
|
1358
|
+
* The index signature admits `undefined` because a key may simply not be registered, and
|
|
1359
|
+
* because the optional `scenePass` must be assignable to it: under `skipLibCheck: false` an
|
|
1360
|
+
* optional property whose type excludes `undefined` from the index signature is an error
|
|
1361
|
+
* (TS2411) for every consumer compiling these declarations.
|
|
1473
1362
|
*/
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1363
|
+
interface PassRecord {
|
|
1364
|
+
scenePass?: ScenePassNode
|
|
1365
|
+
[key: string]: three_webgpu.Node | undefined
|
|
1366
|
+
}
|
|
1478
1367
|
|
|
1479
1368
|
/**
|
|
1480
|
-
*
|
|
1369
|
+
* State passed to pipeline callbacks after the active pipeline has been created.
|
|
1370
|
+
*
|
|
1371
|
+
* `passes.scenePass` is required here: the hook installs the default scene pass before either
|
|
1372
|
+
* callback runs, so callbacks can use it without a guard or a cast.
|
|
1373
|
+
*
|
|
1374
|
+
* `renderer` is narrowed to `WebGPURenderer` and `isLegacy` to `false`: the hook throws under
|
|
1375
|
+
* the legacy renderer before either callback can run, so a callback never sees WebGL.
|
|
1481
1376
|
*/
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
/**
|
|
1489
|
-
* RenderPipeline Types for useRenderPipeline hook (WebGPU only)
|
|
1490
|
-
*/
|
|
1491
|
-
|
|
1492
|
-
|
|
1377
|
+
type RenderPipelineCallbackState = RootState & {
|
|
1378
|
+
renderPipeline: ThreeRenderPipeline
|
|
1379
|
+
passes: PassRecord & { scenePass: ScenePassNode }
|
|
1380
|
+
renderer: three_webgpu.WebGPURenderer
|
|
1381
|
+
isLegacy: false
|
|
1382
|
+
}
|
|
1493
1383
|
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1384
|
+
/**
|
|
1385
|
+
* What a callback may return to register entries into `state.passes`.
|
|
1386
|
+
*
|
|
1387
|
+
* `scenePass` is reserved. The hook owns that entry and its lifecycle: it caches the pass it
|
|
1388
|
+
* created, and `rebuild()` / `reset()` dispose that cached pass. A callback overwriting the
|
|
1389
|
+
* store entry would leave the store pointing at a node the hook never disposes, and the hook
|
|
1390
|
+
* disposing a pass nothing references. So returning it is a type error.
|
|
1391
|
+
*/
|
|
1392
|
+
type RegisteredPasses = Record<string, three_webgpu.Node> & { scenePass?: never }
|
|
1497
1393
|
|
|
1498
1394
|
/** Setup callback - runs first to configure MRT, create additional passes */
|
|
1499
|
-
type RenderPipelineSetupCallback = (state:
|
|
1395
|
+
type RenderPipelineSetupCallback = (state: RenderPipelineCallbackState) => RegisteredPasses | void
|
|
1500
1396
|
|
|
1501
1397
|
/** Main callback - runs second to configure outputNode, create effect passes */
|
|
1502
|
-
type RenderPipelineMainCallback = (state:
|
|
1398
|
+
type RenderPipelineMainCallback = (state: RenderPipelineCallbackState) => RegisteredPasses | void
|
|
1503
1399
|
|
|
1504
|
-
/**
|
|
1505
|
-
interface
|
|
1400
|
+
/** The imperative half of useRenderPipeline's return value, present in every state */
|
|
1401
|
+
interface UseRenderPipelineActions {
|
|
1506
1402
|
/** Current passes from state */
|
|
1507
1403
|
passes: PassRecord
|
|
1508
|
-
/** RenderPipeline instance (null if not initialized) */
|
|
1509
|
-
renderPipeline: any | null // THREE.PostProcessing (will be THREE.RenderPipeline in future Three.js release)
|
|
1510
1404
|
/** Clear all passes from state */
|
|
1511
1405
|
clearPasses: () => void
|
|
1512
1406
|
/** Reset RenderPipeline entirely (clears PP + passes) */
|
|
1513
1407
|
reset: () => void
|
|
1514
1408
|
/** Re-run setup/main callbacks with current closure values */
|
|
1515
1409
|
rebuild: () => void
|
|
1516
|
-
/** True when RenderPipeline is configured and ready */
|
|
1517
|
-
isReady: boolean
|
|
1518
|
-
}
|
|
1519
|
-
}
|
|
1520
|
-
|
|
1521
|
-
//* useFrameNext Types ==============================
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
//* Global Type Declarations ==============================
|
|
1526
|
-
|
|
1527
|
-
declare global {
|
|
1528
|
-
// Job --------------------------------
|
|
1529
|
-
|
|
1530
|
-
/**
|
|
1531
|
-
* Internal job representation in the scheduler
|
|
1532
|
-
*/
|
|
1533
|
-
interface Job {
|
|
1534
|
-
/** Unique identifier */
|
|
1535
|
-
id: string
|
|
1536
|
-
/** The callback to execute */
|
|
1537
|
-
callback: FrameNextCallback
|
|
1538
|
-
/** Phase this job belongs to */
|
|
1539
|
-
phase: string
|
|
1540
|
-
/** Run before these phases/job ids */
|
|
1541
|
-
before: Set<string>
|
|
1542
|
-
/** Run after these phases/job ids */
|
|
1543
|
-
after: Set<string>
|
|
1544
|
-
/** Priority within phase (higher first) */
|
|
1545
|
-
priority: number
|
|
1546
|
-
/** Insertion order for deterministic tie-breaking */
|
|
1547
|
-
index: number
|
|
1548
|
-
/** Max FPS for this job (undefined = no limit) */
|
|
1549
|
-
fps?: number
|
|
1550
|
-
/** Drop frames when behind (true) or catch up (false) */
|
|
1551
|
-
drop: boolean
|
|
1552
|
-
/** Last run timestamp (ms) */
|
|
1553
|
-
lastRun?: number
|
|
1554
|
-
/** Whether job is enabled */
|
|
1555
|
-
enabled: boolean
|
|
1556
|
-
/** Internal flag: system jobs (like default render) don't block user render takeover */
|
|
1557
|
-
system?: boolean
|
|
1558
|
-
}
|
|
1559
|
-
|
|
1560
|
-
// Phase Graph --------------------------------
|
|
1561
|
-
|
|
1562
|
-
/**
|
|
1563
|
-
* A node in the phase graph
|
|
1564
|
-
*/
|
|
1565
|
-
interface PhaseNode {
|
|
1566
|
-
/** Phase name */
|
|
1567
|
-
name: string
|
|
1568
|
-
/** Whether this was auto-generated from a before/after constraint */
|
|
1569
|
-
isAutoGenerated: boolean
|
|
1570
|
-
}
|
|
1571
|
-
|
|
1572
|
-
/**
|
|
1573
|
-
* Options for creating a job from hook options
|
|
1574
|
-
*/
|
|
1575
|
-
interface JobOptions {
|
|
1576
|
-
id?: string
|
|
1577
|
-
phase?: string
|
|
1578
|
-
before?: string | string[]
|
|
1579
|
-
after?: string | string[]
|
|
1580
|
-
priority?: number
|
|
1581
|
-
fps?: number
|
|
1582
|
-
drop?: boolean
|
|
1583
|
-
enabled?: boolean
|
|
1584
|
-
}
|
|
1585
|
-
|
|
1586
|
-
// Frame Loop State --------------------------------
|
|
1587
|
-
|
|
1588
|
-
/**
|
|
1589
|
-
* Internal frame loop state
|
|
1590
|
-
*/
|
|
1591
|
-
interface FrameLoopState {
|
|
1592
|
-
/** Whether the loop is running */
|
|
1593
|
-
running: boolean
|
|
1594
|
-
/** Current RAF handle */
|
|
1595
|
-
rafHandle: number | null
|
|
1596
|
-
/** Last frame timestamp in ms (null = uninitialized) */
|
|
1597
|
-
lastTime: number | null
|
|
1598
|
-
/** Frame counter */
|
|
1599
|
-
frameCount: number
|
|
1600
|
-
/** Elapsed time since first frame in ms */
|
|
1601
|
-
elapsedTime: number
|
|
1602
|
-
/** createdAt timestamp in ms */
|
|
1603
|
-
createdAt: number
|
|
1604
1410
|
}
|
|
1605
1411
|
|
|
1606
|
-
// Root Entry --------------------------------
|
|
1607
|
-
|
|
1608
1412
|
/**
|
|
1609
|
-
*
|
|
1610
|
-
*
|
|
1611
|
-
*
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
/** Unique identifier for this root */
|
|
1615
|
-
id: string
|
|
1616
|
-
/** Function to get the root's current state. Returns any to support independent mode. */
|
|
1617
|
-
getState: () => any
|
|
1618
|
-
/** Map of job IDs to Job objects */
|
|
1619
|
-
jobs: Map<string, Job>
|
|
1620
|
-
/** Cached sorted job list for execution order */
|
|
1621
|
-
sortedJobs: Job[]
|
|
1622
|
-
/** Whether sortedJobs needs rebuilding */
|
|
1623
|
-
needsRebuild: boolean
|
|
1624
|
-
}
|
|
1625
|
-
|
|
1626
|
-
/**
|
|
1627
|
-
* Internal representation of a global job (deprecated API).
|
|
1628
|
-
* Global jobs run once per frame, not per-root.
|
|
1629
|
-
* Used by legacy addEffect/addAfterEffect APIs.
|
|
1630
|
-
* @internal
|
|
1631
|
-
* @deprecated Use useFrame with phases instead
|
|
1632
|
-
*/
|
|
1633
|
-
interface GlobalJob {
|
|
1634
|
-
/** Unique identifier for this global job */
|
|
1635
|
-
id: string
|
|
1636
|
-
/** Callback invoked with RAF timestamp in ms */
|
|
1637
|
-
callback: (timestamp: number) => void
|
|
1638
|
-
}
|
|
1639
|
-
|
|
1640
|
-
// HMR Support --------------------------------
|
|
1641
|
-
|
|
1642
|
-
/**
|
|
1643
|
-
* Hot Module Replacement data structure for preserving scheduler state
|
|
1644
|
-
* @internal
|
|
1645
|
-
*/
|
|
1646
|
-
interface HMRData {
|
|
1647
|
-
/** Shared data object for storing values across reloads */
|
|
1648
|
-
data: Record<string, any>
|
|
1649
|
-
/** Optional function to accept HMR updates */
|
|
1650
|
-
accept?: () => void
|
|
1651
|
-
}
|
|
1652
|
-
|
|
1653
|
-
// Default Phases --------------------------------
|
|
1654
|
-
|
|
1655
|
-
/**
|
|
1656
|
-
* Default phase names for the scheduler
|
|
1413
|
+
* Return type for useRenderPipeline hook, discriminated on `isReady`.
|
|
1414
|
+
*
|
|
1415
|
+
* `if (isReady)` narrows `renderPipeline` to non-null, which is what the docs already tell
|
|
1416
|
+
* callers to check. `passes.scenePass` deliberately stays optional in the ready branch:
|
|
1417
|
+
* `clearPasses()` empties the record while leaving the pipeline in place.
|
|
1657
1418
|
*/
|
|
1658
|
-
type
|
|
1419
|
+
type UseRenderPipelineReturn = UseRenderPipelineActions &
|
|
1420
|
+
(
|
|
1421
|
+
| {
|
|
1422
|
+
/** True when RenderPipeline is configured and ready */
|
|
1423
|
+
isReady: true
|
|
1424
|
+
/** RenderPipeline instance */
|
|
1425
|
+
renderPipeline: ThreeRenderPipeline
|
|
1426
|
+
}
|
|
1427
|
+
| {
|
|
1428
|
+
/** False until the pipeline has been created */
|
|
1429
|
+
isReady: false
|
|
1430
|
+
/** Not initialized yet, or torn down by reset() */
|
|
1431
|
+
renderPipeline: null
|
|
1432
|
+
}
|
|
1433
|
+
)
|
|
1659
1434
|
}
|
|
1660
1435
|
|
|
1661
1436
|
type MutableOrReadonlyParameters<T extends (...args: any) => any> = Parameters<T> | Readonly<Parameters<T>>
|
|
@@ -1734,10 +1509,11 @@ type TSLNodeInput = { nodeType?: string | null; uuid?: string } | null
|
|
|
1734
1509
|
|
|
1735
1510
|
/**
|
|
1736
1511
|
* For node material properties (colorNode, positionNode, etc.), accept broader types
|
|
1737
|
-
* since @types/three has broken inheritance for TSL node subclasses.
|
|
1512
|
+
* since @types/three has broken inheritance for TSL node subclasses. NodeClass requires
|
|
1513
|
+
* `nodeType`, so this structural key test remains neutral to the selected Three entry.
|
|
1738
1514
|
*/
|
|
1739
1515
|
type NodeProps<P> = {
|
|
1740
|
-
[K in keyof P as P[K] extends
|
|
1516
|
+
[K in keyof P as NonNullable<P[K]> extends { nodeType: string | null } ? K : never]?: TSLNodeInput
|
|
1741
1517
|
}
|
|
1742
1518
|
|
|
1743
1519
|
interface ReactProps<P> {
|
|
@@ -1758,11 +1534,29 @@ type ThreeToJSXElements<T extends Record<string, any>> = {
|
|
|
1758
1534
|
[K in keyof T & string as Uncapitalize<K>]: T[K] extends ConstructorRepresentation ? ThreeElement<T[K]> : never
|
|
1759
1535
|
}
|
|
1760
1536
|
|
|
1537
|
+
/** Method names of Object3D, excluded from the `primitive` element's typed props. */
|
|
1538
|
+
type Object3DMethod = NonNullable<
|
|
1539
|
+
{
|
|
1540
|
+
[K in keyof Object3D]-?: Object3D[K] extends (...args: any[]) => any ? K : never
|
|
1541
|
+
}[keyof Object3D]
|
|
1542
|
+
>
|
|
1543
|
+
|
|
1761
1544
|
type ThreeExports = typeof THREE
|
|
1762
1545
|
type ThreeElementsImpl = ThreeToJSXElements<ThreeExports>
|
|
1763
1546
|
|
|
1764
1547
|
interface ThreeElements extends Omit<ThreeElementsImpl, 'audio' | 'source' | 'line' | 'path'> {
|
|
1765
|
-
|
|
1548
|
+
/**
|
|
1549
|
+
* `primitive` wraps a pre-existing object, so its props cannot be derived from one class.
|
|
1550
|
+
* Events are typed from `EventHandlers` (`onClick={(e) => ...}` infers `e`), the ref is
|
|
1551
|
+
* untyped, and any other prop is accepted and applied to the object by name. Object3D's own
|
|
1552
|
+
* methods are left out of the typed surface: they return `this`, so a subclass element's
|
|
1553
|
+
* props (`ThreeElements['group']`) could not be spread onto a primitive otherwise.
|
|
1554
|
+
*/
|
|
1555
|
+
primitive: Omit<ThreeElement<typeof Object3D>, 'args' | 'object' | 'ref' | Object3DMethod> & {
|
|
1556
|
+
object: object
|
|
1557
|
+
ref?: React.Ref<any>
|
|
1558
|
+
[prop: string]: unknown
|
|
1559
|
+
}
|
|
1766
1560
|
// Conflicts with DOM types can be accessed through a three* prefix
|
|
1767
1561
|
threeAudio: ThreeElementsImpl['audio']
|
|
1768
1562
|
threeSource: ThreeElementsImpl['source']
|
|
@@ -1803,6 +1597,7 @@ type three_d_Matrix3 = Matrix3;
|
|
|
1803
1597
|
type three_d_Matrix4 = Matrix4;
|
|
1804
1598
|
type three_d_MutableOrReadonlyParameters<T extends (...args: any) => any> = MutableOrReadonlyParameters<T>;
|
|
1805
1599
|
type three_d_NodeProps<P> = NodeProps<P>;
|
|
1600
|
+
type three_d_Object3DMethod = Object3DMethod;
|
|
1806
1601
|
type three_d_Quaternion = Quaternion;
|
|
1807
1602
|
type three_d_RaycastableRepresentation = RaycastableRepresentation;
|
|
1808
1603
|
type three_d_ReactProps<P> = ReactProps<P>;
|
|
@@ -1817,7 +1612,7 @@ type three_d_Vector3 = Vector3;
|
|
|
1817
1612
|
type three_d_Vector4 = Vector4;
|
|
1818
1613
|
type three_d_VectorRepresentation = VectorRepresentation;
|
|
1819
1614
|
declare namespace three_d {
|
|
1820
|
-
export type { three_d_Color as Color, three_d_ElementProps as ElementProps, three_d_Euler as Euler, three_d_EventProps as EventProps, three_d_GeometryProps as GeometryProps, three_d_GeometryTransformProps as GeometryTransformProps, three_d_Layers as Layers, three_d_MathProps as MathProps, three_d_MathRepresentation as MathRepresentation, three_d_MathType as MathType, three_d_MathTypes as MathTypes, three_d_Matrix3 as Matrix3, three_d_Matrix4 as Matrix4, three_d_MutableOrReadonlyParameters as MutableOrReadonlyParameters, three_d_NodeProps as NodeProps, three_d_Quaternion as Quaternion, three_d_RaycastableRepresentation as RaycastableRepresentation, three_d_ReactProps as ReactProps, three_d_TSLNodeInput as TSLNodeInput, three_d_ThreeElement as ThreeElement, three_d_ThreeElements as ThreeElements, three_d_ThreeElementsImpl as ThreeElementsImpl, three_d_ThreeExports as ThreeExports, three_d_ThreeToJSXElements as ThreeToJSXElements, three_d_Vector2 as Vector2, three_d_Vector3 as Vector3, three_d_Vector4 as Vector4, three_d_VectorRepresentation as VectorRepresentation };
|
|
1615
|
+
export type { three_d_Color as Color, three_d_ElementProps as ElementProps, three_d_Euler as Euler, three_d_EventProps as EventProps, three_d_GeometryProps as GeometryProps, three_d_GeometryTransformProps as GeometryTransformProps, three_d_Layers as Layers, three_d_MathProps as MathProps, three_d_MathRepresentation as MathRepresentation, three_d_MathType as MathType, three_d_MathTypes as MathTypes, three_d_Matrix3 as Matrix3, three_d_Matrix4 as Matrix4, three_d_MutableOrReadonlyParameters as MutableOrReadonlyParameters, three_d_NodeProps as NodeProps, three_d_Object3DMethod as Object3DMethod, three_d_Quaternion as Quaternion, three_d_RaycastableRepresentation as RaycastableRepresentation, three_d_ReactProps as ReactProps, three_d_TSLNodeInput as TSLNodeInput, three_d_ThreeElement as ThreeElement, three_d_ThreeElements as ThreeElements, three_d_ThreeElementsImpl as ThreeElementsImpl, three_d_ThreeExports as ThreeExports, three_d_ThreeToJSXElements as ThreeToJSXElements, three_d_Vector2 as Vector2, three_d_Vector3 as Vector3, three_d_Vector4 as Vector4, three_d_VectorRepresentation as VectorRepresentation };
|
|
1821
1616
|
}
|
|
1822
1617
|
|
|
1823
1618
|
/**
|
|
@@ -1827,7 +1622,7 @@ declare namespace three_d {
|
|
|
1827
1622
|
* a single WebGPURenderer using Three.js CanvasTarget API.
|
|
1828
1623
|
*
|
|
1829
1624
|
* Primary canvas: Has `id` prop, creates its own renderer, registers here
|
|
1830
|
-
* Secondary canvas: Has `
|
|
1625
|
+
* Secondary canvas: Has `renderer={{ primaryCanvas: 'id' }}`, shares primary's renderer via CanvasTarget
|
|
1831
1626
|
*/
|
|
1832
1627
|
|
|
1833
1628
|
interface PrimaryCanvasEntry {
|
|
@@ -1895,12 +1690,23 @@ type EnvironmentLoaderProps = {
|
|
|
1895
1690
|
* const texture = useEnvironment({ preset: 'sunset' })
|
|
1896
1691
|
* ```
|
|
1897
1692
|
*/
|
|
1898
|
-
declare function useEnvironment({ files, path, preset, colorSpace, extensions, }?: Partial<EnvironmentLoaderProps>): Texture$1<unknown> | CubeTexture
|
|
1693
|
+
declare function useEnvironment({ files, path, preset, colorSpace, extensions, }?: Partial<EnvironmentLoaderProps>): Texture$1<unknown, THREE$1.TextureEventMap> | CubeTexture<unknown>;
|
|
1899
1694
|
declare namespace useEnvironment {
|
|
1900
1695
|
var preload: (preloadOptions?: EnvironmentLoaderPreloadOptions) => void;
|
|
1901
1696
|
var clear: (clearOptions?: EnvironmentLoaderClearOptions) => void;
|
|
1902
1697
|
}
|
|
1903
|
-
|
|
1698
|
+
/**
|
|
1699
|
+
* Options accepted by `useEnvironment.preload`.
|
|
1700
|
+
*
|
|
1701
|
+
* `colorSpace` is deliberately omitted: preload only warms the loader cache, and colorSpace is
|
|
1702
|
+
* applied to the texture by `useEnvironment()` at use time, per consumer. Accepting it here would
|
|
1703
|
+
* advertise an option this function silently ignores.
|
|
1704
|
+
*
|
|
1705
|
+
* This previously read `Omit<…, 'encoding'>` — omitting a key that does not exist on
|
|
1706
|
+
* `EnvironmentLoaderProps`, a leftover from three's pre-`colorSpace` `encoding` API. That made the
|
|
1707
|
+
* type equivalent to the full props, so `colorSpace` was accepted and then dropped on the floor.
|
|
1708
|
+
*/
|
|
1709
|
+
type EnvironmentLoaderPreloadOptions = Omit<EnvironmentLoaderProps, 'colorSpace'>;
|
|
1904
1710
|
type EnvironmentLoaderClearOptions = Pick<EnvironmentLoaderProps, 'files' | 'preset'>;
|
|
1905
1711
|
|
|
1906
1712
|
/**
|
|
@@ -1944,9 +1750,9 @@ type EnvironmentProps = {
|
|
|
1944
1750
|
blur?: number;
|
|
1945
1751
|
backgroundBlurriness?: number;
|
|
1946
1752
|
backgroundIntensity?: number;
|
|
1947
|
-
backgroundRotation?: Euler
|
|
1753
|
+
backgroundRotation?: Euler;
|
|
1948
1754
|
environmentIntensity?: number;
|
|
1949
|
-
environmentRotation?: Euler
|
|
1755
|
+
environmentRotation?: Euler;
|
|
1950
1756
|
map?: Texture$1;
|
|
1951
1757
|
preset?: PresetsType;
|
|
1952
1758
|
scene?: Scene | React$1.RefObject<Scene>;
|
|
@@ -2030,7 +1836,7 @@ declare function EnvironmentCube({ background, scene, blur, backgroundBlurriness
|
|
|
2030
1836
|
declare function EnvironmentPortal({ children, near, far, resolution, frames, map, background, blur, backgroundBlurriness, backgroundIntensity, backgroundRotation, environmentIntensity, environmentRotation, scene, files, path, preset, extensions, }: EnvironmentProps): react_jsx_runtime.JSX.Element;
|
|
2031
1837
|
declare module '@react-three/fiber' {
|
|
2032
1838
|
interface ThreeElements {
|
|
2033
|
-
groundProjectedEnvImpl: ThreeElement
|
|
1839
|
+
groundProjectedEnvImpl: ThreeElement<typeof GroundedSkybox>;
|
|
2034
1840
|
}
|
|
2035
1841
|
}
|
|
2036
1842
|
/**
|
|
@@ -2130,6 +1936,24 @@ declare module '@react-three/fiber' {
|
|
|
2130
1936
|
*/
|
|
2131
1937
|
declare function Environment(props: EnvironmentProps): react_jsx_runtime.JSX.Element;
|
|
2132
1938
|
|
|
1939
|
+
/**
|
|
1940
|
+
* Moves every trace of interactivity from one object to its replacement, for reconstruction.
|
|
1941
|
+
*
|
|
1942
|
+
* When `args` or a `primitive`'s `object` changes, R3F builds a new three object and keeps the same
|
|
1943
|
+
* instance. Removing the old object from the interaction state and registering the new one from
|
|
1944
|
+
* scratch makes events *work* again (#3778), but it forgets what was in flight: a pointer resting on
|
|
1945
|
+
* the object fires a second `onPointerEnter` without ever having left, and an active pointer capture
|
|
1946
|
+
* is dropped mid-drag. Rewriting the references instead keeps the interaction continuous across a
|
|
1947
|
+
* swap the user never asked to see (#3744).
|
|
1948
|
+
*
|
|
1949
|
+
* Captures are re-keyed rather than released, so the DOM-level capture on `captureData.target` is
|
|
1950
|
+
* left alone — releasing and re-acquiring it is precisely the glitch being avoided.
|
|
1951
|
+
*
|
|
1952
|
+
* Visibility handlers are deliberately not transferred: that registry is keyed by `object.uuid`, so
|
|
1953
|
+
* the replacement re-registers itself through `applyProps`. The old entry is dropped here so it
|
|
1954
|
+
* cannot outlive the object it described.
|
|
1955
|
+
*/
|
|
1956
|
+
declare function swapInteractivity(store: RootStore, object: Object3D, newObject: Object3D): void;
|
|
2133
1957
|
declare function removeInteractivity(store: RootStore, object: Object3D): void;
|
|
2134
1958
|
declare function createEvents(store: RootStore): {
|
|
2135
1959
|
handlePointer: (name: string) => (event: DomEvent) => void;
|
|
@@ -2137,7 +1961,7 @@ declare function createEvents(store: RootStore): {
|
|
|
2137
1961
|
processDeferredPointer: (event: DomEvent, pointerId: number) => void;
|
|
2138
1962
|
};
|
|
2139
1963
|
/** Default R3F event manager for web */
|
|
2140
|
-
declare function createPointerEvents(store: RootStore): EventManager<
|
|
1964
|
+
declare function createPointerEvents(store: RootStore): EventManager<Element>;
|
|
2141
1965
|
|
|
2142
1966
|
/**
|
|
2143
1967
|
* Gets or creates a memoized loader instance from a loader constructor or returns the loader if it's already an instance.
|
|
@@ -2150,419 +1974,13 @@ declare function getLoader<L extends LoaderLike | ConstructorRepresentation<Load
|
|
|
2150
1974
|
* Note: this hook's caller must be wrapped with `React.Suspense`
|
|
2151
1975
|
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
|
|
2152
1976
|
*/
|
|
2153
|
-
declare function useLoader<I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, extensions?: Extensions<L>, onProgress?: (event: ProgressEvent<EventTarget>) => void): I extends any[] ? LoaderResult<L>[] : LoaderResult<L>;
|
|
1977
|
+
declare function useLoader<I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, extensions?: Extensions<L>, onProgress?: (event: ProgressEvent<EventTarget>) => void, cacheKey?: InputLike): I extends any[] ? LoaderResult<L>[] : LoaderResult<L>;
|
|
2154
1978
|
declare namespace useLoader {
|
|
2155
|
-
var preload: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, extensions?: Extensions<L>, onProgress?: (event: ProgressEvent<EventTarget>) => void) => void;
|
|
2156
|
-
var clear: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I) => void;
|
|
1979
|
+
var preload: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, extensions?: Extensions<L>, onProgress?: (event: ProgressEvent<EventTarget>) => void, cacheKey?: InputLike) => void;
|
|
1980
|
+
var clear: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, cacheKey?: InputLike) => void;
|
|
2157
1981
|
var loader: typeof getLoader;
|
|
2158
1982
|
}
|
|
2159
1983
|
|
|
2160
|
-
/**
|
|
2161
|
-
* Global Singleton Scheduler - manages the frame loop and job execution for ALL R3F roots.
|
|
2162
|
-
*
|
|
2163
|
-
* Features:
|
|
2164
|
-
* - Single RAF loop for entire application
|
|
2165
|
-
* - Root registration (multiple Canvas support)
|
|
2166
|
-
* - Global phases for addEffect/addAfterEffect (deprecated)
|
|
2167
|
-
* - Per-root job management with phases, priorities, FPS throttling
|
|
2168
|
-
* - onIdle callbacks for addTail (deprecated)
|
|
2169
|
-
* - Demand mode support via invalidate()
|
|
2170
|
-
*/
|
|
2171
|
-
declare class Scheduler {
|
|
2172
|
-
private static readonly INSTANCE_KEY;
|
|
2173
|
-
private static get instance();
|
|
2174
|
-
private static set instance(value);
|
|
2175
|
-
/**
|
|
2176
|
-
* Get the global scheduler instance (creates if doesn't exist).
|
|
2177
|
-
* Uses HMR data to preserve instance across hot reloads.
|
|
2178
|
-
* @returns {Scheduler} The singleton scheduler instance
|
|
2179
|
-
*/
|
|
2180
|
-
static get(): Scheduler;
|
|
2181
|
-
/**
|
|
2182
|
-
* Reset the singleton instance. Stops the loop and clears all state.
|
|
2183
|
-
* Primarily used for testing to ensure clean state between tests.
|
|
2184
|
-
* @returns {void}
|
|
2185
|
-
*/
|
|
2186
|
-
static reset(): void;
|
|
2187
|
-
private roots;
|
|
2188
|
-
private phaseGraph;
|
|
2189
|
-
private loopState;
|
|
2190
|
-
private stoppedTime;
|
|
2191
|
-
private nextRootIndex;
|
|
2192
|
-
private globalBeforeJobs;
|
|
2193
|
-
private globalAfterJobs;
|
|
2194
|
-
private nextGlobalIndex;
|
|
2195
|
-
private idleCallbacks;
|
|
2196
|
-
private nextJobIndex;
|
|
2197
|
-
private jobStateListeners;
|
|
2198
|
-
private pendingFrames;
|
|
2199
|
-
private _frameloop;
|
|
2200
|
-
private _independent;
|
|
2201
|
-
private errorHandler;
|
|
2202
|
-
private rootReadyCallbacks;
|
|
2203
|
-
get phases(): string[];
|
|
2204
|
-
get frameloop(): Frameloop;
|
|
2205
|
-
set frameloop(mode: Frameloop);
|
|
2206
|
-
get isRunning(): boolean;
|
|
2207
|
-
get isReady(): boolean;
|
|
2208
|
-
get independent(): boolean;
|
|
2209
|
-
set independent(value: boolean);
|
|
2210
|
-
constructor();
|
|
2211
|
-
/**
|
|
2212
|
-
* Register a root (Canvas) with the scheduler.
|
|
2213
|
-
* The first root to register starts the RAF loop (if frameloop='always').
|
|
2214
|
-
* @param {string} id - Unique identifier for this root
|
|
2215
|
-
* @param {RootOptions} [options] - Optional configuration with getState and onError callbacks
|
|
2216
|
-
* @returns {() => void} Unsubscribe function to remove this root
|
|
2217
|
-
*/
|
|
2218
|
-
registerRoot(id: string, options?: RootOptions): () => void;
|
|
2219
|
-
/**
|
|
2220
|
-
* Unregister a root from the scheduler.
|
|
2221
|
-
* Cleans up all job state listeners for this root's jobs.
|
|
2222
|
-
* The last root to unregister stops the RAF loop.
|
|
2223
|
-
* @param {string} id - The root ID to unregister
|
|
2224
|
-
* @returns {void}
|
|
2225
|
-
*/
|
|
2226
|
-
unregisterRoot(id: string): void;
|
|
2227
|
-
/**
|
|
2228
|
-
* Subscribe to be notified when a root becomes available.
|
|
2229
|
-
* Fires immediately if a root already exists.
|
|
2230
|
-
* @param {() => void} callback - Function called when first root registers
|
|
2231
|
-
* @returns {() => void} Unsubscribe function
|
|
2232
|
-
*/
|
|
2233
|
-
onRootReady(callback: () => void): () => void;
|
|
2234
|
-
/**
|
|
2235
|
-
* Notify all registered root-ready callbacks.
|
|
2236
|
-
* Called when the first root registers.
|
|
2237
|
-
* @returns {void}
|
|
2238
|
-
* @private
|
|
2239
|
-
*/
|
|
2240
|
-
private notifyRootReady;
|
|
2241
|
-
/**
|
|
2242
|
-
* Ensure a default root exists for independent mode.
|
|
2243
|
-
* Creates a minimal root with no state provider.
|
|
2244
|
-
* @returns {void}
|
|
2245
|
-
* @private
|
|
2246
|
-
*/
|
|
2247
|
-
private ensureDefaultRoot;
|
|
2248
|
-
/**
|
|
2249
|
-
* Trigger error handling for job errors.
|
|
2250
|
-
* Uses the bound error handler if available, otherwise logs to console.
|
|
2251
|
-
* @param {Error} error - The error to handle
|
|
2252
|
-
* @returns {void}
|
|
2253
|
-
*/
|
|
2254
|
-
triggerError(error: Error): void;
|
|
2255
|
-
/**
|
|
2256
|
-
* Add a named phase to the scheduler's execution order.
|
|
2257
|
-
* Marks all roots for rebuild to incorporate the new phase.
|
|
2258
|
-
* @param {string} name - The phase name (e.g., 'physics', 'postprocess')
|
|
2259
|
-
* @param {AddPhaseOptions} [options] - Positioning options (before/after other phases)
|
|
2260
|
-
* @returns {void}
|
|
2261
|
-
* @example
|
|
2262
|
-
* scheduler.addPhase('physics', { before: 'update' });
|
|
2263
|
-
* scheduler.addPhase('postprocess', { after: 'render' });
|
|
2264
|
-
*/
|
|
2265
|
-
addPhase(name: string, options?: AddPhaseOptions): void;
|
|
2266
|
-
/**
|
|
2267
|
-
* Check if a phase exists in the scheduler.
|
|
2268
|
-
* @param {string} name - The phase name to check
|
|
2269
|
-
* @returns {boolean} True if the phase exists
|
|
2270
|
-
*/
|
|
2271
|
-
hasPhase(name: string): boolean;
|
|
2272
|
-
/**
|
|
2273
|
-
* Register a global job that runs once per frame (not per-root).
|
|
2274
|
-
* Used internally by deprecated addEffect/addAfterEffect APIs.
|
|
2275
|
-
* @param {'before' | 'after'} phase - When to run: 'before' all roots or 'after' all roots
|
|
2276
|
-
* @param {string} id - Unique identifier for this global job
|
|
2277
|
-
* @param {(timestamp: number) => void} callback - Function called each frame with RAF timestamp
|
|
2278
|
-
* @returns {() => void} Unsubscribe function to remove this global job
|
|
2279
|
-
* @deprecated Use useFrame with phases instead
|
|
2280
|
-
*/
|
|
2281
|
-
registerGlobal(phase: 'before' | 'after', id: string, callback: (timestamp: number) => void): () => void;
|
|
2282
|
-
/**
|
|
2283
|
-
* Register an idle callback that fires when the loop stops.
|
|
2284
|
-
* Used internally by deprecated addTail API.
|
|
2285
|
-
* @param {(timestamp: number) => void} callback - Function called when loop becomes idle
|
|
2286
|
-
* @returns {() => void} Unsubscribe function to remove this idle callback
|
|
2287
|
-
* @deprecated Use demand mode with invalidate() instead
|
|
2288
|
-
*/
|
|
2289
|
-
onIdle(callback: (timestamp: number) => void): () => void;
|
|
2290
|
-
/**
|
|
2291
|
-
* Notify all registered idle callbacks.
|
|
2292
|
-
* Called when the loop stops in demand mode.
|
|
2293
|
-
* @param {number} timestamp - The RAF timestamp when idle occurred
|
|
2294
|
-
* @returns {void}
|
|
2295
|
-
* @private
|
|
2296
|
-
*/
|
|
2297
|
-
private notifyIdle;
|
|
2298
|
-
/**
|
|
2299
|
-
* Register a job (frame callback) with a specific root.
|
|
2300
|
-
* This is the core registration method used by useFrame internally.
|
|
2301
|
-
* @param {FrameNextCallback} callback - The function to call each frame
|
|
2302
|
-
* @param {JobOptions & { rootId?: string; system?: boolean }} [options] - Job configuration
|
|
2303
|
-
* @param {string} [options.rootId] - Target root ID (defaults to first registered root)
|
|
2304
|
-
* @param {string} [options.id] - Unique job ID (auto-generated if not provided)
|
|
2305
|
-
* @param {string} [options.phase] - Execution phase (defaults to 'update')
|
|
2306
|
-
* @param {number} [options.priority] - Priority within phase (higher = earlier, default 0)
|
|
2307
|
-
* @param {number} [options.fps] - FPS throttle limit
|
|
2308
|
-
* @param {boolean} [options.drop] - Drop frames when behind (default true)
|
|
2309
|
-
* @param {boolean} [options.enabled] - Whether job is active (default true)
|
|
2310
|
-
* @param {boolean} [options.system] - Internal flag for system jobs (not user-facing)
|
|
2311
|
-
* @returns {() => void} Unsubscribe function to remove this job
|
|
2312
|
-
*/
|
|
2313
|
-
register(callback: FrameNextCallback, options?: JobOptions & {
|
|
2314
|
-
rootId?: string;
|
|
2315
|
-
system?: boolean;
|
|
2316
|
-
}): () => void;
|
|
2317
|
-
/**
|
|
2318
|
-
* Unregister a job by its ID.
|
|
2319
|
-
* Searches all roots if rootId is not provided.
|
|
2320
|
-
* @param {string} id - The job ID to unregister
|
|
2321
|
-
* @param {string} [rootId] - Optional root ID to search (searches all if not provided)
|
|
2322
|
-
* @returns {void}
|
|
2323
|
-
*/
|
|
2324
|
-
unregister(id: string, rootId?: string): void;
|
|
2325
|
-
/**
|
|
2326
|
-
* Update a job's options dynamically.
|
|
2327
|
-
* Searches all roots to find the job by ID.
|
|
2328
|
-
* Phase/constraint changes trigger a rebuild of the sorted job list.
|
|
2329
|
-
* @param {string} id - The job ID to update
|
|
2330
|
-
* @param {Partial<JobOptions>} options - The options to update
|
|
2331
|
-
* @returns {void}
|
|
2332
|
-
*/
|
|
2333
|
-
updateJob(id: string, options: Partial<JobOptions>): void;
|
|
2334
|
-
/**
|
|
2335
|
-
* Check if a job is currently paused (disabled).
|
|
2336
|
-
* @param {string} id - The job ID to check
|
|
2337
|
-
* @returns {boolean} True if the job exists and is paused
|
|
2338
|
-
*/
|
|
2339
|
-
isJobPaused(id: string): boolean;
|
|
2340
|
-
/**
|
|
2341
|
-
* Subscribe to state changes for a specific job.
|
|
2342
|
-
* Listener is called when job is paused or resumed.
|
|
2343
|
-
* @param {string} id - The job ID to subscribe to
|
|
2344
|
-
* @param {() => void} listener - Callback invoked on state changes
|
|
2345
|
-
* @returns {() => void} Unsubscribe function
|
|
2346
|
-
*/
|
|
2347
|
-
subscribeJobState(id: string, listener: () => void): () => void;
|
|
2348
|
-
/**
|
|
2349
|
-
* Notify all listeners that a job's state has changed.
|
|
2350
|
-
* @param {string} id - The job ID that changed
|
|
2351
|
-
* @returns {void}
|
|
2352
|
-
* @private
|
|
2353
|
-
*/
|
|
2354
|
-
private notifyJobStateChange;
|
|
2355
|
-
/**
|
|
2356
|
-
* Pause a job by ID (sets enabled=false).
|
|
2357
|
-
* Notifies any subscribed state listeners.
|
|
2358
|
-
* @param {string} id - The job ID to pause
|
|
2359
|
-
* @returns {void}
|
|
2360
|
-
*/
|
|
2361
|
-
pauseJob(id: string): void;
|
|
2362
|
-
/**
|
|
2363
|
-
* Resume a paused job by ID (sets enabled=true).
|
|
2364
|
-
* Resets job timing to prevent frame accumulation.
|
|
2365
|
-
* Notifies any subscribed state listeners.
|
|
2366
|
-
* @param {string} id - The job ID to resume
|
|
2367
|
-
* @returns {void}
|
|
2368
|
-
*/
|
|
2369
|
-
resumeJob(id: string): void;
|
|
2370
|
-
/**
|
|
2371
|
-
* Start the requestAnimationFrame loop.
|
|
2372
|
-
* Resets timing state (elapsedTime, frameCount) on start.
|
|
2373
|
-
* No-op if already running.
|
|
2374
|
-
* @returns {void}
|
|
2375
|
-
*/
|
|
2376
|
-
start(): void;
|
|
2377
|
-
/**
|
|
2378
|
-
* Stop the requestAnimationFrame loop.
|
|
2379
|
-
* Cancels any pending RAF callback.
|
|
2380
|
-
* No-op if not running.
|
|
2381
|
-
* @returns {void}
|
|
2382
|
-
*/
|
|
2383
|
-
stop(): void;
|
|
2384
|
-
/**
|
|
2385
|
-
* Request frames to be rendered in demand mode.
|
|
2386
|
-
* Accumulates pending frames (capped at 60) and starts the loop if not running.
|
|
2387
|
-
* No-op if frameloop is not 'demand'.
|
|
2388
|
-
* @param {number} [frames=1] - Number of frames to request
|
|
2389
|
-
* @param {boolean} [stackFrames=false] - Whether to add frames to existing pending count
|
|
2390
|
-
* - `false` (default): Sets pending frames to the specified value (replaces existing count)
|
|
2391
|
-
* - `true`: Adds frames to existing pending count (useful for accumulating invalidations)
|
|
2392
|
-
* @returns {void}
|
|
2393
|
-
* @example
|
|
2394
|
-
* // Request a single frame render
|
|
2395
|
-
* scheduler.invalidate();
|
|
2396
|
-
*
|
|
2397
|
-
* @example
|
|
2398
|
-
* // Request 5 frames (e.g., for animations)
|
|
2399
|
-
* scheduler.invalidate(5);
|
|
2400
|
-
*
|
|
2401
|
-
* @example
|
|
2402
|
-
* // Set pending frames to exactly 3 (don't stack with existing)
|
|
2403
|
-
* scheduler.invalidate(3, false);
|
|
2404
|
-
*
|
|
2405
|
-
* @example
|
|
2406
|
-
* // Add 2 more frames to existing pending count
|
|
2407
|
-
* scheduler.invalidate(2, true);
|
|
2408
|
-
*/
|
|
2409
|
-
invalidate(frames?: number, stackFrames?: boolean): void;
|
|
2410
|
-
/**
|
|
2411
|
-
* Reset timing state for deterministic testing.
|
|
2412
|
-
* Preserves jobs and roots but resets lastTime, frameCount, elapsedTime, etc.
|
|
2413
|
-
* @returns {void}
|
|
2414
|
-
*/
|
|
2415
|
-
resetTiming(): void;
|
|
2416
|
-
/**
|
|
2417
|
-
* Manually execute a single frame for all roots.
|
|
2418
|
-
* Useful for frameloop='never' mode or testing scenarios.
|
|
2419
|
-
* @param {number} [timestamp] - Optional timestamp (defaults to performance.now())
|
|
2420
|
-
* @returns {void}
|
|
2421
|
-
* @example
|
|
2422
|
-
* // Manual control mode
|
|
2423
|
-
* scheduler.frameloop = 'never';
|
|
2424
|
-
* scheduler.step(); // Execute one frame
|
|
2425
|
-
*/
|
|
2426
|
-
step(timestamp?: number): void;
|
|
2427
|
-
/**
|
|
2428
|
-
* Manually execute a single job by its ID.
|
|
2429
|
-
* Useful for testing individual job callbacks in isolation.
|
|
2430
|
-
* @param {string} id - The job ID to step
|
|
2431
|
-
* @param {number} [timestamp] - Optional timestamp (defaults to performance.now())
|
|
2432
|
-
* @returns {void}
|
|
2433
|
-
*/
|
|
2434
|
-
stepJob(id: string, timestamp?: number): void;
|
|
2435
|
-
/**
|
|
2436
|
-
* Main RAF loop callback.
|
|
2437
|
-
* Executes frame, handles demand mode, and schedules next frame.
|
|
2438
|
-
* @param {number} timestamp - RAF timestamp in milliseconds
|
|
2439
|
-
* @returns {void}
|
|
2440
|
-
* @private
|
|
2441
|
-
*/
|
|
2442
|
-
private loop;
|
|
2443
|
-
/**
|
|
2444
|
-
* Execute a single frame across all roots.
|
|
2445
|
-
* Order: globalBefore → each root's jobs → globalAfter
|
|
2446
|
-
* @param {number} timestamp - RAF timestamp in milliseconds
|
|
2447
|
-
* @returns {void}
|
|
2448
|
-
* @private
|
|
2449
|
-
*/
|
|
2450
|
-
private executeFrame;
|
|
2451
|
-
/**
|
|
2452
|
-
* Run all global jobs from a job map.
|
|
2453
|
-
* Catches and logs errors without stopping execution.
|
|
2454
|
-
* @param {Map<string, GlobalJob>} jobs - The global jobs map to execute
|
|
2455
|
-
* @param {number} timestamp - RAF timestamp in milliseconds
|
|
2456
|
-
* @returns {void}
|
|
2457
|
-
* @private
|
|
2458
|
-
*/
|
|
2459
|
-
private runGlobalJobs;
|
|
2460
|
-
/**
|
|
2461
|
-
* Execute all jobs for a single root in sorted order.
|
|
2462
|
-
* Rebuilds sorted job list if needed, then dispatches each job.
|
|
2463
|
-
* Errors are caught and propagated via triggerError.
|
|
2464
|
-
* @param {RootEntry} root - The root entry to tick
|
|
2465
|
-
* @param {number} timestamp - RAF timestamp in milliseconds
|
|
2466
|
-
* @param {number} delta - Time since last frame in seconds
|
|
2467
|
-
* @returns {void}
|
|
2468
|
-
* @private
|
|
2469
|
-
*/
|
|
2470
|
-
private tickRoot;
|
|
2471
|
-
/**
|
|
2472
|
-
* Get the total number of registered jobs across all roots.
|
|
2473
|
-
* Includes both per-root jobs and global before/after jobs.
|
|
2474
|
-
* @returns {number} Total job count
|
|
2475
|
-
*/
|
|
2476
|
-
getJobCount(): number;
|
|
2477
|
-
/**
|
|
2478
|
-
* Get all registered job IDs across all roots.
|
|
2479
|
-
* Includes both per-root jobs and global before/after jobs.
|
|
2480
|
-
* @returns {string[]} Array of all job IDs
|
|
2481
|
-
*/
|
|
2482
|
-
getJobIds(): string[];
|
|
2483
|
-
/**
|
|
2484
|
-
* Get the number of registered roots (Canvas instances).
|
|
2485
|
-
* @returns {number} Number of registered roots
|
|
2486
|
-
*/
|
|
2487
|
-
getRootCount(): number;
|
|
2488
|
-
/**
|
|
2489
|
-
* Check if any user (non-system) jobs are registered in a specific phase.
|
|
2490
|
-
* Used by the default render job to know if a user has taken over rendering.
|
|
2491
|
-
*
|
|
2492
|
-
* @param phase The phase to check
|
|
2493
|
-
* @param rootId Optional root ID to check (checks all roots if not provided)
|
|
2494
|
-
* @returns true if any user jobs exist in the phase
|
|
2495
|
-
*/
|
|
2496
|
-
hasUserJobsInPhase(phase: string, rootId?: string): boolean;
|
|
2497
|
-
/**
|
|
2498
|
-
* Generate a unique root ID for automatic root registration.
|
|
2499
|
-
* @returns {string} A unique root ID in the format 'root_N'
|
|
2500
|
-
*/
|
|
2501
|
-
generateRootId(): string;
|
|
2502
|
-
/**
|
|
2503
|
-
* Generate a unique job ID.
|
|
2504
|
-
* @returns {string} A unique job ID in the format 'job_N'
|
|
2505
|
-
* @private
|
|
2506
|
-
*/
|
|
2507
|
-
private generateJobId;
|
|
2508
|
-
/**
|
|
2509
|
-
* Normalize before/after constraints to a Set.
|
|
2510
|
-
* Handles undefined, single string, or array inputs.
|
|
2511
|
-
* @param {string | string[] | undefined} value - The constraint value(s)
|
|
2512
|
-
* @returns {Set<string>} Normalized Set of constraint strings
|
|
2513
|
-
* @private
|
|
2514
|
-
*/
|
|
2515
|
-
private normalizeConstraints;
|
|
2516
|
-
}
|
|
2517
|
-
/**
|
|
2518
|
-
* Get the global scheduler instance.
|
|
2519
|
-
* Creates one if it doesn't exist.
|
|
2520
|
-
*/
|
|
2521
|
-
declare const getScheduler: () => Scheduler;
|
|
2522
|
-
|
|
2523
|
-
/**
|
|
2524
|
-
* Frame hook with phase-based ordering, priority, and FPS throttling.
|
|
2525
|
-
*
|
|
2526
|
-
* Works both inside and outside Canvas context:
|
|
2527
|
-
* - Inside Canvas: Full RootState (gl, scene, camera, etc.)
|
|
2528
|
-
* - Outside Canvas (waiting mode): Waits for Canvas to mount, then gets full state
|
|
2529
|
-
* - Outside Canvas (independent mode): Fires immediately with timing-only state
|
|
2530
|
-
*
|
|
2531
|
-
* Returns a controls object for manual stepping, pausing, and resuming.
|
|
2532
|
-
*
|
|
2533
|
-
* @param callback - Function called each frame with (state, delta). Optional if you only need scheduler access.
|
|
2534
|
-
* @param priorityOrOptions - Either a priority number (backwards compat) or options object
|
|
2535
|
-
* @returns Controls object with step(), stepAll(), pause(), resume(), isPaused, id, scheduler
|
|
2536
|
-
*
|
|
2537
|
-
* @example
|
|
2538
|
-
* // Simple priority (backwards compat)
|
|
2539
|
-
* useFrame((state, delta) => { ... }, 5)
|
|
2540
|
-
*
|
|
2541
|
-
* @example
|
|
2542
|
-
* // With phase-based ordering
|
|
2543
|
-
* useFrame((state, delta) => { ... }, { phase: 'physics' })
|
|
2544
|
-
*
|
|
2545
|
-
* @example
|
|
2546
|
-
* // Outside Canvas - waits for Canvas to mount
|
|
2547
|
-
* function UI() {
|
|
2548
|
-
* useFrame((state, delta) => { syncUI(state.camera) });
|
|
2549
|
-
* return <button>...</button>;
|
|
2550
|
-
* }
|
|
2551
|
-
*
|
|
2552
|
-
* @example
|
|
2553
|
-
* // Independent mode - no Canvas needed
|
|
2554
|
-
* getScheduler().independent = true;
|
|
2555
|
-
* useFrame((state, delta) => { updateGame(delta) });
|
|
2556
|
-
*
|
|
2557
|
-
* @example
|
|
2558
|
-
* // Scheduler-only access (no callback)
|
|
2559
|
-
* const { scheduler } = useFrame()
|
|
2560
|
-
* scheduler.pauseJob('some-job-id')
|
|
2561
|
-
*
|
|
2562
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useframe
|
|
2563
|
-
*/
|
|
2564
|
-
declare function useFrame(callback?: FrameNextCallback, priorityOrOptions?: number | UseFrameNextOptions): FrameNextControls;
|
|
2565
|
-
|
|
2566
1984
|
declare const IsObject: (url: unknown) => url is Record<string, string>;
|
|
2567
1985
|
type TextureArray<T> = T extends string[] ? Texture$1[] : never;
|
|
2568
1986
|
type TextureRecord<T> = T extends Record<string, string> ? {
|
|
@@ -2575,11 +1993,16 @@ type UseTextureOptions<Url extends string[] | string | Record<string, string>> =
|
|
|
2575
1993
|
/** Callback when texture(s) finish loading */
|
|
2576
1994
|
onLoad?: (texture: MappedTextureType<Url>) => void;
|
|
2577
1995
|
/**
|
|
2578
|
-
*
|
|
2579
|
-
* When true:
|
|
1996
|
+
* Register the texture(s) in R3F's global texture registry for access via useTextures().
|
|
1997
|
+
* When true (the default):
|
|
2580
1998
|
* - Textures persist until explicitly disposed
|
|
2581
|
-
* -
|
|
2582
|
-
*
|
|
1999
|
+
* - On mount, returns existing registered textures if available (preserving modifications like colorSpace)
|
|
2000
|
+
*
|
|
2001
|
+
* Reads are taken once at mount — a mounted `useTexture` does not re-render when the registry
|
|
2002
|
+
* changes. To react to registry swaps, use `useTextures(s => s.get(key))` instead.
|
|
2003
|
+
*
|
|
2004
|
+
* Pass `false` to opt out of registry enrollment entirely.
|
|
2005
|
+
* @default true
|
|
2583
2006
|
*/
|
|
2584
2007
|
cache?: boolean;
|
|
2585
2008
|
};
|
|
@@ -2603,15 +2026,18 @@ type UseTextureOptions<Url extends string[] | string | Record<string, string>> =
|
|
|
2603
2026
|
* normal: '/normal.png'
|
|
2604
2027
|
* })
|
|
2605
2028
|
*
|
|
2606
|
-
* //
|
|
2607
|
-
* //
|
|
2608
|
-
* const diffuse = useTexture('/diffuse.png'
|
|
2029
|
+
* // Textures are registered in the global registry by default — the same texture
|
|
2030
|
+
* // object is shared across components and modifications (colorSpace, wrapS, etc.) are preserved
|
|
2031
|
+
* const diffuse = useTexture('/diffuse.png')
|
|
2609
2032
|
* diffuse.colorSpace = THREE.SRGBColorSpace
|
|
2610
2033
|
*
|
|
2611
2034
|
* // Another component gets the SAME texture with colorSpace already set
|
|
2612
|
-
* const sameDiffuse = useTexture('/diffuse.png'
|
|
2035
|
+
* const sameDiffuse = useTexture('/diffuse.png')
|
|
2036
|
+
*
|
|
2037
|
+
* // Opt out of registry enrollment for a one-off texture
|
|
2038
|
+
* const scratch = useTexture('/scratch.png', { cache: false })
|
|
2613
2039
|
*
|
|
2614
|
-
* // Access
|
|
2040
|
+
* // Access the registry directly
|
|
2615
2041
|
* const { get } = useTextures()
|
|
2616
2042
|
* const cached = get('/diffuse.png')
|
|
2617
2043
|
* ```
|
|
@@ -2628,63 +2054,80 @@ declare const Texture: ({ children, input, onLoad, cache, }: {
|
|
|
2628
2054
|
cache?: boolean;
|
|
2629
2055
|
}) => react_jsx_runtime.JSX.Element;
|
|
2630
2056
|
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2057
|
+
/** Accepted shapes for a registry read: a single key, a list of keys, or a name→key map. */
|
|
2058
|
+
type TextureInput = string | string[] | Record<string, string>;
|
|
2059
|
+
/** Result of a `get()` read, mirroring the input shape. */
|
|
2060
|
+
type TextureResult<Input extends TextureInput> = Input extends string ? Texture$1 | undefined : Input extends string[] ? (Texture$1 | undefined)[] : {
|
|
2061
|
+
[K in keyof Input]: Texture$1 | undefined;
|
|
2634
2062
|
};
|
|
2063
|
+
/** Options for `dispose()`. */
|
|
2064
|
+
interface DisposeOptions {
|
|
2065
|
+
/** Dispose even if the texture still has active references (default false). */
|
|
2066
|
+
force?: boolean;
|
|
2067
|
+
}
|
|
2635
2068
|
interface UseTexturesReturn {
|
|
2636
|
-
/** Map
|
|
2637
|
-
|
|
2638
|
-
/**
|
|
2639
|
-
get
|
|
2640
|
-
/** Check
|
|
2641
|
-
has
|
|
2642
|
-
/**
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2069
|
+
/** The live registry Map (key → Texture). Treat as read-only. */
|
|
2070
|
+
readonly all: Map<string, Texture$1>;
|
|
2071
|
+
/** Read one texture, an array of textures, or a name→texture record (mirrors the input shape). */
|
|
2072
|
+
get<Input extends TextureInput>(input: Input): TextureResult<Input>;
|
|
2073
|
+
/** Check whether a key exists in the registry. */
|
|
2074
|
+
has(key: string): boolean;
|
|
2075
|
+
/**
|
|
2076
|
+
* Register a texture (or a record of textures) that has no URL — e.g. a render
|
|
2077
|
+
* target or procedural texture. URL-loaded textures are registered automatically
|
|
2078
|
+
* by `useTexture` (registry enrollment is on by default).
|
|
2079
|
+
*/
|
|
2080
|
+
add(key: string, texture: Texture$1): void;
|
|
2081
|
+
add(record: Record<string, Texture$1>): void;
|
|
2082
|
+
/**
|
|
2083
|
+
* Dispose a texture's GPU resources and remove it from the registry.
|
|
2084
|
+
* Refcount-aware: if the key is still in use by a mounted `useTexture` consumer it is
|
|
2085
|
+
* skipped (with a warning) unless `{ force: true }` is passed.
|
|
2086
|
+
* @returns true if disposed, false if skipped.
|
|
2087
|
+
*/
|
|
2088
|
+
dispose(key: string, options?: DisposeOptions): boolean;
|
|
2089
|
+
/** Dispose every texture in the registry and clear it. Use on scene teardown. */
|
|
2090
|
+
disposeAll(): void;
|
|
2656
2091
|
}
|
|
2657
2092
|
/**
|
|
2658
|
-
*
|
|
2093
|
+
* Reactive Texture registry — load once with `useTexture`, reach the textures from anywhere.
|
|
2659
2094
|
*
|
|
2660
|
-
*
|
|
2661
|
-
*
|
|
2095
|
+
* This is a registry of plain `Texture` objects (not TSL nodes), so the same texture can feed
|
|
2096
|
+
* a material map, a heightmap sampler, or anything else. It does **not** load — pair it with
|
|
2097
|
+
* `useTexture` for loading (registry enrollment is on by default); `useTextures` is for access and lifecycle.
|
|
2098
|
+
*
|
|
2099
|
+
* The returned handle is **reactive**: the calling component re-renders when the registry
|
|
2100
|
+
* changes. Pass a selector to scope the subscription to a single read.
|
|
2662
2101
|
*
|
|
2663
2102
|
* @example
|
|
2664
2103
|
* ```tsx
|
|
2665
|
-
*
|
|
2666
|
-
*
|
|
2667
|
-
* // Check if texture is already cached
|
|
2668
|
-
* if (!has('/textures/diffuse.png')) {
|
|
2669
|
-
* // Load with useTexture and cache: true, or manually add
|
|
2670
|
-
* const tex = useTexture('/textures/diffuse.png', { cache: true })
|
|
2671
|
-
* }
|
|
2104
|
+
* // Load + register once (anywhere in the tree) — registered by default
|
|
2105
|
+
* useTexture({ map: '/diffuse.jpg', normalMap: '/normal.jpg' })
|
|
2672
2106
|
*
|
|
2673
|
-
* //
|
|
2674
|
-
* const
|
|
2675
|
-
*
|
|
2107
|
+
* // Reach them from another component — record form lands straight into a material
|
|
2108
|
+
* const { map, normalMap } = useTextures().get({ map: '/diffuse.jpg', normalMap: '/normal.jpg' })
|
|
2109
|
+
* return <meshStandardMaterial map={map} normalMap={normalMap} />
|
|
2676
2110
|
*
|
|
2677
|
-
* //
|
|
2678
|
-
*
|
|
2111
|
+
* // A set of heightmaps at once
|
|
2112
|
+
* const [a, b, c] = useTextures().get(['/h0.png', '/h1.png', '/h2.png'])
|
|
2679
2113
|
*
|
|
2680
|
-
* //
|
|
2681
|
-
*
|
|
2114
|
+
* // Register a non-URL texture (render target / procedural)
|
|
2115
|
+
* useTextures().add('rt-main', renderTarget.texture)
|
|
2682
2116
|
*
|
|
2683
|
-
* //
|
|
2684
|
-
*
|
|
2117
|
+
* // Deliberate GPU cleanup (refcount-aware; force to override)
|
|
2118
|
+
* useTextures().dispose('/diffuse.jpg')
|
|
2119
|
+
* useTextures().disposeAll() // scene teardown
|
|
2685
2120
|
* ```
|
|
2121
|
+
*
|
|
2122
|
+
* @remarks
|
|
2123
|
+
* **Future expansion:** an imperative async loader (e.g. `await useTextures().load('/x.jpg')`) is
|
|
2124
|
+
* intentionally not included yet. It would let non-React code (loading screens, dynamic streaming)
|
|
2125
|
+
* populate the registry without Suspense, at the cost of putting loading back into this hook. It
|
|
2126
|
+
* will be added only if a concrete consumer needs imperative loading; for now, loading lives in
|
|
2127
|
+
* `useTexture`.
|
|
2686
2128
|
*/
|
|
2687
2129
|
declare function useTextures(): UseTexturesReturn;
|
|
2130
|
+
declare function useTextures<T>(selector: (registry: UseTexturesReturn) => T): T;
|
|
2688
2131
|
|
|
2689
2132
|
/**
|
|
2690
2133
|
* Creates a render target compatible with the current renderer.
|
|
@@ -2723,11 +2166,6 @@ declare function useRenderTarget(width: number, height: number, options?: Render
|
|
|
2723
2166
|
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usestore
|
|
2724
2167
|
*/
|
|
2725
2168
|
declare function useStore(): RootStore;
|
|
2726
|
-
/**
|
|
2727
|
-
* Accesses R3F's internal state, containing renderer, canvas, scene, etc.
|
|
2728
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#usethree
|
|
2729
|
-
*/
|
|
2730
|
-
declare function useThree<T = RootState>(selector?: (state: RootState) => T, equalityFn?: <T>(state: T, newState: T) => boolean): T;
|
|
2731
2169
|
/**
|
|
2732
2170
|
* Exposes an object's {@link Instance}.
|
|
2733
2171
|
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#useInstanceHandle
|
|
@@ -2803,7 +2241,10 @@ declare function addTail(callback: GlobalRenderCallback): () => void;
|
|
|
2803
2241
|
* Invalidates the view, requesting a frame to be rendered.
|
|
2804
2242
|
* In demand mode, this triggers the scheduler to run frames.
|
|
2805
2243
|
*
|
|
2806
|
-
*
|
|
2244
|
+
* With a state argument, only that root's jobs run on the requested frames; other
|
|
2245
|
+
* roots on 'demand' stay idle. Without one, every registered root is invalidated.
|
|
2246
|
+
*
|
|
2247
|
+
* @param state - Optional root state; targets the invalidation at that root
|
|
2807
2248
|
* @param frames - Number of frames to request (default: 1)
|
|
2808
2249
|
* @param stackFrames - If false, sets pendingFrames to frames. If true, adds to existing pendingFrames (default: false)
|
|
2809
2250
|
*
|
|
@@ -2814,14 +2255,16 @@ declare function invalidate(state?: RootState, frames?: number, stackFrames?: bo
|
|
|
2814
2255
|
* Advances the frameloop and runs render effects.
|
|
2815
2256
|
* Useful for when manually rendering via `frameloop="never"`.
|
|
2816
2257
|
*
|
|
2258
|
+
* With a state argument, only that root is stepped. Without one, every
|
|
2259
|
+
* registered root is stepped for backwards compatibility.
|
|
2260
|
+
*
|
|
2817
2261
|
* @param timestamp - The timestamp to use for this frame
|
|
2818
2262
|
* @param runGlobalEffects - Ignored (kept for backwards compat, global effects always run)
|
|
2819
|
-
* @param state -
|
|
2820
|
-
* @param frame - Ignored (kept for backwards compat)
|
|
2263
|
+
* @param state - Optional root state; targets the manual step at that root
|
|
2821
2264
|
*
|
|
2822
2265
|
* @see https://docs.pmnd.rs/react-three-fiber/api/additional-exports#advance
|
|
2823
2266
|
*/
|
|
2824
|
-
declare function advance(timestamp: number): void;
|
|
2267
|
+
declare function advance(timestamp: number, runGlobalEffects?: boolean, state?: RootState): void;
|
|
2825
2268
|
|
|
2826
2269
|
/* eslint-disable @definitelytyped/no-unnecessary-generics */
|
|
2827
2270
|
declare function ReactReconciler<
|
|
@@ -3866,6 +3309,7 @@ declare namespace ReactReconciler {
|
|
|
3866
3309
|
|
|
3867
3310
|
declare function extend<T extends ConstructorRepresentation>(objects: T): React$1.ExoticComponent<ThreeElement<T>>;
|
|
3868
3311
|
declare function extend<T extends Catalogue>(objects: T): void;
|
|
3312
|
+
declare function extend(objects: Record<string, unknown>): void;
|
|
3869
3313
|
declare const reconciler: ReactReconciler.Reconciler<RootStore, Instance<any>, void, Instance<any>, never, any>;
|
|
3870
3314
|
|
|
3871
3315
|
declare const isRenderer: (def: any) => boolean;
|
|
@@ -3892,11 +3336,6 @@ declare function flushSync<R>(fn: () => R): R;
|
|
|
3892
3336
|
declare const context: React$1.Context<RootStore>;
|
|
3893
3337
|
declare const createStore: (invalidate: (state?: RootState, frames?: number, stackFrames?: boolean) => void, advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState, frame?: XRFrame) => void) => RootStore;
|
|
3894
3338
|
|
|
3895
|
-
/**
|
|
3896
|
-
* Safely flush async effects when testing, simulating a legacy root.
|
|
3897
|
-
* @deprecated Import from React instead. import { act } from 'react'
|
|
3898
|
-
*/
|
|
3899
|
-
declare const act: typeof React$1.act;
|
|
3900
3339
|
/**
|
|
3901
3340
|
* An SSR-friendly useLayoutEffect.
|
|
3902
3341
|
*
|
|
@@ -4148,7 +3587,7 @@ declare function getInstanceProps<T = any>(pendingProps: Record<string, unknown>
|
|
|
4148
3587
|
declare function prepare<T = any>(target: T, root: RootStore, type: string, props: Instance<T>['props']): Instance<T>;
|
|
4149
3588
|
/**
|
|
4150
3589
|
* Triggers an update for an instance.
|
|
4151
|
-
*
|
|
3590
|
+
* Invalidates the frame if the root is in demand mode.
|
|
4152
3591
|
*
|
|
4153
3592
|
* @param instance - Instance to invalidate
|
|
4154
3593
|
*/
|
|
@@ -4314,29 +3753,44 @@ declare const hasConstructor: (object: unknown) => object is {
|
|
|
4314
3753
|
* Used to identify values that should be resolved from refs after mount.
|
|
4315
3754
|
*/
|
|
4316
3755
|
declare const FROM_REF: unique symbol;
|
|
3756
|
+
/** The marker `fromRef()` returns; resolved by the reconciler in `commitMount`. */
|
|
3757
|
+
interface FromRefMarker<T = unknown, R = T> {
|
|
3758
|
+
[FROM_REF]: React$1.RefObject<T | null>;
|
|
3759
|
+
/** Optional transform applied to the resolved ref before assignment. */
|
|
3760
|
+
transform?: (value: T) => R;
|
|
3761
|
+
}
|
|
4317
3762
|
/**
|
|
4318
3763
|
* Defers prop application until the referenced object is available.
|
|
4319
3764
|
* Useful for props like `target` that need sibling refs to be populated.
|
|
4320
3765
|
*
|
|
3766
|
+
* Only top-level props on a three element are resolved: a marker nested inside another value
|
|
3767
|
+
* (an array, an options object) is never seen. When the prop needs the sibling *wrapped* rather
|
|
3768
|
+
* than assigned as-is, pass a `transform`; it runs once the ref is populated and its result is
|
|
3769
|
+
* what gets assigned.
|
|
3770
|
+
*
|
|
4321
3771
|
* @param ref - React ref object to resolve at mount time
|
|
4322
|
-
* @
|
|
3772
|
+
* @param transform - Optional mapping from the resolved object to the value the prop expects
|
|
3773
|
+
* @returns A marker value that the reconciler resolves after mount
|
|
4323
3774
|
*
|
|
4324
3775
|
* @example
|
|
4325
3776
|
* const targetRef = useRef<THREE.Object3D>(null)
|
|
4326
3777
|
*
|
|
4327
3778
|
* <group ref={targetRef} position={[-3, -2, -15]} />
|
|
4328
3779
|
* <spotLight target={fromRef(targetRef)} intensity={100} />
|
|
3780
|
+
*
|
|
3781
|
+
* @example
|
|
3782
|
+
* // Wrap the sibling: a node material's lightsNode needs a LightsNode, not the light itself
|
|
3783
|
+
* <meshPhongNodeMaterial lightsNode={fromRef(lightRef, (light) => lights([light]))} />
|
|
4329
3784
|
*/
|
|
4330
3785
|
declare function fromRef<T>(ref: React$1.RefObject<T | null>): T;
|
|
3786
|
+
declare function fromRef<T, R>(ref: React$1.RefObject<T | null>, transform: (value: T) => R): R;
|
|
4331
3787
|
/**
|
|
4332
3788
|
* Type guard to check if a value is a fromRef marker.
|
|
4333
3789
|
*
|
|
4334
3790
|
* @param value - Value to check
|
|
4335
3791
|
* @returns True if value is a fromRef marker
|
|
4336
3792
|
*/
|
|
4337
|
-
declare function isFromRef(value: unknown): value is
|
|
4338
|
-
[FROM_REF]: React$1.RefObject<any>;
|
|
4339
|
-
};
|
|
3793
|
+
declare function isFromRef(value: unknown): value is FromRefMarker<any, unknown>;
|
|
4340
3794
|
|
|
4341
3795
|
/**
|
|
4342
3796
|
* Symbol marker for mount-only method calls.
|
|
@@ -4363,7 +3817,15 @@ declare const ONCE: unique symbol;
|
|
|
4363
3817
|
* // No arguments
|
|
4364
3818
|
* <geometry center={once()} />
|
|
4365
3819
|
*/
|
|
4366
|
-
declare function once<
|
|
3820
|
+
declare function once<A extends unknown[]>(...args: A): OnceValue<A>;
|
|
3821
|
+
/**
|
|
3822
|
+
* What `once(...args)` is typed as, so the marker is assignable to the prop it targets:
|
|
3823
|
+
* the single argument itself (`rotateX={once(angle)}`), the argument tuple for multi-argument
|
|
3824
|
+
* methods (`translate={once(x, y, z)}`), or `true` for a bare call (`center={once()}`).
|
|
3825
|
+
*
|
|
3826
|
+
* The runtime value is always the marker object; only the declared type follows the prop.
|
|
3827
|
+
*/
|
|
3828
|
+
type OnceValue<A extends unknown[]> = A extends [] ? true : A extends [infer Single] ? Single : A;
|
|
4367
3829
|
/**
|
|
4368
3830
|
* Type guard to check if a value is a once marker.
|
|
4369
3831
|
*
|
|
@@ -4374,11 +3836,8 @@ declare function isOnce(value: unknown): value is {
|
|
|
4374
3836
|
[ONCE]: any[] | true;
|
|
4375
3837
|
};
|
|
4376
3838
|
|
|
4377
|
-
/**
|
|
4378
|
-
|
|
4379
|
-
* @see https://docs.pmnd.rs/react-three-fiber/api/canvas
|
|
4380
|
-
*/
|
|
4381
|
-
declare function Canvas(props: CanvasProps): react_jsx_runtime.JSX.Element;
|
|
3839
|
+
/** Distinguishes a resource leaf from a nested resource scope. */
|
|
3840
|
+
type ResourceLeafGuard<T> = (value: unknown) => value is T;
|
|
4382
3841
|
|
|
4383
3842
|
/**
|
|
4384
3843
|
* ScopedStore - Type-safe wrapper for nested stores (uniforms, nodes)
|
|
@@ -4400,33 +3859,30 @@ declare function Canvas(props: CanvasProps): react_jsx_runtime.JSX.Element;
|
|
|
4400
3859
|
* ```
|
|
4401
3860
|
*/
|
|
4402
3861
|
|
|
4403
|
-
/** Keys reserved for methods (excluded from index signature) */
|
|
4404
|
-
type MethodKeys = 'scope' | 'has' | 'keys';
|
|
4405
3862
|
/**
|
|
4406
3863
|
* Type-safe wrapper interface for accessing nested store data.
|
|
4407
3864
|
* Property access returns `T` (assumes leaf node).
|
|
4408
3865
|
* Use `.scope(key)` for nested object access.
|
|
4409
3866
|
*
|
|
4410
|
-
* Uses mapped type with key filtering to exclude method names from index signature,
|
|
4411
|
-
* allowing methods to have their correct return types.
|
|
4412
3867
|
*/
|
|
4413
|
-
type
|
|
4414
|
-
/** Direct property access returns the leaf type T (method keys excluded) */
|
|
4415
|
-
readonly [K in string as K extends MethodKeys ? never : K]: T;
|
|
4416
|
-
} & {
|
|
3868
|
+
type ScopedStoreMethods<TLeaf> = {
|
|
4417
3869
|
/** Access a nested scope by key. Returns empty wrapper if scope doesn't exist. */
|
|
4418
|
-
scope(key: string): ScopedStoreType<
|
|
3870
|
+
scope<TScope extends Record<string, TLeaf> = Record<string, TLeaf>>(key: string): ScopedStoreType<TLeaf, TScope>;
|
|
4419
3871
|
/** Check if a key exists in the store */
|
|
4420
3872
|
has(key: string): boolean;
|
|
4421
3873
|
/** Get all keys in the store */
|
|
4422
3874
|
keys(): string[];
|
|
4423
3875
|
};
|
|
3876
|
+
type ScopedStoreType<TLeaf, TEntries extends Record<string, TLeaf> = Record<string, TLeaf>> = Readonly<TEntries> & ScopedStoreMethods<TLeaf>;
|
|
3877
|
+
interface ScopedStoreData<TLeaf> {
|
|
3878
|
+
[key: string]: TLeaf | ScopedStoreData<TLeaf>;
|
|
3879
|
+
}
|
|
4424
3880
|
/**
|
|
4425
3881
|
* Create a type-safe ScopedStore wrapper around store data.
|
|
4426
3882
|
* @param data - The raw store data (uniforms or nodes from RootState)
|
|
4427
3883
|
* @returns A ScopedStoreType wrapper with type-safe access
|
|
4428
3884
|
*/
|
|
4429
|
-
declare function createScopedStore<
|
|
3885
|
+
declare function createScopedStore<TLeaf>(data: ScopedStoreData<TLeaf>, isLeaf: ResourceLeafGuard<TLeaf>): ScopedStoreType<TLeaf>;
|
|
4430
3886
|
/**
|
|
4431
3887
|
* State type passed to creator functions with ScopedStore wrappers.
|
|
4432
3888
|
* Provides type-safe access to uniforms, nodes, buffers, and gpuStorage without manual casting.
|
|
@@ -4434,8 +3890,8 @@ declare function createScopedStore<T>(data: Record<string, any>): ScopedStoreTyp
|
|
|
4434
3890
|
type CreatorState = Omit<RootState, 'uniforms' | 'nodes' | 'buffers' | 'gpuStorage'> & {
|
|
4435
3891
|
/** Type-safe uniform access - property access returns UniformNode */
|
|
4436
3892
|
uniforms: ScopedStoreType<UniformNode>;
|
|
4437
|
-
/** Type-safe node access
|
|
4438
|
-
nodes: ScopedStoreType<
|
|
3893
|
+
/** Type-safe node access for real, callable, and legacy structural nodes */
|
|
3894
|
+
nodes: ScopedStoreType<NodeLike>;
|
|
4439
3895
|
/** Type-safe buffer access - property access returns BufferLike (TypedArrays, BufferAttributes, TSL nodes) */
|
|
4440
3896
|
buffers: ScopedStoreType<BufferLike>;
|
|
4441
3897
|
/** Type-safe GPU storage access - property access returns StorageLike (StorageTexture, TSL nodes) */
|
|
@@ -4451,22 +3907,26 @@ type ClearUniformsFn = (scope?: string) => void;
|
|
|
4451
3907
|
/** Function signature for rebuildUniforms util */
|
|
4452
3908
|
type RebuildUniformsFn = (scope?: string) => void;
|
|
4453
3909
|
/** Return type with utils included */
|
|
4454
|
-
type UniformsWithUtils<T extends UniformRecord = UniformRecord> = T & {
|
|
3910
|
+
type UniformsWithUtils<T extends UniformRecord | UniformStore = UniformRecord> = T & {
|
|
4455
3911
|
removeUniforms: RemoveUniformsFn;
|
|
4456
3912
|
clearUniforms: ClearUniformsFn;
|
|
4457
3913
|
rebuildUniforms: RebuildUniformsFn;
|
|
4458
3914
|
};
|
|
4459
|
-
declare function useUniforms(): UniformsWithUtils<
|
|
3915
|
+
declare function useUniforms<T extends UniformInputRecord>(creator: UniformCreator<T>): UniformsWithUtils<UniformNodesFor<T>>;
|
|
3916
|
+
declare function useUniforms<T extends UniformInputRecord>(creator: UniformCreator<T>, scope: string): UniformsWithUtils<UniformNodesFor<T>>;
|
|
3917
|
+
declare function useUniforms<T extends UniformInputRecord>(uniforms: T): UniformsWithUtils<UniformNodesFor<T>>;
|
|
3918
|
+
declare function useUniforms<T extends UniformInputRecord>(uniforms: T, scope: string): UniformsWithUtils<UniformNodesFor<T>>;
|
|
3919
|
+
declare function useUniforms(): UniformsWithUtils<UniformStore>;
|
|
4460
3920
|
declare function useUniforms(scope: string): UniformsWithUtils;
|
|
4461
|
-
declare function useUniforms<T extends UniformInputRecord>(
|
|
4462
|
-
declare function useUniforms<T extends UniformInputRecord>(creator: UniformCreator<T>, scope: string): UniformsWithUtils<UniformRecord<UniformNode>>;
|
|
4463
|
-
declare function useUniforms<T extends UniformInputRecord>(uniforms: T): UniformsWithUtils<UniformRecord<UniformNode>>;
|
|
4464
|
-
declare function useUniforms<T extends UniformInputRecord>(uniforms: T, scope: string): UniformsWithUtils<UniformRecord<UniformNode>>;
|
|
3921
|
+
declare function useUniforms<T extends UniformInputRecord>(scope?: string): UniformsWithUtils<UniformNodesFor<T>>;
|
|
4465
3922
|
/**
|
|
4466
3923
|
* Global rebuildUniforms function for HMR integration.
|
|
4467
|
-
*
|
|
3924
|
+
* Invalidates cached uniforms and increments _hmrVersion to trigger re-creation.
|
|
4468
3925
|
* Call this when HMR is detected to refresh all uniform creators.
|
|
4469
3926
|
*
|
|
3927
|
+
* Resolves to the primary store so shared TSL resources rebuild on the
|
|
3928
|
+
* authoritative store.
|
|
3929
|
+
*
|
|
4470
3930
|
* @param store - The R3F store (from useStore or context)
|
|
4471
3931
|
* @param scope - Optional scope to rebuild ('root' for root only, string for specific scope, undefined for all)
|
|
4472
3932
|
*/
|
|
@@ -4489,47 +3949,28 @@ declare function clearRootUniforms(set: ReturnType<typeof useStore>['setState'])
|
|
|
4489
3949
|
|
|
4490
3950
|
/**
|
|
4491
3951
|
* Supported uniform value types:
|
|
4492
|
-
* - Raw values: number, boolean, Vector2, Vector3, Vector4, Color, Matrix3, Matrix4
|
|
3952
|
+
* - Raw values: number, boolean, Vector2, Vector3, Vector4, Color, Matrix2, Matrix3, Matrix4
|
|
4493
3953
|
* - String colors: '#ff0000', 'red', 'rgb(255,0,0)' (auto-converted to Color)
|
|
4494
3954
|
* - TSL nodes: color(), vec3(), float(), etc. (for type casting)
|
|
4495
3955
|
* - UniformNode: existing uniforms (reused as-is)
|
|
4496
3956
|
*/
|
|
4497
|
-
type UniformValue = number | boolean | string | Vector2$1 | Vector3$1 | Vector4$1 | Color$2 | Matrix3$1 | Matrix4$1 | Node | UniformNode;
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
* - 0 → number
|
|
4501
|
-
* - true → boolean
|
|
4502
|
-
* - '#ff0000' → Color (string colors are converted to Color objects)
|
|
4503
|
-
* - Node → Node (TSL nodes passed through for uniform type casting)
|
|
4504
|
-
*/
|
|
4505
|
-
type Widen<T> = T extends number ? number : T extends boolean ? boolean : T extends string ? Color$2 : T;
|
|
4506
|
-
declare function useUniform<T extends UniformValue>(name: string): UniformNode<T>;
|
|
4507
|
-
declare function useUniform<T extends UniformValue>(name: string, value: T): UniformNode<Widen<T>>;
|
|
3957
|
+
type UniformValue = number | boolean | string | Vector2$1 | Vector3$1 | Vector4$1 | Color$2 | Matrix2 | Matrix3$1 | Matrix4$1 | Node | UniformNode;
|
|
3958
|
+
declare function useUniform<T extends UniformValue = UniformValue>(name: string): UniformNodeFor<T>;
|
|
3959
|
+
declare function useUniform<T extends UniformValue>(name: string, value: T): UniformNodeFor<T>;
|
|
4508
3960
|
|
|
4509
3961
|
/**
|
|
4510
|
-
*
|
|
4511
|
-
*
|
|
4512
|
-
*
|
|
4513
|
-
*
|
|
3962
|
+
* Every node representation a creator may return. The definition lives with the store types as
|
|
3963
|
+
* `NodeLike`, so the shape creators return and the shape `state.nodes` holds are one type by
|
|
3964
|
+
* construction: three's real `Node`, the callable proxy `Fn()` returns, or the legacy structural
|
|
3965
|
+
* `{ uuid, nodeType }` shape.
|
|
4514
3966
|
*/
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
/** label method for chaining - sets the node's label and returns self */
|
|
4519
|
-
label?: ((label: string) => TSLNodeLike) | string;
|
|
4520
|
-
setName?: (name: string) => this;
|
|
4521
|
-
}
|
|
4522
|
-
/** TSL node type - alias for compatibility */
|
|
3967
|
+
type TSLNodeLike = NodeLike;
|
|
3968
|
+
|
|
3969
|
+
/** Backward-compatible alias covering every accepted node representation. */
|
|
4523
3970
|
type TSLNode = TSLNodeLike;
|
|
4524
|
-
/**
|
|
4525
|
-
* A record of TSL nodes - allows mixed node types (OperatorNode, ConstNode, etc.)
|
|
4526
|
-
* Uses TSLNodeLike for broader compatibility with Three.js's TSL type definitions.
|
|
4527
|
-
*/
|
|
4528
|
-
type NodeRecord<T extends TSLNodeLike = TSLNodeLike> = Record<string, T>;
|
|
4529
3971
|
/**
|
|
4530
3972
|
* Creator function that returns a record of nodes.
|
|
4531
|
-
*
|
|
4532
|
-
* (e.g., { n: OperatorNode; color: ConstNode<Color> }) to pass type checking.
|
|
3973
|
+
* Exact creator return inference is preserved within the compatible node constraint.
|
|
4533
3974
|
*/
|
|
4534
3975
|
type NodeCreator<T extends Record<string, TSLNodeLike>> = (state: CreatorState) => T;
|
|
4535
3976
|
/** Function signature for removeNodes util */
|
|
@@ -4539,20 +3980,25 @@ type ClearNodesFn = (scope?: string) => void;
|
|
|
4539
3980
|
/** Function signature for rebuildNodes util */
|
|
4540
3981
|
type RebuildNodesFn = (scope?: string) => void;
|
|
4541
3982
|
/** Return type with utils included */
|
|
4542
|
-
type NodesWithUtils<T extends Record<string,
|
|
3983
|
+
type NodesWithUtils<T extends Record<string, unknown> = NodeRecord> = T & {
|
|
4543
3984
|
removeNodes: RemoveNodesFn;
|
|
4544
3985
|
clearNodes: ClearNodesFn;
|
|
4545
3986
|
rebuildNodes: RebuildNodesFn;
|
|
4546
3987
|
};
|
|
4547
|
-
declare function useNodes(): NodesWithUtils<
|
|
4548
|
-
declare function useNodes(scope: string): NodesWithUtils<
|
|
4549
|
-
declare function useNodes<T extends
|
|
4550
|
-
declare function useNodes<T extends
|
|
3988
|
+
declare function useNodes(): NodesWithUtils<NodeStore>;
|
|
3989
|
+
declare function useNodes(scope: string): NodesWithUtils<NodeRecord>;
|
|
3990
|
+
declare function useNodes<T extends NodeRecord>(scope?: string): NodesWithUtils<T>;
|
|
3991
|
+
declare function useNodes<T extends NodeRecord>(creator: NodeCreator<T>): NodesWithUtils<T>;
|
|
3992
|
+
declare function useNodes<T extends NodeRecord>(creator: NodeCreator<T>, scope: string): NodesWithUtils<T>;
|
|
3993
|
+
declare function useNodes(creatorOrScope?: NodeCreator<NodeRecord> | string, scope?: string): NodesWithUtils<Record<string, unknown>>;
|
|
4551
3994
|
/**
|
|
4552
3995
|
* Global rebuildNodes function for HMR integration.
|
|
4553
|
-
*
|
|
3996
|
+
* Invalidates cached nodes and increments _hmrVersion to trigger re-creation.
|
|
4554
3997
|
* Call this when HMR is detected to refresh all node creators.
|
|
4555
3998
|
*
|
|
3999
|
+
* Resolves to the primary store so shared TSL resources rebuild on the
|
|
4000
|
+
* authoritative store.
|
|
4001
|
+
*
|
|
4556
4002
|
* @param store - The R3F store (from useStore or context)
|
|
4557
4003
|
* @param scope - Optional scope to rebuild ('root' for root only, string for specific scope, undefined for all)
|
|
4558
4004
|
*/
|
|
@@ -4603,6 +4049,10 @@ type LocalNodeCreator<T extends Record<string, unknown>> = (state: CreatorState)
|
|
|
4603
4049
|
*/
|
|
4604
4050
|
declare function useLocalNodes<T extends Record<string, unknown>>(creator: LocalNodeCreator<T>): T;
|
|
4605
4051
|
|
|
4052
|
+
/**
|
|
4053
|
+
* A record of buffer-like values - allows mixed types (TypedArrays, BufferAttributes, TSL nodes)
|
|
4054
|
+
*/
|
|
4055
|
+
type BufferRecordType<T extends BufferLike = BufferLike> = Record<string, T>;
|
|
4606
4056
|
/**
|
|
4607
4057
|
* Creator function that returns a record of buffers.
|
|
4608
4058
|
* Receives CreatorState with access to existing buffers, gpuStorage, uniforms, nodes, etc.
|
|
@@ -4617,26 +4067,34 @@ type RebuildBuffersFn = (scope?: string) => void;
|
|
|
4617
4067
|
/** Function signature for disposeBuffers util - releases GPU resources */
|
|
4618
4068
|
type DisposeBuffersFn = (names: string | string[], scope?: string) => void;
|
|
4619
4069
|
/** Return type with utils included */
|
|
4620
|
-
type BuffersWithUtils<T extends
|
|
4070
|
+
type BuffersWithUtils<T extends BufferRecordType | BufferStore = BufferRecordType> = T & {
|
|
4621
4071
|
removeBuffers: RemoveBuffersFn;
|
|
4622
4072
|
clearBuffers: ClearBuffersFn;
|
|
4623
4073
|
rebuildBuffers: RebuildBuffersFn;
|
|
4624
4074
|
disposeBuffers: DisposeBuffersFn;
|
|
4625
4075
|
};
|
|
4626
|
-
declare function useBuffers(): BuffersWithUtils<
|
|
4076
|
+
declare function useBuffers(): BuffersWithUtils<BufferStore>;
|
|
4627
4077
|
declare function useBuffers(scope: string): BuffersWithUtils<Record<string, BufferLike>>;
|
|
4078
|
+
declare function useBuffers<T extends Record<string, BufferLike>>(scope?: string): BuffersWithUtils<T>;
|
|
4628
4079
|
declare function useBuffers<T extends Record<string, BufferLike>>(creator: BufferCreator<T>): BuffersWithUtils<T>;
|
|
4629
4080
|
declare function useBuffers<T extends Record<string, BufferLike>>(creator: BufferCreator<T>, scope: string): BuffersWithUtils<T>;
|
|
4630
4081
|
/**
|
|
4631
4082
|
* Global rebuildBuffers function for HMR integration.
|
|
4632
|
-
*
|
|
4083
|
+
* Invalidates cached buffers and increments _hmrVersion to trigger re-creation.
|
|
4633
4084
|
* Call this when HMR is detected to refresh all buffer creators.
|
|
4634
4085
|
*
|
|
4086
|
+
* Resolves to the primary store so shared TSL resources rebuild on the
|
|
4087
|
+
* authoritative store.
|
|
4088
|
+
*
|
|
4635
4089
|
* @param store - The R3F store (from useStore or context)
|
|
4636
4090
|
* @param scope - Optional scope to rebuild ('root' for root only, string for specific scope, undefined for all)
|
|
4637
4091
|
*/
|
|
4638
4092
|
declare function rebuildAllBuffers(store: ReturnType<typeof useStore>, scope?: string): void;
|
|
4639
4093
|
|
|
4094
|
+
/**
|
|
4095
|
+
* A record of storage-like values - allows mixed types (StorageTexture, Storage3DTexture, TSL nodes)
|
|
4096
|
+
*/
|
|
4097
|
+
type StorageRecordType<T extends StorageLike = StorageLike> = Record<string, T>;
|
|
4640
4098
|
/**
|
|
4641
4099
|
* Creator function that returns a record of GPU storage objects.
|
|
4642
4100
|
* Receives CreatorState with access to existing buffers, gpuStorage, uniforms, nodes, etc.
|
|
@@ -4651,26 +4109,47 @@ type RebuildStorageFn = (scope?: string) => void;
|
|
|
4651
4109
|
/** Function signature for disposeStorage util - releases GPU resources */
|
|
4652
4110
|
type DisposeStorageFn = (names: string | string[], scope?: string) => void;
|
|
4653
4111
|
/** Return type with utils included */
|
|
4654
|
-
type StorageWithUtils<T extends
|
|
4112
|
+
type StorageWithUtils<T extends StorageRecordType | StorageStore = StorageRecordType> = T & {
|
|
4655
4113
|
removeStorage: RemoveStorageFn;
|
|
4656
4114
|
clearStorage: ClearStorageFn;
|
|
4657
4115
|
rebuildStorage: RebuildStorageFn;
|
|
4658
4116
|
disposeStorage: DisposeStorageFn;
|
|
4659
4117
|
};
|
|
4660
|
-
declare function useGPUStorage(): StorageWithUtils<
|
|
4118
|
+
declare function useGPUStorage(): StorageWithUtils<StorageStore>;
|
|
4661
4119
|
declare function useGPUStorage(scope: string): StorageWithUtils<Record<string, StorageLike>>;
|
|
4120
|
+
declare function useGPUStorage<T extends Record<string, StorageLike>>(scope?: string): StorageWithUtils<T>;
|
|
4662
4121
|
declare function useGPUStorage<T extends Record<string, StorageLike>>(creator: StorageCreator<T>): StorageWithUtils<T>;
|
|
4663
4122
|
declare function useGPUStorage<T extends Record<string, StorageLike>>(creator: StorageCreator<T>, scope: string): StorageWithUtils<T>;
|
|
4664
4123
|
/**
|
|
4665
4124
|
* Global rebuildStorage function for HMR integration.
|
|
4666
|
-
*
|
|
4125
|
+
* Invalidates cached storage and increments _hmrVersion to trigger re-creation.
|
|
4667
4126
|
* Call this when HMR is detected to refresh all storage creators.
|
|
4668
4127
|
*
|
|
4128
|
+
* Resolves to the primary store so shared TSL resources rebuild on the
|
|
4129
|
+
* authoritative store.
|
|
4130
|
+
*
|
|
4669
4131
|
* @param store - The R3F store (from useStore or context)
|
|
4670
4132
|
* @param scope - Optional scope to rebuild ('root' for root only, string for specific scope, undefined for all)
|
|
4671
4133
|
*/
|
|
4672
4134
|
declare function rebuildAllStorage(store: ReturnType<typeof useStore>, scope?: string): void;
|
|
4673
4135
|
|
|
4136
|
+
/**
|
|
4137
|
+
* Re-export from core - useTextures is now a core R3F hook (a reactive Texture registry).
|
|
4138
|
+
*
|
|
4139
|
+
* This file maintains backwards compatibility for existing webgpu imports.
|
|
4140
|
+
*/
|
|
4141
|
+
|
|
4142
|
+
/**
|
|
4143
|
+
* @deprecated The registry now stores plain `Texture` objects, not TSL nodes. Use `Texture` directly.
|
|
4144
|
+
* Kept as an alias for backwards compatibility.
|
|
4145
|
+
*/
|
|
4146
|
+
type TextureEntry = Texture$1;
|
|
4147
|
+
/**
|
|
4148
|
+
* @deprecated The registry now stores plain `Texture` objects, not TSL nodes. Use `Texture` directly.
|
|
4149
|
+
* Kept as an alias for backwards compatibility.
|
|
4150
|
+
*/
|
|
4151
|
+
type TextureNode = Texture$1;
|
|
4152
|
+
|
|
4674
4153
|
interface TextureOperations {
|
|
4675
4154
|
add: (key: string, value: any) => void;
|
|
4676
4155
|
addMultiple: (items: Map<string, any> | Record<string, any>) => void;
|
|
@@ -4688,6 +4167,10 @@ declare function createTextureOperations(set: StoreApi<RootState>['setState']):
|
|
|
4688
4167
|
* - Callbacks receive full RootState for flexibility
|
|
4689
4168
|
* - No auto-cleanup on unmount - use reset() for explicit cleanup
|
|
4690
4169
|
* - Scene/camera changes trigger scenePass recreation
|
|
4170
|
+
* - A replaced scenePass is disposed once the new graph is installed, so rebuild() does not
|
|
4171
|
+
* strand its render target (and MRT attachments) on the GPU
|
|
4172
|
+
* - Any run that changes the output node sets RenderPipeline.needsUpdate, so rebuild() actually
|
|
4173
|
+
* recompiles instead of silently keeping the first compiled graph
|
|
4691
4174
|
*
|
|
4692
4175
|
* @param mainCB - Main callback to configure outputNode and create effect passes
|
|
4693
4176
|
* @param setupCB - Optional setup callback to configure MRT on scenePass
|
|
@@ -4765,5 +4248,32 @@ interface WebGPURootState extends Omit<RootState, 'renderer' | 'gl' | 'internal'
|
|
|
4765
4248
|
internal: WebGPUInternalState
|
|
4766
4249
|
}
|
|
4767
4250
|
|
|
4768
|
-
|
|
4769
|
-
|
|
4251
|
+
/**
|
|
4252
|
+
* @fileoverview WebGPU entry point - WebGPU only, no legacy WebGL
|
|
4253
|
+
*
|
|
4254
|
+
* This entry point is for apps that want to use ONLY WebGPURenderer.
|
|
4255
|
+
* Includes WebGPU-specific hooks (useUniforms, useNodes, useTextures).
|
|
4256
|
+
* Auto-extends THREE with WebGPU node materials (MeshBasicNodeMaterial, etc.)
|
|
4257
|
+
*
|
|
4258
|
+
* Usage:
|
|
4259
|
+
* import { Canvas, useFrame, useUniforms } from '@react-three/fiber/webgpu'
|
|
4260
|
+
*/
|
|
4261
|
+
|
|
4262
|
+
/** `useThree` narrowed to WebGPU state — `state.renderer` is a `WebGPURenderer`. */
|
|
4263
|
+
type UseThreeWebGPU = <T = WebGPURootState>(selector?: (state: WebGPURootState) => T, equalityFn?: <U>(state: U, newState: U) => boolean) => T;
|
|
4264
|
+
/** `useFrame` narrowed to WebGPU state — the callback's `state.renderer` is a `WebGPURenderer`. */
|
|
4265
|
+
type UseFrameWebGPU = (callback?: FrameCallback$1<WebGPURootState>, priorityOrOptions?: number | UseFrameNextOptions) => FrameNextControls;
|
|
4266
|
+
declare const useThree: UseThreeWebGPU;
|
|
4267
|
+
declare const useFrame: UseFrameWebGPU;
|
|
4268
|
+
|
|
4269
|
+
/** Canvas props on the WebGPU entry: `onCreated` receives `WebGPURootState`. */
|
|
4270
|
+
type WebGPUCanvasProps = Omit<CanvasProps, 'onCreated'> & {
|
|
4271
|
+
/** Callback after the canvas has rendered (but not yet committed); `state.renderer` is a `WebGPURenderer` */
|
|
4272
|
+
onCreated?: (state: WebGPURootState) => void;
|
|
4273
|
+
};
|
|
4274
|
+
|
|
4275
|
+
/** `Canvas` narrowed to WebGPU state — the same component, `onCreated` typed against `WebGPURootState`. */
|
|
4276
|
+
declare const Canvas: (props: WebGPUCanvasProps) => JSX.Element;
|
|
4277
|
+
|
|
4278
|
+
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 };
|
|
4279
|
+
export type { Act, Args, ArgsProp, AttachFnType, AttachType, BackgroundConfig, BackgroundProp, BaseRendererProps, Bridge, BufferCreator, BufferLike, BufferRecord, BufferStore, BuffersWithUtils, Camera, CameraProps, WebGPUCanvasProps as 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, FromRefMarker, 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, NodeRecord, NodeStore, NodesWithUtils, NonFunctionKeys, Object3DMethod, ObjectMap, OffscreenCanvas$1 as OffscreenCanvas, OnceValue, 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, TSLNodeLike, 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, WebGPUCanvasProps, WebGPUDefaultProps, WebGPUProps, WebGPUShadowConfig, XRManager, XRPointerConfig };
|