@react-three/drei 9.121.5 → 9.121.6-rc.1
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/core/AccumulativeShadows.d.ts +8 -10
- package/core/ArcballControls.d.ts +4 -4
- package/core/AsciiRenderer.d.ts +1 -2
- package/core/BBAnchor.d.ts +3 -3
- package/core/Backdrop.d.ts +2 -1
- package/core/Billboard.cjs.js +1 -1
- package/core/Billboard.d.ts +3 -2
- package/core/Billboard.js +1 -1
- package/core/Bounds.d.ts +2 -1
- package/core/Bvh.d.ts +3 -2
- package/core/CameraControls.d.ts +4 -4
- package/core/CatmullRomLine.d.ts +2 -3
- package/core/Caustics.d.ts +14 -17
- package/core/Center.d.ts +3 -2
- package/core/Clone.d.ts +4 -4
- package/core/Cloud.cjs.js +1 -1
- package/core/Cloud.d.ts +50 -12
- package/core/Cloud.js +3 -3
- package/core/ComputedAttribute.cjs.js +1 -1
- package/core/ComputedAttribute.d.ts +3 -4
- package/core/ComputedAttribute.js +1 -1
- package/core/ContactShadows.d.ts +3 -2
- package/core/CubeCamera.d.ts +3 -3
- package/core/CubeTexture.d.ts +5 -6
- package/core/CubeTexture.js +2 -7
- package/core/CubicBezierLine.d.ts +2 -3
- package/core/CurveModifier.d.ts +2 -1
- package/core/Decal.d.ts +2 -2
- package/core/Detailed.d.ts +3 -3
- package/core/DetectGPU.d.ts +1 -2
- package/core/DeviceOrientationControls.d.ts +2 -2
- package/core/Edges.cjs.js +1 -1
- package/core/Edges.d.ts +2 -2
- package/core/Edges.js +2 -2
- package/core/Effects.cjs.js +1 -1
- package/core/Effects.d.ts +9 -13
- package/core/Effects.js +3 -3
- package/core/Environment.cjs.js +1 -1
- package/core/Environment.d.ts +5 -7
- package/core/Fbo.d.ts +1 -4
- package/core/Fbo.js +0 -2
- package/core/Fbx.d.ts +1 -1
- package/core/FirstPersonControls.d.ts +2 -2
- package/core/Fisheye.d.ts +2 -1
- package/core/Float.d.ts +2 -1
- package/core/FlyControls.d.ts +2 -2
- package/core/GizmoHelper.d.ts +2 -1
- package/core/GizmoViewport.d.ts +2 -2
- package/core/Gltf.d.ts +9 -5
- package/core/GradientTexture.d.ts +4 -4
- package/core/GradientTexture.js +0 -2
- package/core/Grid.d.ts +6 -7
- package/core/Helper.cjs.js +1 -1
- package/core/Helper.d.ts +1 -1
- package/core/Helper.js +1 -1
- package/core/Hud.d.ts +1 -2
- package/core/Image.d.ts +6 -8
- package/core/Instances.cjs.js +1 -1
- package/core/Instances.d.ts +27 -35
- package/core/Instances.js +35 -30
- package/core/Ktx2.d.ts +1 -1
- package/core/Lightformer.d.ts +3 -3
- package/core/Line.d.ts +4 -4
- package/core/MapControls.d.ts +4 -4
- package/core/MarchingCubes.d.ts +6 -6
- package/core/Mask.d.ts +3 -3
- package/core/MeshDiscardMaterial.d.ts +6 -7
- package/core/MeshDistortMaterial.d.ts +15 -17
- package/core/MeshPortalMaterial.cjs.js +1 -1
- package/core/MeshPortalMaterial.d.ts +14 -17
- package/core/MeshPortalMaterial.js +2 -2
- package/core/MeshReflectorMaterial.cjs.js +1 -1
- package/core/MeshReflectorMaterial.d.ts +9 -22
- package/core/MeshReflectorMaterial.js +2 -4
- package/core/MeshRefractionMaterial.cjs.js +1 -1
- package/core/MeshRefractionMaterial.d.ts +5 -8
- package/core/MeshRefractionMaterial.js +2 -2
- package/core/MeshTransmissionMaterial.cjs.js +1 -1
- package/core/MeshTransmissionMaterial.d.ts +7 -8
- package/core/MeshTransmissionMaterial.js +2 -1
- package/core/MeshWobbleMaterial.d.ts +15 -17
- package/core/MotionPathControls.cjs.js +1 -1
- package/core/MotionPathControls.d.ts +18 -6
- package/core/MotionPathControls.js +2 -3
- package/core/MultiMaterial.cjs.js +1 -1
- package/core/MultiMaterial.d.ts +3 -1
- package/core/MultiMaterial.js +2 -3
- package/core/OrbitControls.d.ts +4 -4
- package/core/OrthographicCamera.d.ts +3 -3
- package/core/Outlines.cjs.js +1 -1
- package/core/Outlines.d.ts +2 -3
- package/core/Outlines.js +2 -2
- package/core/PerformanceMonitor.d.ts +2 -2
- package/core/PerspectiveCamera.d.ts +3 -3
- package/core/PointMaterial.d.ts +3 -11
- package/core/PointerLockControls.d.ts +2 -2
- package/core/Points.cjs.js +1 -1
- package/core/Points.d.ts +10 -13
- package/core/Points.js +6 -16
- package/core/PositionalAudio.d.ts +3 -3
- package/core/Preload.d.ts +2 -3
- package/core/QuadraticBezierLine.d.ts +5 -7
- package/core/RenderCubeTexture.d.ts +2 -2
- package/core/RenderTexture.cjs.js +1 -1
- package/core/RenderTexture.d.ts +3 -3
- package/core/RenderTexture.js +3 -2
- package/core/Resize.d.ts +9 -2
- package/core/RoundedBox.d.ts +4 -4
- package/core/Sampler.d.ts +4 -4
- package/core/ScreenQuad.d.ts +3 -3
- package/core/ScreenSizer.d.ts +3 -3
- package/core/ScreenSpace.d.ts +3 -2
- package/core/Segments.d.ts +6 -8
- package/core/Shadow.d.ts +3 -3
- package/core/ShadowAlpha.cjs.js +1 -1
- package/core/ShadowAlpha.d.ts +1 -2
- package/core/ShadowAlpha.js +1 -1
- package/core/Sky.d.ts +2 -3
- package/core/Sparkles.d.ts +14 -16
- package/core/Splat.d.ts +6 -8
- package/core/SpotLight.d.ts +2 -1
- package/core/SpriteAnimator.cjs.js +1 -1
- package/core/SpriteAnimator.d.ts +36 -3
- package/core/Stage.cjs.js +1 -1
- package/core/Stage.d.ts +3 -2
- package/core/Stars.cjs.js +1 -1
- package/core/Stars.d.ts +6 -8
- package/core/Stars.js +1 -1
- package/core/Stats.d.ts +2 -3
- package/core/StatsGl.d.ts +2 -2
- package/core/Svg.d.ts +6 -6
- package/core/Text.d.ts +3 -4
- package/core/Text3D.d.ts +7 -10
- package/core/Texture.d.ts +1 -1
- package/core/TrackballControls.d.ts +4 -4
- package/core/Trail.cjs.js +1 -1
- package/core/Trail.d.ts +3 -3
- package/core/Trail.js +3 -3
- package/core/TrailTexture.d.ts +3 -2
- package/core/TransformControls.cjs.js +1 -1
- package/core/TransformControls.d.ts +3 -3
- package/core/TransformControls.js +4 -5
- package/core/VideoTexture.cjs.js +1 -1
- package/core/VideoTexture.js +1 -1
- package/core/Wireframe.d.ts +5 -7
- package/core/index.cjs.js +1 -1
- package/core/index.d.ts +0 -1
- package/core/index.js +1 -3
- package/core/shapes.d.ts +21 -20
- package/core/softShadows.d.ts +1 -2
- package/core/useAnimations.cjs.js +1 -1
- package/core/useAnimations.d.ts +2 -2
- package/core/useAnimations.js +1 -1
- package/core/useBoxProjectedEnv.d.ts +1 -1
- package/core/useCamera.cjs.js +1 -1
- package/core/useCamera.d.ts +1 -1
- package/core/useCamera.js +1 -8
- package/core/useContextBridge.d.ts +1 -1
- package/core/useEnvironment.cjs.js +1 -1
- package/core/useEnvironment.d.ts +3 -4
- package/core/useEnvironment.js +11 -19
- package/core/useIntersect.d.ts +1 -1
- package/core/useSpriteLoader.d.ts +1 -1
- package/helpers/deprecated.cjs.js +1 -1
- package/helpers/deprecated.d.ts +1 -4
- package/helpers/deprecated.js +2 -14
- package/helpers/ts-utils.d.ts +4 -0
- package/helpers/useEffectfulState.d.ts +1 -1
- package/index.cjs.js +1 -1
- package/index.js +0 -1
- package/materials/BlurPass.js +0 -1
- package/materials/MeshReflectorMaterial.d.ts +0 -16
- package/native/index.cjs.js +1 -1
- package/native/index.js +1 -3
- package/package.json +7 -8
- package/web/CycleRaycast.d.ts +1 -1
- package/web/FaceLandmarker.d.ts +1 -2
- package/web/Facemesh.d.ts +3 -2
- package/web/Html.cjs.js +1 -1
- package/web/Html.d.ts +4 -4
- package/web/Html.js +1 -1
- package/web/KeyboardControls.d.ts +1 -1
- package/web/PresentationControls.cjs.js +1 -1
- package/web/PresentationControls.d.ts +3 -4
- package/web/PresentationControls.js +20 -28
- package/web/ScrollControls.d.ts +1 -1
- package/web/Select.d.ts +3 -3
- package/web/Select.js +6 -2
- package/web/View.cjs.js +1 -1
- package/web/View.d.ts +8 -10
- package/web/View.js +4 -34
- package/web/index.cjs.js +1 -1
- package/web/index.js +0 -3
- package/web/pivotControls/AxisArrow.js +0 -2
- package/web/pivotControls/AxisRotator.js +0 -2
- package/web/pivotControls/PlaneSlider.js +0 -2
- package/web/pivotControls/ScalingSphere.js +0 -1
- package/web/pivotControls/index.d.ts +1 -2
- package/core/Reflector.cjs.js +0 -1
- package/core/Reflector.d.ts +0 -30
- package/core/Reflector.js +0 -180
package/core/useEnvironment.js
CHANGED
|
@@ -3,7 +3,6 @@ import { CubeReflectionMapping, EquirectangularReflectionMapping, CubeTextureLoa
|
|
|
3
3
|
import { RGBELoader, EXRLoader } from 'three-stdlib';
|
|
4
4
|
import { HDRJPGLoader, GainMapLoader } from '@monogrid/gainmap-js';
|
|
5
5
|
import { presetsObj } from '../helpers/environment-assets.js';
|
|
6
|
-
import { sRGBEncoding, LinearEncoding } from '../helpers/deprecated.js';
|
|
7
6
|
import { useLayoutEffect } from 'react';
|
|
8
7
|
|
|
9
8
|
const CUBEMAP_ROOT = 'https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/';
|
|
@@ -13,11 +12,9 @@ function useEnvironment({
|
|
|
13
12
|
files = defaultFiles,
|
|
14
13
|
path = '',
|
|
15
14
|
preset = undefined,
|
|
16
|
-
|
|
15
|
+
colorSpace = undefined,
|
|
17
16
|
extensions
|
|
18
17
|
} = {}) {
|
|
19
|
-
let loader = null;
|
|
20
|
-
let multiFile = false;
|
|
21
18
|
if (preset) {
|
|
22
19
|
validatePreset(preset);
|
|
23
20
|
files = presetsObj[preset];
|
|
@@ -25,34 +22,32 @@ function useEnvironment({
|
|
|
25
22
|
}
|
|
26
23
|
|
|
27
24
|
// Everything else
|
|
28
|
-
multiFile = isArray(files);
|
|
25
|
+
const multiFile = isArray(files);
|
|
29
26
|
const {
|
|
30
27
|
extension,
|
|
31
28
|
isCubemap
|
|
32
29
|
} = getExtension(files);
|
|
33
|
-
loader = getLoader(extension);
|
|
30
|
+
const loader = getLoader(extension);
|
|
34
31
|
if (!loader) throw new Error('useEnvironment: Unrecognized file extension: ' + files);
|
|
35
32
|
const gl = useThree(state => state.gl);
|
|
36
33
|
useLayoutEffect(() => {
|
|
37
34
|
// Only required for gainmap
|
|
38
35
|
if (extension !== 'webp' && extension !== 'jpg' && extension !== 'jpeg') return;
|
|
39
36
|
function clearGainmapTexture() {
|
|
40
|
-
useLoader.clear(
|
|
41
|
-
// @ts-expect-error
|
|
42
|
-
loader, multiFile ? [files] : files);
|
|
37
|
+
useLoader.clear(loader, multiFile ? [files] : files);
|
|
43
38
|
}
|
|
44
39
|
gl.domElement.addEventListener('webglcontextlost', clearGainmapTexture, {
|
|
45
40
|
once: true
|
|
46
41
|
});
|
|
47
42
|
}, [files, gl.domElement]);
|
|
48
|
-
const loaderResult = useLoader(
|
|
49
|
-
// @ts-expect-error
|
|
50
|
-
loader, multiFile ? [files] : files, loader => {
|
|
43
|
+
const loaderResult = useLoader(loader, multiFile ? [files] : files, loader => {
|
|
51
44
|
// Gainmap requires a renderer
|
|
52
45
|
if (extension === 'webp' || extension === 'jpg' || extension === 'jpeg') {
|
|
46
|
+
// @ts-expect-error
|
|
53
47
|
loader.setRenderer(gl);
|
|
54
48
|
}
|
|
55
49
|
loader.setPath == null || loader.setPath(path);
|
|
50
|
+
// @ts-expect-error
|
|
56
51
|
if (extensions) extensions(loader);
|
|
57
52
|
});
|
|
58
53
|
let texture = multiFile ?
|
|
@@ -63,7 +58,7 @@ function useEnvironment({
|
|
|
63
58
|
texture = (_renderTarget = texture.renderTarget) == null ? void 0 : _renderTarget.texture;
|
|
64
59
|
}
|
|
65
60
|
texture.mapping = isCubemap ? CubeReflectionMapping : EquirectangularReflectionMapping;
|
|
66
|
-
|
|
61
|
+
texture.colorSpace = colorSpace !== null && colorSpace !== void 0 ? colorSpace : isCubemap ? 'srgb' : 'srgb-linear';
|
|
67
62
|
return texture;
|
|
68
63
|
}
|
|
69
64
|
const preloadDefaultOptions = {
|
|
@@ -98,10 +93,9 @@ useEnvironment.preload = preloadOptions => {
|
|
|
98
93
|
}
|
|
99
94
|
const loader = getLoader(extension);
|
|
100
95
|
if (!loader) throw new Error('useEnvironment: Unrecognized file extension: ' + files);
|
|
101
|
-
useLoader.preload(
|
|
102
|
-
// @ts-expect-error
|
|
103
|
-
loader, isArray(files) ? [files] : files, loader => {
|
|
96
|
+
useLoader.preload(loader, isArray(files) ? [files] : files, loader => {
|
|
104
97
|
loader.setPath == null || loader.setPath(path);
|
|
98
|
+
// @ts-expect-error
|
|
105
99
|
if (extensions) extensions(loader);
|
|
106
100
|
});
|
|
107
101
|
};
|
|
@@ -129,9 +123,7 @@ useEnvironment.clear = clearOptions => {
|
|
|
129
123
|
} = getExtension(files);
|
|
130
124
|
const loader = getLoader(extension);
|
|
131
125
|
if (!loader) throw new Error('useEnvironment: Unrecognized file extension: ' + files);
|
|
132
|
-
useLoader.clear(
|
|
133
|
-
// @ts-expect-error
|
|
134
|
-
loader, isArray(files) ? [files] : files);
|
|
126
|
+
useLoader.clear(loader, isArray(files) ? [files] : files);
|
|
135
127
|
};
|
|
136
128
|
function validatePreset(preset) {
|
|
137
129
|
if (!(preset in presetsObj)) throw new Error('Preset must be one of: ' + Object.keys(presetsObj).join(', '));
|
package/core/useIntersect.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Object3D } from 'three';
|
|
3
|
-
export declare function useIntersect<T extends Object3D>(onChange: (visible: boolean) => void): React.
|
|
3
|
+
export declare function useIntersect<T extends Object3D>(onChange: (visible: boolean) => void): React.RefObject<T>;
|
|
@@ -51,7 +51,7 @@ export declare function useSpriteLoader<Url extends string>(input: Url | null, j
|
|
|
51
51
|
loadJsonAndTexture: (textureUrl: string, jsonUrl?: string) => void;
|
|
52
52
|
};
|
|
53
53
|
export declare namespace useSpriteLoader {
|
|
54
|
-
var preload: (url: string) =>
|
|
54
|
+
var preload: (url: string) => void;
|
|
55
55
|
var clear: (input: string) => void;
|
|
56
56
|
}
|
|
57
57
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.setUpdateRange=(e,t)=>{e.updateRanges[0]=t};
|
package/helpers/deprecated.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
export declare const setUpdateRange: (attribute: THREE.BufferAttribute, updateRange: {
|
|
3
|
-
|
|
3
|
+
start: number;
|
|
4
4
|
count: number;
|
|
5
5
|
}) => void;
|
|
6
|
-
export declare const LinearEncoding = 3000;
|
|
7
|
-
export declare const sRGBEncoding = 3001;
|
|
8
|
-
export type TextureEncoding = typeof LinearEncoding | typeof sRGBEncoding;
|
package/helpers/deprecated.js
CHANGED
|
@@ -2,19 +2,7 @@
|
|
|
2
2
|
* Sets `BufferAttribute.updateRange` since r159.
|
|
3
3
|
*/
|
|
4
4
|
const setUpdateRange = (attribute, updateRange) => {
|
|
5
|
-
|
|
6
|
-
// r159
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
attribute.updateRanges[0] = updateRange;
|
|
9
|
-
} else {
|
|
10
|
-
attribute.updateRange = updateRange;
|
|
11
|
-
}
|
|
5
|
+
attribute.updateRanges[0] = updateRange;
|
|
12
6
|
};
|
|
13
|
-
const LinearEncoding = 3000;
|
|
14
|
-
const sRGBEncoding = 3001;
|
|
15
7
|
|
|
16
|
-
|
|
17
|
-
* TextureEncoding was deprecated in r152, and removed in r162.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
export { LinearEncoding, sRGBEncoding, setUpdateRange };
|
|
8
|
+
export { setUpdateRange };
|
package/helpers/ts-utils.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react';
|
|
2
2
|
export type NamedArrayTuple<T extends (...args: any) => any> = Parameters<T>;
|
|
3
3
|
export type ForwardRefComponent<P, T> = ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>;
|
|
4
|
+
export type NonFunctionKeys<T> = {
|
|
5
|
+
[K in keyof T]-?: T[K] extends Function ? never : K;
|
|
6
|
+
}[keyof T];
|
|
7
|
+
export type Overwrite<T, O> = Omit<T, NonFunctionKeys<O>> & O;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
type RefType<T> = React.
|
|
2
|
+
type RefType<T> = React.RefObject<T> | ((state: T) => void);
|
|
3
3
|
export declare function useEffectfulState<T>(fn: () => T, deps?: React.DependencyList, cb?: RefType<T>): T | undefined;
|
|
4
4
|
export {};
|