@react-three/drei 7.25.5 → 7.27.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.
Files changed (49) hide show
  1. package/README.md +75 -34
  2. package/core/Backdrop.js +3 -1
  3. package/core/BakeShadows.cjs.js +1 -1
  4. package/core/BakeShadows.js +3 -3
  5. package/core/Bounds.cjs.js +1 -1
  6. package/core/Bounds.js +1 -1
  7. package/core/DeviceOrientationControls.d.ts +1 -1
  8. package/core/Instances.cjs.js +1 -1
  9. package/core/Instances.js +1 -1
  10. package/core/Line.d.ts +1 -1
  11. package/core/MapControls.d.ts +1 -1
  12. package/core/MeshDistortMaterial.d.ts +1 -1
  13. package/core/MeshReflectorMaterial.cjs.js +1 -0
  14. package/core/MeshReflectorMaterial.d.ts +25 -0
  15. package/core/MeshReflectorMaterial.js +182 -0
  16. package/core/MeshWobbleMaterial.d.ts +1 -1
  17. package/core/OrbitControls.d.ts +1 -1
  18. package/core/PositionalAudio.d.ts +1 -1
  19. package/core/QuadraticBezierLine.js +5 -1
  20. package/core/Reflector.cjs.js +1 -1
  21. package/core/Reflector.d.ts +4 -5
  22. package/core/Reflector.js +3 -0
  23. package/core/SpotLight.d.ts +1 -1
  24. package/core/TrackballControls.d.ts +1 -1
  25. package/core/TransformControls.d.ts +1 -1
  26. package/core/index.cjs.js +1 -1
  27. package/core/index.d.ts +1 -0
  28. package/core/index.js +2 -1
  29. package/core/useDetectGPU.cjs.js +1 -1
  30. package/core/useDetectGPU.d.ts +1 -1
  31. package/core/useDetectGPU.js +1 -5
  32. package/index.cjs.js +1 -1
  33. package/index.js +2 -2
  34. package/materials/MeshReflectorMaterial.d.ts +1 -1
  35. package/native/index.cjs.js +1 -1
  36. package/native/index.d.ts +0 -1
  37. package/native/index.js +4 -3
  38. package/package.json +3 -1
  39. package/web/PresentationControls.cjs.js +1 -0
  40. package/web/PresentationControls.d.ts +14 -0
  41. package/web/PresentationControls.js +73 -0
  42. package/web/ScrollControls.cjs.js +1 -1
  43. package/web/ScrollControls.js +1 -1
  44. package/web/index.cjs.js +1 -1
  45. package/web/index.d.ts +1 -1
  46. package/web/index.js +7 -3
  47. package/materials/index.cjs.js +0 -1
  48. package/materials/index.d.ts +0 -2
  49. package/materials/index.js +0 -4
package/README.md CHANGED
@@ -50,6 +50,7 @@ The `native` route of the library **does not** export `Html` or `Loader`. The de
50
50
  <li><a href="#controls">FirstPersonControls</a></li>
51
51
  <li><a href="#transformcontrols">TransformControls</a></li>
52
52
  <li><a href="#scrollcontrols">ScrollControls</a></li>
53
+ <li><a href="#presentationcontrols">PresentationControls</a></li>
53
54
  </ul>
54
55
  <li><a href="#abstractions">Abstractions</a></li>
55
56
  <ul>
@@ -67,6 +68,7 @@ The `native` route of the library **does not** export `Html` or `Loader`. The de
67
68
  </ul>
68
69
  <li><a href="#shaders">Shaders</a></li>
69
70
  <ul>
71
+ <li><a href="#meshreflectormaterial">MeshReflectorMaterial</a></li>
70
72
  <li><a href="#meshwobblematerial">MeshWobbleMaterial</a></li>
71
73
  <li><a href="#meshdistortmaterial">MeshDistortMaterial</a></li>
72
74
  <li><a href="#pointmaterial">PointMaterial</a></li>
@@ -158,10 +160,9 @@ The `native` route of the library **does not** export `Html` or `Loader`. The de
158
160
  <li><a href="#stage">Stage</a></li>
159
161
  <li><a href="#backdrop">Backdrop</a></li>
160
162
  <li><a href="#environment">Environment</a></li>
161
- <li><a href="#reflector">SpotLight</a></li>
163
+ <li><a href="#spotlight">SpotLight</a></li>
162
164
  <li><a href="#shadow">Shadow</a></li>
163
165
  <li><a href="#contactshadows">ContactShadows</a></li>
164
- <li><a href="#reflector">Reflector</a></li>
165
166
  <li><a href="#sky">Sky</a></li>
166
167
  <li><a href="#stars">Stars</a></li>
167
168
  <li><a href="#cloud">Cloud</a></li>
@@ -181,12 +182,25 @@ The `native` route of the library **does not** export `Html` or `Loader`. The de
181
182
 
182
183
  A responsive [THREE.PerspectiveCamera](https://threejs.org/docs/index.html#api/en/cameras/PerspectiveCamera) that can set itself as the default.
183
184
 
185
+ ```jsx
186
+ <PerspectiveCamera makeDefault {...props} />
187
+ <mesh />
188
+ ```
189
+
190
+ You can also give it children, which will now occupy the same position as the camera and follow along as it moves.
191
+
184
192
  ```jsx
185
193
  <PerspectiveCamera makeDefault {...props}>
186
194
  <mesh />
187
195
  </PerspectiveCamera>
188
196
  ```
189
197
 
198
+ You can also drive it manually, it won't be responsive and you have to calculate aspect ration yourself.
199
+
200
+ ```jsx
201
+ <PerspectiveCamera manual aspect={...} onUpdate={(c) => c.updateProjectionMatrix()}>
202
+ ```
203
+
190
204
  #### OrthographicCamera
191
205
 
192
206
  [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.vercel.app/?path=/story/camera-orthographiccamera--orthographic-camera-scene-st)
@@ -262,6 +276,8 @@ If you are using other controls (Orbit, Trackball, etc), you will notice how the
262
276
 
263
277
  # ScrollControls
264
278
 
279
+ ![](https://img.shields.io/badge/-Dom only-red)
280
+
265
281
  <p align="center">
266
282
  <a href="https://codesandbox.io/s/l4klb"><img width="16%" src="https://codesandbox.io/api/v1/sandboxes/l4klb/screenshot.png" alt="Horizintal tiles"/></a>
267
283
  <a href="https://codesandbox.io/s/4m0d0"><img width="16%" src="https://codesandbox.io/api/v1/sandboxes/4m0d0/screenshot.png" alt="M1 scroll"/></a>
@@ -324,6 +340,27 @@ function Foo() {
324
340
  return <mesh ref={ref} {...props} />
325
341
  ```
326
342
 
343
+ # PresentationControls
344
+
345
+ ![](https://img.shields.io/badge/-Dom only-red)
346
+
347
+ Semi-OrbitControls with spring-physics, polar zoom and snap-back, for presentational purposes. These controls do not turn the camera but will spin their contents. They will not suddenly come to rest when they reach limits like OrbitControls do, but rather smoothly anticipate stopping position.
348
+
349
+ ```jsx
350
+ <PresentationControls
351
+ global={false} // Spin globally or by dragging the model
352
+ snap={false} // Snap-back to center (can also be a spring config)
353
+ speed={1} // Speed factor
354
+ zoom={1} // Zoom factor when half the polar-max is reached
355
+ rotation={[0, 0, 0]} // Default rotation
356
+ polar={[0, Math.PI / 2]} // Vertical limits
357
+ azimuth={[-Infinity, Infinity]} // Horizontal limits
358
+ config = { mass: 1, tension: 170, friction: 26 } // Spring config
359
+ >
360
+ <mesh />
361
+ </PresentationControls>
362
+ ```
363
+
327
364
  # Shapes
328
365
 
329
366
  [Buffer-geometry](https://threejs.org/docs/index.html#api/en/core/BufferGeometry) short-cuts for Plane, Box, Sphere, Circle, Cone, Cylinder, Tube, Torus, TorusKnot, Ring, Tetrahedron, Polyhedron, Icosahedron, Octahedron, Dodecahedron, Extrude, Lathe, Parametric.
@@ -568,6 +605,38 @@ return <primitive object={scene} />
568
605
 
569
606
  # Shaders
570
607
 
608
+ #### MeshReflectorMaterial
609
+
610
+ [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.vercel.app/?path=/story/shaders-meshreflectormaterial--reflector-st)
611
+
612
+ Easily add reflections and/or blur to any mesh. It takes surface roughness into account for a more realistic effect. This material extends from [THREE.MeshStandardMaterial](https://threejs.org/docs/index.html?q=meshsta#api/en/materials/MeshStandardMaterial) and accepts all its props.
613
+
614
+ ```jsx
615
+ <mesh>
616
+ <planeGeometry />
617
+ <MeshReflectorMaterial
618
+ blur={[0, 0]} // Blur ground reflections (width, heigt), 0 skips blur
619
+ mixBlur={1.0} // How much blur mixes with surface roughness (default = 0), note that this can affect performance
620
+ mixStrength={0.5} // Strength of the reflections
621
+ resolution={256} // Off-buffer resolution, lower=faster, higher=better quality, slower
622
+ mirror={0.5} // Mirror environment, 0 = texture colors, 1 = pick up env colors
623
+ depthScale={1} // Scale the depth factor (0 = no depth, default = 0)
624
+ minDepthThreshold={0.9} // Lower edge for the depthTexture interpolation (default = 0)
625
+ maxDepthThreshold={1} // Upper edge for the depthTexture interpolation (default = 0)
626
+ depthToBlurRatioBias={0.25} // Adds a bias factor to the depthTexture before calculating the blur amount [blurFactor = blurTexture * (depthTexture + bias)]. It accepts values between 0 and 1, default is 0.25. An amount > 0 of bias makes sure that the blurTexture is not too sharp because of the multiplication with the depthTexture
627
+ distortion={0} // Amount of distortion based on the distortionMap texture
628
+ distortionMap={distortionTexture} // The red channel of this texture is used as the distortion map. Default is null
629
+ debug={0} /* Depending on the assigned value, one of the following channels is shown:
630
+ 0 = no debug
631
+ 1 = depth channel
632
+ 2 = base channel
633
+ 3 = distortion channel
634
+ 4 = lod channel (based on the roughness)
635
+ */
636
+ >
637
+ </mesh>
638
+ ```
639
+
571
640
  #### MeshWobbleMaterial
572
641
 
573
642
  [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.vercel.app/?path=/story/shaders-meshwobblematerial--mesh-wobble-material-st)
@@ -818,6 +887,8 @@ const [hidden, set] = useState()
818
887
 
819
888
  #### CycleRaycast
820
889
 
890
+ ![](https://img.shields.io/badge/-Dom only-red)
891
+
821
892
  This component allows you to cycle through all objects underneath the cursor with optional visual feedback. This can be useful for non-trivial selection, CAD data, housing, everything that has layers. It does this by changing the raycasters filter function and then refreshing the raycaster.
822
893
 
823
894
  For this to work properly your event handler have to call `event.stopPropagation()`, for instance in `onPointerOver` or `onClick`, only one element can be selective for cycling to make sense.
@@ -947,6 +1018,8 @@ return (
947
1018
 
948
1019
  #### useCursor
949
1020
 
1021
+ ![](https://img.shields.io/badge/-Dom only-red)
1022
+
950
1023
  A small hook that sets the css body cursor according to the hover state of a mesh, so that you can give the use visual feedback when the mouse enters a shape. Arguments 1 and 2 determine the style, the defaults are: onPointerOver = 'pointer', onPointerOut = 'auto'.
951
1024
 
952
1025
  ```jsx
@@ -1478,38 +1551,6 @@ function Foo() {
1478
1551
  return <SpotLight depthBuffer={depthBuffer} />
1479
1552
  ```
1480
1553
 
1481
- #### Reflector
1482
-
1483
- [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.vercel.app/?path=/story/misc-reflector--reflector-st)
1484
-
1485
- Easily add reflections and/or blur to a planar surface. This reflector can also blur and takes surface roughness into account for a more realistic effect.
1486
-
1487
- ```jsx
1488
- <Reflector
1489
- args={[1, 1]} // PlaneBufferGeometry arguments
1490
- blur={[0, 0]} // Blur ground reflections (width, heigt), 0 skips blur
1491
- mixBlur={1.0} // How much blur mixes with surface roughness (default = 0), note that this can affect performance
1492
- mixStrength={0.5} // Strength of the reflections
1493
- resolution={256} // Off-buffer resolution, lower=faster, higher=better quality
1494
- mirror={0.5} // Mirror environment, 0 = texture colors, 1 = pick up env colors
1495
- depthScale={1} // Scale the depth factor (0 = no depth, default = 0)
1496
- minDepthThreshold={0.9} // Lower edge for the depthTexture interpolation (default = 0)
1497
- maxDepthThreshold={1} // Upper edge for the depthTexture interpolation (default = 0)
1498
- depthToBlurRatioBias={0.25} // Adds a bias factor to the depthTexture before calculating the blur amount [blurFactor = blurTexture * (depthTexture + bias)]. It accepts values between 0 and 1, default is 0.25. An amount > 0 of bias makes sure that the blurTexture is not too sharp because of the multiplication with the depthTexture
1499
- distortion={0} // Amount of distortion based on the distortionMap texture
1500
- distortionMap={distortionTexture} // The red channel of this texture is used as the distortion map. Default is null
1501
- debug={0} /* Depending on the assigned value, one of the following channels is shown:
1502
- 0 = no debug
1503
- 1 = depth channel
1504
- 2 = base channel
1505
- 3 = distortion channel
1506
- 4 = lod channel (based on the roughness)
1507
- */
1508
- >
1509
- {(Material, props) => <Material {...props}>}
1510
- </Reflector>
1511
- ```
1512
-
1513
1554
  #### Environment
1514
1555
 
1515
1556
  [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.pmnd.rs/?path=/story/abstractions-environment--environment-st)
package/core/Backdrop.js CHANGED
@@ -16,7 +16,9 @@ function Backdrop({
16
16
  const position = ref.current.attributes.position;
17
17
 
18
18
  for (let x = 0; x < segments + 1; x++) {
19
- for (let y = 0; y < segments + 1; y++) position.setXYZ(i++, x / segments - offset + (x === 0 ? -floor : 0), y / segments - offset, easeInExpo(x / segments));
19
+ for (let y = 0; y < segments + 1; y++) {
20
+ position.setXYZ(i++, x / segments - offset + (x === 0 ? -floor : 0), y / segments - offset, easeInExpo(x / segments));
21
+ }
20
22
  }
21
23
 
22
24
  position.needsUpdate = true;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@react-three/fiber");function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var a=r(e);exports.BakeShadows=function(){const e=t.useThree((e=>e.gl));return a.useEffect((()=>(e.shadowMap.autoUpdate=!1,e.shadowMap.needsUpdate=!0,()=>{e.shadowMap.autoUpdate=e.shadowMap.needsUpdate=!0})),[]),null};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),a=require("@react-three/fiber");exports.BakeShadows=function(){const t=a.useThree((e=>e.gl));return e.useEffect((()=>(t.shadowMap.autoUpdate=!1,t.shadowMap.needsUpdate=!0,()=>{t.shadowMap.autoUpdate=t.shadowMap.needsUpdate=!0})),[t.shadowMap]),null};
@@ -1,15 +1,15 @@
1
- import * as React from 'react';
1
+ import { useEffect } from 'react';
2
2
  import { useThree } from '@react-three/fiber';
3
3
 
4
4
  function BakeShadows() {
5
5
  const gl = useThree(state => state.gl);
6
- React.useEffect(() => {
6
+ useEffect(() => {
7
7
  gl.shadowMap.autoUpdate = false;
8
8
  gl.shadowMap.needsUpdate = true;
9
9
  return () => {
10
10
  gl.shadowMap.autoUpdate = gl.shadowMap.needsUpdate = true;
11
11
  };
12
- }, []);
12
+ }, [gl.shadowMap]);
13
13
  return null;
14
14
  }
15
15
 
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("three"),r=require("@react-three/fiber");function o(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 a=o(e),n=o(t);const c=e=>e&&e.isOrthographicCamera,i=a.createContext(null);exports.Bounds=function({children:e,damping:t=6,fit:o,clip:s,margin:m=1.2,eps:u=.01,onFit:f}){const x=a.useRef(null),p=r.useThree((e=>e.camera)),l=r.useThree((e=>e.controls)),z=r.useThree((e=>e.invalidate)),h=a.useRef(f);function y(e,t){return Math.abs(e.x-t.x)<u&&Math.abs(e.y-t.y)<u&&Math.abs(e.z-t.z)<u}function d(e,t,r,o){e.x=n.MathUtils.damp(e.x,t.x,r,o),e.y=n.MathUtils.damp(e.y,t.y,r,o),e.z=n.MathUtils.damp(e.z,t.z,r,o)}h.current=f;const[M]=a.useState((()=>({animating:!1,focus:new n.Vector3,camera:new n.Vector3,zoom:1}))),[b]=a.useState((()=>({focus:new n.Vector3,camera:new n.Vector3,zoom:1}))),[g]=a.useState((()=>new n.Box3)),w=a.useMemo((()=>{function e(){const e=g.getSize(new n.Vector3),t=g.getCenter(new n.Vector3),r=Math.max(e.x,e.y,e.z),o=c(p)?4*r:r/(2*Math.atan(Math.PI*p.fov/360)),a=c(p)?4*r:o/p.aspect,i=m*Math.max(o,a);return{box:g,size:e,center:t,distance:i}}return{getSize:e,refresh(e){var t;if((t=e)&&t.isObject3D?g.setFromObject(e):(e=>e&&e.isBox3)(e)?g.copy(e):x.current&&g.setFromObject(x.current),g.isEmpty()){const e=p.position.length()||10;g.setFromCenterAndSize(new n.Vector3,new n.Vector3(e,e,e))}return this},clip(){const{distance:t}=e();return l&&(l.maxDistance=10*t),p.near=t/100,p.far=100*t,p.updateProjectionMatrix(),l&&l.update(),this},fit(){M.camera.copy(p.position),l&&M.focus.copy(l.target);const{center:r,distance:o}=e(),a=r.clone().sub(p.position).normalize().multiplyScalar(o);if(b.camera.copy(r).sub(a),b.focus.copy(r),c(p)){M.zoom=p.zoom;let e=0,o=0;const a=[new n.Vector3(g.min.x,g.min.y,g.min.z),new n.Vector3(g.min.x,g.max.y,g.min.z),new n.Vector3(g.min.x,g.min.y,g.max.z),new n.Vector3(g.min.x,g.max.y,g.max.z),new n.Vector3(g.max.x,g.max.y,g.max.z),new n.Vector3(g.max.x,g.max.y,g.min.z),new n.Vector3(g.max.x,g.min.y,g.max.z),new n.Vector3(g.max.x,g.min.y,g.min.z)];r.applyMatrix4(p.matrixWorldInverse);for(const t of a)t.applyMatrix4(p.matrixWorldInverse),e=Math.max(e,Math.abs(t.y-r.y)),o=Math.max(o,Math.abs(t.x-r.x));e*=2,o*=2;const c=(p.top-p.bottom)/e,i=(p.right-p.left)/o;b.zoom=Math.min(c,i)/m,t||(p.zoom=b.zoom,p.updateProjectionMatrix())}return t?M.animating=!0:(p.position.copy(b.camera),p.lookAt(b.focus),l&&(l.target.copy(b.focus),l.update()),z()),h.current&&h.current(this.getSize()),this}}}),[g,p,l,m,t,z]);return a.useLayoutEffect((()=>{if(w.refresh(),o&&w.fit(),s&&w.clip(),l){const e=e=>M.animating=!1;return l.addEventListener("start",e),()=>l.removeEventListener("start",e)}}),[s,o,l]),r.useFrame(((e,r)=>{if(M.animating){if(d(M.focus,b.focus,t,r),d(M.camera,b.camera,t,r),M.zoom=n.MathUtils.damp(M.zoom,b.zoom,t,r),p.position.copy(M.camera),c(p)&&(p.zoom=M.zoom,p.updateProjectionMatrix()),l?(l.target.copy(M.focus),l.update()):p.lookAt(M.focus),z(),c(p)&&!(Math.abs(M.zoom-b.zoom)<u))return;if(!c(p)&&!y(M.camera,b.camera))return;if(l&&!y(M.focus,b.focus))return;M.animating=!1}})),a.createElement("group",{ref:x},a.createElement(i.Provider,{value:w},e))},exports.useBounds=function(){return a.useContext(i)};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("three"),r=require("@react-three/fiber");function o(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 a=o(e),n=o(t);const c=e=>e&&e.isOrthographicCamera,i=a.createContext(null);exports.Bounds=function({children:e,damping:t=6,fit:o,clip:s,margin:m=1.2,eps:u=.01,onFit:f}){const x=a.useRef(null),p=r.useThree((e=>e.camera)),l=r.useThree((e=>e.controls)),z=r.useThree((e=>e.invalidate)),h=a.useRef(f);function y(e,t){return Math.abs(e.x-t.x)<u&&Math.abs(e.y-t.y)<u&&Math.abs(e.z-t.z)<u}function d(e,t,r,o){e.x=n.MathUtils.damp(e.x,t.x,r,o),e.y=n.MathUtils.damp(e.y,t.y,r,o),e.z=n.MathUtils.damp(e.z,t.z,r,o)}h.current=f;const[M]=a.useState((()=>({animating:!1,focus:new n.Vector3,camera:new n.Vector3,zoom:1}))),[b]=a.useState((()=>({focus:new n.Vector3,camera:new n.Vector3,zoom:1}))),[g]=a.useState((()=>new n.Box3)),w=a.useMemo((()=>{function e(){const e=g.getSize(new n.Vector3),t=g.getCenter(new n.Vector3),r=Math.max(e.x,e.y,e.z),o=c(p)?4*r:r/(2*Math.atan(Math.PI*p.fov/360)),a=c(p)?4*r:o/p.aspect,i=m*Math.max(o,a);return{box:g,size:e,center:t,distance:i}}return{getSize:e,refresh(e){var t;if((t=e)&&t.isObject3D?g.setFromObject(e):(e=>e&&e.isBox3)(e)?g.copy(e):x.current&&g.setFromObject(x.current),g.isEmpty()){const e=p.position.length()||10;g.setFromCenterAndSize(new n.Vector3,new n.Vector3(e,e,e))}return this},clip(){const{distance:t}=e();return l&&(l.maxDistance=10*t),p.near=t/100,p.far=100*t,p.updateProjectionMatrix(),l&&l.update(),this},fit(){M.camera.copy(p.position),l&&M.focus.copy(l.target);const{center:r,distance:o}=e(),a=r.clone().sub(p.position).normalize().multiplyScalar(o);if(b.camera.copy(r).sub(a),b.focus.copy(r),c(p)){M.zoom=p.zoom;let e=0,o=0;const a=[new n.Vector3(g.min.x,g.min.y,g.min.z),new n.Vector3(g.min.x,g.max.y,g.min.z),new n.Vector3(g.min.x,g.min.y,g.max.z),new n.Vector3(g.min.x,g.max.y,g.max.z),new n.Vector3(g.max.x,g.max.y,g.max.z),new n.Vector3(g.max.x,g.max.y,g.min.z),new n.Vector3(g.max.x,g.min.y,g.max.z),new n.Vector3(g.max.x,g.min.y,g.min.z)];r.applyMatrix4(p.matrixWorldInverse);for(const t of a)t.applyMatrix4(p.matrixWorldInverse),e=Math.max(e,Math.abs(t.y-r.y)),o=Math.max(o,Math.abs(t.x-r.x));e*=2,o*=2;const c=(p.top-p.bottom)/e,i=(p.right-p.left)/o;b.zoom=Math.min(c,i)/m,t||(p.zoom=b.zoom,p.updateProjectionMatrix())}return t?M.animating=!0:(p.position.copy(b.camera),p.lookAt(b.focus),l&&(l.target.copy(b.focus),l.update()),z()),h.current&&h.current(this.getSize()),this}}}),[g,p,l,m,t,z]);return a.useLayoutEffect((()=>{if(w.refresh(),o&&w.fit(),s&&w.clip(),l){const e=()=>M.animating=!1;return l.addEventListener("start",e),()=>l.removeEventListener("start",e)}}),[s,o,l]),r.useFrame(((e,r)=>{if(M.animating){if(d(M.focus,b.focus,t,r),d(M.camera,b.camera,t,r),M.zoom=n.MathUtils.damp(M.zoom,b.zoom,t,r),p.position.copy(M.camera),c(p)&&(p.zoom=M.zoom,p.updateProjectionMatrix()),l?(l.target.copy(M.focus),l.update()):p.lookAt(M.focus),z(),c(p)&&!(Math.abs(M.zoom-b.zoom)<u))return;if(!c(p)&&!y(M.camera,b.camera))return;if(l&&!y(M.focus,b.focus))return;M.animating=!1}})),a.createElement("group",{ref:x},a.createElement(i.Provider,{value:w},e))},exports.useBounds=function(){return a.useContext(i)};
package/core/Bounds.js CHANGED
@@ -154,7 +154,7 @@ function Bounds({
154
154
 
155
155
  if (controls) {
156
156
  // Try to prevent drag hijacking
157
- const callback = event => current.animating = false;
157
+ const callback = () => current.animating = false;
158
158
 
159
159
  controls.addEventListener('start', callback);
160
160
  return () => controls.removeEventListener('start', callback);
@@ -6,4 +6,4 @@ export declare type DeviceOrientationControlsProps = ReactThreeFiber.Object3DNod
6
6
  camera?: THREE.Camera;
7
7
  onChange?: (e?: THREE.Event) => void;
8
8
  };
9
- export declare const DeviceOrientationControls: React.ForwardRefExoticComponent<Pick<DeviceOrientationControlsProps, "object" | "attach" | "attachArray" | "attachObject" | "args" | "children" | "key" | "onUpdate" | "position" | "up" | "scale" | "rotation" | "matrix" | "quaternion" | "layers" | "dispose" | "addEventListener" | "hasEventListener" | "removeEventListener" | "dispatchEvent" | "onChange" | keyof import("@react-three/fiber/dist/declarations/src/core/events").EventHandlers | "camera" | "enabled" | "connect" | "disconnect" | "update" | "deviceOrientation" | "screenOrientation" | "alphaOffset"> & React.RefAttributes<DeviceOrientationControlsImp>>;
9
+ export declare const DeviceOrientationControls: React.ForwardRefExoticComponent<Pick<DeviceOrientationControlsProps, "object" | "attach" | "attachArray" | "attachObject" | "args" | "children" | "key" | "onUpdate" | "position" | "up" | "scale" | "rotation" | "matrix" | "quaternion" | "layers" | "dispose" | "addEventListener" | "hasEventListener" | "removeEventListener" | "dispatchEvent" | "onChange" | keyof import("@react-three/fiber/dist/declarations/src/core/events").EventHandlers | "camera" | "enabled" | "update" | "connect" | "disconnect" | "deviceOrientation" | "screenOrientation" | "alphaOffset"> & React.RefAttributes<DeviceOrientationControlsImp>>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("three"),r=require("react"),n=require("@react-three/fiber"),a=require("react-merge-refs"),c=require("react-composer"),u=require("../helpers/Position.cjs.js");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 i=o(e),l=s(t),f=s(r),d=o(a),m=o(c);let y,p;const x=f.createContext(null),b=new l.Matrix4,h=new l.Matrix4,g=new l.Matrix4,M=new l.Color,v=new l.Vector3,w=new l.Quaternion,j=new l.Vector3,A=f.forwardRef((({context:e,children:t,...r},a)=>{f.useMemo((()=>n.extend({Position:u.Position})),[]);const c=f.useRef(),{subscribe:o}=f.useContext(e||x);return f.useLayoutEffect((()=>o(c)),[]),f.createElement("position",i.default({ref:d.default([a,c])},r),t)})),E=f.forwardRef((({children:e,range:t,limit:r=1e3,frames:a=1/0,...c},u)=>{const[{context:o,instance:s}]=f.useState((()=>{const e=f.createContext(null);return{context:e,instance:f.forwardRef(((t,r)=>f.createElement(A,i.default({context:e},t,{ref:r}))))}})),m=f.useRef(null),[E,O]=f.useState([]),[[q,P]]=f.useState((()=>{const e=new Float32Array(16*r);for(y=0;y<r;y++)g.identity().toArray(e,16*y);return[e,new Float32Array([...new Array(3*r)].map((()=>1)))]}));f.useLayoutEffect((()=>{m.current.count=m.current.instanceMatrix.updateRange.count=m.current.instanceColor.updateRange.count=Math.min(r,void 0!==t?t:r,E.length)}),[E,t]),f.useEffect((()=>{m.current.instanceMatrix.needsUpdate=!0}));let _=0;n.useFrame((e=>{if(a===1/0||_<a){for(m.current.updateMatrix(),m.current.updateMatrixWorld(),b.copy(m.current.matrixWorld).invert(),y=0;y<E.length;y++)p=E[y].current,p.matrixWorld.decompose(v,w,j),h.compose(v,w,j).premultiply(b),h.equals(g.fromArray(q,16*y))||(h.toArray(q,16*y),m.current.instanceMatrix.needsUpdate=!0),p.color.equals(M.fromArray(P,3*y))||(p.color.toArray(P,3*y),m.current.instanceColor.needsUpdate=!0);_++}}));const C=f.useMemo((()=>{const e={};for(y=0;y<E.length;y++){var t;Object.assign(e,null==(t=E[y].current)?void 0:t.__r3f.handlers)}return Object.keys(e).reduce(((e,t)=>({...e,[t]:e=>{var r,n,a;const c=null==(r=E[e.instanceId])?void 0:r.current;return null==c||null==(n=c.__r3f)||null==(a=n.handlers)?void 0:a[t]({...e,object:c})}})),{})}),[e,E]),R=f.useMemo((()=>({subscribe:e=>(O((t=>[...t,e])),()=>O((t=>t.filter((t=>t.current!==e.current)))))})),[]);return f.createElement("instancedMesh",i.default({matrixAutoUpdate:!1,ref:d.default([u,m]),args:[null,null,0]},C,c),f.createElement("instancedBufferAttribute",{attach:"instanceMatrix",count:q.length/16,array:q,itemSize:16,usage:l.DynamicDrawUsage}),f.createElement("instancedBufferAttribute",{attach:"instanceColor",count:P.length/3,array:P,itemSize:3,usage:l.DynamicDrawUsage}),"function"==typeof e?f.createElement(o.Provider,{value:R},e(s)):f.createElement(x.Provider,{value:R},e))}));exports.Instance=A,exports.Instances=E,exports.Merged=function({meshes:e,children:t,...r}){const n=Array.isArray(e);if(!n)for(const t of Object.keys(e))e[t].isMesh||delete e[t];return f.createElement(m.default,{components:(n?e:Object.values(e)).map((({geometry:e,material:t})=>f.createElement(E,i.default({key:e.uuid,geometry:e,material:t},r))))},(r=>n?t(...r):t(Object.keys(e).filter((t=>e[t].isMesh)).reduce(((e,t,n)=>({...e,[t]:r[n]})),{}))))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("three"),r=require("react"),n=require("@react-three/fiber"),a=require("react-merge-refs"),c=require("react-composer"),u=require("../helpers/Position.cjs.js");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 i=o(e),l=s(t),f=s(r),d=o(a),m=o(c);let y,p;const x=f.createContext(null),b=new l.Matrix4,h=new l.Matrix4,g=new l.Matrix4,M=new l.Color,v=new l.Vector3,w=new l.Quaternion,j=new l.Vector3,A=f.forwardRef((({context:e,children:t,...r},a)=>{f.useMemo((()=>n.extend({Position:u.Position})),[]);const c=f.useRef(),{subscribe:o}=f.useContext(e||x);return f.useLayoutEffect((()=>o(c)),[]),f.createElement("position",i.default({ref:d.default([a,c])},r),t)})),E=f.forwardRef((({children:e,range:t,limit:r=1e3,frames:a=1/0,...c},u)=>{const[{context:o,instance:s}]=f.useState((()=>{const e=f.createContext(null);return{context:e,instance:f.forwardRef(((t,r)=>f.createElement(A,i.default({context:e},t,{ref:r}))))}})),m=f.useRef(null),[E,O]=f.useState([]),[[q,P]]=f.useState((()=>{const e=new Float32Array(16*r);for(y=0;y<r;y++)g.identity().toArray(e,16*y);return[e,new Float32Array([...new Array(3*r)].map((()=>1)))]}));f.useLayoutEffect((()=>{m.current.count=m.current.instanceMatrix.updateRange.count=m.current.instanceColor.updateRange.count=Math.min(r,void 0!==t?t:r,E.length)}),[E,t]),f.useEffect((()=>{m.current.instanceMatrix.needsUpdate=!0}));let _=0;n.useFrame((()=>{if(a===1/0||_<a){for(m.current.updateMatrix(),m.current.updateMatrixWorld(),b.copy(m.current.matrixWorld).invert(),y=0;y<E.length;y++)p=E[y].current,p.matrixWorld.decompose(v,w,j),h.compose(v,w,j).premultiply(b),h.equals(g.fromArray(q,16*y))||(h.toArray(q,16*y),m.current.instanceMatrix.needsUpdate=!0),p.color.equals(M.fromArray(P,3*y))||(p.color.toArray(P,3*y),m.current.instanceColor.needsUpdate=!0);_++}}));const C=f.useMemo((()=>{const e={};for(y=0;y<E.length;y++){var t;Object.assign(e,null==(t=E[y].current)?void 0:t.__r3f.handlers)}return Object.keys(e).reduce(((e,t)=>({...e,[t]:e=>{var r,n,a;const c=null==(r=E[e.instanceId])?void 0:r.current;return null==c||null==(n=c.__r3f)||null==(a=n.handlers)?void 0:a[t]({...e,object:c})}})),{})}),[e,E]),R=f.useMemo((()=>({subscribe:e=>(O((t=>[...t,e])),()=>O((t=>t.filter((t=>t.current!==e.current)))))})),[]);return f.createElement("instancedMesh",i.default({matrixAutoUpdate:!1,ref:d.default([u,m]),args:[null,null,0]},C,c),f.createElement("instancedBufferAttribute",{attach:"instanceMatrix",count:q.length/16,array:q,itemSize:16,usage:l.DynamicDrawUsage}),f.createElement("instancedBufferAttribute",{attach:"instanceColor",count:P.length/3,array:P,itemSize:3,usage:l.DynamicDrawUsage}),"function"==typeof e?f.createElement(o.Provider,{value:R},e(s)):f.createElement(x.Provider,{value:R},e))}));exports.Instance=A,exports.Instances=E,exports.Merged=function({meshes:e,children:t,...r}){const n=Array.isArray(e);if(!n)for(const t of Object.keys(e))e[t].isMesh||delete e[t];return f.createElement(m.default,{components:(n?e:Object.values(e)).map((({geometry:e,material:t})=>f.createElement(E,i.default({key:e.uuid,geometry:e,material:t},r))))},(r=>n?t(...r):t(Object.keys(e).filter((t=>e[t].isMesh)).reduce(((e,t,n)=>({...e,[t]:r[n]})),{}))))};
package/core/Instances.js CHANGED
@@ -70,7 +70,7 @@ const Instances = /*#__PURE__*/React.forwardRef(({
70
70
  parentRef.current.instanceMatrix.needsUpdate = true;
71
71
  });
72
72
  let count = 0;
73
- useFrame(state => {
73
+ useFrame(() => {
74
74
  if (frames === Infinity || count < frames) {
75
75
  parentRef.current.updateMatrix();
76
76
  parentRef.current.updateMatrixWorld();
package/core/Line.d.ts CHANGED
@@ -6,4 +6,4 @@ export declare type LineProps = {
6
6
  points: Array<Vector3 | [number, number, number]>;
7
7
  vertexColors?: Array<Color | [number, number, number]>;
8
8
  } & LineMaterialParameters & Omit<ReactThreeFiber.Object3DNode<Line2, typeof Line2>, 'args'> & Omit<ReactThreeFiber.Object3DNode<LineMaterial, [LineMaterialParameters]>, 'color' | 'vertexColors' | 'resolution' | 'args'>;
9
- export declare const Line: React.ForwardRefExoticComponent<Pick<LineProps, "attach" | "attachArray" | "attachObject" | "children" | "key" | "onUpdate" | "position" | "up" | "scale" | "rotation" | "matrix" | "quaternion" | "layers" | "dispose" | "type" | "id" | "uuid" | "parent" | "modelViewMatrix" | "normalMatrix" | "matrixWorld" | "matrixAutoUpdate" | "matrixWorldNeedsUpdate" | "castShadow" | "receiveShadow" | "frustumCulled" | "renderOrder" | "animations" | "customDepthMaterial" | "customDistanceMaterial" | "isObject3D" | "onBeforeRender" | "onAfterRender" | "applyMatrix4" | "applyQuaternion" | "setRotationFromAxisAngle" | "setRotationFromEuler" | "setRotationFromMatrix" | "setRotationFromQuaternion" | "rotateOnAxis" | "rotateOnWorldAxis" | "rotateX" | "rotateY" | "rotateZ" | "translateOnAxis" | "translateX" | "translateY" | "translateZ" | "localToWorld" | "worldToLocal" | "lookAt" | "add" | "remove" | "clear" | "getObjectById" | "getObjectByName" | "getObjectByProperty" | "getWorldPosition" | "getWorldQuaternion" | "getWorldScale" | "getWorldDirection" | "raycast" | "traverse" | "traverseVisible" | "traverseAncestors" | "updateMatrix" | "updateMatrixWorld" | "updateWorldMatrix" | "toJSON" | "clone" | "copy" | "addEventListener" | "hasEventListener" | "removeEventListener" | "dispatchEvent" | "color" | keyof import("@react-three/fiber/dist/declarations/src/core/events").EventHandlers | "dashed" | "points" | "material" | "isLine2" | "computeLineDistances" | "geometry" | "morphTargetInfluences" | "morphTargetDictionary" | "isMesh" | "updateMorphTargets" | "lineWidth" | "dashScale" | "dashOffset" | "dashSize" | "resolution" | "derivatives" | "defaultAttributeValues" | "index0AttributeName" | "uniformsNeedUpdate" | "isShaderMaterial" | "setValues" | "isMaterial" | "needsUpdate" | "version" | "onBeforeCompile" | "customProgramCacheKey" | "gapSize" | keyof import("three").ShaderMaterialParameters> & React.RefAttributes<Line2>>;
9
+ export declare const Line: React.ForwardRefExoticComponent<Pick<LineProps, "attach" | "attachArray" | "attachObject" | "children" | "key" | "onUpdate" | "position" | "up" | "scale" | "rotation" | "matrix" | "quaternion" | "layers" | "dispose" | "type" | "id" | "uuid" | "parent" | "modelViewMatrix" | "normalMatrix" | "matrixWorld" | "matrixAutoUpdate" | "matrixWorldNeedsUpdate" | "castShadow" | "receiveShadow" | "frustumCulled" | "renderOrder" | "animations" | "customDepthMaterial" | "customDistanceMaterial" | "isObject3D" | "onBeforeRender" | "onAfterRender" | "applyMatrix4" | "applyQuaternion" | "setRotationFromAxisAngle" | "setRotationFromEuler" | "setRotationFromMatrix" | "setRotationFromQuaternion" | "rotateOnAxis" | "rotateOnWorldAxis" | "rotateX" | "rotateY" | "rotateZ" | "translateOnAxis" | "translateX" | "translateY" | "translateZ" | "localToWorld" | "worldToLocal" | "lookAt" | "add" | "remove" | "clear" | "getObjectById" | "getObjectByName" | "getObjectByProperty" | "getWorldPosition" | "getWorldQuaternion" | "getWorldScale" | "getWorldDirection" | "raycast" | "traverse" | "traverseVisible" | "traverseAncestors" | "updateMatrix" | "updateMatrixWorld" | "updateWorldMatrix" | "toJSON" | "clone" | "copy" | "addEventListener" | "hasEventListener" | "removeEventListener" | "dispatchEvent" | "color" | keyof import("@react-three/fiber/dist/declarations/src/core/events").EventHandlers | "dashed" | "points" | "material" | "isMaterial" | "needsUpdate" | "version" | "onBeforeCompile" | "customProgramCacheKey" | "setValues" | "isLine2" | "computeLineDistances" | "geometry" | "morphTargetInfluences" | "morphTargetDictionary" | "isMesh" | "updateMorphTargets" | "lineWidth" | "dashScale" | "dashOffset" | "dashSize" | "resolution" | "derivatives" | "defaultAttributeValues" | "index0AttributeName" | "uniformsNeedUpdate" | "isShaderMaterial" | "gapSize" | keyof import("three").ShaderMaterialParameters> & React.RefAttributes<Line2>>;
@@ -9,4 +9,4 @@ export declare type MapControlsProps = ReactThreeFiber.Overwrite<ReactThreeFiber
9
9
  onStart?: (e?: THREE.Event) => void;
10
10
  onEnd?: (e?: THREE.Event) => void;
11
11
  }>;
12
- export declare const MapControls: React.ForwardRefExoticComponent<Pick<MapControlsProps, "object" | "attach" | "attachArray" | "attachObject" | "args" | "children" | "key" | "onUpdate" | "position" | "up" | "scale" | "rotation" | "matrix" | "quaternion" | "layers" | "dispose" | "addEventListener" | "hasEventListener" | "removeEventListener" | "dispatchEvent" | "onChange" | keyof import("@react-three/fiber/dist/declarations/src/core/events").EventHandlers | "camera" | "reset" | "enabled" | "connect" | "target" | "keys" | "update" | "domElement" | "minDistance" | "maxDistance" | "minZoom" | "maxZoom" | "minPolarAngle" | "maxPolarAngle" | "minAzimuthAngle" | "maxAzimuthAngle" | "enableDamping" | "dampingFactor" | "enableZoom" | "zoomSpeed" | "enableRotate" | "rotateSpeed" | "enablePan" | "panSpeed" | "screenSpacePanning" | "keyPanSpeed" | "autoRotate" | "autoRotateSpeed" | "mouseButtons" | "touches" | "target0" | "position0" | "zoom0" | "_domElementKeyEvents" | "getPolarAngle" | "getAzimuthalAngle" | "setPolarAngle" | "setAzimuthalAngle" | "getDistance" | "listenToKeyEvents" | "saveState" | "onStart" | "onEnd"> & React.RefAttributes<MapControlsImpl>>;
12
+ export declare const MapControls: React.ForwardRefExoticComponent<Pick<MapControlsProps, "object" | "attach" | "attachArray" | "attachObject" | "args" | "children" | "key" | "onUpdate" | "position" | "up" | "scale" | "rotation" | "matrix" | "quaternion" | "layers" | "dispose" | "addEventListener" | "hasEventListener" | "removeEventListener" | "dispatchEvent" | "onChange" | keyof import("@react-three/fiber/dist/declarations/src/core/events").EventHandlers | "camera" | "reset" | "enabled" | "update" | "onStart" | "keys" | "target" | "touches" | "connect" | "domElement" | "minDistance" | "maxDistance" | "minZoom" | "maxZoom" | "minPolarAngle" | "maxPolarAngle" | "minAzimuthAngle" | "maxAzimuthAngle" | "enableDamping" | "dampingFactor" | "enableZoom" | "zoomSpeed" | "enableRotate" | "rotateSpeed" | "enablePan" | "panSpeed" | "screenSpacePanning" | "keyPanSpeed" | "autoRotate" | "autoRotateSpeed" | "mouseButtons" | "target0" | "position0" | "zoom0" | "_domElementKeyEvents" | "getPolarAngle" | "getAzimuthalAngle" | "setPolarAngle" | "setAzimuthalAngle" | "getDistance" | "listenToKeyEvents" | "saveState" | "onEnd"> & React.RefAttributes<MapControlsImpl>>;
@@ -21,5 +21,5 @@ export declare const MeshDistortMaterial: React.ForwardRefExoticComponent<Pick<O
21
21
  } & {
22
22
  speed?: number | undefined;
23
23
  factor?: number | undefined;
24
- }, "visible" | "attach" | "attachArray" | "attachObject" | "args" | "children" | "key" | "onUpdate" | "dispose" | "type" | "id" | "uuid" | "name" | "userData" | "toJSON" | "clone" | "copy" | "addEventListener" | "hasEventListener" | "removeEventListener" | "dispatchEvent" | "color" | "map" | "time" | "transparent" | "fog" | "opacity" | "alphaToCoverage" | "defines" | "wireframe" | "wireframeLinewidth" | "skinning" | "morphTargets" | "morphNormals" | "setValues" | "alphaTest" | "blendDst" | "blendDstAlpha" | "blendEquation" | "blendEquationAlpha" | "blending" | "blendSrc" | "blendSrcAlpha" | "clipIntersection" | "clippingPlanes" | "clipShadows" | "colorWrite" | "depthFunc" | "depthTest" | "depthWrite" | "stencilWrite" | "stencilFunc" | "stencilRef" | "stencilWriteMask" | "stencilFuncMask" | "stencilFail" | "stencilZFail" | "stencilZPass" | "isMaterial" | "needsUpdate" | "polygonOffset" | "polygonOffsetFactor" | "polygonOffsetUnits" | "precision" | "premultipliedAlpha" | "dithering" | "side" | "shadowSide" | "toneMapped" | "vertexColors" | "version" | "onBeforeCompile" | "customProgramCacheKey" | "emissive" | "emissiveIntensity" | "emissiveMap" | "lightMap" | "lightMapIntensity" | "aoMap" | "aoMapIntensity" | "alphaMap" | "envMap" | "reflectivity" | "refractionRatio" | "wireframeLinecap" | "wireframeLinejoin" | "clearcoat" | "clearcoatMap" | "clearcoatRoughness" | "clearcoatRoughnessMap" | "clearcoatNormalScale" | "clearcoatNormalMap" | "ior" | "sheen" | "transmission" | "transmissionMap" | "roughness" | "metalness" | "bumpMap" | "bumpScale" | "normalMap" | "normalMapType" | "normalScale" | "displacementMap" | "displacementScale" | "displacementBias" | "roughnessMap" | "metalnessMap" | "envMapIntensity" | "vertexTangents" | "flatShading" | "isMeshStandardMaterial" | "radius" | "distort" | "speed" | "factor"> & React.RefAttributes<unknown>>;
24
+ }, "visible" | "attach" | "attachArray" | "attachObject" | "args" | "children" | "key" | "onUpdate" | "dispose" | "type" | "id" | "uuid" | "name" | "userData" | "toJSON" | "clone" | "copy" | "addEventListener" | "hasEventListener" | "removeEventListener" | "dispatchEvent" | "color" | "map" | "time" | "transparent" | "fog" | "opacity" | "speed" | "precision" | "alphaTest" | "alphaToCoverage" | "blendDst" | "blendDstAlpha" | "blendEquation" | "blendEquationAlpha" | "blending" | "blendSrc" | "blendSrcAlpha" | "clipIntersection" | "clippingPlanes" | "clipShadows" | "colorWrite" | "defines" | "depthFunc" | "depthTest" | "depthWrite" | "stencilWrite" | "stencilFunc" | "stencilRef" | "stencilWriteMask" | "stencilFuncMask" | "stencilFail" | "stencilZFail" | "stencilZPass" | "isMaterial" | "needsUpdate" | "polygonOffset" | "polygonOffsetFactor" | "polygonOffsetUnits" | "premultipliedAlpha" | "dithering" | "side" | "shadowSide" | "toneMapped" | "vertexColors" | "version" | "onBeforeCompile" | "customProgramCacheKey" | "setValues" | "wireframe" | "wireframeLinewidth" | "skinning" | "morphTargets" | "morphNormals" | "emissive" | "emissiveIntensity" | "emissiveMap" | "lightMap" | "lightMapIntensity" | "aoMap" | "aoMapIntensity" | "alphaMap" | "envMap" | "reflectivity" | "refractionRatio" | "wireframeLinecap" | "wireframeLinejoin" | "clearcoat" | "clearcoatMap" | "clearcoatRoughness" | "clearcoatRoughnessMap" | "clearcoatNormalScale" | "clearcoatNormalMap" | "ior" | "sheen" | "transmission" | "transmissionMap" | "roughness" | "metalness" | "bumpMap" | "bumpScale" | "normalMap" | "normalMapType" | "normalScale" | "displacementMap" | "displacementScale" | "displacementBias" | "roughnessMap" | "metalnessMap" | "envMapIntensity" | "vertexTangents" | "flatShading" | "isMeshStandardMaterial" | "radius" | "distort" | "factor"> & React.RefAttributes<unknown>>;
25
25
  export {};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("react"),r=require("three"),a=require("@react-three/fiber"),n=require("react-merge-refs"),i=require("../materials/BlurPass.cjs.js"),o=require("../materials/MeshReflectorMaterial.cjs.js");function s(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 a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}require("../materials/ConvolutionMaterial.cjs.js");var u=s(e),d=l(t),c=s(n);a.extend({MeshReflectorMaterialImpl:o.MeshReflectorMaterial});const p=d.forwardRef((({mixBlur:e=0,mixStrength:t=.5,resolution:n=256,blur:o=[0,0],minDepthThreshold:s=.9,maxDepthThreshold:l=1,depthScale:p=0,depthToBlurRatioBias:m=.25,mirror:h=.5,debug:f=0,distortion:x=1,distortionMap:M,...T},S)=>{const b=a.useThree((({gl:e})=>e)),y=a.useThree((({camera:e})=>e)),w=a.useThree((({scene:e})=>e)),g=(o=Array.isArray(o)?o:[o,o])[0]+o[1]>0,R=d.useRef(null),[v]=d.useState((()=>new r.Plane)),[j]=d.useState((()=>new r.Vector3)),[B]=d.useState((()=>new r.Vector3)),[D]=d.useState((()=>new r.Vector3)),[_]=d.useState((()=>new r.Matrix4)),[P]=d.useState((()=>new r.Vector3(0,0,-1))),[U]=d.useState((()=>new r.Vector4)),[E]=d.useState((()=>new r.Vector3)),[O]=d.useState((()=>new r.Vector3)),[F]=d.useState((()=>new r.Vector4)),[V]=d.useState((()=>new r.Matrix4)),[W]=d.useState((()=>new r.PerspectiveCamera)),q=d.useCallback((()=>{var e;const t=R.current.parent||(null==(e=R.current)?void 0:e.__r3f.parent);if(!t)return;if(B.setFromMatrixPosition(t.matrixWorld),D.setFromMatrixPosition(y.matrixWorld),_.extractRotation(t.matrixWorld),j.set(0,0,1),j.applyMatrix4(_),E.subVectors(B,D),E.dot(j)>0)return;E.reflect(j).negate(),E.add(B),_.extractRotation(y.matrixWorld),P.set(0,0,-1),P.applyMatrix4(_),P.add(D),O.subVectors(B,P),O.reflect(j).negate(),O.add(B),W.position.copy(E),W.up.set(0,1,0),W.up.applyMatrix4(_),W.up.reflect(j),W.lookAt(O),W.far=y.far,W.updateMatrixWorld(),W.projectionMatrix.copy(y.projectionMatrix),V.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),V.multiply(W.projectionMatrix),V.multiply(W.matrixWorldInverse),V.multiply(t.matrixWorld),v.setFromNormalAndCoplanarPoint(j,B),v.applyMatrix4(W.matrixWorldInverse),U.set(v.normal.x,v.normal.y,v.normal.z,v.constant);const r=W.projectionMatrix;F.x=(Math.sign(U.x)+r.elements[8])/r.elements[0],F.y=(Math.sign(U.y)+r.elements[9])/r.elements[5],F.z=-1,F.w=(1+r.elements[10])/r.elements[14],U.multiplyScalar(2/U.dot(F)),r.elements[2]=U.x,r.elements[6]=U.y,r.elements[10]=U.z+1,r.elements[14]=U.w}),[]),[I,k,L,C]=d.useMemo((()=>{const a={minFilter:r.LinearFilter,magFilter:r.LinearFilter,format:r.RGBFormat,encoding:b.outputEncoding},u=new r.WebGLRenderTarget(n,n,a);u.depthBuffer=!0,u.depthTexture=new r.DepthTexture(n,n),u.depthTexture.format=r.DepthFormat,u.depthTexture.type=r.UnsignedShortType;const d=new r.WebGLRenderTarget(n,n,a);return[u,d,new i.BlurPass({gl:b,resolution:n,width:o[0],height:o[1],minDepthThreshold:s,maxDepthThreshold:l,depthScale:p,depthToBlurRatioBias:m}),{mirror:h,textureMatrix:V,mixBlur:e,tDiffuse:u.texture,tDepth:u.depthTexture,tDiffuseBlur:d.texture,hasBlur:g,mixStrength:t,minDepthThreshold:s,maxDepthThreshold:l,depthScale:p,depthToBlurRatioBias:m,transparent:!0,debug:f,distortion:x,distortionMap:M,"defines-USE_BLUR":g?"":void 0,"defines-USE_DEPTH":p>0?"":void 0,"defines-USE_DISTORTION":M?"":void 0}]}),[b,o,V,n,h,g,e,t,s,l,p,m,f,x,M]);return a.useFrame((()=>{var e;const t=R.current.parent||(null==(e=R.current)?void 0:e.__r3f.parent);if(!t)return;t.visible=!1;const r=b.xr.enabled,a=b.shadowMap.autoUpdate;q(),b.xr.enabled=!1,b.shadowMap.autoUpdate=!1,b.setRenderTarget(I),b.state.buffers.depth.setMask(!0),b.autoClear||b.clear(),b.render(w,W),g&&L.render(b,I,k),b.xr.enabled=r,b.shadowMap.autoUpdate=a,t.visible=!0,b.setRenderTarget(null)})),d.createElement("meshReflectorMaterialImpl",u.default({attach:"material",key:"key"+C["defines-USE_BLUR"]+C["defines-USE_DEPTH"]+C["defines-USE_DISTORTION"],ref:c.default([R,S])},C,T))}));exports.MeshReflectorMaterial=p;
@@ -0,0 +1,25 @@
1
+ import * as React from 'react';
2
+ import { Texture } from 'three';
3
+ import { MeshReflectorMaterialProps, MeshReflectorMaterial as MeshReflectorMaterialImpl } from '../materials/MeshReflectorMaterial';
4
+ export declare type Props = JSX.IntrinsicElements['meshStandardMaterial'] & {
5
+ resolution?: number;
6
+ mixBlur?: number;
7
+ mixStrength?: number;
8
+ blur?: [number, number] | number;
9
+ mirror: number;
10
+ minDepthThreshold?: number;
11
+ maxDepthThreshold?: number;
12
+ depthScale?: number;
13
+ depthToBlurRatioBias?: number;
14
+ debug?: number;
15
+ distortionMap?: Texture;
16
+ distortion?: number;
17
+ };
18
+ declare global {
19
+ namespace JSX {
20
+ interface IntrinsicElements {
21
+ meshReflectorMaterialImpl: MeshReflectorMaterialProps;
22
+ }
23
+ }
24
+ }
25
+ export declare const MeshReflectorMaterial: React.ForwardRefExoticComponent<Pick<Props, "visible" | "attach" | "attachArray" | "attachObject" | "args" | "children" | "key" | "onUpdate" | "dispose" | "type" | "id" | "uuid" | "name" | "userData" | "toJSON" | "clone" | "copy" | "addEventListener" | "hasEventListener" | "removeEventListener" | "dispatchEvent" | "color" | "map" | "transparent" | "fog" | "blur" | "opacity" | "precision" | "alphaTest" | "alphaToCoverage" | "blendDst" | "blendDstAlpha" | "blendEquation" | "blendEquationAlpha" | "blending" | "blendSrc" | "blendSrcAlpha" | "clipIntersection" | "clippingPlanes" | "clipShadows" | "colorWrite" | "defines" | "depthFunc" | "depthTest" | "depthWrite" | "stencilWrite" | "stencilFunc" | "stencilRef" | "stencilWriteMask" | "stencilFuncMask" | "stencilFail" | "stencilZFail" | "stencilZPass" | "isMaterial" | "needsUpdate" | "polygonOffset" | "polygonOffsetFactor" | "polygonOffsetUnits" | "premultipliedAlpha" | "dithering" | "side" | "shadowSide" | "toneMapped" | "vertexColors" | "version" | "onBeforeCompile" | "customProgramCacheKey" | "setValues" | "resolution" | "wireframe" | "wireframeLinewidth" | "skinning" | "morphTargets" | "morphNormals" | "emissive" | "emissiveIntensity" | "emissiveMap" | "lightMap" | "lightMapIntensity" | "aoMap" | "aoMapIntensity" | "alphaMap" | "envMap" | "refractionRatio" | "wireframeLinecap" | "wireframeLinejoin" | "roughness" | "metalness" | "bumpMap" | "bumpScale" | "normalMap" | "normalMapType" | "normalScale" | "displacementMap" | "displacementScale" | "displacementBias" | "roughnessMap" | "metalnessMap" | "envMapIntensity" | "vertexTangents" | "flatShading" | "isMeshStandardMaterial" | "minDepthThreshold" | "maxDepthThreshold" | "depthScale" | "depthToBlurRatioBias" | "mixBlur" | "mixStrength" | "mirror" | "debug" | "distortion" | "distortionMap"> & React.RefAttributes<MeshReflectorMaterialImpl>>;
@@ -0,0 +1,182 @@
1
+ import _extends from '@babel/runtime/helpers/esm/extends';
2
+ import * as React from 'react';
3
+ import { Plane, Vector3, Matrix4, Vector4, PerspectiveCamera, LinearFilter, RGBFormat, WebGLRenderTarget, DepthTexture, DepthFormat, UnsignedShortType } from 'three';
4
+ import { extend, useThree, useFrame } from '@react-three/fiber';
5
+ import mergeRefs from 'react-merge-refs';
6
+ import { BlurPass } from '../materials/BlurPass.js';
7
+ import { MeshReflectorMaterial as MeshReflectorMaterial$1 } from '../materials/MeshReflectorMaterial.js';
8
+
9
+ extend({
10
+ MeshReflectorMaterialImpl: MeshReflectorMaterial$1
11
+ });
12
+ const MeshReflectorMaterial = /*#__PURE__*/React.forwardRef(({
13
+ mixBlur = 0.0,
14
+ mixStrength = 0.5,
15
+ resolution = 256,
16
+ blur = [0, 0],
17
+ minDepthThreshold = 0.9,
18
+ maxDepthThreshold = 1,
19
+ depthScale = 0,
20
+ depthToBlurRatioBias = 0.25,
21
+ mirror = 0.5,
22
+ debug = 0,
23
+ distortion = 1,
24
+ distortionMap,
25
+ ...props
26
+ }, ref) => {
27
+ const gl = useThree(({
28
+ gl
29
+ }) => gl);
30
+ const camera = useThree(({
31
+ camera
32
+ }) => camera);
33
+ const scene = useThree(({
34
+ scene
35
+ }) => scene);
36
+ blur = Array.isArray(blur) ? blur : [blur, blur];
37
+ const hasBlur = blur[0] + blur[1] > 0;
38
+ const materialRef = React.useRef(null);
39
+ const [reflectorPlane] = React.useState(() => new Plane());
40
+ const [normal] = React.useState(() => new Vector3());
41
+ const [reflectorWorldPosition] = React.useState(() => new Vector3());
42
+ const [cameraWorldPosition] = React.useState(() => new Vector3());
43
+ const [rotationMatrix] = React.useState(() => new Matrix4());
44
+ const [lookAtPosition] = React.useState(() => new Vector3(0, 0, -1));
45
+ const [clipPlane] = React.useState(() => new Vector4());
46
+ const [view] = React.useState(() => new Vector3());
47
+ const [target] = React.useState(() => new Vector3());
48
+ const [q] = React.useState(() => new Vector4());
49
+ const [textureMatrix] = React.useState(() => new Matrix4());
50
+ const [virtualCamera] = React.useState(() => new PerspectiveCamera());
51
+ const beforeRender = React.useCallback(() => {
52
+ var _materialRef$current;
53
+
54
+ // TODO: As of R3f 7-8 this should be __r3f.parent
55
+ const parent = materialRef.current.parent || ((_materialRef$current = materialRef.current) == null ? void 0 : _materialRef$current.__r3f.parent);
56
+ if (!parent) return;
57
+ reflectorWorldPosition.setFromMatrixPosition(parent.matrixWorld);
58
+ cameraWorldPosition.setFromMatrixPosition(camera.matrixWorld);
59
+ rotationMatrix.extractRotation(parent.matrixWorld);
60
+ normal.set(0, 0, 1);
61
+ normal.applyMatrix4(rotationMatrix);
62
+ view.subVectors(reflectorWorldPosition, cameraWorldPosition); // Avoid rendering when reflector is facing away
63
+
64
+ if (view.dot(normal) > 0) return;
65
+ view.reflect(normal).negate();
66
+ view.add(reflectorWorldPosition);
67
+ rotationMatrix.extractRotation(camera.matrixWorld);
68
+ lookAtPosition.set(0, 0, -1);
69
+ lookAtPosition.applyMatrix4(rotationMatrix);
70
+ lookAtPosition.add(cameraWorldPosition);
71
+ target.subVectors(reflectorWorldPosition, lookAtPosition);
72
+ target.reflect(normal).negate();
73
+ target.add(reflectorWorldPosition);
74
+ virtualCamera.position.copy(view);
75
+ virtualCamera.up.set(0, 1, 0);
76
+ virtualCamera.up.applyMatrix4(rotationMatrix);
77
+ virtualCamera.up.reflect(normal);
78
+ virtualCamera.lookAt(target);
79
+ virtualCamera.far = camera.far; // Used in WebGLBackground
80
+
81
+ virtualCamera.updateMatrixWorld();
82
+ virtualCamera.projectionMatrix.copy(camera.projectionMatrix); // Update the texture matrix
83
+
84
+ textureMatrix.set(0.5, 0.0, 0.0, 0.5, 0.0, 0.5, 0.0, 0.5, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 1.0);
85
+ textureMatrix.multiply(virtualCamera.projectionMatrix);
86
+ textureMatrix.multiply(virtualCamera.matrixWorldInverse);
87
+ textureMatrix.multiply(parent.matrixWorld); // Now update projection matrix with new clip plane, implementing code from: http://www.terathon.com/code/oblique.html
88
+ // Paper explaining this technique: http://www.terathon.com/lengyel/Lengyel-Oblique.pdf
89
+
90
+ reflectorPlane.setFromNormalAndCoplanarPoint(normal, reflectorWorldPosition);
91
+ reflectorPlane.applyMatrix4(virtualCamera.matrixWorldInverse);
92
+ clipPlane.set(reflectorPlane.normal.x, reflectorPlane.normal.y, reflectorPlane.normal.z, reflectorPlane.constant);
93
+ const projectionMatrix = virtualCamera.projectionMatrix;
94
+ q.x = (Math.sign(clipPlane.x) + projectionMatrix.elements[8]) / projectionMatrix.elements[0];
95
+ q.y = (Math.sign(clipPlane.y) + projectionMatrix.elements[9]) / projectionMatrix.elements[5];
96
+ q.z = -1.0;
97
+ q.w = (1.0 + projectionMatrix.elements[10]) / projectionMatrix.elements[14]; // Calculate the scaled plane vector
98
+
99
+ clipPlane.multiplyScalar(2.0 / clipPlane.dot(q)); // Replacing the third row of the projection matrix
100
+
101
+ projectionMatrix.elements[2] = clipPlane.x;
102
+ projectionMatrix.elements[6] = clipPlane.y;
103
+ projectionMatrix.elements[10] = clipPlane.z + 1.0;
104
+ projectionMatrix.elements[14] = clipPlane.w; // eslint-disable-next-line react-hooks/exhaustive-deps
105
+ }, []);
106
+ const [fbo1, fbo2, blurpass, reflectorProps] = React.useMemo(() => {
107
+ const parameters = {
108
+ minFilter: LinearFilter,
109
+ magFilter: LinearFilter,
110
+ format: RGBFormat,
111
+ encoding: gl.outputEncoding
112
+ };
113
+ const fbo1 = new WebGLRenderTarget(resolution, resolution, parameters);
114
+ fbo1.depthBuffer = true;
115
+ fbo1.depthTexture = new DepthTexture(resolution, resolution);
116
+ fbo1.depthTexture.format = DepthFormat;
117
+ fbo1.depthTexture.type = UnsignedShortType;
118
+ const fbo2 = new WebGLRenderTarget(resolution, resolution, parameters);
119
+ const blurpass = new BlurPass({
120
+ gl,
121
+ resolution,
122
+ width: blur[0],
123
+ height: blur[1],
124
+ minDepthThreshold,
125
+ maxDepthThreshold,
126
+ depthScale,
127
+ depthToBlurRatioBias
128
+ });
129
+ const reflectorProps = {
130
+ mirror,
131
+ textureMatrix,
132
+ mixBlur,
133
+ tDiffuse: fbo1.texture,
134
+ tDepth: fbo1.depthTexture,
135
+ tDiffuseBlur: fbo2.texture,
136
+ hasBlur,
137
+ mixStrength,
138
+ minDepthThreshold,
139
+ maxDepthThreshold,
140
+ depthScale,
141
+ depthToBlurRatioBias,
142
+ transparent: true,
143
+ debug,
144
+ distortion,
145
+ distortionMap,
146
+ 'defines-USE_BLUR': hasBlur ? '' : undefined,
147
+ 'defines-USE_DEPTH': depthScale > 0 ? '' : undefined,
148
+ 'defines-USE_DISTORTION': distortionMap ? '' : undefined
149
+ };
150
+ return [fbo1, fbo2, blurpass, reflectorProps];
151
+ }, [gl, blur, textureMatrix, resolution, mirror, hasBlur, mixBlur, mixStrength, minDepthThreshold, maxDepthThreshold, depthScale, depthToBlurRatioBias, debug, distortion, distortionMap]);
152
+ useFrame(() => {
153
+ var _materialRef$current2;
154
+
155
+ // TODO: As of R3f 7-8 this should be __r3f.parent
156
+ const parent = materialRef.current.parent || ((_materialRef$current2 = materialRef.current) == null ? void 0 : _materialRef$current2.__r3f.parent);
157
+ if (!parent) return;
158
+ parent.visible = false;
159
+ const currentXrEnabled = gl.xr.enabled;
160
+ const currentShadowAutoUpdate = gl.shadowMap.autoUpdate;
161
+ beforeRender();
162
+ gl.xr.enabled = false;
163
+ gl.shadowMap.autoUpdate = false;
164
+ gl.setRenderTarget(fbo1);
165
+ gl.state.buffers.depth.setMask(true);
166
+ if (!gl.autoClear) gl.clear();
167
+ gl.render(scene, virtualCamera);
168
+ if (hasBlur) blurpass.render(gl, fbo1, fbo2);
169
+ gl.xr.enabled = currentXrEnabled;
170
+ gl.shadowMap.autoUpdate = currentShadowAutoUpdate;
171
+ parent.visible = true;
172
+ gl.setRenderTarget(null);
173
+ });
174
+ return /*#__PURE__*/React.createElement("meshReflectorMaterialImpl", _extends({
175
+ attach: "material" // Defines can't be updated dynamically, so we need to recreate the material
176
+ ,
177
+ key: 'key' + reflectorProps['defines-USE_BLUR'] + reflectorProps['defines-USE_DEPTH'] + reflectorProps['defines-USE_DISTORTION'],
178
+ ref: mergeRefs([materialRef, ref])
179
+ }, reflectorProps, props));
180
+ });
181
+
182
+ export { MeshReflectorMaterial };
@@ -21,5 +21,5 @@ export declare const MeshWobbleMaterial: React.ForwardRefExoticComponent<Pick<Om
21
21
  } & {
22
22
  speed?: number | undefined;
23
23
  factor?: number | undefined;
24
- }, "visible" | "attach" | "attachArray" | "attachObject" | "args" | "children" | "key" | "onUpdate" | "dispose" | "type" | "id" | "uuid" | "name" | "userData" | "toJSON" | "clone" | "copy" | "addEventListener" | "hasEventListener" | "removeEventListener" | "dispatchEvent" | "color" | "map" | "time" | "transparent" | "fog" | "opacity" | "alphaToCoverage" | "defines" | "wireframe" | "wireframeLinewidth" | "skinning" | "morphTargets" | "morphNormals" | "setValues" | "alphaTest" | "blendDst" | "blendDstAlpha" | "blendEquation" | "blendEquationAlpha" | "blending" | "blendSrc" | "blendSrcAlpha" | "clipIntersection" | "clippingPlanes" | "clipShadows" | "colorWrite" | "depthFunc" | "depthTest" | "depthWrite" | "stencilWrite" | "stencilFunc" | "stencilRef" | "stencilWriteMask" | "stencilFuncMask" | "stencilFail" | "stencilZFail" | "stencilZPass" | "isMaterial" | "needsUpdate" | "polygonOffset" | "polygonOffsetFactor" | "polygonOffsetUnits" | "precision" | "premultipliedAlpha" | "dithering" | "side" | "shadowSide" | "toneMapped" | "vertexColors" | "version" | "onBeforeCompile" | "customProgramCacheKey" | "emissive" | "emissiveIntensity" | "emissiveMap" | "lightMap" | "lightMapIntensity" | "aoMap" | "aoMapIntensity" | "alphaMap" | "envMap" | "refractionRatio" | "wireframeLinecap" | "wireframeLinejoin" | "roughness" | "metalness" | "bumpMap" | "bumpScale" | "normalMap" | "normalMapType" | "normalScale" | "displacementMap" | "displacementScale" | "displacementBias" | "roughnessMap" | "metalnessMap" | "envMapIntensity" | "vertexTangents" | "flatShading" | "isMeshStandardMaterial" | "speed" | "factor"> & React.RefAttributes<unknown>>;
24
+ }, "visible" | "attach" | "attachArray" | "attachObject" | "args" | "children" | "key" | "onUpdate" | "dispose" | "type" | "id" | "uuid" | "name" | "userData" | "toJSON" | "clone" | "copy" | "addEventListener" | "hasEventListener" | "removeEventListener" | "dispatchEvent" | "color" | "map" | "time" | "transparent" | "fog" | "opacity" | "speed" | "precision" | "alphaTest" | "alphaToCoverage" | "blendDst" | "blendDstAlpha" | "blendEquation" | "blendEquationAlpha" | "blending" | "blendSrc" | "blendSrcAlpha" | "clipIntersection" | "clippingPlanes" | "clipShadows" | "colorWrite" | "defines" | "depthFunc" | "depthTest" | "depthWrite" | "stencilWrite" | "stencilFunc" | "stencilRef" | "stencilWriteMask" | "stencilFuncMask" | "stencilFail" | "stencilZFail" | "stencilZPass" | "isMaterial" | "needsUpdate" | "polygonOffset" | "polygonOffsetFactor" | "polygonOffsetUnits" | "premultipliedAlpha" | "dithering" | "side" | "shadowSide" | "toneMapped" | "vertexColors" | "version" | "onBeforeCompile" | "customProgramCacheKey" | "setValues" | "wireframe" | "wireframeLinewidth" | "skinning" | "morphTargets" | "morphNormals" | "emissive" | "emissiveIntensity" | "emissiveMap" | "lightMap" | "lightMapIntensity" | "aoMap" | "aoMapIntensity" | "alphaMap" | "envMap" | "refractionRatio" | "wireframeLinecap" | "wireframeLinejoin" | "roughness" | "metalness" | "bumpMap" | "bumpScale" | "normalMap" | "normalMapType" | "normalScale" | "displacementMap" | "displacementScale" | "displacementBias" | "roughnessMap" | "metalnessMap" | "envMapIntensity" | "vertexTangents" | "flatShading" | "isMeshStandardMaterial" | "factor"> & React.RefAttributes<unknown>>;
25
25
  export {};
@@ -13,4 +13,4 @@ export declare type OrbitControlsProps = ReactThreeFiber.Overwrite<ReactThreeFib
13
13
  onStart?: (e?: THREE.Event) => void;
14
14
  onEnd?: (e?: THREE.Event) => void;
15
15
  }>;
16
- export declare const OrbitControls: React.ForwardRefExoticComponent<Pick<OrbitControlsProps, "object" | "attach" | "attachArray" | "attachObject" | "args" | "children" | "key" | "onUpdate" | "position" | "up" | "scale" | "rotation" | "matrix" | "quaternion" | "layers" | "dispose" | "addEventListener" | "hasEventListener" | "removeEventListener" | "dispatchEvent" | "onChange" | keyof import("@react-three/fiber/dist/declarations/src/core/events").EventHandlers | "camera" | "reset" | "enabled" | "connect" | "target" | "keys" | "makeDefault" | "update" | "domElement" | "minDistance" | "maxDistance" | "minZoom" | "maxZoom" | "minPolarAngle" | "maxPolarAngle" | "minAzimuthAngle" | "maxAzimuthAngle" | "enableDamping" | "dampingFactor" | "enableZoom" | "zoomSpeed" | "enableRotate" | "rotateSpeed" | "enablePan" | "panSpeed" | "screenSpacePanning" | "keyPanSpeed" | "autoRotate" | "autoRotateSpeed" | "mouseButtons" | "touches" | "target0" | "position0" | "zoom0" | "_domElementKeyEvents" | "getPolarAngle" | "getAzimuthalAngle" | "setPolarAngle" | "setAzimuthalAngle" | "getDistance" | "listenToKeyEvents" | "saveState" | "onStart" | "onEnd" | "regress"> & React.RefAttributes<OrbitControlsImpl>>;
16
+ export declare const OrbitControls: React.ForwardRefExoticComponent<Pick<OrbitControlsProps, "object" | "attach" | "attachArray" | "attachObject" | "args" | "children" | "key" | "onUpdate" | "position" | "up" | "scale" | "rotation" | "matrix" | "quaternion" | "layers" | "dispose" | "addEventListener" | "hasEventListener" | "removeEventListener" | "dispatchEvent" | "onChange" | keyof import("@react-three/fiber/dist/declarations/src/core/events").EventHandlers | "camera" | "reset" | "enabled" | "update" | "onStart" | "keys" | "target" | "touches" | "connect" | "makeDefault" | "domElement" | "minDistance" | "maxDistance" | "minZoom" | "maxZoom" | "minPolarAngle" | "maxPolarAngle" | "minAzimuthAngle" | "maxAzimuthAngle" | "enableDamping" | "dampingFactor" | "enableZoom" | "zoomSpeed" | "enableRotate" | "rotateSpeed" | "enablePan" | "panSpeed" | "screenSpacePanning" | "keyPanSpeed" | "autoRotate" | "autoRotateSpeed" | "mouseButtons" | "target0" | "position0" | "zoom0" | "_domElementKeyEvents" | "getPolarAngle" | "getAzimuthalAngle" | "setPolarAngle" | "setAzimuthalAngle" | "getDistance" | "listenToKeyEvents" | "saveState" | "onEnd" | "regress"> & React.RefAttributes<OrbitControlsImpl>>;