@react-three/drei 7.26.1 → 7.27.3

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
@@ -68,6 +68,7 @@ The `native` route of the library **does not** export `Html` or `Loader`. The de
68
68
  </ul>
69
69
  <li><a href="#shaders">Shaders</a></li>
70
70
  <ul>
71
+ <li><a href="#meshreflectormaterial">MeshReflectorMaterial</a></li>
71
72
  <li><a href="#meshwobblematerial">MeshWobbleMaterial</a></li>
72
73
  <li><a href="#meshdistortmaterial">MeshDistortMaterial</a></li>
73
74
  <li><a href="#pointmaterial">PointMaterial</a></li>
@@ -159,10 +160,9 @@ The `native` route of the library **does not** export `Html` or `Loader`. The de
159
160
  <li><a href="#stage">Stage</a></li>
160
161
  <li><a href="#backdrop">Backdrop</a></li>
161
162
  <li><a href="#environment">Environment</a></li>
162
- <li><a href="#reflector">SpotLight</a></li>
163
+ <li><a href="#spotlight">SpotLight</a></li>
163
164
  <li><a href="#shadow">Shadow</a></li>
164
165
  <li><a href="#contactshadows">ContactShadows</a></li>
165
- <li><a href="#reflector">Reflector</a></li>
166
166
  <li><a href="#sky">Sky</a></li>
167
167
  <li><a href="#stars">Stars</a></li>
168
168
  <li><a href="#cloud">Cloud</a></li>
@@ -182,12 +182,25 @@ The `native` route of the library **does not** export `Html` or `Loader`. The de
182
182
 
183
183
  A responsive [THREE.PerspectiveCamera](https://threejs.org/docs/index.html#api/en/cameras/PerspectiveCamera) that can set itself as the default.
184
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
+
185
192
  ```jsx
186
193
  <PerspectiveCamera makeDefault {...props}>
187
194
  <mesh />
188
195
  </PerspectiveCamera>
189
196
  ```
190
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
+
191
204
  #### OrthographicCamera
192
205
 
193
206
  [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.vercel.app/?path=/story/camera-orthographiccamera--orthographic-camera-scene-st)
@@ -331,7 +344,7 @@ function Foo() {
331
344
 
332
345
  ![](https://img.shields.io/badge/-Dom only-red)
333
346
 
334
- Smooth, springy semi-OrbitControls for presentational purposes. These controls do not turn the camera but will spin their contents.
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.
335
348
 
336
349
  ```jsx
337
350
  <PresentationControls
@@ -592,6 +605,39 @@ return <primitive object={scene} />
592
605
 
593
606
  # Shaders
594
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={0} // How much blur mixes with surface roughness (default = 1)
620
+ mixStrength={1} // Strength of the reflections
621
+ mixContrast={1} // Contrast of the reflections
622
+ resolution={256} // Off-buffer resolution, lower=faster, higher=better quality, slower
623
+ mirror={0} // Mirror environment, 0 = texture colors, 1 = pick up env colors
624
+ depthScale={0} // Scale the depth factor (0 = no depth, default = 0)
625
+ minDepthThreshold={0.9} // Lower edge for the depthTexture interpolation (default = 0)
626
+ maxDepthThreshold={1} // Upper edge for the depthTexture interpolation (default = 0)
627
+ 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
628
+ distortion={1} // Amount of distortion based on the distortionMap texture
629
+ distortionMap={distortionTexture} // The red channel of this texture is used as the distortion map. Default is null
630
+ debug={0} /* Depending on the assigned value, one of the following channels is shown:
631
+ 0 = no debug
632
+ 1 = depth channel
633
+ 2 = base channel
634
+ 3 = distortion channel
635
+ 4 = lod channel (based on the roughness)
636
+ */
637
+ >
638
+ </mesh>
639
+ ```
640
+
595
641
  #### MeshWobbleMaterial
596
642
 
597
643
  [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.vercel.app/?path=/story/shaders-meshwobblematerial--mesh-wobble-material-st)
@@ -1506,38 +1552,6 @@ function Foo() {
1506
1552
  return <SpotLight depthBuffer={depthBuffer} />
1507
1553
  ```
1508
1554
 
1509
- #### Reflector
1510
-
1511
- [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.vercel.app/?path=/story/misc-reflector--reflector-st)
1512
-
1513
- 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.
1514
-
1515
- ```jsx
1516
- <Reflector
1517
- args={[1, 1]} // PlaneBufferGeometry arguments
1518
- blur={[0, 0]} // Blur ground reflections (width, heigt), 0 skips blur
1519
- mixBlur={1.0} // How much blur mixes with surface roughness (default = 0), note that this can affect performance
1520
- mixStrength={0.5} // Strength of the reflections
1521
- resolution={256} // Off-buffer resolution, lower=faster, higher=better quality
1522
- mirror={0.5} // Mirror environment, 0 = texture colors, 1 = pick up env colors
1523
- depthScale={1} // Scale the depth factor (0 = no depth, default = 0)
1524
- minDepthThreshold={0.9} // Lower edge for the depthTexture interpolation (default = 0)
1525
- maxDepthThreshold={1} // Upper edge for the depthTexture interpolation (default = 0)
1526
- 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
1527
- distortion={0} // Amount of distortion based on the distortionMap texture
1528
- distortionMap={distortionTexture} // The red channel of this texture is used as the distortion map. Default is null
1529
- debug={0} /* Depending on the assigned value, one of the following channels is shown:
1530
- 0 = no debug
1531
- 1 = depth channel
1532
- 2 = base channel
1533
- 3 = distortion channel
1534
- 4 = lod channel (based on the roughness)
1535
- */
1536
- >
1537
- {(Material, props) => <Material {...props}>}
1538
- </Reflector>
1539
- ```
1540
-
1541
1555
  #### Environment
1542
1556
 
1543
1557
  [![](https://img.shields.io/badge/-storybook-%23ff69b4)](https://drei.pmnd.rs/?path=/story/abstractions-environment--environment-st)
@@ -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=1,resolution:n=256,blur:o=[0,0],minDepthThreshold:s=.9,maxDepthThreshold:l=1,depthScale:p=0,depthToBlurRatioBias:m=.25,mirror:h=0,debug:f=0,distortion:x=1,mixContrast:M=1,distortionMap:T,...S},b)=>{const y=a.useThree((({gl:e})=>e)),w=a.useThree((({camera:e})=>e)),g=a.useThree((({scene:e})=>e)),R=(o=Array.isArray(o)?o:[o,o])[0]+o[1]>0,v=d.useRef(null),[j]=d.useState((()=>new r.Plane)),[B]=d.useState((()=>new r.Vector3)),[D]=d.useState((()=>new r.Vector3)),[_]=d.useState((()=>new r.Vector3)),[P]=d.useState((()=>new r.Matrix4)),[U]=d.useState((()=>new r.Vector3(0,0,-1))),[E]=d.useState((()=>new r.Vector4)),[O]=d.useState((()=>new r.Vector3)),[F]=d.useState((()=>new r.Vector3)),[V]=d.useState((()=>new r.Vector4)),[W]=d.useState((()=>new r.Matrix4)),[q]=d.useState((()=>new r.PerspectiveCamera)),I=d.useCallback((()=>{var e;const t=v.current.parent||(null==(e=v.current)?void 0:e.__r3f.parent);if(!t)return;if(D.setFromMatrixPosition(t.matrixWorld),_.setFromMatrixPosition(w.matrixWorld),P.extractRotation(t.matrixWorld),B.set(0,0,1),B.applyMatrix4(P),O.subVectors(D,_),O.dot(B)>0)return;O.reflect(B).negate(),O.add(D),P.extractRotation(w.matrixWorld),U.set(0,0,-1),U.applyMatrix4(P),U.add(_),F.subVectors(D,U),F.reflect(B).negate(),F.add(D),q.position.copy(O),q.up.set(0,1,0),q.up.applyMatrix4(P),q.up.reflect(B),q.lookAt(F),q.far=w.far,q.updateMatrixWorld(),q.projectionMatrix.copy(w.projectionMatrix),W.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),W.multiply(q.projectionMatrix),W.multiply(q.matrixWorldInverse),W.multiply(t.matrixWorld),j.setFromNormalAndCoplanarPoint(B,D),j.applyMatrix4(q.matrixWorldInverse),E.set(j.normal.x,j.normal.y,j.normal.z,j.constant);const r=q.projectionMatrix;V.x=(Math.sign(E.x)+r.elements[8])/r.elements[0],V.y=(Math.sign(E.y)+r.elements[9])/r.elements[5],V.z=-1,V.w=(1+r.elements[10])/r.elements[14],E.multiplyScalar(2/E.dot(V)),r.elements[2]=E.x,r.elements[6]=E.y,r.elements[10]=E.z+1,r.elements[14]=E.w}),[]),[C,k,L,z]=d.useMemo((()=>{const a={minFilter:r.LinearFilter,magFilter:r.LinearFilter,format:r.RGBFormat,encoding:y.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:y,resolution:n,width:o[0],height:o[1],minDepthThreshold:s,maxDepthThreshold:l,depthScale:p,depthToBlurRatioBias:m}),{mirror:h,textureMatrix:W,mixBlur:e,tDiffuse:u.texture,tDepth:u.depthTexture,tDiffuseBlur:d.texture,hasBlur:R,mixStrength:t,minDepthThreshold:s,maxDepthThreshold:l,depthScale:p,depthToBlurRatioBias:m,transparent:!0,debug:f,distortion:x,distortionMap:T,mixContrast:M,"defines-USE_BLUR":R?"":void 0,"defines-USE_DEPTH":p>0?"":void 0,"defines-USE_DISTORTION":T?"":void 0}]}),[y,o,W,n,h,R,e,t,s,l,p,m,f,x,T,M]);return a.useFrame((()=>{var e;const t=v.current.parent||(null==(e=v.current)?void 0:e.__r3f.parent);if(!t)return;t.visible=!1;const r=y.xr.enabled,a=y.shadowMap.autoUpdate;I(),y.xr.enabled=!1,y.shadowMap.autoUpdate=!1,y.setRenderTarget(C),y.state.buffers.depth.setMask(!0),y.autoClear||y.clear(),y.render(g,q),R&&L.render(y,C,k),y.xr.enabled=r,y.shadowMap.autoUpdate=a,t.visible=!0,y.setRenderTarget(null)})),d.createElement("meshReflectorMaterialImpl",u.default({attach:"material",key:"key"+z["defines-USE_BLUR"]+z["defines-USE_DEPTH"]+z["defines-USE_DISTORTION"],ref:c.default([v,b])},z,S))}));exports.MeshReflectorMaterial=p;
@@ -0,0 +1,26 @@
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
+ mixContrast?: number;
18
+ };
19
+ declare global {
20
+ namespace JSX {
21
+ interface IntrinsicElements {
22
+ meshReflectorMaterialImpl: MeshReflectorMaterialProps;
23
+ }
24
+ }
25
+ }
26
+ 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" | "mixContrast" | "distortionMap"> & React.RefAttributes<MeshReflectorMaterialImpl>>;
@@ -0,0 +1,184 @@
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,
14
+ mixStrength = 1,
15
+ resolution = 256,
16
+ blur = [0, 0],
17
+ minDepthThreshold = 0.9,
18
+ maxDepthThreshold = 1,
19
+ depthScale = 0,
20
+ depthToBlurRatioBias = 0.25,
21
+ mirror = 0,
22
+ debug = 0,
23
+ distortion = 1,
24
+ mixContrast = 1,
25
+ distortionMap,
26
+ ...props
27
+ }, ref) => {
28
+ const gl = useThree(({
29
+ gl
30
+ }) => gl);
31
+ const camera = useThree(({
32
+ camera
33
+ }) => camera);
34
+ const scene = useThree(({
35
+ scene
36
+ }) => scene);
37
+ blur = Array.isArray(blur) ? blur : [blur, blur];
38
+ const hasBlur = blur[0] + blur[1] > 0;
39
+ const materialRef = React.useRef(null);
40
+ const [reflectorPlane] = React.useState(() => new Plane());
41
+ const [normal] = React.useState(() => new Vector3());
42
+ const [reflectorWorldPosition] = React.useState(() => new Vector3());
43
+ const [cameraWorldPosition] = React.useState(() => new Vector3());
44
+ const [rotationMatrix] = React.useState(() => new Matrix4());
45
+ const [lookAtPosition] = React.useState(() => new Vector3(0, 0, -1));
46
+ const [clipPlane] = React.useState(() => new Vector4());
47
+ const [view] = React.useState(() => new Vector3());
48
+ const [target] = React.useState(() => new Vector3());
49
+ const [q] = React.useState(() => new Vector4());
50
+ const [textureMatrix] = React.useState(() => new Matrix4());
51
+ const [virtualCamera] = React.useState(() => new PerspectiveCamera());
52
+ const beforeRender = React.useCallback(() => {
53
+ var _materialRef$current;
54
+
55
+ // TODO: As of R3f 7-8 this should be __r3f.parent
56
+ const parent = materialRef.current.parent || ((_materialRef$current = materialRef.current) == null ? void 0 : _materialRef$current.__r3f.parent);
57
+ if (!parent) return;
58
+ reflectorWorldPosition.setFromMatrixPosition(parent.matrixWorld);
59
+ cameraWorldPosition.setFromMatrixPosition(camera.matrixWorld);
60
+ rotationMatrix.extractRotation(parent.matrixWorld);
61
+ normal.set(0, 0, 1);
62
+ normal.applyMatrix4(rotationMatrix);
63
+ view.subVectors(reflectorWorldPosition, cameraWorldPosition); // Avoid rendering when reflector is facing away
64
+
65
+ if (view.dot(normal) > 0) return;
66
+ view.reflect(normal).negate();
67
+ view.add(reflectorWorldPosition);
68
+ rotationMatrix.extractRotation(camera.matrixWorld);
69
+ lookAtPosition.set(0, 0, -1);
70
+ lookAtPosition.applyMatrix4(rotationMatrix);
71
+ lookAtPosition.add(cameraWorldPosition);
72
+ target.subVectors(reflectorWorldPosition, lookAtPosition);
73
+ target.reflect(normal).negate();
74
+ target.add(reflectorWorldPosition);
75
+ virtualCamera.position.copy(view);
76
+ virtualCamera.up.set(0, 1, 0);
77
+ virtualCamera.up.applyMatrix4(rotationMatrix);
78
+ virtualCamera.up.reflect(normal);
79
+ virtualCamera.lookAt(target);
80
+ virtualCamera.far = camera.far; // Used in WebGLBackground
81
+
82
+ virtualCamera.updateMatrixWorld();
83
+ virtualCamera.projectionMatrix.copy(camera.projectionMatrix); // Update the texture matrix
84
+
85
+ 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);
86
+ textureMatrix.multiply(virtualCamera.projectionMatrix);
87
+ textureMatrix.multiply(virtualCamera.matrixWorldInverse);
88
+ textureMatrix.multiply(parent.matrixWorld); // Now update projection matrix with new clip plane, implementing code from: http://www.terathon.com/code/oblique.html
89
+ // Paper explaining this technique: http://www.terathon.com/lengyel/Lengyel-Oblique.pdf
90
+
91
+ reflectorPlane.setFromNormalAndCoplanarPoint(normal, reflectorWorldPosition);
92
+ reflectorPlane.applyMatrix4(virtualCamera.matrixWorldInverse);
93
+ clipPlane.set(reflectorPlane.normal.x, reflectorPlane.normal.y, reflectorPlane.normal.z, reflectorPlane.constant);
94
+ const projectionMatrix = virtualCamera.projectionMatrix;
95
+ q.x = (Math.sign(clipPlane.x) + projectionMatrix.elements[8]) / projectionMatrix.elements[0];
96
+ q.y = (Math.sign(clipPlane.y) + projectionMatrix.elements[9]) / projectionMatrix.elements[5];
97
+ q.z = -1.0;
98
+ q.w = (1.0 + projectionMatrix.elements[10]) / projectionMatrix.elements[14]; // Calculate the scaled plane vector
99
+
100
+ clipPlane.multiplyScalar(2.0 / clipPlane.dot(q)); // Replacing the third row of the projection matrix
101
+
102
+ projectionMatrix.elements[2] = clipPlane.x;
103
+ projectionMatrix.elements[6] = clipPlane.y;
104
+ projectionMatrix.elements[10] = clipPlane.z + 1.0;
105
+ projectionMatrix.elements[14] = clipPlane.w; // eslint-disable-next-line react-hooks/exhaustive-deps
106
+ }, []);
107
+ const [fbo1, fbo2, blurpass, reflectorProps] = React.useMemo(() => {
108
+ const parameters = {
109
+ minFilter: LinearFilter,
110
+ magFilter: LinearFilter,
111
+ format: RGBFormat,
112
+ encoding: gl.outputEncoding
113
+ };
114
+ const fbo1 = new WebGLRenderTarget(resolution, resolution, parameters);
115
+ fbo1.depthBuffer = true;
116
+ fbo1.depthTexture = new DepthTexture(resolution, resolution);
117
+ fbo1.depthTexture.format = DepthFormat;
118
+ fbo1.depthTexture.type = UnsignedShortType;
119
+ const fbo2 = new WebGLRenderTarget(resolution, resolution, parameters);
120
+ const blurpass = new BlurPass({
121
+ gl,
122
+ resolution,
123
+ width: blur[0],
124
+ height: blur[1],
125
+ minDepthThreshold,
126
+ maxDepthThreshold,
127
+ depthScale,
128
+ depthToBlurRatioBias
129
+ });
130
+ const reflectorProps = {
131
+ mirror,
132
+ textureMatrix,
133
+ mixBlur,
134
+ tDiffuse: fbo1.texture,
135
+ tDepth: fbo1.depthTexture,
136
+ tDiffuseBlur: fbo2.texture,
137
+ hasBlur,
138
+ mixStrength,
139
+ minDepthThreshold,
140
+ maxDepthThreshold,
141
+ depthScale,
142
+ depthToBlurRatioBias,
143
+ transparent: true,
144
+ debug,
145
+ distortion,
146
+ distortionMap,
147
+ mixContrast,
148
+ 'defines-USE_BLUR': hasBlur ? '' : undefined,
149
+ 'defines-USE_DEPTH': depthScale > 0 ? '' : undefined,
150
+ 'defines-USE_DISTORTION': distortionMap ? '' : undefined
151
+ };
152
+ return [fbo1, fbo2, blurpass, reflectorProps];
153
+ }, [gl, blur, textureMatrix, resolution, mirror, hasBlur, mixBlur, mixStrength, minDepthThreshold, maxDepthThreshold, depthScale, depthToBlurRatioBias, debug, distortion, distortionMap, mixContrast]);
154
+ useFrame(() => {
155
+ var _materialRef$current2;
156
+
157
+ // TODO: As of R3f 7-8 this should be __r3f.parent
158
+ const parent = materialRef.current.parent || ((_materialRef$current2 = materialRef.current) == null ? void 0 : _materialRef$current2.__r3f.parent);
159
+ if (!parent) return;
160
+ parent.visible = false;
161
+ const currentXrEnabled = gl.xr.enabled;
162
+ const currentShadowAutoUpdate = gl.shadowMap.autoUpdate;
163
+ beforeRender();
164
+ gl.xr.enabled = false;
165
+ gl.shadowMap.autoUpdate = false;
166
+ gl.setRenderTarget(fbo1);
167
+ gl.state.buffers.depth.setMask(true);
168
+ if (!gl.autoClear) gl.clear();
169
+ gl.render(scene, virtualCamera);
170
+ if (hasBlur) blurpass.render(gl, fbo1, fbo2);
171
+ gl.xr.enabled = currentXrEnabled;
172
+ gl.shadowMap.autoUpdate = currentShadowAutoUpdate;
173
+ parent.visible = true;
174
+ gl.setRenderTarget(null);
175
+ });
176
+ return /*#__PURE__*/React.createElement("meshReflectorMaterialImpl", _extends({
177
+ attach: "material" // Defines can't be updated dynamically, so we need to recreate the material
178
+ ,
179
+ key: 'key' + reflectorProps['defines-USE_BLUR'] + reflectorProps['defines-USE_DEPTH'] + reflectorProps['defines-USE_DISTORTION'],
180
+ ref: mergeRefs([materialRef, ref])
181
+ }, reflectorProps, props));
182
+ });
183
+
184
+ export { MeshReflectorMaterial };
@@ -1 +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"),o=require("../materials/BlurPass.cjs.js"),i=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({MeshReflectorMaterial:i.MeshReflectorMaterial});const p=d.forwardRef((({mixBlur:e=0,mixStrength:t=.5,resolution:n=256,blur:i=[0,0],args:s=[1,1],minDepthThreshold:l=.9,maxDepthThreshold:p=1,depthScale:m=0,depthToBlurRatioBias:h=.25,mirror:f,children:x,debug:M=0,distortion:b=1,distortionMap:g,...T},w)=>{const y=a.useThree((({gl:e})=>e)),S=a.useThree((({camera:e})=>e)),R=a.useThree((({scene:e})=>e)),j=(i=Array.isArray(i)?i:[i,i])[0]+i[1]>0,B=d.useRef(null),[v]=d.useState((()=>new r.Plane)),[D]=d.useState((()=>new r.Vector3)),[P]=d.useState((()=>new r.Vector3)),[F]=d.useState((()=>new r.Vector3)),[V]=d.useState((()=>new r.Matrix4)),[W]=d.useState((()=>new r.Vector3(0,0,-1))),[E]=d.useState((()=>new r.Vector4)),[O]=d.useState((()=>new r.Vector3)),[q]=d.useState((()=>new r.Vector3)),[U]=d.useState((()=>new r.Vector4)),[_]=d.useState((()=>new r.Matrix4)),[C]=d.useState((()=>new r.PerspectiveCamera)),L=d.useCallback((()=>{if(P.setFromMatrixPosition(B.current.matrixWorld),F.setFromMatrixPosition(S.matrixWorld),V.extractRotation(B.current.matrixWorld),D.set(0,0,1),D.applyMatrix4(V),O.subVectors(P,F),O.dot(D)>0)return;O.reflect(D).negate(),O.add(P),V.extractRotation(S.matrixWorld),W.set(0,0,-1),W.applyMatrix4(V),W.add(F),q.subVectors(P,W),q.reflect(D).negate(),q.add(P),C.position.copy(O),C.up.set(0,1,0),C.up.applyMatrix4(V),C.up.reflect(D),C.lookAt(q),C.far=S.far,C.updateMatrixWorld(),C.projectionMatrix.copy(S.projectionMatrix),_.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),_.multiply(C.projectionMatrix),_.multiply(C.matrixWorldInverse),_.multiply(B.current.matrixWorld),v.setFromNormalAndCoplanarPoint(D,P),v.applyMatrix4(C.matrixWorldInverse),E.set(v.normal.x,v.normal.y,v.normal.z,v.constant);const e=C.projectionMatrix;U.x=(Math.sign(E.x)+e.elements[8])/e.elements[0],U.y=(Math.sign(E.y)+e.elements[9])/e.elements[5],U.z=-1,U.w=(1+e.elements[10])/e.elements[14],E.multiplyScalar(2/E.dot(U)),e.elements[2]=E.x,e.elements[6]=E.y,e.elements[10]=E.z+1,e.elements[14]=E.w}),[]),[k,z,A,G]=d.useMemo((()=>{const a={minFilter:r.LinearFilter,magFilter:r.LinearFilter,format:r.RGBFormat,encoding:y.outputEncoding},s=new r.WebGLRenderTarget(n,n,a);s.depthBuffer=!0,s.depthTexture=new r.DepthTexture(n,n),s.depthTexture.format=r.DepthFormat,s.depthTexture.type=r.UnsignedShortType;const u=new r.WebGLRenderTarget(n,n,a);return[s,u,new o.BlurPass({gl:y,resolution:n,width:i[0],height:i[1],minDepthThreshold:l,maxDepthThreshold:p,depthScale:m,depthToBlurRatioBias:h}),{mirror:f,textureMatrix:_,mixBlur:e,tDiffuse:s.texture,tDepth:s.depthTexture,tDiffuseBlur:u.texture,hasBlur:j,mixStrength:t,minDepthThreshold:l,maxDepthThreshold:p,depthScale:m,depthToBlurRatioBias:h,transparent:!0,debug:M,distortion:b,distortionMap:g,"defines-USE_BLUR":j?"":void 0,"defines-USE_DEPTH":m>0?"":void 0,"defines-USE_DISTORTION":g?"":void 0}]}),[y,i,_,n,f,j,e,t,l,p,m,h,M,b,g]);return a.useFrame((()=>{if(null==B||!B.current)return;B.current.visible=!1;const e=y.xr.enabled,t=y.shadowMap.autoUpdate;L(),y.xr.enabled=!1,y.shadowMap.autoUpdate=!1,y.setRenderTarget(k),y.state.buffers.depth.setMask(!0),y.autoClear||y.clear(),y.render(R,C),j&&A.render(y,k,z),y.xr.enabled=e,y.shadowMap.autoUpdate=t,B.current.visible=!0,y.setRenderTarget(null)})),d.createElement("mesh",u.default({ref:c.default([B,w])},T),d.createElement("planeBufferGeometry",{args:s}),x?x("meshReflectorMaterial",G):d.createElement("meshReflectorMaterial",G))}));exports.Reflector=p;
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"),o=require("../materials/BlurPass.cjs.js"),i=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({MeshReflectorMaterial:i.MeshReflectorMaterial});const p=d.forwardRef((({mixBlur:e=0,mixStrength:t=.5,resolution:n=256,blur:i=[0,0],args:s=[1,1],minDepthThreshold:l=.9,maxDepthThreshold:p=1,depthScale:m=0,depthToBlurRatioBias:h=.25,mirror:f=0,children:x,debug:M=0,distortion:b=1,mixContrast:w=1,distortionMap:g,...T},y)=>{d.useEffect((()=>{console.warn("Reflector has been deprecated and will be removed next major. Replace it with <MeshReflectorMaterial />!")}),[]);const R=a.useThree((({gl:e})=>e)),S=a.useThree((({camera:e})=>e)),j=a.useThree((({scene:e})=>e)),B=(i=Array.isArray(i)?i:[i,i])[0]+i[1]>0,v=d.useRef(null),[D]=d.useState((()=>new r.Plane)),[P]=d.useState((()=>new r.Vector3)),[E]=d.useState((()=>new r.Vector3)),[F]=d.useState((()=>new r.Vector3)),[V]=d.useState((()=>new r.Matrix4)),[W]=d.useState((()=>new r.Vector3(0,0,-1))),[O]=d.useState((()=>new r.Vector4)),[q]=d.useState((()=>new r.Vector3)),[U]=d.useState((()=>new r.Vector3)),[C]=d.useState((()=>new r.Vector4)),[_]=d.useState((()=>new r.Matrix4)),[L]=d.useState((()=>new r.PerspectiveCamera)),k=d.useCallback((()=>{if(E.setFromMatrixPosition(v.current.matrixWorld),F.setFromMatrixPosition(S.matrixWorld),V.extractRotation(v.current.matrixWorld),P.set(0,0,1),P.applyMatrix4(V),q.subVectors(E,F),q.dot(P)>0)return;q.reflect(P).negate(),q.add(E),V.extractRotation(S.matrixWorld),W.set(0,0,-1),W.applyMatrix4(V),W.add(F),U.subVectors(E,W),U.reflect(P).negate(),U.add(E),L.position.copy(q),L.up.set(0,1,0),L.up.applyMatrix4(V),L.up.reflect(P),L.lookAt(U),L.far=S.far,L.updateMatrixWorld(),L.projectionMatrix.copy(S.projectionMatrix),_.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),_.multiply(L.projectionMatrix),_.multiply(L.matrixWorldInverse),_.multiply(v.current.matrixWorld),D.setFromNormalAndCoplanarPoint(P,E),D.applyMatrix4(L.matrixWorldInverse),O.set(D.normal.x,D.normal.y,D.normal.z,D.constant);const e=L.projectionMatrix;C.x=(Math.sign(O.x)+e.elements[8])/e.elements[0],C.y=(Math.sign(O.y)+e.elements[9])/e.elements[5],C.z=-1,C.w=(1+e.elements[10])/e.elements[14],O.multiplyScalar(2/O.dot(C)),e.elements[2]=O.x,e.elements[6]=O.y,e.elements[10]=O.z+1,e.elements[14]=O.w}),[]),[z,A,G,I]=d.useMemo((()=>{const a={minFilter:r.LinearFilter,magFilter:r.LinearFilter,format:r.RGBFormat,encoding:R.outputEncoding},s=new r.WebGLRenderTarget(n,n,a);s.depthBuffer=!0,s.depthTexture=new r.DepthTexture(n,n),s.depthTexture.format=r.DepthFormat,s.depthTexture.type=r.UnsignedShortType;const u=new r.WebGLRenderTarget(n,n,a);return[s,u,new o.BlurPass({gl:R,resolution:n,width:i[0],height:i[1],minDepthThreshold:l,maxDepthThreshold:p,depthScale:m,depthToBlurRatioBias:h}),{mirror:f,textureMatrix:_,mixBlur:e,tDiffuse:s.texture,tDepth:s.depthTexture,tDiffuseBlur:u.texture,hasBlur:B,mixStrength:t,minDepthThreshold:l,maxDepthThreshold:p,depthScale:m,depthToBlurRatioBias:h,transparent:!0,debug:M,distortion:b,distortionMap:g,mixContrast:w,"defines-USE_BLUR":B?"":void 0,"defines-USE_DEPTH":m>0?"":void 0,"defines-USE_DISTORTION":g?"":void 0}]}),[R,i,_,n,f,B,e,t,l,p,m,h,M,b,g,w]);return a.useFrame((()=>{if(null==v||!v.current)return;v.current.visible=!1;const e=R.xr.enabled,t=R.shadowMap.autoUpdate;k(),R.xr.enabled=!1,R.shadowMap.autoUpdate=!1,R.setRenderTarget(z),R.state.buffers.depth.setMask(!0),R.autoClear||R.clear(),R.render(j,L),B&&G.render(R,z,A),R.xr.enabled=e,R.shadowMap.autoUpdate=t,v.current.visible=!0,R.setRenderTarget(null)})),d.createElement("mesh",u.default({ref:c.default([v,y])},T),d.createElement("planeBufferGeometry",{args:s}),x?x("meshReflectorMaterial",I):d.createElement("meshReflectorMaterial",I))}));exports.Reflector=p;
@@ -1,7 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { Mesh, Texture } from 'three';
3
- import { MeshReflectorMaterialImpl } from '../materials/MeshReflectorMaterial';
4
- export declare type ReflectorChildProps = MeshReflectorMaterialImpl;
3
+ import { MeshReflectorMaterialProps } from '../materials/MeshReflectorMaterial';
5
4
  export declare type ReflectorProps = Omit<JSX.IntrinsicElements['mesh'], 'args' | 'children'> & Pick<JSX.IntrinsicElements['planeBufferGeometry'], 'args'> & {
6
5
  resolution?: number;
7
6
  mixBlur?: number;
@@ -15,15 +14,16 @@ export declare type ReflectorProps = Omit<JSX.IntrinsicElements['mesh'], 'args'
15
14
  debug?: number;
16
15
  distortionMap?: Texture;
17
16
  distortion?: number;
17
+ mixContrast?: number;
18
18
  children?: {
19
- (Component: React.ElementType<JSX.IntrinsicElements['meshReflectorMaterial']>, ComponentProps: ReflectorChildProps): JSX.Element | null;
19
+ (Component: React.ElementType<JSX.IntrinsicElements['meshReflectorMaterial']>, ComponentProps: MeshReflectorMaterialProps): JSX.Element | null;
20
20
  };
21
21
  };
22
22
  declare global {
23
23
  namespace JSX {
24
24
  interface IntrinsicElements {
25
- meshReflectorMaterial: MeshReflectorMaterialImpl;
25
+ meshReflectorMaterial: MeshReflectorMaterialProps;
26
26
  }
27
27
  }
28
28
  }
29
- export declare const Reflector: React.ForwardRefExoticComponent<Pick<ReflectorProps, "visible" | "attach" | "attachArray" | "attachObject" | "args" | "children" | "key" | "onUpdate" | "position" | "up" | "scale" | "rotation" | "matrix" | "quaternion" | "layers" | "dispose" | "type" | "id" | "uuid" | "name" | "parent" | "modelViewMatrix" | "normalMatrix" | "matrixWorld" | "matrixAutoUpdate" | "matrixWorldNeedsUpdate" | "castShadow" | "receiveShadow" | "frustumCulled" | "renderOrder" | "animations" | "userData" | "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" | keyof import("@react-three/fiber/dist/declarations/src/core/events").EventHandlers | "material" | "blur" | "geometry" | "morphTargetInfluences" | "morphTargetDictionary" | "isMesh" | "updateMorphTargets" | "resolution" | "minDepthThreshold" | "maxDepthThreshold" | "depthScale" | "depthToBlurRatioBias" | "mixBlur" | "mixStrength" | "mirror" | "distortionMap" | "distortion" | "debug"> & React.RefAttributes<Mesh<import("three").BufferGeometry, import("three").Material | import("three").Material[]>>>;
29
+ export declare const Reflector: React.ForwardRefExoticComponent<Pick<ReflectorProps, "visible" | "attach" | "attachArray" | "attachObject" | "args" | "children" | "key" | "onUpdate" | "position" | "up" | "scale" | "rotation" | "matrix" | "quaternion" | "layers" | "dispose" | "type" | "id" | "uuid" | "name" | "parent" | "modelViewMatrix" | "normalMatrix" | "matrixWorld" | "matrixAutoUpdate" | "matrixWorldNeedsUpdate" | "castShadow" | "receiveShadow" | "frustumCulled" | "renderOrder" | "animations" | "userData" | "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" | keyof import("@react-three/fiber/dist/declarations/src/core/events").EventHandlers | "material" | "blur" | "geometry" | "morphTargetInfluences" | "morphTargetDictionary" | "isMesh" | "updateMorphTargets" | "resolution" | "minDepthThreshold" | "maxDepthThreshold" | "depthScale" | "depthToBlurRatioBias" | "mixBlur" | "mixStrength" | "mirror" | "debug" | "distortion" | "mixContrast" | "distortionMap"> & React.RefAttributes<Mesh<import("three").BufferGeometry, import("three").Material | import("three").Material[]>>>;
package/core/Reflector.js CHANGED
@@ -10,7 +10,7 @@ extend({
10
10
  MeshReflectorMaterial
11
11
  });
12
12
  const Reflector = /*#__PURE__*/React.forwardRef(({
13
- mixBlur = 0.0,
13
+ mixBlur = 0,
14
14
  mixStrength = 0.5,
15
15
  resolution = 256,
16
16
  blur = [0, 0],
@@ -19,13 +19,17 @@ const Reflector = /*#__PURE__*/React.forwardRef(({
19
19
  maxDepthThreshold = 1,
20
20
  depthScale = 0,
21
21
  depthToBlurRatioBias = 0.25,
22
- mirror,
22
+ mirror = 0,
23
23
  children,
24
24
  debug = 0,
25
25
  distortion = 1,
26
+ mixContrast = 1,
26
27
  distortionMap,
27
28
  ...props
28
29
  }, ref) => {
30
+ React.useEffect(() => {
31
+ console.warn('Reflector has been deprecated and will be removed next major. Replace it with <MeshReflectorMaterial />!');
32
+ }, []);
29
33
  const gl = useThree(({
30
34
  gl
31
35
  }) => gl);
@@ -140,12 +144,13 @@ const Reflector = /*#__PURE__*/React.forwardRef(({
140
144
  debug,
141
145
  distortion,
142
146
  distortionMap,
147
+ mixContrast,
143
148
  'defines-USE_BLUR': hasBlur ? '' : undefined,
144
149
  'defines-USE_DEPTH': depthScale > 0 ? '' : undefined,
145
150
  'defines-USE_DISTORTION': distortionMap ? '' : undefined
146
151
  };
147
152
  return [fbo1, fbo2, blurpass, reflectorProps];
148
- }, [gl, blur, textureMatrix, resolution, mirror, hasBlur, mixBlur, mixStrength, minDepthThreshold, maxDepthThreshold, depthScale, depthToBlurRatioBias, debug, distortion, distortionMap]);
153
+ }, [gl, blur, textureMatrix, resolution, mirror, hasBlur, mixBlur, mixStrength, minDepthThreshold, maxDepthThreshold, depthScale, depthToBlurRatioBias, debug, distortion, distortionMap, mixContrast]);
149
154
  useFrame(() => {
150
155
  if (!(meshRef != null && meshRef.current)) return;
151
156
  meshRef.current.visible = false;
package/core/index.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./Billboard.cjs.js"),r=require("./QuadraticBezierLine.cjs.js"),s=require("./CubicBezierLine.cjs.js"),t=require("./Line.cjs.js"),o=require("./PositionalAudio.cjs.js"),i=require("./Text.cjs.js"),u=require("./Effects.cjs.js"),a=require("./GradientTexture.cjs.js"),j=require("./Image.cjs.js"),c=require("./OrthographicCamera.cjs.js"),p=require("./PerspectiveCamera.cjs.js"),n=require("./CubeCamera.cjs.js"),l=require("./DeviceOrientationControls.cjs.js"),x=require("./FlyControls.cjs.js"),q=require("./MapControls.cjs.js"),d=require("./OrbitControls.cjs.js"),h=require("./TrackballControls.cjs.js"),C=require("./ArcballControls.cjs.js"),m=require("./TransformControls.cjs.js"),B=require("./PointerLockControls.cjs.js"),S=require("./FirstPersonControls.cjs.js"),b=require("./GizmoHelper.cjs.js"),f=require("./GizmoViewcube.cjs.js"),P=require("./GizmoViewport.cjs.js"),T=require("./useCubeTexture.cjs.js"),M=require("./useFBX.cjs.js"),g=require("./useGLTF.cjs.js"),v=require("./useProgress.cjs.js"),D=require("./useTexture.cjs.js"),L=require("./Stats.cjs.js"),A=require("./DepthBuffer.cjs.js"),G=require("./useDepthBuffer.cjs.js"),k=require("./useAspect.cjs.js"),F=require("./useCamera.cjs.js"),w=require("./useDetectGPU.cjs.js"),z=require("./useHelper.cjs.js"),I=require("./useBVH.cjs.js"),O=require("./useContextBridge.cjs.js"),E=require("./useAnimations.cjs.js"),y=require("./useFBO.cjs.js"),H=require("./useIntersect.cjs.js"),R=require("./useSimplification.cjs.js"),V=require("./useTessellation.cjs.js"),Q=require("./useEdgeSplit.cjs.js"),W=require("./CurveModifier.cjs.js"),N=require("./MeshDistortMaterial.cjs.js"),U=require("./MeshWobbleMaterial.cjs.js"),X=require("./PointMaterial.cjs.js"),K=require("./shaderMaterial.cjs.js"),_=require("./softShadows.cjs.js"),J=require("./shapes.cjs.js"),Y=require("./RoundedBox.cjs.js"),Z=require("./ScreenQuad.cjs.js"),$=require("./Center.cjs.js"),ee=require("./Bounds.cjs.js"),re=require("./CameraShake.cjs.js"),se=require("./Float.cjs.js"),te=require("./Stage.cjs.js"),oe=require("./Backdrop.cjs.js"),ie=require("./Shadow.cjs.js"),ue=require("./ContactShadows.cjs.js"),ae=require("./Reflector.cjs.js"),je=require("./SpotLight.cjs.js"),ce=require("./Environment.cjs.js"),pe=require("./Sky.cjs.js"),ne=require("./Stars.cjs.js"),le=require("./Cloud.cjs.js"),xe=require("./useMatcapTexture.cjs.js"),qe=require("./useNormalTexture.cjs.js"),de=require("./Points.cjs.js"),he=require("./Instances.cjs.js"),Ce=require("./Segments.cjs.js"),me=require("./Detailed.cjs.js"),Be=require("./Preload.cjs.js"),Se=require("./BakeShadows.cjs.js"),be=require("./meshBounds.cjs.js"),fe=require("./AdaptiveDpr.cjs.js"),Pe=require("./AdaptiveEvents.cjs.js");require("@babel/runtime/helpers/extends"),require("react"),require("@react-three/fiber"),require("react-merge-refs"),require("three"),require("three-stdlib"),require("troika-three-text"),require("lodash.omit"),require("lodash.pick"),require("zustand"),require("three/examples/js/libs/stats.min"),require("../helpers/useEffectfulState.cjs.js"),require("detect-gpu"),require("use-asset"),require("three-mesh-bvh"),require("../helpers/environment-assets.cjs.js"),require("../materials/BlurPass.cjs.js"),require("../materials/ConvolutionMaterial.cjs.js"),require("../materials/MeshReflectorMaterial.cjs.js"),require("../materials/SpotLightMaterial.cjs.js"),require("../assets/cloud.base64.cjs.js"),require("../helpers/matcap-assets.cjs.js"),require("../helpers/normal-assets.cjs.js"),require("../helpers/Position.cjs.js"),require("react-composer"),exports.Billboard=e.Billboard,exports.QuadraticBezierLine=r.QuadraticBezierLine,exports.CubicBezierLine=s.CubicBezierLine,exports.Line=t.Line,exports.PositionalAudio=o.PositionalAudio,exports.Text=i.Text,exports.Effects=u.Effects,exports.isWebGL2Available=u.isWebGL2Available,exports.GradientTexture=a.GradientTexture,exports.Image=j.Image,exports.OrthographicCamera=c.OrthographicCamera,exports.PerspectiveCamera=p.PerspectiveCamera,exports.CubeCamera=n.CubeCamera,exports.DeviceOrientationControls=l.DeviceOrientationControls,exports.FlyControls=x.FlyControls,exports.MapControls=q.MapControls,exports.OrbitControls=d.OrbitControls,exports.TrackballControls=h.TrackballControls,exports.ArcballControls=C.ArcballControls,exports.TransformControls=m.TransformControls,exports.PointerLockControls=B.PointerLockControls,exports.FirstPersonControls=S.FirstPersonControls,exports.GizmoHelper=b.GizmoHelper,exports.useGizmoContext=b.useGizmoContext,exports.GizmoViewcube=f.GizmoViewcube,exports.GizmoViewport=P.GizmoViewport,exports.useCubeTexture=T.useCubeTexture,exports.useFBX=M.useFBX,exports.useGLTF=g.useGLTF,exports.useProgress=v.useProgress,exports.IsObject=D.IsObject,exports.useTexture=D.useTexture,exports.Stats=L.Stats,exports.DepthBuffer=A.DepthBuffer,exports.useDepthBuffer=G.useDepthBuffer,exports.useAspect=k.useAspect,exports.useCamera=F.useCamera,exports.useDetectGPU=w.useDetectGPU,exports.useHelper=z.useHelper,exports.useBVH=I.useBVH,exports.useContextBridge=O.useContextBridge,exports.useAnimations=E.useAnimations,exports.useFBO=y.useFBO,exports.useIntersect=H.useIntersect,exports.useSimplification=R.useSimplification,exports.useTessellation=V.useTessellation,exports.useEdgeSplit=Q.useEdgeSplit,exports.CurveModifier=W.CurveModifier,exports.MeshDistortMaterial=N.MeshDistortMaterial,exports.MeshWobbleMaterial=U.MeshWobbleMaterial,exports.PointMaterial=X.PointMaterial,exports.PointMaterialImpl=X.PointMaterialImpl,exports.shaderMaterial=K.shaderMaterial,exports.softShadows=_.softShadows,exports.Box=J.Box,exports.Circle=J.Circle,exports.Cone=J.Cone,exports.Cylinder=J.Cylinder,exports.Dodecahedron=J.Dodecahedron,exports.Extrude=J.Extrude,exports.Icosahedron=J.Icosahedron,exports.Lathe=J.Lathe,exports.Octahedron=J.Octahedron,exports.Parametric=J.Parametric,exports.Plane=J.Plane,exports.Polyhedron=J.Polyhedron,exports.Ring=J.Ring,exports.Sphere=J.Sphere,exports.Tetrahedron=J.Tetrahedron,exports.Torus=J.Torus,exports.TorusKnot=J.TorusKnot,exports.Tube=J.Tube,exports.RoundedBox=Y.RoundedBox,exports.ScreenQuad=Z.ScreenQuad,exports.Center=$.Center,exports.Bounds=ee.Bounds,exports.useBounds=ee.useBounds,exports.CameraShake=re.CameraShake,exports.Float=se.Float,exports.Stage=te.Stage,exports.Backdrop=oe.Backdrop,exports.Shadow=ie.Shadow,exports.ContactShadows=ue.ContactShadows,exports.Reflector=ae.Reflector,exports.SpotLight=je.SpotLight,exports.Environment=ce.Environment,exports.Sky=pe.Sky,exports.calcPosFromAngles=pe.calcPosFromAngles,exports.Stars=ne.Stars,exports.Cloud=le.Cloud,exports.useMatcapTexture=xe.useMatcapTexture,exports.useNormalTexture=qe.useNormalTexture,exports.Point=de.Point,exports.Points=de.Points,exports.PointsBuffer=de.PointsBuffer,exports.Instance=he.Instance,exports.Instances=he.Instances,exports.Merged=he.Merged,exports.Segment=Ce.Segment,exports.Segments=Ce.Segments,exports.Detailed=me.Detailed,exports.Preload=Be.Preload,exports.BakeShadows=Se.BakeShadows,exports.meshBounds=be.meshBounds,exports.AdaptiveDpr=fe.AdaptiveDpr,exports.AdaptiveEvents=Pe.AdaptiveEvents;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./Billboard.cjs.js"),r=require("./QuadraticBezierLine.cjs.js"),s=require("./CubicBezierLine.cjs.js"),t=require("./Line.cjs.js"),o=require("./PositionalAudio.cjs.js"),i=require("./Text.cjs.js"),u=require("./Effects.cjs.js"),a=require("./GradientTexture.cjs.js"),c=require("./Image.cjs.js"),j=require("./OrthographicCamera.cjs.js"),p=require("./PerspectiveCamera.cjs.js"),n=require("./CubeCamera.cjs.js"),l=require("./DeviceOrientationControls.cjs.js"),x=require("./FlyControls.cjs.js"),q=require("./MapControls.cjs.js"),d=require("./OrbitControls.cjs.js"),h=require("./TrackballControls.cjs.js"),C=require("./ArcballControls.cjs.js"),m=require("./TransformControls.cjs.js"),B=require("./PointerLockControls.cjs.js"),S=require("./FirstPersonControls.cjs.js"),f=require("./GizmoHelper.cjs.js"),b=require("./GizmoViewcube.cjs.js"),P=require("./GizmoViewport.cjs.js"),M=require("./useCubeTexture.cjs.js"),T=require("./useFBX.cjs.js"),g=require("./useGLTF.cjs.js"),v=require("./useProgress.cjs.js"),D=require("./useTexture.cjs.js"),L=require("./Stats.cjs.js"),A=require("./DepthBuffer.cjs.js"),G=require("./useDepthBuffer.cjs.js"),k=require("./useAspect.cjs.js"),F=require("./useCamera.cjs.js"),w=require("./useDetectGPU.cjs.js"),z=require("./useHelper.cjs.js"),I=require("./useBVH.cjs.js"),O=require("./useContextBridge.cjs.js"),E=require("./useAnimations.cjs.js"),R=require("./useFBO.cjs.js"),y=require("./useIntersect.cjs.js"),H=require("./useSimplification.cjs.js"),V=require("./useTessellation.cjs.js"),Q=require("./useEdgeSplit.cjs.js"),W=require("./CurveModifier.cjs.js"),N=require("./MeshDistortMaterial.cjs.js"),U=require("./MeshWobbleMaterial.cjs.js"),X=require("./MeshReflectorMaterial.cjs.js"),K=require("./PointMaterial.cjs.js"),_=require("./shaderMaterial.cjs.js"),J=require("./softShadows.cjs.js"),Y=require("./shapes.cjs.js"),Z=require("./RoundedBox.cjs.js"),$=require("./ScreenQuad.cjs.js"),ee=require("./Center.cjs.js"),re=require("./Bounds.cjs.js"),se=require("./CameraShake.cjs.js"),te=require("./Float.cjs.js"),oe=require("./Stage.cjs.js"),ie=require("./Backdrop.cjs.js"),ue=require("./Shadow.cjs.js"),ae=require("./ContactShadows.cjs.js"),ce=require("./Reflector.cjs.js"),je=require("./SpotLight.cjs.js"),pe=require("./Environment.cjs.js"),ne=require("./Sky.cjs.js"),le=require("./Stars.cjs.js"),xe=require("./Cloud.cjs.js"),qe=require("./useMatcapTexture.cjs.js"),de=require("./useNormalTexture.cjs.js"),he=require("./Points.cjs.js"),Ce=require("./Instances.cjs.js"),me=require("./Segments.cjs.js"),Be=require("./Detailed.cjs.js"),Se=require("./Preload.cjs.js"),fe=require("./BakeShadows.cjs.js"),be=require("./meshBounds.cjs.js"),Pe=require("./AdaptiveDpr.cjs.js"),Me=require("./AdaptiveEvents.cjs.js");require("@babel/runtime/helpers/extends"),require("react"),require("@react-three/fiber"),require("react-merge-refs"),require("three"),require("three-stdlib"),require("troika-three-text"),require("lodash.omit"),require("lodash.pick"),require("zustand"),require("three/examples/js/libs/stats.min"),require("../helpers/useEffectfulState.cjs.js"),require("detect-gpu"),require("use-asset"),require("three-mesh-bvh"),require("../materials/BlurPass.cjs.js"),require("../materials/ConvolutionMaterial.cjs.js"),require("../materials/MeshReflectorMaterial.cjs.js"),require("../helpers/environment-assets.cjs.js"),require("../materials/SpotLightMaterial.cjs.js"),require("../assets/cloud.base64.cjs.js"),require("../helpers/matcap-assets.cjs.js"),require("../helpers/normal-assets.cjs.js"),require("../helpers/Position.cjs.js"),require("react-composer"),exports.Billboard=e.Billboard,exports.QuadraticBezierLine=r.QuadraticBezierLine,exports.CubicBezierLine=s.CubicBezierLine,exports.Line=t.Line,exports.PositionalAudio=o.PositionalAudio,exports.Text=i.Text,exports.Effects=u.Effects,exports.isWebGL2Available=u.isWebGL2Available,exports.GradientTexture=a.GradientTexture,exports.Image=c.Image,exports.OrthographicCamera=j.OrthographicCamera,exports.PerspectiveCamera=p.PerspectiveCamera,exports.CubeCamera=n.CubeCamera,exports.DeviceOrientationControls=l.DeviceOrientationControls,exports.FlyControls=x.FlyControls,exports.MapControls=q.MapControls,exports.OrbitControls=d.OrbitControls,exports.TrackballControls=h.TrackballControls,exports.ArcballControls=C.ArcballControls,exports.TransformControls=m.TransformControls,exports.PointerLockControls=B.PointerLockControls,exports.FirstPersonControls=S.FirstPersonControls,exports.GizmoHelper=f.GizmoHelper,exports.useGizmoContext=f.useGizmoContext,exports.GizmoViewcube=b.GizmoViewcube,exports.GizmoViewport=P.GizmoViewport,exports.useCubeTexture=M.useCubeTexture,exports.useFBX=T.useFBX,exports.useGLTF=g.useGLTF,exports.useProgress=v.useProgress,exports.IsObject=D.IsObject,exports.useTexture=D.useTexture,exports.Stats=L.Stats,exports.DepthBuffer=A.DepthBuffer,exports.useDepthBuffer=G.useDepthBuffer,exports.useAspect=k.useAspect,exports.useCamera=F.useCamera,exports.useDetectGPU=w.useDetectGPU,exports.useHelper=z.useHelper,exports.useBVH=I.useBVH,exports.useContextBridge=O.useContextBridge,exports.useAnimations=E.useAnimations,exports.useFBO=R.useFBO,exports.useIntersect=y.useIntersect,exports.useSimplification=H.useSimplification,exports.useTessellation=V.useTessellation,exports.useEdgeSplit=Q.useEdgeSplit,exports.CurveModifier=W.CurveModifier,exports.MeshDistortMaterial=N.MeshDistortMaterial,exports.MeshWobbleMaterial=U.MeshWobbleMaterial,exports.MeshReflectorMaterial=X.MeshReflectorMaterial,exports.PointMaterial=K.PointMaterial,exports.PointMaterialImpl=K.PointMaterialImpl,exports.shaderMaterial=_.shaderMaterial,exports.softShadows=J.softShadows,exports.Box=Y.Box,exports.Circle=Y.Circle,exports.Cone=Y.Cone,exports.Cylinder=Y.Cylinder,exports.Dodecahedron=Y.Dodecahedron,exports.Extrude=Y.Extrude,exports.Icosahedron=Y.Icosahedron,exports.Lathe=Y.Lathe,exports.Octahedron=Y.Octahedron,exports.Parametric=Y.Parametric,exports.Plane=Y.Plane,exports.Polyhedron=Y.Polyhedron,exports.Ring=Y.Ring,exports.Sphere=Y.Sphere,exports.Tetrahedron=Y.Tetrahedron,exports.Torus=Y.Torus,exports.TorusKnot=Y.TorusKnot,exports.Tube=Y.Tube,exports.RoundedBox=Z.RoundedBox,exports.ScreenQuad=$.ScreenQuad,exports.Center=ee.Center,exports.Bounds=re.Bounds,exports.useBounds=re.useBounds,exports.CameraShake=se.CameraShake,exports.Float=te.Float,exports.Stage=oe.Stage,exports.Backdrop=ie.Backdrop,exports.Shadow=ue.Shadow,exports.ContactShadows=ae.ContactShadows,exports.Reflector=ce.Reflector,exports.SpotLight=je.SpotLight,exports.Environment=pe.Environment,exports.Sky=ne.Sky,exports.calcPosFromAngles=ne.calcPosFromAngles,exports.Stars=le.Stars,exports.Cloud=xe.Cloud,exports.useMatcapTexture=qe.useMatcapTexture,exports.useNormalTexture=de.useNormalTexture,exports.Point=he.Point,exports.Points=he.Points,exports.PointsBuffer=he.PointsBuffer,exports.Instance=Ce.Instance,exports.Instances=Ce.Instances,exports.Merged=Ce.Merged,exports.Segment=me.Segment,exports.Segments=me.Segments,exports.Detailed=Be.Detailed,exports.Preload=Se.Preload,exports.BakeShadows=fe.BakeShadows,exports.meshBounds=be.meshBounds,exports.AdaptiveDpr=Pe.AdaptiveDpr,exports.AdaptiveEvents=Me.AdaptiveEvents;
package/core/index.d.ts CHANGED
@@ -45,6 +45,7 @@ export * from './useEdgeSplit';
45
45
  export * from './CurveModifier';
46
46
  export * from './MeshDistortMaterial';
47
47
  export * from './MeshWobbleMaterial';
48
+ export * from './MeshReflectorMaterial';
48
49
  export * from './PointMaterial';
49
50
  export * from './shaderMaterial';
50
51
  export * from './softShadows';
package/core/index.js CHANGED
@@ -45,6 +45,7 @@ export { useEdgeSplit } from './useEdgeSplit.js';
45
45
  export { CurveModifier } from './CurveModifier.js';
46
46
  export { MeshDistortMaterial } from './MeshDistortMaterial.js';
47
47
  export { MeshWobbleMaterial } from './MeshWobbleMaterial.js';
48
+ export { MeshReflectorMaterial } from './MeshReflectorMaterial.js';
48
49
  export { PointMaterial, PointMaterialImpl } from './PointMaterial.js';
49
50
  export { shaderMaterial } from './shaderMaterial.js';
50
51
  export { softShadows } from './softShadows.js';
@@ -91,10 +92,10 @@ import '../helpers/useEffectfulState.js';
91
92
  import 'detect-gpu';
92
93
  import 'use-asset';
93
94
  import 'three-mesh-bvh';
94
- import '../helpers/environment-assets.js';
95
95
  import '../materials/BlurPass.js';
96
96
  import '../materials/ConvolutionMaterial.js';
97
97
  import '../materials/MeshReflectorMaterial.js';
98
+ import '../helpers/environment-assets.js';
98
99
  import '../materials/SpotLightMaterial.js';
99
100
  import '../assets/cloud.base64.js';
100
101
  import '../helpers/matcap-assets.js';