@react-three/drei 10.7.7 → 11.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -758
- package/_chunks/hls.mjs +3 -0
- package/_chunks/libs/@mediapipe/tasks-vision.mjs +4781 -0
- package/_chunks/libs/@monogrid/gainmap-js.mjs +1137 -0
- package/_chunks/libs/@use-gesture/core.mjs +1650 -0
- package/_chunks/libs/@use-gesture/react.mjs +207 -0
- package/_chunks/libs/camera-controls.mjs +2207 -0
- package/_chunks/libs/detect-gpu.mjs +515 -0
- package/_chunks/libs/hls.js.mjs +21925 -0
- package/_chunks/libs/maath.mjs +5200 -0
- package/_chunks/libs/stats-gl.mjs +301 -0
- package/_chunks/libs/stats.js.mjs +90 -0
- package/_chunks/libs/suspend-react.mjs +60 -0
- package/_chunks/libs/three.mjs +23169 -0
- package/_chunks/libs/tunnel-rat.mjs +458 -0
- package/_chunks/libs/zustand.mjs +104 -0
- package/_chunks/rolldown-runtime.mjs +47 -0
- package/_chunks/vision_bundle.mjs +3 -0
- package/core/_chunks/hls.mjs +3 -0
- package/core/_chunks/libs/@monogrid/gainmap-js.mjs +1137 -0
- package/core/_chunks/libs/@use-gesture/core.mjs +1650 -0
- package/core/_chunks/libs/@use-gesture/react.mjs +207 -0
- package/core/_chunks/libs/detect-gpu.mjs +515 -0
- package/core/_chunks/libs/hls.js.mjs +21925 -0
- package/core/_chunks/libs/maath.mjs +5200 -0
- package/core/_chunks/libs/stats-gl.mjs +301 -0
- package/core/_chunks/libs/stats.js.mjs +90 -0
- package/core/_chunks/libs/suspend-react.mjs +60 -0
- package/core/_chunks/libs/three.mjs +22457 -0
- package/core/_chunks/libs/tunnel-rat.mjs +458 -0
- package/core/_chunks/libs/zustand.mjs +104 -0
- package/core/_chunks/rolldown-runtime.mjs +47 -0
- package/core/core/index.d.mts +2232 -0
- package/core/core/index.mjs +11082 -0
- package/experimental/_chunks/libs/three.mjs +15386 -0
- package/experimental/experimental/index.d.mts +253 -0
- package/experimental/experimental/index.mjs +434 -0
- package/external/_chunks/hls.mjs +3 -0
- package/external/_chunks/libs/@mediapipe/tasks-vision.mjs +4781 -0
- package/external/_chunks/libs/camera-controls.mjs +2207 -0
- package/external/_chunks/libs/hls.js.mjs +21925 -0
- package/external/_chunks/libs/maath.mjs +5200 -0
- package/external/_chunks/libs/suspend-react.mjs +58 -0
- package/external/_chunks/libs/three.mjs +15387 -0
- package/external/_chunks/rolldown-runtime.mjs +32 -0
- package/external/_chunks/vision_bundle.mjs +3 -0
- package/external/external/index.d.mts +499 -0
- package/external/external/index.mjs +9422 -0
- package/index.d.mts +2567 -0
- package/index.mjs +20571 -0
- package/legacy/_chunks/hls.mjs +3 -0
- package/legacy/_chunks/libs/@monogrid/gainmap-js.mjs +1137 -0
- package/legacy/_chunks/libs/@use-gesture/core.mjs +1650 -0
- package/legacy/_chunks/libs/@use-gesture/react.mjs +207 -0
- package/legacy/_chunks/libs/bidi-js.mjs +675 -0
- package/legacy/_chunks/libs/detect-gpu.mjs +515 -0
- package/legacy/_chunks/libs/hls.js.mjs +21925 -0
- package/legacy/_chunks/libs/maath.mjs +5200 -0
- package/legacy/_chunks/libs/stats-gl.mjs +301 -0
- package/legacy/_chunks/libs/stats.js.mjs +90 -0
- package/legacy/_chunks/libs/suspend-react.mjs +60 -0
- package/legacy/_chunks/libs/three.mjs +26062 -0
- package/legacy/_chunks/libs/troika-three-text.mjs +6494 -0
- package/legacy/_chunks/libs/tunnel-rat.mjs +458 -0
- package/legacy/_chunks/libs/zustand.mjs +104 -0
- package/legacy/_chunks/rolldown-runtime.mjs +47 -0
- package/legacy/legacy/index.d.mts +2788 -0
- package/legacy/legacy/index.mjs +14984 -0
- package/native/_chunks/hls.mjs +3 -0
- package/native/_chunks/libs/@monogrid/gainmap-js.mjs +1137 -0
- package/native/_chunks/libs/@use-gesture/core.mjs +1650 -0
- package/native/_chunks/libs/@use-gesture/react.mjs +207 -0
- package/native/_chunks/libs/detect-gpu.mjs +515 -0
- package/native/_chunks/libs/hls.js.mjs +21925 -0
- package/native/_chunks/libs/maath.mjs +5200 -0
- package/native/_chunks/libs/stats-gl.mjs +301 -0
- package/native/_chunks/libs/stats.js.mjs +90 -0
- package/native/_chunks/libs/suspend-react.mjs +60 -0
- package/native/_chunks/libs/three.mjs +22592 -0
- package/native/_chunks/libs/tunnel-rat.mjs +458 -0
- package/native/_chunks/libs/zustand.mjs +104 -0
- package/native/_chunks/rolldown-runtime.mjs +47 -0
- package/native/native/index.d.mts +3168 -0
- package/native/native/index.mjs +14863 -0
- package/package.json +41 -10
- package/webgpu/_chunks/hls.mjs +3 -0
- package/webgpu/_chunks/libs/@monogrid/gainmap-js.mjs +1137 -0
- package/webgpu/_chunks/libs/@use-gesture/core.mjs +1650 -0
- package/webgpu/_chunks/libs/@use-gesture/react.mjs +207 -0
- package/webgpu/_chunks/libs/detect-gpu.mjs +515 -0
- package/webgpu/_chunks/libs/hls.js.mjs +21925 -0
- package/webgpu/_chunks/libs/maath.mjs +5200 -0
- package/webgpu/_chunks/libs/stats-gl.mjs +301 -0
- package/webgpu/_chunks/libs/stats.js.mjs +90 -0
- package/webgpu/_chunks/libs/suspend-react.mjs +60 -0
- package/webgpu/_chunks/libs/three.mjs +22592 -0
- package/webgpu/_chunks/libs/tunnel-rat.mjs +458 -0
- package/webgpu/_chunks/libs/zustand.mjs +104 -0
- package/webgpu/_chunks/rolldown-runtime.mjs +47 -0
- package/webgpu/webgpu/index.d.mts +3166 -0
- package/webgpu/webgpu/index.mjs +15015 -0
- package/core/AccumulativeShadows.cjs.js +0 -1
- package/core/AccumulativeShadows.d.ts +0 -59
- package/core/AccumulativeShadows.js +0 -310
- package/core/AdaptiveDpr.cjs.js +0 -1
- package/core/AdaptiveDpr.d.ts +0 -3
- package/core/AdaptiveDpr.js +0 -28
- package/core/AdaptiveEvents.cjs.js +0 -1
- package/core/AdaptiveEvents.d.ts +0 -1
- package/core/AdaptiveEvents.js +0 -20
- package/core/ArcballControls.cjs.js +0 -1
- package/core/ArcballControls.d.ts +0 -15
- package/core/ArcballControls.js +0 -67
- package/core/AsciiRenderer.cjs.js +0 -1
- package/core/AsciiRenderer.d.ts +0 -11
- package/core/AsciiRenderer.js +0 -66
- package/core/BBAnchor.cjs.js +0 -1
- package/core/BBAnchor.d.ts +0 -7
- package/core/BBAnchor.js +0 -37
- package/core/Backdrop.cjs.js +0 -1
- package/core/Backdrop.d.ts +0 -15
- package/core/Backdrop.js +0 -33
- package/core/BakeShadows.cjs.js +0 -1
- package/core/BakeShadows.d.ts +0 -1
- package/core/BakeShadows.js +0 -16
- package/core/Billboard.cjs.js +0 -1
- package/core/Billboard.d.ts +0 -10
- package/core/Billboard.js +0 -53
- package/core/Bounds.cjs.js +0 -1
- package/core/Bounds.d.ts +0 -36
- package/core/Bounds.js +0 -254
- package/core/Bvh.cjs.js +0 -1
- package/core/Bvh.d.ts +0 -19
- package/core/Bvh.js +0 -92
- package/core/CameraControls.cjs.js +0 -1
- package/core/CameraControls.d.ts +0 -48
- package/core/CameraControls.js +0 -151
- package/core/CameraShake.cjs.js +0 -1
- package/core/CameraShake.d.ts +0 -17
- package/core/CameraShake.js +0 -57
- package/core/CatmullRomLine.cjs.js +0 -1
- package/core/CatmullRomLine.d.ts +0 -10
- package/core/CatmullRomLine.js +0 -42
- package/core/Caustics.cjs.js +0 -1
- package/core/Caustics.d.ts +0 -32
- package/core/Caustics.js +0 -388
- package/core/Center.cjs.js +0 -1
- package/core/Center.d.ts +0 -33
- package/core/Center.js +0 -67
- package/core/Clone.cjs.js +0 -1
- package/core/Clone.d.ts +0 -15
- package/core/Clone.js +0 -100
- package/core/Cloud.cjs.js +0 -1
- package/core/Cloud.d.ts +0 -97
- package/core/Cloud.js +0 -231
- package/core/ComputedAttribute.cjs.js +0 -1
- package/core/ComputedAttribute.d.ts +0 -8
- package/core/ComputedAttribute.js +0 -33
- package/core/ContactShadows.cjs.js +0 -1
- package/core/ContactShadows.d.ts +0 -18
- package/core/ContactShadows.js +0 -114
- package/core/CubeCamera.cjs.js +0 -1
- package/core/CubeCamera.d.ts +0 -21
- package/core/CubeCamera.js +0 -86
- package/core/CubeTexture.cjs.js +0 -1
- package/core/CubeTexture.d.ts +0 -14
- package/core/CubeTexture.js +0 -25
- package/core/CubicBezierLine.cjs.js +0 -1
- package/core/CubicBezierLine.d.ts +0 -12
- package/core/CubicBezierLine.js +0 -28
- package/core/CurveModifier.cjs.js +0 -1
- package/core/CurveModifier.d.ts +0 -11
- package/core/CurveModifier.js +0 -27
- package/core/Decal.cjs.js +0 -1
- package/core/Decal.d.ts +0 -16
- package/core/Decal.js +0 -128
- package/core/Detailed.cjs.js +0 -1
- package/core/Detailed.d.ts +0 -10
- package/core/Detailed.js +0 -33
- package/core/DetectGPU.cjs.js +0 -1
- package/core/DetectGPU.d.ts +0 -7
- package/core/DetectGPU.js +0 -14
- package/core/DeviceOrientationControls.cjs.js +0 -1
- package/core/DeviceOrientationControls.d.ts +0 -10
- package/core/DeviceOrientationControls.js +0 -51
- package/core/Edges.cjs.js +0 -1
- package/core/Edges.d.ts +0 -13
- package/core/Edges.js +0 -38
- package/core/Effects.cjs.js +0 -1
- package/core/Effects.d.ts +0 -25
- package/core/Effects.js +0 -91
- package/core/Environment.cjs.js +0 -1
- package/core/Environment.d.ts +0 -37
- package/core/Environment.js +0 -189
- package/core/Example.cjs.js +0 -1
- package/core/Example.d.ts +0 -13
- package/core/Example.js +0 -46
- package/core/Fbo.cjs.js +0 -1
- package/core/Fbo.d.ts +0 -22
- package/core/Fbo.js +0 -63
- package/core/Fbx.cjs.js +0 -1
- package/core/Fbx.d.ts +0 -11
- package/core/Fbx.js +0 -23
- package/core/FirstPersonControls.cjs.js +0 -1
- package/core/FirstPersonControls.d.ts +0 -8
- package/core/FirstPersonControls.js +0 -38
- package/core/Fisheye.cjs.js +0 -1
- package/core/Fisheye.d.ts +0 -10
- package/core/Fisheye.js +0 -95
- package/core/Float.cjs.js +0 -1
- package/core/Float.d.ts +0 -14
- package/core/Float.js +0 -37
- package/core/FlyControls.cjs.js +0 -1
- package/core/FlyControls.d.ts +0 -10
- package/core/FlyControls.js +0 -55
- package/core/GizmoHelper.cjs.js +0 -1
- package/core/GizmoHelper.d.ts +0 -16
- package/core/GizmoHelper.js +0 -116
- package/core/GizmoViewcube.cjs.js +0 -1
- package/core/GizmoViewcube.d.ts +0 -14
- package/core/GizmoViewcube.js +0 -133
- package/core/GizmoViewport.cjs.js +0 -1
- package/core/GizmoViewport.d.ts +0 -16
- package/core/GizmoViewport.js +0 -140
- package/core/Gltf.cjs.js +0 -1
- package/core/Gltf.d.ts +0 -27
- package/core/Gltf.js +0 -52
- package/core/GradientTexture.cjs.js +0 -1
- package/core/GradientTexture.d.ts +0 -18
- package/core/GradientTexture.js +0 -54
- package/core/Grid.cjs.js +0 -1
- package/core/Grid.d.ts +0 -26
- package/core/Grid.js +0 -142
- package/core/Helper.cjs.js +0 -1
- package/core/Helper.d.ts +0 -16
- package/core/Helper.js +0 -47
- package/core/Hud.cjs.js +0 -1
- package/core/Hud.d.ts +0 -6
- package/core/Hud.js +0 -55
- package/core/Image.cjs.js +0 -1
- package/core/Image.d.ts +0 -38
- package/core/Image.js +0 -160
- package/core/Instances.cjs.js +0 -1
- package/core/Instances.d.ts +0 -64
- package/core/Instances.js +0 -313
- package/core/Ktx2.cjs.js +0 -1
- package/core/Ktx2.d.ts +0 -14
- package/core/Ktx2.js +0 -48
- package/core/Lightformer.cjs.js +0 -1
- package/core/Lightformer.d.ts +0 -15
- package/core/Lightformer.js +0 -63
- package/core/Line.cjs.js +0 -1
- package/core/Line.d.ts +0 -13
- package/core/Line.js +0 -73
- package/core/MapControls.cjs.js +0 -1
- package/core/MapControls.d.ts +0 -14
- package/core/MapControls.js +0 -63
- package/core/MarchingCubes.cjs.js +0 -1
- package/core/MarchingCubes.d.ts +0 -24
- package/core/MarchingCubes.js +0 -78
- package/core/Mask.cjs.js +0 -1
- package/core/Mask.d.ts +0 -17
- package/core/Mask.js +0 -42
- package/core/MatcapTexture.cjs.js +0 -1
- package/core/MatcapTexture.d.ts +0 -9
- package/core/MatcapTexture.js +0 -51
- package/core/MeshDiscardMaterial.cjs.js +0 -1
- package/core/MeshDiscardMaterial.d.ts +0 -10
- package/core/MeshDiscardMaterial.js +0 -15
- package/core/MeshDistortMaterial.cjs.js +0 -1
- package/core/MeshDistortMaterial.d.ts +0 -39
- package/core/MeshDistortMaterial.js +0 -72
- package/core/MeshPortalMaterial.cjs.js +0 -1
- package/core/MeshPortalMaterial.d.ts +0 -25
- package/core/MeshPortalMaterial.js +0 -467
- package/core/MeshReflectorMaterial.cjs.js +0 -1
- package/core/MeshReflectorMaterial.d.ts +0 -14
- package/core/MeshReflectorMaterial.js +0 -180
- package/core/MeshRefractionMaterial.cjs.js +0 -1
- package/core/MeshRefractionMaterial.d.ts +0 -19
- package/core/MeshRefractionMaterial.js +0 -73
- package/core/MeshTransmissionMaterial.cjs.js +0 -1
- package/core/MeshTransmissionMaterial.d.ts +0 -34
- package/core/MeshTransmissionMaterial.js +0 -402
- package/core/MeshWobbleMaterial.cjs.js +0 -1
- package/core/MeshWobbleMaterial.d.ts +0 -36
- package/core/MeshWobbleMaterial.js +0 -60
- package/core/MotionPathControls.cjs.js +0 -1
- package/core/MotionPathControls.d.ts +0 -33
- package/core/MotionPathControls.js +0 -121
- package/core/MultiMaterial.cjs.js +0 -1
- package/core/MultiMaterial.d.ts +0 -4
- package/core/MultiMaterial.js +0 -29
- package/core/NormalTexture.cjs.js +0 -1
- package/core/NormalTexture.d.ts +0 -14
- package/core/NormalTexture.js +0 -42
- package/core/OrbitControls.cjs.js +0 -1
- package/core/OrbitControls.d.ts +0 -22
- package/core/OrbitControls.js +0 -79
- package/core/OrthographicCamera.cjs.js +0 -1
- package/core/OrthographicCamera.d.ts +0 -14
- package/core/OrthographicCamera.js +0 -76
- package/core/Outlines.cjs.js +0 -1
- package/core/Outlines.d.ts +0 -17
- package/core/Outlines.js +0 -166
- package/core/PerformanceMonitor.cjs.js +0 -1
- package/core/PerformanceMonitor.d.ts +0 -36
- package/core/PerformanceMonitor.js +0 -116
- package/core/PerspectiveCamera.cjs.js +0 -1
- package/core/PerspectiveCamera.d.ts +0 -14
- package/core/PerspectiveCamera.js +0 -72
- package/core/PointMaterial.cjs.js +0 -1
- package/core/PointMaterial.d.ts +0 -8
- package/core/PointMaterial.js +0 -36
- package/core/PointerLockControls.cjs.js +0 -1
- package/core/PointerLockControls.d.ts +0 -15
- package/core/PointerLockControls.js +0 -89
- package/core/Points.cjs.js +0 -1
- package/core/Points.d.ts +0 -31
- package/core/Points.js +0 -202
- package/core/PositionalAudio.cjs.js +0 -1
- package/core/PositionalAudio.d.ts +0 -9
- package/core/PositionalAudio.js +0 -46
- package/core/Preload.cjs.js +0 -1
- package/core/Preload.d.ts +0 -7
- package/core/Preload.js +0 -44
- package/core/Progress.cjs.js +0 -1
- package/core/Progress.d.ts +0 -14
- package/core/Progress.js +0 -55
- package/core/QuadraticBezierLine.cjs.js +0 -1
- package/core/QuadraticBezierLine.d.ts +0 -14
- package/core/QuadraticBezierLine.js +0 -42
- package/core/RenderCubeTexture.cjs.js +0 -1
- package/core/RenderCubeTexture.d.ts +0 -30
- package/core/RenderCubeTexture.js +0 -96
- package/core/RenderTexture.cjs.js +0 -1
- package/core/RenderTexture.d.ts +0 -18
- package/core/RenderTexture.js +0 -105
- package/core/Resize.cjs.js +0 -1
- package/core/Resize.d.ts +0 -17
- package/core/Resize.js +0 -39
- package/core/RoundedBox.cjs.js +0 -1
- package/core/RoundedBox.d.ts +0 -14
- package/core/RoundedBox.js +0 -70
- package/core/Sampler.cjs.js +0 -1
- package/core/Sampler.d.ts +0 -28
- package/core/Sampler.js +0 -75
- package/core/ScreenQuad.cjs.js +0 -1
- package/core/ScreenQuad.d.ts +0 -5
- package/core/ScreenQuad.js +0 -25
- package/core/ScreenSizer.cjs.js +0 -1
- package/core/ScreenSizer.d.ts +0 -7
- package/core/ScreenSizer.js +0 -39
- package/core/ScreenSpace.cjs.js +0 -1
- package/core/ScreenSpace.d.ts +0 -7
- package/core/ScreenSpace.js +0 -25
- package/core/Segments.cjs.js +0 -1
- package/core/Segments.d.ts +0 -29
- package/core/Segments.js +0 -96
- package/core/Shadow.cjs.js +0 -1
- package/core/Shadow.d.ts +0 -12
- package/core/Shadow.js +0 -42
- package/core/ShadowAlpha.cjs.js +0 -1
- package/core/ShadowAlpha.d.ts +0 -7
- package/core/ShadowAlpha.js +0 -108
- package/core/Sky.cjs.js +0 -1
- package/core/Sky.d.ts +0 -16
- package/core/Sky.js +0 -39
- package/core/Sparkles.cjs.js +0 -1
- package/core/Sparkles.d.ts +0 -26
- package/core/Sparkles.js +0 -161
- package/core/Splat.cjs.js +0 -1
- package/core/Splat.d.ts +0 -56
- package/core/Splat.js +0 -506
- package/core/SpotLight.cjs.js +0 -1
- package/core/SpotLight.d.ts +0 -27
- package/core/SpotLight.js +0 -223
- package/core/SpriteAnimator.cjs.js +0 -1
- package/core/SpriteAnimator.d.ts +0 -88
- package/core/SpriteAnimator.js +0 -413
- package/core/Stage.cjs.js +0 -1
- package/core/Stage.d.ts +0 -27
- package/core/Stage.js +0 -133
- package/core/Stars.cjs.js +0 -1
- package/core/Stars.d.ts +0 -22
- package/core/Stars.js +0 -100
- package/core/Stats.cjs.js +0 -1
- package/core/Stats.d.ts +0 -7
- package/core/Stats.js +0 -32
- package/core/StatsGl.cjs.js +0 -1
- package/core/StatsGl.d.ts +0 -14
- package/core/StatsGl.js +0 -44
- package/core/Svg.cjs.js +0 -1
- package/core/Svg.d.ts +0 -13
- package/core/Svg.js +0 -62
- package/core/Text.cjs.js +0 -1
- package/core/Text.d.ts +0 -38
- package/core/Text.js +0 -57
- package/core/Text3D.cjs.js +0 -1
- package/core/Text3D.d.ts +0 -20
- package/core/Text3D.js +0 -74
- package/core/Texture.cjs.js +0 -1
- package/core/Texture.d.ts +0 -20
- package/core/Texture.js +0 -60
- package/core/TrackballControls.cjs.js +0 -1
- package/core/TrackballControls.d.ts +0 -15
- package/core/TrackballControls.js +0 -72
- package/core/Trail.cjs.js +0 -1
- package/core/Trail.d.ts +0 -21
- package/core/Trail.js +0 -150
- package/core/TrailTexture.cjs.js +0 -1
- package/core/TrailTexture.d.ts +0 -19
- package/core/TrailTexture.js +0 -159
- package/core/TransformControls.cjs.js +0 -1
- package/core/TransformControls.d.ts +0 -28
- package/core/TransformControls.js +0 -114
- package/core/VideoTexture.cjs.js +0 -1
- package/core/VideoTexture.d.ts +0 -26
- package/core/VideoTexture.js +0 -111
- package/core/Wireframe.cjs.js +0 -1
- package/core/Wireframe.d.ts +0 -15
- package/core/Wireframe.js +0 -157
- package/core/calculateScaleFactor.cjs.js +0 -1
- package/core/calculateScaleFactor.d.ts +0 -3
- package/core/calculateScaleFactor.js +0 -31
- package/core/index.cjs.js +0 -1
- package/core/index.d.ts +0 -122
- package/core/index.js +0 -150
- package/core/meshBounds.cjs.js +0 -1
- package/core/meshBounds.d.ts +0 -2
- package/core/meshBounds.js +0 -28
- package/core/shaderMaterial.cjs.js +0 -1
- package/core/shaderMaterial.d.ts +0 -9
- package/core/shaderMaterial.js +0 -29
- package/core/shapes.cjs.js +0 -1
- package/core/shapes.d.ts +0 -26
- package/core/shapes.js +0 -65
- package/core/softShadows.cjs.js +0 -1
- package/core/softShadows.d.ts +0 -6
- package/core/softShadows.js +0 -158
- package/core/useAnimations.cjs.js +0 -1
- package/core/useAnimations.d.ts +0 -13
- package/core/useAnimations.js +0 -52
- package/core/useAspect.cjs.js +0 -1
- package/core/useAspect.d.ts +0 -1
- package/core/useAspect.js +0 -10
- package/core/useBoxProjectedEnv.cjs.js +0 -1
- package/core/useBoxProjectedEnv.d.ts +0 -19
- package/core/useBoxProjectedEnv.js +0 -95
- package/core/useCamera.cjs.js +0 -1
- package/core/useCamera.d.ts +0 -3
- package/core/useCamera.js +0 -19
- package/core/useContextBridge.cjs.js +0 -1
- package/core/useContextBridge.d.ts +0 -4
- package/core/useContextBridge.js +0 -20
- package/core/useDepthBuffer.cjs.js +0 -1
- package/core/useDepthBuffer.d.ts +0 -6
- package/core/useDepthBuffer.js +0 -38
- package/core/useEnvironment.cjs.js +0 -1
- package/core/useEnvironment.d.ts +0 -17
- package/core/useEnvironment.js +0 -150
- package/core/useFont.cjs.js +0 -1
- package/core/useFont.d.ts +0 -24
- package/core/useFont.js +0 -24
- package/core/useIntersect.cjs.js +0 -1
- package/core/useIntersect.d.ts +0 -3
- package/core/useIntersect.js +0 -36
- package/core/useSpriteLoader.cjs.js +0 -1
- package/core/useSpriteLoader.d.ts +0 -57
- package/core/useSpriteLoader.js +0 -402
- package/helpers/constants.cjs.js +0 -1
- package/helpers/constants.d.ts +0 -1
- package/helpers/constants.js +0 -6
- package/helpers/deprecated.cjs.js +0 -1
- package/helpers/deprecated.d.ts +0 -5
- package/helpers/deprecated.js +0 -8
- package/helpers/environment-assets.cjs.js +0 -1
- package/helpers/environment-assets.d.ts +0 -13
- package/helpers/environment-assets.js +0 -14
- package/helpers/glsl/DefaultSpotlightShadowShadows.glsl.js +0 -3
- package/helpers/glsl/distort.vert.glsl.js +0 -3
- package/helpers/ts-utils.cjs.js +0 -1
- package/helpers/ts-utils.d.ts +0 -7
- package/helpers/ts-utils.js +0 -1
- package/helpers/useEffectfulState.cjs.js +0 -1
- package/helpers/useEffectfulState.d.ts +0 -4
- package/helpers/useEffectfulState.js +0 -17
- package/index.cjs.js +0 -1
- package/index.d.ts +0 -1
- package/index.js +0 -139
- package/materials/BlurPass.cjs.js +0 -1
- package/materials/BlurPass.d.ts +0 -23
- package/materials/BlurPass.js +0 -72
- package/materials/ConvolutionMaterial.cjs.js +0 -1
- package/materials/ConvolutionMaterial.d.ts +0 -7
- package/materials/ConvolutionMaterial.js +0 -97
- package/materials/DiscardMaterial.cjs.js +0 -1
- package/materials/DiscardMaterial.d.ts +0 -3
- package/materials/DiscardMaterial.js +0 -5
- package/materials/MeshReflectorMaterial.cjs.js +0 -1
- package/materials/MeshReflectorMaterial.d.ts +0 -50
- package/materials/MeshReflectorMaterial.js +0 -256
- package/materials/MeshRefractionMaterial.cjs.js +0 -1
- package/materials/MeshRefractionMaterial.d.ts +0 -18
- package/materials/MeshRefractionMaterial.js +0 -163
- package/materials/SpotLightMaterial.cjs.js +0 -1
- package/materials/SpotLightMaterial.d.ts +0 -4
- package/materials/SpotLightMaterial.js +0 -115
- package/materials/WireframeMaterial.cjs.js +0 -1
- package/materials/WireframeMaterial.d.ts +0 -64
- package/materials/WireframeMaterial.js +0 -217
- package/native/index.cjs.js +0 -1
- package/native/index.d.ts +0 -1
- package/native/index.js +0 -150
- package/web/CycleRaycast.cjs.js +0 -1
- package/web/CycleRaycast.d.ts +0 -10
- package/web/CycleRaycast.js +0 -93
- package/web/DragControls.cjs.js +0 -1
- package/web/DragControls.d.ts +0 -17
- package/web/DragControls.js +0 -127
- package/web/FaceControls.cjs.js +0 -1
- package/web/FaceControls.d.ts +0 -29
- package/web/FaceControls.js +0 -236
- package/web/FaceLandmarker.cjs.js +0 -1
- package/web/FaceLandmarker.d.ts +0 -14
- package/web/FaceLandmarker.js +0 -49
- package/web/Facemesh.cjs.js +0 -1
- package/web/Facemesh.d.ts +0 -118
- package/web/Facemesh.js +0 -4538
- package/web/Html.cjs.js +0 -1
- package/web/Html.d.ts +0 -34
- package/web/Html.js +0 -375
- package/web/KeyboardControls.cjs.js +0 -1
- package/web/KeyboardControls.d.ts +0 -37
- package/web/KeyboardControls.js +0 -104
- package/web/Loader.cjs.js +0 -1
- package/web/Loader.d.ts +0 -12
- package/web/Loader.js +0 -101
- package/web/PresentationControls.cjs.js +0 -1
- package/web/PresentationControls.d.ts +0 -16
- package/web/PresentationControls.js +0 -79
- package/web/ScreenVideoTexture.cjs.js +0 -1
- package/web/ScreenVideoTexture.d.ts +0 -17
- package/web/ScreenVideoTexture.js +0 -30
- package/web/ScrollControls.cjs.js +0 -1
- package/web/ScrollControls.d.ts +0 -45
- package/web/ScrollControls.js +0 -237
- package/web/Select.cjs.js +0 -1
- package/web/Select.d.ts +0 -14
- package/web/Select.js +0 -171
- package/web/View.cjs.js +0 -1
- package/web/View.d.ts +0 -34
- package/web/View.js +0 -259
- package/web/WebcamVideoTexture.cjs.js +0 -1
- package/web/WebcamVideoTexture.d.ts +0 -17
- package/web/WebcamVideoTexture.js +0 -33
- package/web/index.cjs.js +0 -1
- package/web/index.d.ts +0 -17
- package/web/index.js +0 -176
- package/web/pivotControls/AxisArrow.cjs.js +0 -1
- package/web/pivotControls/AxisArrow.d.ts +0 -7
- package/web/pivotControls/AxisArrow.js +0 -193
- package/web/pivotControls/AxisRotator.cjs.js +0 -1
- package/web/pivotControls/AxisRotator.d.ts +0 -7
- package/web/pivotControls/AxisRotator.js +0 -220
- package/web/pivotControls/PlaneSlider.cjs.js +0 -1
- package/web/pivotControls/PlaneSlider.d.ts +0 -7
- package/web/pivotControls/PlaneSlider.js +0 -202
- package/web/pivotControls/ScalingSphere.cjs.js +0 -1
- package/web/pivotControls/ScalingSphere.d.ts +0 -7
- package/web/pivotControls/ScalingSphere.js +0 -192
- package/web/pivotControls/context.cjs.js +0 -1
- package/web/pivotControls/context.d.ts +0 -33
- package/web/pivotControls/context.js +0 -5
- package/web/pivotControls/index.cjs.js +0 -1
- package/web/pivotControls/index.d.ts +0 -39
- package/web/pivotControls/index.js +0 -213
- package/web/useCursor.cjs.js +0 -1
- package/web/useCursor.d.ts +0 -1
- package/web/useCursor.js +0 -12
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
import { MeshStandardMaterial } from 'three';
|
|
2
|
-
|
|
3
|
-
class MeshReflectorMaterial extends MeshStandardMaterial {
|
|
4
|
-
constructor(parameters = {}) {
|
|
5
|
-
super(parameters);
|
|
6
|
-
this._tDepth = {
|
|
7
|
-
value: null
|
|
8
|
-
};
|
|
9
|
-
this._distortionMap = {
|
|
10
|
-
value: null
|
|
11
|
-
};
|
|
12
|
-
this._tDiffuse = {
|
|
13
|
-
value: null
|
|
14
|
-
};
|
|
15
|
-
this._tDiffuseBlur = {
|
|
16
|
-
value: null
|
|
17
|
-
};
|
|
18
|
-
this._textureMatrix = {
|
|
19
|
-
value: null
|
|
20
|
-
};
|
|
21
|
-
this._hasBlur = {
|
|
22
|
-
value: false
|
|
23
|
-
};
|
|
24
|
-
this._mirror = {
|
|
25
|
-
value: 0.0
|
|
26
|
-
};
|
|
27
|
-
this._mixBlur = {
|
|
28
|
-
value: 0.0
|
|
29
|
-
};
|
|
30
|
-
this._blurStrength = {
|
|
31
|
-
value: 0.5
|
|
32
|
-
};
|
|
33
|
-
this._minDepthThreshold = {
|
|
34
|
-
value: 0.9
|
|
35
|
-
};
|
|
36
|
-
this._maxDepthThreshold = {
|
|
37
|
-
value: 1
|
|
38
|
-
};
|
|
39
|
-
this._depthScale = {
|
|
40
|
-
value: 0
|
|
41
|
-
};
|
|
42
|
-
this._depthToBlurRatioBias = {
|
|
43
|
-
value: 0.25
|
|
44
|
-
};
|
|
45
|
-
this._distortion = {
|
|
46
|
-
value: 1
|
|
47
|
-
};
|
|
48
|
-
this._mixContrast = {
|
|
49
|
-
value: 1.0
|
|
50
|
-
};
|
|
51
|
-
this.setValues(parameters);
|
|
52
|
-
}
|
|
53
|
-
onBeforeCompile(shader) {
|
|
54
|
-
var _shader$defines;
|
|
55
|
-
if (!((_shader$defines = shader.defines) != null && _shader$defines.USE_UV)) {
|
|
56
|
-
shader.defines.USE_UV = '';
|
|
57
|
-
}
|
|
58
|
-
shader.uniforms.hasBlur = this._hasBlur;
|
|
59
|
-
shader.uniforms.tDiffuse = this._tDiffuse;
|
|
60
|
-
shader.uniforms.tDepth = this._tDepth;
|
|
61
|
-
shader.uniforms.distortionMap = this._distortionMap;
|
|
62
|
-
shader.uniforms.tDiffuseBlur = this._tDiffuseBlur;
|
|
63
|
-
shader.uniforms.textureMatrix = this._textureMatrix;
|
|
64
|
-
shader.uniforms.mirror = this._mirror;
|
|
65
|
-
shader.uniforms.mixBlur = this._mixBlur;
|
|
66
|
-
shader.uniforms.mixStrength = this._blurStrength;
|
|
67
|
-
shader.uniforms.minDepthThreshold = this._minDepthThreshold;
|
|
68
|
-
shader.uniforms.maxDepthThreshold = this._maxDepthThreshold;
|
|
69
|
-
shader.uniforms.depthScale = this._depthScale;
|
|
70
|
-
shader.uniforms.depthToBlurRatioBias = this._depthToBlurRatioBias;
|
|
71
|
-
shader.uniforms.distortion = this._distortion;
|
|
72
|
-
shader.uniforms.mixContrast = this._mixContrast;
|
|
73
|
-
shader.vertexShader = `
|
|
74
|
-
uniform mat4 textureMatrix;
|
|
75
|
-
varying vec4 my_vUv;
|
|
76
|
-
${shader.vertexShader}`;
|
|
77
|
-
shader.vertexShader = shader.vertexShader.replace('#include <project_vertex>', `#include <project_vertex>
|
|
78
|
-
my_vUv = textureMatrix * vec4( position, 1.0 );
|
|
79
|
-
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );`);
|
|
80
|
-
shader.fragmentShader = `
|
|
81
|
-
uniform sampler2D tDiffuse;
|
|
82
|
-
uniform sampler2D tDiffuseBlur;
|
|
83
|
-
uniform sampler2D tDepth;
|
|
84
|
-
uniform sampler2D distortionMap;
|
|
85
|
-
uniform float distortion;
|
|
86
|
-
uniform float cameraNear;
|
|
87
|
-
uniform float cameraFar;
|
|
88
|
-
uniform bool hasBlur;
|
|
89
|
-
uniform float mixBlur;
|
|
90
|
-
uniform float mirror;
|
|
91
|
-
uniform float mixStrength;
|
|
92
|
-
uniform float minDepthThreshold;
|
|
93
|
-
uniform float maxDepthThreshold;
|
|
94
|
-
uniform float mixContrast;
|
|
95
|
-
uniform float depthScale;
|
|
96
|
-
uniform float depthToBlurRatioBias;
|
|
97
|
-
varying vec4 my_vUv;
|
|
98
|
-
${shader.fragmentShader}`;
|
|
99
|
-
shader.fragmentShader = shader.fragmentShader.replace('#include <emissivemap_fragment>', `#include <emissivemap_fragment>
|
|
100
|
-
|
|
101
|
-
float distortionFactor = 0.0;
|
|
102
|
-
#ifdef USE_DISTORTION
|
|
103
|
-
distortionFactor = texture2D(distortionMap, vUv).r * distortion;
|
|
104
|
-
#endif
|
|
105
|
-
|
|
106
|
-
vec4 new_vUv = my_vUv;
|
|
107
|
-
new_vUv.x += distortionFactor;
|
|
108
|
-
new_vUv.y += distortionFactor;
|
|
109
|
-
|
|
110
|
-
vec4 base = texture2DProj(tDiffuse, new_vUv);
|
|
111
|
-
vec4 blur = texture2DProj(tDiffuseBlur, new_vUv);
|
|
112
|
-
|
|
113
|
-
vec4 merge = base;
|
|
114
|
-
|
|
115
|
-
#ifdef USE_NORMALMAP
|
|
116
|
-
vec2 normal_uv = vec2(0.0);
|
|
117
|
-
vec4 normalColor = texture2D(normalMap, vUv * normalScale);
|
|
118
|
-
vec3 my_normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );
|
|
119
|
-
vec3 coord = new_vUv.xyz / new_vUv.w;
|
|
120
|
-
normal_uv = coord.xy + coord.z * my_normal.xz * 0.05;
|
|
121
|
-
vec4 base_normal = texture2D(tDiffuse, normal_uv);
|
|
122
|
-
vec4 blur_normal = texture2D(tDiffuseBlur, normal_uv);
|
|
123
|
-
merge = base_normal;
|
|
124
|
-
blur = blur_normal;
|
|
125
|
-
#endif
|
|
126
|
-
|
|
127
|
-
float depthFactor = 0.0001;
|
|
128
|
-
float blurFactor = 0.0;
|
|
129
|
-
|
|
130
|
-
#ifdef USE_DEPTH
|
|
131
|
-
vec4 depth = texture2DProj(tDepth, new_vUv);
|
|
132
|
-
depthFactor = smoothstep(minDepthThreshold, maxDepthThreshold, 1.0-(depth.r * depth.a));
|
|
133
|
-
depthFactor *= depthScale;
|
|
134
|
-
depthFactor = max(0.0001, min(1.0, depthFactor));
|
|
135
|
-
|
|
136
|
-
#ifdef USE_BLUR
|
|
137
|
-
blur = blur * min(1.0, depthFactor + depthToBlurRatioBias);
|
|
138
|
-
merge = merge * min(1.0, depthFactor + 0.5);
|
|
139
|
-
#else
|
|
140
|
-
merge = merge * depthFactor;
|
|
141
|
-
#endif
|
|
142
|
-
|
|
143
|
-
#endif
|
|
144
|
-
|
|
145
|
-
float reflectorRoughnessFactor = roughness;
|
|
146
|
-
#ifdef USE_ROUGHNESSMAP
|
|
147
|
-
vec4 reflectorTexelRoughness = texture2D( roughnessMap, vUv );
|
|
148
|
-
reflectorRoughnessFactor *= reflectorTexelRoughness.g;
|
|
149
|
-
#endif
|
|
150
|
-
|
|
151
|
-
#ifdef USE_BLUR
|
|
152
|
-
blurFactor = min(1.0, mixBlur * reflectorRoughnessFactor);
|
|
153
|
-
merge = mix(merge, blur, blurFactor);
|
|
154
|
-
#endif
|
|
155
|
-
|
|
156
|
-
vec4 newMerge = vec4(0.0, 0.0, 0.0, 1.0);
|
|
157
|
-
newMerge.r = (merge.r - 0.5) * mixContrast + 0.5;
|
|
158
|
-
newMerge.g = (merge.g - 0.5) * mixContrast + 0.5;
|
|
159
|
-
newMerge.b = (merge.b - 0.5) * mixContrast + 0.5;
|
|
160
|
-
|
|
161
|
-
diffuseColor.rgb = diffuseColor.rgb * ((1.0 - min(1.0, mirror)) + newMerge.rgb * mixStrength);
|
|
162
|
-
`);
|
|
163
|
-
}
|
|
164
|
-
get tDiffuse() {
|
|
165
|
-
return this._tDiffuse.value;
|
|
166
|
-
}
|
|
167
|
-
set tDiffuse(v) {
|
|
168
|
-
this._tDiffuse.value = v;
|
|
169
|
-
}
|
|
170
|
-
get tDepth() {
|
|
171
|
-
return this._tDepth.value;
|
|
172
|
-
}
|
|
173
|
-
set tDepth(v) {
|
|
174
|
-
this._tDepth.value = v;
|
|
175
|
-
}
|
|
176
|
-
get distortionMap() {
|
|
177
|
-
return this._distortionMap.value;
|
|
178
|
-
}
|
|
179
|
-
set distortionMap(v) {
|
|
180
|
-
this._distortionMap.value = v;
|
|
181
|
-
}
|
|
182
|
-
get tDiffuseBlur() {
|
|
183
|
-
return this._tDiffuseBlur.value;
|
|
184
|
-
}
|
|
185
|
-
set tDiffuseBlur(v) {
|
|
186
|
-
this._tDiffuseBlur.value = v;
|
|
187
|
-
}
|
|
188
|
-
get textureMatrix() {
|
|
189
|
-
return this._textureMatrix.value;
|
|
190
|
-
}
|
|
191
|
-
set textureMatrix(v) {
|
|
192
|
-
this._textureMatrix.value = v;
|
|
193
|
-
}
|
|
194
|
-
get hasBlur() {
|
|
195
|
-
return this._hasBlur.value;
|
|
196
|
-
}
|
|
197
|
-
set hasBlur(v) {
|
|
198
|
-
this._hasBlur.value = v;
|
|
199
|
-
}
|
|
200
|
-
get mirror() {
|
|
201
|
-
return this._mirror.value;
|
|
202
|
-
}
|
|
203
|
-
set mirror(v) {
|
|
204
|
-
this._mirror.value = v;
|
|
205
|
-
}
|
|
206
|
-
get mixBlur() {
|
|
207
|
-
return this._mixBlur.value;
|
|
208
|
-
}
|
|
209
|
-
set mixBlur(v) {
|
|
210
|
-
this._mixBlur.value = v;
|
|
211
|
-
}
|
|
212
|
-
get mixStrength() {
|
|
213
|
-
return this._blurStrength.value;
|
|
214
|
-
}
|
|
215
|
-
set mixStrength(v) {
|
|
216
|
-
this._blurStrength.value = v;
|
|
217
|
-
}
|
|
218
|
-
get minDepthThreshold() {
|
|
219
|
-
return this._minDepthThreshold.value;
|
|
220
|
-
}
|
|
221
|
-
set minDepthThreshold(v) {
|
|
222
|
-
this._minDepthThreshold.value = v;
|
|
223
|
-
}
|
|
224
|
-
get maxDepthThreshold() {
|
|
225
|
-
return this._maxDepthThreshold.value;
|
|
226
|
-
}
|
|
227
|
-
set maxDepthThreshold(v) {
|
|
228
|
-
this._maxDepthThreshold.value = v;
|
|
229
|
-
}
|
|
230
|
-
get depthScale() {
|
|
231
|
-
return this._depthScale.value;
|
|
232
|
-
}
|
|
233
|
-
set depthScale(v) {
|
|
234
|
-
this._depthScale.value = v;
|
|
235
|
-
}
|
|
236
|
-
get depthToBlurRatioBias() {
|
|
237
|
-
return this._depthToBlurRatioBias.value;
|
|
238
|
-
}
|
|
239
|
-
set depthToBlurRatioBias(v) {
|
|
240
|
-
this._depthToBlurRatioBias.value = v;
|
|
241
|
-
}
|
|
242
|
-
get distortion() {
|
|
243
|
-
return this._distortion.value;
|
|
244
|
-
}
|
|
245
|
-
set distortion(v) {
|
|
246
|
-
this._distortion.value = v;
|
|
247
|
-
}
|
|
248
|
-
get mixContrast() {
|
|
249
|
-
return this._mixContrast.value;
|
|
250
|
-
}
|
|
251
|
-
set mixContrast(v) {
|
|
252
|
-
this._mixContrast.value = v;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
export { MeshReflectorMaterial };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three"),r=require("../core/shaderMaterial.cjs.js"),n=require("three-mesh-bvh"),i=require("../helpers/constants.cjs.js");function o(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 t=o(e);const a=r.shaderMaterial({envMap:null,bounces:3,ior:2.4,correctMips:!0,aberrationStrength:.01,fresnel:0,bvh:new n.MeshBVHUniformStruct,color:new t.Color("white"),opacity:1,resolution:new t.Vector2,viewMatrixInverse:new t.Matrix4,projectionMatrixInverse:new t.Matrix4},"\n uniform mat4 viewMatrixInverse;\n\n varying vec3 vWorldPosition;\n varying vec3 vNormal;\n varying mat4 vModelMatrixInverse;\n\n #include <color_pars_vertex>\n\n void main() {\n #include <color_vertex>\n\n vec4 transformedNormal = vec4(normal, 0.0);\n vec4 transformedPosition = vec4(position, 1.0);\n #ifdef USE_INSTANCING\n transformedNormal = instanceMatrix * transformedNormal;\n transformedPosition = instanceMatrix * transformedPosition;\n #endif\n\n #ifdef USE_INSTANCING\n vModelMatrixInverse = inverse(modelMatrix * instanceMatrix);\n #else\n vModelMatrixInverse = inverse(modelMatrix);\n #endif\n\n vWorldPosition = (modelMatrix * transformedPosition).xyz;\n vNormal = normalize((viewMatrixInverse * vec4(normalMatrix * transformedNormal.xyz, 0.0)).xyz);\n gl_Position = projectionMatrix * viewMatrix * modelMatrix * transformedPosition;\n }",`\n #define ENVMAP_TYPE_CUBE_UV\n precision highp isampler2D;\n precision highp usampler2D;\n varying vec3 vWorldPosition;\n varying vec3 vNormal;\n varying mat4 vModelMatrixInverse;\n\n #include <color_pars_fragment>\n\n #ifdef ENVMAP_TYPE_CUBEM\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n\n uniform float bounces;\n ${n.shaderStructs}\n ${n.shaderIntersectFunction}\n uniform BVH bvh;\n uniform float ior;\n uniform bool correctMips;\n uniform vec2 resolution;\n uniform float fresnel;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrixInverse;\n uniform mat4 viewMatrixInverse;\n uniform float aberrationStrength;\n uniform vec3 color;\n uniform float opacity;\n\n float fresnelFunc(vec3 viewDirection, vec3 worldNormal) {\n return pow( 1.0 + dot( viewDirection, worldNormal), 10.0 );\n }\n\n vec3 totalInternalReflection(vec3 ro, vec3 rd, vec3 normal, float ior, mat4 modelMatrixInverse) {\n vec3 rayOrigin = ro;\n vec3 rayDirection = rd;\n rayDirection = refract(rayDirection, normal, 1.0 / ior);\n rayOrigin = vWorldPosition + rayDirection * 0.001;\n rayOrigin = (modelMatrixInverse * vec4(rayOrigin, 1.0)).xyz;\n rayDirection = normalize((modelMatrixInverse * vec4(rayDirection, 0.0)).xyz);\n for(float i = 0.0; i < bounces; i++) {\n uvec4 faceIndices = uvec4( 0u );\n vec3 faceNormal = vec3( 0.0, 0.0, 1.0 );\n vec3 barycoord = vec3( 0.0 );\n float side = 1.0;\n float dist = 0.0;\n bvhIntersectFirstHit( bvh, rayOrigin, rayDirection, faceIndices, faceNormal, barycoord, side, dist );\n vec3 hitPos = rayOrigin + rayDirection * max(dist - 0.001, 0.0);\n vec3 tempDir = refract(rayDirection, faceNormal, ior);\n if (length(tempDir) != 0.0) {\n rayDirection = tempDir;\n break;\n }\n rayDirection = reflect(rayDirection, faceNormal);\n rayOrigin = hitPos + rayDirection * 0.01;\n }\n rayDirection = normalize((modelMatrix * vec4(rayDirection, 0.0)).xyz);\n return rayDirection;\n }\n\n #include <common>\n #include <cube_uv_reflection_fragment>\n\n #ifdef ENVMAP_TYPE_CUBEM\n vec4 textureGradient(samplerCube envMap, vec3 rayDirection, vec3 directionCamPerfect) {\n return textureGrad(envMap, rayDirection, dFdx(correctMips ? directionCamPerfect: rayDirection), dFdy(correctMips ? directionCamPerfect: rayDirection));\n }\n #else\n vec4 textureGradient(sampler2D envMap, vec3 rayDirection, vec3 directionCamPerfect) {\n vec2 uvv = equirectUv( rayDirection );\n vec2 smoothUv = equirectUv( directionCamPerfect );\n return textureGrad(envMap, uvv, dFdx(correctMips ? smoothUv : uvv), dFdy(correctMips ? smoothUv : uvv));\n }\n #endif\n\n void main() {\n vec2 uv = gl_FragCoord.xy / resolution;\n vec3 directionCamPerfect = (projectionMatrixInverse * vec4(uv * 2.0 - 1.0, 0.0, 1.0)).xyz;\n directionCamPerfect = (viewMatrixInverse * vec4(directionCamPerfect, 0.0)).xyz;\n directionCamPerfect = normalize(directionCamPerfect);\n vec3 normal = vNormal;\n vec3 rayOrigin = cameraPosition;\n vec3 rayDirection = normalize(vWorldPosition - cameraPosition);\n\n vec4 diffuseColor = vec4(color, opacity);\n #include <color_fragment>\n\n #ifdef CHROMATIC_ABERRATIONS\n vec3 rayDirectionG = totalInternalReflection(rayOrigin, rayDirection, normal, max(ior, 1.0), vModelMatrixInverse);\n #ifdef FAST_CHROMA\n vec3 rayDirectionR = normalize(rayDirectionG + 1.0 * vec3(aberrationStrength / 2.0));\n vec3 rayDirectionB = normalize(rayDirectionG - 1.0 * vec3(aberrationStrength / 2.0));\n #else\n vec3 rayDirectionR = totalInternalReflection(rayOrigin, rayDirection, normal, max(ior * (1.0 - aberrationStrength), 1.0), vModelMatrixInverse);\n vec3 rayDirectionB = totalInternalReflection(rayOrigin, rayDirection, normal, max(ior * (1.0 + aberrationStrength), 1.0), vModelMatrixInverse);\n #endif\n float finalColorR = textureGradient(envMap, rayDirectionR, directionCamPerfect).r;\n float finalColorG = textureGradient(envMap, rayDirectionG, directionCamPerfect).g;\n float finalColorB = textureGradient(envMap, rayDirectionB, directionCamPerfect).b;\n diffuseColor.rgb *= vec3(finalColorR, finalColorG, finalColorB);\n #else\n rayDirection = totalInternalReflection(rayOrigin, rayDirection, normal, max(ior, 1.0), vModelMatrixInverse);\n diffuseColor.rgb *= textureGradient(envMap, rayDirection, directionCamPerfect).rgb;\n #endif\n\n vec3 viewDirection = normalize(vWorldPosition - cameraPosition);\n float nFresnel = fresnelFunc(viewDirection, normal) * fresnel;\n gl_FragColor = vec4(mix(diffuseColor.rgb, vec3(1.0), nFresnel), diffuseColor.a);\n\n #include <tonemapping_fragment>\n #include <${i.version>=154?"colorspace_fragment":"encodings_fragment"}>\n }`);exports.MeshRefractionMaterial=a;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import { MeshBVHUniformStruct } from 'three-mesh-bvh';
|
|
3
|
-
export declare const MeshRefractionMaterial: import("@react-three/fiber").ConstructorRepresentation<THREE.ShaderMaterial & {
|
|
4
|
-
envMap: null;
|
|
5
|
-
bounces: number;
|
|
6
|
-
ior: number;
|
|
7
|
-
correctMips: true;
|
|
8
|
-
aberrationStrength: number;
|
|
9
|
-
fresnel: number;
|
|
10
|
-
bvh: MeshBVHUniformStruct;
|
|
11
|
-
color: THREE.Color;
|
|
12
|
-
opacity: number;
|
|
13
|
-
resolution: THREE.Vector2;
|
|
14
|
-
viewMatrixInverse: THREE.Matrix4;
|
|
15
|
-
projectionMatrixInverse: THREE.Matrix4;
|
|
16
|
-
}> & {
|
|
17
|
-
key: string;
|
|
18
|
-
};
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import { shaderMaterial } from '../core/shaderMaterial.js';
|
|
3
|
-
import { shaderStructs, shaderIntersectFunction, MeshBVHUniformStruct } from 'three-mesh-bvh';
|
|
4
|
-
import { version } from '../helpers/constants.js';
|
|
5
|
-
|
|
6
|
-
// Author: N8Programs
|
|
7
|
-
const MeshRefractionMaterial = /* @__PURE__ */shaderMaterial({
|
|
8
|
-
envMap: null,
|
|
9
|
-
bounces: 3,
|
|
10
|
-
ior: 2.4,
|
|
11
|
-
correctMips: true,
|
|
12
|
-
aberrationStrength: 0.01,
|
|
13
|
-
fresnel: 0,
|
|
14
|
-
bvh: /* @__PURE__ */new MeshBVHUniformStruct(),
|
|
15
|
-
color: /* @__PURE__ */new THREE.Color('white'),
|
|
16
|
-
opacity: 1,
|
|
17
|
-
resolution: /* @__PURE__ */new THREE.Vector2(),
|
|
18
|
-
viewMatrixInverse: /* @__PURE__ */new THREE.Matrix4(),
|
|
19
|
-
projectionMatrixInverse: /* @__PURE__ */new THREE.Matrix4()
|
|
20
|
-
}, /*glsl*/`
|
|
21
|
-
uniform mat4 viewMatrixInverse;
|
|
22
|
-
|
|
23
|
-
varying vec3 vWorldPosition;
|
|
24
|
-
varying vec3 vNormal;
|
|
25
|
-
varying mat4 vModelMatrixInverse;
|
|
26
|
-
|
|
27
|
-
#include <color_pars_vertex>
|
|
28
|
-
|
|
29
|
-
void main() {
|
|
30
|
-
#include <color_vertex>
|
|
31
|
-
|
|
32
|
-
vec4 transformedNormal = vec4(normal, 0.0);
|
|
33
|
-
vec4 transformedPosition = vec4(position, 1.0);
|
|
34
|
-
#ifdef USE_INSTANCING
|
|
35
|
-
transformedNormal = instanceMatrix * transformedNormal;
|
|
36
|
-
transformedPosition = instanceMatrix * transformedPosition;
|
|
37
|
-
#endif
|
|
38
|
-
|
|
39
|
-
#ifdef USE_INSTANCING
|
|
40
|
-
vModelMatrixInverse = inverse(modelMatrix * instanceMatrix);
|
|
41
|
-
#else
|
|
42
|
-
vModelMatrixInverse = inverse(modelMatrix);
|
|
43
|
-
#endif
|
|
44
|
-
|
|
45
|
-
vWorldPosition = (modelMatrix * transformedPosition).xyz;
|
|
46
|
-
vNormal = normalize((viewMatrixInverse * vec4(normalMatrix * transformedNormal.xyz, 0.0)).xyz);
|
|
47
|
-
gl_Position = projectionMatrix * viewMatrix * modelMatrix * transformedPosition;
|
|
48
|
-
}`, /*glsl*/`
|
|
49
|
-
#define ENVMAP_TYPE_CUBE_UV
|
|
50
|
-
precision highp isampler2D;
|
|
51
|
-
precision highp usampler2D;
|
|
52
|
-
varying vec3 vWorldPosition;
|
|
53
|
-
varying vec3 vNormal;
|
|
54
|
-
varying mat4 vModelMatrixInverse;
|
|
55
|
-
|
|
56
|
-
#include <color_pars_fragment>
|
|
57
|
-
|
|
58
|
-
#ifdef ENVMAP_TYPE_CUBEM
|
|
59
|
-
uniform samplerCube envMap;
|
|
60
|
-
#else
|
|
61
|
-
uniform sampler2D envMap;
|
|
62
|
-
#endif
|
|
63
|
-
|
|
64
|
-
uniform float bounces;
|
|
65
|
-
${shaderStructs}
|
|
66
|
-
${shaderIntersectFunction}
|
|
67
|
-
uniform BVH bvh;
|
|
68
|
-
uniform float ior;
|
|
69
|
-
uniform bool correctMips;
|
|
70
|
-
uniform vec2 resolution;
|
|
71
|
-
uniform float fresnel;
|
|
72
|
-
uniform mat4 modelMatrix;
|
|
73
|
-
uniform mat4 projectionMatrixInverse;
|
|
74
|
-
uniform mat4 viewMatrixInverse;
|
|
75
|
-
uniform float aberrationStrength;
|
|
76
|
-
uniform vec3 color;
|
|
77
|
-
uniform float opacity;
|
|
78
|
-
|
|
79
|
-
float fresnelFunc(vec3 viewDirection, vec3 worldNormal) {
|
|
80
|
-
return pow( 1.0 + dot( viewDirection, worldNormal), 10.0 );
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
vec3 totalInternalReflection(vec3 ro, vec3 rd, vec3 normal, float ior, mat4 modelMatrixInverse) {
|
|
84
|
-
vec3 rayOrigin = ro;
|
|
85
|
-
vec3 rayDirection = rd;
|
|
86
|
-
rayDirection = refract(rayDirection, normal, 1.0 / ior);
|
|
87
|
-
rayOrigin = vWorldPosition + rayDirection * 0.001;
|
|
88
|
-
rayOrigin = (modelMatrixInverse * vec4(rayOrigin, 1.0)).xyz;
|
|
89
|
-
rayDirection = normalize((modelMatrixInverse * vec4(rayDirection, 0.0)).xyz);
|
|
90
|
-
for(float i = 0.0; i < bounces; i++) {
|
|
91
|
-
uvec4 faceIndices = uvec4( 0u );
|
|
92
|
-
vec3 faceNormal = vec3( 0.0, 0.0, 1.0 );
|
|
93
|
-
vec3 barycoord = vec3( 0.0 );
|
|
94
|
-
float side = 1.0;
|
|
95
|
-
float dist = 0.0;
|
|
96
|
-
bvhIntersectFirstHit( bvh, rayOrigin, rayDirection, faceIndices, faceNormal, barycoord, side, dist );
|
|
97
|
-
vec3 hitPos = rayOrigin + rayDirection * max(dist - 0.001, 0.0);
|
|
98
|
-
vec3 tempDir = refract(rayDirection, faceNormal, ior);
|
|
99
|
-
if (length(tempDir) != 0.0) {
|
|
100
|
-
rayDirection = tempDir;
|
|
101
|
-
break;
|
|
102
|
-
}
|
|
103
|
-
rayDirection = reflect(rayDirection, faceNormal);
|
|
104
|
-
rayOrigin = hitPos + rayDirection * 0.01;
|
|
105
|
-
}
|
|
106
|
-
rayDirection = normalize((modelMatrix * vec4(rayDirection, 0.0)).xyz);
|
|
107
|
-
return rayDirection;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
#include <common>
|
|
111
|
-
#include <cube_uv_reflection_fragment>
|
|
112
|
-
|
|
113
|
-
#ifdef ENVMAP_TYPE_CUBEM
|
|
114
|
-
vec4 textureGradient(samplerCube envMap, vec3 rayDirection, vec3 directionCamPerfect) {
|
|
115
|
-
return textureGrad(envMap, rayDirection, dFdx(correctMips ? directionCamPerfect: rayDirection), dFdy(correctMips ? directionCamPerfect: rayDirection));
|
|
116
|
-
}
|
|
117
|
-
#else
|
|
118
|
-
vec4 textureGradient(sampler2D envMap, vec3 rayDirection, vec3 directionCamPerfect) {
|
|
119
|
-
vec2 uvv = equirectUv( rayDirection );
|
|
120
|
-
vec2 smoothUv = equirectUv( directionCamPerfect );
|
|
121
|
-
return textureGrad(envMap, uvv, dFdx(correctMips ? smoothUv : uvv), dFdy(correctMips ? smoothUv : uvv));
|
|
122
|
-
}
|
|
123
|
-
#endif
|
|
124
|
-
|
|
125
|
-
void main() {
|
|
126
|
-
vec2 uv = gl_FragCoord.xy / resolution;
|
|
127
|
-
vec3 directionCamPerfect = (projectionMatrixInverse * vec4(uv * 2.0 - 1.0, 0.0, 1.0)).xyz;
|
|
128
|
-
directionCamPerfect = (viewMatrixInverse * vec4(directionCamPerfect, 0.0)).xyz;
|
|
129
|
-
directionCamPerfect = normalize(directionCamPerfect);
|
|
130
|
-
vec3 normal = vNormal;
|
|
131
|
-
vec3 rayOrigin = cameraPosition;
|
|
132
|
-
vec3 rayDirection = normalize(vWorldPosition - cameraPosition);
|
|
133
|
-
|
|
134
|
-
vec4 diffuseColor = vec4(color, opacity);
|
|
135
|
-
#include <color_fragment>
|
|
136
|
-
|
|
137
|
-
#ifdef CHROMATIC_ABERRATIONS
|
|
138
|
-
vec3 rayDirectionG = totalInternalReflection(rayOrigin, rayDirection, normal, max(ior, 1.0), vModelMatrixInverse);
|
|
139
|
-
#ifdef FAST_CHROMA
|
|
140
|
-
vec3 rayDirectionR = normalize(rayDirectionG + 1.0 * vec3(aberrationStrength / 2.0));
|
|
141
|
-
vec3 rayDirectionB = normalize(rayDirectionG - 1.0 * vec3(aberrationStrength / 2.0));
|
|
142
|
-
#else
|
|
143
|
-
vec3 rayDirectionR = totalInternalReflection(rayOrigin, rayDirection, normal, max(ior * (1.0 - aberrationStrength), 1.0), vModelMatrixInverse);
|
|
144
|
-
vec3 rayDirectionB = totalInternalReflection(rayOrigin, rayDirection, normal, max(ior * (1.0 + aberrationStrength), 1.0), vModelMatrixInverse);
|
|
145
|
-
#endif
|
|
146
|
-
float finalColorR = textureGradient(envMap, rayDirectionR, directionCamPerfect).r;
|
|
147
|
-
float finalColorG = textureGradient(envMap, rayDirectionG, directionCamPerfect).g;
|
|
148
|
-
float finalColorB = textureGradient(envMap, rayDirectionB, directionCamPerfect).b;
|
|
149
|
-
diffuseColor.rgb *= vec3(finalColorR, finalColorG, finalColorB);
|
|
150
|
-
#else
|
|
151
|
-
rayDirection = totalInternalReflection(rayOrigin, rayDirection, normal, max(ior, 1.0), vModelMatrixInverse);
|
|
152
|
-
diffuseColor.rgb *= textureGradient(envMap, rayDirection, directionCamPerfect).rgb;
|
|
153
|
-
#endif
|
|
154
|
-
|
|
155
|
-
vec3 viewDirection = normalize(vWorldPosition - cameraPosition);
|
|
156
|
-
float nFresnel = fresnelFunc(viewDirection, normal) * fresnel;
|
|
157
|
-
gl_FragColor = vec4(mix(diffuseColor.rgb, vec3(1.0), nFresnel), diffuseColor.a);
|
|
158
|
-
|
|
159
|
-
#include <tonemapping_fragment>
|
|
160
|
-
#include <${version >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>
|
|
161
|
-
}`);
|
|
162
|
-
|
|
163
|
-
export { MeshRefractionMaterial };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three"),n=require("../helpers/constants.cjs.js");function t(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:function(){return e[t]}})}})),n.default=e,Object.freeze(n)}var o=t(e);class r extends o.ShaderMaterial{constructor(){super({uniforms:{depth:{value:null},opacity:{value:1},attenuation:{value:2.5},anglePower:{value:12},spotPosition:{value:new o.Vector3(0,0,0)},lightColor:{value:new o.Color("white")},cameraNear:{value:0},cameraFar:{value:1},resolution:{value:new o.Vector2(0,0)}},transparent:!0,depthWrite:!1,vertexShader:"\n varying vec3 vNormal;\n varying float vViewZ;\n varying float vIntensity;\n uniform vec3 spotPosition;\n uniform float attenuation;\n\n #include <common>\n #include <logdepthbuf_pars_vertex>\n\n void main() {\n // compute intensity\n vNormal = normalize(normalMatrix * normal);\n vec4 worldPosition = modelMatrix * vec4(position, 1);\n vec4 viewPosition = viewMatrix * worldPosition;\n vViewZ = viewPosition.z;\n\n vIntensity = 1.0 - saturate(distance(worldPosition.xyz, spotPosition) / attenuation);\n\n gl_Position = projectionMatrix * viewPosition;\n\n #include <logdepthbuf_vertex>\n }\n ",fragmentShader:`\n varying vec3 vNormal;\n varying float vViewZ;\n varying float vIntensity;\n\n uniform vec3 lightColor;\n uniform float anglePower;\n uniform sampler2D depth;\n uniform vec2 resolution;\n uniform float cameraNear;\n uniform float cameraFar;\n uniform float opacity;\n\n #include <packing>\n #include <logdepthbuf_pars_fragment>\n\n float readDepth(sampler2D depthSampler, vec2 uv) {\n float fragCoordZ = texture(depthSampler, uv).r;\n\n // https://github.com/mrdoob/three.js/issues/23072\n #ifdef USE_LOGDEPTHBUF\n float viewZ = 1.0 - exp2(fragCoordZ * log(cameraFar + 1.0) / log(2.0));\n #else\n float viewZ = perspectiveDepthToViewZ(fragCoordZ, cameraNear, cameraFar);\n #endif\n\n return viewZ;\n }\n\n void main() {\n #include <logdepthbuf_fragment>\n\n vec3 normal = vec3(vNormal.x, vNormal.y, abs(vNormal.z));\n float angleIntensity = pow(dot(normal, vec3(0, 0, 1)), anglePower);\n float intensity = vIntensity * angleIntensity;\n\n // fades when z is close to sampled depth, meaning the cone is intersecting existing geometry\n bool isSoft = resolution[0] > 0.0 && resolution[1] > 0.0;\n if (isSoft) {\n vec2 uv = gl_FragCoord.xy / resolution;\n intensity *= smoothstep(0.0, 1.0, vViewZ - readDepth(depth, uv));\n }\n\n gl_FragColor = vec4(lightColor, intensity * opacity);\n\n #include <tonemapping_fragment>\n #include <${n.version>=154?"colorspace_fragment":"encodings_fragment"}>\n }\n `})}}exports.SpotLightMaterial=r;
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import { version } from '../helpers/constants.js';
|
|
3
|
-
|
|
4
|
-
class SpotLightMaterial extends THREE.ShaderMaterial {
|
|
5
|
-
constructor() {
|
|
6
|
-
super({
|
|
7
|
-
uniforms: {
|
|
8
|
-
depth: {
|
|
9
|
-
value: null
|
|
10
|
-
},
|
|
11
|
-
opacity: {
|
|
12
|
-
value: 1
|
|
13
|
-
},
|
|
14
|
-
attenuation: {
|
|
15
|
-
value: 2.5
|
|
16
|
-
},
|
|
17
|
-
anglePower: {
|
|
18
|
-
value: 12
|
|
19
|
-
},
|
|
20
|
-
spotPosition: {
|
|
21
|
-
value: new THREE.Vector3(0, 0, 0)
|
|
22
|
-
},
|
|
23
|
-
lightColor: {
|
|
24
|
-
value: new THREE.Color('white')
|
|
25
|
-
},
|
|
26
|
-
cameraNear: {
|
|
27
|
-
value: 0
|
|
28
|
-
},
|
|
29
|
-
cameraFar: {
|
|
30
|
-
value: 1
|
|
31
|
-
},
|
|
32
|
-
resolution: {
|
|
33
|
-
value: new THREE.Vector2(0, 0)
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
transparent: true,
|
|
37
|
-
depthWrite: false,
|
|
38
|
-
vertexShader: /* glsl */`
|
|
39
|
-
varying vec3 vNormal;
|
|
40
|
-
varying float vViewZ;
|
|
41
|
-
varying float vIntensity;
|
|
42
|
-
uniform vec3 spotPosition;
|
|
43
|
-
uniform float attenuation;
|
|
44
|
-
|
|
45
|
-
#include <common>
|
|
46
|
-
#include <logdepthbuf_pars_vertex>
|
|
47
|
-
|
|
48
|
-
void main() {
|
|
49
|
-
// compute intensity
|
|
50
|
-
vNormal = normalize(normalMatrix * normal);
|
|
51
|
-
vec4 worldPosition = modelMatrix * vec4(position, 1);
|
|
52
|
-
vec4 viewPosition = viewMatrix * worldPosition;
|
|
53
|
-
vViewZ = viewPosition.z;
|
|
54
|
-
|
|
55
|
-
vIntensity = 1.0 - saturate(distance(worldPosition.xyz, spotPosition) / attenuation);
|
|
56
|
-
|
|
57
|
-
gl_Position = projectionMatrix * viewPosition;
|
|
58
|
-
|
|
59
|
-
#include <logdepthbuf_vertex>
|
|
60
|
-
}
|
|
61
|
-
`,
|
|
62
|
-
fragmentShader: /* glsl */`
|
|
63
|
-
varying vec3 vNormal;
|
|
64
|
-
varying float vViewZ;
|
|
65
|
-
varying float vIntensity;
|
|
66
|
-
|
|
67
|
-
uniform vec3 lightColor;
|
|
68
|
-
uniform float anglePower;
|
|
69
|
-
uniform sampler2D depth;
|
|
70
|
-
uniform vec2 resolution;
|
|
71
|
-
uniform float cameraNear;
|
|
72
|
-
uniform float cameraFar;
|
|
73
|
-
uniform float opacity;
|
|
74
|
-
|
|
75
|
-
#include <packing>
|
|
76
|
-
#include <logdepthbuf_pars_fragment>
|
|
77
|
-
|
|
78
|
-
float readDepth(sampler2D depthSampler, vec2 uv) {
|
|
79
|
-
float fragCoordZ = texture(depthSampler, uv).r;
|
|
80
|
-
|
|
81
|
-
// https://github.com/mrdoob/three.js/issues/23072
|
|
82
|
-
#ifdef USE_LOGDEPTHBUF
|
|
83
|
-
float viewZ = 1.0 - exp2(fragCoordZ * log(cameraFar + 1.0) / log(2.0));
|
|
84
|
-
#else
|
|
85
|
-
float viewZ = perspectiveDepthToViewZ(fragCoordZ, cameraNear, cameraFar);
|
|
86
|
-
#endif
|
|
87
|
-
|
|
88
|
-
return viewZ;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
void main() {
|
|
92
|
-
#include <logdepthbuf_fragment>
|
|
93
|
-
|
|
94
|
-
vec3 normal = vec3(vNormal.x, vNormal.y, abs(vNormal.z));
|
|
95
|
-
float angleIntensity = pow(dot(normal, vec3(0, 0, 1)), anglePower);
|
|
96
|
-
float intensity = vIntensity * angleIntensity;
|
|
97
|
-
|
|
98
|
-
// fades when z is close to sampled depth, meaning the cone is intersecting existing geometry
|
|
99
|
-
bool isSoft = resolution[0] > 0.0 && resolution[1] > 0.0;
|
|
100
|
-
if (isSoft) {
|
|
101
|
-
vec2 uv = gl_FragCoord.xy / resolution;
|
|
102
|
-
intensity *= smoothstep(0.0, 1.0, vViewZ - readDepth(depth, uv));
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
gl_FragColor = vec4(lightColor, intensity * opacity);
|
|
106
|
-
|
|
107
|
-
#include <tonemapping_fragment>
|
|
108
|
-
#include <${version >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>
|
|
109
|
-
}
|
|
110
|
-
`
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export { SpotLightMaterial };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("three"),e=require("react"),n=require("../core/shaderMaterial.cjs.js");function a(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var a=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,a.get?a:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var r=a(t),o=a(e);const i={uniforms:{strokeOpacity:1,fillOpacity:.25,fillMix:0,thickness:.05,colorBackfaces:!1,dashInvert:!0,dash:!1,dashRepeats:4,dashLength:.5,squeeze:!1,squeezeMin:.2,squeezeMax:1,stroke:new r.Color("#ff0000"),backfaceStroke:new r.Color("#0000ff"),fill:new r.Color("#00ff00")},vertex:"\n\t attribute vec3 barycentric;\n\t\n\t\tvarying vec3 v_edges_Barycentric;\n\t\tvarying vec3 v_edges_Position;\n\n\t\tvoid initWireframe() {\n\t\t\tv_edges_Barycentric = barycentric;\n\t\t\tv_edges_Position = position.xyz;\n\t\t}\n\t ",fragment:"\n\t\t#ifndef PI\n\t \t#define PI 3.1415926535897932384626433832795\n\t\t#endif\n \n\t varying vec3 v_edges_Barycentric;\n\t varying vec3 v_edges_Position;\n \n\t uniform float strokeOpacity;\n\t uniform float fillOpacity;\n\t uniform float fillMix;\n\t uniform float thickness;\n\t uniform bool colorBackfaces;\n \n\t // Dash\n\t uniform bool dashInvert;\n\t uniform bool dash;\n\t uniform bool dashOnly;\n\t uniform float dashRepeats;\n\t uniform float dashLength;\n \n\t // Squeeze\n\t uniform bool squeeze;\n\t uniform float squeezeMin;\n\t uniform float squeezeMax;\n \n\t // Colors\n\t uniform vec3 stroke;\n\t uniform vec3 backfaceStroke;\n\t uniform vec3 fill;\n \n\t // This is like\n\t float wireframe_aastep(float threshold, float dist) {\n\t\t float afwidth = fwidth(dist) * 0.5;\n\t\t return smoothstep(threshold - afwidth, threshold + afwidth, dist);\n\t }\n \n\t float wireframe_map(float value, float min1, float max1, float min2, float max2) {\n\t\t return min2 + (value - min1) * (max2 - min2) / (max1 - min1);\n\t }\n \n\t float getWireframe() {\n\t\t\tvec3 barycentric = v_edges_Barycentric;\n\t\t\n\t\t\t// Distance from center of each triangle to its edges.\n\t\t\tfloat d = min(min(barycentric.x, barycentric.y), barycentric.z);\n\n\t\t\t// for dashed rendering, we can use this to get the 0 .. 1 value of the line length\n\t\t\tfloat positionAlong = max(barycentric.x, barycentric.y);\n\t\t\tif (barycentric.y < barycentric.x && barycentric.y < barycentric.z) {\n\t\t\t\tpositionAlong = 1.0 - positionAlong;\n\t\t\t}\n\n\t\t\t// the thickness of the stroke\n\t\t\tfloat computedThickness = wireframe_map(thickness, 0.0, 1.0, 0.0, 0.34);\n\n\t\t\t// if we want to shrink the thickness toward the center of the line segment\n\t\t\tif (squeeze) {\n\t\t\t\tcomputedThickness *= mix(squeezeMin, squeezeMax, (1.0 - sin(positionAlong * PI)));\n\t\t\t}\n\n\t\t\t// Create dash pattern\n\t\t\tif (dash) {\n\t\t\t\t// here we offset the stroke position depending on whether it\n\t\t\t\t// should overlap or not\n\t\t\t\tfloat offset = 1.0 / dashRepeats * dashLength / 2.0;\n\t\t\t\tif (!dashInvert) {\n\t\t\t\t\toffset += 1.0 / dashRepeats / 2.0;\n\t\t\t\t}\n\n\t\t\t\t// if we should animate the dash or not\n\t\t\t\t// if (dashAnimate) {\n\t\t\t\t// \toffset += time * 0.22;\n\t\t\t\t// }\n\n\t\t\t\t// create the repeating dash pattern\n\t\t\t\tfloat pattern = fract((positionAlong + offset) * dashRepeats);\n\t\t\t\tcomputedThickness *= 1.0 - wireframe_aastep(dashLength, pattern);\n\t\t\t}\n\n\t\t\t// compute the anti-aliased stroke edge \n\t\t\tfloat edge = 1.0 - wireframe_aastep(computedThickness, d);\n\n\t\t\treturn edge;\n\t }\n\t "},l=n.shaderMaterial(i.uniforms,i.vertex+"\n \tvoid main() {\n\t\tinitWireframe();\n\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n\t}\n ",i.fragment+"\n void main () {\n\t\t// Compute color\n\n\t\tfloat edge = getWireframe();\n\t\tvec4 colorStroke = vec4(stroke, edge);\n\n\t\t#ifdef FLIP_SIDED\n\t\t\tcolorStroke.rgb = backfaceStroke;\n\t\t#endif\n \n\t\tvec4 colorFill = vec4(fill, fillOpacity);\n\t\tvec4 outColor = mix(colorFill, colorStroke, edge * strokeOpacity);\n\n\t\tgl_FragColor = outColor;\n\t}\n ");exports.WireframeMaterial=l,exports.WireframeMaterialShaders=i,exports.setWireframeOverride=function(t,e){t.onBeforeCompile=t=>{t.uniforms={...t.uniforms,...e},t.vertexShader=t.vertexShader.replace("void main() {",`\n\t\t ${i.vertex}\n\t\t void main() {\n\t\t\tinitWireframe();\n\t\t`),t.fragmentShader=t.fragmentShader.replace("void main() {",`\n\t\t ${i.fragment}\n\t\t void main() {\n\t\t`),t.fragmentShader=t.fragmentShader.replace("#include <color_fragment>","\n\t\t #include <color_fragment>\n\t\t\t float edge = getWireframe();\n\t\t vec4 colorStroke = vec4(stroke, edge);\n\t\t #ifdef FLIP_SIDED\n\t\t\tcolorStroke.rgb = backfaceStroke;\n\t\t #endif\n\t\t vec4 colorFill = vec4(mix(diffuseColor.rgb, fill, fillMix), mix(diffuseColor.a, fillOpacity, fillMix));\n\t\t vec4 outColor = mix(colorFill, colorStroke, edge * strokeOpacity);\n\n\t\t diffuseColor.rgb = outColor.rgb;\n\t\t diffuseColor.a *= outColor.a;\n\t\t")},t.side=r.DoubleSide,t.transparent=!0},exports.useWireframeUniforms=function(t,e){o.useEffect((()=>{var n;t.fillOpacity.value=null!==(n=e.fillOpacity)&&void 0!==n?n:t.fillOpacity.value}),[e.fillOpacity]),o.useEffect((()=>{var n;t.fillMix.value=null!==(n=e.fillMix)&&void 0!==n?n:t.fillMix.value}),[e.fillMix]),o.useEffect((()=>{var n;t.strokeOpacity.value=null!==(n=e.strokeOpacity)&&void 0!==n?n:t.strokeOpacity.value}),[e.strokeOpacity]),o.useEffect((()=>{var n;t.thickness.value=null!==(n=e.thickness)&&void 0!==n?n:t.thickness.value}),[e.thickness]),o.useEffect((()=>{t.colorBackfaces.value=!!e.colorBackfaces}),[e.colorBackfaces]),o.useEffect((()=>{t.dash.value=!!e.dash}),[e.dash]),o.useEffect((()=>{t.dashInvert.value=!!e.dashInvert}),[e.dashInvert]),o.useEffect((()=>{var n;t.dashRepeats.value=null!==(n=e.dashRepeats)&&void 0!==n?n:t.dashRepeats.value}),[e.dashRepeats]),o.useEffect((()=>{var n;t.dashLength.value=null!==(n=e.dashLength)&&void 0!==n?n:t.dashLength.value}),[e.dashLength]),o.useEffect((()=>{t.squeeze.value=!!e.squeeze}),[e.squeeze]),o.useEffect((()=>{var n;t.squeezeMin.value=null!==(n=e.squeezeMin)&&void 0!==n?n:t.squeezeMin.value}),[e.squeezeMin]),o.useEffect((()=>{var n;t.squeezeMax.value=null!==(n=e.squeezeMax)&&void 0!==n?n:t.squeezeMax.value}),[e.squeezeMax]),o.useEffect((()=>{t.stroke.value=e.stroke?new r.Color(e.stroke):t.stroke.value}),[e.stroke]),o.useEffect((()=>{t.fill.value=e.fill?new r.Color(e.fill):t.fill.value}),[e.fill]),o.useEffect((()=>{t.backfaceStroke.value=e.backfaceStroke?new r.Color(e.backfaceStroke):t.backfaceStroke.value}),[e.backfaceStroke])};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
export interface WireframeMaterialProps extends THREE.ShaderMaterialParameters {
|
|
3
|
-
fillOpacity?: number;
|
|
4
|
-
fillMix?: number;
|
|
5
|
-
strokeOpacity?: number;
|
|
6
|
-
thickness?: number;
|
|
7
|
-
colorBackfaces?: boolean;
|
|
8
|
-
dashInvert?: boolean;
|
|
9
|
-
dash?: boolean;
|
|
10
|
-
dashRepeats?: number;
|
|
11
|
-
dashLength?: number;
|
|
12
|
-
squeeze?: boolean;
|
|
13
|
-
squeezeMin?: number;
|
|
14
|
-
squeezeMax?: number;
|
|
15
|
-
stroke?: THREE.ColorRepresentation;
|
|
16
|
-
backfaceStroke?: THREE.ColorRepresentation;
|
|
17
|
-
fill?: THREE.ColorRepresentation;
|
|
18
|
-
}
|
|
19
|
-
export declare const WireframeMaterialShaders: {
|
|
20
|
-
uniforms: {
|
|
21
|
-
strokeOpacity: number;
|
|
22
|
-
fillOpacity: number;
|
|
23
|
-
fillMix: number;
|
|
24
|
-
thickness: number;
|
|
25
|
-
colorBackfaces: boolean;
|
|
26
|
-
dashInvert: boolean;
|
|
27
|
-
dash: boolean;
|
|
28
|
-
dashRepeats: number;
|
|
29
|
-
dashLength: number;
|
|
30
|
-
squeeze: boolean;
|
|
31
|
-
squeezeMin: number;
|
|
32
|
-
squeezeMax: number;
|
|
33
|
-
stroke: THREE.Color;
|
|
34
|
-
backfaceStroke: THREE.Color;
|
|
35
|
-
fill: THREE.Color;
|
|
36
|
-
};
|
|
37
|
-
vertex: string;
|
|
38
|
-
fragment: string;
|
|
39
|
-
};
|
|
40
|
-
export declare const WireframeMaterial: import("@react-three/fiber").ConstructorRepresentation<THREE.ShaderMaterial & {
|
|
41
|
-
strokeOpacity: number;
|
|
42
|
-
fillOpacity: number;
|
|
43
|
-
fillMix: number;
|
|
44
|
-
thickness: number;
|
|
45
|
-
colorBackfaces: boolean;
|
|
46
|
-
dashInvert: boolean;
|
|
47
|
-
dash: boolean;
|
|
48
|
-
dashRepeats: number;
|
|
49
|
-
dashLength: number;
|
|
50
|
-
squeeze: boolean;
|
|
51
|
-
squeezeMin: number;
|
|
52
|
-
squeezeMax: number;
|
|
53
|
-
stroke: THREE.Color;
|
|
54
|
-
backfaceStroke: THREE.Color;
|
|
55
|
-
fill: THREE.Color;
|
|
56
|
-
}> & {
|
|
57
|
-
key: string;
|
|
58
|
-
};
|
|
59
|
-
export declare function setWireframeOverride(material: THREE.Material, uniforms: {
|
|
60
|
-
[key: string]: THREE.IUniform<any>;
|
|
61
|
-
}): void;
|
|
62
|
-
export declare function useWireframeUniforms(uniforms: {
|
|
63
|
-
[key: string]: THREE.IUniform<any>;
|
|
64
|
-
}, props: WireframeMaterialProps): void;
|