@react-three/fiber 10.0.0-canary.604355a → 10.0.0-canary.611635d
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 +2741 -3274
- package/dist/index.d.cts +312 -815
- package/dist/index.d.mts +312 -815
- package/dist/index.d.ts +312 -815
- package/dist/index.mjs +2546 -3078
- package/dist/legacy.cjs +2327 -2866
- package/dist/legacy.d.cts +313 -815
- package/dist/legacy.d.mts +313 -815
- package/dist/legacy.d.ts +313 -815
- package/dist/legacy.mjs +2494 -3032
- package/dist/webgpu/index.cjs +2593 -2985
- package/dist/webgpu/index.d.cts +428 -829
- package/dist/webgpu/index.d.mts +428 -829
- package/dist/webgpu/index.d.ts +428 -829
- package/dist/webgpu/index.mjs +2753 -3148
- 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.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as three_webgpu from 'three/webgpu';
|
|
2
|
-
import { RenderTarget, WebGPURenderer,
|
|
2
|
+
import { CubeRenderTarget, RenderTarget, WebGPURenderer, Node, StorageTexture, Data3DTexture, CanvasTarget, ShaderNodeObject, Euler as Euler$2, Color as Color$2, ColorRepresentation as ColorRepresentation$1, Layers as Layers$1, Raycaster, Intersection as Intersection$1, BufferGeometry, Matrix4 as Matrix4$1, Quaternion as Quaternion$1, Vector2 as Vector2$1, Vector3 as Vector3$1, Vector4 as Vector4$1, Matrix3 as Matrix3$1, Loader as Loader$1, ColorSpace, Texture as Texture$1, CubeTexture, Scene, Object3D, Frustum, OrthographicCamera, WebGPURendererParameters } from 'three/webgpu';
|
|
3
3
|
import { Inspector } from 'three/addons/inspector/Inspector.js';
|
|
4
4
|
import * as THREE$1 from 'three';
|
|
5
5
|
import { Color as Color$1, ColorRepresentation, Euler as Euler$1, Loader, RenderTargetOptions as RenderTargetOptions$1 } from 'three';
|
|
@@ -7,9 +7,10 @@ import * as React$1 from 'react';
|
|
|
7
7
|
import { ReactNode, Component, RefObject, JSX } from 'react';
|
|
8
8
|
import { StoreApi } from 'zustand';
|
|
9
9
|
import { UseBoundStoreWithEqualityFn } from 'zustand/traditional';
|
|
10
|
+
import { FrameTimingState, FrameCallback as FrameCallback$1, SchedulerApi, UseFrameNextOptions, FrameNextControls } from '@pmndrs/scheduler';
|
|
11
|
+
export { AddPhaseOptions, FrameControls, FrameNextControls, FrameTimingState, RootOptions, Scheduler, SchedulerApi, UseFrameNextOptions, UseFrameOptions, getScheduler } from '@pmndrs/scheduler';
|
|
10
12
|
import { Options } from 'react-use-measure';
|
|
11
13
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
12
|
-
import { ThreeElement as ThreeElement$1, Euler as Euler$3 } from '@react-three/fiber';
|
|
13
14
|
import { GroundedSkybox } from 'three/examples/jsm/objects/GroundedSkybox.js';
|
|
14
15
|
|
|
15
16
|
function _mergeNamespaces(n, m) {
|
|
@@ -47,12 +48,16 @@ type WebGLShadowMap = never;
|
|
|
47
48
|
|
|
48
49
|
declare const WebGLRenderTarget: any;
|
|
49
50
|
|
|
51
|
+
declare const WebGLCubeRenderTarget: any;
|
|
52
|
+
|
|
50
53
|
var THREE = /*#__PURE__*/_mergeNamespaces({
|
|
51
54
|
__proto__: null,
|
|
55
|
+
CubeRenderTargetCompat: CubeRenderTarget,
|
|
52
56
|
Inspector: Inspector,
|
|
53
57
|
R3F_BUILD_LEGACY: R3F_BUILD_LEGACY,
|
|
54
58
|
R3F_BUILD_WEBGPU: R3F_BUILD_WEBGPU,
|
|
55
59
|
RenderTargetCompat: RenderTarget,
|
|
60
|
+
WebGLCubeRenderTarget: WebGLCubeRenderTarget,
|
|
56
61
|
WebGLRenderTarget: WebGLRenderTarget,
|
|
57
62
|
WebGLRenderer: WebGLRenderer,
|
|
58
63
|
WebGLRendererParameters: WebGLRendererParameters,
|
|
@@ -151,6 +156,8 @@ interface IntersectionEvent<TSourceEvent> extends Intersection {
|
|
|
151
156
|
unprojectedPoint: THREE$1.Vector3
|
|
152
157
|
/** Normalized event coordinates */
|
|
153
158
|
pointer: THREE$1.Vector2
|
|
159
|
+
/** pointerId of the original event for multiple pointer events */
|
|
160
|
+
pointerId: number
|
|
154
161
|
/** Delta between first click and this event */
|
|
155
162
|
delta: number
|
|
156
163
|
/** The ray that pierced it */
|
|
@@ -227,6 +234,18 @@ interface EventHandlers {
|
|
|
227
234
|
type FilterFunction = (items: THREE$1.Intersection[], state: RootState) => THREE$1.Intersection[]
|
|
228
235
|
type ComputeFunction = (event: DomEvent, root: RootState, previous?: RootState) => void
|
|
229
236
|
|
|
237
|
+
/** Configuration for XR pointer registration (controllers/hands) */
|
|
238
|
+
interface XRPointerConfig {
|
|
239
|
+
/** Ray origin (updated each frame by XR system) */
|
|
240
|
+
ray: THREE$1.Ray
|
|
241
|
+
/** Optional: custom compute function for this pointer */
|
|
242
|
+
compute?: (state: RootState) => void
|
|
243
|
+
/** Pointer type identifier */
|
|
244
|
+
type: 'controller' | 'hand' | 'gaze'
|
|
245
|
+
/** Which hand (for controller/hand types) */
|
|
246
|
+
handedness?: 'left' | 'right'
|
|
247
|
+
}
|
|
248
|
+
|
|
230
249
|
interface EventManager<TTarget> {
|
|
231
250
|
/** Determines if the event layer is active */
|
|
232
251
|
enabled: boolean
|
|
@@ -246,8 +265,21 @@ interface EventManager<TTarget> {
|
|
|
246
265
|
disconnect?: () => void
|
|
247
266
|
/** Triggers a onPointerMove with the last known event. This can be useful to enable raycasting without
|
|
248
267
|
* explicit user interaction, for instance when the camera moves a hoverable object underneath the cursor.
|
|
268
|
+
* @param pointerId - Optional pointer ID to update specific pointer only
|
|
249
269
|
*/
|
|
250
|
-
update?: () => void
|
|
270
|
+
update?: (pointerId?: number) => void
|
|
271
|
+
/** Defer pointer move raycasting to frame start (default: true) */
|
|
272
|
+
frameTimedRaycasts?: boolean
|
|
273
|
+
/** Always fire raycaster immediately on scroll events (default: true) */
|
|
274
|
+
alwaysFireOnScroll?: boolean
|
|
275
|
+
/** Automatically re-raycast every frame to detect hover changes from moving objects/camera (default: false) */
|
|
276
|
+
updateOnFrame?: boolean
|
|
277
|
+
/** Flush deferred pointer raycasts. Called by scheduler at frame start (input phase). */
|
|
278
|
+
flush?: () => void
|
|
279
|
+
/** Register an XR pointer (controller/hand). Returns assigned pointerId */
|
|
280
|
+
registerPointer?: (config: XRPointerConfig) => number
|
|
281
|
+
/** Unregister an XR pointer */
|
|
282
|
+
unregisterPointer?: (pointerId: number) => void
|
|
251
283
|
}
|
|
252
284
|
|
|
253
285
|
interface PointerCaptureTarget {
|
|
@@ -267,227 +299,94 @@ interface VisibilityEntry {
|
|
|
267
299
|
}
|
|
268
300
|
|
|
269
301
|
//* Scheduler Types (useFrame) ==============================
|
|
302
|
+
//
|
|
303
|
+
// The generic, framework-agnostic scheduler types now live in @pmndrs/scheduler.
|
|
304
|
+
// This file re-exports them and layers r3f's RootState-aware frame state on top,
|
|
305
|
+
// so existing `#types` imports across the codebase keep resolving unchanged.
|
|
270
306
|
|
|
271
307
|
|
|
272
308
|
|
|
273
|
-
//
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* Options for useFrame hook
|
|
277
|
-
*/
|
|
278
|
-
interface UseFrameNextOptions {
|
|
279
|
-
/** Optional stable id for the job. Auto-generated if not provided */
|
|
280
|
-
id?: string
|
|
281
|
-
/** Named phase to run in. Default: 'update' */
|
|
282
|
-
phase?: string
|
|
283
|
-
/** Run before this phase or job id */
|
|
284
|
-
before?: string | string[]
|
|
285
|
-
/** Run after this phase or job id */
|
|
286
|
-
after?: string | string[]
|
|
287
|
-
/** Priority within phase. Higher runs first. Default: 0 */
|
|
288
|
-
priority?: number
|
|
289
|
-
/** Max frames per second for this job */
|
|
290
|
-
fps?: number
|
|
291
|
-
/** If true, skip frames when behind. If false, try to catch up. Default: true */
|
|
292
|
-
drop?: boolean
|
|
293
|
-
/** Enable/disable without unregistering. Default: true */
|
|
294
|
-
enabled?: boolean
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
/** Alias for UseFrameNextOptions */
|
|
298
|
-
type UseFrameOptions = UseFrameNextOptions
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* Options for addPhase
|
|
302
|
-
*/
|
|
303
|
-
interface AddPhaseOptions {
|
|
304
|
-
/** Insert this phase before the specified phase */
|
|
305
|
-
before?: string
|
|
306
|
-
/** Insert this phase after the specified phase */
|
|
307
|
-
after?: string
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
// Frame State --------------------------------
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* Timing-only state for independent/outside mode (no RootState)
|
|
314
|
-
*/
|
|
315
|
-
interface FrameTimingState {
|
|
316
|
-
/** High-resolution timestamp from RAF (ms) */
|
|
317
|
-
time: number
|
|
318
|
-
/** Time since last frame in seconds (for legacy compatibility with THREE.Clock) */
|
|
319
|
-
delta: number
|
|
320
|
-
/** Elapsed time since first frame in seconds (for legacy compatibility with THREE.Clock) */
|
|
321
|
-
elapsed: number
|
|
322
|
-
/** Incrementing frame counter */
|
|
323
|
-
frame: number
|
|
324
|
-
}
|
|
309
|
+
// Frame State (r3f-specific) --------------------------------
|
|
325
310
|
|
|
326
311
|
/**
|
|
327
|
-
* State passed to useFrame callbacks (extends RootState with timing)
|
|
312
|
+
* State passed to useFrame callbacks (extends RootState with timing).
|
|
328
313
|
*/
|
|
329
314
|
interface FrameNextState extends RootState, FrameTimingState {}
|
|
330
315
|
|
|
331
316
|
/** Alias for FrameNextState */
|
|
332
317
|
type FrameState = FrameNextState
|
|
333
318
|
|
|
334
|
-
//
|
|
319
|
+
// Callback Types (r3f-specific) --------------------------------
|
|
335
320
|
|
|
336
321
|
/**
|
|
337
|
-
*
|
|
322
|
+
* Callback function for useFrame. Receives the full r3f RootState plus timing.
|
|
338
323
|
*/
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
onError?: (error: Error) => void
|
|
344
|
-
}
|
|
324
|
+
type FrameNextCallback = FrameCallback$1<RootState>
|
|
325
|
+
|
|
326
|
+
/** Alias for FrameNextCallback */
|
|
327
|
+
type FrameCallback = FrameNextCallback
|
|
345
328
|
|
|
346
|
-
|
|
329
|
+
//* Buffer Types (useBuffers) ========================================
|
|
347
330
|
|
|
348
331
|
/**
|
|
349
|
-
*
|
|
332
|
+
* Buffer-like types for GPU compute and storage operations.
|
|
333
|
+
* Includes raw CPU arrays, Three.js buffer attributes, and TSL buffer nodes.
|
|
334
|
+
*
|
|
335
|
+
* @example
|
|
336
|
+
* ```tsx
|
|
337
|
+
* const { positions, velocities } = useBuffers(() => ({
|
|
338
|
+
* positions: instancedArray(count, 'vec3'), // StorageBufferNode
|
|
339
|
+
* velocities: new Float32Array(count * 3), // TypedArray
|
|
340
|
+
* }), 'particles')
|
|
341
|
+
* ```
|
|
350
342
|
*/
|
|
351
|
-
type
|
|
343
|
+
type BufferLike =
|
|
344
|
+
| Float32Array
|
|
345
|
+
| Uint32Array
|
|
346
|
+
| Int32Array
|
|
347
|
+
| Float64Array
|
|
348
|
+
| Uint8Array
|
|
349
|
+
| Int8Array
|
|
350
|
+
| Uint16Array
|
|
351
|
+
| Int16Array
|
|
352
|
+
| THREE$1.BufferAttribute // Base class for all buffer attributes
|
|
353
|
+
| Node // TSL buffer nodes (instancedArray, storage)
|
|
354
|
+
|
|
355
|
+
/** Flat record of buffer-like values (no nested scopes) */
|
|
356
|
+
type BufferRecord = Record<string, BufferLike>
|
|
352
357
|
|
|
353
|
-
/**
|
|
354
|
-
|
|
358
|
+
/**
|
|
359
|
+
* Buffer store that can contain both root-level buffers and scoped buffer objects.
|
|
360
|
+
* Structure: { positions: Float32Array, particles: { vel: StorageBufferNode } }
|
|
361
|
+
*/
|
|
362
|
+
type BufferStore = Record<string, BufferLike | BufferRecord>
|
|
355
363
|
|
|
356
|
-
|
|
364
|
+
//* Storage Types (useGPUStorage) ========================================
|
|
357
365
|
|
|
358
366
|
/**
|
|
359
|
-
*
|
|
367
|
+
* GPU storage types for texture-based storage operations.
|
|
368
|
+
* Includes Three.js storage textures and TSL storage texture nodes.
|
|
369
|
+
*
|
|
370
|
+
* @example
|
|
371
|
+
* ```tsx
|
|
372
|
+
* const { heightMap } = useGPUStorage(() => ({
|
|
373
|
+
* heightMap: new StorageTexture(512, 512),
|
|
374
|
+
* }), 'terrain')
|
|
375
|
+
* ```
|
|
360
376
|
*/
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
scheduler: SchedulerApi
|
|
366
|
-
/** Manually step this job only (bypasses FPS limiting) */
|
|
367
|
-
step(timestamp?: number): void
|
|
368
|
-
/** Manually step ALL jobs in the scheduler */
|
|
369
|
-
stepAll(timestamp?: number): void
|
|
370
|
-
/** Pause this job (set enabled=false) */
|
|
371
|
-
pause(): void
|
|
372
|
-
/** Resume this job (set enabled=true) */
|
|
373
|
-
resume(): void
|
|
374
|
-
/** Reactive paused state - automatically triggers re-render when changed */
|
|
375
|
-
isPaused: boolean
|
|
376
|
-
}
|
|
377
|
+
type StorageLike =
|
|
378
|
+
| StorageTexture // GPU storage texture
|
|
379
|
+
| Data3DTexture // 3D texture (can be used as storage)
|
|
380
|
+
| Node // TSL storage texture nodes (storageTexture)
|
|
377
381
|
|
|
378
|
-
/**
|
|
379
|
-
type
|
|
380
|
-
|
|
381
|
-
// Scheduler Interface --------------------------------
|
|
382
|
+
/** Flat record of storage-like values (no nested scopes) */
|
|
383
|
+
type StorageRecord = Record<string, StorageLike>
|
|
382
384
|
|
|
383
385
|
/**
|
|
384
|
-
*
|
|
386
|
+
* Storage store that can contain both root-level storage and scoped storage objects.
|
|
387
|
+
* Structure: { heightMap: StorageTexture, terrain: { normal: StorageTextureNode } }
|
|
385
388
|
*/
|
|
386
|
-
|
|
387
|
-
//* Phase Management --------------------------------
|
|
388
|
-
|
|
389
|
-
/** Add a named phase to the scheduler */
|
|
390
|
-
addPhase(name: string, options?: AddPhaseOptions): void
|
|
391
|
-
/** Get the ordered list of phase names */
|
|
392
|
-
readonly phases: string[]
|
|
393
|
-
/** Check if a phase exists */
|
|
394
|
-
hasPhase(name: string): boolean
|
|
395
|
-
|
|
396
|
-
//* Root Management --------------------------------
|
|
397
|
-
|
|
398
|
-
/** Register a root (Canvas) with the scheduler. Returns unsubscribe function. */
|
|
399
|
-
registerRoot(id: string, options?: RootOptions): () => void
|
|
400
|
-
/** Unregister a root */
|
|
401
|
-
unregisterRoot(id: string): void
|
|
402
|
-
/** Generate a unique root ID */
|
|
403
|
-
generateRootId(): string
|
|
404
|
-
/** Get the number of registered roots */
|
|
405
|
-
getRootCount(): number
|
|
406
|
-
/** Check if any root is registered and ready */
|
|
407
|
-
readonly isReady: boolean
|
|
408
|
-
/** Subscribe to root-ready event. Fires immediately if already ready. Returns unsubscribe. */
|
|
409
|
-
onRootReady(callback: () => void): () => void
|
|
410
|
-
|
|
411
|
-
//* Job Registration --------------------------------
|
|
412
|
-
|
|
413
|
-
/** Register a job with the scheduler (returns unsubscribe function) */
|
|
414
|
-
register(
|
|
415
|
-
callback: FrameNextCallback,
|
|
416
|
-
options?: {
|
|
417
|
-
id?: string
|
|
418
|
-
rootId?: string
|
|
419
|
-
phase?: string
|
|
420
|
-
before?: string | string[]
|
|
421
|
-
after?: string | string[]
|
|
422
|
-
priority?: number
|
|
423
|
-
fps?: number
|
|
424
|
-
drop?: boolean
|
|
425
|
-
enabled?: boolean
|
|
426
|
-
},
|
|
427
|
-
): () => void
|
|
428
|
-
/** Update a job's options */
|
|
429
|
-
updateJob(
|
|
430
|
-
id: string,
|
|
431
|
-
options: {
|
|
432
|
-
priority?: number
|
|
433
|
-
fps?: number
|
|
434
|
-
drop?: boolean
|
|
435
|
-
enabled?: boolean
|
|
436
|
-
phase?: string
|
|
437
|
-
before?: string | string[]
|
|
438
|
-
after?: string | string[]
|
|
439
|
-
},
|
|
440
|
-
): void
|
|
441
|
-
/** Unregister a job by ID */
|
|
442
|
-
unregister(id: string, rootId?: string): void
|
|
443
|
-
/** Get the number of registered jobs */
|
|
444
|
-
getJobCount(): number
|
|
445
|
-
/** Get all job IDs */
|
|
446
|
-
getJobIds(): string[]
|
|
447
|
-
|
|
448
|
-
//* Global Jobs (for legacy addEffect/addAfterEffect) --------------------------------
|
|
449
|
-
|
|
450
|
-
/** Register a global job (runs once per frame, not per-root). Returns unsubscribe function. */
|
|
451
|
-
registerGlobal(phase: 'before' | 'after', id: string, callback: (timestamp: number) => void): () => void
|
|
452
|
-
|
|
453
|
-
//* Idle Callbacks (for legacy addTail) --------------------------------
|
|
454
|
-
|
|
455
|
-
/** Register an idle callback (fires when loop stops). Returns unsubscribe function. */
|
|
456
|
-
onIdle(callback: (timestamp: number) => void): () => void
|
|
457
|
-
|
|
458
|
-
//* Frame Loop Control --------------------------------
|
|
459
|
-
|
|
460
|
-
/** Start the scheduler loop */
|
|
461
|
-
start(): void
|
|
462
|
-
/** Stop the scheduler loop */
|
|
463
|
-
stop(): void
|
|
464
|
-
/** Check if the scheduler is running */
|
|
465
|
-
readonly isRunning: boolean
|
|
466
|
-
/** Get/set the frameloop mode ('always', 'demand', 'never') */
|
|
467
|
-
frameloop: Frameloop
|
|
468
|
-
/** Independent mode - runs without Canvas, callbacks receive timing-only state */
|
|
469
|
-
independent: boolean
|
|
470
|
-
|
|
471
|
-
//* Manual Stepping --------------------------------
|
|
472
|
-
|
|
473
|
-
/** Manually step all jobs once (for frameloop='never' or testing) */
|
|
474
|
-
step(timestamp?: number): void
|
|
475
|
-
/** Manually step a single job by ID */
|
|
476
|
-
stepJob(id: string, timestamp?: number): void
|
|
477
|
-
/** Request frame(s) to be rendered (for frameloop='demand') */
|
|
478
|
-
invalidate(frames?: number): void
|
|
479
|
-
|
|
480
|
-
//* Per-Job Control --------------------------------
|
|
481
|
-
|
|
482
|
-
/** Check if a job is paused */
|
|
483
|
-
isJobPaused(id: string): boolean
|
|
484
|
-
/** Pause a job */
|
|
485
|
-
pauseJob(id: string): void
|
|
486
|
-
/** Resume a job */
|
|
487
|
-
resumeJob(id: string): void
|
|
488
|
-
/** Subscribe to job state changes (for reactive isPaused). Returns unsubscribe function. */
|
|
489
|
-
subscribeJobState(id: string, listener: () => void): () => void
|
|
490
|
-
}
|
|
389
|
+
type StorageStore = Record<string, StorageLike | StorageRecord>
|
|
491
390
|
|
|
492
391
|
//* Renderer Types ========================================
|
|
493
392
|
|
|
@@ -502,6 +401,18 @@ type Subscription = {
|
|
|
502
401
|
store: RootStore
|
|
503
402
|
}
|
|
504
403
|
|
|
404
|
+
/** Per-pointer state for multi-touch and XR support */
|
|
405
|
+
type PointerState = {
|
|
406
|
+
/** Objects currently hovered by this pointer */
|
|
407
|
+
hovered: Map<string, ThreeEvent<DomEvent>>
|
|
408
|
+
/** Objects capturing this pointer */
|
|
409
|
+
captured: Map<THREE$1.Object3D, PointerCaptureTarget>
|
|
410
|
+
/** Initial click position [x, y] */
|
|
411
|
+
initialClick: [x: number, y: number]
|
|
412
|
+
/** Objects hit on initial click */
|
|
413
|
+
initialHits: THREE$1.Object3D[]
|
|
414
|
+
}
|
|
415
|
+
|
|
505
416
|
type Dpr = number | [min: number, max: number]
|
|
506
417
|
|
|
507
418
|
interface Size {
|
|
@@ -543,12 +454,21 @@ interface Performance {
|
|
|
543
454
|
|
|
544
455
|
interface InternalState {
|
|
545
456
|
interaction: THREE$1.Object3D[]
|
|
546
|
-
hovered: Map<string, ThreeEvent<DomEvent>>
|
|
547
457
|
subscribers: Subscription[]
|
|
458
|
+
/** Per-pointer state (hover, capture, click tracking) - replaces hovered, capturedMap, initialClick, initialHits */
|
|
459
|
+
pointerMap: Map<number, PointerState>
|
|
460
|
+
/** Pointers needing raycast this frame (used with frameTimedRaycasts) */
|
|
461
|
+
pointerDirty: Map<number, DomEvent>
|
|
462
|
+
/** Last event received (for events.update() compatibility) */
|
|
463
|
+
lastEvent: React$1.RefObject<DomEvent | null>
|
|
464
|
+
/** @deprecated Use pointerMap.get(pointerId).hovered instead */
|
|
465
|
+
hovered: Map<string, ThreeEvent<DomEvent>>
|
|
466
|
+
/** @deprecated Use pointerMap.get(pointerId).captured instead */
|
|
548
467
|
capturedMap: Map<number, Map<THREE$1.Object3D, PointerCaptureTarget>>
|
|
468
|
+
/** @deprecated Use pointerMap.get(pointerId).initialClick instead */
|
|
549
469
|
initialClick: [x: number, y: number]
|
|
470
|
+
/** @deprecated Use pointerMap.get(pointerId).initialHits instead */
|
|
550
471
|
initialHits: THREE$1.Object3D[]
|
|
551
|
-
lastEvent: React$1.RefObject<DomEvent | null>
|
|
552
472
|
/** Visibility event registry (onFramed, onOccluded, onVisible) */
|
|
553
473
|
visibilityRegistry: Map<string, VisibilityEntry>
|
|
554
474
|
/** Whether occlusion queries are enabled (WebGPU only) */
|
|
@@ -581,7 +501,7 @@ interface InternalState {
|
|
|
581
501
|
canvasTarget?: CanvasTarget
|
|
582
502
|
/**
|
|
583
503
|
* Whether multi-canvas rendering is active.
|
|
584
|
-
* True when any canvas uses `
|
|
504
|
+
* True when any canvas uses `renderer={{ primaryCanvas: 'id' }}` to share a renderer.
|
|
585
505
|
* When true, setCanvasTarget is called before each render.
|
|
586
506
|
*/
|
|
587
507
|
isMultiCanvas?: boolean
|
|
@@ -679,8 +599,8 @@ interface RootState {
|
|
|
679
599
|
setSize: (width?: number, height?: number, top?: number, left?: number) => void
|
|
680
600
|
/** Shortcut to manual setting the pixel ratio */
|
|
681
601
|
setDpr: (dpr: Dpr) => void
|
|
682
|
-
/** Shortcut to setting frameloop flags */
|
|
683
|
-
setFrameloop: (frameloop
|
|
602
|
+
/** Shortcut to setting frameloop flags. No args resets to 'always'. */
|
|
603
|
+
setFrameloop: (frameloop?: Frameloop) => void
|
|
684
604
|
/** Set error state to propagate to error boundary */
|
|
685
605
|
setError: (error: Error | null) => void
|
|
686
606
|
/** Current error state (null when no error) */
|
|
@@ -689,11 +609,17 @@ interface RootState {
|
|
|
689
609
|
uniforms: UniformStore
|
|
690
610
|
/** Global TSL nodes - root-level nodes + scoped sub-objects. Use useNodes() hook */
|
|
691
611
|
nodes: Record<string, any>
|
|
692
|
-
/** Global TSL
|
|
693
|
-
|
|
694
|
-
/**
|
|
695
|
-
|
|
696
|
-
/** Global
|
|
612
|
+
/** Global TSL buffer nodes - root-level buffers + scoped sub-objects. Use useBuffers() hook */
|
|
613
|
+
buffers: BufferStore
|
|
614
|
+
/** Global GPU storage (textures, etc.) - root-level storage + scoped sub-objects. Use useGPUStorage() hook */
|
|
615
|
+
gpuStorage: StorageStore
|
|
616
|
+
/** Global Texture registry (key → Texture, usually keyed by URL) - use useTextures() hook for access + lifecycle */
|
|
617
|
+
textures: Map<string, THREE$1.Texture>
|
|
618
|
+
/** Internal: refcount per texture key, driven by mounted useTexture consumers (registry enrollment is on by default) */
|
|
619
|
+
_textureRefs: Map<string, number>
|
|
620
|
+
/** WebGPU RenderPipeline instance - use useRenderPipeline() hook */
|
|
621
|
+
renderPipeline: ThreeRenderPipeline | null
|
|
622
|
+
/** Global TSL pass nodes for render pipeline - use useRenderPipeline() hook */
|
|
697
623
|
passes: Record<string, any>
|
|
698
624
|
/** Internal version counter for HMR - incremented by rebuildNodes/rebuildUniforms to bust memoization */
|
|
699
625
|
_hmrVersion: number
|
|
@@ -743,6 +669,20 @@ interface Renderer {
|
|
|
743
669
|
render: (scene: THREE$1.Scene, camera: THREE$1.Camera) => any
|
|
744
670
|
}
|
|
745
671
|
|
|
672
|
+
//* Color Management Config ==============================
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* Color management configuration shared by both WebGL and WebGPU renderers.
|
|
676
|
+
*/
|
|
677
|
+
interface ColorManagementConfig {
|
|
678
|
+
/**
|
|
679
|
+
* Color space assigned to 8-bit input textures (color maps).
|
|
680
|
+
* Defaults to sRGB. Most textures are authored in sRGB.
|
|
681
|
+
* @default THREE.SRGBColorSpace
|
|
682
|
+
*/
|
|
683
|
+
textureColorSpace?: THREE$1.ColorSpace
|
|
684
|
+
}
|
|
685
|
+
|
|
746
686
|
//* WebGL Renderer Props ==============================
|
|
747
687
|
|
|
748
688
|
type DefaultGLProps = Omit<THREE$1.WebGLRendererParameters, 'canvas'> & {
|
|
@@ -753,7 +693,7 @@ type GLProps =
|
|
|
753
693
|
| Renderer
|
|
754
694
|
| ((defaultProps: DefaultGLProps) => Renderer)
|
|
755
695
|
| ((defaultProps: DefaultGLProps) => Promise<Renderer>)
|
|
756
|
-
| Partial<Properties<THREE$1.WebGLRenderer> | THREE$1.WebGLRendererParameters>
|
|
696
|
+
| (Partial<Properties<THREE$1.WebGLRenderer> | THREE$1.WebGLRendererParameters> & ColorManagementConfig)
|
|
757
697
|
|
|
758
698
|
//* WebGPU Renderer Props ==============================
|
|
759
699
|
|
|
@@ -779,9 +719,9 @@ interface CanvasSchedulerConfig {
|
|
|
779
719
|
}
|
|
780
720
|
|
|
781
721
|
/**
|
|
782
|
-
* Extended renderer configuration for multi-canvas support.
|
|
722
|
+
* Extended renderer configuration for multi-canvas support and color management.
|
|
783
723
|
*/
|
|
784
|
-
interface RendererConfigExtended {
|
|
724
|
+
interface RendererConfigExtended extends ColorManagementConfig {
|
|
785
725
|
/** Share renderer from another canvas (WebGPU only) */
|
|
786
726
|
primaryCanvas?: string
|
|
787
727
|
/** Canvas-level scheduler options */
|
|
@@ -846,8 +786,6 @@ interface RenderProps<TCanvas extends HTMLCanvasElement | OffscreenCanvas$1> {
|
|
|
846
786
|
* @see https://threejs.org/docs/#api/en/renderers/WebGLRenderer.shadowMap
|
|
847
787
|
*/
|
|
848
788
|
shadows?: boolean | 'basic' | 'percentage' | 'soft' | 'variance' | Partial<THREE$1.WebGLShadowMap>
|
|
849
|
-
/** Color space assigned to 8-bit input textures (color maps). Defaults to sRGB. Most textures are authored in sRGB. */
|
|
850
|
-
textureColorSpace?: THREE$1.ColorSpace
|
|
851
789
|
/** Creates an orthographic camera */
|
|
852
790
|
orthographic?: boolean
|
|
853
791
|
/**
|
|
@@ -973,8 +911,6 @@ interface Instance<O = any> {
|
|
|
973
911
|
attach?: AttachType<O>
|
|
974
912
|
previousAttach?: any
|
|
975
913
|
isHidden: boolean
|
|
976
|
-
/** Deferred ref props to apply in commitMount */
|
|
977
|
-
deferredRefs?: Array<{ prop: string; ref: React$1.RefObject<any> }>
|
|
978
914
|
/** Set of props that have been applied via once() */
|
|
979
915
|
appliedOnce?: Set<string>
|
|
980
916
|
}
|
|
@@ -1100,7 +1036,7 @@ interface CanvasProps
|
|
|
1100
1036
|
*/
|
|
1101
1037
|
resize?: Options
|
|
1102
1038
|
/** The target where events are being subscribed to, default: the div that wraps canvas */
|
|
1103
|
-
eventSource?: HTMLElement | React$1.RefObject<HTMLElement>
|
|
1039
|
+
eventSource?: HTMLElement | React$1.RefObject<HTMLElement | null>
|
|
1104
1040
|
/** The event prefix that is cast into canvas pointer x/y events, default: "offset" */
|
|
1105
1041
|
eventPrefix?: 'offset' | 'client' | 'page' | 'layer' | 'screen'
|
|
1106
1042
|
/** Enable/disable automatic HMR refresh for TSL nodes and uniforms, default: true in dev */
|
|
@@ -1211,10 +1147,21 @@ type RenderTargetOptions = RenderTargetOptions$1
|
|
|
1211
1147
|
//* Global Types ==============================
|
|
1212
1148
|
|
|
1213
1149
|
declare global {
|
|
1214
|
-
/**
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1150
|
+
/**
|
|
1151
|
+
* Uniform node type.
|
|
1152
|
+
*
|
|
1153
|
+
* This is three's own `UniformNode`, not a re-declaration of it. It previously was a
|
|
1154
|
+
* hand-rolled `interface UniformNode<T> extends Node { value: T }`, which shadowed the real
|
|
1155
|
+
* exported type globally — so R3F's ~58 references resolved to an approximation that was
|
|
1156
|
+
* missing members three actually ships (`setName` among them) and had drifted to the wrong
|
|
1157
|
+
* arity when three made `UniformNode` two-parameter.
|
|
1158
|
+
*
|
|
1159
|
+
* three's signature is `UniformNode<TNodeType, TValue>`. R3F only ever varies the value type,
|
|
1160
|
+
* so the node type is fixed to `unknown` and the single parameter is kept for call-site
|
|
1161
|
+
* ergonomics. The result is three's structural type, so members stay in sync with the
|
|
1162
|
+
* installed three instead of needing to be mirrored by hand.
|
|
1163
|
+
*/
|
|
1164
|
+
type UniformNode<T = unknown> = three_webgpu.UniformNode<unknown, T>
|
|
1218
1165
|
|
|
1219
1166
|
/**
|
|
1220
1167
|
* ShaderCallable - the return type of Fn()
|
|
@@ -1314,6 +1261,7 @@ declare global {
|
|
|
1314
1261
|
| three_webgpu.Euler
|
|
1315
1262
|
| three_webgpu.Quaternion
|
|
1316
1263
|
| { x: number; y?: number; z?: number; w?: number } // Plain objects converted to vectors
|
|
1264
|
+
| { r: number; g: number; b: number; a?: number } // Plain objects converted to Color
|
|
1317
1265
|
| Node // TSL nodes like color(), vec3(), float() for type casting
|
|
1318
1266
|
| UniformNode
|
|
1319
1267
|
|
|
@@ -1358,179 +1306,40 @@ declare module 'three/tsl' {
|
|
|
1358
1306
|
): ShaderCallable<R>
|
|
1359
1307
|
}
|
|
1360
1308
|
|
|
1361
|
-
/**
|
|
1362
|
-
* PostProcessing Types for usePostProcessing hook (WebGPU only)
|
|
1363
|
-
*/
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
1309
|
declare global {
|
|
1368
|
-
/**
|
|
1310
|
+
/**
|
|
1311
|
+
* three's own render pipeline type. Named here so the rest of R3F refers to three's shape
|
|
1312
|
+
* rather than `any`. three r183 renamed `PostProcessing` to `RenderPipeline`; our peer floor
|
|
1313
|
+
* is r185, so the new name is the only one.
|
|
1314
|
+
*/
|
|
1315
|
+
type ThreeRenderPipeline = three_webgpu.RenderPipeline
|
|
1316
|
+
|
|
1317
|
+
/** Pass record - stores TSL pass nodes for render pipeline */
|
|
1369
1318
|
type PassRecord = Record<string, any>
|
|
1370
1319
|
|
|
1371
1320
|
/** Setup callback - runs first to configure MRT, create additional passes */
|
|
1372
|
-
type
|
|
1321
|
+
type RenderPipelineSetupCallback = (state: RootState) => PassRecord | void
|
|
1373
1322
|
|
|
1374
1323
|
/** Main callback - runs second to configure outputNode, create effect passes */
|
|
1375
|
-
type
|
|
1324
|
+
type RenderPipelineMainCallback = (state: RootState) => PassRecord | void
|
|
1376
1325
|
|
|
1377
|
-
/** Return type for
|
|
1378
|
-
interface
|
|
1326
|
+
/** Return type for useRenderPipeline hook */
|
|
1327
|
+
interface UseRenderPipelineReturn {
|
|
1379
1328
|
/** Current passes from state */
|
|
1380
1329
|
passes: PassRecord
|
|
1381
|
-
/**
|
|
1382
|
-
|
|
1330
|
+
/** RenderPipeline instance (null if not initialized) */
|
|
1331
|
+
renderPipeline: ThreeRenderPipeline | null
|
|
1383
1332
|
/** Clear all passes from state */
|
|
1384
1333
|
clearPasses: () => void
|
|
1385
|
-
/** Reset
|
|
1334
|
+
/** Reset RenderPipeline entirely (clears PP + passes) */
|
|
1386
1335
|
reset: () => void
|
|
1387
1336
|
/** Re-run setup/main callbacks with current closure values */
|
|
1388
1337
|
rebuild: () => void
|
|
1389
|
-
/** True when
|
|
1338
|
+
/** True when RenderPipeline is configured and ready */
|
|
1390
1339
|
isReady: boolean
|
|
1391
1340
|
}
|
|
1392
1341
|
}
|
|
1393
1342
|
|
|
1394
|
-
//* useFrameNext Types ==============================
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
//* Global Type Declarations ==============================
|
|
1399
|
-
|
|
1400
|
-
declare global {
|
|
1401
|
-
// Job --------------------------------
|
|
1402
|
-
|
|
1403
|
-
/**
|
|
1404
|
-
* Internal job representation in the scheduler
|
|
1405
|
-
*/
|
|
1406
|
-
interface Job {
|
|
1407
|
-
/** Unique identifier */
|
|
1408
|
-
id: string
|
|
1409
|
-
/** The callback to execute */
|
|
1410
|
-
callback: FrameNextCallback
|
|
1411
|
-
/** Phase this job belongs to */
|
|
1412
|
-
phase: string
|
|
1413
|
-
/** Run before these phases/job ids */
|
|
1414
|
-
before: Set<string>
|
|
1415
|
-
/** Run after these phases/job ids */
|
|
1416
|
-
after: Set<string>
|
|
1417
|
-
/** Priority within phase (higher first) */
|
|
1418
|
-
priority: number
|
|
1419
|
-
/** Insertion order for deterministic tie-breaking */
|
|
1420
|
-
index: number
|
|
1421
|
-
/** Max FPS for this job (undefined = no limit) */
|
|
1422
|
-
fps?: number
|
|
1423
|
-
/** Drop frames when behind (true) or catch up (false) */
|
|
1424
|
-
drop: boolean
|
|
1425
|
-
/** Last run timestamp (ms) */
|
|
1426
|
-
lastRun?: number
|
|
1427
|
-
/** Whether job is enabled */
|
|
1428
|
-
enabled: boolean
|
|
1429
|
-
/** Internal flag: system jobs (like default render) don't block user render takeover */
|
|
1430
|
-
system?: boolean
|
|
1431
|
-
}
|
|
1432
|
-
|
|
1433
|
-
// Phase Graph --------------------------------
|
|
1434
|
-
|
|
1435
|
-
/**
|
|
1436
|
-
* A node in the phase graph
|
|
1437
|
-
*/
|
|
1438
|
-
interface PhaseNode {
|
|
1439
|
-
/** Phase name */
|
|
1440
|
-
name: string
|
|
1441
|
-
/** Whether this was auto-generated from a before/after constraint */
|
|
1442
|
-
isAutoGenerated: boolean
|
|
1443
|
-
}
|
|
1444
|
-
|
|
1445
|
-
/**
|
|
1446
|
-
* Options for creating a job from hook options
|
|
1447
|
-
*/
|
|
1448
|
-
interface JobOptions {
|
|
1449
|
-
id?: string
|
|
1450
|
-
phase?: string
|
|
1451
|
-
before?: string | string[]
|
|
1452
|
-
after?: string | string[]
|
|
1453
|
-
priority?: number
|
|
1454
|
-
fps?: number
|
|
1455
|
-
drop?: boolean
|
|
1456
|
-
enabled?: boolean
|
|
1457
|
-
}
|
|
1458
|
-
|
|
1459
|
-
// Frame Loop State --------------------------------
|
|
1460
|
-
|
|
1461
|
-
/**
|
|
1462
|
-
* Internal frame loop state
|
|
1463
|
-
*/
|
|
1464
|
-
interface FrameLoopState {
|
|
1465
|
-
/** Whether the loop is running */
|
|
1466
|
-
running: boolean
|
|
1467
|
-
/** Current RAF handle */
|
|
1468
|
-
rafHandle: number | null
|
|
1469
|
-
/** Last frame timestamp in ms (null = uninitialized) */
|
|
1470
|
-
lastTime: number | null
|
|
1471
|
-
/** Frame counter */
|
|
1472
|
-
frameCount: number
|
|
1473
|
-
/** Elapsed time since first frame in ms */
|
|
1474
|
-
elapsedTime: number
|
|
1475
|
-
/** createdAt timestamp in ms */
|
|
1476
|
-
createdAt: number
|
|
1477
|
-
}
|
|
1478
|
-
|
|
1479
|
-
// Root Entry --------------------------------
|
|
1480
|
-
|
|
1481
|
-
/**
|
|
1482
|
-
* Internal representation of a registered root (Canvas).
|
|
1483
|
-
* Tracks jobs and manages rebuild state for this root.
|
|
1484
|
-
* @internal
|
|
1485
|
-
*/
|
|
1486
|
-
interface RootEntry {
|
|
1487
|
-
/** Unique identifier for this root */
|
|
1488
|
-
id: string
|
|
1489
|
-
/** Function to get the root's current state. Returns any to support independent mode. */
|
|
1490
|
-
getState: () => any
|
|
1491
|
-
/** Map of job IDs to Job objects */
|
|
1492
|
-
jobs: Map<string, Job>
|
|
1493
|
-
/** Cached sorted job list for execution order */
|
|
1494
|
-
sortedJobs: Job[]
|
|
1495
|
-
/** Whether sortedJobs needs rebuilding */
|
|
1496
|
-
needsRebuild: boolean
|
|
1497
|
-
}
|
|
1498
|
-
|
|
1499
|
-
/**
|
|
1500
|
-
* Internal representation of a global job (deprecated API).
|
|
1501
|
-
* Global jobs run once per frame, not per-root.
|
|
1502
|
-
* Used by legacy addEffect/addAfterEffect APIs.
|
|
1503
|
-
* @internal
|
|
1504
|
-
* @deprecated Use useFrame with phases instead
|
|
1505
|
-
*/
|
|
1506
|
-
interface GlobalJob {
|
|
1507
|
-
/** Unique identifier for this global job */
|
|
1508
|
-
id: string
|
|
1509
|
-
/** Callback invoked with RAF timestamp in ms */
|
|
1510
|
-
callback: (timestamp: number) => void
|
|
1511
|
-
}
|
|
1512
|
-
|
|
1513
|
-
// HMR Support --------------------------------
|
|
1514
|
-
|
|
1515
|
-
/**
|
|
1516
|
-
* Hot Module Replacement data structure for preserving scheduler state
|
|
1517
|
-
* @internal
|
|
1518
|
-
*/
|
|
1519
|
-
interface HMRData {
|
|
1520
|
-
/** Shared data object for storing values across reloads */
|
|
1521
|
-
data: Record<string, any>
|
|
1522
|
-
/** Optional function to accept HMR updates */
|
|
1523
|
-
accept?: () => void
|
|
1524
|
-
}
|
|
1525
|
-
|
|
1526
|
-
// Default Phases --------------------------------
|
|
1527
|
-
|
|
1528
|
-
/**
|
|
1529
|
-
* Default phase names for the scheduler
|
|
1530
|
-
*/
|
|
1531
|
-
type DefaultPhase = 'start' | 'input' | 'physics' | 'update' | 'render' | 'finish'
|
|
1532
|
-
}
|
|
1533
|
-
|
|
1534
1343
|
type MutableOrReadonlyParameters<T extends (...args: any) => any> = Parameters<T> | Readonly<Parameters<T>>
|
|
1535
1344
|
|
|
1536
1345
|
interface MathRepresentation {
|
|
@@ -1700,7 +1509,7 @@ declare namespace three_d {
|
|
|
1700
1509
|
* a single WebGPURenderer using Three.js CanvasTarget API.
|
|
1701
1510
|
*
|
|
1702
1511
|
* Primary canvas: Has `id` prop, creates its own renderer, registers here
|
|
1703
|
-
* Secondary canvas: Has `
|
|
1512
|
+
* Secondary canvas: Has `renderer={{ primaryCanvas: 'id' }}`, shares primary's renderer via CanvasTarget
|
|
1704
1513
|
*/
|
|
1705
1514
|
|
|
1706
1515
|
interface PrimaryCanvasEntry {
|
|
@@ -1768,12 +1577,23 @@ type EnvironmentLoaderProps = {
|
|
|
1768
1577
|
* const texture = useEnvironment({ preset: 'sunset' })
|
|
1769
1578
|
* ```
|
|
1770
1579
|
*/
|
|
1771
|
-
declare function useEnvironment({ files, path, preset, colorSpace, extensions, }?: Partial<EnvironmentLoaderProps>): Texture$1<unknown> | CubeTexture
|
|
1580
|
+
declare function useEnvironment({ files, path, preset, colorSpace, extensions, }?: Partial<EnvironmentLoaderProps>): Texture$1<unknown, THREE$1.TextureEventMap> | CubeTexture<unknown>;
|
|
1772
1581
|
declare namespace useEnvironment {
|
|
1773
1582
|
var preload: (preloadOptions?: EnvironmentLoaderPreloadOptions) => void;
|
|
1774
1583
|
var clear: (clearOptions?: EnvironmentLoaderClearOptions) => void;
|
|
1775
1584
|
}
|
|
1776
|
-
|
|
1585
|
+
/**
|
|
1586
|
+
* Options accepted by `useEnvironment.preload`.
|
|
1587
|
+
*
|
|
1588
|
+
* `colorSpace` is deliberately omitted: preload only warms the loader cache, and colorSpace is
|
|
1589
|
+
* applied to the texture by `useEnvironment()` at use time, per consumer. Accepting it here would
|
|
1590
|
+
* advertise an option this function silently ignores.
|
|
1591
|
+
*
|
|
1592
|
+
* This previously read `Omit<…, 'encoding'>` — omitting a key that does not exist on
|
|
1593
|
+
* `EnvironmentLoaderProps`, a leftover from three's pre-`colorSpace` `encoding` API. That made the
|
|
1594
|
+
* type equivalent to the full props, so `colorSpace` was accepted and then dropped on the floor.
|
|
1595
|
+
*/
|
|
1596
|
+
type EnvironmentLoaderPreloadOptions = Omit<EnvironmentLoaderProps, 'colorSpace'>;
|
|
1777
1597
|
type EnvironmentLoaderClearOptions = Pick<EnvironmentLoaderProps, 'files' | 'preset'>;
|
|
1778
1598
|
|
|
1779
1599
|
/**
|
|
@@ -1817,9 +1637,9 @@ type EnvironmentProps = {
|
|
|
1817
1637
|
blur?: number;
|
|
1818
1638
|
backgroundBlurriness?: number;
|
|
1819
1639
|
backgroundIntensity?: number;
|
|
1820
|
-
backgroundRotation?: Euler
|
|
1640
|
+
backgroundRotation?: Euler;
|
|
1821
1641
|
environmentIntensity?: number;
|
|
1822
|
-
environmentRotation?: Euler
|
|
1642
|
+
environmentRotation?: Euler;
|
|
1823
1643
|
map?: Texture$1;
|
|
1824
1644
|
preset?: PresetsType;
|
|
1825
1645
|
scene?: Scene | React$1.RefObject<Scene>;
|
|
@@ -1903,7 +1723,7 @@ declare function EnvironmentCube({ background, scene, blur, backgroundBlurriness
|
|
|
1903
1723
|
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;
|
|
1904
1724
|
declare module '@react-three/fiber' {
|
|
1905
1725
|
interface ThreeElements {
|
|
1906
|
-
groundProjectedEnvImpl: ThreeElement
|
|
1726
|
+
groundProjectedEnvImpl: ThreeElement<typeof GroundedSkybox>;
|
|
1907
1727
|
}
|
|
1908
1728
|
}
|
|
1909
1729
|
/**
|
|
@@ -2003,9 +1823,29 @@ declare module '@react-three/fiber' {
|
|
|
2003
1823
|
*/
|
|
2004
1824
|
declare function Environment(props: EnvironmentProps): react_jsx_runtime.JSX.Element;
|
|
2005
1825
|
|
|
1826
|
+
/**
|
|
1827
|
+
* Moves every trace of interactivity from one object to its replacement, for reconstruction.
|
|
1828
|
+
*
|
|
1829
|
+
* When `args` or a `primitive`'s `object` changes, R3F builds a new three object and keeps the same
|
|
1830
|
+
* instance. Removing the old object from the interaction state and registering the new one from
|
|
1831
|
+
* scratch makes events *work* again (#3778), but it forgets what was in flight: a pointer resting on
|
|
1832
|
+
* the object fires a second `onPointerEnter` without ever having left, and an active pointer capture
|
|
1833
|
+
* is dropped mid-drag. Rewriting the references instead keeps the interaction continuous across a
|
|
1834
|
+
* swap the user never asked to see (#3744).
|
|
1835
|
+
*
|
|
1836
|
+
* Captures are re-keyed rather than released, so the DOM-level capture on `captureData.target` is
|
|
1837
|
+
* left alone — releasing and re-acquiring it is precisely the glitch being avoided.
|
|
1838
|
+
*
|
|
1839
|
+
* Visibility handlers are deliberately not transferred: that registry is keyed by `object.uuid`, so
|
|
1840
|
+
* the replacement re-registers itself through `applyProps`. The old entry is dropped here so it
|
|
1841
|
+
* cannot outlive the object it described.
|
|
1842
|
+
*/
|
|
1843
|
+
declare function swapInteractivity(store: RootStore, object: Object3D, newObject: Object3D): void;
|
|
2006
1844
|
declare function removeInteractivity(store: RootStore, object: Object3D): void;
|
|
2007
1845
|
declare function createEvents(store: RootStore): {
|
|
2008
1846
|
handlePointer: (name: string) => (event: DomEvent) => void;
|
|
1847
|
+
flushDeferredPointers: () => void;
|
|
1848
|
+
processDeferredPointer: (event: DomEvent, pointerId: number) => void;
|
|
2009
1849
|
};
|
|
2010
1850
|
/** Default R3F event manager for web */
|
|
2011
1851
|
declare function createPointerEvents(store: RootStore): EventManager<HTMLElement>;
|
|
@@ -2021,383 +1861,21 @@ declare function getLoader<L extends LoaderLike | ConstructorRepresentation<Load
|
|
|
2021
1861
|
* Note: this hook's caller must be wrapped with `React.Suspense`
|
|
2022
1862
|
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
|
|
2023
1863
|
*/
|
|
2024
|
-
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>;
|
|
1864
|
+
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>;
|
|
2025
1865
|
declare namespace useLoader {
|
|
2026
|
-
var preload: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, extensions?: Extensions<L>, onProgress?: (event: ProgressEvent<EventTarget>) => void) => void;
|
|
2027
|
-
var clear: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I) => void;
|
|
1866
|
+
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;
|
|
1867
|
+
var clear: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, cacheKey?: InputLike) => void;
|
|
2028
1868
|
var loader: typeof getLoader;
|
|
2029
1869
|
}
|
|
2030
1870
|
|
|
2031
|
-
/**
|
|
2032
|
-
* Global Singleton Scheduler - manages the frame loop and job execution for ALL R3F roots.
|
|
2033
|
-
*
|
|
2034
|
-
* Features:
|
|
2035
|
-
* - Single RAF loop for entire application
|
|
2036
|
-
* - Root registration (multiple Canvas support)
|
|
2037
|
-
* - Global phases for addEffect/addAfterEffect (deprecated)
|
|
2038
|
-
* - Per-root job management with phases, priorities, FPS throttling
|
|
2039
|
-
* - onIdle callbacks for addTail (deprecated)
|
|
2040
|
-
* - Demand mode support via invalidate()
|
|
2041
|
-
*/
|
|
2042
|
-
declare class Scheduler {
|
|
2043
|
-
private static readonly INSTANCE_KEY;
|
|
2044
|
-
private static get instance();
|
|
2045
|
-
private static set instance(value);
|
|
2046
|
-
/**
|
|
2047
|
-
* Get the global scheduler instance (creates if doesn't exist).
|
|
2048
|
-
* Uses HMR data to preserve instance across hot reloads.
|
|
2049
|
-
* @returns {Scheduler} The singleton scheduler instance
|
|
2050
|
-
*/
|
|
2051
|
-
static get(): Scheduler;
|
|
2052
|
-
/**
|
|
2053
|
-
* Reset the singleton instance. Stops the loop and clears all state.
|
|
2054
|
-
* Primarily used for testing to ensure clean state between tests.
|
|
2055
|
-
* @returns {void}
|
|
2056
|
-
*/
|
|
2057
|
-
static reset(): void;
|
|
2058
|
-
private roots;
|
|
2059
|
-
private phaseGraph;
|
|
2060
|
-
private loopState;
|
|
2061
|
-
private stoppedTime;
|
|
2062
|
-
private nextRootIndex;
|
|
2063
|
-
private globalBeforeJobs;
|
|
2064
|
-
private globalAfterJobs;
|
|
2065
|
-
private nextGlobalIndex;
|
|
2066
|
-
private idleCallbacks;
|
|
2067
|
-
private nextJobIndex;
|
|
2068
|
-
private jobStateListeners;
|
|
2069
|
-
private pendingFrames;
|
|
2070
|
-
private _frameloop;
|
|
2071
|
-
private _independent;
|
|
2072
|
-
private errorHandler;
|
|
2073
|
-
private rootReadyCallbacks;
|
|
2074
|
-
get phases(): string[];
|
|
2075
|
-
get frameloop(): Frameloop;
|
|
2076
|
-
set frameloop(mode: Frameloop);
|
|
2077
|
-
get isRunning(): boolean;
|
|
2078
|
-
get isReady(): boolean;
|
|
2079
|
-
get independent(): boolean;
|
|
2080
|
-
set independent(value: boolean);
|
|
2081
|
-
constructor();
|
|
2082
|
-
/**
|
|
2083
|
-
* Register a root (Canvas) with the scheduler.
|
|
2084
|
-
* The first root to register starts the RAF loop (if frameloop='always').
|
|
2085
|
-
* @param {string} id - Unique identifier for this root
|
|
2086
|
-
* @param {RootOptions} [options] - Optional configuration with getState and onError callbacks
|
|
2087
|
-
* @returns {() => void} Unsubscribe function to remove this root
|
|
2088
|
-
*/
|
|
2089
|
-
registerRoot(id: string, options?: RootOptions): () => void;
|
|
2090
|
-
/**
|
|
2091
|
-
* Unregister a root from the scheduler.
|
|
2092
|
-
* Cleans up all job state listeners for this root's jobs.
|
|
2093
|
-
* The last root to unregister stops the RAF loop.
|
|
2094
|
-
* @param {string} id - The root ID to unregister
|
|
2095
|
-
* @returns {void}
|
|
2096
|
-
*/
|
|
2097
|
-
unregisterRoot(id: string): void;
|
|
2098
|
-
/**
|
|
2099
|
-
* Subscribe to be notified when a root becomes available.
|
|
2100
|
-
* Fires immediately if a root already exists.
|
|
2101
|
-
* @param {() => void} callback - Function called when first root registers
|
|
2102
|
-
* @returns {() => void} Unsubscribe function
|
|
2103
|
-
*/
|
|
2104
|
-
onRootReady(callback: () => void): () => void;
|
|
2105
|
-
/**
|
|
2106
|
-
* Notify all registered root-ready callbacks.
|
|
2107
|
-
* Called when the first root registers.
|
|
2108
|
-
* @returns {void}
|
|
2109
|
-
* @private
|
|
2110
|
-
*/
|
|
2111
|
-
private notifyRootReady;
|
|
2112
|
-
/**
|
|
2113
|
-
* Ensure a default root exists for independent mode.
|
|
2114
|
-
* Creates a minimal root with no state provider.
|
|
2115
|
-
* @returns {void}
|
|
2116
|
-
* @private
|
|
2117
|
-
*/
|
|
2118
|
-
private ensureDefaultRoot;
|
|
2119
|
-
/**
|
|
2120
|
-
* Trigger error handling for job errors.
|
|
2121
|
-
* Uses the bound error handler if available, otherwise logs to console.
|
|
2122
|
-
* @param {Error} error - The error to handle
|
|
2123
|
-
* @returns {void}
|
|
2124
|
-
*/
|
|
2125
|
-
triggerError(error: Error): void;
|
|
2126
|
-
/**
|
|
2127
|
-
* Add a named phase to the scheduler's execution order.
|
|
2128
|
-
* Marks all roots for rebuild to incorporate the new phase.
|
|
2129
|
-
* @param {string} name - The phase name (e.g., 'physics', 'postprocess')
|
|
2130
|
-
* @param {AddPhaseOptions} [options] - Positioning options (before/after other phases)
|
|
2131
|
-
* @returns {void}
|
|
2132
|
-
* @example
|
|
2133
|
-
* scheduler.addPhase('physics', { before: 'update' });
|
|
2134
|
-
* scheduler.addPhase('postprocess', { after: 'render' });
|
|
2135
|
-
*/
|
|
2136
|
-
addPhase(name: string, options?: AddPhaseOptions): void;
|
|
2137
|
-
/**
|
|
2138
|
-
* Check if a phase exists in the scheduler.
|
|
2139
|
-
* @param {string} name - The phase name to check
|
|
2140
|
-
* @returns {boolean} True if the phase exists
|
|
2141
|
-
*/
|
|
2142
|
-
hasPhase(name: string): boolean;
|
|
2143
|
-
/**
|
|
2144
|
-
* Register a global job that runs once per frame (not per-root).
|
|
2145
|
-
* Used internally by deprecated addEffect/addAfterEffect APIs.
|
|
2146
|
-
* @param {'before' | 'after'} phase - When to run: 'before' all roots or 'after' all roots
|
|
2147
|
-
* @param {string} id - Unique identifier for this global job
|
|
2148
|
-
* @param {(timestamp: number) => void} callback - Function called each frame with RAF timestamp
|
|
2149
|
-
* @returns {() => void} Unsubscribe function to remove this global job
|
|
2150
|
-
* @deprecated Use useFrame with phases instead
|
|
2151
|
-
*/
|
|
2152
|
-
registerGlobal(phase: 'before' | 'after', id: string, callback: (timestamp: number) => void): () => void;
|
|
2153
|
-
/**
|
|
2154
|
-
* Register an idle callback that fires when the loop stops.
|
|
2155
|
-
* Used internally by deprecated addTail API.
|
|
2156
|
-
* @param {(timestamp: number) => void} callback - Function called when loop becomes idle
|
|
2157
|
-
* @returns {() => void} Unsubscribe function to remove this idle callback
|
|
2158
|
-
* @deprecated Use demand mode with invalidate() instead
|
|
2159
|
-
*/
|
|
2160
|
-
onIdle(callback: (timestamp: number) => void): () => void;
|
|
2161
|
-
/**
|
|
2162
|
-
* Notify all registered idle callbacks.
|
|
2163
|
-
* Called when the loop stops in demand mode.
|
|
2164
|
-
* @param {number} timestamp - The RAF timestamp when idle occurred
|
|
2165
|
-
* @returns {void}
|
|
2166
|
-
* @private
|
|
2167
|
-
*/
|
|
2168
|
-
private notifyIdle;
|
|
2169
|
-
/**
|
|
2170
|
-
* Register a job (frame callback) with a specific root.
|
|
2171
|
-
* This is the core registration method used by useFrame internally.
|
|
2172
|
-
* @param {FrameNextCallback} callback - The function to call each frame
|
|
2173
|
-
* @param {JobOptions & { rootId?: string; system?: boolean }} [options] - Job configuration
|
|
2174
|
-
* @param {string} [options.rootId] - Target root ID (defaults to first registered root)
|
|
2175
|
-
* @param {string} [options.id] - Unique job ID (auto-generated if not provided)
|
|
2176
|
-
* @param {string} [options.phase] - Execution phase (defaults to 'update')
|
|
2177
|
-
* @param {number} [options.priority] - Priority within phase (higher = earlier, default 0)
|
|
2178
|
-
* @param {number} [options.fps] - FPS throttle limit
|
|
2179
|
-
* @param {boolean} [options.drop] - Drop frames when behind (default true)
|
|
2180
|
-
* @param {boolean} [options.enabled] - Whether job is active (default true)
|
|
2181
|
-
* @param {boolean} [options.system] - Internal flag for system jobs (not user-facing)
|
|
2182
|
-
* @returns {() => void} Unsubscribe function to remove this job
|
|
2183
|
-
*/
|
|
2184
|
-
register(callback: FrameNextCallback, options?: JobOptions & {
|
|
2185
|
-
rootId?: string;
|
|
2186
|
-
system?: boolean;
|
|
2187
|
-
}): () => void;
|
|
2188
|
-
/**
|
|
2189
|
-
* Unregister a job by its ID.
|
|
2190
|
-
* Searches all roots if rootId is not provided.
|
|
2191
|
-
* @param {string} id - The job ID to unregister
|
|
2192
|
-
* @param {string} [rootId] - Optional root ID to search (searches all if not provided)
|
|
2193
|
-
* @returns {void}
|
|
2194
|
-
*/
|
|
2195
|
-
unregister(id: string, rootId?: string): void;
|
|
2196
|
-
/**
|
|
2197
|
-
* Update a job's options dynamically.
|
|
2198
|
-
* Searches all roots to find the job by ID.
|
|
2199
|
-
* Phase/constraint changes trigger a rebuild of the sorted job list.
|
|
2200
|
-
* @param {string} id - The job ID to update
|
|
2201
|
-
* @param {Partial<JobOptions>} options - The options to update
|
|
2202
|
-
* @returns {void}
|
|
2203
|
-
*/
|
|
2204
|
-
updateJob(id: string, options: Partial<JobOptions>): void;
|
|
2205
|
-
/**
|
|
2206
|
-
* Check if a job is currently paused (disabled).
|
|
2207
|
-
* @param {string} id - The job ID to check
|
|
2208
|
-
* @returns {boolean} True if the job exists and is paused
|
|
2209
|
-
*/
|
|
2210
|
-
isJobPaused(id: string): boolean;
|
|
2211
|
-
/**
|
|
2212
|
-
* Subscribe to state changes for a specific job.
|
|
2213
|
-
* Listener is called when job is paused or resumed.
|
|
2214
|
-
* @param {string} id - The job ID to subscribe to
|
|
2215
|
-
* @param {() => void} listener - Callback invoked on state changes
|
|
2216
|
-
* @returns {() => void} Unsubscribe function
|
|
2217
|
-
*/
|
|
2218
|
-
subscribeJobState(id: string, listener: () => void): () => void;
|
|
2219
|
-
/**
|
|
2220
|
-
* Notify all listeners that a job's state has changed.
|
|
2221
|
-
* @param {string} id - The job ID that changed
|
|
2222
|
-
* @returns {void}
|
|
2223
|
-
* @private
|
|
2224
|
-
*/
|
|
2225
|
-
private notifyJobStateChange;
|
|
2226
|
-
/**
|
|
2227
|
-
* Pause a job by ID (sets enabled=false).
|
|
2228
|
-
* Notifies any subscribed state listeners.
|
|
2229
|
-
* @param {string} id - The job ID to pause
|
|
2230
|
-
* @returns {void}
|
|
2231
|
-
*/
|
|
2232
|
-
pauseJob(id: string): void;
|
|
2233
|
-
/**
|
|
2234
|
-
* Resume a paused job by ID (sets enabled=true).
|
|
2235
|
-
* Resets job timing to prevent frame accumulation.
|
|
2236
|
-
* Notifies any subscribed state listeners.
|
|
2237
|
-
* @param {string} id - The job ID to resume
|
|
2238
|
-
* @returns {void}
|
|
2239
|
-
*/
|
|
2240
|
-
resumeJob(id: string): void;
|
|
2241
|
-
/**
|
|
2242
|
-
* Start the requestAnimationFrame loop.
|
|
2243
|
-
* Resets timing state (elapsedTime, frameCount) on start.
|
|
2244
|
-
* No-op if already running.
|
|
2245
|
-
* @returns {void}
|
|
2246
|
-
*/
|
|
2247
|
-
start(): void;
|
|
2248
|
-
/**
|
|
2249
|
-
* Stop the requestAnimationFrame loop.
|
|
2250
|
-
* Cancels any pending RAF callback.
|
|
2251
|
-
* No-op if not running.
|
|
2252
|
-
* @returns {void}
|
|
2253
|
-
*/
|
|
2254
|
-
stop(): void;
|
|
2255
|
-
/**
|
|
2256
|
-
* Request frames to be rendered in demand mode.
|
|
2257
|
-
* Accumulates pending frames (capped at 60) and starts the loop if not running.
|
|
2258
|
-
* No-op if frameloop is not 'demand'.
|
|
2259
|
-
* @param {number} [frames=1] - Number of frames to request
|
|
2260
|
-
* @param {boolean} [stackFrames=false] - Whether to add frames to existing pending count
|
|
2261
|
-
* - `false` (default): Sets pending frames to the specified value (replaces existing count)
|
|
2262
|
-
* - `true`: Adds frames to existing pending count (useful for accumulating invalidations)
|
|
2263
|
-
* @returns {void}
|
|
2264
|
-
* @example
|
|
2265
|
-
* // Request a single frame render
|
|
2266
|
-
* scheduler.invalidate();
|
|
2267
|
-
*
|
|
2268
|
-
* @example
|
|
2269
|
-
* // Request 5 frames (e.g., for animations)
|
|
2270
|
-
* scheduler.invalidate(5);
|
|
2271
|
-
*
|
|
2272
|
-
* @example
|
|
2273
|
-
* // Set pending frames to exactly 3 (don't stack with existing)
|
|
2274
|
-
* scheduler.invalidate(3, false);
|
|
2275
|
-
*
|
|
2276
|
-
* @example
|
|
2277
|
-
* // Add 2 more frames to existing pending count
|
|
2278
|
-
* scheduler.invalidate(2, true);
|
|
2279
|
-
*/
|
|
2280
|
-
invalidate(frames?: number, stackFrames?: boolean): void;
|
|
2281
|
-
/**
|
|
2282
|
-
* Reset timing state for deterministic testing.
|
|
2283
|
-
* Preserves jobs and roots but resets lastTime, frameCount, elapsedTime, etc.
|
|
2284
|
-
* @returns {void}
|
|
2285
|
-
*/
|
|
2286
|
-
resetTiming(): void;
|
|
2287
|
-
/**
|
|
2288
|
-
* Manually execute a single frame for all roots.
|
|
2289
|
-
* Useful for frameloop='never' mode or testing scenarios.
|
|
2290
|
-
* @param {number} [timestamp] - Optional timestamp (defaults to performance.now())
|
|
2291
|
-
* @returns {void}
|
|
2292
|
-
* @example
|
|
2293
|
-
* // Manual control mode
|
|
2294
|
-
* scheduler.frameloop = 'never';
|
|
2295
|
-
* scheduler.step(); // Execute one frame
|
|
2296
|
-
*/
|
|
2297
|
-
step(timestamp?: number): void;
|
|
2298
|
-
/**
|
|
2299
|
-
* Manually execute a single job by its ID.
|
|
2300
|
-
* Useful for testing individual job callbacks in isolation.
|
|
2301
|
-
* @param {string} id - The job ID to step
|
|
2302
|
-
* @param {number} [timestamp] - Optional timestamp (defaults to performance.now())
|
|
2303
|
-
* @returns {void}
|
|
2304
|
-
*/
|
|
2305
|
-
stepJob(id: string, timestamp?: number): void;
|
|
2306
|
-
/**
|
|
2307
|
-
* Main RAF loop callback.
|
|
2308
|
-
* Executes frame, handles demand mode, and schedules next frame.
|
|
2309
|
-
* @param {number} timestamp - RAF timestamp in milliseconds
|
|
2310
|
-
* @returns {void}
|
|
2311
|
-
* @private
|
|
2312
|
-
*/
|
|
2313
|
-
private loop;
|
|
2314
|
-
/**
|
|
2315
|
-
* Execute a single frame across all roots.
|
|
2316
|
-
* Order: globalBefore → each root's jobs → globalAfter
|
|
2317
|
-
* @param {number} timestamp - RAF timestamp in milliseconds
|
|
2318
|
-
* @returns {void}
|
|
2319
|
-
* @private
|
|
2320
|
-
*/
|
|
2321
|
-
private executeFrame;
|
|
2322
|
-
/**
|
|
2323
|
-
* Run all global jobs from a job map.
|
|
2324
|
-
* Catches and logs errors without stopping execution.
|
|
2325
|
-
* @param {Map<string, GlobalJob>} jobs - The global jobs map to execute
|
|
2326
|
-
* @param {number} timestamp - RAF timestamp in milliseconds
|
|
2327
|
-
* @returns {void}
|
|
2328
|
-
* @private
|
|
2329
|
-
*/
|
|
2330
|
-
private runGlobalJobs;
|
|
2331
|
-
/**
|
|
2332
|
-
* Execute all jobs for a single root in sorted order.
|
|
2333
|
-
* Rebuilds sorted job list if needed, then dispatches each job.
|
|
2334
|
-
* Errors are caught and propagated via triggerError.
|
|
2335
|
-
* @param {RootEntry} root - The root entry to tick
|
|
2336
|
-
* @param {number} timestamp - RAF timestamp in milliseconds
|
|
2337
|
-
* @param {number} delta - Time since last frame in seconds
|
|
2338
|
-
* @returns {void}
|
|
2339
|
-
* @private
|
|
2340
|
-
*/
|
|
2341
|
-
private tickRoot;
|
|
2342
|
-
/**
|
|
2343
|
-
* Get the total number of registered jobs across all roots.
|
|
2344
|
-
* Includes both per-root jobs and global before/after jobs.
|
|
2345
|
-
* @returns {number} Total job count
|
|
2346
|
-
*/
|
|
2347
|
-
getJobCount(): number;
|
|
2348
|
-
/**
|
|
2349
|
-
* Get all registered job IDs across all roots.
|
|
2350
|
-
* Includes both per-root jobs and global before/after jobs.
|
|
2351
|
-
* @returns {string[]} Array of all job IDs
|
|
2352
|
-
*/
|
|
2353
|
-
getJobIds(): string[];
|
|
2354
|
-
/**
|
|
2355
|
-
* Get the number of registered roots (Canvas instances).
|
|
2356
|
-
* @returns {number} Number of registered roots
|
|
2357
|
-
*/
|
|
2358
|
-
getRootCount(): number;
|
|
2359
|
-
/**
|
|
2360
|
-
* Check if any user (non-system) jobs are registered in a specific phase.
|
|
2361
|
-
* Used by the default render job to know if a user has taken over rendering.
|
|
2362
|
-
*
|
|
2363
|
-
* @param phase The phase to check
|
|
2364
|
-
* @param rootId Optional root ID to check (checks all roots if not provided)
|
|
2365
|
-
* @returns true if any user jobs exist in the phase
|
|
2366
|
-
*/
|
|
2367
|
-
hasUserJobsInPhase(phase: string, rootId?: string): boolean;
|
|
2368
|
-
/**
|
|
2369
|
-
* Generate a unique root ID for automatic root registration.
|
|
2370
|
-
* @returns {string} A unique root ID in the format 'root_N'
|
|
2371
|
-
*/
|
|
2372
|
-
generateRootId(): string;
|
|
2373
|
-
/**
|
|
2374
|
-
* Generate a unique job ID.
|
|
2375
|
-
* @returns {string} A unique job ID in the format 'job_N'
|
|
2376
|
-
* @private
|
|
2377
|
-
*/
|
|
2378
|
-
private generateJobId;
|
|
2379
|
-
/**
|
|
2380
|
-
* Normalize before/after constraints to a Set.
|
|
2381
|
-
* Handles undefined, single string, or array inputs.
|
|
2382
|
-
* @param {string | string[] | undefined} value - The constraint value(s)
|
|
2383
|
-
* @returns {Set<string>} Normalized Set of constraint strings
|
|
2384
|
-
* @private
|
|
2385
|
-
*/
|
|
2386
|
-
private normalizeConstraints;
|
|
2387
|
-
}
|
|
2388
|
-
/**
|
|
2389
|
-
* Get the global scheduler instance.
|
|
2390
|
-
* Creates one if it doesn't exist.
|
|
2391
|
-
*/
|
|
2392
|
-
declare const getScheduler: () => Scheduler;
|
|
2393
|
-
|
|
2394
1871
|
/**
|
|
2395
1872
|
* Frame hook with phase-based ordering, priority, and FPS throttling.
|
|
2396
1873
|
*
|
|
2397
|
-
*
|
|
2398
|
-
* - Inside Canvas: Full RootState (
|
|
2399
|
-
* - Outside Canvas
|
|
2400
|
-
*
|
|
1874
|
+
* Always delivers full RootState — works both inside and outside Canvas context:
|
|
1875
|
+
* - Inside Canvas: Full RootState (renderer, scene, camera, etc.)
|
|
1876
|
+
* - Outside Canvas: The job registers immediately but the callback is held until a
|
|
1877
|
+
* Canvas adopts it, then runs with full RootState. For hostless / standalone
|
|
1878
|
+
* frame loops with no Canvas, use `@pmndrs/scheduler` directly.
|
|
2401
1879
|
*
|
|
2402
1880
|
* Returns a controls object for manual stepping, pausing, and resuming.
|
|
2403
1881
|
*
|
|
@@ -2414,16 +1892,16 @@ declare const getScheduler: () => Scheduler;
|
|
|
2414
1892
|
* useFrame((state, delta) => { ... }, { phase: 'physics' })
|
|
2415
1893
|
*
|
|
2416
1894
|
* @example
|
|
2417
|
-
* // Outside Canvas - waits for Canvas
|
|
1895
|
+
* // Outside Canvas - callback waits for a Canvas, then always has full state
|
|
2418
1896
|
* function UI() {
|
|
2419
1897
|
* useFrame((state, delta) => { syncUI(state.camera) });
|
|
2420
1898
|
* return <button>...</button>;
|
|
2421
1899
|
* }
|
|
2422
1900
|
*
|
|
2423
1901
|
* @example
|
|
2424
|
-
* //
|
|
2425
|
-
* getScheduler
|
|
2426
|
-
*
|
|
1902
|
+
* // Hostless / standalone loop (no Canvas) - use @pmndrs/scheduler directly
|
|
1903
|
+
* import { getScheduler } from '@pmndrs/scheduler'
|
|
1904
|
+
* getScheduler().register((state, delta) => { updateGame(delta) })
|
|
2427
1905
|
*
|
|
2428
1906
|
* @example
|
|
2429
1907
|
* // Scheduler-only access (no callback)
|
|
@@ -2446,11 +1924,16 @@ type UseTextureOptions<Url extends string[] | string | Record<string, string>> =
|
|
|
2446
1924
|
/** Callback when texture(s) finish loading */
|
|
2447
1925
|
onLoad?: (texture: MappedTextureType<Url>) => void;
|
|
2448
1926
|
/**
|
|
2449
|
-
*
|
|
2450
|
-
* When true:
|
|
1927
|
+
* Register the texture(s) in R3F's global texture registry for access via useTextures().
|
|
1928
|
+
* When true (the default):
|
|
2451
1929
|
* - Textures persist until explicitly disposed
|
|
2452
|
-
* -
|
|
2453
|
-
*
|
|
1930
|
+
* - On mount, returns existing registered textures if available (preserving modifications like colorSpace)
|
|
1931
|
+
*
|
|
1932
|
+
* Reads are taken once at mount — a mounted `useTexture` does not re-render when the registry
|
|
1933
|
+
* changes. To react to registry swaps, use `useTextures(s => s.get(key))` instead.
|
|
1934
|
+
*
|
|
1935
|
+
* Pass `false` to opt out of registry enrollment entirely.
|
|
1936
|
+
* @default true
|
|
2454
1937
|
*/
|
|
2455
1938
|
cache?: boolean;
|
|
2456
1939
|
};
|
|
@@ -2474,15 +1957,18 @@ type UseTextureOptions<Url extends string[] | string | Record<string, string>> =
|
|
|
2474
1957
|
* normal: '/normal.png'
|
|
2475
1958
|
* })
|
|
2476
1959
|
*
|
|
2477
|
-
* //
|
|
2478
|
-
* //
|
|
2479
|
-
* const diffuse = useTexture('/diffuse.png'
|
|
1960
|
+
* // Textures are registered in the global registry by default — the same texture
|
|
1961
|
+
* // object is shared across components and modifications (colorSpace, wrapS, etc.) are preserved
|
|
1962
|
+
* const diffuse = useTexture('/diffuse.png')
|
|
2480
1963
|
* diffuse.colorSpace = THREE.SRGBColorSpace
|
|
2481
1964
|
*
|
|
2482
1965
|
* // Another component gets the SAME texture with colorSpace already set
|
|
2483
|
-
* const sameDiffuse = useTexture('/diffuse.png'
|
|
1966
|
+
* const sameDiffuse = useTexture('/diffuse.png')
|
|
1967
|
+
*
|
|
1968
|
+
* // Opt out of registry enrollment for a one-off texture
|
|
1969
|
+
* const scratch = useTexture('/scratch.png', { cache: false })
|
|
2484
1970
|
*
|
|
2485
|
-
* // Access
|
|
1971
|
+
* // Access the registry directly
|
|
2486
1972
|
* const { get } = useTextures()
|
|
2487
1973
|
* const cached = get('/diffuse.png')
|
|
2488
1974
|
* ```
|
|
@@ -2499,63 +1985,80 @@ declare const Texture: ({ children, input, onLoad, cache, }: {
|
|
|
2499
1985
|
cache?: boolean;
|
|
2500
1986
|
}) => react_jsx_runtime.JSX.Element;
|
|
2501
1987
|
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
1988
|
+
/** Accepted shapes for a registry read: a single key, a list of keys, or a name→key map. */
|
|
1989
|
+
type TextureInput = string | string[] | Record<string, string>;
|
|
1990
|
+
/** Result of a `get()` read, mirroring the input shape. */
|
|
1991
|
+
type TextureResult<Input extends TextureInput> = Input extends string ? Texture$1 | undefined : Input extends string[] ? (Texture$1 | undefined)[] : {
|
|
1992
|
+
[K in keyof Input]: Texture$1 | undefined;
|
|
2505
1993
|
};
|
|
1994
|
+
/** Options for `dispose()`. */
|
|
1995
|
+
interface DisposeOptions {
|
|
1996
|
+
/** Dispose even if the texture still has active references (default false). */
|
|
1997
|
+
force?: boolean;
|
|
1998
|
+
}
|
|
2506
1999
|
interface UseTexturesReturn {
|
|
2507
|
-
/** Map
|
|
2508
|
-
|
|
2509
|
-
/**
|
|
2510
|
-
get
|
|
2511
|
-
/** Check
|
|
2512
|
-
has
|
|
2513
|
-
/**
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2000
|
+
/** The live registry Map (key → Texture). Treat as read-only. */
|
|
2001
|
+
readonly all: Map<string, Texture$1>;
|
|
2002
|
+
/** Read one texture, an array of textures, or a name→texture record (mirrors the input shape). */
|
|
2003
|
+
get<Input extends TextureInput>(input: Input): TextureResult<Input>;
|
|
2004
|
+
/** Check whether a key exists in the registry. */
|
|
2005
|
+
has(key: string): boolean;
|
|
2006
|
+
/**
|
|
2007
|
+
* Register a texture (or a record of textures) that has no URL — e.g. a render
|
|
2008
|
+
* target or procedural texture. URL-loaded textures are registered automatically
|
|
2009
|
+
* by `useTexture` (registry enrollment is on by default).
|
|
2010
|
+
*/
|
|
2011
|
+
add(key: string, texture: Texture$1): void;
|
|
2012
|
+
add(record: Record<string, Texture$1>): void;
|
|
2013
|
+
/**
|
|
2014
|
+
* Dispose a texture's GPU resources and remove it from the registry.
|
|
2015
|
+
* Refcount-aware: if the key is still in use by a mounted `useTexture` consumer it is
|
|
2016
|
+
* skipped (with a warning) unless `{ force: true }` is passed.
|
|
2017
|
+
* @returns true if disposed, false if skipped.
|
|
2018
|
+
*/
|
|
2019
|
+
dispose(key: string, options?: DisposeOptions): boolean;
|
|
2020
|
+
/** Dispose every texture in the registry and clear it. Use on scene teardown. */
|
|
2021
|
+
disposeAll(): void;
|
|
2527
2022
|
}
|
|
2528
2023
|
/**
|
|
2529
|
-
*
|
|
2024
|
+
* Reactive Texture registry — load once with `useTexture`, reach the textures from anywhere.
|
|
2530
2025
|
*
|
|
2531
|
-
*
|
|
2532
|
-
*
|
|
2026
|
+
* This is a registry of plain `Texture` objects (not TSL nodes), so the same texture can feed
|
|
2027
|
+
* a material map, a heightmap sampler, or anything else. It does **not** load — pair it with
|
|
2028
|
+
* `useTexture` for loading (registry enrollment is on by default); `useTextures` is for access and lifecycle.
|
|
2029
|
+
*
|
|
2030
|
+
* The returned handle is **reactive**: the calling component re-renders when the registry
|
|
2031
|
+
* changes. Pass a selector to scope the subscription to a single read.
|
|
2533
2032
|
*
|
|
2534
2033
|
* @example
|
|
2535
2034
|
* ```tsx
|
|
2536
|
-
*
|
|
2537
|
-
*
|
|
2538
|
-
* // Check if texture is already cached
|
|
2539
|
-
* if (!has('/textures/diffuse.png')) {
|
|
2540
|
-
* // Load with useTexture and cache: true, or manually add
|
|
2541
|
-
* const tex = useTexture('/textures/diffuse.png', { cache: true })
|
|
2542
|
-
* }
|
|
2035
|
+
* // Load + register once (anywhere in the tree) — registered by default
|
|
2036
|
+
* useTexture({ map: '/diffuse.jpg', normalMap: '/normal.jpg' })
|
|
2543
2037
|
*
|
|
2544
|
-
* //
|
|
2545
|
-
* const
|
|
2546
|
-
*
|
|
2038
|
+
* // Reach them from another component — record form lands straight into a material
|
|
2039
|
+
* const { map, normalMap } = useTextures().get({ map: '/diffuse.jpg', normalMap: '/normal.jpg' })
|
|
2040
|
+
* return <meshStandardMaterial map={map} normalMap={normalMap} />
|
|
2547
2041
|
*
|
|
2548
|
-
* //
|
|
2549
|
-
*
|
|
2042
|
+
* // A set of heightmaps at once
|
|
2043
|
+
* const [a, b, c] = useTextures().get(['/h0.png', '/h1.png', '/h2.png'])
|
|
2550
2044
|
*
|
|
2551
|
-
* //
|
|
2552
|
-
*
|
|
2045
|
+
* // Register a non-URL texture (render target / procedural)
|
|
2046
|
+
* useTextures().add('rt-main', renderTarget.texture)
|
|
2553
2047
|
*
|
|
2554
|
-
* //
|
|
2555
|
-
*
|
|
2048
|
+
* // Deliberate GPU cleanup (refcount-aware; force to override)
|
|
2049
|
+
* useTextures().dispose('/diffuse.jpg')
|
|
2050
|
+
* useTextures().disposeAll() // scene teardown
|
|
2556
2051
|
* ```
|
|
2052
|
+
*
|
|
2053
|
+
* @remarks
|
|
2054
|
+
* **Future expansion:** an imperative async loader (e.g. `await useTextures().load('/x.jpg')`) is
|
|
2055
|
+
* intentionally not included yet. It would let non-React code (loading screens, dynamic streaming)
|
|
2056
|
+
* populate the registry without Suspense, at the cost of putting loading back into this hook. It
|
|
2057
|
+
* will be added only if a concrete consumer needs imperative loading; for now, loading lives in
|
|
2058
|
+
* `useTexture`.
|
|
2557
2059
|
*/
|
|
2558
2060
|
declare function useTextures(): UseTexturesReturn;
|
|
2061
|
+
declare function useTextures<T>(selector: (registry: UseTexturesReturn) => T): T;
|
|
2559
2062
|
|
|
2560
2063
|
/**
|
|
2561
2064
|
* Creates a render target compatible with the current renderer.
|
|
@@ -2585,9 +2088,9 @@ declare function useTextures(): UseTexturesReturn;
|
|
|
2585
2088
|
* const fbo = useRenderTarget(512, 256, { samples: 4 })
|
|
2586
2089
|
* ```
|
|
2587
2090
|
*/
|
|
2588
|
-
declare function useRenderTarget(options?: RenderTargetOptions): RenderTarget
|
|
2589
|
-
declare function useRenderTarget(size: number, options?: RenderTargetOptions): RenderTarget
|
|
2590
|
-
declare function useRenderTarget(width: number, height: number, options?: RenderTargetOptions): RenderTarget
|
|
2091
|
+
declare function useRenderTarget(options?: RenderTargetOptions): RenderTarget;
|
|
2092
|
+
declare function useRenderTarget(size: number, options?: RenderTargetOptions): RenderTarget;
|
|
2093
|
+
declare function useRenderTarget(width: number, height: number, options?: RenderTargetOptions): RenderTarget;
|
|
2591
2094
|
|
|
2592
2095
|
/**
|
|
2593
2096
|
* Returns the R3F Canvas' Zustand store. Useful for [transient updates](https://github.com/pmndrs/zustand#transient-updates-for-often-occurring-state-changes).
|
|
@@ -3763,11 +3266,6 @@ declare function flushSync<R>(fn: () => R): R;
|
|
|
3763
3266
|
declare const context: React$1.Context<RootStore>;
|
|
3764
3267
|
declare const createStore: (invalidate: (state?: RootState, frames?: number, stackFrames?: boolean) => void, advance: (timestamp: number, runGlobalEffects?: boolean, state?: RootState, frame?: XRFrame) => void) => RootStore;
|
|
3765
3268
|
|
|
3766
|
-
/**
|
|
3767
|
-
* Safely flush async effects when testing, simulating a legacy root.
|
|
3768
|
-
* @deprecated Import from React instead. import { act } from 'react'
|
|
3769
|
-
*/
|
|
3770
|
-
declare const act: typeof React$1.act;
|
|
3771
3269
|
/**
|
|
3772
3270
|
* An SSR-friendly useLayoutEffect.
|
|
3773
3271
|
*
|
|
@@ -4300,13 +3798,17 @@ type ScopedStoreType<T> = {
|
|
|
4300
3798
|
declare function createScopedStore<T>(data: Record<string, any>): ScopedStoreType<T>;
|
|
4301
3799
|
/**
|
|
4302
3800
|
* State type passed to creator functions with ScopedStore wrappers.
|
|
4303
|
-
* Provides type-safe access to uniforms and
|
|
3801
|
+
* Provides type-safe access to uniforms, nodes, buffers, and gpuStorage without manual casting.
|
|
4304
3802
|
*/
|
|
4305
|
-
type CreatorState = Omit<RootState, 'uniforms' | 'nodes'> & {
|
|
3803
|
+
type CreatorState = Omit<RootState, 'uniforms' | 'nodes' | 'buffers' | 'gpuStorage'> & {
|
|
4306
3804
|
/** Type-safe uniform access - property access returns UniformNode */
|
|
4307
3805
|
uniforms: ScopedStoreType<UniformNode>;
|
|
4308
3806
|
/** Type-safe node access - property access returns TSLNodeType (Node | ShaderCallable | ShaderNodeObject) */
|
|
4309
3807
|
nodes: ScopedStoreType<TSLNodeType>;
|
|
3808
|
+
/** Type-safe buffer access - property access returns BufferLike (TypedArrays, BufferAttributes, TSL nodes) */
|
|
3809
|
+
buffers: ScopedStoreType<BufferLike>;
|
|
3810
|
+
/** Type-safe GPU storage access - property access returns StorageLike (StorageTexture, TSL nodes) */
|
|
3811
|
+
gpuStorage: ScopedStoreType<StorageLike>;
|
|
4310
3812
|
};
|
|
4311
3813
|
|
|
4312
3814
|
/** Creator function that returns uniform inputs (can be raw values or UniformNodes) */
|
|
@@ -4331,9 +3833,12 @@ declare function useUniforms<T extends UniformInputRecord>(uniforms: T): Uniform
|
|
|
4331
3833
|
declare function useUniforms<T extends UniformInputRecord>(uniforms: T, scope: string): UniformsWithUtils<UniformRecord<UniformNode>>;
|
|
4332
3834
|
/**
|
|
4333
3835
|
* Global rebuildUniforms function for HMR integration.
|
|
4334
|
-
*
|
|
3836
|
+
* Invalidates cached uniforms and increments _hmrVersion to trigger re-creation.
|
|
4335
3837
|
* Call this when HMR is detected to refresh all uniform creators.
|
|
4336
3838
|
*
|
|
3839
|
+
* Resolves to the primary store so shared TSL resources rebuild on the
|
|
3840
|
+
* authoritative store.
|
|
3841
|
+
*
|
|
4337
3842
|
* @param store - The R3F store (from useStore or context)
|
|
4338
3843
|
* @param scope - Optional scope to rebuild ('root' for root only, string for specific scope, undefined for all)
|
|
4339
3844
|
*/
|
|
@@ -4417,9 +3922,12 @@ declare function useNodes<T extends Record<string, TSLNodeLike>>(creator: NodeCr
|
|
|
4417
3922
|
declare function useNodes<T extends Record<string, TSLNodeLike>>(creator: NodeCreator<T>, scope: string): NodesWithUtils<T>;
|
|
4418
3923
|
/**
|
|
4419
3924
|
* Global rebuildNodes function for HMR integration.
|
|
4420
|
-
*
|
|
3925
|
+
* Invalidates cached nodes and increments _hmrVersion to trigger re-creation.
|
|
4421
3926
|
* Call this when HMR is detected to refresh all node creators.
|
|
4422
3927
|
*
|
|
3928
|
+
* Resolves to the primary store so shared TSL resources rebuild on the
|
|
3929
|
+
* authoritative store.
|
|
3930
|
+
*
|
|
4423
3931
|
* @param store - The R3F store (from useStore or context)
|
|
4424
3932
|
* @param scope - Optional scope to rebuild ('root' for root only, string for specific scope, undefined for all)
|
|
4425
3933
|
*/
|
|
@@ -4470,6 +3978,97 @@ type LocalNodeCreator<T extends Record<string, unknown>> = (state: CreatorState)
|
|
|
4470
3978
|
*/
|
|
4471
3979
|
declare function useLocalNodes<T extends Record<string, unknown>>(creator: LocalNodeCreator<T>): T;
|
|
4472
3980
|
|
|
3981
|
+
/**
|
|
3982
|
+
* Creator function that returns a record of buffers.
|
|
3983
|
+
* Receives CreatorState with access to existing buffers, gpuStorage, uniforms, nodes, etc.
|
|
3984
|
+
*/
|
|
3985
|
+
type BufferCreator<T extends Record<string, BufferLike>> = (state: CreatorState) => T;
|
|
3986
|
+
/** Function signature for removeBuffers util */
|
|
3987
|
+
type RemoveBuffersFn = (names: string | string[], scope?: string) => void;
|
|
3988
|
+
/** Function signature for clearBuffers util */
|
|
3989
|
+
type ClearBuffersFn = (scope?: string) => void;
|
|
3990
|
+
/** Function signature for rebuildBuffers util */
|
|
3991
|
+
type RebuildBuffersFn = (scope?: string) => void;
|
|
3992
|
+
/** Function signature for disposeBuffers util - releases GPU resources */
|
|
3993
|
+
type DisposeBuffersFn = (names: string | string[], scope?: string) => void;
|
|
3994
|
+
/** Return type with utils included */
|
|
3995
|
+
type BuffersWithUtils<T extends Record<string, BufferLike> = Record<string, BufferLike>> = T & {
|
|
3996
|
+
removeBuffers: RemoveBuffersFn;
|
|
3997
|
+
clearBuffers: ClearBuffersFn;
|
|
3998
|
+
rebuildBuffers: RebuildBuffersFn;
|
|
3999
|
+
disposeBuffers: DisposeBuffersFn;
|
|
4000
|
+
};
|
|
4001
|
+
declare function useBuffers(): BuffersWithUtils<Record<string, BufferLike> & Record<string, Record<string, BufferLike>>>;
|
|
4002
|
+
declare function useBuffers(scope: string): BuffersWithUtils<Record<string, BufferLike>>;
|
|
4003
|
+
declare function useBuffers<T extends Record<string, BufferLike>>(creator: BufferCreator<T>): BuffersWithUtils<T>;
|
|
4004
|
+
declare function useBuffers<T extends Record<string, BufferLike>>(creator: BufferCreator<T>, scope: string): BuffersWithUtils<T>;
|
|
4005
|
+
/**
|
|
4006
|
+
* Global rebuildBuffers function for HMR integration.
|
|
4007
|
+
* Invalidates cached buffers and increments _hmrVersion to trigger re-creation.
|
|
4008
|
+
* Call this when HMR is detected to refresh all buffer creators.
|
|
4009
|
+
*
|
|
4010
|
+
* Resolves to the primary store so shared TSL resources rebuild on the
|
|
4011
|
+
* authoritative store.
|
|
4012
|
+
*
|
|
4013
|
+
* @param store - The R3F store (from useStore or context)
|
|
4014
|
+
* @param scope - Optional scope to rebuild ('root' for root only, string for specific scope, undefined for all)
|
|
4015
|
+
*/
|
|
4016
|
+
declare function rebuildAllBuffers(store: ReturnType<typeof useStore>, scope?: string): void;
|
|
4017
|
+
|
|
4018
|
+
/**
|
|
4019
|
+
* Creator function that returns a record of GPU storage objects.
|
|
4020
|
+
* Receives CreatorState with access to existing buffers, gpuStorage, uniforms, nodes, etc.
|
|
4021
|
+
*/
|
|
4022
|
+
type StorageCreator<T extends Record<string, StorageLike>> = (state: CreatorState) => T;
|
|
4023
|
+
/** Function signature for removeStorage util */
|
|
4024
|
+
type RemoveStorageFn = (names: string | string[], scope?: string) => void;
|
|
4025
|
+
/** Function signature for clearStorage util */
|
|
4026
|
+
type ClearStorageFn = (scope?: string) => void;
|
|
4027
|
+
/** Function signature for rebuildStorage util */
|
|
4028
|
+
type RebuildStorageFn = (scope?: string) => void;
|
|
4029
|
+
/** Function signature for disposeStorage util - releases GPU resources */
|
|
4030
|
+
type DisposeStorageFn = (names: string | string[], scope?: string) => void;
|
|
4031
|
+
/** Return type with utils included */
|
|
4032
|
+
type StorageWithUtils<T extends Record<string, StorageLike> = Record<string, StorageLike>> = T & {
|
|
4033
|
+
removeStorage: RemoveStorageFn;
|
|
4034
|
+
clearStorage: ClearStorageFn;
|
|
4035
|
+
rebuildStorage: RebuildStorageFn;
|
|
4036
|
+
disposeStorage: DisposeStorageFn;
|
|
4037
|
+
};
|
|
4038
|
+
declare function useGPUStorage(): StorageWithUtils<Record<string, StorageLike> & Record<string, Record<string, StorageLike>>>;
|
|
4039
|
+
declare function useGPUStorage(scope: string): StorageWithUtils<Record<string, StorageLike>>;
|
|
4040
|
+
declare function useGPUStorage<T extends Record<string, StorageLike>>(creator: StorageCreator<T>): StorageWithUtils<T>;
|
|
4041
|
+
declare function useGPUStorage<T extends Record<string, StorageLike>>(creator: StorageCreator<T>, scope: string): StorageWithUtils<T>;
|
|
4042
|
+
/**
|
|
4043
|
+
* Global rebuildStorage function for HMR integration.
|
|
4044
|
+
* Invalidates cached storage and increments _hmrVersion to trigger re-creation.
|
|
4045
|
+
* Call this when HMR is detected to refresh all storage creators.
|
|
4046
|
+
*
|
|
4047
|
+
* Resolves to the primary store so shared TSL resources rebuild on the
|
|
4048
|
+
* authoritative store.
|
|
4049
|
+
*
|
|
4050
|
+
* @param store - The R3F store (from useStore or context)
|
|
4051
|
+
* @param scope - Optional scope to rebuild ('root' for root only, string for specific scope, undefined for all)
|
|
4052
|
+
*/
|
|
4053
|
+
declare function rebuildAllStorage(store: ReturnType<typeof useStore>, scope?: string): void;
|
|
4054
|
+
|
|
4055
|
+
/**
|
|
4056
|
+
* Re-export from core - useTextures is now a core R3F hook (a reactive Texture registry).
|
|
4057
|
+
*
|
|
4058
|
+
* This file maintains backwards compatibility for existing webgpu imports.
|
|
4059
|
+
*/
|
|
4060
|
+
|
|
4061
|
+
/**
|
|
4062
|
+
* @deprecated The registry now stores plain `Texture` objects, not TSL nodes. Use `Texture` directly.
|
|
4063
|
+
* Kept as an alias for backwards compatibility.
|
|
4064
|
+
*/
|
|
4065
|
+
type TextureEntry = Texture$1;
|
|
4066
|
+
/**
|
|
4067
|
+
* @deprecated The registry now stores plain `Texture` objects, not TSL nodes. Use `Texture` directly.
|
|
4068
|
+
* Kept as an alias for backwards compatibility.
|
|
4069
|
+
*/
|
|
4070
|
+
type TextureNode = Texture$1;
|
|
4071
|
+
|
|
4473
4072
|
interface TextureOperations {
|
|
4474
4073
|
add: (key: string, value: any) => void;
|
|
4475
4074
|
addMultiple: (items: Map<string, any> | Record<string, any>) => void;
|
|
@@ -4479,10 +4078,10 @@ interface TextureOperations {
|
|
|
4479
4078
|
declare function createTextureOperations(set: StoreApi<RootState>['setState']): TextureOperations;
|
|
4480
4079
|
|
|
4481
4080
|
/**
|
|
4482
|
-
* Hook for managing WebGPU
|
|
4081
|
+
* Hook for managing WebGPU RenderPipeline with automatic scenePass setup.
|
|
4483
4082
|
*
|
|
4484
4083
|
* Features:
|
|
4485
|
-
* - Creates
|
|
4084
|
+
* - Creates RenderPipeline instance if not exists
|
|
4486
4085
|
* - Creates default scenePass (no MRT) automatically
|
|
4487
4086
|
* - Callbacks receive full RootState for flexibility
|
|
4488
4087
|
* - No auto-cleanup on unmount - use reset() for explicit cleanup
|
|
@@ -4490,21 +4089,21 @@ declare function createTextureOperations(set: StoreApi<RootState>['setState']):
|
|
|
4490
4089
|
*
|
|
4491
4090
|
* @param mainCB - Main callback to configure outputNode and create effect passes
|
|
4492
4091
|
* @param setupCB - Optional setup callback to configure MRT on scenePass
|
|
4493
|
-
* @returns { passes,
|
|
4092
|
+
* @returns { passes, renderPipeline, clearPasses, reset, rebuild }
|
|
4494
4093
|
*
|
|
4495
4094
|
* @example
|
|
4496
4095
|
* ```tsx
|
|
4497
4096
|
* // Simple effect
|
|
4498
|
-
*
|
|
4499
|
-
*
|
|
4097
|
+
* useRenderPipeline(({ renderPipeline, passes }) => {
|
|
4098
|
+
* renderPipeline.outputNode = bloom(passes.scenePass.getTextureNode())
|
|
4500
4099
|
* })
|
|
4501
4100
|
*
|
|
4502
4101
|
* // With MRT setup
|
|
4503
|
-
*
|
|
4504
|
-
* ({
|
|
4102
|
+
* useRenderPipeline(
|
|
4103
|
+
* ({ renderPipeline, passes }) => {
|
|
4505
4104
|
* const beauty = passes.scenePass.getTextureNode().toInspector('Color')
|
|
4506
4105
|
* const vel = passes.scenePass.getTextureNode('velocity')
|
|
4507
|
-
*
|
|
4106
|
+
* renderPipeline.outputNode = motionBlur(beauty, vel)
|
|
4508
4107
|
* },
|
|
4509
4108
|
* ({ passes }) => {
|
|
4510
4109
|
* passes.scenePass.setMRT(mrt({ output, velocity }))
|
|
@@ -4512,10 +4111,10 @@ declare function createTextureOperations(set: StoreApi<RootState>['setState']):
|
|
|
4512
4111
|
* )
|
|
4513
4112
|
*
|
|
4514
4113
|
* // Read-only access
|
|
4515
|
-
* const {
|
|
4114
|
+
* const { renderPipeline, passes } = useRenderPipeline()
|
|
4516
4115
|
* ```
|
|
4517
4116
|
*/
|
|
4518
|
-
declare function
|
|
4117
|
+
declare function useRenderPipeline(mainCB?: RenderPipelineMainCallback, setupCB?: RenderPipelineSetupCallback): UseRenderPipelineReturn;
|
|
4519
4118
|
|
|
4520
4119
|
//* Renderer Props ========================================
|
|
4521
4120
|
|
|
@@ -4564,5 +4163,5 @@ interface WebGPURootState extends Omit<RootState, 'renderer' | 'gl' | 'internal'
|
|
|
4564
4163
|
internal: WebGPUInternalState
|
|
4565
4164
|
}
|
|
4566
4165
|
|
|
4567
|
-
export { Block, Canvas, Environment, EnvironmentCube, EnvironmentMap, EnvironmentPortal, ErrorBoundary, FROM_REF, IsObject, ONCE, Portal, R3F_BUILD_LEGACY, R3F_BUILD_WEBGPU, REACT_INTERNAL_PROPS, RESERVED_PROPS, three_d as ReactThreeFiber,
|
|
4568
|
-
export type { Act,
|
|
4166
|
+
export { Block, Canvas, Environment, EnvironmentCube, EnvironmentMap, EnvironmentPortal, ErrorBoundary, FROM_REF, IsObject, ONCE, Portal, R3F_BUILD_LEGACY, R3F_BUILD_WEBGPU, REACT_INTERNAL_PROPS, RESERVED_PROPS, three_d as ReactThreeFiber, Texture, _roots, addAfterEffect, addEffect, addTail, advance, applyProps, attach, buildGraph, calculateDpr, clearNodeScope, clearRootNodes, clearRootUniforms, clearScope, context, createEvents, createPointerEvents, createPortal, createRoot, createScopedStore, createStore, createTextureOperations, detach, diffProps, dispose, createPointerEvents as events, extend, findInitialRoot, flushSync, fromRef, getInstanceProps, getPrimary, getPrimaryIds, getRootState, getUuidPrefix, hasConstructor, hasPrimary, invalidate, invalidateInstance, is, isColorRepresentation, isCopyable, isFromRef, isObject3D, isOnce, isOrthographicCamera, isRef, isRenderer, isTexture, isVectorLike, once, prepare, presetsObj, rebuildAllBuffers, rebuildAllNodes, rebuildAllStorage, rebuildAllUniforms, reconciler, registerPrimary, removeInteractivity, removeNodes, removeUniforms, resolve, swapInteractivity, unmountComponentAtNode, unregisterPrimary, updateCamera, updateFrustum, useBridge, useBuffers, useEnvironment, useFrame, useGPUStorage, useGraph, useInstanceHandle, useIsomorphicLayoutEffect, useLoader, useLocalNodes, useMutableCallback, useNodes, useRenderPipeline, useRenderTarget, useStore, useTexture, useTextures, useThree, useUniform, useUniforms, waitForPrimary };
|
|
4167
|
+
export type { Act, Args, ArgsProp, AttachFnType, AttachType, BackgroundConfig, BackgroundProp, BaseRendererProps, Bridge, BufferCreator, BufferLike, BufferRecord, BufferStore, BuffersWithUtils, Camera, CameraProps, CanvasProps, CanvasSchedulerConfig, Catalogue, ClearBuffersFn, ClearNodesFn, ClearStorageFn, ClearUniformsFn, Color, ColorManagementConfig, ComputeFunction, ConstructorRepresentation, CreatorState, DefaultGLProps, DefaultRendererProps, Disposable, DisposeBuffersFn, DisposeOptions, DisposeStorageFn, DomEvent, Dpr, ElementProps, EnvironmentLoaderProps, EnvironmentProps, EquConfig, Euler, EventHandlers, EventManager, EventProps, Events, Extensions, FiberRoot, FilterFunction, FrameCallback, FrameNextCallback, FrameNextState, FrameState, Frameloop, GLProps, GLTFLike, GeometryProps, GeometryTransformProps, GlobalEffectType, GlobalRenderCallback, HostConfig, InferLoadResult, InjectState, InputLike, Instance, InstanceProps, WebGPUInternalState as InternalState, Intersection, IntersectionEvent, IsAllOptional, IsOptional, Layers, LegacyInternalState, LegacyRenderer, LegacyRootState, LoaderInstance, LoaderLike, LoaderResult, LocalNodeCreator, MappedTextureType, MathProps, MathRepresentation, MathType, MathTypes, Matrix3, Matrix4, Mutable, MutableOrReadonlyParameters, NodeCreator, NodeProps, NodeRecord, NodesWithUtils, NonFunctionKeys, ObjectMap, OffscreenCanvas$1 as OffscreenCanvas, Overwrite, Performance, PointerCaptureTarget, PointerState, PresetsType, PrimaryCanvasEntry, Properties, Quaternion, WebGPUR3FRenderer as R3FRenderer, RaycastableRepresentation, ReactProps, RebuildBuffersFn, RebuildNodesFn, RebuildStorageFn, RebuildUniformsFn, ReconcilerRoot, RemoveBuffersFn, RemoveNodesFn, RemoveStorageFn, RemoveUniformsFn, RenderCallback, RenderProps, RenderTargetOptions, Renderer, RendererConfigExtended, RendererFactory, RendererProps, Root, WebGPURootState as RootState, RootStore, ScopedStoreType, SetBlock, Size, StorageCreator, StorageLike, StorageRecord, StorageStore, StorageWithUtils, Subscription, TSLNode, TSLNodeInput, TextureEntry, TextureInput, TextureNode, TextureOperations, TextureResult, ThreeCamera, ThreeElement, ThreeElements, ThreeElementsImpl, ThreeEvent, ThreeExports, ThreeToJSXElements, UnblockProps, UniformCreator, UniformValue, UniformsWithUtils, UseTextureOptions, UseTexturesReturn, Vector2, Vector3, Vector4, VectorRepresentation, Viewport, VisibilityEntry, WebGLDefaultProps, WebGLProps, WebGLShadowConfig, WebGPUDefaultProps, WebGPUProps, WebGPUShadowConfig, XRManager, XRPointerConfig };
|