@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
package/core/meshBounds.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Matrix4, Ray, Sphere, Vector3 } from 'three';
|
|
2
|
-
|
|
3
|
-
const _inverseMatrix = /* @__PURE__ */new Matrix4();
|
|
4
|
-
const _ray = /* @__PURE__ */new Ray();
|
|
5
|
-
const _sphere = /* @__PURE__ */new Sphere();
|
|
6
|
-
const _vA = /* @__PURE__ */new Vector3();
|
|
7
|
-
function meshBounds(raycaster, intersects) {
|
|
8
|
-
const geometry = this.geometry;
|
|
9
|
-
const material = this.material;
|
|
10
|
-
const matrixWorld = this.matrixWorld;
|
|
11
|
-
if (material === undefined) return;
|
|
12
|
-
// Checking boundingSphere distance to ray
|
|
13
|
-
if (geometry.boundingSphere === null) geometry.computeBoundingSphere();
|
|
14
|
-
_sphere.copy(geometry.boundingSphere);
|
|
15
|
-
_sphere.applyMatrix4(matrixWorld);
|
|
16
|
-
if (raycaster.ray.intersectsSphere(_sphere) === false) return;
|
|
17
|
-
_inverseMatrix.copy(matrixWorld).invert();
|
|
18
|
-
_ray.copy(raycaster.ray).applyMatrix4(_inverseMatrix);
|
|
19
|
-
// Check boundingBox before continuing
|
|
20
|
-
if (geometry.boundingBox !== null && _ray.intersectBox(geometry.boundingBox, _vA) === null) return;
|
|
21
|
-
intersects.push({
|
|
22
|
-
distance: _vA.distanceTo(raycaster.ray.origin),
|
|
23
|
-
point: _vA.clone(),
|
|
24
|
-
object: this
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export { meshBounds };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function e(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)}Object.defineProperty(exports,"__esModule",{value:!0});var r=e(require("three"));exports.shaderMaterial=function(e,t,n,i){var s;return(s=class extends r.ShaderMaterial{constructor(s){super({vertexShader:t,fragmentShader:n,...s});for(const t in e)this.uniforms[t]=new r.Uniform(e[t]),Object.defineProperty(this,t,{get(){return this.uniforms[t].value},set(e){this.uniforms[t].value=e}});this.uniforms=r.UniformsUtils.clone(this.uniforms),null==i||i(this)}}).key=r.MathUtils.generateUUID(),s};
|
package/core/shaderMaterial.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import { type ConstructorRepresentation } from '@react-three/fiber';
|
|
3
|
-
import { type MeshBVHUniformStruct } from 'three-mesh-bvh';
|
|
4
|
-
type UniformValue = THREE.Texture | THREE.TypedArray | THREE.Matrix4 | THREE.Matrix3 | THREE.Quaternion | THREE.Vector4 | THREE.Vector3 | THREE.Vector2 | THREE.Color | MeshBVHUniformStruct | number | boolean | null;
|
|
5
|
-
type Uniforms = Record<string, UniformValue | Record<string, UniformValue> | Array<UniformValue>>;
|
|
6
|
-
export declare function shaderMaterial<U extends Uniforms, M extends THREE.ShaderMaterial & U>(uniforms: U, vertexShader: string, fragmentShader: string, onInit?: (material?: M) => void): ConstructorRepresentation<M> & {
|
|
7
|
-
key: string;
|
|
8
|
-
};
|
|
9
|
-
export {};
|
package/core/shaderMaterial.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
|
|
3
|
-
function shaderMaterial(uniforms, vertexShader, fragmentShader, onInit) {
|
|
4
|
-
var _Class;
|
|
5
|
-
return _Class = class extends THREE.ShaderMaterial {
|
|
6
|
-
constructor(parameters) {
|
|
7
|
-
super({
|
|
8
|
-
vertexShader,
|
|
9
|
-
fragmentShader,
|
|
10
|
-
...parameters
|
|
11
|
-
});
|
|
12
|
-
for (const key in uniforms) {
|
|
13
|
-
this.uniforms[key] = new THREE.Uniform(uniforms[key]);
|
|
14
|
-
Object.defineProperty(this, key, {
|
|
15
|
-
get() {
|
|
16
|
-
return this.uniforms[key].value;
|
|
17
|
-
},
|
|
18
|
-
set(value) {
|
|
19
|
-
this.uniforms[key].value = value;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
this.uniforms = THREE.UniformsUtils.clone(this.uniforms);
|
|
24
|
-
onInit == null || onInit(this);
|
|
25
|
-
}
|
|
26
|
-
}, _Class.key = THREE.MathUtils.generateUUID(), _Class;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export { shaderMaterial };
|
package/core/shapes.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("three");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var s=o(e),u=n(t),a=n(r);function c(e,t){const r=e+"Geometry";return u.forwardRef((({args:e,children:o,...n},a)=>{const c=u.useRef(null);return u.useImperativeHandle(a,(()=>c.current)),u.useLayoutEffect((()=>{null==t||t(c.current)})),u.createElement("mesh",s.default({ref:c},n),u.createElement(r,{attach:"geometry",args:e}),o)}))}const p=c("box"),l=c("circle"),i=c("cone"),d=c("cylinder"),f=c("sphere"),x=c("plane"),h=c("tube"),b=c("torus"),y=c("torusKnot"),g=c("tetrahedron"),m=c("ring"),O=c("polyhedron"),j=c("icosahedron"),v=c("octahedron"),w=c("dodecahedron"),E=c("extrude"),P=c("lathe"),B=c("capsule"),C=c("shape",(({geometry:e})=>{const t=e.attributes.position,r=(new a.Box3).setFromBufferAttribute(t),o=new a.Vector3;r.getSize(o);const n=[];let s=0,u=0,c=0,p=0;for(let e=0;e<t.count;e++)s=t.getX(e),u=t.getY(e),c=(s-r.min.x)/o.x,p=(u-r.min.y)/o.y,n.push(c,p);e.setAttribute("uv",new a.Float32BufferAttribute(n,2))}));exports.Box=p,exports.Capsule=B,exports.Circle=l,exports.Cone=i,exports.Cylinder=d,exports.Dodecahedron=w,exports.Extrude=E,exports.Icosahedron=j,exports.Lathe=P,exports.Octahedron=v,exports.Plane=x,exports.Polyhedron=O,exports.Ring=m,exports.Shape=C,exports.Sphere=f,exports.Tetrahedron=g,exports.Torus=b,exports.TorusKnot=y,exports.Tube=h;
|
package/core/shapes.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
3
|
-
import { ThreeElements } from '@react-three/fiber';
|
|
4
|
-
export type Args<T> = T extends new (...args: any) => any ? ConstructorParameters<T> : T;
|
|
5
|
-
export type ShapeProps<T> = Omit<ThreeElements['mesh'], 'ref' | 'args'> & {
|
|
6
|
-
args?: Args<T>;
|
|
7
|
-
};
|
|
8
|
-
export declare const Box: ForwardRefComponent<ShapeProps<typeof THREE.BoxGeometry>, THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
9
|
-
export declare const Circle: ForwardRefComponent<ShapeProps<typeof THREE.CircleGeometry>, THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
10
|
-
export declare const Cone: ForwardRefComponent<ShapeProps<typeof THREE.ConeGeometry>, THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
11
|
-
export declare const Cylinder: ForwardRefComponent<ShapeProps<typeof THREE.CylinderGeometry>, THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
12
|
-
export declare const Sphere: ForwardRefComponent<ShapeProps<typeof THREE.SphereGeometry>, THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
13
|
-
export declare const Plane: ForwardRefComponent<ShapeProps<typeof THREE.PlaneGeometry>, THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
14
|
-
export declare const Tube: ForwardRefComponent<ShapeProps<typeof THREE.TubeGeometry>, THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
15
|
-
export declare const Torus: ForwardRefComponent<ShapeProps<typeof THREE.TorusGeometry>, THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
16
|
-
export declare const TorusKnot: ForwardRefComponent<ShapeProps<typeof THREE.TorusKnotGeometry>, THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
17
|
-
export declare const Tetrahedron: ForwardRefComponent<ShapeProps<typeof THREE.TetrahedronGeometry>, THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
18
|
-
export declare const Ring: ForwardRefComponent<ShapeProps<typeof THREE.RingGeometry>, THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
19
|
-
export declare const Polyhedron: ForwardRefComponent<ShapeProps<typeof THREE.PolyhedronGeometry>, THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
20
|
-
export declare const Icosahedron: ForwardRefComponent<ShapeProps<typeof THREE.IcosahedronGeometry>, THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
21
|
-
export declare const Octahedron: ForwardRefComponent<ShapeProps<typeof THREE.OctahedronGeometry>, THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
22
|
-
export declare const Dodecahedron: ForwardRefComponent<ShapeProps<typeof THREE.DodecahedronGeometry>, THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
23
|
-
export declare const Extrude: ForwardRefComponent<ShapeProps<typeof THREE.ExtrudeGeometry>, THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
24
|
-
export declare const Lathe: ForwardRefComponent<ShapeProps<typeof THREE.LatheGeometry>, THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
25
|
-
export declare const Capsule: ForwardRefComponent<ShapeProps<typeof THREE.CapsuleGeometry>, THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
26
|
-
export declare const Shape: ForwardRefComponent<ShapeProps<typeof THREE.ShapeGeometry>, THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
package/core/shapes.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import * as THREE from 'three';
|
|
4
|
-
|
|
5
|
-
function create(type, effect) {
|
|
6
|
-
const El = type + 'Geometry';
|
|
7
|
-
return /*#__PURE__*/React.forwardRef(({
|
|
8
|
-
args,
|
|
9
|
-
children,
|
|
10
|
-
...props
|
|
11
|
-
}, fref) => {
|
|
12
|
-
const ref = React.useRef(null);
|
|
13
|
-
React.useImperativeHandle(fref, () => ref.current);
|
|
14
|
-
React.useLayoutEffect(() => void (effect == null ? void 0 : effect(ref.current)));
|
|
15
|
-
return /*#__PURE__*/React.createElement("mesh", _extends({
|
|
16
|
-
ref: ref
|
|
17
|
-
}, props), /*#__PURE__*/React.createElement(El, {
|
|
18
|
-
attach: "geometry",
|
|
19
|
-
args: args
|
|
20
|
-
}), children);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
const Box = /* @__PURE__ */create('box');
|
|
24
|
-
const Circle = /* @__PURE__ */create('circle');
|
|
25
|
-
const Cone = /* @__PURE__ */create('cone');
|
|
26
|
-
const Cylinder = /* @__PURE__ */create('cylinder');
|
|
27
|
-
const Sphere = /* @__PURE__ */create('sphere');
|
|
28
|
-
const Plane = /* @__PURE__ */create('plane');
|
|
29
|
-
const Tube = /* @__PURE__ */create('tube');
|
|
30
|
-
const Torus = /* @__PURE__ */create('torus');
|
|
31
|
-
const TorusKnot = /* @__PURE__ */create('torusKnot');
|
|
32
|
-
const Tetrahedron = /* @__PURE__ */create('tetrahedron');
|
|
33
|
-
const Ring = /* @__PURE__ */create('ring');
|
|
34
|
-
const Polyhedron = /* @__PURE__ */create('polyhedron');
|
|
35
|
-
const Icosahedron = /* @__PURE__ */create('icosahedron');
|
|
36
|
-
const Octahedron = /* @__PURE__ */create('octahedron');
|
|
37
|
-
const Dodecahedron = /* @__PURE__ */create('dodecahedron');
|
|
38
|
-
const Extrude = /* @__PURE__ */create('extrude');
|
|
39
|
-
const Lathe = /* @__PURE__ */create('lathe');
|
|
40
|
-
const Capsule = /* @__PURE__ */create('capsule');
|
|
41
|
-
const Shape = /* @__PURE__ */create('shape', ({
|
|
42
|
-
geometry
|
|
43
|
-
}) => {
|
|
44
|
-
// Calculate UVs (by https://discourse.threejs.org/u/prisoner849)
|
|
45
|
-
// https://discourse.threejs.org/t/custom-shape-in-image-not-working/49348/10
|
|
46
|
-
const pos = geometry.attributes.position;
|
|
47
|
-
const b3 = new THREE.Box3().setFromBufferAttribute(pos);
|
|
48
|
-
const b3size = new THREE.Vector3();
|
|
49
|
-
b3.getSize(b3size);
|
|
50
|
-
const uv = [];
|
|
51
|
-
let x = 0,
|
|
52
|
-
y = 0,
|
|
53
|
-
u = 0,
|
|
54
|
-
v = 0;
|
|
55
|
-
for (let i = 0; i < pos.count; i++) {
|
|
56
|
-
x = pos.getX(i);
|
|
57
|
-
y = pos.getY(i);
|
|
58
|
-
u = (x - b3.min.x) / b3size.x;
|
|
59
|
-
v = (y - b3.min.y) / b3size.y;
|
|
60
|
-
uv.push(u, v);
|
|
61
|
-
}
|
|
62
|
-
geometry.setAttribute('uv', new THREE.Float32BufferAttribute(uv, 2));
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
export { Box, Capsule, Circle, Cone, Cylinder, Dodecahedron, Extrude, Icosahedron, Lathe, Octahedron, Plane, Polyhedron, Ring, Shape, Sphere, Tetrahedron, Torus, TorusKnot, Tube };
|
package/core/softShadows.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),n=require("three"),a=require("@react-three/fiber");function t(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(a){if("default"!==a){var t=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(n,a,t.get?t:{enumerable:!0,get:function(){return e[a]}})}})),n.default=e,Object.freeze(n)}var r=t(e),o=t(n);function l(e,n,a){n.traverse((n=>{n.material&&(e.properties.remove(n.material),null==n.material.dispose||n.material.dispose())})),e.info.programs.length=0,e.compile(n,a)}exports.SoftShadows=function({focus:e=0,samples:n=10,size:t=25}){const s=a.useThree((e=>e.gl)),i=a.useThree((e=>e.scene)),u=a.useThree((e=>e.camera));return r.useEffect((()=>{const a=o.ShaderChunk.shadowmap_pars_fragment;return o.ShaderChunk.shadowmap_pars_fragment=o.ShaderChunk.shadowmap_pars_fragment.replace("#ifdef USE_SHADOWMAP","#ifdef USE_SHADOWMAP\n"+(({focus:e=0,size:n=25,samples:a=10}={})=>`\n#define PENUMBRA_FILTER_SIZE float(${n})\n#define RGB_NOISE_FUNCTION(uv) (randRGB(uv))\nvec3 randRGB(vec2 uv) {\n return vec3(\n fract(sin(dot(uv, vec2(12.75613, 38.12123))) * 13234.76575),\n fract(sin(dot(uv, vec2(19.45531, 58.46547))) * 43678.23431),\n fract(sin(dot(uv, vec2(23.67817, 78.23121))) * 93567.23423)\n );\n}\n\nvec3 lowPassRandRGB(vec2 uv) {\n // 3x3 convolution (average)\n // can be implemented as separable with an extra buffer for a total of 6 samples instead of 9\n vec3 result = vec3(0);\n result += RGB_NOISE_FUNCTION(uv + vec2(-1.0, -1.0));\n result += RGB_NOISE_FUNCTION(uv + vec2(-1.0, 0.0));\n result += RGB_NOISE_FUNCTION(uv + vec2(-1.0, +1.0));\n result += RGB_NOISE_FUNCTION(uv + vec2( 0.0, -1.0));\n result += RGB_NOISE_FUNCTION(uv + vec2( 0.0, 0.0));\n result += RGB_NOISE_FUNCTION(uv + vec2( 0.0, +1.0));\n result += RGB_NOISE_FUNCTION(uv + vec2(+1.0, -1.0));\n result += RGB_NOISE_FUNCTION(uv + vec2(+1.0, 0.0));\n result += RGB_NOISE_FUNCTION(uv + vec2(+1.0, +1.0));\n result *= 0.111111111; // 1.0 / 9.0\n return result;\n}\nvec3 highPassRandRGB(vec2 uv) {\n // by subtracting the low-pass signal from the original signal, we're being left with the high-pass signal\n // hp(x) = x - lp(x)\n return RGB_NOISE_FUNCTION(uv) - lowPassRandRGB(uv) + 0.5;\n}\n\n\nvec2 vogelDiskSample(int sampleIndex, int sampleCount, float angle) {\n const float goldenAngle = 2.399963f; // radians\n float r = sqrt(float(sampleIndex) + 0.5f) / sqrt(float(sampleCount));\n float theta = float(sampleIndex) * goldenAngle + angle;\n float sine = sin(theta);\n float cosine = cos(theta);\n return vec2(cosine, sine) * r;\n}\nfloat penumbraSize( const in float zReceiver, const in float zBlocker ) { // Parallel plane estimation\n return (zReceiver - zBlocker) / zBlocker;\n}\nfloat findBlocker(sampler2D shadowMap, vec2 uv, float compare, float angle) {\n float texelSize = 1.0 / float(textureSize(shadowMap, 0).x);\n float blockerDepthSum = float(${e});\n float blockers = 0.0;\n\n int j = 0;\n vec2 offset = vec2(0.);\n float depth = 0.;\n\n #pragma unroll_loop_start\n for(int i = 0; i < ${a}; i ++) {\n offset = (vogelDiskSample(j, ${a}, angle) * texelSize) * 2.0 * PENUMBRA_FILTER_SIZE;\n depth = unpackRGBAToDepth( texture2D( shadowMap, uv + offset));\n if (depth < compare) {\n blockerDepthSum += depth;\n blockers++;\n }\n j++;\n }\n #pragma unroll_loop_end\n\n if (blockers > 0.0) {\n return blockerDepthSum / blockers;\n }\n return -1.0;\n}\n\n \nfloat vogelFilter(sampler2D shadowMap, vec2 uv, float zReceiver, float filterRadius, float angle) {\n float texelSize = 1.0 / float(textureSize(shadowMap, 0).x);\n float shadow = 0.0f;\n int j = 0;\n vec2 vogelSample = vec2(0.0);\n vec2 offset = vec2(0.0);\n #pragma unroll_loop_start\n for (int i = 0; i < ${a}; i++) {\n vogelSample = vogelDiskSample(j, ${a}, angle) * texelSize;\n offset = vogelSample * (1.0 + filterRadius * float(${n}));\n shadow += step( zReceiver, unpackRGBAToDepth( texture2D( shadowMap, uv + offset ) ) );\n j++;\n }\n #pragma unroll_loop_end\n return shadow * 1.0 / ${a}.0;\n}\n\nfloat PCSS (sampler2D shadowMap, vec4 coords) {\n vec2 uv = coords.xy;\n float zReceiver = coords.z; // Assumed to be eye-space z in this code\n float angle = highPassRandRGB(gl_FragCoord.xy).r * PI2;\n float avgBlockerDepth = findBlocker(shadowMap, uv, zReceiver, angle);\n if (avgBlockerDepth == -1.0) {\n return 1.0;\n }\n float penumbraRatio = penumbraSize(zReceiver, avgBlockerDepth);\n return vogelFilter(shadowMap, uv, zReceiver, 1.25 * penumbraRatio, angle);\n}`)({size:t,samples:n,focus:e})).replace("#if defined( SHADOWMAP_TYPE_PCF )","\nreturn PCSS(shadowMap, shadowCoord);\n#if defined( SHADOWMAP_TYPE_PCF )"),l(s,i,u),()=>{o.ShaderChunk.shadowmap_pars_fragment=a,l(s,i,u)}}),[e,t,n]),null};
|
package/core/softShadows.d.ts
DELETED
package/core/softShadows.js
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as THREE from 'three';
|
|
3
|
-
import { useThree } from '@react-three/fiber';
|
|
4
|
-
|
|
5
|
-
/* Integration and compilation: @N8Programs
|
|
6
|
-
Inspired by:
|
|
7
|
-
https://github.com/mrdoob/three.js/blob/dev/examples/webgl_shadowmap_pcss.html
|
|
8
|
-
https://developer.nvidia.com/gpugems/gpugems2/part-ii-shading-lighting-and-shadows/chapter-17-efficient-soft-edged-shadows-using
|
|
9
|
-
https://developer.download.nvidia.com/whitepapers/2008/PCSS_Integration.pdf
|
|
10
|
-
https://github.com/mrdoob/three.js/blob/master/examples/webgl_shadowmap_pcss.html [spidersharma03]
|
|
11
|
-
https://spline.design/
|
|
12
|
-
Concept:
|
|
13
|
-
https://www.gamedev.net/tutorials/programming/graphics/contact-hardening-soft-shadows-made-fast-r4906/
|
|
14
|
-
Vogel Disk Implementation:
|
|
15
|
-
https://www.shadertoy.com/view/4l3yRM [ashalah]
|
|
16
|
-
High-Frequency Noise Implementation:
|
|
17
|
-
https://www.shadertoy.com/view/tt3fDH [spawner64]
|
|
18
|
-
*/
|
|
19
|
-
const pcss = ({
|
|
20
|
-
focus = 0,
|
|
21
|
-
size = 25,
|
|
22
|
-
samples = 10
|
|
23
|
-
} = {}) => `
|
|
24
|
-
#define PENUMBRA_FILTER_SIZE float(${size})
|
|
25
|
-
#define RGB_NOISE_FUNCTION(uv) (randRGB(uv))
|
|
26
|
-
vec3 randRGB(vec2 uv) {
|
|
27
|
-
return vec3(
|
|
28
|
-
fract(sin(dot(uv, vec2(12.75613, 38.12123))) * 13234.76575),
|
|
29
|
-
fract(sin(dot(uv, vec2(19.45531, 58.46547))) * 43678.23431),
|
|
30
|
-
fract(sin(dot(uv, vec2(23.67817, 78.23121))) * 93567.23423)
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
vec3 lowPassRandRGB(vec2 uv) {
|
|
35
|
-
// 3x3 convolution (average)
|
|
36
|
-
// can be implemented as separable with an extra buffer for a total of 6 samples instead of 9
|
|
37
|
-
vec3 result = vec3(0);
|
|
38
|
-
result += RGB_NOISE_FUNCTION(uv + vec2(-1.0, -1.0));
|
|
39
|
-
result += RGB_NOISE_FUNCTION(uv + vec2(-1.0, 0.0));
|
|
40
|
-
result += RGB_NOISE_FUNCTION(uv + vec2(-1.0, +1.0));
|
|
41
|
-
result += RGB_NOISE_FUNCTION(uv + vec2( 0.0, -1.0));
|
|
42
|
-
result += RGB_NOISE_FUNCTION(uv + vec2( 0.0, 0.0));
|
|
43
|
-
result += RGB_NOISE_FUNCTION(uv + vec2( 0.0, +1.0));
|
|
44
|
-
result += RGB_NOISE_FUNCTION(uv + vec2(+1.0, -1.0));
|
|
45
|
-
result += RGB_NOISE_FUNCTION(uv + vec2(+1.0, 0.0));
|
|
46
|
-
result += RGB_NOISE_FUNCTION(uv + vec2(+1.0, +1.0));
|
|
47
|
-
result *= 0.111111111; // 1.0 / 9.0
|
|
48
|
-
return result;
|
|
49
|
-
}
|
|
50
|
-
vec3 highPassRandRGB(vec2 uv) {
|
|
51
|
-
// by subtracting the low-pass signal from the original signal, we're being left with the high-pass signal
|
|
52
|
-
// hp(x) = x - lp(x)
|
|
53
|
-
return RGB_NOISE_FUNCTION(uv) - lowPassRandRGB(uv) + 0.5;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
vec2 vogelDiskSample(int sampleIndex, int sampleCount, float angle) {
|
|
58
|
-
const float goldenAngle = 2.399963f; // radians
|
|
59
|
-
float r = sqrt(float(sampleIndex) + 0.5f) / sqrt(float(sampleCount));
|
|
60
|
-
float theta = float(sampleIndex) * goldenAngle + angle;
|
|
61
|
-
float sine = sin(theta);
|
|
62
|
-
float cosine = cos(theta);
|
|
63
|
-
return vec2(cosine, sine) * r;
|
|
64
|
-
}
|
|
65
|
-
float penumbraSize( const in float zReceiver, const in float zBlocker ) { // Parallel plane estimation
|
|
66
|
-
return (zReceiver - zBlocker) / zBlocker;
|
|
67
|
-
}
|
|
68
|
-
float findBlocker(sampler2D shadowMap, vec2 uv, float compare, float angle) {
|
|
69
|
-
float texelSize = 1.0 / float(textureSize(shadowMap, 0).x);
|
|
70
|
-
float blockerDepthSum = float(${focus});
|
|
71
|
-
float blockers = 0.0;
|
|
72
|
-
|
|
73
|
-
int j = 0;
|
|
74
|
-
vec2 offset = vec2(0.);
|
|
75
|
-
float depth = 0.;
|
|
76
|
-
|
|
77
|
-
#pragma unroll_loop_start
|
|
78
|
-
for(int i = 0; i < ${samples}; i ++) {
|
|
79
|
-
offset = (vogelDiskSample(j, ${samples}, angle) * texelSize) * 2.0 * PENUMBRA_FILTER_SIZE;
|
|
80
|
-
depth = unpackRGBAToDepth( texture2D( shadowMap, uv + offset));
|
|
81
|
-
if (depth < compare) {
|
|
82
|
-
blockerDepthSum += depth;
|
|
83
|
-
blockers++;
|
|
84
|
-
}
|
|
85
|
-
j++;
|
|
86
|
-
}
|
|
87
|
-
#pragma unroll_loop_end
|
|
88
|
-
|
|
89
|
-
if (blockers > 0.0) {
|
|
90
|
-
return blockerDepthSum / blockers;
|
|
91
|
-
}
|
|
92
|
-
return -1.0;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
float vogelFilter(sampler2D shadowMap, vec2 uv, float zReceiver, float filterRadius, float angle) {
|
|
97
|
-
float texelSize = 1.0 / float(textureSize(shadowMap, 0).x);
|
|
98
|
-
float shadow = 0.0f;
|
|
99
|
-
int j = 0;
|
|
100
|
-
vec2 vogelSample = vec2(0.0);
|
|
101
|
-
vec2 offset = vec2(0.0);
|
|
102
|
-
#pragma unroll_loop_start
|
|
103
|
-
for (int i = 0; i < ${samples}; i++) {
|
|
104
|
-
vogelSample = vogelDiskSample(j, ${samples}, angle) * texelSize;
|
|
105
|
-
offset = vogelSample * (1.0 + filterRadius * float(${size}));
|
|
106
|
-
shadow += step( zReceiver, unpackRGBAToDepth( texture2D( shadowMap, uv + offset ) ) );
|
|
107
|
-
j++;
|
|
108
|
-
}
|
|
109
|
-
#pragma unroll_loop_end
|
|
110
|
-
return shadow * 1.0 / ${samples}.0;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
float PCSS (sampler2D shadowMap, vec4 coords) {
|
|
114
|
-
vec2 uv = coords.xy;
|
|
115
|
-
float zReceiver = coords.z; // Assumed to be eye-space z in this code
|
|
116
|
-
float angle = highPassRandRGB(gl_FragCoord.xy).r * PI2;
|
|
117
|
-
float avgBlockerDepth = findBlocker(shadowMap, uv, zReceiver, angle);
|
|
118
|
-
if (avgBlockerDepth == -1.0) {
|
|
119
|
-
return 1.0;
|
|
120
|
-
}
|
|
121
|
-
float penumbraRatio = penumbraSize(zReceiver, avgBlockerDepth);
|
|
122
|
-
return vogelFilter(shadowMap, uv, zReceiver, 1.25 * penumbraRatio, angle);
|
|
123
|
-
}`;
|
|
124
|
-
function reset(gl, scene, camera) {
|
|
125
|
-
scene.traverse(object => {
|
|
126
|
-
if (object.material) {
|
|
127
|
-
gl.properties.remove(object.material);
|
|
128
|
-
object.material.dispose == null || object.material.dispose();
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
gl.info.programs.length = 0;
|
|
132
|
-
gl.compile(scene, camera);
|
|
133
|
-
}
|
|
134
|
-
function SoftShadows({
|
|
135
|
-
focus = 0,
|
|
136
|
-
samples = 10,
|
|
137
|
-
size = 25
|
|
138
|
-
}) {
|
|
139
|
-
const gl = useThree(state => state.gl);
|
|
140
|
-
const scene = useThree(state => state.scene);
|
|
141
|
-
const camera = useThree(state => state.camera);
|
|
142
|
-
React.useEffect(() => {
|
|
143
|
-
const original = THREE.ShaderChunk.shadowmap_pars_fragment;
|
|
144
|
-
THREE.ShaderChunk.shadowmap_pars_fragment = THREE.ShaderChunk.shadowmap_pars_fragment.replace('#ifdef USE_SHADOWMAP', '#ifdef USE_SHADOWMAP\n' + pcss({
|
|
145
|
-
size,
|
|
146
|
-
samples,
|
|
147
|
-
focus
|
|
148
|
-
})).replace('#if defined( SHADOWMAP_TYPE_PCF )', '\nreturn PCSS(shadowMap, shadowCoord);\n#if defined( SHADOWMAP_TYPE_PCF )');
|
|
149
|
-
reset(gl, scene, camera);
|
|
150
|
-
return () => {
|
|
151
|
-
THREE.ShaderChunk.shadowmap_pars_fragment = original;
|
|
152
|
-
reset(gl, scene, camera);
|
|
153
|
-
};
|
|
154
|
-
}, [focus, size, samples]);
|
|
155
|
-
return null;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export { SoftShadows };
|
|
@@ -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 n(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 c=n(e);exports.useAnimations=function(e,n){const u=c.useRef(null),[o]=c.useState((()=>n?n instanceof r.Object3D?{current:n}:n:u)),[a]=c.useState((()=>new r.AnimationMixer(void 0)));c.useLayoutEffect((()=>{n&&(o.current=n instanceof r.Object3D?n:n.current),a._root=o.current}));const i=c.useRef({}),s=c.useMemo((()=>{const r={};return e.forEach((e=>Object.defineProperty(r,e.name,{enumerable:!0,get(){if(o.current)return i.current[e.name]||(i.current[e.name]=a.clipAction(e,o.current))},configurable:!0}))),{ref:o,clips:e,actions:r,names:e.map((e=>e.name)),mixer:a}}),[e]);return t.useFrame(((e,r)=>a.update(r))),c.useEffect((()=>{const e=o.current;return()=>{i.current={},a.stopAllAction(),Object.values(s.actions).forEach((r=>{e&&a.uncacheAction(r,e)}))}}),[e]),s};
|
package/core/useAnimations.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Object3D, AnimationClip, AnimationAction, AnimationMixer } from 'three';
|
|
3
|
-
type Api<T extends AnimationClip> = {
|
|
4
|
-
ref: React.RefObject<Object3D | undefined | null>;
|
|
5
|
-
clips: AnimationClip[];
|
|
6
|
-
mixer: AnimationMixer;
|
|
7
|
-
names: T['name'][];
|
|
8
|
-
actions: {
|
|
9
|
-
[key in T['name']]: AnimationAction | null;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export declare function useAnimations<T extends AnimationClip>(clips: T[], root?: React.RefObject<Object3D | undefined | null> | Object3D): Api<T>;
|
|
13
|
-
export {};
|
package/core/useAnimations.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Object3D, AnimationMixer } from 'three';
|
|
3
|
-
import { useFrame } from '@react-three/fiber';
|
|
4
|
-
|
|
5
|
-
function useAnimations(clips, root) {
|
|
6
|
-
const ref = React.useRef(null);
|
|
7
|
-
const [actualRef] = React.useState(() => root ? root instanceof Object3D ? {
|
|
8
|
-
current: root
|
|
9
|
-
} : root : ref);
|
|
10
|
-
const [mixer] = React.useState(() => new AnimationMixer(undefined));
|
|
11
|
-
React.useLayoutEffect(() => {
|
|
12
|
-
if (root) actualRef.current = root instanceof Object3D ? root : root.current;
|
|
13
|
-
mixer._root = actualRef.current;
|
|
14
|
-
});
|
|
15
|
-
const lazyActions = React.useRef({});
|
|
16
|
-
const api = React.useMemo(() => {
|
|
17
|
-
const actions = {};
|
|
18
|
-
clips.forEach(clip => Object.defineProperty(actions, clip.name, {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get() {
|
|
21
|
-
if (actualRef.current) {
|
|
22
|
-
return lazyActions.current[clip.name] || (lazyActions.current[clip.name] = mixer.clipAction(clip, actualRef.current));
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
configurable: true
|
|
26
|
-
}));
|
|
27
|
-
return {
|
|
28
|
-
ref: actualRef,
|
|
29
|
-
clips,
|
|
30
|
-
actions,
|
|
31
|
-
names: clips.map(c => c.name),
|
|
32
|
-
mixer
|
|
33
|
-
};
|
|
34
|
-
}, [clips]);
|
|
35
|
-
useFrame((state, delta) => mixer.update(delta));
|
|
36
|
-
React.useEffect(() => {
|
|
37
|
-
const currentRoot = actualRef.current;
|
|
38
|
-
return () => {
|
|
39
|
-
// Clean up only when clips change, wipe out lazy actions and uncache clips
|
|
40
|
-
lazyActions.current = {};
|
|
41
|
-
mixer.stopAllAction();
|
|
42
|
-
Object.values(api.actions).forEach(action => {
|
|
43
|
-
if (currentRoot) {
|
|
44
|
-
mixer.uncacheAction(action, currentRoot);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
}, [clips]);
|
|
49
|
-
return api;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export { useAnimations };
|
package/core/useAspect.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@react-three/fiber");exports.useAspect=function(t,r,s=1){const i=e.useThree((e=>e.viewport)),c=r*(i.aspect>t/r?i.width/t:i.height/r);return[t*(i.aspect>t/r?i.width/t:i.height/r)*s,c*s,1]};
|
package/core/useAspect.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function useAspect(width: number, height: number, factor?: number): [number, number, number];
|
package/core/useAspect.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { useThree } from '@react-three/fiber';
|
|
2
|
-
|
|
3
|
-
function useAspect(width, height, factor = 1) {
|
|
4
|
-
const v = useThree(state => state.viewport);
|
|
5
|
-
const adaptedHeight = height * (v.aspect > width / height ? v.width / width : v.height / height);
|
|
6
|
-
const adaptedWidth = width * (v.aspect > width / height ? v.width / width : v.height / height);
|
|
7
|
-
return [adaptedWidth * factor, adaptedHeight * factor, 1];
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export { useAspect };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three"),r=require("react"),n=require("@react-three/fiber");function i(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}})),r.default=e,Object.freeze(r)}var o=i(e),t=i(r);exports.useBoxProjectedEnv=function(e=new o.Vector3,r=new o.Vector3){const[i]=t.useState((()=>({position:new o.Vector3,size:new o.Vector3})));n.applyProps(i,{position:e,size:r});const a=t.useRef(null),c=t.useMemo((()=>({ref:a,onBeforeCompile:e=>function(e,r,n){e.defines.BOX_PROJECTED_ENV_MAP=!0,e.uniforms.envMapPosition={value:r},e.uniforms.envMapSize={value:n},e.vertexShader=`\n varying vec3 vWorldPosition;\n ${e.vertexShader.replace("#include <worldpos_vertex>","\n#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n #ifdef BOX_PROJECTED_ENV_MAP\n vWorldPosition = worldPosition.xyz;\n #endif\n#endif\n")}`,e.fragmentShader=`\n \n#ifdef BOX_PROJECTED_ENV_MAP\n uniform vec3 envMapSize;\n uniform vec3 envMapPosition;\n varying vec3 vWorldPosition;\n \n vec3 parallaxCorrectNormal( vec3 v, vec3 cubeSize, vec3 cubePos ) {\n vec3 nDir = normalize( v );\n vec3 rbmax = ( .5 * cubeSize + cubePos - vWorldPosition ) / nDir;\n vec3 rbmin = ( -.5 * cubeSize + cubePos - vWorldPosition ) / nDir;\n vec3 rbminmax;\n rbminmax.x = ( nDir.x > 0. ) ? rbmax.x : rbmin.x;\n rbminmax.y = ( nDir.y > 0. ) ? rbmax.y : rbmin.y;\n rbminmax.z = ( nDir.z > 0. ) ? rbmax.z : rbmin.z;\n float correction = min( min( rbminmax.x, rbminmax.y ), rbminmax.z );\n vec3 boxIntersection = vWorldPosition + nDir * correction; \n return boxIntersection - cubePos;\n }\n#endif\n\n ${e.fragmentShader.replace("#include <envmap_physical_pars_fragment>",o.ShaderChunk.envmap_physical_pars_fragment).replace("vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );","vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n \n#ifdef BOX_PROJECTED_ENV_MAP\n worldNormal = parallaxCorrectNormal( worldNormal, envMapSize, envMapPosition );\n#endif\n\n ").replace("reflectVec = inverseTransformDirection( reflectVec, viewMatrix );","reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n \n#ifdef BOX_PROJECTED_ENV_MAP\n reflectVec = parallaxCorrectNormal( reflectVec, envMapSize, envMapPosition );\n#endif\n\n ")}`}(e,i.position,i.size),customProgramCacheKey:()=>JSON.stringify(i.position.toArray())+JSON.stringify(i.size.toArray())})),[...i.position.toArray(),...i.size.toArray()]);return t.useLayoutEffect((()=>{a.current.needsUpdate=!0}),[i]),c};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { ReactThreeFiber } from '@react-three/fiber';
|
|
4
|
-
interface MaterialShader {
|
|
5
|
-
vertexShader: string;
|
|
6
|
-
fragmentShader: string;
|
|
7
|
-
defines: {
|
|
8
|
-
[define: string]: string | number | boolean;
|
|
9
|
-
} | undefined;
|
|
10
|
-
uniforms: {
|
|
11
|
-
[uniform: string]: THREE.IUniform;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export declare function useBoxProjectedEnv(position?: ReactThreeFiber.Vector3, size?: ReactThreeFiber.Vector3): {
|
|
15
|
-
ref: React.RefObject<THREE.Material>;
|
|
16
|
-
onBeforeCompile: (shader: MaterialShader) => void;
|
|
17
|
-
customProgramCacheKey: () => string;
|
|
18
|
-
};
|
|
19
|
-
export {};
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { applyProps } from '@react-three/fiber';
|
|
4
|
-
|
|
5
|
-
// credits for the box-projecting shader code go to codercat (https://codercat.tk)
|
|
6
|
-
// and @0beqz https://gist.github.com/0beqz/8d51b4ae16d68021a09fb504af708fca
|
|
7
|
-
|
|
8
|
-
const worldposReplace = /* glsl */`
|
|
9
|
-
#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )
|
|
10
|
-
vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );
|
|
11
|
-
#ifdef BOX_PROJECTED_ENV_MAP
|
|
12
|
-
vWorldPosition = worldPosition.xyz;
|
|
13
|
-
#endif
|
|
14
|
-
#endif
|
|
15
|
-
`;
|
|
16
|
-
const boxProjectDefinitions = /*glsl */`
|
|
17
|
-
#ifdef BOX_PROJECTED_ENV_MAP
|
|
18
|
-
uniform vec3 envMapSize;
|
|
19
|
-
uniform vec3 envMapPosition;
|
|
20
|
-
varying vec3 vWorldPosition;
|
|
21
|
-
|
|
22
|
-
vec3 parallaxCorrectNormal( vec3 v, vec3 cubeSize, vec3 cubePos ) {
|
|
23
|
-
vec3 nDir = normalize( v );
|
|
24
|
-
vec3 rbmax = ( .5 * cubeSize + cubePos - vWorldPosition ) / nDir;
|
|
25
|
-
vec3 rbmin = ( -.5 * cubeSize + cubePos - vWorldPosition ) / nDir;
|
|
26
|
-
vec3 rbminmax;
|
|
27
|
-
rbminmax.x = ( nDir.x > 0. ) ? rbmax.x : rbmin.x;
|
|
28
|
-
rbminmax.y = ( nDir.y > 0. ) ? rbmax.y : rbmin.y;
|
|
29
|
-
rbminmax.z = ( nDir.z > 0. ) ? rbmax.z : rbmin.z;
|
|
30
|
-
float correction = min( min( rbminmax.x, rbminmax.y ), rbminmax.z );
|
|
31
|
-
vec3 boxIntersection = vWorldPosition + nDir * correction;
|
|
32
|
-
return boxIntersection - cubePos;
|
|
33
|
-
}
|
|
34
|
-
#endif
|
|
35
|
-
`;
|
|
36
|
-
|
|
37
|
-
// will be inserted after "vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );"
|
|
38
|
-
const getIBLIrradiance_patch = /* glsl */`
|
|
39
|
-
#ifdef BOX_PROJECTED_ENV_MAP
|
|
40
|
-
worldNormal = parallaxCorrectNormal( worldNormal, envMapSize, envMapPosition );
|
|
41
|
-
#endif
|
|
42
|
-
`;
|
|
43
|
-
|
|
44
|
-
// will be inserted after "reflectVec = inverseTransformDirection( reflectVec, viewMatrix );"
|
|
45
|
-
const getIBLRadiance_patch = /* glsl */`
|
|
46
|
-
#ifdef BOX_PROJECTED_ENV_MAP
|
|
47
|
-
reflectVec = parallaxCorrectNormal( reflectVec, envMapSize, envMapPosition );
|
|
48
|
-
#endif
|
|
49
|
-
`;
|
|
50
|
-
|
|
51
|
-
// FIXME Replace with `THREE.WebGLProgramParametersWithUniforms` type when able to target @types/three@0.160.0
|
|
52
|
-
|
|
53
|
-
function boxProjectedEnvMap(shader, envMapPosition, envMapSize) {
|
|
54
|
-
// defines
|
|
55
|
-
shader.defines.BOX_PROJECTED_ENV_MAP = true;
|
|
56
|
-
// uniforms
|
|
57
|
-
shader.uniforms.envMapPosition = {
|
|
58
|
-
value: envMapPosition
|
|
59
|
-
};
|
|
60
|
-
shader.uniforms.envMapSize = {
|
|
61
|
-
value: envMapSize
|
|
62
|
-
};
|
|
63
|
-
// vertex shader
|
|
64
|
-
shader.vertexShader = `
|
|
65
|
-
varying vec3 vWorldPosition;
|
|
66
|
-
${shader.vertexShader.replace('#include <worldpos_vertex>', worldposReplace)}`;
|
|
67
|
-
// fragment shader
|
|
68
|
-
shader.fragmentShader = `
|
|
69
|
-
${boxProjectDefinitions}
|
|
70
|
-
${shader.fragmentShader.replace('#include <envmap_physical_pars_fragment>', THREE.ShaderChunk.envmap_physical_pars_fragment).replace('vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );', `vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
71
|
-
${getIBLIrradiance_patch}
|
|
72
|
-
`).replace('reflectVec = inverseTransformDirection( reflectVec, viewMatrix );', `reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
|
|
73
|
-
${getIBLRadiance_patch}
|
|
74
|
-
`)}`;
|
|
75
|
-
}
|
|
76
|
-
function useBoxProjectedEnv(position = new THREE.Vector3(), size = new THREE.Vector3()) {
|
|
77
|
-
const [config] = React.useState(() => ({
|
|
78
|
-
position: new THREE.Vector3(),
|
|
79
|
-
size: new THREE.Vector3()
|
|
80
|
-
}));
|
|
81
|
-
applyProps(config, {
|
|
82
|
-
position,
|
|
83
|
-
size
|
|
84
|
-
});
|
|
85
|
-
const ref = React.useRef(null);
|
|
86
|
-
const spread = React.useMemo(() => ({
|
|
87
|
-
ref,
|
|
88
|
-
onBeforeCompile: shader => boxProjectedEnvMap(shader, config.position, config.size),
|
|
89
|
-
customProgramCacheKey: () => JSON.stringify(config.position.toArray()) + JSON.stringify(config.size.toArray())
|
|
90
|
-
}), [...config.position.toArray(), ...config.size.toArray()]);
|
|
91
|
-
React.useLayoutEffect(() => void (ref.current.needsUpdate = true), [config]);
|
|
92
|
-
return spread;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export { useBoxProjectedEnv };
|
package/core/useCamera.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 n(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 c=n(e);exports.useCamera=function(e,n){const u=t.useThree((e=>e.pointer)),[a]=c.useState((()=>{const c=new r.Raycaster;return n&&t.applyProps(c,n),function(t,n){c.setFromCamera(u,e instanceof r.Camera?e:e.current);const a=this.constructor.prototype.raycast.bind(this);a&&a(c,n)}}));return a};
|
package/core/useCamera.d.ts
DELETED
package/core/useCamera.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Raycaster, Camera } from 'three';
|
|
3
|
-
import { useThree, applyProps } from '@react-three/fiber';
|
|
4
|
-
|
|
5
|
-
function useCamera(camera, props) {
|
|
6
|
-
const pointer = useThree(state => state.pointer);
|
|
7
|
-
const [raycast] = React.useState(() => {
|
|
8
|
-
const raycaster = new Raycaster();
|
|
9
|
-
if (props) applyProps(raycaster, props);
|
|
10
|
-
return function (_, intersects) {
|
|
11
|
-
raycaster.setFromCamera(pointer, camera instanceof Camera ? camera : camera.current);
|
|
12
|
-
const rc = this.constructor.prototype.raycast.bind(this);
|
|
13
|
-
if (rc) rc(raycaster, intersects);
|
|
14
|
-
};
|
|
15
|
-
});
|
|
16
|
-
return raycast;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { useCamera };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function e(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)}Object.defineProperty(exports,"__esModule",{value:!0});var r=e(require("react"));exports.useContextBridge=function(...e){const t=r.useRef([]);return t.current=e.map((e=>r.useContext(e))),r.useMemo((()=>({children:n})=>e.reduceRight(((e,n,u)=>r.createElement(n.Provider,{value:t.current[u],children:e})),n)),[])};
|
package/core/useContextBridge.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
/* eslint-disable react-hooks/rules-of-hooks */
|
|
4
|
-
function useContextBridge(...contexts) {
|
|
5
|
-
const cRef = React.useRef([]);
|
|
6
|
-
cRef.current = contexts.map(context => React.useContext(context));
|
|
7
|
-
return React.useMemo(() => ({
|
|
8
|
-
children
|
|
9
|
-
}) => contexts.reduceRight((acc, Context, i) => /*#__PURE__*/React.createElement(Context.Provider, {
|
|
10
|
-
value: cRef.current[i],
|
|
11
|
-
children: acc
|
|
12
|
-
}), children
|
|
13
|
-
/*
|
|
14
|
-
* done this way in reference to:
|
|
15
|
-
* https://github.com/DefinitelyTyped/DefinitelyTyped/issues/44572#issuecomment-625878049
|
|
16
|
-
* https://github.com/microsoft/TypeScript/issues/14729
|
|
17
|
-
*/), []);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { useContextBridge };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three"),r=require("react"),t=require("@react-three/fiber"),u=require("./Fbo.cjs.js");function n(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 s=n(r);exports.useDepthBuffer=function({size:r=256,frames:n=1/0}={}){const c=t.useThree((e=>e.viewport.dpr)),{width:o,height:i}=t.useThree((e=>e.size)),a=r||o*c,f=r||i*c,p=s.useMemo((()=>{const r=new e.DepthTexture(a,f);return r.format=e.DepthFormat,r.type=e.UnsignedShortType,{depthTexture:r}}),[a,f]);let d=0;const h=u.useFBO(a,f,p);return t.useFrame((e=>{(n===1/0||d<n)&&(e.gl.setRenderTarget(h),e.gl.render(e.scene,e.camera),e.gl.setRenderTarget(null),d++)})),h.depthTexture};
|