@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,72 +0,0 @@
|
|
|
1
|
-
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
2
|
-
import { useThree, useFrame } from '@react-three/fiber';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { TrackballControls as TrackballControls$1 } from 'three-stdlib';
|
|
5
|
-
|
|
6
|
-
const TrackballControls = /* @__PURE__ */React.forwardRef(({
|
|
7
|
-
makeDefault,
|
|
8
|
-
camera,
|
|
9
|
-
domElement,
|
|
10
|
-
regress,
|
|
11
|
-
onChange,
|
|
12
|
-
onStart,
|
|
13
|
-
onEnd,
|
|
14
|
-
...restProps
|
|
15
|
-
}, ref) => {
|
|
16
|
-
const {
|
|
17
|
-
invalidate,
|
|
18
|
-
camera: defaultCamera,
|
|
19
|
-
gl,
|
|
20
|
-
events,
|
|
21
|
-
set,
|
|
22
|
-
get,
|
|
23
|
-
performance,
|
|
24
|
-
viewport
|
|
25
|
-
} = useThree();
|
|
26
|
-
const explCamera = camera || defaultCamera;
|
|
27
|
-
const explDomElement = domElement || events.connected || gl.domElement;
|
|
28
|
-
const controls = React.useMemo(() => new TrackballControls$1(explCamera), [explCamera]);
|
|
29
|
-
useFrame(() => {
|
|
30
|
-
if (controls.enabled) controls.update();
|
|
31
|
-
}, -1);
|
|
32
|
-
React.useEffect(() => {
|
|
33
|
-
controls.connect(explDomElement);
|
|
34
|
-
return () => void controls.dispose();
|
|
35
|
-
}, [explDomElement, regress, controls, invalidate]);
|
|
36
|
-
React.useEffect(() => {
|
|
37
|
-
const callback = e => {
|
|
38
|
-
invalidate();
|
|
39
|
-
if (regress) performance.regress();
|
|
40
|
-
if (onChange) onChange(e);
|
|
41
|
-
};
|
|
42
|
-
controls.addEventListener('change', callback);
|
|
43
|
-
if (onStart) controls.addEventListener('start', onStart);
|
|
44
|
-
if (onEnd) controls.addEventListener('end', onEnd);
|
|
45
|
-
return () => {
|
|
46
|
-
if (onStart) controls.removeEventListener('start', onStart);
|
|
47
|
-
if (onEnd) controls.removeEventListener('end', onEnd);
|
|
48
|
-
controls.removeEventListener('change', callback);
|
|
49
|
-
};
|
|
50
|
-
}, [onChange, onStart, onEnd, controls, invalidate]);
|
|
51
|
-
React.useEffect(() => {
|
|
52
|
-
controls.handleResize();
|
|
53
|
-
}, [viewport]);
|
|
54
|
-
React.useEffect(() => {
|
|
55
|
-
if (makeDefault) {
|
|
56
|
-
const old = get().controls;
|
|
57
|
-
// @ts-ignore https://github.com/three-types/three-ts-types/pull/1398
|
|
58
|
-
set({
|
|
59
|
-
controls
|
|
60
|
-
});
|
|
61
|
-
return () => set({
|
|
62
|
-
controls: old
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
}, [makeDefault, controls]);
|
|
66
|
-
return /*#__PURE__*/React.createElement("primitive", _extends({
|
|
67
|
-
ref: ref,
|
|
68
|
-
object: controls
|
|
69
|
-
}, restProps));
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
export { TrackballControls };
|
package/core/Trail.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@react-three/fiber"),t=require("react"),r=require("three"),n=require("meshline");function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var i=o(t);const u={width:.2,length:1,decay:1,local:!1,stride:0,interval:1},s=(e,t=1)=>(e.set(e.subarray(t)),e.fill(-1/0,-t),e);function c(t,n){const{length:o,local:c,decay:l,interval:a,stride:f}={...u,...n},d=i.useRef(null),[h]=i.useState((()=>new r.Vector3));i.useLayoutEffect((()=>{t&&(d.current=Float32Array.from({length:10*o*3},((e,r)=>t.position.getComponent(r%3))))}),[o,t]);const p=i.useRef(new r.Vector3),y=i.useRef(0);return e.useFrame((()=>{if(t&&d.current){if(0===y.current){let e;c?e=t.position:(t.getWorldPosition(h),e=h);const r=1*l;for(let t=0;t<r;t++)e.distanceTo(p.current)<f||(s(d.current,3),d.current.set(e.toArray(),d.current.length-3));p.current.copy(e)}y.current++,y.current=y.current%a}})),d}const l=i.forwardRef(((t,o)=>{const{children:s}=t,{width:l,length:a,decay:f,local:d,stride:h,interval:p}={...u,...t},{color:y="hotpink",attenuation:g,target:m}=t,v=e.useThree((e=>e.size)),b=e.useThree((e=>e.scene)),w=i.useRef(null),[M,j]=i.useState(null),O=c(M,{length:a,decay:f,local:d,stride:h,interval:p});i.useEffect((()=>{const e=(null==m?void 0:m.current)||w.current.children.find((e=>e instanceof r.Object3D));e&&j(e)}),[O,m]);const E=i.useMemo((()=>new n.MeshLineGeometry),[]),P=i.useMemo((()=>{var e,t;const o=new n.MeshLineMaterial({lineWidth:.1*l,color:y,sizeAttenuation:1,resolution:new r.Vector2(v.width,v.height)});let i;if(s)if(Array.isArray(s))i=s.find((e=>{const t=e;return"string"==typeof t.type&&"meshLineMaterial"===t.type}));else{const e=s;"string"==typeof e.type&&"meshLineMaterial"===e.type&&(i=e)}return"object"==typeof(null==(e=i)?void 0:e.props)&&null!==(null==(t=i)?void 0:t.props)&&o.setValues(i.props),o}),[l,y,v,s]);return i.useEffect((()=>{P.uniforms.resolution.value.set(v.width,v.height)}),[v]),e.useFrame((()=>{O.current&&E.setPoints(O.current,g)})),i.createElement("group",null,e.createPortal(i.createElement("mesh",{ref:o,geometry:E,material:P}),b),i.createElement("group",{ref:w},s))}));exports.Trail=l,exports.useTrail=c;
|
package/core/Trail.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ColorRepresentation, Mesh, Object3D } from 'three';
|
|
3
|
-
import { MeshLineGeometry as MeshLineGeometryImpl } from 'meshline';
|
|
4
|
-
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
5
|
-
type Settings = {
|
|
6
|
-
width: number;
|
|
7
|
-
length: number;
|
|
8
|
-
decay: number;
|
|
9
|
-
local: boolean;
|
|
10
|
-
stride: number;
|
|
11
|
-
interval: number;
|
|
12
|
-
};
|
|
13
|
-
export type TrailProps = {
|
|
14
|
-
color?: ColorRepresentation;
|
|
15
|
-
attenuation?: (width: number) => number;
|
|
16
|
-
target?: React.RefObject<Object3D>;
|
|
17
|
-
} & Partial<Settings>;
|
|
18
|
-
export declare function useTrail(target: Object3D, settings: Partial<Settings>): React.RefObject<Float32Array | null>;
|
|
19
|
-
export type MeshLineGeometry = Mesh & MeshLineGeometryImpl;
|
|
20
|
-
export declare const Trail: ForwardRefComponent<React.PropsWithChildren<TrailProps>, MeshLineGeometry>;
|
|
21
|
-
export {};
|
package/core/Trail.js
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { useFrame, useThree, createPortal } from '@react-three/fiber';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { Vector3, Object3D, Vector2 } from 'three';
|
|
4
|
-
import { MeshLineGeometry, MeshLineMaterial } from 'meshline';
|
|
5
|
-
|
|
6
|
-
const defaults = {
|
|
7
|
-
width: 0.2,
|
|
8
|
-
length: 1,
|
|
9
|
-
decay: 1,
|
|
10
|
-
local: false,
|
|
11
|
-
stride: 0,
|
|
12
|
-
interval: 1
|
|
13
|
-
};
|
|
14
|
-
const shiftLeft = (collection, steps = 1) => {
|
|
15
|
-
collection.set(collection.subarray(steps));
|
|
16
|
-
collection.fill(-Infinity, -steps);
|
|
17
|
-
return collection;
|
|
18
|
-
};
|
|
19
|
-
function useTrail(target, settings) {
|
|
20
|
-
const {
|
|
21
|
-
length,
|
|
22
|
-
local,
|
|
23
|
-
decay,
|
|
24
|
-
interval,
|
|
25
|
-
stride
|
|
26
|
-
} = {
|
|
27
|
-
...defaults,
|
|
28
|
-
...settings
|
|
29
|
-
};
|
|
30
|
-
const points = React.useRef(null);
|
|
31
|
-
const [worldPosition] = React.useState(() => new Vector3());
|
|
32
|
-
React.useLayoutEffect(() => {
|
|
33
|
-
if (target) {
|
|
34
|
-
points.current = Float32Array.from({
|
|
35
|
-
length: length * 10 * 3
|
|
36
|
-
}, (_, i) => target.position.getComponent(i % 3));
|
|
37
|
-
}
|
|
38
|
-
}, [length, target]);
|
|
39
|
-
const prevPosition = React.useRef(new Vector3());
|
|
40
|
-
const frameCount = React.useRef(0);
|
|
41
|
-
useFrame(() => {
|
|
42
|
-
if (!target) return;
|
|
43
|
-
if (!points.current) return;
|
|
44
|
-
if (frameCount.current === 0) {
|
|
45
|
-
let newPosition;
|
|
46
|
-
if (local) {
|
|
47
|
-
newPosition = target.position;
|
|
48
|
-
} else {
|
|
49
|
-
target.getWorldPosition(worldPosition);
|
|
50
|
-
newPosition = worldPosition;
|
|
51
|
-
}
|
|
52
|
-
const steps = 1 * decay;
|
|
53
|
-
for (let i = 0; i < steps; i++) {
|
|
54
|
-
if (newPosition.distanceTo(prevPosition.current) < stride) continue;
|
|
55
|
-
shiftLeft(points.current, 3);
|
|
56
|
-
points.current.set(newPosition.toArray(), points.current.length - 3);
|
|
57
|
-
}
|
|
58
|
-
prevPosition.current.copy(newPosition);
|
|
59
|
-
}
|
|
60
|
-
frameCount.current++;
|
|
61
|
-
frameCount.current = frameCount.current % interval;
|
|
62
|
-
});
|
|
63
|
-
return points;
|
|
64
|
-
}
|
|
65
|
-
const Trail = /* @__PURE__ */React.forwardRef((props, forwardRef) => {
|
|
66
|
-
const {
|
|
67
|
-
children
|
|
68
|
-
} = props;
|
|
69
|
-
const {
|
|
70
|
-
width,
|
|
71
|
-
length,
|
|
72
|
-
decay,
|
|
73
|
-
local,
|
|
74
|
-
stride,
|
|
75
|
-
interval
|
|
76
|
-
} = {
|
|
77
|
-
...defaults,
|
|
78
|
-
...props
|
|
79
|
-
};
|
|
80
|
-
const {
|
|
81
|
-
color = 'hotpink',
|
|
82
|
-
attenuation,
|
|
83
|
-
target
|
|
84
|
-
} = props;
|
|
85
|
-
const size = useThree(s => s.size);
|
|
86
|
-
const scene = useThree(s => s.scene);
|
|
87
|
-
const ref = React.useRef(null);
|
|
88
|
-
const [anchor, setAnchor] = React.useState(null);
|
|
89
|
-
const points = useTrail(anchor, {
|
|
90
|
-
length,
|
|
91
|
-
decay,
|
|
92
|
-
local,
|
|
93
|
-
stride,
|
|
94
|
-
interval
|
|
95
|
-
});
|
|
96
|
-
React.useEffect(() => {
|
|
97
|
-
const t = (target == null ? void 0 : target.current) || ref.current.children.find(o => {
|
|
98
|
-
return o instanceof Object3D;
|
|
99
|
-
});
|
|
100
|
-
if (t) {
|
|
101
|
-
setAnchor(t);
|
|
102
|
-
}
|
|
103
|
-
}, [points, target]);
|
|
104
|
-
const geo = React.useMemo(() => new MeshLineGeometry(), []);
|
|
105
|
-
const mat = React.useMemo(() => {
|
|
106
|
-
var _matOverride, _matOverride2;
|
|
107
|
-
const m = new MeshLineMaterial({
|
|
108
|
-
lineWidth: 0.1 * width,
|
|
109
|
-
color: color,
|
|
110
|
-
sizeAttenuation: 1,
|
|
111
|
-
resolution: new Vector2(size.width, size.height)
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
// Get and apply first <meshLineMaterial /> from children
|
|
115
|
-
let matOverride;
|
|
116
|
-
if (children) {
|
|
117
|
-
if (Array.isArray(children)) {
|
|
118
|
-
matOverride = children.find(child => {
|
|
119
|
-
const c = child;
|
|
120
|
-
return typeof c.type === 'string' && c.type === 'meshLineMaterial';
|
|
121
|
-
});
|
|
122
|
-
} else {
|
|
123
|
-
const c = children;
|
|
124
|
-
if (typeof c.type === 'string' && c.type === 'meshLineMaterial') {
|
|
125
|
-
matOverride = c;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
if (typeof ((_matOverride = matOverride) == null ? void 0 : _matOverride.props) === 'object' && ((_matOverride2 = matOverride) == null ? void 0 : _matOverride2.props) !== null) {
|
|
130
|
-
m.setValues(matOverride.props);
|
|
131
|
-
}
|
|
132
|
-
return m;
|
|
133
|
-
}, [width, color, size, children]);
|
|
134
|
-
React.useEffect(() => {
|
|
135
|
-
mat.uniforms.resolution.value.set(size.width, size.height);
|
|
136
|
-
}, [size]);
|
|
137
|
-
useFrame(() => {
|
|
138
|
-
if (!points.current) return;
|
|
139
|
-
geo.setPoints(points.current, attenuation);
|
|
140
|
-
});
|
|
141
|
-
return /*#__PURE__*/React.createElement("group", null, createPortal(/*#__PURE__*/React.createElement("mesh", {
|
|
142
|
-
ref: forwardRef,
|
|
143
|
-
geometry: geo,
|
|
144
|
-
material: mat
|
|
145
|
-
}), scene), /*#__PURE__*/React.createElement("group", {
|
|
146
|
-
ref: ref
|
|
147
|
-
}, children));
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
export { Trail, useTrail };
|
package/core/TrailTexture.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),e=require("@react-three/fiber"),i=require("three");function s(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var a=s(t);const h=t=>Math.sqrt(1-Math.pow(t-1,2));class r{constructor({size:t=256,maxAge:e=750,radius:i=.3,intensity:s=.2,interpolate:a=0,smoothing:r=0,minForce:n=.3,blend:c="screen",ease:o=h}={}){this.size=t,this.maxAge=e,this.radius=i,this.intensity=s,this.ease=o,this.interpolate=a,this.smoothing=r,this.minForce=n,this.blend=c,this.trail=[],this.force=0,this.initTexture()}initTexture(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=this.size;const t=this.canvas.getContext("2d");if(null===t)throw new Error("2D not available");this.ctx=t,this.ctx.fillStyle="black",this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height),this.texture=new i.Texture(this.canvas),this.canvas.id="touchTexture",this.canvas.style.width=this.canvas.style.height=`${this.canvas.width}px`}update(t){this.clear(),this.trail.forEach(((e,i)=>{e.age+=1e3*t,e.age>this.maxAge&&this.trail.splice(i,1)})),this.trail.length||(this.force=0),this.trail.forEach((t=>{this.drawTouch(t)})),this.texture.needsUpdate=!0}clear(){this.ctx.globalCompositeOperation="source-over",this.ctx.fillStyle="black",this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height)}addTouch(t){const e=this.trail[this.trail.length-1];if(e){const i=e.x-t.x,s=e.y-t.y,a=i*i+s*s,h=Math.max(this.minForce,Math.min(1e4*a,1));if(this.force=function(t,e,i=.9){return e*i+t*(1-i)}(h,this.force,this.smoothing),this.interpolate){const t=Math.ceil(a/Math.pow(.5*this.radius/this.interpolate,2));if(t>1)for(let a=1;a<t;a++)this.trail.push({x:e.x-i/t*a,y:e.y-s/t*a,age:0,force:h})}}this.trail.push({x:t.x,y:t.y,age:0,force:this.force})}drawTouch(t){const e={x:t.x*this.size,y:(1-t.y)*this.size};let i=1;i=t.age<.3*this.maxAge?this.ease(t.age/(.3*this.maxAge)):this.ease(1-(t.age-.3*this.maxAge)/(.7*this.maxAge)),i*=t.force,this.ctx.globalCompositeOperation=this.blend;const s=this.size*this.radius*i,a=this.ctx.createRadialGradient(e.x,e.y,Math.max(0,.25*s),e.x,e.y,Math.max(0,s));a.addColorStop(0,`rgba(255, 255, 255, ${this.intensity})`),a.addColorStop(1,"rgba(0, 0, 0, 0.0)"),this.ctx.beginPath(),this.ctx.fillStyle=a,this.ctx.arc(e.x,e.y,Math.max(0,s),0,2*Math.PI),this.ctx.fill()}}function n(i={}){const{size:s,maxAge:a,radius:h,intensity:n,interpolate:c,smoothing:o,minForce:l,blend:u,ease:x}=i,d=t.useMemo((()=>new r(i)),[s,a,h,n,c,o,l,u,x]);e.useFrame(((t,e)=>{d.update(e)}));const f=t.useCallback((t=>d.addTouch(t.uv)),[d]);return[d.texture,f]}exports.TrailTexture=({children:t,...e})=>{const i=n(e);return a.createElement(a.Fragment,null,null==t?void 0:t(i))},exports.useTrailTexture=n;
|
package/core/TrailTexture.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Texture } from 'three';
|
|
3
|
-
type TrailConfig = {
|
|
4
|
-
size?: number;
|
|
5
|
-
maxAge?: number;
|
|
6
|
-
radius?: number;
|
|
7
|
-
intensity?: number;
|
|
8
|
-
interpolate?: number;
|
|
9
|
-
smoothing?: number;
|
|
10
|
-
minForce?: number;
|
|
11
|
-
blend?: CanvasRenderingContext2D['globalCompositeOperation'];
|
|
12
|
-
ease?: (t: number) => number;
|
|
13
|
-
};
|
|
14
|
-
export declare function useTrailTexture(config?: Partial<TrailConfig>): [Texture, (ThreeEvent: any) => void];
|
|
15
|
-
export type TrailTextureProps = {
|
|
16
|
-
children?: (texture: ReturnType<typeof useTrailTexture>) => React.ReactNode;
|
|
17
|
-
} & TrailConfig;
|
|
18
|
-
export declare const TrailTexture: ({ children, ...config }: TrailTextureProps) => React.JSX.Element;
|
|
19
|
-
export {};
|
package/core/TrailTexture.js
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useMemo, useCallback } from 'react';
|
|
3
|
-
import { useFrame } from '@react-three/fiber';
|
|
4
|
-
import { Texture } from 'three';
|
|
5
|
-
|
|
6
|
-
// smooth new sample (measurement) based on previous sample (current)
|
|
7
|
-
function smoothAverage(current, measurement, smoothing = 0.9) {
|
|
8
|
-
return measurement * smoothing + current * (1.0 - smoothing);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// default ease
|
|
12
|
-
const easeCircleOut = x => Math.sqrt(1 - Math.pow(x - 1, 2));
|
|
13
|
-
class TrailTextureImpl {
|
|
14
|
-
constructor({
|
|
15
|
-
size = 256,
|
|
16
|
-
maxAge = 750,
|
|
17
|
-
radius = 0.3,
|
|
18
|
-
intensity = 0.2,
|
|
19
|
-
interpolate = 0,
|
|
20
|
-
smoothing = 0,
|
|
21
|
-
minForce = 0.3,
|
|
22
|
-
blend = 'screen',
|
|
23
|
-
// source-over is canvas default. Others are slower
|
|
24
|
-
ease = easeCircleOut
|
|
25
|
-
} = {}) {
|
|
26
|
-
this.size = size;
|
|
27
|
-
this.maxAge = maxAge;
|
|
28
|
-
this.radius = radius;
|
|
29
|
-
this.intensity = intensity;
|
|
30
|
-
this.ease = ease;
|
|
31
|
-
this.interpolate = interpolate;
|
|
32
|
-
this.smoothing = smoothing;
|
|
33
|
-
this.minForce = minForce;
|
|
34
|
-
this.blend = blend;
|
|
35
|
-
this.trail = [];
|
|
36
|
-
this.force = 0;
|
|
37
|
-
this.initTexture();
|
|
38
|
-
}
|
|
39
|
-
initTexture() {
|
|
40
|
-
this.canvas = document.createElement('canvas');
|
|
41
|
-
this.canvas.width = this.canvas.height = this.size;
|
|
42
|
-
const ctx = this.canvas.getContext('2d');
|
|
43
|
-
if (ctx === null) {
|
|
44
|
-
throw new Error('2D not available');
|
|
45
|
-
}
|
|
46
|
-
this.ctx = ctx;
|
|
47
|
-
this.ctx.fillStyle = 'black';
|
|
48
|
-
this.ctx.fillRect(0, 0, this.canvas.width, this.canvas.height);
|
|
49
|
-
this.texture = new Texture(this.canvas);
|
|
50
|
-
this.canvas.id = 'touchTexture';
|
|
51
|
-
this.canvas.style.width = this.canvas.style.height = `${this.canvas.width}px`;
|
|
52
|
-
}
|
|
53
|
-
update(delta) {
|
|
54
|
-
this.clear();
|
|
55
|
-
|
|
56
|
-
// age points
|
|
57
|
-
this.trail.forEach((point, i) => {
|
|
58
|
-
point.age += delta * 1000;
|
|
59
|
-
// remove old
|
|
60
|
-
if (point.age > this.maxAge) {
|
|
61
|
-
this.trail.splice(i, 1);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
// reset force when empty (when smoothing)
|
|
66
|
-
if (!this.trail.length) this.force = 0;
|
|
67
|
-
this.trail.forEach(point => {
|
|
68
|
-
this.drawTouch(point);
|
|
69
|
-
});
|
|
70
|
-
this.texture.needsUpdate = true;
|
|
71
|
-
}
|
|
72
|
-
clear() {
|
|
73
|
-
this.ctx.globalCompositeOperation = 'source-over';
|
|
74
|
-
this.ctx.fillStyle = 'black';
|
|
75
|
-
this.ctx.fillRect(0, 0, this.canvas.width, this.canvas.height);
|
|
76
|
-
}
|
|
77
|
-
addTouch(point) {
|
|
78
|
-
const last = this.trail[this.trail.length - 1];
|
|
79
|
-
if (last) {
|
|
80
|
-
const dx = last.x - point.x;
|
|
81
|
-
const dy = last.y - point.y;
|
|
82
|
-
const dd = dx * dx + dy * dy;
|
|
83
|
-
const force = Math.max(this.minForce, Math.min(dd * 10000, 1));
|
|
84
|
-
this.force = smoothAverage(force, this.force, this.smoothing);
|
|
85
|
-
if (!!this.interpolate) {
|
|
86
|
-
const lines = Math.ceil(dd / Math.pow(this.radius * 0.5 / this.interpolate, 2));
|
|
87
|
-
if (lines > 1) {
|
|
88
|
-
for (let i = 1; i < lines; i++) {
|
|
89
|
-
this.trail.push({
|
|
90
|
-
x: last.x - dx / lines * i,
|
|
91
|
-
y: last.y - dy / lines * i,
|
|
92
|
-
age: 0,
|
|
93
|
-
force
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
this.trail.push({
|
|
100
|
-
x: point.x,
|
|
101
|
-
y: point.y,
|
|
102
|
-
age: 0,
|
|
103
|
-
force: this.force
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
drawTouch(point) {
|
|
107
|
-
const pos = {
|
|
108
|
-
x: point.x * this.size,
|
|
109
|
-
y: (1 - point.y) * this.size
|
|
110
|
-
};
|
|
111
|
-
let intensity = 1;
|
|
112
|
-
if (point.age < this.maxAge * 0.3) {
|
|
113
|
-
intensity = this.ease(point.age / (this.maxAge * 0.3));
|
|
114
|
-
} else {
|
|
115
|
-
intensity = this.ease(1 - (point.age - this.maxAge * 0.3) / (this.maxAge * 0.7));
|
|
116
|
-
}
|
|
117
|
-
intensity *= point.force;
|
|
118
|
-
|
|
119
|
-
// apply blending
|
|
120
|
-
this.ctx.globalCompositeOperation = this.blend;
|
|
121
|
-
const radius = this.size * this.radius * intensity;
|
|
122
|
-
const grd = this.ctx.createRadialGradient(pos.x, pos.y, Math.max(0, radius * 0.25), pos.x, pos.y, Math.max(0, radius));
|
|
123
|
-
grd.addColorStop(0, `rgba(255, 255, 255, ${this.intensity})`);
|
|
124
|
-
grd.addColorStop(1, `rgba(0, 0, 0, 0.0)`);
|
|
125
|
-
this.ctx.beginPath();
|
|
126
|
-
this.ctx.fillStyle = grd;
|
|
127
|
-
this.ctx.arc(pos.x, pos.y, Math.max(0, radius), 0, Math.PI * 2);
|
|
128
|
-
this.ctx.fill();
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
function useTrailTexture(config = {}) {
|
|
132
|
-
const {
|
|
133
|
-
size,
|
|
134
|
-
maxAge,
|
|
135
|
-
radius,
|
|
136
|
-
intensity,
|
|
137
|
-
interpolate,
|
|
138
|
-
smoothing,
|
|
139
|
-
minForce,
|
|
140
|
-
blend,
|
|
141
|
-
ease
|
|
142
|
-
} = config;
|
|
143
|
-
const trail = useMemo(() => new TrailTextureImpl(config), [size, maxAge, radius, intensity, interpolate, smoothing, minForce, blend, ease]);
|
|
144
|
-
useFrame((_, delta) => void trail.update(delta));
|
|
145
|
-
const onMove = useCallback(e => trail.addTouch(e.uv), [trail]);
|
|
146
|
-
return [trail.texture, onMove];
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
//
|
|
150
|
-
|
|
151
|
-
const TrailTexture = ({
|
|
152
|
-
children,
|
|
153
|
-
...config
|
|
154
|
-
}) => {
|
|
155
|
-
const ret = useTrailTexture(config);
|
|
156
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, children == null ? void 0 : children(ret));
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
export { TrailTexture, useTrailTexture };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("@react-three/fiber"),r=require("react"),n=require("three"),o=require("three-stdlib");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function s(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var a=u(e),c=s(r),i=s(n);const f=c.forwardRef((({children:e,domElement:r,onChange:n,onMouseDown:u,onMouseUp:s,onObjectChange:f,object:l,makeDefault:d,camera:v,enabled:h,axis:m,mode:E,translationSnap:b,rotationSnap:g,scaleSnap:p,space:L,size:j,showX:w,showY:y,showZ:O,...T},D)=>{const C=t.useThree((e=>e.controls)),R=t.useThree((e=>e.gl)),S=t.useThree((e=>e.events)),q=t.useThree((e=>e.camera)),x=t.useThree((e=>e.invalidate)),M=t.useThree((e=>e.get)),_=t.useThree((e=>e.set)),z=v||q,P=r||S.connected||R.domElement,U=c.useMemo((()=>new o.TransformControls(z,P)),[z,P]),k=c.useRef(null);c.useLayoutEffect((()=>(l?U.attach(l instanceof i.Object3D?l:l.current):k.current instanceof i.Object3D&&U.attach(k.current),()=>{U.detach()})),[l,e,U]),c.useEffect((()=>{if(C){const e=e=>C.enabled=!e.value;return U.addEventListener("dragging-changed",e),()=>U.removeEventListener("dragging-changed",e)}}),[U,C]);const X=c.useRef(void 0),Y=c.useRef(void 0),Z=c.useRef(void 0),F=c.useRef(void 0);return c.useLayoutEffect((()=>{X.current=n}),[n]),c.useLayoutEffect((()=>{Y.current=u}),[u]),c.useLayoutEffect((()=>{Z.current=s}),[s]),c.useLayoutEffect((()=>{F.current=f}),[f]),c.useEffect((()=>{const e=e=>{x(),null==X.current||X.current(e)},t=e=>null==Y.current?void 0:Y.current(e),r=e=>null==Z.current?void 0:Z.current(e),n=e=>null==F.current?void 0:F.current(e);return U.addEventListener("change",e),U.addEventListener("mouseDown",t),U.addEventListener("mouseUp",r),U.addEventListener("objectChange",n),()=>{U.removeEventListener("change",e),U.removeEventListener("mouseDown",t),U.removeEventListener("mouseUp",r),U.removeEventListener("objectChange",n)}}),[x,U]),c.useEffect((()=>{if(d){const e=M().controls;return _({controls:U}),()=>_({controls:e})}}),[d,U]),c.createElement(c.Fragment,null,c.createElement("primitive",{ref:D,object:U,enabled:h,axis:m,mode:E,translationSnap:b,rotationSnap:g,scaleSnap:p,space:L,size:j,showX:w,showY:y,showZ:O}),c.createElement("group",a.default({ref:k},T),e))}));exports.TransformControls=f;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { ThreeElement, ThreeElements } from '@react-three/fiber';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import * as THREE from 'three';
|
|
4
|
-
import { TransformControls as TransformControlsImpl } from 'three-stdlib';
|
|
5
|
-
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
6
|
-
export type TransformControlsProps = Omit<ThreeElement<typeof TransformControlsImpl>, 'ref' | 'args'> & Omit<ThreeElements['group'], 'ref'> & {
|
|
7
|
-
object?: THREE.Object3D | React.RefObject<THREE.Object3D>;
|
|
8
|
-
enabled?: boolean;
|
|
9
|
-
axis?: string | null;
|
|
10
|
-
domElement?: HTMLElement;
|
|
11
|
-
mode?: 'translate' | 'rotate' | 'scale';
|
|
12
|
-
translationSnap?: number | null;
|
|
13
|
-
rotationSnap?: number | null;
|
|
14
|
-
scaleSnap?: number | null;
|
|
15
|
-
space?: 'world' | 'local';
|
|
16
|
-
size?: number;
|
|
17
|
-
showX?: boolean;
|
|
18
|
-
showY?: boolean;
|
|
19
|
-
showZ?: boolean;
|
|
20
|
-
children?: React.ReactElement<THREE.Object3D>;
|
|
21
|
-
camera?: THREE.Camera;
|
|
22
|
-
onChange?: (e?: THREE.Event) => void;
|
|
23
|
-
onMouseDown?: (e?: THREE.Event) => void;
|
|
24
|
-
onMouseUp?: (e?: THREE.Event) => void;
|
|
25
|
-
onObjectChange?: (e?: THREE.Event) => void;
|
|
26
|
-
makeDefault?: boolean;
|
|
27
|
-
};
|
|
28
|
-
export declare const TransformControls: ForwardRefComponent<TransformControlsProps, TransformControlsImpl>;
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
2
|
-
import { useThree } from '@react-three/fiber';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import * as THREE from 'three';
|
|
5
|
-
import { TransformControls as TransformControls$1 } from 'three-stdlib';
|
|
6
|
-
|
|
7
|
-
const TransformControls = /* @__PURE__ */React.forwardRef(({
|
|
8
|
-
children,
|
|
9
|
-
domElement,
|
|
10
|
-
onChange,
|
|
11
|
-
onMouseDown,
|
|
12
|
-
onMouseUp,
|
|
13
|
-
onObjectChange,
|
|
14
|
-
object,
|
|
15
|
-
makeDefault,
|
|
16
|
-
camera,
|
|
17
|
-
// Transform
|
|
18
|
-
enabled,
|
|
19
|
-
axis,
|
|
20
|
-
mode,
|
|
21
|
-
translationSnap,
|
|
22
|
-
rotationSnap,
|
|
23
|
-
scaleSnap,
|
|
24
|
-
space,
|
|
25
|
-
size,
|
|
26
|
-
showX,
|
|
27
|
-
showY,
|
|
28
|
-
showZ,
|
|
29
|
-
...props
|
|
30
|
-
}, ref) => {
|
|
31
|
-
const defaultControls = useThree(state => state.controls);
|
|
32
|
-
const gl = useThree(state => state.gl);
|
|
33
|
-
const events = useThree(state => state.events);
|
|
34
|
-
const defaultCamera = useThree(state => state.camera);
|
|
35
|
-
const invalidate = useThree(state => state.invalidate);
|
|
36
|
-
const get = useThree(state => state.get);
|
|
37
|
-
const set = useThree(state => state.set);
|
|
38
|
-
const explCamera = camera || defaultCamera;
|
|
39
|
-
const explDomElement = domElement || events.connected || gl.domElement;
|
|
40
|
-
const controls = React.useMemo(() => new TransformControls$1(explCamera, explDomElement), [explCamera, explDomElement]);
|
|
41
|
-
const group = React.useRef(null);
|
|
42
|
-
React.useLayoutEffect(() => {
|
|
43
|
-
if (object) {
|
|
44
|
-
controls.attach(object instanceof THREE.Object3D ? object : object.current);
|
|
45
|
-
} else if (group.current instanceof THREE.Object3D) {
|
|
46
|
-
controls.attach(group.current);
|
|
47
|
-
}
|
|
48
|
-
return () => void controls.detach();
|
|
49
|
-
}, [object, children, controls]);
|
|
50
|
-
React.useEffect(() => {
|
|
51
|
-
if (defaultControls) {
|
|
52
|
-
const callback = event => defaultControls.enabled = !event.value;
|
|
53
|
-
controls.addEventListener('dragging-changed', callback);
|
|
54
|
-
return () => controls.removeEventListener('dragging-changed', callback);
|
|
55
|
-
}
|
|
56
|
-
}, [controls, defaultControls]);
|
|
57
|
-
const onChangeRef = React.useRef(undefined);
|
|
58
|
-
const onMouseDownRef = React.useRef(undefined);
|
|
59
|
-
const onMouseUpRef = React.useRef(undefined);
|
|
60
|
-
const onObjectChangeRef = React.useRef(undefined);
|
|
61
|
-
React.useLayoutEffect(() => void (onChangeRef.current = onChange), [onChange]);
|
|
62
|
-
React.useLayoutEffect(() => void (onMouseDownRef.current = onMouseDown), [onMouseDown]);
|
|
63
|
-
React.useLayoutEffect(() => void (onMouseUpRef.current = onMouseUp), [onMouseUp]);
|
|
64
|
-
React.useLayoutEffect(() => void (onObjectChangeRef.current = onObjectChange), [onObjectChange]);
|
|
65
|
-
React.useEffect(() => {
|
|
66
|
-
const onChange = e => {
|
|
67
|
-
invalidate();
|
|
68
|
-
onChangeRef.current == null || onChangeRef.current(e);
|
|
69
|
-
};
|
|
70
|
-
const onMouseDown = e => onMouseDownRef.current == null ? void 0 : onMouseDownRef.current(e);
|
|
71
|
-
const onMouseUp = e => onMouseUpRef.current == null ? void 0 : onMouseUpRef.current(e);
|
|
72
|
-
const onObjectChange = e => onObjectChangeRef.current == null ? void 0 : onObjectChangeRef.current(e);
|
|
73
|
-
controls.addEventListener('change', onChange);
|
|
74
|
-
controls.addEventListener('mouseDown', onMouseDown);
|
|
75
|
-
controls.addEventListener('mouseUp', onMouseUp);
|
|
76
|
-
controls.addEventListener('objectChange', onObjectChange);
|
|
77
|
-
return () => {
|
|
78
|
-
controls.removeEventListener('change', onChange);
|
|
79
|
-
controls.removeEventListener('mouseDown', onMouseDown);
|
|
80
|
-
controls.removeEventListener('mouseUp', onMouseUp);
|
|
81
|
-
controls.removeEventListener('objectChange', onObjectChange);
|
|
82
|
-
};
|
|
83
|
-
}, [invalidate, controls]);
|
|
84
|
-
React.useEffect(() => {
|
|
85
|
-
if (makeDefault) {
|
|
86
|
-
const old = get().controls;
|
|
87
|
-
set({
|
|
88
|
-
controls
|
|
89
|
-
});
|
|
90
|
-
return () => set({
|
|
91
|
-
controls: old
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
}, [makeDefault, controls]);
|
|
95
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("primitive", {
|
|
96
|
-
ref: ref,
|
|
97
|
-
object: controls,
|
|
98
|
-
enabled: enabled,
|
|
99
|
-
axis: axis,
|
|
100
|
-
mode: mode,
|
|
101
|
-
translationSnap: translationSnap,
|
|
102
|
-
rotationSnap: rotationSnap,
|
|
103
|
-
scaleSnap: scaleSnap,
|
|
104
|
-
space: space,
|
|
105
|
-
size: size,
|
|
106
|
-
showX: showX,
|
|
107
|
-
showY: showY,
|
|
108
|
-
showZ: showZ
|
|
109
|
-
}), /*#__PURE__*/React.createElement("group", _extends({
|
|
110
|
-
ref: group
|
|
111
|
-
}, props), children));
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
export { TransformControls };
|
package/core/VideoTexture.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("three"),t=require("@react-three/fiber"),n=require("suspend-react"),o=require("hls.js");function u(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}})),r.default=e,Object.freeze(r)}var s=u(e),a=u(r);const c=((e,r)=>"undefined"!=typeof window&&"function"==typeof(null==(e=window.document)?void 0:e.createElement)&&"string"==typeof(null==(r=window.navigator)?void 0:r.userAgent))();let i=null;function l(r,{unsuspend:s="loadedmetadata",start:l=!0,hls:d={},crossOrigin:p="anonymous",muted:m=!0,loop:v=!0,playsInline:y=!0,onVideoFrame:b,...g}={}){const w=t.useThree((e=>e.gl)),h=e.useRef(null),E=n.suspend((()=>new Promise((async e=>{let t,n;"string"==typeof r?t=r:n=r;const l=Object.assign(document.createElement("video"),{src:t,srcObject:n,crossOrigin:p,loop:v,muted:m,playsInline:y,...g});if(t&&c&&t.endsWith(".m3u8")){const e=h.current=await async function(...e){var r;null!==(r=i)&&void 0!==r||(i=await Promise.resolve().then((function(){return u(require("hls.js"))})));const t=i.default;return t.isSupported()?new t(...e):null}(d);e&&(e.on(o.Events.MEDIA_ATTACHED,(()=>{e.loadSource(t)})),e.attachMedia(l))}const f=new a.VideoTexture(l);f.colorSpace=w.outputColorSpace,l.addEventListener(s,(()=>e(f)))}))),[r]),O=E.source.data;return f(O,b),e.useEffect((()=>(l&&E.image.play(),()=>{h.current&&(h.current.destroy(),h.current=null)})),[E,l]),E}const d=e.forwardRef((({children:r,src:t,...n},o)=>{const u=l(t,n);return e.useEffect((()=>()=>{u.dispose()}),[u]),e.useImperativeHandle(o,(()=>u),[u]),s.createElement(s.Fragment,null,null==r?void 0:r(u))})),f=(r,t)=>{e.useEffect((()=>{if(!t)return;if(!r.requestVideoFrameCallback)return;let e;const n=(...o)=>{t(...o),e=r.requestVideoFrameCallback(n)};return r.requestVideoFrameCallback(n),()=>r.cancelVideoFrameCallback(e)}),[r,t])};exports.VideoTexture=d,exports.useVideoTexture=l;
|
package/core/VideoTexture.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as THREE from 'three';
|
|
3
|
-
import { type default as Hls } from 'hls.js';
|
|
4
|
-
declare function getHls(...args: ConstructorParameters<typeof Hls>): Promise<Hls | null>;
|
|
5
|
-
export declare function useVideoTexture(srcOrSrcObject: HTMLVideoElement['src' | 'srcObject'], { unsuspend, start, hls: hlsConfig, crossOrigin, muted, loop, playsInline, onVideoFrame, ...videoProps }?: {
|
|
6
|
-
unsuspend?: keyof HTMLVideoElementEventMap;
|
|
7
|
-
start?: boolean;
|
|
8
|
-
hls?: Parameters<typeof getHls>[0];
|
|
9
|
-
onVideoFrame?: VideoFrameRequestCallback;
|
|
10
|
-
} & Partial<Omit<HTMLVideoElement, 'children' | 'src' | 'srcObject'>>): THREE.VideoTexture;
|
|
11
|
-
type UseVideoTextureParams = Parameters<typeof useVideoTexture>;
|
|
12
|
-
type VideoTexture = ReturnType<typeof useVideoTexture>;
|
|
13
|
-
export type VideoTextureProps = {
|
|
14
|
-
children?: (texture: VideoTexture) => React.ReactNode;
|
|
15
|
-
src: UseVideoTextureParams[0];
|
|
16
|
-
} & UseVideoTextureParams[1];
|
|
17
|
-
export declare const VideoTexture: React.ForwardRefExoticComponent<{
|
|
18
|
-
children?: (texture: VideoTexture) => React.ReactNode;
|
|
19
|
-
src: UseVideoTextureParams[0];
|
|
20
|
-
} & {
|
|
21
|
-
unsuspend?: keyof HTMLVideoElementEventMap;
|
|
22
|
-
start?: boolean;
|
|
23
|
-
hls?: Parameters<typeof getHls>[0];
|
|
24
|
-
onVideoFrame?: VideoFrameRequestCallback;
|
|
25
|
-
} & Partial<Omit<HTMLVideoElement, "children" | "src" | "srcObject">> & React.RefAttributes<THREE.VideoTexture>>;
|
|
26
|
-
export {};
|