@react-three/drei 10.7.6 → 10.8.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
package/core/Stars.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useFrame } from '@react-three/fiber';
|
|
3
|
-
import { Color, AdditiveBlending, ShaderMaterial, Vector3, Spherical } from 'three';
|
|
4
|
-
import { version } from '../helpers/constants.js';
|
|
5
|
-
|
|
6
|
-
class StarfieldMaterial extends ShaderMaterial {
|
|
7
|
-
constructor() {
|
|
8
|
-
super({
|
|
9
|
-
uniforms: {
|
|
10
|
-
time: {
|
|
11
|
-
value: 0.0
|
|
12
|
-
},
|
|
13
|
-
fade: {
|
|
14
|
-
value: 1.0
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
vertexShader: /* glsl */`
|
|
18
|
-
uniform float time;
|
|
19
|
-
attribute float size;
|
|
20
|
-
varying vec3 vColor;
|
|
21
|
-
void main() {
|
|
22
|
-
vColor = color;
|
|
23
|
-
vec4 mvPosition = modelViewMatrix * vec4(position, 0.5);
|
|
24
|
-
gl_PointSize = size * (30.0 / -mvPosition.z) * (3.0 + sin(time + 100.0));
|
|
25
|
-
gl_Position = projectionMatrix * mvPosition;
|
|
26
|
-
}`,
|
|
27
|
-
fragmentShader: /* glsl */`
|
|
28
|
-
uniform sampler2D pointTexture;
|
|
29
|
-
uniform float fade;
|
|
30
|
-
varying vec3 vColor;
|
|
31
|
-
void main() {
|
|
32
|
-
float opacity = 1.0;
|
|
33
|
-
if (fade == 1.0) {
|
|
34
|
-
float d = distance(gl_PointCoord, vec2(0.5, 0.5));
|
|
35
|
-
opacity = 1.0 / (1.0 + exp(16.0 * (d - 0.25)));
|
|
36
|
-
}
|
|
37
|
-
gl_FragColor = vec4(vColor, opacity);
|
|
38
|
-
|
|
39
|
-
#include <tonemapping_fragment>
|
|
40
|
-
#include <${version >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>
|
|
41
|
-
}`
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
const genStar = r => {
|
|
46
|
-
return new Vector3().setFromSpherical(new Spherical(r, Math.acos(1 - Math.random() * 2), Math.random() * 2 * Math.PI));
|
|
47
|
-
};
|
|
48
|
-
const Stars = /* @__PURE__ */React.forwardRef(({
|
|
49
|
-
radius = 100,
|
|
50
|
-
depth = 50,
|
|
51
|
-
count = 5000,
|
|
52
|
-
saturation = 0,
|
|
53
|
-
factor = 4,
|
|
54
|
-
fade = false,
|
|
55
|
-
speed = 1
|
|
56
|
-
}, ref) => {
|
|
57
|
-
const material = React.useRef(null);
|
|
58
|
-
const [position, color, size] = React.useMemo(() => {
|
|
59
|
-
const positions = [];
|
|
60
|
-
const colors = [];
|
|
61
|
-
const sizes = Array.from({
|
|
62
|
-
length: count
|
|
63
|
-
}, () => (0.5 + 0.5 * Math.random()) * factor);
|
|
64
|
-
const color = new Color();
|
|
65
|
-
let r = radius + depth;
|
|
66
|
-
const increment = depth / count;
|
|
67
|
-
for (let i = 0; i < count; i++) {
|
|
68
|
-
r -= increment * Math.random();
|
|
69
|
-
positions.push(...genStar(r).toArray());
|
|
70
|
-
color.setHSL(i / count, saturation, 0.9);
|
|
71
|
-
colors.push(color.r, color.g, color.b);
|
|
72
|
-
}
|
|
73
|
-
return [new Float32Array(positions), new Float32Array(colors), new Float32Array(sizes)];
|
|
74
|
-
}, [count, depth, factor, radius, saturation]);
|
|
75
|
-
useFrame(state => material.current && (material.current.uniforms.time.value = state.clock.elapsedTime * speed));
|
|
76
|
-
const [starfieldMaterial] = React.useState(() => new StarfieldMaterial());
|
|
77
|
-
return /*#__PURE__*/React.createElement("points", {
|
|
78
|
-
ref: ref
|
|
79
|
-
}, /*#__PURE__*/React.createElement("bufferGeometry", null, /*#__PURE__*/React.createElement("bufferAttribute", {
|
|
80
|
-
attach: "attributes-position",
|
|
81
|
-
args: [position, 3]
|
|
82
|
-
}), /*#__PURE__*/React.createElement("bufferAttribute", {
|
|
83
|
-
attach: "attributes-color",
|
|
84
|
-
args: [color, 3]
|
|
85
|
-
}), /*#__PURE__*/React.createElement("bufferAttribute", {
|
|
86
|
-
attach: "attributes-size",
|
|
87
|
-
args: [size, 1]
|
|
88
|
-
})), /*#__PURE__*/React.createElement("primitive", {
|
|
89
|
-
ref: material,
|
|
90
|
-
object: starfieldMaterial,
|
|
91
|
-
attach: "material",
|
|
92
|
-
blending: AdditiveBlending,
|
|
93
|
-
"uniforms-fade-value": fade,
|
|
94
|
-
depthWrite: false,
|
|
95
|
-
transparent: true,
|
|
96
|
-
vertexColors: true
|
|
97
|
-
}));
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
export { Stars };
|
package/core/Stats.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@react-three/fiber"),r=require("stats.js"),n=require("../helpers/useEffectfulState.cjs.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function c(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 f=c(e),l=u(r);exports.Stats=function({showPanel:e=0,className:r,parent:u}){const c=n.useEffectfulState((()=>new l.default),[]);return f.useEffect((()=>{if(c){const n=u&&u.current||document.body;c.showPanel(e),null==n||n.appendChild(c.dom);const f=(null!=r?r:"").split(" ").filter((e=>e));f.length&&c.dom.classList.add(...f);const l=t.addEffect((()=>c.begin())),s=t.addAfterEffect((()=>c.end()));return()=>{f.length&&c.dom.classList.remove(...f),null==n||n.removeChild(c.dom),l(),s()}}}),[u,c,r,e]),null};
|
package/core/Stats.d.ts
DELETED
package/core/Stats.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { addEffect, addAfterEffect } from '@react-three/fiber';
|
|
3
|
-
import StatsImpl from 'stats.js';
|
|
4
|
-
import { useEffectfulState } from '../helpers/useEffectfulState.js';
|
|
5
|
-
|
|
6
|
-
function Stats({
|
|
7
|
-
showPanel = 0,
|
|
8
|
-
className,
|
|
9
|
-
parent
|
|
10
|
-
}) {
|
|
11
|
-
const stats = useEffectfulState(() => new StatsImpl(), []);
|
|
12
|
-
React.useEffect(() => {
|
|
13
|
-
if (stats) {
|
|
14
|
-
const node = parent && parent.current || document.body;
|
|
15
|
-
stats.showPanel(showPanel);
|
|
16
|
-
node == null || node.appendChild(stats.dom);
|
|
17
|
-
const classNames = (className !== null && className !== void 0 ? className : '').split(' ').filter(cls => cls);
|
|
18
|
-
if (classNames.length) stats.dom.classList.add(...classNames);
|
|
19
|
-
const begin = addEffect(() => stats.begin());
|
|
20
|
-
const end = addAfterEffect(() => stats.end());
|
|
21
|
-
return () => {
|
|
22
|
-
if (classNames.length) stats.dom.classList.remove(...classNames);
|
|
23
|
-
node == null || node.removeChild(stats.dom);
|
|
24
|
-
begin();
|
|
25
|
-
end();
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
}, [parent, stats, className, showPanel]);
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export { Stats };
|
package/core/StatsGl.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("stats-gl");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function l(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var 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 o=l(t),u=n(r);const s=o.forwardRef((function({className:t,parent:r,id:n,clearStatsGlStyle:l,...s},c){const a=e.useThree((e=>e.gl)),d=o.useMemo((()=>{const e=new u.default({...s});return e.init(a),e}),[a]);return o.useImperativeHandle(c,(()=>d.domElement),[d]),o.useEffect((()=>{if(d){const o=r&&r.current||document.body;null==o||o.appendChild(d.domElement),d.domElement.querySelectorAll("canvas").forEach((e=>{e.style.removeProperty("position")})),n&&(d.domElement.id=n),l&&d.domElement.removeAttribute("style"),d.domElement.removeAttribute("style");const u=(null!=t?t:"").split(" ").filter((e=>e));u.length&&d.domElement.classList.add(...u);const s=e.addAfterEffect((()=>d.update()));return()=>{u.length&&d.domElement.classList.remove(...u),null==o||o.removeChild(d.domElement),s()}}}),[r,d,t,n,l]),null}));exports.StatsGl=s;
|
package/core/StatsGl.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import Stats from 'stats-gl';
|
|
4
|
-
type StatsOptions = ConstructorParameters<typeof Stats>[0];
|
|
5
|
-
export type StatsGlProps = Partial<StatsOptions> & {
|
|
6
|
-
id?: string;
|
|
7
|
-
clearStatsGlStyle?: boolean;
|
|
8
|
-
showPanel?: number;
|
|
9
|
-
className?: string;
|
|
10
|
-
parent?: React.RefObject<HTMLElement>;
|
|
11
|
-
ref?: React.RefObject<HTMLElement>;
|
|
12
|
-
};
|
|
13
|
-
export declare const StatsGl: ForwardRefComponent<StatsGlProps, HTMLDivElement>;
|
|
14
|
-
export {};
|
package/core/StatsGl.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { useThree, addAfterEffect } from '@react-three/fiber';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import Stats from 'stats-gl';
|
|
4
|
-
|
|
5
|
-
const StatsGl = /* @__PURE__ */React.forwardRef(function StatsGl({
|
|
6
|
-
className,
|
|
7
|
-
parent,
|
|
8
|
-
id,
|
|
9
|
-
clearStatsGlStyle,
|
|
10
|
-
...props
|
|
11
|
-
}, fref) {
|
|
12
|
-
const gl = useThree(state => state.gl);
|
|
13
|
-
const stats = React.useMemo(() => {
|
|
14
|
-
const stats = new Stats({
|
|
15
|
-
...props
|
|
16
|
-
});
|
|
17
|
-
stats.init(gl);
|
|
18
|
-
return stats;
|
|
19
|
-
}, [gl]);
|
|
20
|
-
React.useImperativeHandle(fref, () => stats.domElement, [stats]);
|
|
21
|
-
React.useEffect(() => {
|
|
22
|
-
if (stats) {
|
|
23
|
-
const node = parent && parent.current || document.body;
|
|
24
|
-
node == null || node.appendChild(stats.domElement);
|
|
25
|
-
stats.domElement.querySelectorAll('canvas').forEach(canvas => {
|
|
26
|
-
canvas.style.removeProperty('position');
|
|
27
|
-
});
|
|
28
|
-
if (id) stats.domElement.id = id;
|
|
29
|
-
if (clearStatsGlStyle) stats.domElement.removeAttribute('style');
|
|
30
|
-
stats.domElement.removeAttribute('style');
|
|
31
|
-
const classNames = (className !== null && className !== void 0 ? className : '').split(' ').filter(cls => cls);
|
|
32
|
-
if (classNames.length) stats.domElement.classList.add(...classNames);
|
|
33
|
-
const end = addAfterEffect(() => stats.update());
|
|
34
|
-
return () => {
|
|
35
|
-
if (classNames.length) stats.domElement.classList.remove(...classNames);
|
|
36
|
-
node == null || node.removeChild(stats.domElement);
|
|
37
|
-
end();
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
}, [parent, stats, className, id, clearStatsGlStyle]);
|
|
41
|
-
return null;
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
export { StatsGl };
|
package/core/Svg.cjs.js
DELETED
|
@@ -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"),a=require("three"),s=require("three-stdlib");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}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 a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var i=l(e),u=o(r);const n=r.forwardRef((function({src:e,skipFill:l,skipStrokes:o,fillMaterial:n,strokeMaterial:c,fillMeshProps:d,strokeMeshProps:f,...p},m){const y=t.useLoader(s.SVGLoader,e.startsWith("<svg")?`data:image/svg+xml;utf8,${e}`:e),h=r.useMemo((()=>o?[]:y.paths.map((e=>{var t;return void 0===(null==(t=e.userData)?void 0:t.style.stroke)||"none"===e.userData.style.stroke?null:e.subPaths.map((t=>s.SVGLoader.pointsToStroke(t.getPoints(),e.userData.style)))}))),[y,o]);r.useEffect((()=>()=>h.forEach((e=>e&&e.map((e=>e.dispose()))))),[h]);let b=0;return u.createElement("object3D",i.default({ref:m},p),u.createElement("object3D",{scale:[1,-1,1]},y.paths.map(((e,t)=>{var p,m;return u.createElement(r.Fragment,{key:t},!l&&void 0!==(null==(p=e.userData)?void 0:p.style.fill)&&"none"!==e.userData.style.fill&&s.SVGLoader.createShapes(e).map(((t,r)=>u.createElement("mesh",i.default({key:r},d,{renderOrder:b++}),u.createElement("shapeGeometry",{args:[t]}),u.createElement("meshBasicMaterial",i.default({color:e.userData.style.fill,opacity:e.userData.style.fillOpacity,transparent:!0,side:a.DoubleSide,depthWrite:!1},n))))),!o&&void 0!==(null==(m=e.userData)?void 0:m.style.stroke)&&"none"!==e.userData.style.stroke&&e.subPaths.map(((r,s)=>u.createElement("mesh",i.default({key:s,geometry:h[t][s]},f,{renderOrder:b++}),u.createElement("meshBasicMaterial",i.default({color:e.userData.style.stroke,opacity:e.userData.style.strokeOpacity,transparent:!0,side:a.DoubleSide,depthWrite:!1},c))))))}))))}));exports.Svg=n;
|
package/core/Svg.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ThreeElements } from '@react-three/fiber';
|
|
2
|
-
import { Object3D } from 'three';
|
|
3
|
-
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
4
|
-
export interface SvgProps extends Omit<ThreeElements['object3D'], 'ref'> {
|
|
5
|
-
src: string;
|
|
6
|
-
skipFill?: boolean;
|
|
7
|
-
skipStrokes?: boolean;
|
|
8
|
-
fillMaterial?: ThreeElements['meshBasicMaterial'];
|
|
9
|
-
strokeMaterial?: ThreeElements['meshBasicMaterial'];
|
|
10
|
-
fillMeshProps?: ThreeElements['mesh'];
|
|
11
|
-
strokeMeshProps?: ThreeElements['mesh'];
|
|
12
|
-
}
|
|
13
|
-
export declare const Svg: ForwardRefComponent<SvgProps, Object3D>;
|
package/core/Svg.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
2
|
-
import { useLoader } from '@react-three/fiber';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { forwardRef, useMemo, useEffect, Fragment } from 'react';
|
|
5
|
-
import { DoubleSide } from 'three';
|
|
6
|
-
import { SVGLoader } from 'three-stdlib';
|
|
7
|
-
|
|
8
|
-
const Svg = /* @__PURE__ */forwardRef(function R3FSvg({
|
|
9
|
-
src,
|
|
10
|
-
skipFill,
|
|
11
|
-
skipStrokes,
|
|
12
|
-
fillMaterial,
|
|
13
|
-
strokeMaterial,
|
|
14
|
-
fillMeshProps,
|
|
15
|
-
strokeMeshProps,
|
|
16
|
-
...props
|
|
17
|
-
}, ref) {
|
|
18
|
-
const svg = useLoader(SVGLoader, !src.startsWith('<svg') ? src : `data:image/svg+xml;utf8,${src}`);
|
|
19
|
-
const strokeGeometries = useMemo(() => skipStrokes ? [] : svg.paths.map(path => {
|
|
20
|
-
var _path$userData;
|
|
21
|
-
return ((_path$userData = path.userData) == null ? void 0 : _path$userData.style.stroke) === undefined || path.userData.style.stroke === 'none' ? null : path.subPaths.map(subPath => SVGLoader.pointsToStroke(subPath.getPoints(), path.userData.style));
|
|
22
|
-
}), [svg, skipStrokes]);
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
return () => strokeGeometries.forEach(group => group && group.map(g => g.dispose()));
|
|
25
|
-
}, [strokeGeometries]);
|
|
26
|
-
let renderOrder = 0;
|
|
27
|
-
return /*#__PURE__*/React.createElement("object3D", _extends({
|
|
28
|
-
ref: ref
|
|
29
|
-
}, props), /*#__PURE__*/React.createElement("object3D", {
|
|
30
|
-
scale: [1, -1, 1]
|
|
31
|
-
}, svg.paths.map((path, p) => {
|
|
32
|
-
var _path$userData2, _path$userData3;
|
|
33
|
-
return /*#__PURE__*/React.createElement(Fragment, {
|
|
34
|
-
key: p
|
|
35
|
-
}, !skipFill && ((_path$userData2 = path.userData) == null ? void 0 : _path$userData2.style.fill) !== undefined && path.userData.style.fill !== 'none' && SVGLoader.createShapes(path).map((shape, s) => /*#__PURE__*/React.createElement("mesh", _extends({
|
|
36
|
-
key: s
|
|
37
|
-
}, fillMeshProps, {
|
|
38
|
-
renderOrder: renderOrder++
|
|
39
|
-
}), /*#__PURE__*/React.createElement("shapeGeometry", {
|
|
40
|
-
args: [shape]
|
|
41
|
-
}), /*#__PURE__*/React.createElement("meshBasicMaterial", _extends({
|
|
42
|
-
color: path.userData.style.fill,
|
|
43
|
-
opacity: path.userData.style.fillOpacity,
|
|
44
|
-
transparent: true,
|
|
45
|
-
side: DoubleSide,
|
|
46
|
-
depthWrite: false
|
|
47
|
-
}, fillMaterial)))), !skipStrokes && ((_path$userData3 = path.userData) == null ? void 0 : _path$userData3.style.stroke) !== undefined && path.userData.style.stroke !== 'none' && path.subPaths.map((_subPath, s) => /*#__PURE__*/React.createElement("mesh", _extends({
|
|
48
|
-
key: s,
|
|
49
|
-
geometry: strokeGeometries[p][s]
|
|
50
|
-
}, strokeMeshProps, {
|
|
51
|
-
renderOrder: renderOrder++
|
|
52
|
-
}), /*#__PURE__*/React.createElement("meshBasicMaterial", _extends({
|
|
53
|
-
color: path.userData.style.stroke,
|
|
54
|
-
opacity: path.userData.style.strokeOpacity,
|
|
55
|
-
transparent: true,
|
|
56
|
-
side: DoubleSide,
|
|
57
|
-
depthWrite: false
|
|
58
|
-
}, strokeMaterial)))));
|
|
59
|
-
})));
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
export { Svg };
|
package/core/Text.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("react"),r=require("troika-three-text"),n=require("@react-three/fiber"),o=require("suspend-react");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function u(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=c(e),i=u(t);const f=i.forwardRef((({sdfGlyphSize:e=64,anchorX:t="center",anchorY:c="middle",font:u,fontSize:f=1,children:s,characters:d,onSync:l,...p},h)=>{const b=n.useThree((({invalidate:e})=>e)),[y]=i.useState((()=>new r.Text)),[j,m]=i.useMemo((()=>{const e=[];let t="";return i.Children.forEach(s,(r=>{"string"==typeof r||"number"==typeof r?t+=r:e.push(r)})),[e,t]}),[s]);return o.suspend((()=>new Promise((e=>r.preloadFont({font:u,characters:d},e)))),["troika-text",u,d]),i.useLayoutEffect((()=>{y.sync((()=>{b(),l&&l(y)}))})),i.useEffect((()=>()=>y.dispose()),[y]),i.createElement("primitive",a.default({object:y,ref:h,font:u,text:m,anchorX:t,anchorY:c,fontSize:f,sdfGlyphSize:e},p),j)}));exports.Text=f;
|
package/core/Text.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ReactThreeFiber, ThreeElements } from '@react-three/fiber';
|
|
3
|
-
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
4
|
-
export type TextProps = Omit<ThreeElements['mesh'], 'ref'> & {
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
characters?: string;
|
|
7
|
-
color?: ReactThreeFiber.Color;
|
|
8
|
-
fontSize?: number;
|
|
9
|
-
fontWeight?: number | string;
|
|
10
|
-
fontStyle?: 'italic' | 'normal';
|
|
11
|
-
maxWidth?: number;
|
|
12
|
-
lineHeight?: number;
|
|
13
|
-
letterSpacing?: number;
|
|
14
|
-
textAlign?: 'left' | 'right' | 'center' | 'justify';
|
|
15
|
-
font?: string;
|
|
16
|
-
anchorX?: number | 'left' | 'center' | 'right';
|
|
17
|
-
anchorY?: number | 'top' | 'top-baseline' | 'middle' | 'bottom-baseline' | 'bottom';
|
|
18
|
-
clipRect?: [number, number, number, number];
|
|
19
|
-
depthOffset?: number;
|
|
20
|
-
direction?: 'auto' | 'ltr' | 'rtl';
|
|
21
|
-
overflowWrap?: 'normal' | 'break-word';
|
|
22
|
-
whiteSpace?: 'normal' | 'overflowWrap' | 'nowrap';
|
|
23
|
-
outlineWidth?: number | string;
|
|
24
|
-
outlineOffsetX?: number | string;
|
|
25
|
-
outlineOffsetY?: number | string;
|
|
26
|
-
outlineBlur?: number | string;
|
|
27
|
-
outlineColor?: ReactThreeFiber.Color;
|
|
28
|
-
outlineOpacity?: number;
|
|
29
|
-
strokeWidth?: number | string;
|
|
30
|
-
strokeColor?: ReactThreeFiber.Color;
|
|
31
|
-
strokeOpacity?: number;
|
|
32
|
-
fillOpacity?: number;
|
|
33
|
-
sdfGlyphSize?: number;
|
|
34
|
-
debugSDF?: boolean;
|
|
35
|
-
glyphGeometryDetail?: number;
|
|
36
|
-
onSync?: (troika: any) => void;
|
|
37
|
-
};
|
|
38
|
-
export declare const Text: ForwardRefComponent<TextProps, any>;
|
package/core/Text.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { Text as Text$1, preloadFont } from 'troika-three-text';
|
|
4
|
-
import { useThree } from '@react-three/fiber';
|
|
5
|
-
import { suspend } from 'suspend-react';
|
|
6
|
-
|
|
7
|
-
const Text = /* @__PURE__ */React.forwardRef(({
|
|
8
|
-
sdfGlyphSize = 64,
|
|
9
|
-
anchorX = 'center',
|
|
10
|
-
anchorY = 'middle',
|
|
11
|
-
font,
|
|
12
|
-
fontSize = 1,
|
|
13
|
-
children,
|
|
14
|
-
characters,
|
|
15
|
-
onSync,
|
|
16
|
-
...props
|
|
17
|
-
}, ref) => {
|
|
18
|
-
const invalidate = useThree(({
|
|
19
|
-
invalidate
|
|
20
|
-
}) => invalidate);
|
|
21
|
-
const [troikaMesh] = React.useState(() => new Text$1());
|
|
22
|
-
const [nodes, text] = React.useMemo(() => {
|
|
23
|
-
const n = [];
|
|
24
|
-
let t = '';
|
|
25
|
-
React.Children.forEach(children, child => {
|
|
26
|
-
if (typeof child === 'string' || typeof child === 'number') {
|
|
27
|
-
t += child;
|
|
28
|
-
} else {
|
|
29
|
-
n.push(child);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
return [n, t];
|
|
33
|
-
}, [children]);
|
|
34
|
-
suspend(() => new Promise(res => preloadFont({
|
|
35
|
-
font,
|
|
36
|
-
characters
|
|
37
|
-
}, res)), ['troika-text', font, characters]);
|
|
38
|
-
React.useLayoutEffect(() => void troikaMesh.sync(() => {
|
|
39
|
-
invalidate();
|
|
40
|
-
if (onSync) onSync(troikaMesh);
|
|
41
|
-
}));
|
|
42
|
-
React.useEffect(() => {
|
|
43
|
-
return () => troikaMesh.dispose();
|
|
44
|
-
}, [troikaMesh]);
|
|
45
|
-
return /*#__PURE__*/React.createElement("primitive", _extends({
|
|
46
|
-
object: troikaMesh,
|
|
47
|
-
ref: ref,
|
|
48
|
-
font: font,
|
|
49
|
-
text: text,
|
|
50
|
-
anchorX: anchorX,
|
|
51
|
-
anchorY: anchorY,
|
|
52
|
-
fontSize: fontSize,
|
|
53
|
-
sdfGlyphSize: sdfGlyphSize
|
|
54
|
-
}, props), nodes);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
export { Text };
|
package/core/Text3D.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("react"),r=require("@react-three/fiber"),n=require("three-stdlib"),u=require("./useFont.cjs.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function c(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("suspend-react");var i=s(e),l=c(t);const o=["string","number"],a=l.forwardRef((({font:e,letterSpacing:s=0,lineHeight:c=1,size:a=1,height:f=.2,bevelThickness:m=.1,bevelSize:b=.01,bevelEnabled:d=!1,bevelOffset:g=0,bevelSegments:h=4,curveSegments:v=8,smooth:p,children:y,...j},x)=>{l.useMemo((()=>r.extend({RenamedTextGeometry:n.TextGeometry})),[]);const O=l.useRef(null),S=u.useFont(e),E=t.useMemo((()=>({font:S,size:a,height:f,bevelThickness:m,bevelSize:b,bevelEnabled:d,bevelSegments:h,bevelOffset:g,curveSegments:v,letterSpacing:s,lineHeight:c})),[S,a,f,m,b,d,h,g,v,s,c]),[q,...M]=t.useMemo((()=>(e=>{let t="";const r=[];return l.Children.forEach(e,(e=>{o.includes(typeof e)?t+=e+"":r.push(e)})),[t,...r]})(y)),[y]),T=l.useMemo((()=>[q,E]),[q,E]);return l.useLayoutEffect((()=>{p&&(O.current.geometry=n.mergeVertices(O.current.geometry,p),O.current.geometry.computeVertexNormals())}),[T,p]),l.useImperativeHandle(x,(()=>O.current),[]),l.createElement("mesh",i.default({},j,{ref:O}),l.createElement("renamedTextGeometry",{args:T}),M)}));exports.Text3D=a;
|
package/core/Text3D.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as THREE from 'three';
|
|
3
|
-
import { ThreeElement, ThreeElements } from '@react-three/fiber';
|
|
4
|
-
import { TextGeometry, TextGeometryParameters } from 'three-stdlib';
|
|
5
|
-
import { FontData } from './useFont';
|
|
6
|
-
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
7
|
-
declare module '@react-three/fiber' {
|
|
8
|
-
interface ThreeElements {
|
|
9
|
-
renamedTextGeometry: ThreeElement<typeof TextGeometry>;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
export type Text3DProps = Omit<ThreeElements['mesh'], 'ref'> & {
|
|
13
|
-
font: FontData | string;
|
|
14
|
-
bevelSegments?: number;
|
|
15
|
-
smooth?: number;
|
|
16
|
-
} & Omit<TextGeometryParameters, 'font'>;
|
|
17
|
-
export declare const Text3D: ForwardRefComponent<React.PropsWithChildren<Text3DProps & {
|
|
18
|
-
letterSpacing?: number;
|
|
19
|
-
lineHeight?: number;
|
|
20
|
-
}>, THREE.Mesh>;
|
package/core/Text3D.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { useMemo } from 'react';
|
|
4
|
-
import { extend } from '@react-three/fiber';
|
|
5
|
-
import { TextGeometry, mergeVertices } from 'three-stdlib';
|
|
6
|
-
import { useFont } from './useFont.js';
|
|
7
|
-
|
|
8
|
-
const types = ['string', 'number'];
|
|
9
|
-
const getTextFromChildren = children => {
|
|
10
|
-
let label = '';
|
|
11
|
-
const rest = [];
|
|
12
|
-
React.Children.forEach(children, child => {
|
|
13
|
-
if (types.includes(typeof child)) label += child + '';else rest.push(child);
|
|
14
|
-
});
|
|
15
|
-
return [label, ...rest];
|
|
16
|
-
};
|
|
17
|
-
const Text3D = /* @__PURE__ */React.forwardRef(({
|
|
18
|
-
font: _font,
|
|
19
|
-
letterSpacing = 0,
|
|
20
|
-
lineHeight = 1,
|
|
21
|
-
size = 1,
|
|
22
|
-
height = 0.2,
|
|
23
|
-
bevelThickness = 0.1,
|
|
24
|
-
bevelSize = 0.01,
|
|
25
|
-
bevelEnabled = false,
|
|
26
|
-
bevelOffset = 0,
|
|
27
|
-
bevelSegments = 4,
|
|
28
|
-
curveSegments = 8,
|
|
29
|
-
smooth,
|
|
30
|
-
children,
|
|
31
|
-
...props
|
|
32
|
-
}, fref) => {
|
|
33
|
-
React.useMemo(() => extend({
|
|
34
|
-
RenamedTextGeometry: TextGeometry
|
|
35
|
-
}), []);
|
|
36
|
-
const ref = React.useRef(null);
|
|
37
|
-
const font = useFont(_font);
|
|
38
|
-
const opts = useMemo(() => {
|
|
39
|
-
return {
|
|
40
|
-
font,
|
|
41
|
-
size,
|
|
42
|
-
height,
|
|
43
|
-
bevelThickness,
|
|
44
|
-
bevelSize,
|
|
45
|
-
bevelEnabled,
|
|
46
|
-
bevelSegments,
|
|
47
|
-
bevelOffset,
|
|
48
|
-
curveSegments,
|
|
49
|
-
letterSpacing,
|
|
50
|
-
lineHeight
|
|
51
|
-
};
|
|
52
|
-
}, [font, size, height, bevelThickness, bevelSize, bevelEnabled, bevelSegments, bevelOffset, curveSegments, letterSpacing, lineHeight]);
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* We need the `children` in the deps because we
|
|
56
|
-
* need to be able to do `<Text3d>{state}</Text3d>`.
|
|
57
|
-
*/
|
|
58
|
-
const [label, ...rest] = useMemo(() => getTextFromChildren(children), [children]);
|
|
59
|
-
const args = React.useMemo(() => [label, opts], [label, opts]);
|
|
60
|
-
React.useLayoutEffect(() => {
|
|
61
|
-
if (smooth) {
|
|
62
|
-
ref.current.geometry = mergeVertices(ref.current.geometry, smooth);
|
|
63
|
-
ref.current.geometry.computeVertexNormals();
|
|
64
|
-
}
|
|
65
|
-
}, [args, smooth]);
|
|
66
|
-
React.useImperativeHandle(fref, () => ref.current, []);
|
|
67
|
-
return /*#__PURE__*/React.createElement("mesh", _extends({}, props, {
|
|
68
|
-
ref: ref
|
|
69
|
-
}), /*#__PURE__*/React.createElement("renamedTextGeometry", {
|
|
70
|
-
args: args
|
|
71
|
-
}), rest);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
export { Text3D };
|
package/core/Texture.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");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 u=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,u.get?u:{enumerable:!0,get:function(){return e[t]}})}})),r.default=e,Object.freeze(r)}var n=u(e);const o=e=>e===Object(e)&&!Array.isArray(e)&&"function"!=typeof e;function a(u,n){const a=t.useThree((e=>e.gl)),c=t.useLoader(r.TextureLoader,o(u)?Object.values(u):u);e.useLayoutEffect((()=>{null==n||n(c)}),[n]),e.useEffect((()=>{if("initTexture"in a){let e=[];Array.isArray(c)?e=c:c instanceof r.Texture?e=[c]:o(c)&&(e=Object.values(c)),e.forEach((e=>{e instanceof r.Texture&&a.initTexture(e)}))}}),[a,c]);return e.useMemo((()=>{if(o(u)){const e={};let r=0;for(const t in u)e[t]=c[r++];return e}return c}),[u,c])}a.preload=e=>t.useLoader.preload(r.TextureLoader,e),a.clear=e=>t.useLoader.clear(r.TextureLoader,e);exports.IsObject=o,exports.Texture=({children:e,input:r,onLoad:t})=>{const u=a(r,t);return n.createElement(n.Fragment,null,null==e?void 0:e(u))},exports.useTexture=a;
|
package/core/Texture.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Texture as _Texture } from 'three';
|
|
3
|
-
export declare const IsObject: (url: unknown) => url is Record<string, string>;
|
|
4
|
-
type TextureArray<T> = T extends string[] ? _Texture[] : never;
|
|
5
|
-
type TextureRecord<T> = T extends Record<string, string> ? {
|
|
6
|
-
[key in keyof T]: _Texture;
|
|
7
|
-
} : never;
|
|
8
|
-
type SingleTexture<T> = T extends string ? _Texture : never;
|
|
9
|
-
export type MappedTextureType<T extends string[] | string | Record<string, string>> = TextureArray<T> | TextureRecord<T> | SingleTexture<T>;
|
|
10
|
-
export declare function useTexture<Url extends string[] | string | Record<string, string>>(input: Url, onLoad?: (texture: MappedTextureType<Url>) => void): MappedTextureType<Url>;
|
|
11
|
-
export declare namespace useTexture {
|
|
12
|
-
var preload: (url: string | string[]) => void;
|
|
13
|
-
var clear: (input: string | string[]) => void;
|
|
14
|
-
}
|
|
15
|
-
export declare const Texture: ({ children, input, onLoad, }: {
|
|
16
|
-
children?: (texture: ReturnType<typeof useTexture>) => React.ReactNode;
|
|
17
|
-
input: Parameters<typeof useTexture>[0];
|
|
18
|
-
onLoad?: Parameters<typeof useTexture>[1];
|
|
19
|
-
}) => React.JSX.Element;
|
|
20
|
-
export {};
|
package/core/Texture.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useLayoutEffect, useEffect, useMemo } from 'react';
|
|
3
|
-
import { TextureLoader, Texture as Texture$1 } from 'three';
|
|
4
|
-
import { useThree, useLoader } from '@react-three/fiber';
|
|
5
|
-
|
|
6
|
-
const IsObject = url => url === Object(url) && !Array.isArray(url) && typeof url !== 'function';
|
|
7
|
-
function useTexture(input, onLoad) {
|
|
8
|
-
const gl = useThree(state => state.gl);
|
|
9
|
-
const textures = useLoader(TextureLoader, IsObject(input) ? Object.values(input) : input);
|
|
10
|
-
useLayoutEffect(() => {
|
|
11
|
-
onLoad == null || onLoad(textures);
|
|
12
|
-
}, [onLoad]);
|
|
13
|
-
|
|
14
|
-
// https://github.com/mrdoob/three.js/issues/22696
|
|
15
|
-
// Upload the texture to the GPU immediately instead of waiting for the first render
|
|
16
|
-
// NOTE: only available for WebGLRenderer
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
if ('initTexture' in gl) {
|
|
19
|
-
let textureArray = [];
|
|
20
|
-
if (Array.isArray(textures)) {
|
|
21
|
-
textureArray = textures;
|
|
22
|
-
} else if (textures instanceof Texture$1) {
|
|
23
|
-
textureArray = [textures];
|
|
24
|
-
} else if (IsObject(textures)) {
|
|
25
|
-
textureArray = Object.values(textures);
|
|
26
|
-
}
|
|
27
|
-
textureArray.forEach(texture => {
|
|
28
|
-
if (texture instanceof Texture$1) {
|
|
29
|
-
gl.initTexture(texture);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}, [gl, textures]);
|
|
34
|
-
const mappedTextures = useMemo(() => {
|
|
35
|
-
if (IsObject(input)) {
|
|
36
|
-
const keyed = {};
|
|
37
|
-
let i = 0;
|
|
38
|
-
for (const key in input) keyed[key] = textures[i++];
|
|
39
|
-
return keyed;
|
|
40
|
-
} else {
|
|
41
|
-
return textures;
|
|
42
|
-
}
|
|
43
|
-
}, [input, textures]);
|
|
44
|
-
return mappedTextures;
|
|
45
|
-
}
|
|
46
|
-
useTexture.preload = url => useLoader.preload(TextureLoader, url);
|
|
47
|
-
useTexture.clear = input => useLoader.clear(TextureLoader, input);
|
|
48
|
-
|
|
49
|
-
//
|
|
50
|
-
|
|
51
|
-
const Texture = ({
|
|
52
|
-
children,
|
|
53
|
-
input,
|
|
54
|
-
onLoad
|
|
55
|
-
}) => {
|
|
56
|
-
const ret = useTexture(input, onLoad);
|
|
57
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, children == null ? void 0 : children(ret));
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export { IsObject, Texture, useTexture };
|
|
@@ -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-stdlib");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function a(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 s=o(e),c=a(r);const u=c.forwardRef((({makeDefault:e,camera:r,domElement:o,regress:a,onChange:u,onStart:i,onEnd:f,...l},d)=>{const{invalidate:v,camera:m,gl:b,events:E,set:p,get:g,performance:h,viewport:j}=t.useThree(),O=r||m,L=o||E.connected||b.domElement,y=c.useMemo((()=>new n.TrackballControls(O)),[O]);return t.useFrame((()=>{y.enabled&&y.update()}),-1),c.useEffect((()=>(y.connect(L),()=>{y.dispose()})),[L,a,y,v]),c.useEffect((()=>{const e=e=>{v(),a&&h.regress(),u&&u(e)};return y.addEventListener("change",e),i&&y.addEventListener("start",i),f&&y.addEventListener("end",f),()=>{i&&y.removeEventListener("start",i),f&&y.removeEventListener("end",f),y.removeEventListener("change",e)}}),[u,i,f,y,v]),c.useEffect((()=>{y.handleResize()}),[j]),c.useEffect((()=>{if(e){const e=g().controls;return p({controls:y}),()=>p({controls:e})}}),[e,y]),c.createElement("primitive",s.default({ref:d,object:y},l))}));exports.TrackballControls=u;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ReactThreeFiber, ThreeElement } from '@react-three/fiber';
|
|
2
|
-
import * as THREE from 'three';
|
|
3
|
-
import { TrackballControls as TrackballControlsImpl } from 'three-stdlib';
|
|
4
|
-
import { ForwardRefComponent, Overwrite } from '../helpers/ts-utils';
|
|
5
|
-
export type TrackballControlsProps = Omit<Overwrite<ThreeElement<typeof TrackballControlsImpl>, {
|
|
6
|
-
target?: ReactThreeFiber.Vector3;
|
|
7
|
-
camera?: THREE.Camera;
|
|
8
|
-
domElement?: HTMLElement;
|
|
9
|
-
regress?: boolean;
|
|
10
|
-
makeDefault?: boolean;
|
|
11
|
-
onChange?: (e?: THREE.Event) => void;
|
|
12
|
-
onStart?: (e?: THREE.Event) => void;
|
|
13
|
-
onEnd?: (e?: THREE.Event) => void;
|
|
14
|
-
}>, 'ref' | 'args'>;
|
|
15
|
-
export declare const TrackballControls: ForwardRefComponent<TrackballControlsProps, TrackballControlsImpl>;
|