@react-three/drei 9.0.0-beta.3 → 9.0.0-beta.4
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/README.md +293 -26
- package/core/ArcballControls.cjs.js +1 -1
- package/core/ArcballControls.js +13 -25
- package/core/Bounds.cjs.js +1 -1
- package/core/Bounds.d.ts +2 -1
- package/core/Bounds.js +25 -14
- package/core/Clone.cjs.js +1 -0
- package/core/Clone.d.ts +11 -0
- package/core/Clone.js +92 -0
- package/core/Cloud.cjs.js +1 -1
- package/core/Cloud.d.ts +3 -1
- package/core/Cloud.js +4 -1
- package/core/ComputedAttribute.cjs.js +1 -0
- package/core/ComputedAttribute.d.ts +9 -0
- package/core/ComputedAttribute.js +34 -0
- package/core/ContactShadows.cjs.js +1 -1
- package/core/ContactShadows.d.ts +3 -1
- package/core/ContactShadows.js +15 -2
- package/core/CubeCamera.cjs.js +1 -1
- package/core/CubeCamera.js +6 -6
- package/core/DeviceOrientationControls.cjs.js +1 -1
- package/core/DeviceOrientationControls.js +2 -6
- package/core/Effects.cjs.js +1 -1
- package/core/Effects.d.ts +3 -2
- package/core/Effects.js +2 -2
- package/core/Environment.cjs.js +1 -1
- package/core/Environment.d.ts +13 -3
- package/core/Environment.js +96 -33
- package/core/FirstPersonControls.cjs.js +1 -1
- package/core/FirstPersonControls.js +2 -6
- package/core/Float.cjs.js +1 -1
- package/core/Float.d.ts +1 -1
- package/core/Float.js +5 -4
- package/core/GizmoHelper.cjs.js +1 -1
- package/core/GizmoHelper.d.ts +2 -1
- package/core/GizmoHelper.js +31 -41
- package/core/Image.cjs.js +1 -1
- package/core/Image.d.ts +5 -3
- package/core/Image.js +6 -1
- package/core/Instances.cjs.js +1 -1
- package/core/Instances.d.ts +1 -1
- package/core/Instances.js +5 -11
- package/core/Lightformer.cjs.js +1 -0
- package/core/Lightformer.d.ts +41 -0
- package/core/Lightformer.js +51 -0
- package/core/MeshReflectorMaterial.cjs.js +1 -1
- package/core/MeshReflectorMaterial.d.ts +1 -2
- package/core/MeshReflectorMaterial.js +4 -5
- package/core/OrbitControls.cjs.js +1 -1
- package/core/OrbitControls.js +18 -31
- package/core/PointMaterial.cjs.js +1 -1
- package/core/PointMaterial.d.ts +5 -8
- package/core/PointMaterial.js +16 -34
- package/core/PointerLockControls.cjs.js +1 -1
- package/core/PointerLockControls.d.ts +3 -1
- package/core/PointerLockControls.js +36 -22
- package/core/Points.cjs.js +1 -1
- package/core/Points.d.ts +3 -3
- package/core/Points.js +11 -30
- package/core/Reflector.d.ts +1 -1
- package/core/Sampler.cjs.js +1 -0
- package/core/Sampler.d.ts +21 -0
- package/core/Sampler.js +65 -0
- package/core/SpotLight.d.ts +1 -1
- package/core/Stage.cjs.js +1 -1
- package/core/Stage.js +1 -2
- package/core/Stars.cjs.js +1 -1
- package/core/Stars.js +3 -0
- package/core/Stats.cjs.js +1 -1
- package/core/Stats.js +1 -1
- package/core/Text.cjs.js +1 -1
- package/core/Text.d.ts +2 -1
- package/core/Text.js +3 -2
- package/core/TrackballControls.cjs.js +1 -1
- package/core/TrackballControls.js +7 -5
- package/core/Trail.cjs.js +1 -0
- package/core/Trail.d.ts +21 -0
- package/core/Trail.js +160 -0
- package/core/TransformControls.cjs.js +1 -1
- package/core/TransformControls.js +7 -13
- package/core/index.cjs.js +1 -1
- package/core/index.d.ts +6 -0
- package/core/index.js +9 -2
- package/core/useBoxProjectedEnv.cjs.js +1 -0
- package/core/useBoxProjectedEnv.d.ts +8 -0
- package/core/useBoxProjectedEnv.js +98 -0
- package/core/useFBO.cjs.js +1 -1
- package/core/useFBO.d.ts +1 -1
- package/core/useFBO.js +22 -24
- package/core/useGLTF.d.ts +1 -1
- package/core/useHelper.d.ts +3 -1
- package/index.cjs.js +1 -1
- package/index.js +7 -1
- package/materials/ConvolutionMaterial.cjs.js +1 -1
- package/materials/ConvolutionMaterial.js +2 -0
- package/materials/MeshReflectorMaterial.cjs.js +1 -1
- package/materials/MeshReflectorMaterial.d.ts +0 -3
- package/materials/MeshReflectorMaterial.js +8 -34
- package/materials/SpotLightMaterial.cjs.js +1 -1
- package/materials/SpotLightMaterial.js +3 -0
- package/native/index.cjs.js +1 -1
- package/native/index.js +9 -2
- package/package.json +6 -5
- package/web/ScrollControls.cjs.js +1 -1
- package/web/ScrollControls.js +2 -2
- package/web/index.cjs.js +1 -1
- package/web/index.js +9 -2
package/core/useFBO.js
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import * as THREE from 'three';
|
|
3
3
|
import { useThree } from '@react-three/fiber';
|
|
4
4
|
|
|
5
5
|
// 👇 uncomment when TS version supports function overloads
|
|
6
6
|
// export function useFBO(settings?: FBOSettings)
|
|
7
7
|
function useFBO(width, height, settings) {
|
|
8
|
-
const
|
|
9
|
-
gl
|
|
10
|
-
}) => gl);
|
|
11
|
-
const size = useThree(({
|
|
8
|
+
const {
|
|
9
|
+
gl,
|
|
12
10
|
size
|
|
13
|
-
}
|
|
14
|
-
const dpr = useMemo(() => gl.getPixelRatio(), [gl]);
|
|
11
|
+
} = useThree();
|
|
12
|
+
const dpr = React.useMemo(() => gl.getPixelRatio(), [gl]);
|
|
15
13
|
|
|
16
14
|
const _width = typeof width === 'number' ? width : size.width * dpr;
|
|
17
15
|
|
|
@@ -19,27 +17,27 @@ function useFBO(width, height, settings) {
|
|
|
19
17
|
|
|
20
18
|
const _settings = (typeof width === 'number' ? settings : width) || {};
|
|
21
19
|
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} = _settings;
|
|
20
|
+
const {
|
|
21
|
+
samples,
|
|
22
|
+
...targetSettings
|
|
23
|
+
} = _settings;
|
|
24
|
+
const target = React.useMemo(() => {
|
|
28
25
|
let target;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
26
|
+
target = new THREE.WebGLRenderTarget(_width, _height, {
|
|
27
|
+
minFilter: THREE.LinearFilter,
|
|
28
|
+
magFilter: THREE.LinearFilter,
|
|
29
|
+
encoding: gl.outputEncoding,
|
|
30
|
+
type: THREE.HalfFloatType,
|
|
31
|
+
...targetSettings
|
|
32
|
+
});
|
|
33
|
+
target.samples = samples;
|
|
37
34
|
return target;
|
|
38
35
|
}, []);
|
|
39
|
-
|
|
36
|
+
React.useLayoutEffect(() => {
|
|
40
37
|
target.setSize(_width, _height);
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
if (samples) target.samples = samples;
|
|
39
|
+
}, [samples, target, _width, _height]);
|
|
40
|
+
React.useEffect(() => {
|
|
43
41
|
return () => target.dispose();
|
|
44
42
|
}, []);
|
|
45
43
|
return target;
|
package/core/useGLTF.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GLTFLoader } from 'three-stdlib';
|
|
2
|
-
export declare function useGLTF<T extends string | string[]>(path: T, useDraco?: boolean | string, useMeshOpt?: boolean, extendLoader?: (loader: GLTFLoader) => void): T extends any[] ?
|
|
2
|
+
export declare function useGLTF<T extends string | string[]>(path: T, useDraco?: boolean | string, useMeshOpt?: boolean, extendLoader?: (loader: GLTFLoader) => void): T extends any[] ? import("three-stdlib").GLTF[] : import("three-stdlib").GLTF;
|
|
3
3
|
export declare namespace useGLTF {
|
|
4
4
|
var preload: (path: string | string[], useDraco?: string | boolean, useMeshOpt?: boolean, extendLoader?: ((loader: GLTFLoader) => void) | undefined) => undefined;
|
|
5
5
|
var clear: (input: string | string[]) => void;
|
package/core/useHelper.d.ts
CHANGED
|
@@ -4,5 +4,7 @@ import { Falsey } from 'utility-types';
|
|
|
4
4
|
declare type Helper = Object3D & {
|
|
5
5
|
update: () => void;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
declare type Constructor = new (...args: any[]) => any;
|
|
8
|
+
declare type Rest<T> = T extends [infer _, ...infer R] ? R : never;
|
|
9
|
+
export declare function useHelper<T extends Constructor>(object3D: React.MutableRefObject<Object3D | undefined> | Falsey | undefined, helperConstructor: T, ...args: Rest<ConstructorParameters<T>>): React.MutableRefObject<Helper | undefined>;
|
|
8
10
|
export {};
|