@react-three/drei 9.83.8 → 9.84.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/README.md +70 -2
  2. package/core/AccumulativeShadows.d.ts +3 -3
  3. package/core/AccumulativeShadows.js +30 -36
  4. package/core/AdaptiveDpr.js +4 -4
  5. package/core/ArcballControls.d.ts +1 -1
  6. package/core/ArcballControls.js +0 -1
  7. package/core/AsciiRenderer.d.ts +3 -3
  8. package/core/AsciiRenderer.js +12 -6
  9. package/core/BBAnchor.cjs.js +1 -1
  10. package/core/BBAnchor.d.ts +2 -2
  11. package/core/BBAnchor.js +5 -5
  12. package/core/Backdrop.d.ts +2 -2
  13. package/core/Backdrop.js +0 -3
  14. package/core/Billboard.d.ts +1 -1
  15. package/core/Billboard.js +6 -3
  16. package/core/Bounds.d.ts +5 -5
  17. package/core/Bounds.js +5 -32
  18. package/core/CameraControls.d.ts +2 -2
  19. package/core/CameraControls.js +0 -3
  20. package/core/CameraShake.js +0 -4
  21. package/core/CatmullRomLine.d.ts +1 -1
  22. package/core/CatmullRomLine.js +0 -2
  23. package/core/Caustics.d.ts +1 -1
  24. package/core/Caustics.js +31 -32
  25. package/core/Center.d.ts +2 -2
  26. package/core/Center.js +2 -1
  27. package/core/Clone.d.ts +1 -1
  28. package/core/Clone.js +10 -13
  29. package/core/Cloud.cjs.js +1 -1
  30. package/core/Cloud.d.ts +2 -2
  31. package/core/Cloud.js +1 -2
  32. package/core/ComputedAttribute.d.ts +2 -2
  33. package/core/ComputedAttribute.js +0 -1
  34. package/core/ContactShadows.d.ts +1 -1
  35. package/core/ContactShadows.js +6 -7
  36. package/core/CubeCamera.cjs.js +1 -1
  37. package/core/CubeCamera.d.ts +2 -2
  38. package/core/CubeCamera.js +1 -1
  39. package/core/CubicBezierLine.d.ts +1 -1
  40. package/core/CurveModifier.d.ts +1 -1
  41. package/core/CurveModifier.js +2 -4
  42. package/core/Decal.d.ts +1 -1
  43. package/core/Decal.js +8 -15
  44. package/core/Detailed.d.ts +1 -1
  45. package/core/Detailed.js +0 -1
  46. package/core/DeviceOrientationControls.d.ts +1 -1
  47. package/core/DeviceOrientationControls.js +3 -4
  48. package/core/Edges.d.ts +1 -1
  49. package/core/Edges.js +0 -2
  50. package/core/Effects.d.ts +1 -1
  51. package/core/Effects.js +5 -7
  52. package/core/Environment.d.ts +3 -3
  53. package/core/Environment.js +6 -12
  54. package/core/Example.d.ts +3 -3
  55. package/core/Example.js +2 -1
  56. package/core/FaceControls.cjs.js +1 -1
  57. package/core/FaceControls.d.ts +5 -5
  58. package/core/FaceControls.js +42 -39
  59. package/core/FaceLandmarker.d.ts +3 -2
  60. package/core/FaceLandmarker.js +1 -1
  61. package/core/Facemesh.d.ts +6 -6
  62. package/core/Facemesh.js +47 -53
  63. package/core/FirstPersonControls.d.ts +1 -1
  64. package/core/Float.d.ts +1 -1
  65. package/core/Float.js +0 -1
  66. package/core/FlyControls.d.ts +1 -1
  67. package/core/FlyControls.js +1 -2
  68. package/core/GizmoHelper.cjs.js +1 -1
  69. package/core/GizmoHelper.d.ts +2 -2
  70. package/core/GizmoHelper.js +18 -19
  71. package/core/GizmoViewcube.d.ts +3 -3
  72. package/core/GizmoViewcube.js +0 -14
  73. package/core/GizmoViewport.d.ts +3 -3
  74. package/core/GizmoViewport.js +0 -7
  75. package/core/Gltf.d.ts +1 -1
  76. package/core/GradientTexture.d.ts +3 -3
  77. package/core/GradientTexture.js +2 -5
  78. package/core/Grid.d.ts +2 -2
  79. package/core/Grid.js +2 -6
  80. package/core/Hud.d.ts +2 -2
  81. package/core/Hud.js +6 -9
  82. package/core/Image.d.ts +2 -2
  83. package/core/Image.js +4 -6
  84. package/core/Instances.d.ts +6 -6
  85. package/core/Instances.js +20 -35
  86. package/core/Lightformer.d.ts +1 -1
  87. package/core/Lightformer.js +4 -2
  88. package/core/Line.d.ts +1 -1
  89. package/core/Line.js +0 -3
  90. package/core/MapControls.d.ts +1 -1
  91. package/core/MapControls.js +0 -2
  92. package/core/MarchingCubes.d.ts +3 -3
  93. package/core/Mask.d.ts +1 -1
  94. package/core/MeshDistortMaterial.d.ts +2 -2
  95. package/core/MeshDistortMaterial.js +0 -9
  96. package/core/MeshPortalMaterial.d.ts +4 -4
  97. package/core/MeshPortalMaterial.js +22 -61
  98. package/core/MeshReflectorMaterial.d.ts +1 -1
  99. package/core/MeshReflectorMaterial.js +12 -14
  100. package/core/MeshRefractionMaterial.cjs.js +1 -1
  101. package/core/MeshRefractionMaterial.d.ts +3 -3
  102. package/core/MeshRefractionMaterial.js +9 -14
  103. package/core/MeshTransmissionMaterial.d.ts +2 -2
  104. package/core/MeshTransmissionMaterial.js +32 -33
  105. package/core/MeshWobbleMaterial.d.ts +2 -2
  106. package/core/MeshWobbleMaterial.js +0 -7
  107. package/core/MotionPathControls.cjs.js +1 -0
  108. package/core/MotionPathControls.d.ts +15 -0
  109. package/core/MotionPathControls.js +114 -0
  110. package/core/OrbitControls.d.ts +2 -2
  111. package/core/OrbitControls.js +0 -4
  112. package/core/OrthographicCamera.d.ts +1 -1
  113. package/core/OrthographicCamera.js +2 -3
  114. package/core/Outlines.cjs.js +1 -1
  115. package/core/Outlines.d.ts +4 -3
  116. package/core/Outlines.js +5 -8
  117. package/core/PerformanceMonitor.d.ts +4 -4
  118. package/core/PerformanceMonitor.js +8 -12
  119. package/core/PerspectiveCamera.d.ts +1 -1
  120. package/core/PerspectiveCamera.js +2 -3
  121. package/core/PointMaterial.d.ts +1 -1
  122. package/core/PointMaterial.js +0 -2
  123. package/core/PointerLockControls.d.ts +1 -1
  124. package/core/PointerLockControls.js +4 -6
  125. package/core/Points.d.ts +2 -2
  126. package/core/Points.js +6 -23
  127. package/core/PositionalAudio.d.ts +1 -1
  128. package/core/PositionalAudio.js +0 -5
  129. package/core/Preload.d.ts +1 -1
  130. package/core/Preload.js +8 -9
  131. package/core/QuadraticBezierLine.d.ts +2 -2
  132. package/core/QuadraticBezierLine.js +0 -2
  133. package/core/Reflector.d.ts +1 -1
  134. package/core/Reflector.js +11 -12
  135. package/core/RenderTexture.d.ts +1 -1
  136. package/core/RenderTexture.js +9 -11
  137. package/core/Resize.d.ts +2 -2
  138. package/core/RoundedBox.cjs.js +1 -1
  139. package/core/RoundedBox.d.ts +1 -1
  140. package/core/RoundedBox.js +1 -3
  141. package/core/Sampler.d.ts +5 -5
  142. package/core/Sampler.js +0 -10
  143. package/core/ScreenQuad.d.ts +1 -1
  144. package/core/ScreenQuad.js +0 -1
  145. package/core/ScreenSpace.d.ts +1 -1
  146. package/core/Segments.d.ts +2 -2
  147. package/core/Segments.js +0 -6
  148. package/core/Shadow.d.ts +1 -1
  149. package/core/Sky.d.ts +1 -1
  150. package/core/Sparkles.js +0 -10
  151. package/core/SpotLight.d.ts +2 -2
  152. package/core/SpotLight.js +3 -10
  153. package/core/SpriteAnimator.d.ts +1 -1
  154. package/core/SpriteAnimator.js +16 -34
  155. package/core/Stage.d.ts +4 -4
  156. package/core/Stage.js +2 -4
  157. package/core/Stars.d.ts +1 -1
  158. package/core/Stars.js +2 -11
  159. package/core/Stats.d.ts +1 -1
  160. package/core/Stats.js +2 -2
  161. package/core/StatsGl.d.ts +1 -1
  162. package/core/StatsGl.js +4 -3
  163. package/core/Svg.js +0 -2
  164. package/core/Text.d.ts +1 -1
  165. package/core/Text3D.d.ts +1 -1
  166. package/core/Text3D.js +1 -3
  167. package/core/TrackballControls.d.ts +1 -1
  168. package/core/TrackballControls.js +0 -1
  169. package/core/Trail.d.ts +3 -3
  170. package/core/Trail.js +6 -17
  171. package/core/TransformControls.d.ts +1 -1
  172. package/core/TransformControls.js +3 -9
  173. package/core/Wireframe.d.ts +1 -1
  174. package/core/Wireframe.js +0 -28
  175. package/core/index.cjs.js +1 -1
  176. package/core/index.d.ts +1 -0
  177. package/core/index.js +1 -0
  178. package/core/meshBounds.js +4 -14
  179. package/core/shaderMaterial.js +10 -9
  180. package/core/shapes.d.ts +2 -2
  181. package/core/shapes.js +3 -6
  182. package/core/softShadows.d.ts +1 -1
  183. package/core/softShadows.js +1 -4
  184. package/core/useAnimations.d.ts +1 -1
  185. package/core/useAnimations.js +2 -4
  186. package/core/useBVH.d.ts +1 -1
  187. package/core/useBVH.js +3 -4
  188. package/core/useBoxProjectedEnv.js +15 -22
  189. package/core/useCamera.js +0 -1
  190. package/core/useContextBridge.js +1 -2
  191. package/core/useCubeCamera.d.ts +1 -1
  192. package/core/useCubeTexture.d.ts +1 -1
  193. package/core/useCubeTexture.js +4 -3
  194. package/core/useEnvironment.cjs.js +1 -1
  195. package/core/useEnvironment.d.ts +2 -2
  196. package/core/useEnvironment.js +9 -11
  197. package/core/useFBO.d.ts +1 -1
  198. package/core/useFBO.js +3 -12
  199. package/core/useFBX.js +0 -2
  200. package/core/useFont.d.ts +2 -2
  201. package/core/useFont.js +0 -4
  202. package/core/useGLTF.d.ts +2 -2
  203. package/core/useGLTF.js +0 -8
  204. package/core/useHelper.d.ts +3 -3
  205. package/core/useHelper.js +2 -5
  206. package/core/useIntersect.js +5 -8
  207. package/core/useKTX2.js +3 -5
  208. package/core/useMatcapTexture.js +0 -6
  209. package/core/useNormalTexture.d.ts +1 -1
  210. package/core/useProgress.d.ts +1 -1
  211. package/core/useProgress.js +0 -5
  212. package/core/useTexture.js +4 -6
  213. package/core/useTrailTexture.d.ts +1 -1
  214. package/core/useTrailTexture.js +10 -21
  215. package/helpers/environment-assets.d.ts +1 -1
  216. package/helpers/ts-utils.d.ts +2 -2
  217. package/helpers/useEffectfulState.d.ts +1 -1
  218. package/helpers/useEffectfulState.js +0 -1
  219. package/index.cjs.js +1 -1
  220. package/index.js +1 -0
  221. package/materials/BlurPass.js +2 -5
  222. package/materials/ConvolutionMaterial.js +0 -3
  223. package/materials/MeshReflectorMaterial.d.ts +1 -1
  224. package/materials/MeshReflectorMaterial.js +0 -34
  225. package/materials/MeshRefractionMaterial.js +2 -6
  226. package/materials/SpotLightMaterial.js +2 -7
  227. package/materials/WireframeMaterial.js +7 -25
  228. package/native/index.cjs.js +1 -1
  229. package/native/index.js +1 -0
  230. package/package.json +2 -2
  231. package/react-three-drei-0.0.0-semantic-release.tgz +0 -0
  232. package/web/CycleRaycast.d.ts +1 -1
  233. package/web/CycleRaycast.js +20 -24
  234. package/web/Html.d.ts +2 -2
  235. package/web/Html.js +6 -50
  236. package/web/KeyboardControls.d.ts +10 -10
  237. package/web/KeyboardControls.js +9 -6
  238. package/web/Loader.d.ts +2 -2
  239. package/web/Loader.js +8 -5
  240. package/web/PresentationControls.d.ts +2 -2
  241. package/web/PresentationControls.js +2 -1
  242. package/web/ScrollControls.d.ts +4 -4
  243. package/web/ScrollControls.js +5 -16
  244. package/web/Select.d.ts +3 -3
  245. package/web/Select.js +6 -17
  246. package/web/View.d.ts +5 -5
  247. package/web/View.js +7 -20
  248. package/web/index.cjs.js +1 -1
  249. package/web/index.js +1 -0
  250. package/web/pivotControls/AxisArrow.js +6 -15
  251. package/web/pivotControls/AxisRotator.js +8 -23
  252. package/web/pivotControls/PlaneSlider.js +6 -16
  253. package/web/pivotControls/context.d.ts +2 -2
  254. package/web/pivotControls/index.d.ts +1 -1
  255. package/web/pivotControls/index.js +2 -9
@@ -10,7 +10,6 @@ import { context } from './context.js';
10
10
  const tV0 = new THREE.Vector3();
11
11
  const tV1 = new THREE.Vector3();
12
12
  const tV2 = new THREE.Vector3();
13
-
14
13
  const getPoint2 = (point3, camera, size) => {
15
14
  const widthHalf = size.width / 2;
16
15
  const heightHalf = size.height / 2;
@@ -20,23 +19,19 @@ const getPoint2 = (point3, camera, size) => {
20
19
  vector.y = -(vector.y * heightHalf) + heightHalf;
21
20
  return vector;
22
21
  };
23
-
24
22
  const getPoint3 = (point2, camera, size, zValue = 1) => {
25
23
  const vector = tV0.set(point2.x / size.width * 2 - 1, -(point2.y / size.height) * 2 + 1, zValue);
26
24
  vector.unproject(camera);
27
25
  return vector;
28
26
  };
29
-
30
27
  const calculateScaleFactor = (point3, radiusPx, camera, size) => {
31
28
  const point2 = getPoint2(tV2.copy(point3), camera, size);
32
29
  let scale = 0;
33
-
34
30
  for (let i = 0; i < 2; ++i) {
35
31
  const point2off = tV1.copy(point2).setComponent(i, point2.getComponent(i) + radiusPx);
36
32
  const point3off = getPoint3(point2off, camera, size, point2off.z);
37
33
  scale = Math.max(scale, point3.distanceTo(point3off));
38
34
  }
39
-
40
35
  return scale;
41
36
  };
42
37
  const mL0 = new THREE.Matrix4();
@@ -120,8 +115,8 @@ const PivotControls = /*#__PURE__*/React.forwardRef(({
120
115
  },
121
116
  onDrag: mdW => {
122
117
  mP.copy(parentRef.current.matrixWorld);
123
- mPInv.copy(mP).invert(); // After applying the delta
124
-
118
+ mPInv.copy(mP).invert();
119
+ // After applying the delta
125
120
  mW.copy(mW0).premultiply(mdW);
126
121
  mL.copy(mW).premultiply(mPInv);
127
122
  mL0Inv.copy(mL0).invert();
@@ -152,10 +147,8 @@ const PivotControls = /*#__PURE__*/React.forwardRef(({
152
147
  useFrame(state => {
153
148
  if (fixed) {
154
149
  const sf = calculateScaleFactor(gizmoRef.current.getWorldPosition(vec), scale, state.camera, state.size);
155
-
156
150
  if (gizmoRef.current) {
157
151
  var _gizmoRef$current, _gizmoRef$current2, _gizmoRef$current3;
158
-
159
152
  if (((_gizmoRef$current = gizmoRef.current) == null ? void 0 : _gizmoRef$current.scale.x) !== sf || ((_gizmoRef$current2 = gizmoRef.current) == null ? void 0 : _gizmoRef$current2.scale.y) !== sf || ((_gizmoRef$current3 = gizmoRef.current) == null ? void 0 : _gizmoRef$current3.scale.z) !== sf) {
160
153
  gizmoRef.current.scale.setScalar(sf);
161
154
  state.invalidate();