@react-three/drei 7.27.1 → 7.27.2

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three");class t extends e.MeshStandardMaterial{constructor(e={}){super(e),this._debug={value:0},this._tDepth={value:null},this._distortionMap={value:null},this._tDiffuse={value:null},this._tDiffuseBlur={value:null},this._textureMatrix={value:null},this._hasBlur={value:!1},this._mirror={value:0},this._mixBlur={value:0},this._blurStrength={value:.5},this._minDepthThreshold={value:.9},this._maxDepthThreshold={value:1},this._depthScale={value:0},this._depthToBlurRatioBias={value:.25},this._distortion={value:1},this.setValues(e)}onBeforeCompile(e){var t;null!=(t=e.defines)&&t.USE_UV||(e.defines.USE_UV=""),e.uniforms.debug=this._debug,e.uniforms.hasBlur=this._hasBlur,e.uniforms.tDiffuse=this._tDiffuse,e.uniforms.tDepth=this._tDepth,e.uniforms.distortionMap=this._distortionMap,e.uniforms.tDiffuseBlur=this._tDiffuseBlur,e.uniforms.textureMatrix=this._textureMatrix,e.uniforms.mirror=this._mirror,e.uniforms.mixBlur=this._mixBlur,e.uniforms.mixStrength=this._blurStrength,e.uniforms.minDepthThreshold=this._minDepthThreshold,e.uniforms.maxDepthThreshold=this._maxDepthThreshold,e.uniforms.depthScale=this._depthScale,e.uniforms.depthToBlurRatioBias=this._depthToBlurRatioBias,e.uniforms.distortion=this._distortion,e.vertexShader=`\n uniform mat4 textureMatrix;\n varying vec4 my_vUv; \n ${e.vertexShader}`,e.vertexShader=e.vertexShader.replace("#include <project_vertex>","#include <project_vertex>\n my_vUv = textureMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );"),e.fragmentShader=`\n uniform int debug;\n uniform sampler2D tDiffuse;\n uniform sampler2D tDiffuseBlur;\n uniform sampler2D tDepth;\n uniform sampler2D distortionMap;\n uniform float distortion;\n uniform float cameraNear;\n\t\t\t uniform float cameraFar;\n uniform bool hasBlur;\n uniform float mixBlur;\n uniform float mirror;\n uniform float mixStrength;\n uniform float minDepthThreshold;\n uniform float maxDepthThreshold;\n uniform float depthScale;\n uniform float depthToBlurRatioBias;\n varying vec4 my_vUv; \n ${e.fragmentShader}`,e.fragmentShader=e.fragmentShader.replace("#include <emissivemap_fragment>","#include <emissivemap_fragment>\n \n float distortionFactor = 0.0;\n #ifdef USE_DISTORTION\n distortionFactor = texture2D(distortionMap, vUv).r * distortion;\n #endif\n\n vec4 new_vUv = my_vUv;\n new_vUv.x += distortionFactor;\n new_vUv.y += distortionFactor;\n\n vec4 base = texture2DProj(tDiffuse, new_vUv);\n vec4 blur = texture2DProj(tDiffuseBlur, new_vUv);\n \n vec4 merge = base;\n \n #ifdef USE_NORMALMAP\n vec2 normal_uv = vec2(0.0);\n vec4 normalColor = texture2D(normalMap, vUv * normalScale);\n vec3 my_normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );\n vec3 coord = new_vUv.xyz / new_vUv.w;\n normal_uv = coord.xy + coord.z * my_normal.xz * 0.05;\n vec4 base_normal = texture2D(tDiffuse, normal_uv);\n vec4 blur_normal = texture2D(tDiffuseBlur, normal_uv);\n merge = base_normal;\n blur = blur_normal;\n #endif\n\n float depthFactor = 0.0001;\n float blurFactor = 0.0;\n\n #ifdef USE_DEPTH\n vec4 depth = texture2DProj(tDepth, new_vUv);\n depthFactor = smoothstep(minDepthThreshold, maxDepthThreshold, 1.0-(depth.r * depth.a));\n depthFactor *= depthScale;\n depthFactor = max(0.0001, min(1.0, depthFactor));\n\n #ifdef USE_BLUR\n blur = blur * min(1.0, depthFactor + depthToBlurRatioBias);\n merge = merge * min(1.0, depthFactor + 0.5);;\n #else\n merge = merge * depthFactor;\n #endif\n \n #endif\n\n float reflectorRoughnessFactor = roughness;\n #ifdef USE_ROUGHNESSMAP\n vec4 reflectorTexelRoughness = texture2D( roughnessMap, vUv );\n reflectorRoughnessFactor *= reflectorTexelRoughness.g;\n #endif\n \n #ifdef USE_BLUR\n blurFactor = min(1.0, mixBlur * reflectorRoughnessFactor);\n merge = mix(merge, blur, blurFactor);\n #endif\n\n diffuseColor.rgb = diffuseColor.rgb * ((1.0 - min(1.0, mirror)) + merge.rgb * mixStrength); \n diffuseColor = sRGBToLinear(diffuseColor);\n \n if (debug == 1) {\n diffuseColor = sRGBToLinear(vec4(vec3(depthFactor), 1.0));\n }\n if (debug == 2) {\n diffuseColor = sRGBToLinear(vec4(vec3(blurFactor), 1.0));\n }\n if (debug == 3) {\n diffuseColor = sRGBToLinear(texture2DProj(tDiffuse, new_vUv));\n }\n if (debug == 4) {\n diffuseColor = sRGBToLinear(texture2DProj(tDiffuseBlur, new_vUv));\n }\n ")}get tDiffuse(){return this._tDiffuse.value}set tDiffuse(e){this._tDiffuse.value=e}get tDepth(){return this._tDepth.value}set tDepth(e){this._tDepth.value=e}get distortionMap(){return this._distortionMap.value}set distortionMap(e){this._distortionMap.value=e}get tDiffuseBlur(){return this._tDiffuseBlur.value}set tDiffuseBlur(e){this._tDiffuseBlur.value=e}get textureMatrix(){return this._textureMatrix.value}set textureMatrix(e){this._textureMatrix.value=e}get hasBlur(){return this._hasBlur.value}set hasBlur(e){this._hasBlur.value=e}get mirror(){return this._mirror.value}set mirror(e){this._mirror.value=e}get mixBlur(){return this._mixBlur.value}set mixBlur(e){this._mixBlur.value=e}get mixStrength(){return this._blurStrength.value}set mixStrength(e){this._blurStrength.value=e}get minDepthThreshold(){return this._minDepthThreshold.value}set minDepthThreshold(e){this._minDepthThreshold.value=e}get maxDepthThreshold(){return this._maxDepthThreshold.value}set maxDepthThreshold(e){this._maxDepthThreshold.value=e}get depthScale(){return this._depthScale.value}set depthScale(e){this._depthScale.value=e}get debug(){return this._debug.value}set debug(e){this._debug.value=e}get depthToBlurRatioBias(){return this._depthToBlurRatioBias.value}set depthToBlurRatioBias(e){this._depthToBlurRatioBias.value=e}get distortion(){return this._distortion.value}set distortion(e){this._distortion.value=e}}exports.MeshReflectorMaterial=t;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three");class t extends e.MeshStandardMaterial{constructor(e={}){super(e),this._debug={value:0},this._tDepth={value:null},this._distortionMap={value:null},this._tDiffuse={value:null},this._tDiffuseBlur={value:null},this._textureMatrix={value:null},this._hasBlur={value:!1},this._mirror={value:0},this._mixBlur={value:0},this._blurStrength={value:.5},this._minDepthThreshold={value:.9},this._maxDepthThreshold={value:1},this._depthScale={value:0},this._depthToBlurRatioBias={value:.25},this._distortion={value:1},this._gamma={value:1},this._contrast={value:1},this._brightness={value:0},this.setValues(e)}onBeforeCompile(e){var t;null!=(t=e.defines)&&t.USE_UV||(e.defines.USE_UV=""),e.uniforms.debug=this._debug,e.uniforms.hasBlur=this._hasBlur,e.uniforms.tDiffuse=this._tDiffuse,e.uniforms.tDepth=this._tDepth,e.uniforms.distortionMap=this._distortionMap,e.uniforms.tDiffuseBlur=this._tDiffuseBlur,e.uniforms.textureMatrix=this._textureMatrix,e.uniforms.mirror=this._mirror,e.uniforms.mixBlur=this._mixBlur,e.uniforms.mixStrength=this._blurStrength,e.uniforms.minDepthThreshold=this._minDepthThreshold,e.uniforms.maxDepthThreshold=this._maxDepthThreshold,e.uniforms.depthScale=this._depthScale,e.uniforms.depthToBlurRatioBias=this._depthToBlurRatioBias,e.uniforms.distortion=this._distortion,e.uniforms.gamma=this._gamma,e.uniforms.contrast=this._contrast,e.uniforms.brightness=this._brightness,e.vertexShader=`\n uniform mat4 textureMatrix;\n varying vec4 my_vUv; \n ${e.vertexShader}`,e.vertexShader=e.vertexShader.replace("#include <project_vertex>","#include <project_vertex>\n my_vUv = textureMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );"),e.fragmentShader=`\n uniform int debug;\n uniform sampler2D tDiffuse;\n uniform sampler2D tDiffuseBlur;\n uniform sampler2D tDepth;\n uniform sampler2D distortionMap;\n uniform float distortion;\n uniform float cameraNear;\n\t\t\t uniform float cameraFar;\n uniform bool hasBlur;\n uniform float mixBlur;\n uniform float mirror;\n uniform float mixStrength;\n uniform float minDepthThreshold;\n uniform float maxDepthThreshold;\n\n uniform float gamma;\n uniform float contrast;\n uniform float brightness;\n\n uniform float depthScale;\n uniform float depthToBlurRatioBias;\n varying vec4 my_vUv; \n ${e.fragmentShader}`,e.fragmentShader=e.fragmentShader.replace("#include <emissivemap_fragment>","#include <emissivemap_fragment>\n \n float distortionFactor = 0.0;\n #ifdef USE_DISTORTION\n distortionFactor = texture2D(distortionMap, vUv).r * distortion;\n #endif\n\n vec4 new_vUv = my_vUv;\n new_vUv.x += distortionFactor;\n new_vUv.y += distortionFactor;\n\n vec4 base = texture2DProj(tDiffuse, new_vUv);\n vec4 blur = texture2DProj(tDiffuseBlur, new_vUv);\n \n vec4 merge = base;\n \n #ifdef USE_NORMALMAP\n vec2 normal_uv = vec2(0.0);\n vec4 normalColor = texture2D(normalMap, vUv * normalScale);\n vec3 my_normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );\n vec3 coord = new_vUv.xyz / new_vUv.w;\n normal_uv = coord.xy + coord.z * my_normal.xz * 0.05;\n vec4 base_normal = texture2D(tDiffuse, normal_uv);\n vec4 blur_normal = texture2D(tDiffuseBlur, normal_uv);\n merge = base_normal;\n blur = blur_normal;\n #endif\n\n float depthFactor = 0.0001;\n float blurFactor = 0.0;\n\n #ifdef USE_DEPTH\n vec4 depth = texture2DProj(tDepth, new_vUv);\n depthFactor = smoothstep(minDepthThreshold, maxDepthThreshold, 1.0-(depth.r * depth.a));\n depthFactor *= depthScale;\n depthFactor = max(0.0001, min(1.0, depthFactor));\n\n #ifdef USE_BLUR\n blur = blur * min(1.0, depthFactor + depthToBlurRatioBias);\n merge = merge * min(1.0, depthFactor + 0.5);\n #else\n merge = merge * depthFactor;\n #endif\n \n #endif\n\n float reflectorRoughnessFactor = roughness;\n #ifdef USE_ROUGHNESSMAP\n vec4 reflectorTexelRoughness = texture2D( roughnessMap, vUv );\n reflectorRoughnessFactor *= reflectorTexelRoughness.g;\n #endif\n \n #ifdef USE_BLUR\n blurFactor = min(1.0, mixBlur * reflectorRoughnessFactor);\n merge = mix(merge, blur, blurFactor);\n #endif\n\n vec4 newMerge = vec4(0.0, 0.0, 0.0, 1.0);\n newMerge.r = (pow(merge.r,gamma) - 0.5)*contrast + brightness + 0.5;\n newMerge.g = (pow(merge.g,gamma) - 0.5)*contrast + brightness + 0.5;\n newMerge.b = (pow(merge.b,gamma) - 0.5)*contrast + brightness + 0.5;\n\n diffuseColor.rgb = diffuseColor.rgb * ((1.0 - min(1.0, mirror)) + newMerge.rgb * mixStrength); \n diffuseColor = sRGBToLinear(diffuseColor);\n \n if (debug == 1) {\n diffuseColor = sRGBToLinear(vec4(vec3(depthFactor), 1.0));\n }\n if (debug == 2) {\n diffuseColor = sRGBToLinear(vec4(vec3(blurFactor), 1.0));\n }\n if (debug == 3) {\n diffuseColor = sRGBToLinear(texture2DProj(tDiffuse, new_vUv));\n }\n if (debug == 4) {\n diffuseColor = sRGBToLinear(texture2DProj(tDiffuseBlur, new_vUv));\n }\n ")}get tDiffuse(){return this._tDiffuse.value}set tDiffuse(e){this._tDiffuse.value=e}get tDepth(){return this._tDepth.value}set tDepth(e){this._tDepth.value=e}get distortionMap(){return this._distortionMap.value}set distortionMap(e){this._distortionMap.value=e}get tDiffuseBlur(){return this._tDiffuseBlur.value}set tDiffuseBlur(e){this._tDiffuseBlur.value=e}get textureMatrix(){return this._textureMatrix.value}set textureMatrix(e){this._textureMatrix.value=e}get hasBlur(){return this._hasBlur.value}set hasBlur(e){this._hasBlur.value=e}get mirror(){return this._mirror.value}set mirror(e){this._mirror.value=e}get mixBlur(){return this._mixBlur.value}set mixBlur(e){this._mixBlur.value=e}get mixStrength(){return this._blurStrength.value}set mixStrength(e){this._blurStrength.value=e}get minDepthThreshold(){return this._minDepthThreshold.value}set minDepthThreshold(e){this._minDepthThreshold.value=e}get maxDepthThreshold(){return this._maxDepthThreshold.value}set maxDepthThreshold(e){this._maxDepthThreshold.value=e}get depthScale(){return this._depthScale.value}set depthScale(e){this._depthScale.value=e}get debug(){return this._debug.value}set debug(e){this._debug.value=e}get depthToBlurRatioBias(){return this._depthToBlurRatioBias.value}set depthToBlurRatioBias(e){this._depthToBlurRatioBias.value=e}get distortion(){return this._distortion.value}set distortion(e){this._distortion.value=e}get gamma(){return this._gamma.value}set gamma(e){this._gamma.value=e}get contrast(){return this._contrast.value}set contrast(e){this._contrast.value=e}get brightness(){return this._brightness.value}set brightness(e){this._brightness.value=e}}exports.MeshReflectorMaterial=t;
@@ -15,6 +15,9 @@ export declare class MeshReflectorMaterial extends MeshStandardMaterial {
15
15
  private _depthScale;
16
16
  private _depthToBlurRatioBias;
17
17
  private _distortion;
18
+ private _gamma;
19
+ private _contrast;
20
+ private _brightness;
18
21
  constructor(parameters?: {});
19
22
  onBeforeCompile(shader: any): void;
20
23
  get tDiffuse(): Texture | null;
@@ -47,6 +50,12 @@ export declare class MeshReflectorMaterial extends MeshStandardMaterial {
47
50
  set depthToBlurRatioBias(v: number);
48
51
  get distortion(): number;
49
52
  set distortion(v: number);
53
+ get gamma(): number;
54
+ set gamma(v: number);
55
+ get contrast(): number;
56
+ set contrast(v: number);
57
+ get brightness(): number;
58
+ set brightness(v: number);
50
59
  }
51
60
  export declare type MeshReflectorMaterialProps = {
52
61
  mixBlur: number;
@@ -62,4 +71,7 @@ export declare type MeshReflectorMaterialProps = {
62
71
  depthScale: number;
63
72
  depthToBlurRatioBias: number;
64
73
  distortion: number;
74
+ gamma: number;
75
+ contrast: number;
76
+ brightness: number;
65
77
  } & JSX.IntrinsicElements['meshStandardMaterial'];
@@ -48,6 +48,15 @@ class MeshReflectorMaterial extends MeshStandardMaterial {
48
48
  this._distortion = {
49
49
  value: 1
50
50
  };
51
+ this._gamma = {
52
+ value: 1.0
53
+ };
54
+ this._contrast = {
55
+ value: 1.0
56
+ };
57
+ this._brightness = {
58
+ value: 0.0
59
+ };
51
60
  this.setValues(parameters);
52
61
  }
53
62
 
@@ -73,6 +82,9 @@ class MeshReflectorMaterial extends MeshStandardMaterial {
73
82
  shader.uniforms.depthScale = this._depthScale;
74
83
  shader.uniforms.depthToBlurRatioBias = this._depthToBlurRatioBias;
75
84
  shader.uniforms.distortion = this._distortion;
85
+ shader.uniforms.gamma = this._gamma;
86
+ shader.uniforms.contrast = this._contrast;
87
+ shader.uniforms.brightness = this._brightness;
76
88
  shader.vertexShader = `
77
89
  uniform mat4 textureMatrix;
78
90
  varying vec4 my_vUv;
@@ -95,6 +107,11 @@ class MeshReflectorMaterial extends MeshStandardMaterial {
95
107
  uniform float mixStrength;
96
108
  uniform float minDepthThreshold;
97
109
  uniform float maxDepthThreshold;
110
+
111
+ uniform float gamma;
112
+ uniform float contrast;
113
+ uniform float brightness;
114
+
98
115
  uniform float depthScale;
99
116
  uniform float depthToBlurRatioBias;
100
117
  varying vec4 my_vUv;
@@ -138,7 +155,7 @@ class MeshReflectorMaterial extends MeshStandardMaterial {
138
155
 
139
156
  #ifdef USE_BLUR
140
157
  blur = blur * min(1.0, depthFactor + depthToBlurRatioBias);
141
- merge = merge * min(1.0, depthFactor + 0.5);;
158
+ merge = merge * min(1.0, depthFactor + 0.5);
142
159
  #else
143
160
  merge = merge * depthFactor;
144
161
  #endif
@@ -156,7 +173,12 @@ class MeshReflectorMaterial extends MeshStandardMaterial {
156
173
  merge = mix(merge, blur, blurFactor);
157
174
  #endif
158
175
 
159
- diffuseColor.rgb = diffuseColor.rgb * ((1.0 - min(1.0, mirror)) + merge.rgb * mixStrength);
176
+ vec4 newMerge = vec4(0.0, 0.0, 0.0, 1.0);
177
+ newMerge.r = (pow(merge.r,gamma) - 0.5)*contrast + brightness + 0.5;
178
+ newMerge.g = (pow(merge.g,gamma) - 0.5)*contrast + brightness + 0.5;
179
+ newMerge.b = (pow(merge.b,gamma) - 0.5)*contrast + brightness + 0.5;
180
+
181
+ diffuseColor.rgb = diffuseColor.rgb * ((1.0 - min(1.0, mirror)) + newMerge.rgb * mixStrength);
160
182
  diffuseColor = sRGBToLinear(diffuseColor);
161
183
 
162
184
  if (debug == 1) {
@@ -294,6 +316,30 @@ class MeshReflectorMaterial extends MeshStandardMaterial {
294
316
  this._distortion.value = v;
295
317
  }
296
318
 
319
+ get gamma() {
320
+ return this._gamma.value;
321
+ }
322
+
323
+ set gamma(v) {
324
+ this._gamma.value = v;
325
+ }
326
+
327
+ get contrast() {
328
+ return this._contrast.value;
329
+ }
330
+
331
+ set contrast(v) {
332
+ this._contrast.value = v;
333
+ }
334
+
335
+ get brightness() {
336
+ return this._brightness.value;
337
+ }
338
+
339
+ set brightness(v) {
340
+ this._brightness.value = v;
341
+ }
342
+
297
343
  }
298
344
 
299
345
  export { MeshReflectorMaterial };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-three/drei",
3
- "version": "7.27.1",
3
+ "version": "7.27.2",
4
4
  "private": false,
5
5
  "description": "useful add-ons for react-three-fiber",
6
6
  "keywords": [
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("react"),r=require("three"),o=require("@react-three/fiber"),n=require("@react-spring/three"),a=require("@use-gesture/react");function i(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 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 u=i(e),c=s(t);exports.PresentationControls=function({snap:e,global:t,children:i,speed:s=1,rotation:l=[0,0,0],zoom:f=1,polar:d=[0,Math.PI/2],azimuth:b=[-1/0,1/0],config:g={mass:1,tension:170,friction:26}}){const{size:m,gl:p}=o.useThree(),h=c.useMemo((()=>[l[0]+d[0],l[0]+d[1]]),[l[0],d[0],d[1]]),y=c.useMemo((()=>[l[1]+b[0],l[1]+b[1]]),[l[1],b[0],b[1]]),M=c.useMemo((()=>[r.MathUtils.clamp(l[0],...h),r.MathUtils.clamp(l[1],...y),l[2]]),[l[0],l[1],l[2],h,y]),[j,v]=n.useSpring((()=>({scale:1,rotation:M,config:g})));c.useEffect((()=>{v.start({scale:1,rotation:M,config:g})}),[M]),c.useEffect((()=>{t&&(document.body.style.cursor="grab")}),[t]);const O=a.useGesture({onHover:({last:e})=>{t||(document.body.style.cursor=e?"auto":"grab")},onDrag:({down:t,delta:[o,n],memo:[a,i]=j.rotation.animation.to||M})=>{document.body.style.cursor=t?"grabbing":"grab",o=r.MathUtils.clamp(i+o/m.width*Math.PI*s,...y),n=r.MathUtils.clamp(a+n/m.height*Math.PI*s,...h);const u=e&&!t&&"boolean"!=typeof e?e:g;return v.start({scale:t&&n>h[1]/2?f:1,rotation:e&&!t?M:[n,o,0],config:e=>"scale"===e?{...u,friction:3*u.friction}:u}),[n,o]}},{target:t&&p.domElement});return c.createElement(n.a.group,u.default({},null==O?void 0:O(),j),i)};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("react"),r=require("three"),o=require("@react-three/fiber"),n=require("@react-spring/three"),a=require("@use-gesture/react");function i(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 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 u=i(e),c=s(t);exports.PresentationControls=function({snap:e,global:t,children:i,speed:s=1,rotation:l=[0,0,0],zoom:f=1,polar:d=[0,Math.PI/2],azimuth:b=[-1/0,1/0],config:g={mass:1,tension:170,friction:26}}){const{size:m,gl:p}=o.useThree(),h=c.useMemo((()=>[l[0]+d[0],l[0]+d[1]]),[l[0],d[0],d[1]]),y=c.useMemo((()=>[l[1]+b[0],l[1]+b[1]]),[l[1],b[0],b[1]]),M=c.useMemo((()=>[r.MathUtils.clamp(l[0],...h),r.MathUtils.clamp(l[1],...y),l[2]]),[l[0],l[1],l[2],h,y]),[v,j]=n.useSpring((()=>({scale:1,rotation:M,config:g})));c.useEffect((()=>{j.start({scale:1,rotation:M,config:g})}),[M]),c.useEffect((()=>{t&&(document.body.style.cursor="grab")}),[t]);const O=a.useGesture({onHover:({last:e})=>{t||(document.body.style.cursor=e?"auto":"grab")},onDrag:({down:t,delta:[o,n],memo:[a,i]=v.rotation.animation.to||M})=>{document.body.style.cursor=t?"grabbing":"grab",o=r.MathUtils.clamp(i+o/m.width*Math.PI*s,...y),n=r.MathUtils.clamp(a+n/m.height*Math.PI*s,...h);const u=e&&!t&&"boolean"!=typeof e?e:g;return j.start({scale:t&&n>h[1]/2?f:1,rotation:e&&!t?M:[n,o,0],config:e=>"scale"===e?{...u,friction:3*u.friction}:u}),[n,o]}},{target:t?p.domElement:void 0});return c.createElement(n.a.group,u.default({},null==O?void 0:O(),v),i)};
@@ -65,7 +65,7 @@ function PresentationControls({
65
65
  return [y, x];
66
66
  }
67
67
  }, {
68
- target: global && gl.domElement
68
+ target: global ? gl.domElement : undefined
69
69
  });
70
70
  return /*#__PURE__*/React.createElement(a.group, _extends({}, bind == null ? void 0 : bind(), spring), children);
71
71
  }