@react-three/fiber 10.0.0-canary.164c7be → 10.0.0-canary.1be335a
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 +344 -145
- package/dist/index.d.cts +49 -25
- package/dist/index.d.mts +49 -25
- package/dist/index.d.ts +49 -25
- package/dist/index.mjs +347 -148
- package/dist/legacy.cjs +299 -100
- package/dist/legacy.d.cts +49 -24
- package/dist/legacy.d.mts +49 -24
- package/dist/legacy.d.ts +49 -24
- package/dist/legacy.mjs +301 -102
- package/dist/webgpu/index.cjs +631 -673
- package/dist/webgpu/index.d.cts +83 -29
- package/dist/webgpu/index.d.mts +83 -29
- package/dist/webgpu/index.d.ts +83 -29
- package/dist/webgpu/index.mjs +634 -676
- package/package.json +3 -3
- package/readme.md +2 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as three_webgpu from 'three/webgpu';
|
|
2
|
-
import { RenderTarget, WebGPURenderer, Node, StorageTexture, Data3DTexture, CanvasTarget, ShaderNodeObject, Euler as Euler$2, Color as Color$2, ColorRepresentation as ColorRepresentation$1, Layers as Layers$1, Raycaster, Intersection as Intersection$1, BufferGeometry, Matrix4 as Matrix4$1, Quaternion as Quaternion$1, Vector2 as Vector2$1, Vector3 as Vector3$1, Vector4 as Vector4$1, Matrix3 as Matrix3$1, Loader as Loader$1, ColorSpace, Texture as Texture$1, CubeTexture, Scene, Object3D, Frustum, OrthographicCamera } from 'three/webgpu';
|
|
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 } from 'three/webgpu';
|
|
3
3
|
import * as THREE$1 from 'three';
|
|
4
|
-
import { WebGLRenderTarget, WebGLRenderer, Color as Color$1, ColorRepresentation, Euler as Euler$1, Loader, RenderTargetOptions as RenderTargetOptions$1 } from 'three';
|
|
4
|
+
import { WebGLCubeRenderTarget, WebGLRenderTarget, WebGLRenderer, Color as Color$1, ColorRepresentation, Euler as Euler$1, Loader, RenderTargetOptions as RenderTargetOptions$1 } from 'three';
|
|
5
5
|
import { WebGLRendererParameters } from 'three/src/renderers/WebGLRenderer.js';
|
|
6
6
|
import { Inspector } from 'three/addons/inspector/Inspector.js';
|
|
7
7
|
import * as React$1 from 'react';
|
|
@@ -50,10 +50,13 @@ declare const R3F_BUILD_WEBGPU = true;
|
|
|
50
50
|
|
|
51
51
|
var THREE = /*#__PURE__*/_mergeNamespaces({
|
|
52
52
|
__proto__: null,
|
|
53
|
+
CubeRenderTarget: CubeRenderTarget,
|
|
54
|
+
CubeRenderTargetCompat: CubeRenderTarget,
|
|
53
55
|
Inspector: Inspector,
|
|
54
56
|
R3F_BUILD_LEGACY: R3F_BUILD_LEGACY,
|
|
55
57
|
R3F_BUILD_WEBGPU: R3F_BUILD_WEBGPU,
|
|
56
58
|
RenderTargetCompat: RenderTarget,
|
|
59
|
+
WebGLCubeRenderTarget: WebGLCubeRenderTarget,
|
|
57
60
|
WebGLRenderTarget: WebGLRenderTarget,
|
|
58
61
|
WebGLRenderer: WebGLRenderer,
|
|
59
62
|
WebGLRendererParameters: WebGLRendererParameters
|
|
@@ -496,7 +499,7 @@ interface InternalState {
|
|
|
496
499
|
canvasTarget?: CanvasTarget
|
|
497
500
|
/**
|
|
498
501
|
* Whether multi-canvas rendering is active.
|
|
499
|
-
* True when any canvas uses `
|
|
502
|
+
* True when any canvas uses `renderer={{ primaryCanvas: 'id' }}` to share a renderer.
|
|
500
503
|
* When true, setCanvasTarget is called before each render.
|
|
501
504
|
*/
|
|
502
505
|
isMultiCanvas?: boolean
|
|
@@ -594,8 +597,8 @@ interface RootState {
|
|
|
594
597
|
setSize: (width?: number, height?: number, top?: number, left?: number) => void
|
|
595
598
|
/** Shortcut to manual setting the pixel ratio */
|
|
596
599
|
setDpr: (dpr: Dpr) => void
|
|
597
|
-
/** Shortcut to setting frameloop flags */
|
|
598
|
-
setFrameloop: (frameloop
|
|
600
|
+
/** Shortcut to setting frameloop flags. No args resets to 'always'. */
|
|
601
|
+
setFrameloop: (frameloop?: Frameloop) => void
|
|
599
602
|
/** Set error state to propagate to error boundary */
|
|
600
603
|
setError: (error: Error | null) => void
|
|
601
604
|
/** Current error state (null when no error) */
|
|
@@ -613,7 +616,7 @@ interface RootState {
|
|
|
613
616
|
/** Internal: refcount per texture key, driven by mounted useTexture consumers (registry enrollment is on by default) */
|
|
614
617
|
_textureRefs: Map<string, number>
|
|
615
618
|
/** WebGPU RenderPipeline instance - use useRenderPipeline() hook */
|
|
616
|
-
renderPipeline:
|
|
619
|
+
renderPipeline: ThreeRenderPipeline | null
|
|
617
620
|
/** Global TSL pass nodes for render pipeline - use useRenderPipeline() hook */
|
|
618
621
|
passes: Record<string, any>
|
|
619
622
|
/** Internal version counter for HMR - incremented by rebuildNodes/rebuildUniforms to bust memoization */
|
|
@@ -906,8 +909,6 @@ interface Instance<O = any> {
|
|
|
906
909
|
attach?: AttachType<O>
|
|
907
910
|
previousAttach?: any
|
|
908
911
|
isHidden: boolean
|
|
909
|
-
/** Deferred ref props to apply in commitMount */
|
|
910
|
-
deferredRefs?: Array<{ prop: string; ref: React$1.RefObject<any> }>
|
|
911
912
|
/** Set of props that have been applied via once() */
|
|
912
913
|
appliedOnce?: Set<string>
|
|
913
914
|
}
|
|
@@ -1144,10 +1145,21 @@ type RenderTargetOptions = RenderTargetOptions$1
|
|
|
1144
1145
|
//* Global Types ==============================
|
|
1145
1146
|
|
|
1146
1147
|
declare global {
|
|
1147
|
-
/**
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1148
|
+
/**
|
|
1149
|
+
* Uniform node type.
|
|
1150
|
+
*
|
|
1151
|
+
* This is three's own `UniformNode`, not a re-declaration of it. It previously was a
|
|
1152
|
+
* hand-rolled `interface UniformNode<T> extends Node { value: T }`, which shadowed the real
|
|
1153
|
+
* exported type globally — so R3F's ~58 references resolved to an approximation that was
|
|
1154
|
+
* missing members three actually ships (`setName` among them) and had drifted to the wrong
|
|
1155
|
+
* arity when three made `UniformNode` two-parameter.
|
|
1156
|
+
*
|
|
1157
|
+
* three's signature is `UniformNode<TNodeType, TValue>`. R3F only ever varies the value type,
|
|
1158
|
+
* so the node type is fixed to `unknown` and the single parameter is kept for call-site
|
|
1159
|
+
* ergonomics. The result is three's structural type, so members stay in sync with the
|
|
1160
|
+
* installed three instead of needing to be mirrored by hand.
|
|
1161
|
+
*/
|
|
1162
|
+
type UniformNode<T = unknown> = three_webgpu.UniformNode<unknown, T>
|
|
1151
1163
|
|
|
1152
1164
|
/**
|
|
1153
1165
|
* ShaderCallable - the return type of Fn()
|
|
@@ -1292,13 +1304,14 @@ declare module 'three/tsl' {
|
|
|
1292
1304
|
): ShaderCallable<R>
|
|
1293
1305
|
}
|
|
1294
1306
|
|
|
1295
|
-
/**
|
|
1296
|
-
* RenderPipeline Types for useRenderPipeline hook (WebGPU only)
|
|
1297
|
-
*/
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
1307
|
declare global {
|
|
1308
|
+
/**
|
|
1309
|
+
* three's own render pipeline type. Named here so the rest of R3F refers to three's shape
|
|
1310
|
+
* rather than `any`. three r183 renamed `PostProcessing` to `RenderPipeline`; our peer floor
|
|
1311
|
+
* is r185, so the new name is the only one.
|
|
1312
|
+
*/
|
|
1313
|
+
type ThreeRenderPipeline = three_webgpu.RenderPipeline
|
|
1314
|
+
|
|
1302
1315
|
/** Pass record - stores TSL pass nodes for render pipeline */
|
|
1303
1316
|
type PassRecord = Record<string, any>
|
|
1304
1317
|
|
|
@@ -1313,7 +1326,7 @@ declare global {
|
|
|
1313
1326
|
/** Current passes from state */
|
|
1314
1327
|
passes: PassRecord
|
|
1315
1328
|
/** RenderPipeline instance (null if not initialized) */
|
|
1316
|
-
renderPipeline:
|
|
1329
|
+
renderPipeline: ThreeRenderPipeline | null
|
|
1317
1330
|
/** Clear all passes from state */
|
|
1318
1331
|
clearPasses: () => void
|
|
1319
1332
|
/** Reset RenderPipeline entirely (clears PP + passes) */
|
|
@@ -1494,7 +1507,7 @@ declare namespace three_d {
|
|
|
1494
1507
|
* a single WebGPURenderer using Three.js CanvasTarget API.
|
|
1495
1508
|
*
|
|
1496
1509
|
* Primary canvas: Has `id` prop, creates its own renderer, registers here
|
|
1497
|
-
* Secondary canvas: Has `
|
|
1510
|
+
* Secondary canvas: Has `renderer={{ primaryCanvas: 'id' }}`, shares primary's renderer via CanvasTarget
|
|
1498
1511
|
*/
|
|
1499
1512
|
|
|
1500
1513
|
interface PrimaryCanvasEntry {
|
|
@@ -1562,12 +1575,23 @@ type EnvironmentLoaderProps = {
|
|
|
1562
1575
|
* const texture = useEnvironment({ preset: 'sunset' })
|
|
1563
1576
|
* ```
|
|
1564
1577
|
*/
|
|
1565
|
-
declare function useEnvironment({ files, path, preset, colorSpace, extensions, }?: Partial<EnvironmentLoaderProps>): Texture$1<unknown> | CubeTexture
|
|
1578
|
+
declare function useEnvironment({ files, path, preset, colorSpace, extensions, }?: Partial<EnvironmentLoaderProps>): Texture$1<unknown, THREE$1.TextureEventMap> | CubeTexture<unknown>;
|
|
1566
1579
|
declare namespace useEnvironment {
|
|
1567
1580
|
var preload: (preloadOptions?: EnvironmentLoaderPreloadOptions) => void;
|
|
1568
1581
|
var clear: (clearOptions?: EnvironmentLoaderClearOptions) => void;
|
|
1569
1582
|
}
|
|
1570
|
-
|
|
1583
|
+
/**
|
|
1584
|
+
* Options accepted by `useEnvironment.preload`.
|
|
1585
|
+
*
|
|
1586
|
+
* `colorSpace` is deliberately omitted: preload only warms the loader cache, and colorSpace is
|
|
1587
|
+
* applied to the texture by `useEnvironment()` at use time, per consumer. Accepting it here would
|
|
1588
|
+
* advertise an option this function silently ignores.
|
|
1589
|
+
*
|
|
1590
|
+
* This previously read `Omit<…, 'encoding'>` — omitting a key that does not exist on
|
|
1591
|
+
* `EnvironmentLoaderProps`, a leftover from three's pre-`colorSpace` `encoding` API. That made the
|
|
1592
|
+
* type equivalent to the full props, so `colorSpace` was accepted and then dropped on the floor.
|
|
1593
|
+
*/
|
|
1594
|
+
type EnvironmentLoaderPreloadOptions = Omit<EnvironmentLoaderProps, 'colorSpace'>;
|
|
1571
1595
|
type EnvironmentLoaderClearOptions = Pick<EnvironmentLoaderProps, 'files' | 'preset'>;
|
|
1572
1596
|
|
|
1573
1597
|
/**
|
|
@@ -1817,10 +1841,10 @@ declare function getLoader<L extends LoaderLike | ConstructorRepresentation<Load
|
|
|
1817
1841
|
* Note: this hook's caller must be wrapped with `React.Suspense`
|
|
1818
1842
|
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
|
|
1819
1843
|
*/
|
|
1820
|
-
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>;
|
|
1844
|
+
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>;
|
|
1821
1845
|
declare namespace useLoader {
|
|
1822
|
-
var preload: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, extensions?: Extensions<L>, onProgress?: (event: ProgressEvent<EventTarget>) => void) => void;
|
|
1823
|
-
var clear: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I) => void;
|
|
1846
|
+
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;
|
|
1847
|
+
var clear: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, cacheKey?: InputLike) => void;
|
|
1824
1848
|
var loader: typeof getLoader;
|
|
1825
1849
|
}
|
|
1826
1850
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as three_webgpu from 'three/webgpu';
|
|
2
|
-
import { RenderTarget, WebGPURenderer, Node, StorageTexture, Data3DTexture, CanvasTarget, ShaderNodeObject, Euler as Euler$2, Color as Color$2, ColorRepresentation as ColorRepresentation$1, Layers as Layers$1, Raycaster, Intersection as Intersection$1, BufferGeometry, Matrix4 as Matrix4$1, Quaternion as Quaternion$1, Vector2 as Vector2$1, Vector3 as Vector3$1, Vector4 as Vector4$1, Matrix3 as Matrix3$1, Loader as Loader$1, ColorSpace, Texture as Texture$1, CubeTexture, Scene, Object3D, Frustum, OrthographicCamera } from 'three/webgpu';
|
|
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 } from 'three/webgpu';
|
|
3
3
|
import * as THREE$1 from 'three';
|
|
4
|
-
import { WebGLRenderTarget, WebGLRenderer, Color as Color$1, ColorRepresentation, Euler as Euler$1, Loader, RenderTargetOptions as RenderTargetOptions$1 } from 'three';
|
|
4
|
+
import { WebGLCubeRenderTarget, WebGLRenderTarget, WebGLRenderer, Color as Color$1, ColorRepresentation, Euler as Euler$1, Loader, RenderTargetOptions as RenderTargetOptions$1 } from 'three';
|
|
5
5
|
import { WebGLRendererParameters } from 'three/src/renderers/WebGLRenderer.js';
|
|
6
6
|
import { Inspector } from 'three/addons/inspector/Inspector.js';
|
|
7
7
|
import * as React$1 from 'react';
|
|
@@ -50,10 +50,13 @@ declare const R3F_BUILD_WEBGPU = true;
|
|
|
50
50
|
|
|
51
51
|
var THREE = /*#__PURE__*/_mergeNamespaces({
|
|
52
52
|
__proto__: null,
|
|
53
|
+
CubeRenderTarget: CubeRenderTarget,
|
|
54
|
+
CubeRenderTargetCompat: CubeRenderTarget,
|
|
53
55
|
Inspector: Inspector,
|
|
54
56
|
R3F_BUILD_LEGACY: R3F_BUILD_LEGACY,
|
|
55
57
|
R3F_BUILD_WEBGPU: R3F_BUILD_WEBGPU,
|
|
56
58
|
RenderTargetCompat: RenderTarget,
|
|
59
|
+
WebGLCubeRenderTarget: WebGLCubeRenderTarget,
|
|
57
60
|
WebGLRenderTarget: WebGLRenderTarget,
|
|
58
61
|
WebGLRenderer: WebGLRenderer,
|
|
59
62
|
WebGLRendererParameters: WebGLRendererParameters
|
|
@@ -496,7 +499,7 @@ interface InternalState {
|
|
|
496
499
|
canvasTarget?: CanvasTarget
|
|
497
500
|
/**
|
|
498
501
|
* Whether multi-canvas rendering is active.
|
|
499
|
-
* True when any canvas uses `
|
|
502
|
+
* True when any canvas uses `renderer={{ primaryCanvas: 'id' }}` to share a renderer.
|
|
500
503
|
* When true, setCanvasTarget is called before each render.
|
|
501
504
|
*/
|
|
502
505
|
isMultiCanvas?: boolean
|
|
@@ -594,8 +597,8 @@ interface RootState {
|
|
|
594
597
|
setSize: (width?: number, height?: number, top?: number, left?: number) => void
|
|
595
598
|
/** Shortcut to manual setting the pixel ratio */
|
|
596
599
|
setDpr: (dpr: Dpr) => void
|
|
597
|
-
/** Shortcut to setting frameloop flags */
|
|
598
|
-
setFrameloop: (frameloop
|
|
600
|
+
/** Shortcut to setting frameloop flags. No args resets to 'always'. */
|
|
601
|
+
setFrameloop: (frameloop?: Frameloop) => void
|
|
599
602
|
/** Set error state to propagate to error boundary */
|
|
600
603
|
setError: (error: Error | null) => void
|
|
601
604
|
/** Current error state (null when no error) */
|
|
@@ -613,7 +616,7 @@ interface RootState {
|
|
|
613
616
|
/** Internal: refcount per texture key, driven by mounted useTexture consumers (registry enrollment is on by default) */
|
|
614
617
|
_textureRefs: Map<string, number>
|
|
615
618
|
/** WebGPU RenderPipeline instance - use useRenderPipeline() hook */
|
|
616
|
-
renderPipeline:
|
|
619
|
+
renderPipeline: ThreeRenderPipeline | null
|
|
617
620
|
/** Global TSL pass nodes for render pipeline - use useRenderPipeline() hook */
|
|
618
621
|
passes: Record<string, any>
|
|
619
622
|
/** Internal version counter for HMR - incremented by rebuildNodes/rebuildUniforms to bust memoization */
|
|
@@ -906,8 +909,6 @@ interface Instance<O = any> {
|
|
|
906
909
|
attach?: AttachType<O>
|
|
907
910
|
previousAttach?: any
|
|
908
911
|
isHidden: boolean
|
|
909
|
-
/** Deferred ref props to apply in commitMount */
|
|
910
|
-
deferredRefs?: Array<{ prop: string; ref: React$1.RefObject<any> }>
|
|
911
912
|
/** Set of props that have been applied via once() */
|
|
912
913
|
appliedOnce?: Set<string>
|
|
913
914
|
}
|
|
@@ -1144,10 +1145,21 @@ type RenderTargetOptions = RenderTargetOptions$1
|
|
|
1144
1145
|
//* Global Types ==============================
|
|
1145
1146
|
|
|
1146
1147
|
declare global {
|
|
1147
|
-
/**
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1148
|
+
/**
|
|
1149
|
+
* Uniform node type.
|
|
1150
|
+
*
|
|
1151
|
+
* This is three's own `UniformNode`, not a re-declaration of it. It previously was a
|
|
1152
|
+
* hand-rolled `interface UniformNode<T> extends Node { value: T }`, which shadowed the real
|
|
1153
|
+
* exported type globally — so R3F's ~58 references resolved to an approximation that was
|
|
1154
|
+
* missing members three actually ships (`setName` among them) and had drifted to the wrong
|
|
1155
|
+
* arity when three made `UniformNode` two-parameter.
|
|
1156
|
+
*
|
|
1157
|
+
* three's signature is `UniformNode<TNodeType, TValue>`. R3F only ever varies the value type,
|
|
1158
|
+
* so the node type is fixed to `unknown` and the single parameter is kept for call-site
|
|
1159
|
+
* ergonomics. The result is three's structural type, so members stay in sync with the
|
|
1160
|
+
* installed three instead of needing to be mirrored by hand.
|
|
1161
|
+
*/
|
|
1162
|
+
type UniformNode<T = unknown> = three_webgpu.UniformNode<unknown, T>
|
|
1151
1163
|
|
|
1152
1164
|
/**
|
|
1153
1165
|
* ShaderCallable - the return type of Fn()
|
|
@@ -1292,13 +1304,14 @@ declare module 'three/tsl' {
|
|
|
1292
1304
|
): ShaderCallable<R>
|
|
1293
1305
|
}
|
|
1294
1306
|
|
|
1295
|
-
/**
|
|
1296
|
-
* RenderPipeline Types for useRenderPipeline hook (WebGPU only)
|
|
1297
|
-
*/
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
1307
|
declare global {
|
|
1308
|
+
/**
|
|
1309
|
+
* three's own render pipeline type. Named here so the rest of R3F refers to three's shape
|
|
1310
|
+
* rather than `any`. three r183 renamed `PostProcessing` to `RenderPipeline`; our peer floor
|
|
1311
|
+
* is r185, so the new name is the only one.
|
|
1312
|
+
*/
|
|
1313
|
+
type ThreeRenderPipeline = three_webgpu.RenderPipeline
|
|
1314
|
+
|
|
1302
1315
|
/** Pass record - stores TSL pass nodes for render pipeline */
|
|
1303
1316
|
type PassRecord = Record<string, any>
|
|
1304
1317
|
|
|
@@ -1313,7 +1326,7 @@ declare global {
|
|
|
1313
1326
|
/** Current passes from state */
|
|
1314
1327
|
passes: PassRecord
|
|
1315
1328
|
/** RenderPipeline instance (null if not initialized) */
|
|
1316
|
-
renderPipeline:
|
|
1329
|
+
renderPipeline: ThreeRenderPipeline | null
|
|
1317
1330
|
/** Clear all passes from state */
|
|
1318
1331
|
clearPasses: () => void
|
|
1319
1332
|
/** Reset RenderPipeline entirely (clears PP + passes) */
|
|
@@ -1494,7 +1507,7 @@ declare namespace three_d {
|
|
|
1494
1507
|
* a single WebGPURenderer using Three.js CanvasTarget API.
|
|
1495
1508
|
*
|
|
1496
1509
|
* Primary canvas: Has `id` prop, creates its own renderer, registers here
|
|
1497
|
-
* Secondary canvas: Has `
|
|
1510
|
+
* Secondary canvas: Has `renderer={{ primaryCanvas: 'id' }}`, shares primary's renderer via CanvasTarget
|
|
1498
1511
|
*/
|
|
1499
1512
|
|
|
1500
1513
|
interface PrimaryCanvasEntry {
|
|
@@ -1562,12 +1575,23 @@ type EnvironmentLoaderProps = {
|
|
|
1562
1575
|
* const texture = useEnvironment({ preset: 'sunset' })
|
|
1563
1576
|
* ```
|
|
1564
1577
|
*/
|
|
1565
|
-
declare function useEnvironment({ files, path, preset, colorSpace, extensions, }?: Partial<EnvironmentLoaderProps>): Texture$1<unknown> | CubeTexture
|
|
1578
|
+
declare function useEnvironment({ files, path, preset, colorSpace, extensions, }?: Partial<EnvironmentLoaderProps>): Texture$1<unknown, THREE$1.TextureEventMap> | CubeTexture<unknown>;
|
|
1566
1579
|
declare namespace useEnvironment {
|
|
1567
1580
|
var preload: (preloadOptions?: EnvironmentLoaderPreloadOptions) => void;
|
|
1568
1581
|
var clear: (clearOptions?: EnvironmentLoaderClearOptions) => void;
|
|
1569
1582
|
}
|
|
1570
|
-
|
|
1583
|
+
/**
|
|
1584
|
+
* Options accepted by `useEnvironment.preload`.
|
|
1585
|
+
*
|
|
1586
|
+
* `colorSpace` is deliberately omitted: preload only warms the loader cache, and colorSpace is
|
|
1587
|
+
* applied to the texture by `useEnvironment()` at use time, per consumer. Accepting it here would
|
|
1588
|
+
* advertise an option this function silently ignores.
|
|
1589
|
+
*
|
|
1590
|
+
* This previously read `Omit<…, 'encoding'>` — omitting a key that does not exist on
|
|
1591
|
+
* `EnvironmentLoaderProps`, a leftover from three's pre-`colorSpace` `encoding` API. That made the
|
|
1592
|
+
* type equivalent to the full props, so `colorSpace` was accepted and then dropped on the floor.
|
|
1593
|
+
*/
|
|
1594
|
+
type EnvironmentLoaderPreloadOptions = Omit<EnvironmentLoaderProps, 'colorSpace'>;
|
|
1571
1595
|
type EnvironmentLoaderClearOptions = Pick<EnvironmentLoaderProps, 'files' | 'preset'>;
|
|
1572
1596
|
|
|
1573
1597
|
/**
|
|
@@ -1817,10 +1841,10 @@ declare function getLoader<L extends LoaderLike | ConstructorRepresentation<Load
|
|
|
1817
1841
|
* Note: this hook's caller must be wrapped with `React.Suspense`
|
|
1818
1842
|
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
|
|
1819
1843
|
*/
|
|
1820
|
-
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>;
|
|
1844
|
+
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>;
|
|
1821
1845
|
declare namespace useLoader {
|
|
1822
|
-
var preload: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, extensions?: Extensions<L>, onProgress?: (event: ProgressEvent<EventTarget>) => void) => void;
|
|
1823
|
-
var clear: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I) => void;
|
|
1846
|
+
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;
|
|
1847
|
+
var clear: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, cacheKey?: InputLike) => void;
|
|
1824
1848
|
var loader: typeof getLoader;
|
|
1825
1849
|
}
|
|
1826
1850
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as three_webgpu from 'three/webgpu';
|
|
2
|
-
import { RenderTarget, WebGPURenderer, Node, StorageTexture, Data3DTexture, CanvasTarget, ShaderNodeObject, Euler as Euler$2, Color as Color$2, ColorRepresentation as ColorRepresentation$1, Layers as Layers$1, Raycaster, Intersection as Intersection$1, BufferGeometry, Matrix4 as Matrix4$1, Quaternion as Quaternion$1, Vector2 as Vector2$1, Vector3 as Vector3$1, Vector4 as Vector4$1, Matrix3 as Matrix3$1, Loader as Loader$1, ColorSpace, Texture as Texture$1, CubeTexture, Scene, Object3D, Frustum, OrthographicCamera } from 'three/webgpu';
|
|
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 } from 'three/webgpu';
|
|
3
3
|
import * as THREE$1 from 'three';
|
|
4
|
-
import { WebGLRenderTarget, WebGLRenderer, Color as Color$1, ColorRepresentation, Euler as Euler$1, Loader, RenderTargetOptions as RenderTargetOptions$1 } from 'three';
|
|
4
|
+
import { WebGLCubeRenderTarget, WebGLRenderTarget, WebGLRenderer, Color as Color$1, ColorRepresentation, Euler as Euler$1, Loader, RenderTargetOptions as RenderTargetOptions$1 } from 'three';
|
|
5
5
|
import { WebGLRendererParameters } from 'three/src/renderers/WebGLRenderer.js';
|
|
6
6
|
import { Inspector } from 'three/addons/inspector/Inspector.js';
|
|
7
7
|
import * as React$1 from 'react';
|
|
@@ -50,10 +50,13 @@ declare const R3F_BUILD_WEBGPU = true;
|
|
|
50
50
|
|
|
51
51
|
var THREE = /*#__PURE__*/_mergeNamespaces({
|
|
52
52
|
__proto__: null,
|
|
53
|
+
CubeRenderTarget: CubeRenderTarget,
|
|
54
|
+
CubeRenderTargetCompat: CubeRenderTarget,
|
|
53
55
|
Inspector: Inspector,
|
|
54
56
|
R3F_BUILD_LEGACY: R3F_BUILD_LEGACY,
|
|
55
57
|
R3F_BUILD_WEBGPU: R3F_BUILD_WEBGPU,
|
|
56
58
|
RenderTargetCompat: RenderTarget,
|
|
59
|
+
WebGLCubeRenderTarget: WebGLCubeRenderTarget,
|
|
57
60
|
WebGLRenderTarget: WebGLRenderTarget,
|
|
58
61
|
WebGLRenderer: WebGLRenderer,
|
|
59
62
|
WebGLRendererParameters: WebGLRendererParameters
|
|
@@ -496,7 +499,7 @@ interface InternalState {
|
|
|
496
499
|
canvasTarget?: CanvasTarget
|
|
497
500
|
/**
|
|
498
501
|
* Whether multi-canvas rendering is active.
|
|
499
|
-
* True when any canvas uses `
|
|
502
|
+
* True when any canvas uses `renderer={{ primaryCanvas: 'id' }}` to share a renderer.
|
|
500
503
|
* When true, setCanvasTarget is called before each render.
|
|
501
504
|
*/
|
|
502
505
|
isMultiCanvas?: boolean
|
|
@@ -594,8 +597,8 @@ interface RootState {
|
|
|
594
597
|
setSize: (width?: number, height?: number, top?: number, left?: number) => void
|
|
595
598
|
/** Shortcut to manual setting the pixel ratio */
|
|
596
599
|
setDpr: (dpr: Dpr) => void
|
|
597
|
-
/** Shortcut to setting frameloop flags */
|
|
598
|
-
setFrameloop: (frameloop
|
|
600
|
+
/** Shortcut to setting frameloop flags. No args resets to 'always'. */
|
|
601
|
+
setFrameloop: (frameloop?: Frameloop) => void
|
|
599
602
|
/** Set error state to propagate to error boundary */
|
|
600
603
|
setError: (error: Error | null) => void
|
|
601
604
|
/** Current error state (null when no error) */
|
|
@@ -613,7 +616,7 @@ interface RootState {
|
|
|
613
616
|
/** Internal: refcount per texture key, driven by mounted useTexture consumers (registry enrollment is on by default) */
|
|
614
617
|
_textureRefs: Map<string, number>
|
|
615
618
|
/** WebGPU RenderPipeline instance - use useRenderPipeline() hook */
|
|
616
|
-
renderPipeline:
|
|
619
|
+
renderPipeline: ThreeRenderPipeline | null
|
|
617
620
|
/** Global TSL pass nodes for render pipeline - use useRenderPipeline() hook */
|
|
618
621
|
passes: Record<string, any>
|
|
619
622
|
/** Internal version counter for HMR - incremented by rebuildNodes/rebuildUniforms to bust memoization */
|
|
@@ -906,8 +909,6 @@ interface Instance<O = any> {
|
|
|
906
909
|
attach?: AttachType<O>
|
|
907
910
|
previousAttach?: any
|
|
908
911
|
isHidden: boolean
|
|
909
|
-
/** Deferred ref props to apply in commitMount */
|
|
910
|
-
deferredRefs?: Array<{ prop: string; ref: React$1.RefObject<any> }>
|
|
911
912
|
/** Set of props that have been applied via once() */
|
|
912
913
|
appliedOnce?: Set<string>
|
|
913
914
|
}
|
|
@@ -1144,10 +1145,21 @@ type RenderTargetOptions = RenderTargetOptions$1
|
|
|
1144
1145
|
//* Global Types ==============================
|
|
1145
1146
|
|
|
1146
1147
|
declare global {
|
|
1147
|
-
/**
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1148
|
+
/**
|
|
1149
|
+
* Uniform node type.
|
|
1150
|
+
*
|
|
1151
|
+
* This is three's own `UniformNode`, not a re-declaration of it. It previously was a
|
|
1152
|
+
* hand-rolled `interface UniformNode<T> extends Node { value: T }`, which shadowed the real
|
|
1153
|
+
* exported type globally — so R3F's ~58 references resolved to an approximation that was
|
|
1154
|
+
* missing members three actually ships (`setName` among them) and had drifted to the wrong
|
|
1155
|
+
* arity when three made `UniformNode` two-parameter.
|
|
1156
|
+
*
|
|
1157
|
+
* three's signature is `UniformNode<TNodeType, TValue>`. R3F only ever varies the value type,
|
|
1158
|
+
* so the node type is fixed to `unknown` and the single parameter is kept for call-site
|
|
1159
|
+
* ergonomics. The result is three's structural type, so members stay in sync with the
|
|
1160
|
+
* installed three instead of needing to be mirrored by hand.
|
|
1161
|
+
*/
|
|
1162
|
+
type UniformNode<T = unknown> = three_webgpu.UniformNode<unknown, T>
|
|
1151
1163
|
|
|
1152
1164
|
/**
|
|
1153
1165
|
* ShaderCallable - the return type of Fn()
|
|
@@ -1292,13 +1304,14 @@ declare module 'three/tsl' {
|
|
|
1292
1304
|
): ShaderCallable<R>
|
|
1293
1305
|
}
|
|
1294
1306
|
|
|
1295
|
-
/**
|
|
1296
|
-
* RenderPipeline Types for useRenderPipeline hook (WebGPU only)
|
|
1297
|
-
*/
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
1307
|
declare global {
|
|
1308
|
+
/**
|
|
1309
|
+
* three's own render pipeline type. Named here so the rest of R3F refers to three's shape
|
|
1310
|
+
* rather than `any`. three r183 renamed `PostProcessing` to `RenderPipeline`; our peer floor
|
|
1311
|
+
* is r185, so the new name is the only one.
|
|
1312
|
+
*/
|
|
1313
|
+
type ThreeRenderPipeline = three_webgpu.RenderPipeline
|
|
1314
|
+
|
|
1302
1315
|
/** Pass record - stores TSL pass nodes for render pipeline */
|
|
1303
1316
|
type PassRecord = Record<string, any>
|
|
1304
1317
|
|
|
@@ -1313,7 +1326,7 @@ declare global {
|
|
|
1313
1326
|
/** Current passes from state */
|
|
1314
1327
|
passes: PassRecord
|
|
1315
1328
|
/** RenderPipeline instance (null if not initialized) */
|
|
1316
|
-
renderPipeline:
|
|
1329
|
+
renderPipeline: ThreeRenderPipeline | null
|
|
1317
1330
|
/** Clear all passes from state */
|
|
1318
1331
|
clearPasses: () => void
|
|
1319
1332
|
/** Reset RenderPipeline entirely (clears PP + passes) */
|
|
@@ -1494,7 +1507,7 @@ declare namespace three_d {
|
|
|
1494
1507
|
* a single WebGPURenderer using Three.js CanvasTarget API.
|
|
1495
1508
|
*
|
|
1496
1509
|
* Primary canvas: Has `id` prop, creates its own renderer, registers here
|
|
1497
|
-
* Secondary canvas: Has `
|
|
1510
|
+
* Secondary canvas: Has `renderer={{ primaryCanvas: 'id' }}`, shares primary's renderer via CanvasTarget
|
|
1498
1511
|
*/
|
|
1499
1512
|
|
|
1500
1513
|
interface PrimaryCanvasEntry {
|
|
@@ -1562,12 +1575,23 @@ type EnvironmentLoaderProps = {
|
|
|
1562
1575
|
* const texture = useEnvironment({ preset: 'sunset' })
|
|
1563
1576
|
* ```
|
|
1564
1577
|
*/
|
|
1565
|
-
declare function useEnvironment({ files, path, preset, colorSpace, extensions, }?: Partial<EnvironmentLoaderProps>): Texture$1<unknown> | CubeTexture
|
|
1578
|
+
declare function useEnvironment({ files, path, preset, colorSpace, extensions, }?: Partial<EnvironmentLoaderProps>): Texture$1<unknown, THREE$1.TextureEventMap> | CubeTexture<unknown>;
|
|
1566
1579
|
declare namespace useEnvironment {
|
|
1567
1580
|
var preload: (preloadOptions?: EnvironmentLoaderPreloadOptions) => void;
|
|
1568
1581
|
var clear: (clearOptions?: EnvironmentLoaderClearOptions) => void;
|
|
1569
1582
|
}
|
|
1570
|
-
|
|
1583
|
+
/**
|
|
1584
|
+
* Options accepted by `useEnvironment.preload`.
|
|
1585
|
+
*
|
|
1586
|
+
* `colorSpace` is deliberately omitted: preload only warms the loader cache, and colorSpace is
|
|
1587
|
+
* applied to the texture by `useEnvironment()` at use time, per consumer. Accepting it here would
|
|
1588
|
+
* advertise an option this function silently ignores.
|
|
1589
|
+
*
|
|
1590
|
+
* This previously read `Omit<…, 'encoding'>` — omitting a key that does not exist on
|
|
1591
|
+
* `EnvironmentLoaderProps`, a leftover from three's pre-`colorSpace` `encoding` API. That made the
|
|
1592
|
+
* type equivalent to the full props, so `colorSpace` was accepted and then dropped on the floor.
|
|
1593
|
+
*/
|
|
1594
|
+
type EnvironmentLoaderPreloadOptions = Omit<EnvironmentLoaderProps, 'colorSpace'>;
|
|
1571
1595
|
type EnvironmentLoaderClearOptions = Pick<EnvironmentLoaderProps, 'files' | 'preset'>;
|
|
1572
1596
|
|
|
1573
1597
|
/**
|
|
@@ -1817,10 +1841,10 @@ declare function getLoader<L extends LoaderLike | ConstructorRepresentation<Load
|
|
|
1817
1841
|
* Note: this hook's caller must be wrapped with `React.Suspense`
|
|
1818
1842
|
* @see https://docs.pmnd.rs/react-three-fiber/api/hooks#useloader
|
|
1819
1843
|
*/
|
|
1820
|
-
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>;
|
|
1844
|
+
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>;
|
|
1821
1845
|
declare namespace useLoader {
|
|
1822
|
-
var preload: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, extensions?: Extensions<L>, onProgress?: (event: ProgressEvent<EventTarget>) => void) => void;
|
|
1823
|
-
var clear: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I) => void;
|
|
1846
|
+
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;
|
|
1847
|
+
var clear: <I extends InputLike, L extends LoaderLike | ConstructorRepresentation<LoaderLike>>(loader: L, input: I, cacheKey?: InputLike) => void;
|
|
1824
1848
|
var loader: typeof getLoader;
|
|
1825
1849
|
}
|
|
1826
1850
|
|