@react-three/drei 9.102.2 → 9.102.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 CHANGED
@@ -448,7 +448,7 @@ Scroll controls create a HTML scroll container in front of the canvas. Everythin
448
448
  You can listen and react to scroll with the `useScroll` hook which gives you useful data like the current scroll `offset`, `delta` and functions for range finding: `range`, `curve` and `visible`. The latter functions are especially useful if you want to react to the scroll offset, for instance if you wanted to fade things in and out if they are in or out of view.
449
449
 
450
450
  ```jsx
451
- <ScrollControls pages={3} damping={0.1}>
451
+ ;<ScrollControls pages={3} damping={0.1}>
452
452
  {/* Canvas contents in here will *not* scroll, but receive useScroll! */}
453
453
  <SomeModel />
454
454
  <Scroll>
@@ -1596,7 +1596,7 @@ Radial gradient.
1596
1596
 
1597
1597
  ```jsx
1598
1598
  import { GradientTexture, GradientType } from './GradientTexture'
1599
- <mesh>
1599
+ ;<mesh>
1600
1600
  <planeGeometry />
1601
1601
  <meshBasicMaterial>
1602
1602
  <GradientTexture
@@ -1625,7 +1625,7 @@ Abstracts [THREE.EdgesGeometry](https://threejs.org/docs/#api/en/geometries/Edge
1625
1625
  <boxGeometry />
1626
1626
  <meshBasicMaterial />
1627
1627
  <Edges
1628
- lineWidth={4}
1628
+ linewidth={4}
1629
1629
  scale={1.1}
1630
1630
  threshold={15} // Display edges only when the angle between two faces exceeds this value (default=15 degrees)
1631
1631
  color="white"
@@ -2825,7 +2825,7 @@ type FBOSettings = {
2825
2825
  samples?: number
2826
2826
  /** If set, the scene depth will be rendered into buffer.depthTexture. Default: false */
2827
2827
  depth?: boolean
2828
- } & THREE.WebGLRenderTargetOptions
2828
+ } & THREE.RenderTargetOptions
2829
2829
 
2830
2830
  export function useFBO(
2831
2831
  /** Width in pixels, or settings (will render fullscreen by default) */
@@ -3726,7 +3726,7 @@ If you still experience flip flops despite the bounds you can define a limit of
3726
3726
  PerformanceMonitor can also have children, if you wrap your app in it you get to use `usePerformanceMonitor` which allows individual components down the nested tree to respond to performance changes on their own.
3727
3727
 
3728
3728
  ```jsx
3729
- <PerformanceMonitor>
3729
+ ;<PerformanceMonitor>
3730
3730
  <Effects />
3731
3731
  </PerformanceMonitor>
3732
3732
 
@@ -3756,16 +3756,20 @@ type HudProps = {
3756
3756
  ```
3757
3757
 
3758
3758
  ```jsx
3759
- { /* Renders on top of the default scene with a perspective camera */ }
3760
- <Hud>
3759
+ {
3760
+ /* Renders on top of the default scene with a perspective camera */
3761
+ }
3762
+ ;<Hud>
3761
3763
  <PerspectiveCamera makeDefault position={[0, 0, 10]} />
3762
3764
  <mesh>
3763
3765
  <ringGeometry />
3764
3766
  </mesh>
3765
3767
  </Hud>
3766
3768
 
3767
- { /* Renders on top of the previous HUD with an orthographic camera */ }
3768
- <Hud renderPriority={2}>
3769
+ {
3770
+ /* Renders on top of the previous HUD with an orthographic camera */
3771
+ }
3772
+ ;<Hud renderPriority={2}>
3769
3773
  <OrthographicCamera makeDefault position={[0, 0, 10]} />
3770
3774
  <mesh>
3771
3775
  <boxGeometry />
package/core/Line.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("react"),r=require("three"),n=require("@react-three/fiber"),i=require("three-stdlib");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function s(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var a=o(e),c=s(t);const u=c.forwardRef((function({points:e,color:t=16777215,vertexColors:o,linewidth:s=1,lineWidth:u,segments:l,dashed:f,...d},m){var h;const p=n.useThree((e=>e.size)),b=c.useMemo((()=>l?new i.LineSegments2:new i.Line2),[l]),[y]=c.useState((()=>new i.LineMaterial)),v=4===(null==o||null==(h=o[0])?void 0:h.length)?4:3,g=c.useMemo((()=>{const n=l?new i.LineSegmentsGeometry:new i.LineGeometry,s=e.map((e=>{const t=Array.isArray(e);return e instanceof r.Vector3||e instanceof r.Vector4?[e.x,e.y,e.z]:e instanceof r.Vector2?[e.x,e.y,0]:t&&3===e.length?[e[0],e[1],e[2]]:t&&2===e.length?[e[0],e[1],0]:e}));if(n.setPositions(s.flat()),o){t=16777215;const e=o.map((e=>e instanceof r.Color?e.toArray():e));n.setColors(e.flat(),v)}return n}),[e,l,o,v]);return c.useLayoutEffect((()=>{b.computeLineDistances()}),[e,b]),c.useLayoutEffect((()=>{f?y.defines.USE_DASH="":delete y.defines.USE_DASH,y.needsUpdate=!0}),[f,y]),c.useEffect((()=>()=>g.dispose()),[g]),c.createElement("primitive",a.default({object:b,ref:m},d),c.createElement("primitive",{object:g,attach:"geometry"}),c.createElement("primitive",a.default({object:y,attach:"material",color:t,vertexColors:Boolean(o),resolution:[p.width,p.height],linewidth:null!=s?s:u,dashed:f,transparent:4===v},d)))}));exports.Line=u;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("react"),r=require("three"),n=require("@react-three/fiber"),i=require("three-stdlib");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function s(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var a=o(e),c=s(t);const l=c.forwardRef((function({points:e,color:t=16777215,vertexColors:o,linewidth:s,lineWidth:l,segments:u,dashed:f,...d},m){var h,p;const b=n.useThree((e=>e.size)),y=c.useMemo((()=>u?new i.LineSegments2:new i.Line2),[u]),[v]=c.useState((()=>new i.LineMaterial)),g=4===(null==o||null==(h=o[0])?void 0:h.length)?4:3,j=c.useMemo((()=>{const n=u?new i.LineSegmentsGeometry:new i.LineGeometry,s=e.map((e=>{const t=Array.isArray(e);return e instanceof r.Vector3||e instanceof r.Vector4?[e.x,e.y,e.z]:e instanceof r.Vector2?[e.x,e.y,0]:t&&3===e.length?[e[0],e[1],e[2]]:t&&2===e.length?[e[0],e[1],0]:e}));if(n.setPositions(s.flat()),o){t=16777215;const e=o.map((e=>e instanceof r.Color?e.toArray():e));n.setColors(e.flat(),g)}return n}),[e,u,o,g]);return c.useLayoutEffect((()=>{y.computeLineDistances()}),[e,y]),c.useLayoutEffect((()=>{f?v.defines.USE_DASH="":delete v.defines.USE_DASH,v.needsUpdate=!0}),[f,v]),c.useEffect((()=>()=>j.dispose()),[j]),c.createElement("primitive",a.default({object:y,ref:m},d),c.createElement("primitive",{object:j,attach:"geometry"}),c.createElement("primitive",a.default({object:v,attach:"material",color:t,vertexColors:Boolean(o),resolution:[b.width,b.height],linewidth:null!==(p=null!=s?s:l)&&void 0!==p?p:1,dashed:f,transparent:4===g},d)))}));exports.Line=l;
package/core/Line.js CHANGED
@@ -8,13 +8,13 @@ const Line = /* @__PURE__ */React.forwardRef(function Line({
8
8
  points,
9
9
  color = 0xffffff,
10
10
  vertexColors,
11
- linewidth = 1,
11
+ linewidth,
12
12
  lineWidth,
13
13
  segments,
14
14
  dashed,
15
15
  ...rest
16
16
  }, ref) {
17
- var _vertexColors$;
17
+ var _vertexColors$, _ref;
18
18
  const size = useThree(state => state.size);
19
19
  const line2 = React.useMemo(() => segments ? new LineSegments2() : new Line2(), [segments]);
20
20
  const [lineMaterial] = React.useState(() => new LineMaterial());
@@ -61,7 +61,7 @@ const Line = /* @__PURE__ */React.forwardRef(function Line({
61
61
  color: color,
62
62
  vertexColors: Boolean(vertexColors),
63
63
  resolution: [size.width, size.height],
64
- linewidth: linewidth !== null && linewidth !== void 0 ? linewidth : lineWidth,
64
+ linewidth: (_ref = linewidth !== null && linewidth !== void 0 ? linewidth : lineWidth) !== null && _ref !== void 0 ? _ref : 1,
65
65
  dashed: dashed,
66
66
  transparent: itemSize === 4
67
67
  }, rest)));
package/core/useFBO.d.ts CHANGED
@@ -1,7 +1,22 @@
1
1
  import * as THREE from 'three';
2
+ import { TextureEncoding } from '../helpers/deprecated';
3
+ type ColorSpace = 'srgb' | 'srgb-linear' | '' | string;
2
4
  type FBOSettings = {
3
5
  samples?: number;
4
6
  depth?: boolean;
5
- } & THREE.WebGLRenderTargetOptions;
7
+ wrapS?: THREE.Wrapping | undefined;
8
+ wrapT?: THREE.Wrapping | undefined;
9
+ magFilter?: THREE.MagnificationTextureFilter | undefined;
10
+ minFilter?: THREE.MinificationTextureFilter | undefined;
11
+ format?: number | undefined;
12
+ type?: THREE.TextureDataType | undefined;
13
+ anisotropy?: number | undefined;
14
+ depthBuffer?: boolean | undefined;
15
+ stencilBuffer?: boolean | undefined;
16
+ generateMipmaps?: boolean | undefined;
17
+ depthTexture?: THREE.DepthTexture | undefined;
18
+ encoding?: TextureEncoding | undefined;
19
+ colorSpace?: ColorSpace | undefined;
20
+ };
6
21
  export declare function useFBO(width?: number | FBOSettings, height?: number, settings?: FBOSettings): THREE.WebGLRenderTarget;
7
22
  export {};
package/core/useFBO.js CHANGED
@@ -2,6 +2,8 @@ import * as React from 'react';
2
2
  import * as THREE from 'three';
3
3
  import { useThree } from '@react-three/fiber';
4
4
 
5
+ // TODO: consume this from three >r154 when SemVer allows
6
+
5
7
  // 👇 uncomment when TS version supports function overloads
6
8
  // export function useFBO(settings?: FBOSettings)
7
9
  function useFBO( /** Width in pixels, or settings (will render fullscreen by default) */
@@ -1,3 +1,4 @@
1
+ import * as THREE from 'three';
1
2
  export declare const setUpdateRange: (attribute: THREE.BufferAttribute, updateRange: {
2
3
  offset: number;
3
4
  count: number;