@react-three/drei 10.7.7 → 11.0.0-alpha.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.
- package/README.md +49 -758
- package/_chunks/hls.mjs +3 -0
- package/_chunks/libs/@mediapipe/tasks-vision.mjs +4781 -0
- package/_chunks/libs/@monogrid/gainmap-js.mjs +1137 -0
- package/_chunks/libs/@use-gesture/core.mjs +1650 -0
- package/_chunks/libs/@use-gesture/react.mjs +207 -0
- package/_chunks/libs/camera-controls.mjs +2207 -0
- package/_chunks/libs/detect-gpu.mjs +515 -0
- package/_chunks/libs/hls.js.mjs +21925 -0
- package/_chunks/libs/maath.mjs +5200 -0
- package/_chunks/libs/stats-gl.mjs +301 -0
- package/_chunks/libs/stats.js.mjs +90 -0
- package/_chunks/libs/suspend-react.mjs +60 -0
- package/_chunks/libs/three.mjs +23169 -0
- package/_chunks/libs/tunnel-rat.mjs +458 -0
- package/_chunks/libs/zustand.mjs +104 -0
- package/_chunks/rolldown-runtime.mjs +47 -0
- package/_chunks/vision_bundle.mjs +3 -0
- package/core/_chunks/hls.mjs +3 -0
- package/core/_chunks/libs/@monogrid/gainmap-js.mjs +1137 -0
- package/core/_chunks/libs/@use-gesture/core.mjs +1650 -0
- package/core/_chunks/libs/@use-gesture/react.mjs +207 -0
- package/core/_chunks/libs/detect-gpu.mjs +515 -0
- package/core/_chunks/libs/hls.js.mjs +21925 -0
- package/core/_chunks/libs/maath.mjs +5200 -0
- package/core/_chunks/libs/stats-gl.mjs +301 -0
- package/core/_chunks/libs/stats.js.mjs +90 -0
- package/core/_chunks/libs/suspend-react.mjs +60 -0
- package/core/_chunks/libs/three.mjs +22457 -0
- package/core/_chunks/libs/tunnel-rat.mjs +458 -0
- package/core/_chunks/libs/zustand.mjs +104 -0
- package/core/_chunks/rolldown-runtime.mjs +47 -0
- package/core/core/index.d.mts +2232 -0
- package/core/core/index.mjs +11082 -0
- package/experimental/_chunks/libs/three.mjs +15386 -0
- package/experimental/experimental/index.d.mts +253 -0
- package/experimental/experimental/index.mjs +434 -0
- package/external/_chunks/hls.mjs +3 -0
- package/external/_chunks/libs/@mediapipe/tasks-vision.mjs +4781 -0
- package/external/_chunks/libs/camera-controls.mjs +2207 -0
- package/external/_chunks/libs/hls.js.mjs +21925 -0
- package/external/_chunks/libs/maath.mjs +5200 -0
- package/external/_chunks/libs/suspend-react.mjs +58 -0
- package/external/_chunks/libs/three.mjs +15387 -0
- package/external/_chunks/rolldown-runtime.mjs +32 -0
- package/external/_chunks/vision_bundle.mjs +3 -0
- package/external/external/index.d.mts +499 -0
- package/external/external/index.mjs +9422 -0
- package/index.d.mts +2567 -0
- package/index.mjs +20571 -0
- package/legacy/_chunks/hls.mjs +3 -0
- package/legacy/_chunks/libs/@monogrid/gainmap-js.mjs +1137 -0
- package/legacy/_chunks/libs/@use-gesture/core.mjs +1650 -0
- package/legacy/_chunks/libs/@use-gesture/react.mjs +207 -0
- package/legacy/_chunks/libs/bidi-js.mjs +675 -0
- package/legacy/_chunks/libs/detect-gpu.mjs +515 -0
- package/legacy/_chunks/libs/hls.js.mjs +21925 -0
- package/legacy/_chunks/libs/maath.mjs +5200 -0
- package/legacy/_chunks/libs/stats-gl.mjs +301 -0
- package/legacy/_chunks/libs/stats.js.mjs +90 -0
- package/legacy/_chunks/libs/suspend-react.mjs +60 -0
- package/legacy/_chunks/libs/three.mjs +26062 -0
- package/legacy/_chunks/libs/troika-three-text.mjs +6494 -0
- package/legacy/_chunks/libs/tunnel-rat.mjs +458 -0
- package/legacy/_chunks/libs/zustand.mjs +104 -0
- package/legacy/_chunks/rolldown-runtime.mjs +47 -0
- package/legacy/legacy/index.d.mts +2788 -0
- package/legacy/legacy/index.mjs +14984 -0
- package/native/_chunks/hls.mjs +3 -0
- package/native/_chunks/libs/@monogrid/gainmap-js.mjs +1137 -0
- package/native/_chunks/libs/@use-gesture/core.mjs +1650 -0
- package/native/_chunks/libs/@use-gesture/react.mjs +207 -0
- package/native/_chunks/libs/detect-gpu.mjs +515 -0
- package/native/_chunks/libs/hls.js.mjs +21925 -0
- package/native/_chunks/libs/maath.mjs +5200 -0
- package/native/_chunks/libs/stats-gl.mjs +301 -0
- package/native/_chunks/libs/stats.js.mjs +90 -0
- package/native/_chunks/libs/suspend-react.mjs +60 -0
- package/native/_chunks/libs/three.mjs +22592 -0
- package/native/_chunks/libs/tunnel-rat.mjs +458 -0
- package/native/_chunks/libs/zustand.mjs +104 -0
- package/native/_chunks/rolldown-runtime.mjs +47 -0
- package/native/native/index.d.mts +3168 -0
- package/native/native/index.mjs +14863 -0
- package/package.json +41 -10
- package/webgpu/_chunks/hls.mjs +3 -0
- package/webgpu/_chunks/libs/@monogrid/gainmap-js.mjs +1137 -0
- package/webgpu/_chunks/libs/@use-gesture/core.mjs +1650 -0
- package/webgpu/_chunks/libs/@use-gesture/react.mjs +207 -0
- package/webgpu/_chunks/libs/detect-gpu.mjs +515 -0
- package/webgpu/_chunks/libs/hls.js.mjs +21925 -0
- package/webgpu/_chunks/libs/maath.mjs +5200 -0
- package/webgpu/_chunks/libs/stats-gl.mjs +301 -0
- package/webgpu/_chunks/libs/stats.js.mjs +90 -0
- package/webgpu/_chunks/libs/suspend-react.mjs +60 -0
- package/webgpu/_chunks/libs/three.mjs +22592 -0
- package/webgpu/_chunks/libs/tunnel-rat.mjs +458 -0
- package/webgpu/_chunks/libs/zustand.mjs +104 -0
- package/webgpu/_chunks/rolldown-runtime.mjs +47 -0
- package/webgpu/webgpu/index.d.mts +3166 -0
- package/webgpu/webgpu/index.mjs +15015 -0
- package/core/AccumulativeShadows.cjs.js +0 -1
- package/core/AccumulativeShadows.d.ts +0 -59
- package/core/AccumulativeShadows.js +0 -310
- package/core/AdaptiveDpr.cjs.js +0 -1
- package/core/AdaptiveDpr.d.ts +0 -3
- package/core/AdaptiveDpr.js +0 -28
- package/core/AdaptiveEvents.cjs.js +0 -1
- package/core/AdaptiveEvents.d.ts +0 -1
- package/core/AdaptiveEvents.js +0 -20
- package/core/ArcballControls.cjs.js +0 -1
- package/core/ArcballControls.d.ts +0 -15
- package/core/ArcballControls.js +0 -67
- package/core/AsciiRenderer.cjs.js +0 -1
- package/core/AsciiRenderer.d.ts +0 -11
- package/core/AsciiRenderer.js +0 -66
- package/core/BBAnchor.cjs.js +0 -1
- package/core/BBAnchor.d.ts +0 -7
- package/core/BBAnchor.js +0 -37
- package/core/Backdrop.cjs.js +0 -1
- package/core/Backdrop.d.ts +0 -15
- package/core/Backdrop.js +0 -33
- package/core/BakeShadows.cjs.js +0 -1
- package/core/BakeShadows.d.ts +0 -1
- package/core/BakeShadows.js +0 -16
- package/core/Billboard.cjs.js +0 -1
- package/core/Billboard.d.ts +0 -10
- package/core/Billboard.js +0 -53
- package/core/Bounds.cjs.js +0 -1
- package/core/Bounds.d.ts +0 -36
- package/core/Bounds.js +0 -254
- package/core/Bvh.cjs.js +0 -1
- package/core/Bvh.d.ts +0 -19
- package/core/Bvh.js +0 -92
- package/core/CameraControls.cjs.js +0 -1
- package/core/CameraControls.d.ts +0 -48
- package/core/CameraControls.js +0 -151
- package/core/CameraShake.cjs.js +0 -1
- package/core/CameraShake.d.ts +0 -17
- package/core/CameraShake.js +0 -57
- package/core/CatmullRomLine.cjs.js +0 -1
- package/core/CatmullRomLine.d.ts +0 -10
- package/core/CatmullRomLine.js +0 -42
- package/core/Caustics.cjs.js +0 -1
- package/core/Caustics.d.ts +0 -32
- package/core/Caustics.js +0 -388
- package/core/Center.cjs.js +0 -1
- package/core/Center.d.ts +0 -33
- package/core/Center.js +0 -67
- package/core/Clone.cjs.js +0 -1
- package/core/Clone.d.ts +0 -15
- package/core/Clone.js +0 -100
- package/core/Cloud.cjs.js +0 -1
- package/core/Cloud.d.ts +0 -97
- package/core/Cloud.js +0 -231
- package/core/ComputedAttribute.cjs.js +0 -1
- package/core/ComputedAttribute.d.ts +0 -8
- package/core/ComputedAttribute.js +0 -33
- package/core/ContactShadows.cjs.js +0 -1
- package/core/ContactShadows.d.ts +0 -18
- package/core/ContactShadows.js +0 -114
- package/core/CubeCamera.cjs.js +0 -1
- package/core/CubeCamera.d.ts +0 -21
- package/core/CubeCamera.js +0 -86
- package/core/CubeTexture.cjs.js +0 -1
- package/core/CubeTexture.d.ts +0 -14
- package/core/CubeTexture.js +0 -25
- package/core/CubicBezierLine.cjs.js +0 -1
- package/core/CubicBezierLine.d.ts +0 -12
- package/core/CubicBezierLine.js +0 -28
- package/core/CurveModifier.cjs.js +0 -1
- package/core/CurveModifier.d.ts +0 -11
- package/core/CurveModifier.js +0 -27
- package/core/Decal.cjs.js +0 -1
- package/core/Decal.d.ts +0 -16
- package/core/Decal.js +0 -128
- package/core/Detailed.cjs.js +0 -1
- package/core/Detailed.d.ts +0 -10
- package/core/Detailed.js +0 -33
- package/core/DetectGPU.cjs.js +0 -1
- package/core/DetectGPU.d.ts +0 -7
- package/core/DetectGPU.js +0 -14
- package/core/DeviceOrientationControls.cjs.js +0 -1
- package/core/DeviceOrientationControls.d.ts +0 -10
- package/core/DeviceOrientationControls.js +0 -51
- package/core/Edges.cjs.js +0 -1
- package/core/Edges.d.ts +0 -13
- package/core/Edges.js +0 -38
- package/core/Effects.cjs.js +0 -1
- package/core/Effects.d.ts +0 -25
- package/core/Effects.js +0 -91
- package/core/Environment.cjs.js +0 -1
- package/core/Environment.d.ts +0 -37
- package/core/Environment.js +0 -189
- package/core/Example.cjs.js +0 -1
- package/core/Example.d.ts +0 -13
- package/core/Example.js +0 -46
- package/core/Fbo.cjs.js +0 -1
- package/core/Fbo.d.ts +0 -22
- package/core/Fbo.js +0 -63
- package/core/Fbx.cjs.js +0 -1
- package/core/Fbx.d.ts +0 -11
- package/core/Fbx.js +0 -23
- package/core/FirstPersonControls.cjs.js +0 -1
- package/core/FirstPersonControls.d.ts +0 -8
- package/core/FirstPersonControls.js +0 -38
- package/core/Fisheye.cjs.js +0 -1
- package/core/Fisheye.d.ts +0 -10
- package/core/Fisheye.js +0 -95
- package/core/Float.cjs.js +0 -1
- package/core/Float.d.ts +0 -14
- package/core/Float.js +0 -37
- package/core/FlyControls.cjs.js +0 -1
- package/core/FlyControls.d.ts +0 -10
- package/core/FlyControls.js +0 -55
- package/core/GizmoHelper.cjs.js +0 -1
- package/core/GizmoHelper.d.ts +0 -16
- package/core/GizmoHelper.js +0 -116
- package/core/GizmoViewcube.cjs.js +0 -1
- package/core/GizmoViewcube.d.ts +0 -14
- package/core/GizmoViewcube.js +0 -133
- package/core/GizmoViewport.cjs.js +0 -1
- package/core/GizmoViewport.d.ts +0 -16
- package/core/GizmoViewport.js +0 -140
- package/core/Gltf.cjs.js +0 -1
- package/core/Gltf.d.ts +0 -27
- package/core/Gltf.js +0 -52
- package/core/GradientTexture.cjs.js +0 -1
- package/core/GradientTexture.d.ts +0 -18
- package/core/GradientTexture.js +0 -54
- package/core/Grid.cjs.js +0 -1
- package/core/Grid.d.ts +0 -26
- package/core/Grid.js +0 -142
- package/core/Helper.cjs.js +0 -1
- package/core/Helper.d.ts +0 -16
- package/core/Helper.js +0 -47
- package/core/Hud.cjs.js +0 -1
- package/core/Hud.d.ts +0 -6
- package/core/Hud.js +0 -55
- package/core/Image.cjs.js +0 -1
- package/core/Image.d.ts +0 -38
- package/core/Image.js +0 -160
- package/core/Instances.cjs.js +0 -1
- package/core/Instances.d.ts +0 -64
- package/core/Instances.js +0 -313
- package/core/Ktx2.cjs.js +0 -1
- package/core/Ktx2.d.ts +0 -14
- package/core/Ktx2.js +0 -48
- package/core/Lightformer.cjs.js +0 -1
- package/core/Lightformer.d.ts +0 -15
- package/core/Lightformer.js +0 -63
- package/core/Line.cjs.js +0 -1
- package/core/Line.d.ts +0 -13
- package/core/Line.js +0 -73
- package/core/MapControls.cjs.js +0 -1
- package/core/MapControls.d.ts +0 -14
- package/core/MapControls.js +0 -63
- package/core/MarchingCubes.cjs.js +0 -1
- package/core/MarchingCubes.d.ts +0 -24
- package/core/MarchingCubes.js +0 -78
- package/core/Mask.cjs.js +0 -1
- package/core/Mask.d.ts +0 -17
- package/core/Mask.js +0 -42
- package/core/MatcapTexture.cjs.js +0 -1
- package/core/MatcapTexture.d.ts +0 -9
- package/core/MatcapTexture.js +0 -51
- package/core/MeshDiscardMaterial.cjs.js +0 -1
- package/core/MeshDiscardMaterial.d.ts +0 -10
- package/core/MeshDiscardMaterial.js +0 -15
- package/core/MeshDistortMaterial.cjs.js +0 -1
- package/core/MeshDistortMaterial.d.ts +0 -39
- package/core/MeshDistortMaterial.js +0 -72
- package/core/MeshPortalMaterial.cjs.js +0 -1
- package/core/MeshPortalMaterial.d.ts +0 -25
- package/core/MeshPortalMaterial.js +0 -467
- package/core/MeshReflectorMaterial.cjs.js +0 -1
- package/core/MeshReflectorMaterial.d.ts +0 -14
- package/core/MeshReflectorMaterial.js +0 -180
- package/core/MeshRefractionMaterial.cjs.js +0 -1
- package/core/MeshRefractionMaterial.d.ts +0 -19
- package/core/MeshRefractionMaterial.js +0 -73
- package/core/MeshTransmissionMaterial.cjs.js +0 -1
- package/core/MeshTransmissionMaterial.d.ts +0 -34
- package/core/MeshTransmissionMaterial.js +0 -402
- package/core/MeshWobbleMaterial.cjs.js +0 -1
- package/core/MeshWobbleMaterial.d.ts +0 -36
- package/core/MeshWobbleMaterial.js +0 -60
- package/core/MotionPathControls.cjs.js +0 -1
- package/core/MotionPathControls.d.ts +0 -33
- package/core/MotionPathControls.js +0 -121
- package/core/MultiMaterial.cjs.js +0 -1
- package/core/MultiMaterial.d.ts +0 -4
- package/core/MultiMaterial.js +0 -29
- package/core/NormalTexture.cjs.js +0 -1
- package/core/NormalTexture.d.ts +0 -14
- package/core/NormalTexture.js +0 -42
- package/core/OrbitControls.cjs.js +0 -1
- package/core/OrbitControls.d.ts +0 -22
- package/core/OrbitControls.js +0 -79
- package/core/OrthographicCamera.cjs.js +0 -1
- package/core/OrthographicCamera.d.ts +0 -14
- package/core/OrthographicCamera.js +0 -76
- package/core/Outlines.cjs.js +0 -1
- package/core/Outlines.d.ts +0 -17
- package/core/Outlines.js +0 -166
- package/core/PerformanceMonitor.cjs.js +0 -1
- package/core/PerformanceMonitor.d.ts +0 -36
- package/core/PerformanceMonitor.js +0 -116
- package/core/PerspectiveCamera.cjs.js +0 -1
- package/core/PerspectiveCamera.d.ts +0 -14
- package/core/PerspectiveCamera.js +0 -72
- package/core/PointMaterial.cjs.js +0 -1
- package/core/PointMaterial.d.ts +0 -8
- package/core/PointMaterial.js +0 -36
- package/core/PointerLockControls.cjs.js +0 -1
- package/core/PointerLockControls.d.ts +0 -15
- package/core/PointerLockControls.js +0 -89
- package/core/Points.cjs.js +0 -1
- package/core/Points.d.ts +0 -31
- package/core/Points.js +0 -202
- package/core/PositionalAudio.cjs.js +0 -1
- package/core/PositionalAudio.d.ts +0 -9
- package/core/PositionalAudio.js +0 -46
- package/core/Preload.cjs.js +0 -1
- package/core/Preload.d.ts +0 -7
- package/core/Preload.js +0 -44
- package/core/Progress.cjs.js +0 -1
- package/core/Progress.d.ts +0 -14
- package/core/Progress.js +0 -55
- package/core/QuadraticBezierLine.cjs.js +0 -1
- package/core/QuadraticBezierLine.d.ts +0 -14
- package/core/QuadraticBezierLine.js +0 -42
- package/core/RenderCubeTexture.cjs.js +0 -1
- package/core/RenderCubeTexture.d.ts +0 -30
- package/core/RenderCubeTexture.js +0 -96
- package/core/RenderTexture.cjs.js +0 -1
- package/core/RenderTexture.d.ts +0 -18
- package/core/RenderTexture.js +0 -105
- package/core/Resize.cjs.js +0 -1
- package/core/Resize.d.ts +0 -17
- package/core/Resize.js +0 -39
- package/core/RoundedBox.cjs.js +0 -1
- package/core/RoundedBox.d.ts +0 -14
- package/core/RoundedBox.js +0 -70
- package/core/Sampler.cjs.js +0 -1
- package/core/Sampler.d.ts +0 -28
- package/core/Sampler.js +0 -75
- package/core/ScreenQuad.cjs.js +0 -1
- package/core/ScreenQuad.d.ts +0 -5
- package/core/ScreenQuad.js +0 -25
- package/core/ScreenSizer.cjs.js +0 -1
- package/core/ScreenSizer.d.ts +0 -7
- package/core/ScreenSizer.js +0 -39
- package/core/ScreenSpace.cjs.js +0 -1
- package/core/ScreenSpace.d.ts +0 -7
- package/core/ScreenSpace.js +0 -25
- package/core/Segments.cjs.js +0 -1
- package/core/Segments.d.ts +0 -29
- package/core/Segments.js +0 -96
- package/core/Shadow.cjs.js +0 -1
- package/core/Shadow.d.ts +0 -12
- package/core/Shadow.js +0 -42
- package/core/ShadowAlpha.cjs.js +0 -1
- package/core/ShadowAlpha.d.ts +0 -7
- package/core/ShadowAlpha.js +0 -108
- package/core/Sky.cjs.js +0 -1
- package/core/Sky.d.ts +0 -16
- package/core/Sky.js +0 -39
- package/core/Sparkles.cjs.js +0 -1
- package/core/Sparkles.d.ts +0 -26
- package/core/Sparkles.js +0 -161
- package/core/Splat.cjs.js +0 -1
- package/core/Splat.d.ts +0 -56
- package/core/Splat.js +0 -506
- package/core/SpotLight.cjs.js +0 -1
- package/core/SpotLight.d.ts +0 -27
- package/core/SpotLight.js +0 -223
- package/core/SpriteAnimator.cjs.js +0 -1
- package/core/SpriteAnimator.d.ts +0 -88
- package/core/SpriteAnimator.js +0 -413
- package/core/Stage.cjs.js +0 -1
- package/core/Stage.d.ts +0 -27
- package/core/Stage.js +0 -133
- package/core/Stars.cjs.js +0 -1
- package/core/Stars.d.ts +0 -22
- package/core/Stars.js +0 -100
- package/core/Stats.cjs.js +0 -1
- package/core/Stats.d.ts +0 -7
- package/core/Stats.js +0 -32
- package/core/StatsGl.cjs.js +0 -1
- package/core/StatsGl.d.ts +0 -14
- package/core/StatsGl.js +0 -44
- package/core/Svg.cjs.js +0 -1
- package/core/Svg.d.ts +0 -13
- package/core/Svg.js +0 -62
- package/core/Text.cjs.js +0 -1
- package/core/Text.d.ts +0 -38
- package/core/Text.js +0 -57
- package/core/Text3D.cjs.js +0 -1
- package/core/Text3D.d.ts +0 -20
- package/core/Text3D.js +0 -74
- package/core/Texture.cjs.js +0 -1
- package/core/Texture.d.ts +0 -20
- package/core/Texture.js +0 -60
- package/core/TrackballControls.cjs.js +0 -1
- package/core/TrackballControls.d.ts +0 -15
- package/core/TrackballControls.js +0 -72
- package/core/Trail.cjs.js +0 -1
- package/core/Trail.d.ts +0 -21
- package/core/Trail.js +0 -150
- package/core/TrailTexture.cjs.js +0 -1
- package/core/TrailTexture.d.ts +0 -19
- package/core/TrailTexture.js +0 -159
- package/core/TransformControls.cjs.js +0 -1
- package/core/TransformControls.d.ts +0 -28
- package/core/TransformControls.js +0 -114
- package/core/VideoTexture.cjs.js +0 -1
- package/core/VideoTexture.d.ts +0 -26
- package/core/VideoTexture.js +0 -111
- package/core/Wireframe.cjs.js +0 -1
- package/core/Wireframe.d.ts +0 -15
- package/core/Wireframe.js +0 -157
- package/core/calculateScaleFactor.cjs.js +0 -1
- package/core/calculateScaleFactor.d.ts +0 -3
- package/core/calculateScaleFactor.js +0 -31
- package/core/index.cjs.js +0 -1
- package/core/index.d.ts +0 -122
- package/core/index.js +0 -150
- package/core/meshBounds.cjs.js +0 -1
- package/core/meshBounds.d.ts +0 -2
- package/core/meshBounds.js +0 -28
- package/core/shaderMaterial.cjs.js +0 -1
- package/core/shaderMaterial.d.ts +0 -9
- package/core/shaderMaterial.js +0 -29
- package/core/shapes.cjs.js +0 -1
- package/core/shapes.d.ts +0 -26
- package/core/shapes.js +0 -65
- package/core/softShadows.cjs.js +0 -1
- package/core/softShadows.d.ts +0 -6
- package/core/softShadows.js +0 -158
- package/core/useAnimations.cjs.js +0 -1
- package/core/useAnimations.d.ts +0 -13
- package/core/useAnimations.js +0 -52
- package/core/useAspect.cjs.js +0 -1
- package/core/useAspect.d.ts +0 -1
- package/core/useAspect.js +0 -10
- package/core/useBoxProjectedEnv.cjs.js +0 -1
- package/core/useBoxProjectedEnv.d.ts +0 -19
- package/core/useBoxProjectedEnv.js +0 -95
- package/core/useCamera.cjs.js +0 -1
- package/core/useCamera.d.ts +0 -3
- package/core/useCamera.js +0 -19
- package/core/useContextBridge.cjs.js +0 -1
- package/core/useContextBridge.d.ts +0 -4
- package/core/useContextBridge.js +0 -20
- package/core/useDepthBuffer.cjs.js +0 -1
- package/core/useDepthBuffer.d.ts +0 -6
- package/core/useDepthBuffer.js +0 -38
- package/core/useEnvironment.cjs.js +0 -1
- package/core/useEnvironment.d.ts +0 -17
- package/core/useEnvironment.js +0 -150
- package/core/useFont.cjs.js +0 -1
- package/core/useFont.d.ts +0 -24
- package/core/useFont.js +0 -24
- package/core/useIntersect.cjs.js +0 -1
- package/core/useIntersect.d.ts +0 -3
- package/core/useIntersect.js +0 -36
- package/core/useSpriteLoader.cjs.js +0 -1
- package/core/useSpriteLoader.d.ts +0 -57
- package/core/useSpriteLoader.js +0 -402
- package/helpers/constants.cjs.js +0 -1
- package/helpers/constants.d.ts +0 -1
- package/helpers/constants.js +0 -6
- package/helpers/deprecated.cjs.js +0 -1
- package/helpers/deprecated.d.ts +0 -5
- package/helpers/deprecated.js +0 -8
- package/helpers/environment-assets.cjs.js +0 -1
- package/helpers/environment-assets.d.ts +0 -13
- package/helpers/environment-assets.js +0 -14
- package/helpers/glsl/DefaultSpotlightShadowShadows.glsl.js +0 -3
- package/helpers/glsl/distort.vert.glsl.js +0 -3
- package/helpers/ts-utils.cjs.js +0 -1
- package/helpers/ts-utils.d.ts +0 -7
- package/helpers/ts-utils.js +0 -1
- package/helpers/useEffectfulState.cjs.js +0 -1
- package/helpers/useEffectfulState.d.ts +0 -4
- package/helpers/useEffectfulState.js +0 -17
- package/index.cjs.js +0 -1
- package/index.d.ts +0 -1
- package/index.js +0 -139
- package/materials/BlurPass.cjs.js +0 -1
- package/materials/BlurPass.d.ts +0 -23
- package/materials/BlurPass.js +0 -72
- package/materials/ConvolutionMaterial.cjs.js +0 -1
- package/materials/ConvolutionMaterial.d.ts +0 -7
- package/materials/ConvolutionMaterial.js +0 -97
- package/materials/DiscardMaterial.cjs.js +0 -1
- package/materials/DiscardMaterial.d.ts +0 -3
- package/materials/DiscardMaterial.js +0 -5
- package/materials/MeshReflectorMaterial.cjs.js +0 -1
- package/materials/MeshReflectorMaterial.d.ts +0 -50
- package/materials/MeshReflectorMaterial.js +0 -256
- package/materials/MeshRefractionMaterial.cjs.js +0 -1
- package/materials/MeshRefractionMaterial.d.ts +0 -18
- package/materials/MeshRefractionMaterial.js +0 -163
- package/materials/SpotLightMaterial.cjs.js +0 -1
- package/materials/SpotLightMaterial.d.ts +0 -4
- package/materials/SpotLightMaterial.js +0 -115
- package/materials/WireframeMaterial.cjs.js +0 -1
- package/materials/WireframeMaterial.d.ts +0 -64
- package/materials/WireframeMaterial.js +0 -217
- package/native/index.cjs.js +0 -1
- package/native/index.d.ts +0 -1
- package/native/index.js +0 -150
- package/web/CycleRaycast.cjs.js +0 -1
- package/web/CycleRaycast.d.ts +0 -10
- package/web/CycleRaycast.js +0 -93
- package/web/DragControls.cjs.js +0 -1
- package/web/DragControls.d.ts +0 -17
- package/web/DragControls.js +0 -127
- package/web/FaceControls.cjs.js +0 -1
- package/web/FaceControls.d.ts +0 -29
- package/web/FaceControls.js +0 -236
- package/web/FaceLandmarker.cjs.js +0 -1
- package/web/FaceLandmarker.d.ts +0 -14
- package/web/FaceLandmarker.js +0 -49
- package/web/Facemesh.cjs.js +0 -1
- package/web/Facemesh.d.ts +0 -118
- package/web/Facemesh.js +0 -4538
- package/web/Html.cjs.js +0 -1
- package/web/Html.d.ts +0 -34
- package/web/Html.js +0 -375
- package/web/KeyboardControls.cjs.js +0 -1
- package/web/KeyboardControls.d.ts +0 -37
- package/web/KeyboardControls.js +0 -104
- package/web/Loader.cjs.js +0 -1
- package/web/Loader.d.ts +0 -12
- package/web/Loader.js +0 -101
- package/web/PresentationControls.cjs.js +0 -1
- package/web/PresentationControls.d.ts +0 -16
- package/web/PresentationControls.js +0 -79
- package/web/ScreenVideoTexture.cjs.js +0 -1
- package/web/ScreenVideoTexture.d.ts +0 -17
- package/web/ScreenVideoTexture.js +0 -30
- package/web/ScrollControls.cjs.js +0 -1
- package/web/ScrollControls.d.ts +0 -45
- package/web/ScrollControls.js +0 -237
- package/web/Select.cjs.js +0 -1
- package/web/Select.d.ts +0 -14
- package/web/Select.js +0 -171
- package/web/View.cjs.js +0 -1
- package/web/View.d.ts +0 -34
- package/web/View.js +0 -259
- package/web/WebcamVideoTexture.cjs.js +0 -1
- package/web/WebcamVideoTexture.d.ts +0 -17
- package/web/WebcamVideoTexture.js +0 -33
- package/web/index.cjs.js +0 -1
- package/web/index.d.ts +0 -17
- package/web/index.js +0 -176
- package/web/pivotControls/AxisArrow.cjs.js +0 -1
- package/web/pivotControls/AxisArrow.d.ts +0 -7
- package/web/pivotControls/AxisArrow.js +0 -193
- package/web/pivotControls/AxisRotator.cjs.js +0 -1
- package/web/pivotControls/AxisRotator.d.ts +0 -7
- package/web/pivotControls/AxisRotator.js +0 -220
- package/web/pivotControls/PlaneSlider.cjs.js +0 -1
- package/web/pivotControls/PlaneSlider.d.ts +0 -7
- package/web/pivotControls/PlaneSlider.js +0 -202
- package/web/pivotControls/ScalingSphere.cjs.js +0 -1
- package/web/pivotControls/ScalingSphere.d.ts +0 -7
- package/web/pivotControls/ScalingSphere.js +0 -192
- package/web/pivotControls/context.cjs.js +0 -1
- package/web/pivotControls/context.d.ts +0 -33
- package/web/pivotControls/context.js +0 -5
- package/web/pivotControls/index.cjs.js +0 -1
- package/web/pivotControls/index.d.ts +0 -39
- package/web/pivotControls/index.js +0 -213
- package/web/useCursor.cjs.js +0 -1
- package/web/useCursor.d.ts +0 -1
- package/web/useCursor.js +0 -12
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as THREE from 'three';
|
|
3
|
-
import { useThree } from '@react-three/fiber';
|
|
4
|
-
import { Line } from '../../core/Line.js';
|
|
5
|
-
import { Html } from '../Html.js';
|
|
6
|
-
import { context } from './context.js';
|
|
7
|
-
|
|
8
|
-
const decomposeIntoBasis = (e1, e2, offset) => {
|
|
9
|
-
const i1 = Math.abs(e1.x) >= Math.abs(e1.y) && Math.abs(e1.x) >= Math.abs(e1.z) ? 0 : Math.abs(e1.y) >= Math.abs(e1.x) && Math.abs(e1.y) >= Math.abs(e1.z) ? 1 : 2;
|
|
10
|
-
const e2DegrowthOrder = [0, 1, 2].sort((a, b) => Math.abs(e2.getComponent(b)) - Math.abs(e2.getComponent(a)));
|
|
11
|
-
const i2 = i1 === e2DegrowthOrder[0] ? e2DegrowthOrder[1] : e2DegrowthOrder[0];
|
|
12
|
-
const a1 = e1.getComponent(i1);
|
|
13
|
-
const a2 = e1.getComponent(i2);
|
|
14
|
-
const b1 = e2.getComponent(i1);
|
|
15
|
-
const b2 = e2.getComponent(i2);
|
|
16
|
-
const c1 = offset.getComponent(i1);
|
|
17
|
-
const c2 = offset.getComponent(i2);
|
|
18
|
-
const y = (c2 - c1 * (a2 / a1)) / (b2 - b1 * (a2 / a1));
|
|
19
|
-
const x = (c1 - y * b1) / a1;
|
|
20
|
-
return [x, y];
|
|
21
|
-
};
|
|
22
|
-
const ray = /* @__PURE__ */new THREE.Ray();
|
|
23
|
-
const intersection = /* @__PURE__ */new THREE.Vector3();
|
|
24
|
-
const offsetMatrix = /* @__PURE__ */new THREE.Matrix4();
|
|
25
|
-
const PlaneSlider = ({
|
|
26
|
-
dir1,
|
|
27
|
-
dir2,
|
|
28
|
-
axis
|
|
29
|
-
}) => {
|
|
30
|
-
const {
|
|
31
|
-
translation,
|
|
32
|
-
translationLimits,
|
|
33
|
-
annotations,
|
|
34
|
-
annotationsClass,
|
|
35
|
-
depthTest,
|
|
36
|
-
scale,
|
|
37
|
-
lineWidth,
|
|
38
|
-
fixed,
|
|
39
|
-
axisColors,
|
|
40
|
-
hoveredColor,
|
|
41
|
-
opacity,
|
|
42
|
-
renderOrder,
|
|
43
|
-
onDragStart,
|
|
44
|
-
onDrag,
|
|
45
|
-
onDragEnd,
|
|
46
|
-
userData
|
|
47
|
-
} = React.useContext(context);
|
|
48
|
-
const camControls = useThree(state => state.controls);
|
|
49
|
-
const divRef = React.useRef(null);
|
|
50
|
-
const objRef = React.useRef(null);
|
|
51
|
-
const clickInfo = React.useRef(null);
|
|
52
|
-
const offsetX0 = React.useRef(0);
|
|
53
|
-
const offsetY0 = React.useRef(0);
|
|
54
|
-
const [isHovered, setIsHovered] = React.useState(false);
|
|
55
|
-
const onPointerDown = React.useCallback(e => {
|
|
56
|
-
if (annotations) {
|
|
57
|
-
divRef.current.innerText = `${translation.current[(axis + 1) % 3].toFixed(2)}, ${translation.current[(axis + 2) % 3].toFixed(2)}`;
|
|
58
|
-
divRef.current.style.display = 'block';
|
|
59
|
-
}
|
|
60
|
-
e.stopPropagation();
|
|
61
|
-
const clickPoint = e.point.clone();
|
|
62
|
-
const origin = new THREE.Vector3().setFromMatrixPosition(objRef.current.matrixWorld);
|
|
63
|
-
const e1 = new THREE.Vector3().setFromMatrixColumn(objRef.current.matrixWorld, 0).normalize();
|
|
64
|
-
const e2 = new THREE.Vector3().setFromMatrixColumn(objRef.current.matrixWorld, 1).normalize();
|
|
65
|
-
const normal = new THREE.Vector3().setFromMatrixColumn(objRef.current.matrixWorld, 2).normalize();
|
|
66
|
-
const plane = new THREE.Plane().setFromNormalAndCoplanarPoint(normal, origin);
|
|
67
|
-
clickInfo.current = {
|
|
68
|
-
clickPoint,
|
|
69
|
-
e1,
|
|
70
|
-
e2,
|
|
71
|
-
plane
|
|
72
|
-
};
|
|
73
|
-
offsetX0.current = translation.current[(axis + 1) % 3];
|
|
74
|
-
offsetY0.current = translation.current[(axis + 2) % 3];
|
|
75
|
-
onDragStart({
|
|
76
|
-
component: 'Slider',
|
|
77
|
-
axis,
|
|
78
|
-
origin,
|
|
79
|
-
directions: [e1, e2, normal]
|
|
80
|
-
});
|
|
81
|
-
camControls && (camControls.enabled = false);
|
|
82
|
-
// @ts-ignore
|
|
83
|
-
e.target.setPointerCapture(e.pointerId);
|
|
84
|
-
}, [annotations, camControls, onDragStart, axis]);
|
|
85
|
-
const onPointerMove = React.useCallback(e => {
|
|
86
|
-
e.stopPropagation();
|
|
87
|
-
if (!isHovered) setIsHovered(true);
|
|
88
|
-
if (clickInfo.current) {
|
|
89
|
-
const {
|
|
90
|
-
clickPoint,
|
|
91
|
-
e1,
|
|
92
|
-
e2,
|
|
93
|
-
plane
|
|
94
|
-
} = clickInfo.current;
|
|
95
|
-
const [minX, maxX] = (translationLimits == null ? void 0 : translationLimits[(axis + 1) % 3]) || [undefined, undefined];
|
|
96
|
-
const [minY, maxY] = (translationLimits == null ? void 0 : translationLimits[(axis + 2) % 3]) || [undefined, undefined];
|
|
97
|
-
ray.copy(e.ray);
|
|
98
|
-
ray.intersectPlane(plane, intersection);
|
|
99
|
-
ray.direction.negate();
|
|
100
|
-
ray.intersectPlane(plane, intersection);
|
|
101
|
-
intersection.sub(clickPoint);
|
|
102
|
-
let [offsetX, offsetY] = decomposeIntoBasis(e1, e2, intersection);
|
|
103
|
-
/* let offsetY = (intersection.y - (intersection.x * e1.y) / e1.x) / (e2.y - (e2.x * e1.y) / e1.x)
|
|
104
|
-
let offsetX = (intersection.x - offsetY * e2.x) / e1.x */
|
|
105
|
-
if (minX !== undefined) {
|
|
106
|
-
offsetX = Math.max(offsetX, minX - offsetX0.current);
|
|
107
|
-
}
|
|
108
|
-
if (maxX !== undefined) {
|
|
109
|
-
offsetX = Math.min(offsetX, maxX - offsetX0.current);
|
|
110
|
-
}
|
|
111
|
-
if (minY !== undefined) {
|
|
112
|
-
offsetY = Math.max(offsetY, minY - offsetY0.current);
|
|
113
|
-
}
|
|
114
|
-
if (maxY !== undefined) {
|
|
115
|
-
offsetY = Math.min(offsetY, maxY - offsetY0.current);
|
|
116
|
-
}
|
|
117
|
-
translation.current[(axis + 1) % 3] = offsetX0.current + offsetX;
|
|
118
|
-
translation.current[(axis + 2) % 3] = offsetY0.current + offsetY;
|
|
119
|
-
if (annotations) {
|
|
120
|
-
divRef.current.innerText = `${translation.current[(axis + 1) % 3].toFixed(2)}, ${translation.current[(axis + 2) % 3].toFixed(2)}`;
|
|
121
|
-
}
|
|
122
|
-
offsetMatrix.makeTranslation(offsetX * e1.x + offsetY * e2.x, offsetX * e1.y + offsetY * e2.y, offsetX * e1.z + offsetY * e2.z);
|
|
123
|
-
onDrag(offsetMatrix);
|
|
124
|
-
}
|
|
125
|
-
}, [annotations, onDrag, isHovered, translation, translationLimits, axis]);
|
|
126
|
-
const onPointerUp = React.useCallback(e => {
|
|
127
|
-
if (annotations) {
|
|
128
|
-
divRef.current.style.display = 'none';
|
|
129
|
-
}
|
|
130
|
-
e.stopPropagation();
|
|
131
|
-
clickInfo.current = null;
|
|
132
|
-
onDragEnd();
|
|
133
|
-
camControls && (camControls.enabled = true);
|
|
134
|
-
// @ts-ignore
|
|
135
|
-
e.target.releasePointerCapture(e.pointerId);
|
|
136
|
-
}, [annotations, camControls, onDragEnd]);
|
|
137
|
-
const onPointerOut = React.useCallback(e => {
|
|
138
|
-
e.stopPropagation();
|
|
139
|
-
setIsHovered(false);
|
|
140
|
-
}, []);
|
|
141
|
-
const matrixL = React.useMemo(() => {
|
|
142
|
-
const dir1N = dir1.clone().normalize();
|
|
143
|
-
const dir2N = dir2.clone().normalize();
|
|
144
|
-
return new THREE.Matrix4().makeBasis(dir1N, dir2N, dir1N.clone().cross(dir2N));
|
|
145
|
-
}, [dir1, dir2]);
|
|
146
|
-
const pos1 = fixed ? 1 / 7 : scale / 7;
|
|
147
|
-
const length = fixed ? 0.225 : scale * 0.225;
|
|
148
|
-
const color = isHovered ? hoveredColor : axisColors[axis];
|
|
149
|
-
const points = React.useMemo(() => [new THREE.Vector3(0, 0, 0), new THREE.Vector3(0, length, 0), new THREE.Vector3(length, length, 0), new THREE.Vector3(length, 0, 0), new THREE.Vector3(0, 0, 0)], [length]);
|
|
150
|
-
return /*#__PURE__*/React.createElement("group", {
|
|
151
|
-
ref: objRef,
|
|
152
|
-
matrix: matrixL,
|
|
153
|
-
matrixAutoUpdate: false
|
|
154
|
-
}, annotations && /*#__PURE__*/React.createElement(Html, {
|
|
155
|
-
position: [0, 0, 0]
|
|
156
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
157
|
-
style: {
|
|
158
|
-
display: 'none',
|
|
159
|
-
background: '#151520',
|
|
160
|
-
color: 'white',
|
|
161
|
-
padding: '6px 8px',
|
|
162
|
-
borderRadius: 7,
|
|
163
|
-
whiteSpace: 'nowrap'
|
|
164
|
-
},
|
|
165
|
-
className: annotationsClass,
|
|
166
|
-
ref: divRef
|
|
167
|
-
})), /*#__PURE__*/React.createElement("group", {
|
|
168
|
-
position: [pos1 * 1.7, pos1 * 1.7, 0]
|
|
169
|
-
}, /*#__PURE__*/React.createElement("mesh", {
|
|
170
|
-
visible: true,
|
|
171
|
-
onPointerDown: onPointerDown,
|
|
172
|
-
onPointerMove: onPointerMove,
|
|
173
|
-
onPointerUp: onPointerUp,
|
|
174
|
-
onPointerOut: onPointerOut,
|
|
175
|
-
scale: length,
|
|
176
|
-
userData: userData,
|
|
177
|
-
renderOrder: renderOrder
|
|
178
|
-
}, /*#__PURE__*/React.createElement("planeGeometry", null), /*#__PURE__*/React.createElement("meshBasicMaterial", {
|
|
179
|
-
transparent: true,
|
|
180
|
-
depthTest: depthTest,
|
|
181
|
-
color: color,
|
|
182
|
-
polygonOffset: true,
|
|
183
|
-
polygonOffsetFactor: -10,
|
|
184
|
-
side: THREE.DoubleSide,
|
|
185
|
-
fog: false
|
|
186
|
-
})), /*#__PURE__*/React.createElement(Line, {
|
|
187
|
-
position: [-length / 2, -length / 2, 0],
|
|
188
|
-
transparent: true,
|
|
189
|
-
depthTest: depthTest,
|
|
190
|
-
points: points,
|
|
191
|
-
lineWidth: lineWidth,
|
|
192
|
-
color: color,
|
|
193
|
-
opacity: opacity,
|
|
194
|
-
polygonOffset: true,
|
|
195
|
-
polygonOffsetFactor: -10,
|
|
196
|
-
userData: userData,
|
|
197
|
-
fog: false,
|
|
198
|
-
renderOrder: renderOrder
|
|
199
|
-
})));
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
export { PlaneSlider };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("three"),r=require("@react-three/fiber"),n=require("../Html.cjs.js"),o=require("./context.cjs.js"),a=require("../../core/calculateScaleFactor.cjs.js");function i(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)}require("@babel/runtime/helpers/extends"),require("react-dom/client");var c=i(e),l=i(t);const s=new l.Vector3,u=new l.Vector3,p=(e,t,r,n)=>{const o=t.dot(t),a=t.dot(e)-t.dot(r),i=t.dot(n);if(0===i)return-a/o;s.copy(n).multiplyScalar(o/i).sub(t),u.copy(n).multiplyScalar(a/i).add(r).sub(e);return-s.dot(u)/s.dot(s)},d=new l.Vector3(0,1,0),m=new l.Vector3,f=new l.Matrix4;exports.ScalingSphere=({direction:e,axis:t})=>{const{scaleLimits:i,annotations:u,annotationsClass:x,depthTest:y,scale:g,lineWidth:h,fixed:b,axisColors:P,hoveredColor:M,opacity:w,renderOrder:v,onDragStart:O,onDrag:j,onDragEnd:k,userData:C}=c.useContext(o.context),S=r.useThree((e=>e.size)),E=r.useThree((e=>e.controls)),R=c.useRef(null),q=c.useRef(null),F=c.useRef(null),D=c.useRef(1),L=c.useRef(1),T=c.useRef(null),[V,z]=c.useState(!1),G=b?1.2:1.2*g,W=c.useCallback((r=>{u&&(R.current.innerText=`${L.current.toFixed(2)}`,R.current.style.display="block"),r.stopPropagation();const n=(new l.Matrix4).extractRotation(q.current.matrixWorld),o=r.point.clone(),i=(new l.Vector3).setFromMatrixPosition(q.current.matrixWorld),c=e.clone().applyMatrix4(n).normalize(),p=q.current.matrixWorld.clone(),d=p.clone().invert(),m=b?1/a.calculateScaleFactor(q.current.getWorldPosition(s),g,r.camera,S):1;T.current={clickPoint:o,dir:c,mPLG:p,mPLGInv:d,offsetMultiplier:m},O({component:"Sphere",axis:t,origin:i,directions:[c]}),E&&(E.enabled=!1),r.target.setPointerCapture(r.pointerId)}),[u,E,e,O,t,b,g,S]),I=c.useCallback((e=>{if(e.stopPropagation(),V||z(!0),T.current){const{clickPoint:r,dir:n,mPLG:o,mPLGInv:a,offsetMultiplier:c}=T.current,[l,s]=(null==i?void 0:i[t])||[1e-5,void 0],d=p(r,n,e.ray.origin,e.ray.direction)*c,x=b?d:d/g;let y=Math.pow(2,.2*x);e.shiftKey&&(y=Math.round(10*y)/10),y=Math.max(y,l/D.current),void 0!==s&&(y=Math.min(y,s/D.current)),L.current=D.current*y,F.current.position.set(0,G+d,0),u&&(R.current.innerText=`${L.current.toFixed(2)}`),m.set(1,1,1),m.setComponent(t,y),f.makeScale(m.x,m.y,m.z).premultiply(o).multiply(a),j(f)}}),[u,G,j,V,i,t]),_=c.useCallback((e=>{u&&(R.current.style.display="none"),e.stopPropagation(),D.current=L.current,T.current=null,F.current.position.set(0,G,0),k(),E&&(E.enabled=!0),e.target.releasePointerCapture(e.pointerId)}),[u,E,k,G]),U=c.useCallback((e=>{e.stopPropagation(),z(!1)}),[]),{radius:H,matrixL:Q}=c.useMemo((()=>{const t=b?h/g*1.8:g/22.5,r=(new l.Quaternion).setFromUnitVectors(d,e.clone().normalize());return{radius:t,matrixL:(new l.Matrix4).makeRotationFromQuaternion(r)}}),[e,g,h,b]),$=V?M:P[t];return c.createElement("group",{ref:q},c.createElement("group",{matrix:Q,matrixAutoUpdate:!1,onPointerDown:W,onPointerMove:I,onPointerUp:_,onPointerOut:U},u&&c.createElement(n.Html,{position:[0,G/2,0]},c.createElement("div",{style:{display:"none",background:"#151520",color:"white",padding:"6px 8px",borderRadius:7,whiteSpace:"nowrap"},className:x,ref:R})),c.createElement("mesh",{ref:F,position:[0,G,0],renderOrder:v,userData:C},c.createElement("sphereGeometry",{args:[H,12,12]}),c.createElement("meshBasicMaterial",{transparent:!0,depthTest:y,color:$,opacity:w,polygonOffset:!0,polygonOffsetFactor:-10}))))},exports.calculateOffset=p;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as THREE from 'three';
|
|
3
|
-
export declare const calculateOffset: (clickPoint: THREE.Vector3, normal: THREE.Vector3, rayStart: THREE.Vector3, rayDir: THREE.Vector3) => number;
|
|
4
|
-
export declare const ScalingSphere: React.FC<{
|
|
5
|
-
direction: THREE.Vector3;
|
|
6
|
-
axis: 0 | 1 | 2;
|
|
7
|
-
}>;
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as THREE from 'three';
|
|
3
|
-
import { useThree } from '@react-three/fiber';
|
|
4
|
-
import { Html } from '../Html.js';
|
|
5
|
-
import { context } from './context.js';
|
|
6
|
-
import { calculateScaleFactor } from '../../core/calculateScaleFactor.js';
|
|
7
|
-
|
|
8
|
-
const vec1 = /* @__PURE__ */new THREE.Vector3();
|
|
9
|
-
const vec2 = /* @__PURE__ */new THREE.Vector3();
|
|
10
|
-
const calculateOffset = (clickPoint, normal, rayStart, rayDir) => {
|
|
11
|
-
const e1 = normal.dot(normal);
|
|
12
|
-
const e2 = normal.dot(clickPoint) - normal.dot(rayStart);
|
|
13
|
-
const e3 = normal.dot(rayDir);
|
|
14
|
-
if (e3 === 0) {
|
|
15
|
-
return -e2 / e1;
|
|
16
|
-
}
|
|
17
|
-
vec1.copy(rayDir).multiplyScalar(e1 / e3).sub(normal);
|
|
18
|
-
vec2.copy(rayDir).multiplyScalar(e2 / e3).add(rayStart).sub(clickPoint);
|
|
19
|
-
const offset = -vec1.dot(vec2) / vec1.dot(vec1);
|
|
20
|
-
return offset;
|
|
21
|
-
};
|
|
22
|
-
const upV = /* @__PURE__ */new THREE.Vector3(0, 1, 0);
|
|
23
|
-
const scaleV = /* @__PURE__ */new THREE.Vector3();
|
|
24
|
-
const scaleMatrix = /* @__PURE__ */new THREE.Matrix4();
|
|
25
|
-
const ScalingSphere = ({
|
|
26
|
-
direction,
|
|
27
|
-
axis
|
|
28
|
-
}) => {
|
|
29
|
-
const {
|
|
30
|
-
scaleLimits,
|
|
31
|
-
annotations,
|
|
32
|
-
annotationsClass,
|
|
33
|
-
depthTest,
|
|
34
|
-
scale,
|
|
35
|
-
lineWidth,
|
|
36
|
-
fixed,
|
|
37
|
-
axisColors,
|
|
38
|
-
hoveredColor,
|
|
39
|
-
opacity,
|
|
40
|
-
renderOrder,
|
|
41
|
-
onDragStart,
|
|
42
|
-
onDrag,
|
|
43
|
-
onDragEnd,
|
|
44
|
-
userData
|
|
45
|
-
} = React.useContext(context);
|
|
46
|
-
const size = useThree(state => state.size);
|
|
47
|
-
const camControls = useThree(state => state.controls);
|
|
48
|
-
const divRef = React.useRef(null);
|
|
49
|
-
const objRef = React.useRef(null);
|
|
50
|
-
const meshRef = React.useRef(null);
|
|
51
|
-
const scale0 = React.useRef(1);
|
|
52
|
-
const scaleCur = React.useRef(1);
|
|
53
|
-
const clickInfo = React.useRef(null);
|
|
54
|
-
const [isHovered, setIsHovered] = React.useState(false);
|
|
55
|
-
const position = fixed ? 1.2 : 1.2 * scale;
|
|
56
|
-
const onPointerDown = React.useCallback(e => {
|
|
57
|
-
if (annotations) {
|
|
58
|
-
divRef.current.innerText = `${scaleCur.current.toFixed(2)}`;
|
|
59
|
-
divRef.current.style.display = 'block';
|
|
60
|
-
}
|
|
61
|
-
e.stopPropagation();
|
|
62
|
-
const rotation = new THREE.Matrix4().extractRotation(objRef.current.matrixWorld);
|
|
63
|
-
const clickPoint = e.point.clone();
|
|
64
|
-
const origin = new THREE.Vector3().setFromMatrixPosition(objRef.current.matrixWorld);
|
|
65
|
-
const dir = direction.clone().applyMatrix4(rotation).normalize();
|
|
66
|
-
const mPLG = objRef.current.matrixWorld.clone();
|
|
67
|
-
const mPLGInv = mPLG.clone().invert();
|
|
68
|
-
const offsetMultiplier = fixed ? 1 / calculateScaleFactor(objRef.current.getWorldPosition(vec1), scale, e.camera, size) : 1;
|
|
69
|
-
clickInfo.current = {
|
|
70
|
-
clickPoint,
|
|
71
|
-
dir,
|
|
72
|
-
mPLG,
|
|
73
|
-
mPLGInv,
|
|
74
|
-
offsetMultiplier
|
|
75
|
-
};
|
|
76
|
-
onDragStart({
|
|
77
|
-
component: 'Sphere',
|
|
78
|
-
axis,
|
|
79
|
-
origin,
|
|
80
|
-
directions: [dir]
|
|
81
|
-
});
|
|
82
|
-
camControls && (camControls.enabled = false);
|
|
83
|
-
// @ts-ignore - setPointerCapture is not in the type definition
|
|
84
|
-
e.target.setPointerCapture(e.pointerId);
|
|
85
|
-
}, [annotations, camControls, direction, onDragStart, axis, fixed, scale, size]);
|
|
86
|
-
const onPointerMove = React.useCallback(e => {
|
|
87
|
-
e.stopPropagation();
|
|
88
|
-
if (!isHovered) setIsHovered(true);
|
|
89
|
-
if (clickInfo.current) {
|
|
90
|
-
const {
|
|
91
|
-
clickPoint,
|
|
92
|
-
dir,
|
|
93
|
-
mPLG,
|
|
94
|
-
mPLGInv,
|
|
95
|
-
offsetMultiplier
|
|
96
|
-
} = clickInfo.current;
|
|
97
|
-
const [min, max] = (scaleLimits == null ? void 0 : scaleLimits[axis]) || [1e-5, undefined]; // always limit the minimal value, since setting it very low might break the transform
|
|
98
|
-
|
|
99
|
-
const offsetW = calculateOffset(clickPoint, dir, e.ray.origin, e.ray.direction);
|
|
100
|
-
const offsetL = offsetW * offsetMultiplier;
|
|
101
|
-
const offsetH = fixed ? offsetL : offsetL / scale;
|
|
102
|
-
let upscale = Math.pow(2, offsetH * 0.2);
|
|
103
|
-
|
|
104
|
-
// @ts-ignore
|
|
105
|
-
if (e.shiftKey) {
|
|
106
|
-
upscale = Math.round(upscale * 10) / 10;
|
|
107
|
-
}
|
|
108
|
-
upscale = Math.max(upscale, min / scale0.current);
|
|
109
|
-
if (max !== undefined) {
|
|
110
|
-
upscale = Math.min(upscale, max / scale0.current);
|
|
111
|
-
}
|
|
112
|
-
scaleCur.current = scale0.current * upscale;
|
|
113
|
-
meshRef.current.position.set(0, position + offsetL, 0);
|
|
114
|
-
if (annotations) {
|
|
115
|
-
divRef.current.innerText = `${scaleCur.current.toFixed(2)}`;
|
|
116
|
-
}
|
|
117
|
-
scaleV.set(1, 1, 1);
|
|
118
|
-
scaleV.setComponent(axis, upscale);
|
|
119
|
-
scaleMatrix.makeScale(scaleV.x, scaleV.y, scaleV.z).premultiply(mPLG).multiply(mPLGInv);
|
|
120
|
-
onDrag(scaleMatrix);
|
|
121
|
-
}
|
|
122
|
-
}, [annotations, position, onDrag, isHovered, scaleLimits, axis]);
|
|
123
|
-
const onPointerUp = React.useCallback(e => {
|
|
124
|
-
if (annotations) {
|
|
125
|
-
divRef.current.style.display = 'none';
|
|
126
|
-
}
|
|
127
|
-
e.stopPropagation();
|
|
128
|
-
scale0.current = scaleCur.current;
|
|
129
|
-
clickInfo.current = null;
|
|
130
|
-
meshRef.current.position.set(0, position, 0);
|
|
131
|
-
onDragEnd();
|
|
132
|
-
camControls && (camControls.enabled = true);
|
|
133
|
-
// @ts-ignore - releasePointerCapture & PointerEvent#pointerId is not in the type definition
|
|
134
|
-
e.target.releasePointerCapture(e.pointerId);
|
|
135
|
-
}, [annotations, camControls, onDragEnd, position]);
|
|
136
|
-
const onPointerOut = React.useCallback(e => {
|
|
137
|
-
e.stopPropagation();
|
|
138
|
-
setIsHovered(false);
|
|
139
|
-
}, []);
|
|
140
|
-
const {
|
|
141
|
-
radius,
|
|
142
|
-
matrixL
|
|
143
|
-
} = React.useMemo(() => {
|
|
144
|
-
const radius = fixed ? lineWidth / scale * 1.8 : scale / 22.5;
|
|
145
|
-
const quaternion = new THREE.Quaternion().setFromUnitVectors(upV, direction.clone().normalize());
|
|
146
|
-
const matrixL = new THREE.Matrix4().makeRotationFromQuaternion(quaternion);
|
|
147
|
-
return {
|
|
148
|
-
radius,
|
|
149
|
-
matrixL
|
|
150
|
-
};
|
|
151
|
-
}, [direction, scale, lineWidth, fixed]);
|
|
152
|
-
const color = isHovered ? hoveredColor : axisColors[axis];
|
|
153
|
-
return /*#__PURE__*/React.createElement("group", {
|
|
154
|
-
ref: objRef
|
|
155
|
-
}, /*#__PURE__*/React.createElement("group", {
|
|
156
|
-
matrix: matrixL,
|
|
157
|
-
matrixAutoUpdate: false,
|
|
158
|
-
onPointerDown: onPointerDown,
|
|
159
|
-
onPointerMove: onPointerMove,
|
|
160
|
-
onPointerUp: onPointerUp,
|
|
161
|
-
onPointerOut: onPointerOut
|
|
162
|
-
}, annotations && /*#__PURE__*/React.createElement(Html, {
|
|
163
|
-
position: [0, position / 2, 0]
|
|
164
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
165
|
-
style: {
|
|
166
|
-
display: 'none',
|
|
167
|
-
background: '#151520',
|
|
168
|
-
color: 'white',
|
|
169
|
-
padding: '6px 8px',
|
|
170
|
-
borderRadius: 7,
|
|
171
|
-
whiteSpace: 'nowrap'
|
|
172
|
-
},
|
|
173
|
-
className: annotationsClass,
|
|
174
|
-
ref: divRef
|
|
175
|
-
})), /*#__PURE__*/React.createElement("mesh", {
|
|
176
|
-
ref: meshRef,
|
|
177
|
-
position: [0, position, 0],
|
|
178
|
-
renderOrder: renderOrder,
|
|
179
|
-
userData: userData
|
|
180
|
-
}, /*#__PURE__*/React.createElement("sphereGeometry", {
|
|
181
|
-
args: [radius, 12, 12]
|
|
182
|
-
}), /*#__PURE__*/React.createElement("meshBasicMaterial", {
|
|
183
|
-
transparent: true,
|
|
184
|
-
depthTest: depthTest,
|
|
185
|
-
color: color,
|
|
186
|
-
opacity: opacity,
|
|
187
|
-
polygonOffset: true,
|
|
188
|
-
polygonOffsetFactor: -10
|
|
189
|
-
}))));
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
export { ScalingSphere, calculateOffset };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function e(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)}Object.defineProperty(exports,"__esModule",{value:!0});const t=e(require("react")).createContext(null);exports.context=t;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
export type OnDragStartProps = {
|
|
4
|
-
component: 'Arrow' | 'Slider' | 'Rotator' | 'Sphere';
|
|
5
|
-
axis: 0 | 1 | 2;
|
|
6
|
-
origin: THREE.Vector3;
|
|
7
|
-
directions: THREE.Vector3[];
|
|
8
|
-
};
|
|
9
|
-
export type PivotContext = {
|
|
10
|
-
onDragStart: (props: OnDragStartProps) => void;
|
|
11
|
-
onDrag: (mdW: THREE.Matrix4) => void;
|
|
12
|
-
onDragEnd: () => void;
|
|
13
|
-
translation: {
|
|
14
|
-
current: [number, number, number];
|
|
15
|
-
};
|
|
16
|
-
translationLimits?: [[number, number] | undefined, [number, number] | undefined, [number, number] | undefined];
|
|
17
|
-
rotationLimits?: [[number, number] | undefined, [number, number] | undefined, [number, number] | undefined];
|
|
18
|
-
scaleLimits?: [[number, number] | undefined, [number, number] | undefined, [number, number] | undefined];
|
|
19
|
-
axisColors: [string | number, string | number, string | number];
|
|
20
|
-
hoveredColor: string | number;
|
|
21
|
-
opacity: number;
|
|
22
|
-
scale: number;
|
|
23
|
-
lineWidth: number;
|
|
24
|
-
fixed: boolean;
|
|
25
|
-
depthTest: boolean;
|
|
26
|
-
renderOrder: number;
|
|
27
|
-
userData?: {
|
|
28
|
-
[key: string]: any;
|
|
29
|
-
};
|
|
30
|
-
annotations?: boolean;
|
|
31
|
-
annotationsClass?: string;
|
|
32
|
-
};
|
|
33
|
-
export declare const context: React.Context<PivotContext>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),r=require("@react-three/fiber"),t=require("react"),i=require("three"),a=require("./AxisArrow.cjs.js"),n=require("./AxisRotator.cjs.js"),o=require("./PlaneSlider.cjs.js"),c=require("./ScalingSphere.cjs.js"),l=require("./context.cjs.js"),s=require("../../core/calculateScaleFactor.cjs.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function d(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})}})),r.default=e,Object.freeze(r)}require("../../core/Line.cjs.js"),require("three-stdlib"),require("../Html.cjs.js"),require("react-dom/client");var m=u(e),x=d(t),p=d(i);const f=new p.Matrix4,y=new p.Matrix4,w=new p.Matrix4,g=new p.Matrix4,b=new p.Matrix4,E=new p.Matrix4,j=new p.Matrix4,S=new p.Matrix4,h=new p.Matrix4,v=new p.Box3,M=new p.Box3,A=new p.Vector3,q=new p.Vector3,R=new p.Vector3,V=new p.Vector3,P=new p.Vector3,W=new p.Vector3(1,0,0),D=new p.Vector3(0,1,0),O=new p.Vector3(0,0,1),C=x.forwardRef((({enabled:e=!0,matrix:t,onDragStart:i,onDrag:u,onDragEnd:d,autoTransform:C=!0,anchor:L,disableAxes:B=!1,disableSliders:F=!1,disableRotations:z=!1,disableScaling:T=!1,activeAxes:_=[!0,!0,!0],offset:k=[0,0,0],rotation:H=[0,0,0],scale:I=1,lineWidth:U=4,fixed:G=!1,translationLimits:J,rotationLimits:K,scaleLimits:N,depthTest:Q=!0,renderOrder:X=500,axisColors:Y=["#ff2060","#20df80","#2080ff"],hoveredColor:Z="#ffff40",annotations:$=!1,annotationsClass:ee,opacity:re=1,visible:te=!0,userData:ie,children:ae,...ne},oe)=>{const ce=r.useThree((e=>e.invalidate)),le=x.useRef(null),se=x.useRef(null),ue=x.useRef(null),de=x.useRef(null),me=x.useRef([0,0,0]),xe=x.useRef(new p.Vector3(1,1,1)),pe=x.useRef(new p.Vector3(1,1,1));x.useLayoutEffect((()=>{L&&(de.current.updateWorldMatrix(!0,!0),g.copy(de.current.matrixWorld).invert(),v.makeEmpty(),de.current.traverse((e=>{e.geometry&&(e.geometry.boundingBox||e.geometry.computeBoundingBox(),E.copy(e.matrixWorld).premultiply(g),M.copy(e.geometry.boundingBox),M.applyMatrix4(E),v.union(M))})),A.copy(v.max).add(v.min).multiplyScalar(.5),q.copy(v.max).sub(v.min).multiplyScalar(.5),R.copy(q).multiply(new p.Vector3(...L)).add(A),V.set(...k).add(R),ue.current.position.copy(V),ce())}));const fe=x.useMemo((()=>({onDragStart:e=>{f.copy(se.current.matrix),y.copy(se.current.matrixWorld),i&&i(e),ce()},onDrag:e=>{w.copy(le.current.matrixWorld),g.copy(w).invert(),b.copy(y).premultiply(e),E.copy(b).premultiply(g),j.copy(f).invert(),S.copy(E).multiply(j),C&&se.current.matrix.copy(E),u&&u(E,S,b,e),ce()},onDragEnd:()=>{d&&d(),ce()},translation:me,translationLimits:J,rotationLimits:K,axisColors:Y,hoveredColor:Z,opacity:re,scale:I,lineWidth:U,fixed:G,depthTest:Q,renderOrder:X,userData:ie,annotations:$,annotationsClass:ee})),[i,u,d,me,J,K,N,Q,I,U,G,...Y,Z,re,ie,C,$,ee]),ye=new p.Vector3;return r.useFrame((e=>{if(G){const r=s.calculateScaleFactor(ue.current.getWorldPosition(ye),I,e.camera,e.size);xe.current.setScalar(r)}t&&t instanceof p.Matrix4&&(se.current.matrix=t),se.current.updateWorldMatrix(!0,!0),h.makeRotationFromEuler(ue.current.rotation).setPosition(ue.current.position).premultiply(se.current.matrixWorld),pe.current.setFromMatrixScale(h),P.copy(xe.current).divide(pe.current),(Math.abs(ue.current.scale.x-P.x)>1e-4||Math.abs(ue.current.scale.y-P.y)>1e-4||Math.abs(ue.current.scale.z-P.z)>1e-4)&&(ue.current.scale.copy(P),e.invalidate())})),x.useImperativeHandle(oe,(()=>se.current),[]),x.createElement(l.context.Provider,{value:fe},x.createElement("group",{ref:le},x.createElement("group",m.default({ref:se,matrix:t,matrixAutoUpdate:!1},ne),x.createElement("group",{visible:te,ref:ue,position:k,rotation:H},e&&x.createElement(x.Fragment,null,!B&&_[0]&&x.createElement(a.AxisArrow,{axis:0,direction:W}),!B&&_[1]&&x.createElement(a.AxisArrow,{axis:1,direction:D}),!B&&_[2]&&x.createElement(a.AxisArrow,{axis:2,direction:O}),!F&&_[0]&&_[1]&&x.createElement(o.PlaneSlider,{axis:2,dir1:W,dir2:D}),!F&&_[0]&&_[2]&&x.createElement(o.PlaneSlider,{axis:1,dir1:O,dir2:W}),!F&&_[2]&&_[1]&&x.createElement(o.PlaneSlider,{axis:0,dir1:D,dir2:O}),!z&&_[0]&&_[1]&&x.createElement(n.AxisRotator,{axis:2,dir1:W,dir2:D}),!z&&_[0]&&_[2]&&x.createElement(n.AxisRotator,{axis:1,dir1:O,dir2:W}),!z&&_[2]&&_[1]&&x.createElement(n.AxisRotator,{axis:0,dir1:D,dir2:O}),!T&&_[0]&&x.createElement(c.ScalingSphere,{axis:0,direction:W}),!T&&_[1]&&x.createElement(c.ScalingSphere,{axis:1,direction:D}),!T&&_[2]&&x.createElement(c.ScalingSphere,{axis:2,direction:O}))),x.createElement("group",{ref:de},ae))))}));exports.PivotControls=C;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as THREE from 'three';
|
|
3
|
-
import { ForwardRefComponent } from '../../helpers/ts-utils';
|
|
4
|
-
import { OnDragStartProps } from './context';
|
|
5
|
-
export type PivotControlsProps = {
|
|
6
|
-
enabled?: boolean;
|
|
7
|
-
scale?: number;
|
|
8
|
-
lineWidth?: number;
|
|
9
|
-
fixed?: boolean;
|
|
10
|
-
offset?: [number, number, number];
|
|
11
|
-
rotation?: [number, number, number];
|
|
12
|
-
matrix?: THREE.Matrix4;
|
|
13
|
-
anchor?: [number, number, number];
|
|
14
|
-
autoTransform?: boolean;
|
|
15
|
-
activeAxes?: [boolean, boolean, boolean];
|
|
16
|
-
disableAxes?: boolean;
|
|
17
|
-
disableSliders?: boolean;
|
|
18
|
-
disableRotations?: boolean;
|
|
19
|
-
disableScaling?: boolean;
|
|
20
|
-
translationLimits?: [[number, number] | undefined, [number, number] | undefined, [number, number] | undefined];
|
|
21
|
-
rotationLimits?: [[number, number] | undefined, [number, number] | undefined, [number, number] | undefined];
|
|
22
|
-
scaleLimits?: [[number, number] | undefined, [number, number] | undefined, [number, number] | undefined];
|
|
23
|
-
axisColors?: [string | number, string | number, string | number];
|
|
24
|
-
hoveredColor?: string | number;
|
|
25
|
-
annotations?: boolean;
|
|
26
|
-
annotationsClass?: string;
|
|
27
|
-
onDragStart?: (props: OnDragStartProps) => void;
|
|
28
|
-
onDrag?: (l: THREE.Matrix4, deltaL: THREE.Matrix4, w: THREE.Matrix4, deltaW: THREE.Matrix4) => void;
|
|
29
|
-
onDragEnd?: () => void;
|
|
30
|
-
depthTest?: boolean;
|
|
31
|
-
renderOrder?: number;
|
|
32
|
-
opacity?: number;
|
|
33
|
-
visible?: boolean;
|
|
34
|
-
userData?: {
|
|
35
|
-
[key: string]: any;
|
|
36
|
-
};
|
|
37
|
-
children?: React.ReactNode;
|
|
38
|
-
};
|
|
39
|
-
export declare const PivotControls: ForwardRefComponent<PivotControlsProps, THREE.Group>;
|