@react-three/drei 9.112.0 → 9.113.0
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 +0 -18
- package/core/GradientTexture.d.ts +1 -1
- package/core/GradientTexture.js +0 -1
- package/core/Line.d.ts +4 -4
- package/core/StatsGl.cjs.js +1 -1
- package/core/StatsGl.d.ts +5 -1
- package/core/StatsGl.js +15 -5
- package/index.cjs.js +1 -1
- package/materials/MeshRefractionMaterial.d.ts +0 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -779,24 +779,6 @@ https://pmndrs.github.io/drei
|
|
|
779
779
|
|
|
780
780
|
[Documentation has moved here](https://pmndrs.github.io/drei/staging/use-environment)
|
|
781
781
|
|
|
782
|
-
In order to preload you do this:
|
|
783
|
-
|
|
784
|
-
```jsx
|
|
785
|
-
useEnvironment.preload({ preset: 'city' })
|
|
786
|
-
useEnvironment.preload({ files: 'model.hdr' })
|
|
787
|
-
useEnvironment.preload({ files: ['px', 'nx', 'py', 'ny', 'pz', 'nz'].map((n) => `${n}.png`) })
|
|
788
|
-
```
|
|
789
|
-
|
|
790
|
-
Keep in mind that preloading [gainmaps](https://github.com/MONOGRID/gainmap-js) is not possible, because their loader requires access to the renderer.
|
|
791
|
-
|
|
792
|
-
You can also clear your environment map from the cache:
|
|
793
|
-
|
|
794
|
-
```jsx
|
|
795
|
-
useEnvironment.clear({ preset: 'city' })
|
|
796
|
-
useEnvironment.clear({ files: 'model.hdr' })
|
|
797
|
-
useEnvironment.clear({ files: ['px', 'nx', 'py', 'ny', 'pz', 'nz'].map((n) => `${n}.png`) })
|
|
798
|
-
```
|
|
799
|
-
|
|
800
782
|
#### MatcapTexture / useMatcapTexture
|
|
801
783
|
|
|
802
784
|
[Documentation has moved here](https://pmndrs.github.io/drei/staging/matcap-texture-use-matcap-texture)
|
|
@@ -13,6 +13,6 @@ type Props = {
|
|
|
13
13
|
type?: GradientType;
|
|
14
14
|
innerCircleRadius?: number;
|
|
15
15
|
outerCircleRadius?: string | number;
|
|
16
|
-
} & JSX.IntrinsicElements['texture']
|
|
16
|
+
} & Omit<JSX.IntrinsicElements['texture'], 'type'>;
|
|
17
17
|
export declare function GradientTexture({ stops, colors, size, width, type, innerCircleRadius, outerCircleRadius, ...props }: Props): React.JSX.Element;
|
|
18
18
|
export {};
|
package/core/GradientTexture.js
CHANGED
package/core/Line.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ReactThreeFiber } from '@react-three/fiber';
|
|
1
|
+
import { Color, ColorRepresentation } from 'three';
|
|
2
|
+
import { ReactThreeFiber, Vector2 as FiberVector2, Vector3 as FiberVector3 } from '@react-three/fiber';
|
|
3
3
|
import { LineMaterial, LineMaterialParameters, Line2, LineSegments2 } from 'three-stdlib';
|
|
4
4
|
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
5
5
|
export type LineProps = {
|
|
6
|
-
points:
|
|
7
|
-
vertexColors?:
|
|
6
|
+
points: ReadonlyArray<FiberVector2 | FiberVector3>;
|
|
7
|
+
vertexColors?: ReadonlyArray<Color | [number, number, number] | [number, number, number, number]>;
|
|
8
8
|
lineWidth?: number;
|
|
9
9
|
segments?: boolean;
|
|
10
10
|
} & Omit<LineMaterialParameters, 'vertexColors' | 'color'> & Omit<ReactThreeFiber.Object3DNode<Line2, typeof Line2>, 'args'> & Omit<ReactThreeFiber.Object3DNode<LineMaterial, [LineMaterialParameters]>, 'color' | 'vertexColors' | 'args'> & {
|
package/core/StatsGl.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@react-three/fiber"),t=require("react"),r=require("stats-gl");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function l(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var n=l(t),u=o(r);const s=n.forwardRef((({className:t,parent:r,id:o,clearStatsGlStyle:l,...s},a)=>{const c=e.useThree((e=>e.gl)),d=n.useMemo((()=>{const e=new u.default({...s});return e.init(c),e}),[c]);return n.useImperativeHandle(a,(()=>d.dom)),n.useEffect((()=>{if(d){const n=r&&r.current||document.body;null==n||n.appendChild(d.dom),d.dom.querySelectorAll("canvas").forEach((e=>{e.style.removeProperty("position")})),o&&(d.dom.id=o),l&&d.dom.removeAttribute("style"),d.dom.removeAttribute("style");const u=(null!=t?t:"").split(" ").filter((e=>e));u.length&&d.dom.classList.add(...u);const s=e.addAfterEffect((()=>d.update()));return()=>{u.length&&d.dom.classList.remove(...u),null==n||n.removeChild(d.dom),s()}}}),[r,d,t,o,l]),null}));s.displayName="StatsGl",exports.StatsGl=s;
|
package/core/StatsGl.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import Stats from 'stats-gl';
|
|
3
4
|
type Props = Partial<Stats> & {
|
|
5
|
+
id?: string;
|
|
6
|
+
clearStatsGlStyle?: boolean;
|
|
4
7
|
showPanel?: number;
|
|
5
8
|
className?: string;
|
|
6
9
|
parent?: React.RefObject<HTMLElement>;
|
|
10
|
+
ref?: React.RefObject<HTMLElement>;
|
|
7
11
|
};
|
|
8
|
-
export declare
|
|
12
|
+
export declare const StatsGl: ForwardRefComponent<Props, HTMLDivElement>;
|
|
9
13
|
export {};
|
package/core/StatsGl.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { useThree, addAfterEffect } from '@react-three/fiber';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import Stats from 'stats-gl';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
const StatsGl = /* @__PURE__ */React.forwardRef(({
|
|
6
6
|
className,
|
|
7
7
|
parent,
|
|
8
|
+
id,
|
|
9
|
+
clearStatsGlStyle,
|
|
8
10
|
...props
|
|
9
|
-
}) {
|
|
11
|
+
}, fref) => {
|
|
10
12
|
const gl = useThree(state => state.gl);
|
|
11
13
|
const stats = React.useMemo(() => {
|
|
12
14
|
const stats = new Stats({
|
|
@@ -15,10 +17,17 @@ function StatsGl({
|
|
|
15
17
|
stats.init(gl);
|
|
16
18
|
return stats;
|
|
17
19
|
}, [gl]);
|
|
20
|
+
React.useImperativeHandle(fref, () => stats.dom);
|
|
18
21
|
React.useEffect(() => {
|
|
19
22
|
if (stats) {
|
|
20
23
|
const node = parent && parent.current || document.body;
|
|
21
24
|
node == null || node.appendChild(stats.dom);
|
|
25
|
+
stats.dom.querySelectorAll('canvas').forEach(canvas => {
|
|
26
|
+
canvas.style.removeProperty('position');
|
|
27
|
+
});
|
|
28
|
+
if (id) stats.dom.id = id;
|
|
29
|
+
if (clearStatsGlStyle) stats.dom.removeAttribute('style');
|
|
30
|
+
stats.dom.removeAttribute('style');
|
|
22
31
|
const classNames = (className !== null && className !== void 0 ? className : '').split(' ').filter(cls => cls);
|
|
23
32
|
if (classNames.length) stats.dom.classList.add(...classNames);
|
|
24
33
|
const end = addAfterEffect(() => stats.update());
|
|
@@ -28,8 +37,9 @@ function StatsGl({
|
|
|
28
37
|
end();
|
|
29
38
|
};
|
|
30
39
|
}
|
|
31
|
-
}, [parent, stats, className]);
|
|
40
|
+
}, [parent, stats, className, id, clearStatsGlStyle]);
|
|
32
41
|
return null;
|
|
33
|
-
}
|
|
42
|
+
});
|
|
43
|
+
StatsGl.displayName = 'StatsGl';
|
|
34
44
|
|
|
35
45
|
export { StatsGl };
|