@react-three/fiber 10.0.0-canary.dc0ec15 → 10.0.0-canary.de17310
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/extension.d.cts +49 -1095
- package/dist/extension.d.mts +49 -1095
- package/dist/extension.d.ts +49 -1067
- package/dist/index.cjs +2 -8
- package/dist/index.d.cts +8 -342
- package/dist/index.d.mts +8 -342
- package/dist/index.d.ts +7 -341
- package/dist/index.mjs +2 -8
- package/dist/legacy.cjs +2 -8
- package/dist/legacy.d.cts +6 -341
- package/dist/legacy.d.mts +6 -341
- package/dist/legacy.d.ts +6 -341
- package/dist/legacy.mjs +2 -8
- package/dist/webgpu/index.cjs +9 -939
- package/dist/webgpu/index.d.cts +12 -685
- package/dist/webgpu/index.d.mts +12 -685
- package/dist/webgpu/index.d.ts +11 -684
- package/dist/webgpu/index.mjs +11 -923
- package/package.json +1 -1
package/dist/webgpu/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as three_examples_jsm_inspector_Inspector_js from 'three/examples/jsm/inspector/Inspector.js';
|
|
2
|
-
import * as
|
|
3
|
-
import { CubeRenderTarget, RenderTarget, WebGPURenderer,
|
|
2
|
+
import * as webgpu from 'three/webgpu';
|
|
3
|
+
import { CubeRenderTarget, RenderTarget, WebGPURenderer, 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, WebGPURendererParameters } from 'three/webgpu';
|
|
4
4
|
import { Inspector } from 'three/addons/inspector/Inspector.js';
|
|
5
5
|
import * as THREE$1 from 'three';
|
|
6
6
|
import { Color as Color$1, ColorRepresentation, Euler as Euler$1, Loader, RenderTargetOptions as RenderTargetOptions$1 } from 'three';
|
|
@@ -302,90 +302,6 @@ type FrameNextCallback = FrameCallback$1<RootState>
|
|
|
302
302
|
/** Alias for FrameNextCallback */
|
|
303
303
|
type FrameCallback = FrameNextCallback
|
|
304
304
|
|
|
305
|
-
//* Buffer Types (useBuffers) ========================================
|
|
306
|
-
|
|
307
|
-
/**
|
|
308
|
-
* Buffer-like types for GPU compute and storage operations.
|
|
309
|
-
* Includes raw CPU arrays, Three.js buffer attributes, and TSL buffer nodes.
|
|
310
|
-
*
|
|
311
|
-
* @example
|
|
312
|
-
* ```tsx
|
|
313
|
-
* const { positions, velocities } = useBuffers(() => ({
|
|
314
|
-
* positions: instancedArray(count, 'vec3'), // StorageBufferNode
|
|
315
|
-
* velocities: new Float32Array(count * 3), // TypedArray
|
|
316
|
-
* }), 'particles')
|
|
317
|
-
* ```
|
|
318
|
-
*/
|
|
319
|
-
type BufferLike =
|
|
320
|
-
| Float32Array
|
|
321
|
-
| Uint32Array
|
|
322
|
-
| Int32Array
|
|
323
|
-
| Float64Array
|
|
324
|
-
| Uint8Array
|
|
325
|
-
| Int8Array
|
|
326
|
-
| Uint16Array
|
|
327
|
-
| Int16Array
|
|
328
|
-
| THREE$1.BufferAttribute // Base class for all buffer attributes
|
|
329
|
-
| THREE$1.InterleavedBufferAttribute
|
|
330
|
-
| Node // TSL buffer nodes (instancedArray, storage)
|
|
331
|
-
|
|
332
|
-
/** Flat record of buffer-like values (no nested scopes) */
|
|
333
|
-
type BufferRecord = Record<string, BufferLike>
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* Buffer store that can contain both root-level buffers and scoped buffer objects.
|
|
337
|
-
* Structure: { positions: Float32Array, particles: { vel: StorageBufferNode } }
|
|
338
|
-
*/
|
|
339
|
-
type BufferStore = Record<string, BufferLike | BufferRecord>
|
|
340
|
-
|
|
341
|
-
//* Node Types (useNodes) ========================================
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
* Every node representation `useNodes` accepts and `state.nodes` holds: three's real `Node`,
|
|
345
|
-
* the callable proxy `Fn()` returns, and the legacy structural shape (`uuid`/`nodeType`) older
|
|
346
|
-
* code passes through. Creators are constrained to this same type, so the shape a creator returns
|
|
347
|
-
* and the shape the store holds are one type by construction.
|
|
348
|
-
*/
|
|
349
|
-
type NodeLike = TSLNodeType | LegacyTSLNodeLike
|
|
350
|
-
|
|
351
|
-
/** Flat record of TSL nodes (no nested scopes) */
|
|
352
|
-
type NodeRecord<T extends NodeLike = NodeLike> = Record<string, T>
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
* Node store that can contain both root-level nodes and scoped node objects.
|
|
356
|
-
* Structure: { wobble: OperatorNode, fx: { blur: ShaderCallable } }
|
|
357
|
-
*/
|
|
358
|
-
type NodeStore = Record<string, NodeLike | NodeRecord>
|
|
359
|
-
|
|
360
|
-
//* Storage Types (useGPUStorage) ========================================
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* GPU storage types for texture-based storage operations.
|
|
364
|
-
* Includes Three.js storage textures and TSL storage texture nodes.
|
|
365
|
-
*
|
|
366
|
-
* @example
|
|
367
|
-
* ```tsx
|
|
368
|
-
* const { heightMap } = useGPUStorage(() => ({
|
|
369
|
-
* heightMap: new StorageTexture(512, 512),
|
|
370
|
-
* }), 'terrain')
|
|
371
|
-
* ```
|
|
372
|
-
*/
|
|
373
|
-
type StorageLike =
|
|
374
|
-
| StorageTexture // 2D GPU storage texture
|
|
375
|
-
| Storage3DTexture // 3D GPU storage texture (volumes, fluid grids)
|
|
376
|
-
| StorageArrayTexture // 2D-array GPU storage texture
|
|
377
|
-
| Data3DTexture // 3D texture (can be used as storage)
|
|
378
|
-
| Node // TSL storage texture nodes (storageTexture)
|
|
379
|
-
|
|
380
|
-
/** Flat record of storage-like values (no nested scopes) */
|
|
381
|
-
type StorageRecord = Record<string, StorageLike>
|
|
382
|
-
|
|
383
|
-
/**
|
|
384
|
-
* Storage store that can contain both root-level storage and scoped storage objects.
|
|
385
|
-
* Structure: { heightMap: StorageTexture, terrain: { normal: StorageTextureNode } }
|
|
386
|
-
*/
|
|
387
|
-
type StorageStore = Record<string, StorageLike | StorageRecord>
|
|
388
|
-
|
|
389
305
|
//* Renderer Types ========================================
|
|
390
306
|
|
|
391
307
|
/** Default renderer type - union of WebGL and WebGPU renderers */
|
|
@@ -558,12 +474,13 @@ interface RootState {
|
|
|
558
474
|
/** Get current state */
|
|
559
475
|
get: StoreApi<RootState>['getState']
|
|
560
476
|
/**
|
|
561
|
-
*
|
|
477
|
+
* The store of the canvas that owns this root's renderer.
|
|
562
478
|
* - For primary/independent canvases: points to its own store (self-reference)
|
|
563
479
|
* - For secondary canvases: points to the primary canvas's store
|
|
480
|
+
* - Portals copy it from their parent
|
|
564
481
|
*
|
|
565
|
-
*
|
|
566
|
-
*
|
|
482
|
+
* Anything shared per renderer rather than per canvas (e.g. @react-three/tsl's resources)
|
|
483
|
+
* resolves through it.
|
|
567
484
|
*/
|
|
568
485
|
primaryStore: RootStore
|
|
569
486
|
/** @deprecated Use `renderer` instead. The instance of the renderer (typed as WebGLRenderer for backwards compat) */
|
|
@@ -626,24 +543,10 @@ interface RootState {
|
|
|
626
543
|
setError: (error: Error | null) => void
|
|
627
544
|
/** Current error state (null when no error) */
|
|
628
545
|
error: Error | null
|
|
629
|
-
/** Global TSL uniform nodes - root-level uniforms + scoped sub-objects. Use useUniforms() hook */
|
|
630
|
-
uniforms: UniformStore
|
|
631
|
-
/** Global TSL nodes - root-level nodes + scoped sub-objects. Use useNodes() hook */
|
|
632
|
-
nodes: NodeStore
|
|
633
|
-
/** Global TSL buffer nodes - root-level buffers + scoped sub-objects. Use useBuffers() hook */
|
|
634
|
-
buffers: BufferStore
|
|
635
|
-
/** Global GPU storage (textures, etc.) - root-level storage + scoped sub-objects. Use useGPUStorage() hook */
|
|
636
|
-
gpuStorage: StorageStore
|
|
637
546
|
/** Global Texture registry (key → Texture, usually keyed by URL) - use useTextures() hook for access + lifecycle */
|
|
638
547
|
textures: Map<string, THREE$1.Texture>
|
|
639
548
|
/** Internal: refcount per texture key, driven by mounted useTexture consumers (registry enrollment is on by default) */
|
|
640
549
|
_textureRefs: Map<string, number>
|
|
641
|
-
/** WebGPU RenderPipeline instance - use useRenderPipeline() hook */
|
|
642
|
-
renderPipeline: ThreeRenderPipeline | null
|
|
643
|
-
/** Global TSL pass nodes for render pipeline - use useRenderPipeline() hook */
|
|
644
|
-
passes: PassRecord
|
|
645
|
-
/** Internal version counter for HMR - incremented by rebuildNodes/rebuildUniforms to bust memoization */
|
|
646
|
-
_hmrVersion: number
|
|
647
550
|
/** Internal: whether setSize() has taken ownership of canvas dimensions */
|
|
648
551
|
_sizeImperative: boolean
|
|
649
552
|
/** Internal: stored size props from Canvas for reset functionality */
|
|
@@ -1174,243 +1077,6 @@ interface LegacyRootState extends Omit<RootState, 'renderer' | 'internal'> {
|
|
|
1174
1077
|
|
|
1175
1078
|
type RenderTargetOptions = RenderTargetOptions$1
|
|
1176
1079
|
|
|
1177
|
-
//* Global TSL Types ==============================
|
|
1178
|
-
|
|
1179
|
-
declare global {
|
|
1180
|
-
/**
|
|
1181
|
-
* Broad callable-node fallback for dynamic store readers.
|
|
1182
|
-
* Creator hooks preserve the exact function signatures inferred from Three's `Fn`.
|
|
1183
|
-
*/
|
|
1184
|
-
type CallableTSLNode = ((...params: never[]) => unknown) & {
|
|
1185
|
-
readonly shaderNode: unknown
|
|
1186
|
-
readonly id: number
|
|
1187
|
-
}
|
|
1188
|
-
|
|
1189
|
-
/** Legacy structural node accepted when at least one historical marker exists. */
|
|
1190
|
-
type LegacyTSLNodeLike = {
|
|
1191
|
-
label?: ((label: string) => unknown) | string
|
|
1192
|
-
setName?: (name: string) => unknown
|
|
1193
|
-
} & ({ uuid: string | undefined; nodeType?: string | null } | { uuid?: string; nodeType: string | null | undefined })
|
|
1194
|
-
|
|
1195
|
-
/** Node type accepted by broad dynamic node-store readers. */
|
|
1196
|
-
type TSLNodeType = three_webgpu.Node | CallableTSLNode
|
|
1197
|
-
|
|
1198
|
-
/**
|
|
1199
|
-
* Derive Three's shader node type from an existing node or a supported raw input.
|
|
1200
|
-
* Existing InputNode generics take precedence over structural value normalization.
|
|
1201
|
-
* Both generics must be inferred because Three's UniformNode intersects an unknown-typed
|
|
1202
|
-
* InputNode base with its concrete InputNode specialization.
|
|
1203
|
-
*/
|
|
1204
|
-
type UniformNodeType<T> = T extends three_webgpu.UniformNode<infer TNodeType, infer _TValue>
|
|
1205
|
-
? TNodeType
|
|
1206
|
-
: T extends three_webgpu.InputNode<infer TNodeType, infer _TValue>
|
|
1207
|
-
? TNodeType
|
|
1208
|
-
: T extends number
|
|
1209
|
-
? 'float'
|
|
1210
|
-
: T extends boolean
|
|
1211
|
-
? 'bool'
|
|
1212
|
-
: T extends string | three_webgpu.Color | { r: number; g: number; b: number }
|
|
1213
|
-
? 'color'
|
|
1214
|
-
: T extends three_webgpu.Vector4 | { x: number; y: number; z: number; w: number }
|
|
1215
|
-
? 'vec4'
|
|
1216
|
-
: T extends three_webgpu.Vector3 | { x: number; y: number; z: number }
|
|
1217
|
-
? 'vec3'
|
|
1218
|
-
: T extends three_webgpu.Vector2 | { x: number; y: number }
|
|
1219
|
-
? 'vec2'
|
|
1220
|
-
: T extends three_webgpu.Matrix4
|
|
1221
|
-
? 'mat4'
|
|
1222
|
-
: T extends three_webgpu.Matrix3
|
|
1223
|
-
? 'mat3'
|
|
1224
|
-
: T extends three_webgpu.Matrix2
|
|
1225
|
-
? 'mat2'
|
|
1226
|
-
: unknown
|
|
1227
|
-
|
|
1228
|
-
/** Derive the normalized JavaScript value stored by a uniform node. */
|
|
1229
|
-
type UniformNodeValue<T> = T extends three_webgpu.UniformNode<infer _TNodeType, infer TValue>
|
|
1230
|
-
? TValue
|
|
1231
|
-
: T extends three_webgpu.InputNode<infer _TNodeType, infer TValue>
|
|
1232
|
-
? TValue
|
|
1233
|
-
: T extends string | { r: number; g: number; b: number }
|
|
1234
|
-
? three_webgpu.Color
|
|
1235
|
-
: T extends { x: number; y: number; z: number; w: number }
|
|
1236
|
-
? three_webgpu.Vector4
|
|
1237
|
-
: T extends { x: number; y: number; z: number }
|
|
1238
|
-
? three_webgpu.Vector3
|
|
1239
|
-
: T extends { x: number; y: number }
|
|
1240
|
-
? three_webgpu.Vector2
|
|
1241
|
-
: T extends number
|
|
1242
|
-
? number
|
|
1243
|
-
: T extends boolean
|
|
1244
|
-
? boolean
|
|
1245
|
-
: T
|
|
1246
|
-
|
|
1247
|
-
/** Three's exact UniformNode with shader and value generics derived from an input. */
|
|
1248
|
-
type UniformNodeFor<T> = three_webgpu.UniformNode<UniformNodeType<T>, UniformNodeValue<T>>
|
|
1249
|
-
|
|
1250
|
-
/** Preserve every input key while mapping values to exact Three uniform nodes. */
|
|
1251
|
-
type UniformNodesFor<T extends UniformInputRecord> = {
|
|
1252
|
-
[K in keyof T]: UniformNodeFor<T[K]>
|
|
1253
|
-
}
|
|
1254
|
-
|
|
1255
|
-
/** Backward-compatible single-parameter uniform alias. */
|
|
1256
|
-
type UniformNode<T = unknown> = UniformNodeFor<T>
|
|
1257
|
-
|
|
1258
|
-
/** Flat record of uniform nodes (no nested scopes) */
|
|
1259
|
-
type UniformRecord<T extends UniformNode = UniformNode> = Record<string, T>
|
|
1260
|
-
|
|
1261
|
-
/**
|
|
1262
|
-
* Uniform store that can contain both root-level uniforms and scoped uniform objects
|
|
1263
|
-
* Used by state.uniforms which has structure like:
|
|
1264
|
-
* { uTime: UniformNode, player: { uHealth: UniformNode }, enemy: { uHealth: UniformNode } }
|
|
1265
|
-
*/
|
|
1266
|
-
type UniformStore = Record<string, UniformNode | UniformRecord>
|
|
1267
|
-
|
|
1268
|
-
/**
|
|
1269
|
-
* Helper to safely access a uniform node from the store.
|
|
1270
|
-
* Use this when accessing state.uniforms to get proper typing.
|
|
1271
|
-
* @example
|
|
1272
|
-
* const uTime = uniforms.uTime as UniformNode<number>
|
|
1273
|
-
* const uColor = uniforms.uColor as UniformNode<import('three/webgpu').Color>
|
|
1274
|
-
*/
|
|
1275
|
-
type GetUniform<T = unknown> = UniformNode<T>
|
|
1276
|
-
|
|
1277
|
-
/**
|
|
1278
|
-
* Acceptable input values for useUniforms - raw values that get converted to UniformNodes
|
|
1279
|
-
* Supports:
|
|
1280
|
-
* - Primitives: number, string (color), boolean
|
|
1281
|
-
* - Three.js types: Color, Vector2/3/4, Matrix2/3/4
|
|
1282
|
-
* - Plain objects: { x, y, z, w } converted to vectors
|
|
1283
|
-
* - TSL nodes: color(), vec3(), float() for type casting
|
|
1284
|
-
* - UniformNode: existing uniforms (reused as-is)
|
|
1285
|
-
*/
|
|
1286
|
-
type UniformValue =
|
|
1287
|
-
| number
|
|
1288
|
-
| string
|
|
1289
|
-
| boolean
|
|
1290
|
-
| three_webgpu.Color
|
|
1291
|
-
| three_webgpu.Vector2
|
|
1292
|
-
| three_webgpu.Vector3
|
|
1293
|
-
| three_webgpu.Vector4
|
|
1294
|
-
| three_webgpu.Matrix2
|
|
1295
|
-
| three_webgpu.Matrix3
|
|
1296
|
-
| three_webgpu.Matrix4
|
|
1297
|
-
| { x: number; y: number }
|
|
1298
|
-
| { x: number; y: number; z: number }
|
|
1299
|
-
| { x: number; y: number; z: number; w: number }
|
|
1300
|
-
| { r: number; g: number; b: number; a?: number } // Plain objects converted to Color
|
|
1301
|
-
| three_webgpu.Node // TSL nodes like color(), vec3(), float() for type casting
|
|
1302
|
-
| UniformNode
|
|
1303
|
-
|
|
1304
|
-
/** Input record for useUniforms - accepts raw values or UniformNodes */
|
|
1305
|
-
type UniformInputRecord = Record<string, UniformValue>
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
|
-
declare global {
|
|
1309
|
-
/**
|
|
1310
|
-
* three's own render pipeline type. Named here so the rest of R3F refers to three's shape
|
|
1311
|
-
* rather than `any`. three r183 renamed `PostProcessing` to `RenderPipeline`; our peer floor
|
|
1312
|
-
* is r185, so the new name is the only one.
|
|
1313
|
-
*/
|
|
1314
|
-
type ThreeRenderPipeline = three_webgpu.RenderPipeline
|
|
1315
|
-
|
|
1316
|
-
/**
|
|
1317
|
-
* The pass `useRenderPipeline` creates for you: three's own `PassNode`, as returned by
|
|
1318
|
-
* `pass(scene, camera)` from `three/tsl`. Referenced from three so members like
|
|
1319
|
-
* `getTextureNode`, `setMRT` and `dispose` track the installed version.
|
|
1320
|
-
*/
|
|
1321
|
-
type ScenePassNode = three_webgpu.PassNode
|
|
1322
|
-
|
|
1323
|
-
/**
|
|
1324
|
-
* Pass record - stores TSL pass nodes for render pipeline.
|
|
1325
|
-
*
|
|
1326
|
-
* `scenePass` is the only key the library owns. It is optional here because this is also the
|
|
1327
|
-
* shape of `state.passes`, which is `{}` before the pipeline exists and again after `reset()`
|
|
1328
|
-
* or `clearPasses()`. Inside the callbacks it is always present; see
|
|
1329
|
-
* {@link RenderPipelineCallbackState}.
|
|
1330
|
-
*
|
|
1331
|
-
* Every other key is user-registered, via a callback's return value. Those are TSL nodes of
|
|
1332
|
-
* any kind, not only passes: texture reads of an MRT attachment, effect nodes, extra
|
|
1333
|
-
* `pass()` instances. `Node` is the common base, so that is the bound. Narrow at the call
|
|
1334
|
-
* site when you need a member, e.g. `passes.velocity as TextureNode`.
|
|
1335
|
-
*
|
|
1336
|
-
* The index signature admits `undefined` because a key may simply not be registered, and
|
|
1337
|
-
* because the optional `scenePass` must be assignable to it: under `skipLibCheck: false` an
|
|
1338
|
-
* optional property whose type excludes `undefined` from the index signature is an error
|
|
1339
|
-
* (TS2411) for every consumer compiling these declarations.
|
|
1340
|
-
*/
|
|
1341
|
-
interface PassRecord {
|
|
1342
|
-
scenePass?: ScenePassNode
|
|
1343
|
-
[key: string]: three_webgpu.Node | undefined
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
|
-
/**
|
|
1347
|
-
* State passed to pipeline callbacks after the active pipeline has been created.
|
|
1348
|
-
*
|
|
1349
|
-
* `passes.scenePass` is required here: the hook installs the default scene pass before either
|
|
1350
|
-
* callback runs, so callbacks can use it without a guard or a cast.
|
|
1351
|
-
*
|
|
1352
|
-
* `renderer` is narrowed to `WebGPURenderer` and `isLegacy` to `false`: the hook throws under
|
|
1353
|
-
* the legacy renderer before either callback can run, so a callback never sees WebGL.
|
|
1354
|
-
*/
|
|
1355
|
-
type RenderPipelineCallbackState = RootState & {
|
|
1356
|
-
renderPipeline: ThreeRenderPipeline
|
|
1357
|
-
passes: PassRecord & { scenePass: ScenePassNode }
|
|
1358
|
-
renderer: three_webgpu.WebGPURenderer
|
|
1359
|
-
isLegacy: false
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1362
|
-
/**
|
|
1363
|
-
* What a callback may return to register entries into `state.passes`.
|
|
1364
|
-
*
|
|
1365
|
-
* `scenePass` is reserved. The hook owns that entry and its lifecycle: it caches the pass it
|
|
1366
|
-
* created, and `rebuild()` / `reset()` dispose that cached pass. A callback overwriting the
|
|
1367
|
-
* store entry would leave the store pointing at a node the hook never disposes, and the hook
|
|
1368
|
-
* disposing a pass nothing references. So returning it is a type error.
|
|
1369
|
-
*/
|
|
1370
|
-
type RegisteredPasses = Record<string, three_webgpu.Node> & { scenePass?: never }
|
|
1371
|
-
|
|
1372
|
-
/** Setup callback - runs first to configure MRT, create additional passes */
|
|
1373
|
-
type RenderPipelineSetupCallback = (state: RenderPipelineCallbackState) => RegisteredPasses | void
|
|
1374
|
-
|
|
1375
|
-
/** Main callback - runs second to configure outputNode, create effect passes */
|
|
1376
|
-
type RenderPipelineMainCallback = (state: RenderPipelineCallbackState) => RegisteredPasses | void
|
|
1377
|
-
|
|
1378
|
-
/** The imperative half of useRenderPipeline's return value, present in every state */
|
|
1379
|
-
interface UseRenderPipelineActions {
|
|
1380
|
-
/** Current passes from state */
|
|
1381
|
-
passes: PassRecord
|
|
1382
|
-
/** Clear all passes from state */
|
|
1383
|
-
clearPasses: () => void
|
|
1384
|
-
/** Reset RenderPipeline entirely (clears PP + passes) */
|
|
1385
|
-
reset: () => void
|
|
1386
|
-
/** Re-run setup/main callbacks with current closure values */
|
|
1387
|
-
rebuild: () => void
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1390
|
-
/**
|
|
1391
|
-
* Return type for useRenderPipeline hook, discriminated on `isReady`.
|
|
1392
|
-
*
|
|
1393
|
-
* `if (isReady)` narrows `renderPipeline` to non-null, which is what the docs already tell
|
|
1394
|
-
* callers to check. `passes.scenePass` deliberately stays optional in the ready branch:
|
|
1395
|
-
* `clearPasses()` empties the record while leaving the pipeline in place.
|
|
1396
|
-
*/
|
|
1397
|
-
type UseRenderPipelineReturn = UseRenderPipelineActions &
|
|
1398
|
-
(
|
|
1399
|
-
| {
|
|
1400
|
-
/** True when RenderPipeline is configured and ready */
|
|
1401
|
-
isReady: true
|
|
1402
|
-
/** RenderPipeline instance */
|
|
1403
|
-
renderPipeline: ThreeRenderPipeline
|
|
1404
|
-
}
|
|
1405
|
-
| {
|
|
1406
|
-
/** False until the pipeline has been created */
|
|
1407
|
-
isReady: false
|
|
1408
|
-
/** Not initialized yet, or torn down by reset() */
|
|
1409
|
-
renderPipeline: null
|
|
1410
|
-
}
|
|
1411
|
-
)
|
|
1412
|
-
}
|
|
1413
|
-
|
|
1414
1080
|
type MutableOrReadonlyParameters<T extends (...args: any) => any> = Parameters<T> | Readonly<Parameters<T>>
|
|
1415
1081
|
|
|
1416
1082
|
interface MathRepresentation {
|
|
@@ -3846,303 +3512,6 @@ declare function isOnce(value: unknown): value is {
|
|
|
3846
3512
|
[ONCE]: any[] | true;
|
|
3847
3513
|
};
|
|
3848
3514
|
|
|
3849
|
-
/** Distinguishes a resource leaf from a nested resource scope. */
|
|
3850
|
-
type ResourceLeafGuard<T> = (value: unknown) => value is T;
|
|
3851
|
-
|
|
3852
|
-
/**
|
|
3853
|
-
* ScopedStore - Type-safe wrapper for nested stores (uniforms, nodes)
|
|
3854
|
-
*
|
|
3855
|
-
* Provides TypeScript-friendly access to uniform/node stores where the runtime
|
|
3856
|
-
* structure is `Record<string, T | Record<string, T>>` (leaf nodes or nested scopes).
|
|
3857
|
-
*
|
|
3858
|
-
* The wrapper uses a Proxy to:
|
|
3859
|
-
* 1. Return `T` for property access (type assumption: assumes leaf node)
|
|
3860
|
-
* 2. Provide `.scope(key)` method for explicit nested access
|
|
3861
|
-
* 3. Support iteration methods: has(), keys(), Object.keys(), for...in
|
|
3862
|
-
*
|
|
3863
|
-
* @example
|
|
3864
|
-
* ```tsx
|
|
3865
|
-
* useLocalNodes(({ uniforms }) => ({
|
|
3866
|
-
* wobble: sin(uniforms.uTime.mul(2)), // No cast needed!
|
|
3867
|
-
* playerHealth: uniforms.scope('player').uHealth // Explicit scope access
|
|
3868
|
-
* }))
|
|
3869
|
-
* ```
|
|
3870
|
-
*/
|
|
3871
|
-
|
|
3872
|
-
/**
|
|
3873
|
-
* Type-safe wrapper interface for accessing nested store data.
|
|
3874
|
-
* Property access returns `T` (assumes leaf node).
|
|
3875
|
-
* Use `.scope(key)` for nested object access.
|
|
3876
|
-
*
|
|
3877
|
-
*/
|
|
3878
|
-
type ScopedStoreMethods<TLeaf> = {
|
|
3879
|
-
/** Access a nested scope by key. Returns empty wrapper if scope doesn't exist. */
|
|
3880
|
-
scope<TScope extends Record<string, TLeaf> = Record<string, TLeaf>>(key: string): ScopedStoreType<TLeaf, TScope>;
|
|
3881
|
-
/** Check if a key exists in the store */
|
|
3882
|
-
has(key: string): boolean;
|
|
3883
|
-
/** Get all keys in the store */
|
|
3884
|
-
keys(): string[];
|
|
3885
|
-
};
|
|
3886
|
-
type ScopedStoreType<TLeaf, TEntries extends Record<string, TLeaf> = Record<string, TLeaf>> = Readonly<TEntries> & ScopedStoreMethods<TLeaf>;
|
|
3887
|
-
interface ScopedStoreData<TLeaf> {
|
|
3888
|
-
[key: string]: TLeaf | ScopedStoreData<TLeaf>;
|
|
3889
|
-
}
|
|
3890
|
-
/**
|
|
3891
|
-
* Create a type-safe ScopedStore wrapper around store data.
|
|
3892
|
-
* @param data - The raw store data (uniforms or nodes from RootState)
|
|
3893
|
-
* @returns A ScopedStoreType wrapper with type-safe access
|
|
3894
|
-
*/
|
|
3895
|
-
declare function createScopedStore<TLeaf>(data: ScopedStoreData<TLeaf>, isLeaf: ResourceLeafGuard<TLeaf>): ScopedStoreType<TLeaf>;
|
|
3896
|
-
/**
|
|
3897
|
-
* State type passed to creator functions with ScopedStore wrappers.
|
|
3898
|
-
* Provides type-safe access to uniforms, nodes, buffers, and gpuStorage without manual casting.
|
|
3899
|
-
*/
|
|
3900
|
-
type CreatorState = Omit<RootState, 'uniforms' | 'nodes' | 'buffers' | 'gpuStorage'> & {
|
|
3901
|
-
/** Type-safe uniform access - property access returns UniformNode */
|
|
3902
|
-
uniforms: ScopedStoreType<UniformNode>;
|
|
3903
|
-
/** Type-safe node access for real, callable, and legacy structural nodes */
|
|
3904
|
-
nodes: ScopedStoreType<NodeLike>;
|
|
3905
|
-
/** Type-safe buffer access - property access returns BufferLike (TypedArrays, BufferAttributes, TSL nodes) */
|
|
3906
|
-
buffers: ScopedStoreType<BufferLike>;
|
|
3907
|
-
/** Type-safe GPU storage access - property access returns StorageLike (StorageTexture, TSL nodes) */
|
|
3908
|
-
gpuStorage: ScopedStoreType<StorageLike>;
|
|
3909
|
-
};
|
|
3910
|
-
|
|
3911
|
-
/** Creator function that returns uniform inputs (can be raw values or UniformNodes) */
|
|
3912
|
-
type UniformCreator<T extends UniformInputRecord = UniformInputRecord> = (state: CreatorState) => T;
|
|
3913
|
-
/** Function signature for removeUniforms util */
|
|
3914
|
-
type RemoveUniformsFn = (names: string | string[], scope?: string) => void;
|
|
3915
|
-
/** Function signature for clearUniforms util */
|
|
3916
|
-
type ClearUniformsFn = (scope?: string) => void;
|
|
3917
|
-
/** Function signature for rebuildUniforms util */
|
|
3918
|
-
type RebuildUniformsFn = (scope?: string) => void;
|
|
3919
|
-
/** Return type with utils included */
|
|
3920
|
-
type UniformsWithUtils<T extends UniformRecord | UniformStore = UniformRecord> = T & {
|
|
3921
|
-
removeUniforms: RemoveUniformsFn;
|
|
3922
|
-
clearUniforms: ClearUniformsFn;
|
|
3923
|
-
rebuildUniforms: RebuildUniformsFn;
|
|
3924
|
-
};
|
|
3925
|
-
declare function useUniforms<T extends UniformInputRecord>(creator: UniformCreator<T>): UniformsWithUtils<UniformNodesFor<T>>;
|
|
3926
|
-
declare function useUniforms<T extends UniformInputRecord>(creator: UniformCreator<T>, scope: string): UniformsWithUtils<UniformNodesFor<T>>;
|
|
3927
|
-
declare function useUniforms<T extends UniformInputRecord>(uniforms: T): UniformsWithUtils<UniformNodesFor<T>>;
|
|
3928
|
-
declare function useUniforms<T extends UniformInputRecord>(uniforms: T, scope: string): UniformsWithUtils<UniformNodesFor<T>>;
|
|
3929
|
-
declare function useUniforms(): UniformsWithUtils<UniformStore>;
|
|
3930
|
-
declare function useUniforms(scope: string): UniformsWithUtils;
|
|
3931
|
-
declare function useUniforms<T extends UniformInputRecord>(scope?: string): UniformsWithUtils<UniformNodesFor<T>>;
|
|
3932
|
-
/**
|
|
3933
|
-
* Global rebuildUniforms function for HMR integration.
|
|
3934
|
-
* Invalidates cached uniforms and increments _hmrVersion to trigger re-creation.
|
|
3935
|
-
* Call this when HMR is detected to refresh all uniform creators.
|
|
3936
|
-
*
|
|
3937
|
-
* Resolves to the primary store so shared TSL resources rebuild on the
|
|
3938
|
-
* authoritative store.
|
|
3939
|
-
*
|
|
3940
|
-
* @param store - The R3F store (from useStore or context)
|
|
3941
|
-
* @param scope - Optional scope to rebuild ('root' for root only, string for specific scope, undefined for all)
|
|
3942
|
-
*/
|
|
3943
|
-
declare function rebuildAllUniforms(store: ReturnType<typeof useStore>, scope?: string): void;
|
|
3944
|
-
/**
|
|
3945
|
-
* Remove uniforms by name from root level or a scope
|
|
3946
|
-
* @deprecated Use `const { removeUniforms } = useUniforms()` instead
|
|
3947
|
-
*/
|
|
3948
|
-
declare function removeUniforms(set: ReturnType<typeof useStore>['setState'], names: string[], scope?: string): void;
|
|
3949
|
-
/**
|
|
3950
|
-
* Clear all uniforms from a scope (removes the entire scope object)
|
|
3951
|
-
* @deprecated Use `const { clearUniforms } = useUniforms()` instead
|
|
3952
|
-
*/
|
|
3953
|
-
declare function clearScope(set: ReturnType<typeof useStore>['setState'], scope: string): void;
|
|
3954
|
-
/**
|
|
3955
|
-
* Clear all root-level uniforms (preserves scopes)
|
|
3956
|
-
* @deprecated Use `const { clearUniforms } = useUniforms()` with `clearUniforms('root')` instead
|
|
3957
|
-
*/
|
|
3958
|
-
declare function clearRootUniforms(set: ReturnType<typeof useStore>['setState']): void;
|
|
3959
|
-
|
|
3960
|
-
/**
|
|
3961
|
-
* Supported uniform value types:
|
|
3962
|
-
* - Raw values: number, boolean, Vector2, Vector3, Vector4, Color, Matrix2, Matrix3, Matrix4
|
|
3963
|
-
* - String colors: '#ff0000', 'red', 'rgb(255,0,0)' (auto-converted to Color)
|
|
3964
|
-
* - TSL nodes: color(), vec3(), float(), etc. (for type casting)
|
|
3965
|
-
* - UniformNode: existing uniforms (reused as-is)
|
|
3966
|
-
*/
|
|
3967
|
-
type UniformValue = number | boolean | string | Vector2$1 | Vector3$1 | Vector4$1 | Color$2 | Matrix2 | Matrix3$1 | Matrix4$1 | Node | UniformNode;
|
|
3968
|
-
declare function useUniform<T extends UniformValue = UniformValue>(name: string): UniformNodeFor<T>;
|
|
3969
|
-
declare function useUniform<T extends UniformValue>(name: string, value: T): UniformNodeFor<T>;
|
|
3970
|
-
|
|
3971
|
-
/**
|
|
3972
|
-
* Every node representation a creator may return. The definition lives with the store types as
|
|
3973
|
-
* `NodeLike`, so the shape creators return and the shape `state.nodes` holds are one type by
|
|
3974
|
-
* construction: three's real `Node`, the callable proxy `Fn()` returns, or the legacy structural
|
|
3975
|
-
* `{ uuid, nodeType }` shape.
|
|
3976
|
-
*/
|
|
3977
|
-
type TSLNodeLike = NodeLike;
|
|
3978
|
-
|
|
3979
|
-
/** Backward-compatible alias covering every accepted node representation. */
|
|
3980
|
-
type TSLNode = TSLNodeLike;
|
|
3981
|
-
/**
|
|
3982
|
-
* Creator function that returns a record of nodes.
|
|
3983
|
-
* Exact creator return inference is preserved within the compatible node constraint.
|
|
3984
|
-
*/
|
|
3985
|
-
type NodeCreator<T extends Record<string, TSLNodeLike>> = (state: CreatorState) => T;
|
|
3986
|
-
/** Function signature for removeNodes util */
|
|
3987
|
-
type RemoveNodesFn = (names: string | string[], scope?: string) => void;
|
|
3988
|
-
/** Function signature for clearNodes util */
|
|
3989
|
-
type ClearNodesFn = (scope?: string) => void;
|
|
3990
|
-
/** Function signature for rebuildNodes util */
|
|
3991
|
-
type RebuildNodesFn = (scope?: string) => void;
|
|
3992
|
-
/** Return type with utils included */
|
|
3993
|
-
type NodesWithUtils<T extends Record<string, unknown> = NodeRecord> = T & {
|
|
3994
|
-
removeNodes: RemoveNodesFn;
|
|
3995
|
-
clearNodes: ClearNodesFn;
|
|
3996
|
-
rebuildNodes: RebuildNodesFn;
|
|
3997
|
-
};
|
|
3998
|
-
declare function useNodes(): NodesWithUtils<NodeStore>;
|
|
3999
|
-
declare function useNodes(scope: string): NodesWithUtils<NodeRecord>;
|
|
4000
|
-
declare function useNodes<T extends NodeRecord>(scope?: string): NodesWithUtils<T>;
|
|
4001
|
-
declare function useNodes<T extends NodeRecord>(creator: NodeCreator<T>): NodesWithUtils<T>;
|
|
4002
|
-
declare function useNodes<T extends NodeRecord>(creator: NodeCreator<T>, scope: string): NodesWithUtils<T>;
|
|
4003
|
-
declare function useNodes(creatorOrScope?: NodeCreator<NodeRecord> | string, scope?: string): NodesWithUtils<Record<string, unknown>>;
|
|
4004
|
-
/**
|
|
4005
|
-
* Global rebuildNodes function for HMR integration.
|
|
4006
|
-
* Invalidates cached nodes and increments _hmrVersion to trigger re-creation.
|
|
4007
|
-
* Call this when HMR is detected to refresh all node creators.
|
|
4008
|
-
*
|
|
4009
|
-
* Resolves to the primary store so shared TSL resources rebuild on the
|
|
4010
|
-
* authoritative store.
|
|
4011
|
-
*
|
|
4012
|
-
* @param store - The R3F store (from useStore or context)
|
|
4013
|
-
* @param scope - Optional scope to rebuild ('root' for root only, string for specific scope, undefined for all)
|
|
4014
|
-
*/
|
|
4015
|
-
declare function rebuildAllNodes(store: ReturnType<typeof useStore>, scope?: string): void;
|
|
4016
|
-
/**
|
|
4017
|
-
* Remove nodes by name from root level or a scope
|
|
4018
|
-
* @deprecated Use `const { removeNodes } = useNodes()` instead
|
|
4019
|
-
*/
|
|
4020
|
-
declare function removeNodes(set: ReturnType<typeof useStore>['setState'], names: string[], scope?: string): void;
|
|
4021
|
-
/**
|
|
4022
|
-
* Clear all nodes from a scope (removes the entire scope object)
|
|
4023
|
-
* @deprecated Use `const { clearNodes } = useNodes()` instead
|
|
4024
|
-
*/
|
|
4025
|
-
declare function clearNodeScope(set: ReturnType<typeof useStore>['setState'], scope: string): void;
|
|
4026
|
-
/**
|
|
4027
|
-
* Clear all root-level nodes (preserves scopes)
|
|
4028
|
-
* @deprecated Use `const { clearNodes } = useNodes()` with `clearNodes('root')` instead
|
|
4029
|
-
*/
|
|
4030
|
-
declare function clearRootNodes(set: ReturnType<typeof useStore>['setState']): void;
|
|
4031
|
-
|
|
4032
|
-
/** Creator receives CreatorState with ScopedStore wrappers for type-safe access. Returns any record. */
|
|
4033
|
-
type LocalNodeCreator<T extends Record<string, unknown>> = (state: CreatorState) => T;
|
|
4034
|
-
/**
|
|
4035
|
-
* Creates local values that rebuild when uniforms, nodes, or textures change.
|
|
4036
|
-
*
|
|
4037
|
-
* Unlike `useNodes`, this does NOT register to the global store.
|
|
4038
|
-
* Use for component-specific nodes/values that depend on shared resources.
|
|
4039
|
-
*
|
|
4040
|
-
* @example
|
|
4041
|
-
* ```tsx
|
|
4042
|
-
* // Destructure what you need from state
|
|
4043
|
-
* const { wobble, uTime } = useLocalNodes(({ uniforms, nodes }) => ({
|
|
4044
|
-
* wobble: sin(uniforms.uTime.mul(2)),
|
|
4045
|
-
* uTime: uniforms.uTime, // can return uniforms too
|
|
4046
|
-
* }))
|
|
4047
|
-
*
|
|
4048
|
-
* // Or access anything else from RootState
|
|
4049
|
-
* const { scaled } = useLocalNodes(({ camera, nodes }) => ({
|
|
4050
|
-
* scaled: nodes.basePos.mul(camera.zoom),
|
|
4051
|
-
* }))
|
|
4052
|
-
*
|
|
4053
|
-
* // Type-safe uniform access
|
|
4054
|
-
* const { colorNode } = useLocalNodes(({ uniforms }) => {
|
|
4055
|
-
* const uValue = uniforms.myUniform as UniformNode<number>
|
|
4056
|
-
* return { colorNode: mix(colorA, colorB, uValue) }
|
|
4057
|
-
* })
|
|
4058
|
-
* ```
|
|
4059
|
-
*/
|
|
4060
|
-
declare function useLocalNodes<T extends Record<string, unknown>>(creator: LocalNodeCreator<T>): T;
|
|
4061
|
-
|
|
4062
|
-
/**
|
|
4063
|
-
* A record of buffer-like values - allows mixed types (TypedArrays, BufferAttributes, TSL nodes)
|
|
4064
|
-
*/
|
|
4065
|
-
type BufferRecordType<T extends BufferLike = BufferLike> = Record<string, T>;
|
|
4066
|
-
/**
|
|
4067
|
-
* Creator function that returns a record of buffers.
|
|
4068
|
-
* Receives CreatorState with access to existing buffers, gpuStorage, uniforms, nodes, etc.
|
|
4069
|
-
*/
|
|
4070
|
-
type BufferCreator<T extends Record<string, BufferLike>> = (state: CreatorState) => T;
|
|
4071
|
-
/** Function signature for removeBuffers util */
|
|
4072
|
-
type RemoveBuffersFn = (names: string | string[], scope?: string) => void;
|
|
4073
|
-
/** Function signature for clearBuffers util */
|
|
4074
|
-
type ClearBuffersFn = (scope?: string) => void;
|
|
4075
|
-
/** Function signature for rebuildBuffers util */
|
|
4076
|
-
type RebuildBuffersFn = (scope?: string) => void;
|
|
4077
|
-
/** Function signature for disposeBuffers util - releases GPU resources */
|
|
4078
|
-
type DisposeBuffersFn = (names: string | string[], scope?: string) => void;
|
|
4079
|
-
/** Return type with utils included */
|
|
4080
|
-
type BuffersWithUtils<T extends BufferRecordType | BufferStore = BufferRecordType> = T & {
|
|
4081
|
-
removeBuffers: RemoveBuffersFn;
|
|
4082
|
-
clearBuffers: ClearBuffersFn;
|
|
4083
|
-
rebuildBuffers: RebuildBuffersFn;
|
|
4084
|
-
disposeBuffers: DisposeBuffersFn;
|
|
4085
|
-
};
|
|
4086
|
-
declare function useBuffers(): BuffersWithUtils<BufferStore>;
|
|
4087
|
-
declare function useBuffers(scope: string): BuffersWithUtils<Record<string, BufferLike>>;
|
|
4088
|
-
declare function useBuffers<T extends Record<string, BufferLike>>(scope?: string): BuffersWithUtils<T>;
|
|
4089
|
-
declare function useBuffers<T extends Record<string, BufferLike>>(creator: BufferCreator<T>): BuffersWithUtils<T>;
|
|
4090
|
-
declare function useBuffers<T extends Record<string, BufferLike>>(creator: BufferCreator<T>, scope: string): BuffersWithUtils<T>;
|
|
4091
|
-
/**
|
|
4092
|
-
* Global rebuildBuffers function for HMR integration.
|
|
4093
|
-
* Invalidates cached buffers and increments _hmrVersion to trigger re-creation.
|
|
4094
|
-
* Call this when HMR is detected to refresh all buffer creators.
|
|
4095
|
-
*
|
|
4096
|
-
* Resolves to the primary store so shared TSL resources rebuild on the
|
|
4097
|
-
* authoritative store.
|
|
4098
|
-
*
|
|
4099
|
-
* @param store - The R3F store (from useStore or context)
|
|
4100
|
-
* @param scope - Optional scope to rebuild ('root' for root only, string for specific scope, undefined for all)
|
|
4101
|
-
*/
|
|
4102
|
-
declare function rebuildAllBuffers(store: ReturnType<typeof useStore>, scope?: string): void;
|
|
4103
|
-
|
|
4104
|
-
/**
|
|
4105
|
-
* A record of storage-like values - allows mixed types (StorageTexture, Storage3DTexture, TSL nodes)
|
|
4106
|
-
*/
|
|
4107
|
-
type StorageRecordType<T extends StorageLike = StorageLike> = Record<string, T>;
|
|
4108
|
-
/**
|
|
4109
|
-
* Creator function that returns a record of GPU storage objects.
|
|
4110
|
-
* Receives CreatorState with access to existing buffers, gpuStorage, uniforms, nodes, etc.
|
|
4111
|
-
*/
|
|
4112
|
-
type StorageCreator<T extends Record<string, StorageLike>> = (state: CreatorState) => T;
|
|
4113
|
-
/** Function signature for removeStorage util */
|
|
4114
|
-
type RemoveStorageFn = (names: string | string[], scope?: string) => void;
|
|
4115
|
-
/** Function signature for clearStorage util */
|
|
4116
|
-
type ClearStorageFn = (scope?: string) => void;
|
|
4117
|
-
/** Function signature for rebuildStorage util */
|
|
4118
|
-
type RebuildStorageFn = (scope?: string) => void;
|
|
4119
|
-
/** Function signature for disposeStorage util - releases GPU resources */
|
|
4120
|
-
type DisposeStorageFn = (names: string | string[], scope?: string) => void;
|
|
4121
|
-
/** Return type with utils included */
|
|
4122
|
-
type StorageWithUtils<T extends StorageRecordType | StorageStore = StorageRecordType> = T & {
|
|
4123
|
-
removeStorage: RemoveStorageFn;
|
|
4124
|
-
clearStorage: ClearStorageFn;
|
|
4125
|
-
rebuildStorage: RebuildStorageFn;
|
|
4126
|
-
disposeStorage: DisposeStorageFn;
|
|
4127
|
-
};
|
|
4128
|
-
declare function useGPUStorage(): StorageWithUtils<StorageStore>;
|
|
4129
|
-
declare function useGPUStorage(scope: string): StorageWithUtils<Record<string, StorageLike>>;
|
|
4130
|
-
declare function useGPUStorage<T extends Record<string, StorageLike>>(scope?: string): StorageWithUtils<T>;
|
|
4131
|
-
declare function useGPUStorage<T extends Record<string, StorageLike>>(creator: StorageCreator<T>): StorageWithUtils<T>;
|
|
4132
|
-
declare function useGPUStorage<T extends Record<string, StorageLike>>(creator: StorageCreator<T>, scope: string): StorageWithUtils<T>;
|
|
4133
|
-
/**
|
|
4134
|
-
* Global rebuildStorage function for HMR integration.
|
|
4135
|
-
* Invalidates cached storage and increments _hmrVersion to trigger re-creation.
|
|
4136
|
-
* Call this when HMR is detected to refresh all storage creators.
|
|
4137
|
-
*
|
|
4138
|
-
* Resolves to the primary store so shared TSL resources rebuild on the
|
|
4139
|
-
* authoritative store.
|
|
4140
|
-
*
|
|
4141
|
-
* @param store - The R3F store (from useStore or context)
|
|
4142
|
-
* @param scope - Optional scope to rebuild ('root' for root only, string for specific scope, undefined for all)
|
|
4143
|
-
*/
|
|
4144
|
-
declare function rebuildAllStorage(store: ReturnType<typeof useStore>, scope?: string): void;
|
|
4145
|
-
|
|
4146
3515
|
/**
|
|
4147
3516
|
* Re-export from core - useTextures is now a core R3F hook (a reactive Texture registry).
|
|
4148
3517
|
*
|
|
@@ -4168,49 +3537,6 @@ interface TextureOperations {
|
|
|
4168
3537
|
}
|
|
4169
3538
|
declare function createTextureOperations(set: StoreApi<RootState>['setState']): TextureOperations;
|
|
4170
3539
|
|
|
4171
|
-
/**
|
|
4172
|
-
* Hook for managing WebGPU RenderPipeline with automatic scenePass setup.
|
|
4173
|
-
*
|
|
4174
|
-
* Features:
|
|
4175
|
-
* - Creates RenderPipeline instance if not exists
|
|
4176
|
-
* - Creates default scenePass (no MRT) automatically
|
|
4177
|
-
* - Callbacks receive full RootState for flexibility
|
|
4178
|
-
* - No auto-cleanup on unmount - use reset() for explicit cleanup
|
|
4179
|
-
* - Scene/camera changes trigger scenePass recreation
|
|
4180
|
-
* - A replaced scenePass is disposed once the new graph is installed, so rebuild() does not
|
|
4181
|
-
* strand its render target (and MRT attachments) on the GPU
|
|
4182
|
-
* - Any run that changes the output node sets RenderPipeline.needsUpdate, so rebuild() actually
|
|
4183
|
-
* recompiles instead of silently keeping the first compiled graph
|
|
4184
|
-
*
|
|
4185
|
-
* @param mainCB - Main callback to configure outputNode and create effect passes
|
|
4186
|
-
* @param setupCB - Optional setup callback to configure MRT on scenePass
|
|
4187
|
-
* @returns { passes, renderPipeline, clearPasses, reset, rebuild }
|
|
4188
|
-
*
|
|
4189
|
-
* @example
|
|
4190
|
-
* ```tsx
|
|
4191
|
-
* // Simple effect
|
|
4192
|
-
* useRenderPipeline(({ renderPipeline, passes }) => {
|
|
4193
|
-
* renderPipeline.outputNode = bloom(passes.scenePass.getTextureNode())
|
|
4194
|
-
* })
|
|
4195
|
-
*
|
|
4196
|
-
* // With MRT setup
|
|
4197
|
-
* useRenderPipeline(
|
|
4198
|
-
* ({ renderPipeline, passes }) => {
|
|
4199
|
-
* const beauty = passes.scenePass.getTextureNode().toInspector('Color')
|
|
4200
|
-
* const vel = passes.scenePass.getTextureNode('velocity')
|
|
4201
|
-
* renderPipeline.outputNode = motionBlur(beauty, vel)
|
|
4202
|
-
* },
|
|
4203
|
-
* ({ passes }) => {
|
|
4204
|
-
* passes.scenePass.setMRT(mrt({ output, velocity }))
|
|
4205
|
-
* }
|
|
4206
|
-
* )
|
|
4207
|
-
*
|
|
4208
|
-
* // Read-only access
|
|
4209
|
-
* const { renderPipeline, passes } = useRenderPipeline()
|
|
4210
|
-
* ```
|
|
4211
|
-
*/
|
|
4212
|
-
declare function useRenderPipeline(mainCB?: RenderPipelineMainCallback, setupCB?: RenderPipelineSetupCallback): UseRenderPipelineReturn;
|
|
4213
|
-
|
|
4214
3540
|
//* Renderer Props ========================================
|
|
4215
3541
|
|
|
4216
3542
|
type WebGPUDefaultProps = Omit<WebGPURendererParameters, 'canvas'> & BaseRendererProps
|
|
@@ -4262,11 +3588,12 @@ interface WebGPURootState extends Omit<RootState, 'renderer' | 'gl' | 'internal'
|
|
|
4262
3588
|
* @fileoverview WebGPU entry point - WebGPU only, no legacy WebGL
|
|
4263
3589
|
*
|
|
4264
3590
|
* This entry point is for apps that want to use ONLY WebGPURenderer.
|
|
4265
|
-
* Includes WebGPU-specific hooks (useUniforms, useNodes, useTextures).
|
|
4266
3591
|
* Auto-extends THREE with WebGPU node materials (MeshBasicNodeMaterial, etc.)
|
|
3592
|
+
* The TSL resource hooks (useUniforms, useNodes, useRenderPipeline, ...) are in @react-three/tsl.
|
|
4267
3593
|
*
|
|
4268
3594
|
* Usage:
|
|
4269
|
-
* import { Canvas, useFrame
|
|
3595
|
+
* import { Canvas, useFrame } from '@react-three/fiber/webgpu'
|
|
3596
|
+
* import { useUniforms } from '@react-three/tsl'
|
|
4270
3597
|
*/
|
|
4271
3598
|
|
|
4272
3599
|
/** `useThree` narrowed to WebGPU state — `state.renderer` is a `WebGPURenderer`. */
|
|
@@ -4285,5 +3612,5 @@ type WebGPUCanvasProps = Omit<CanvasProps, 'onCreated'> & {
|
|
|
4285
3612
|
/** `Canvas` narrowed to WebGPU state — the same component, `onCreated` typed against `WebGPURootState`. */
|
|
4286
3613
|
declare const Canvas: (props: WebGPUCanvasProps) => JSX.Element;
|
|
4287
3614
|
|
|
4288
|
-
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,
|
|
4289
|
-
export type { Act, Args, ArgsProp, AttachFnType, AttachType, BackgroundConfig, BackgroundProp, BaseRendererProps,
|
|
3615
|
+
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, context, createEvents, createPointerEvents, createPortal, createRoot, 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, reconciler, registerPrimary, registerRootExtension, removeInteractivity, resolve, setRenderOverride, swapInteractivity, unmountComponentAtNode, unregisterPrimary, updateCamera, updateFrustum, useBridge, useEnvironment, useFrame, useGraph, useInstanceHandle, useIsomorphicLayoutEffect, useLoader, useMutableCallback, useRenderTarget, useStore, useTexture, useTextures, useThree, waitForPrimary };
|
|
3616
|
+
export type { Act, Args, ArgsProp, AttachFnType, AttachType, BackgroundConfig, BackgroundProp, BaseRendererProps, RootState as BaseRootState, Bridge, Camera, CameraProps, WebGPUCanvasProps as CanvasProps, CanvasSchedulerConfig, Catalogue, Color, ColorManagementConfig, ComputeFunction, ConstructorRepresentation, DefaultGLProps, DefaultRendererProps, Disposable, DisposeOptions, 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, MappedTextureType, MathProps, MathRepresentation, MathType, MathTypes, Matrix3, Matrix4, Mutable, MutableOrReadonlyParameters, NodeProps, NonFunctionKeys, Object3DMethod, ObjectMap, OffscreenCanvas$1 as OffscreenCanvas, OnceValue, Overwrite, Performance, PointerCaptureTarget, PointerState, PresetsType, PrimaryCanvasEntry, Properties, Quaternion, WebGPUR3FRenderer as R3FRenderer, RaycastableRepresentation, ReactProps, ReconcilerRoot, RenderCallback, RenderProps, RenderTargetOptions, Renderer, RendererConfigExtended, RendererFactory, RendererProps, Root, RootExtension, WebGPURootState as RootState, RootStore, SetBlock, Size, Subscription, TSLNodeInput, TextureEntry, TextureInput, TextureNode, TextureOperations, TextureResult, ThreeCamera, ThreeElement, ThreeElements, ThreeElementsImpl, ThreeEvent, ThreeExports, ThreeToJSXElements, UnblockProps, UseFrameWebGPU, UseTextureOptions, UseTexturesReturn, UseThreeWebGPU, Vector2, Vector3, Vector4, VectorRepresentation, Viewport, VisibilityEntry, WebGLDefaultProps, WebGLProps, WebGLShadowConfig, WebGPUCanvasProps, WebGPUDefaultProps, WebGPUProps, WebGPUShadowConfig, XRManager, XRPointerConfig };
|