@ohos-ports/react-three-drei 10.7.7-beta.0
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/LICENSE +21 -0
- package/README.md +852 -0
- package/core/AccumulativeShadows.cjs.js +1 -0
- package/core/AccumulativeShadows.d.ts +59 -0
- package/core/AccumulativeShadows.js +310 -0
- package/core/AdaptiveDpr.cjs.js +1 -0
- package/core/AdaptiveDpr.d.ts +3 -0
- package/core/AdaptiveDpr.js +28 -0
- package/core/AdaptiveEvents.cjs.js +1 -0
- package/core/AdaptiveEvents.d.ts +1 -0
- package/core/AdaptiveEvents.js +20 -0
- package/core/ArcballControls.cjs.js +1 -0
- package/core/ArcballControls.d.ts +15 -0
- package/core/ArcballControls.js +67 -0
- package/core/AsciiRenderer.cjs.js +1 -0
- package/core/AsciiRenderer.d.ts +11 -0
- package/core/AsciiRenderer.js +66 -0
- package/core/BBAnchor.cjs.js +1 -0
- package/core/BBAnchor.d.ts +7 -0
- package/core/BBAnchor.js +37 -0
- package/core/Backdrop.cjs.js +1 -0
- package/core/Backdrop.d.ts +15 -0
- package/core/Backdrop.js +33 -0
- package/core/BakeShadows.cjs.js +1 -0
- package/core/BakeShadows.d.ts +1 -0
- package/core/BakeShadows.js +16 -0
- package/core/Billboard.cjs.js +1 -0
- package/core/Billboard.d.ts +10 -0
- package/core/Billboard.js +53 -0
- package/core/Bounds.cjs.js +1 -0
- package/core/Bounds.d.ts +36 -0
- package/core/Bounds.js +254 -0
- package/core/Bvh.cjs.js +1 -0
- package/core/Bvh.d.ts +19 -0
- package/core/Bvh.js +92 -0
- package/core/CameraControls.cjs.js +1 -0
- package/core/CameraControls.d.ts +48 -0
- package/core/CameraControls.js +151 -0
- package/core/CameraShake.cjs.js +1 -0
- package/core/CameraShake.d.ts +17 -0
- package/core/CameraShake.js +57 -0
- package/core/CatmullRomLine.cjs.js +1 -0
- package/core/CatmullRomLine.d.ts +10 -0
- package/core/CatmullRomLine.js +42 -0
- package/core/Caustics.cjs.js +1 -0
- package/core/Caustics.d.ts +32 -0
- package/core/Caustics.js +388 -0
- package/core/Center.cjs.js +1 -0
- package/core/Center.d.ts +33 -0
- package/core/Center.js +67 -0
- package/core/Clone.cjs.js +1 -0
- package/core/Clone.d.ts +15 -0
- package/core/Clone.js +100 -0
- package/core/Cloud.cjs.js +1 -0
- package/core/Cloud.d.ts +97 -0
- package/core/Cloud.js +231 -0
- package/core/ComputedAttribute.cjs.js +1 -0
- package/core/ComputedAttribute.d.ts +8 -0
- package/core/ComputedAttribute.js +33 -0
- package/core/ContactShadows.cjs.js +1 -0
- package/core/ContactShadows.d.ts +18 -0
- package/core/ContactShadows.js +114 -0
- package/core/CubeCamera.cjs.js +1 -0
- package/core/CubeCamera.d.ts +21 -0
- package/core/CubeCamera.js +86 -0
- package/core/CubeTexture.cjs.js +1 -0
- package/core/CubeTexture.d.ts +14 -0
- package/core/CubeTexture.js +25 -0
- package/core/CubicBezierLine.cjs.js +1 -0
- package/core/CubicBezierLine.d.ts +12 -0
- package/core/CubicBezierLine.js +28 -0
- package/core/CurveModifier.cjs.js +1 -0
- package/core/CurveModifier.d.ts +11 -0
- package/core/CurveModifier.js +27 -0
- package/core/Decal.cjs.js +1 -0
- package/core/Decal.d.ts +16 -0
- package/core/Decal.js +128 -0
- package/core/Detailed.cjs.js +1 -0
- package/core/Detailed.d.ts +10 -0
- package/core/Detailed.js +33 -0
- package/core/DetectGPU.cjs.js +1 -0
- package/core/DetectGPU.d.ts +7 -0
- package/core/DetectGPU.js +14 -0
- package/core/DeviceOrientationControls.cjs.js +1 -0
- package/core/DeviceOrientationControls.d.ts +10 -0
- package/core/DeviceOrientationControls.js +51 -0
- package/core/Edges.cjs.js +1 -0
- package/core/Edges.d.ts +13 -0
- package/core/Edges.js +38 -0
- package/core/Effects.cjs.js +1 -0
- package/core/Effects.d.ts +25 -0
- package/core/Effects.js +91 -0
- package/core/Environment.cjs.js +1 -0
- package/core/Environment.d.ts +37 -0
- package/core/Environment.js +189 -0
- package/core/Example.cjs.js +1 -0
- package/core/Example.d.ts +13 -0
- package/core/Example.js +46 -0
- package/core/Fbo.cjs.js +1 -0
- package/core/Fbo.d.ts +22 -0
- package/core/Fbo.js +63 -0
- package/core/Fbx.cjs.js +1 -0
- package/core/Fbx.d.ts +11 -0
- package/core/Fbx.js +23 -0
- package/core/FirstPersonControls.cjs.js +1 -0
- package/core/FirstPersonControls.d.ts +8 -0
- package/core/FirstPersonControls.js +38 -0
- package/core/Fisheye.cjs.js +1 -0
- package/core/Fisheye.d.ts +10 -0
- package/core/Fisheye.js +95 -0
- package/core/Float.cjs.js +1 -0
- package/core/Float.d.ts +14 -0
- package/core/Float.js +37 -0
- package/core/FlyControls.cjs.js +1 -0
- package/core/FlyControls.d.ts +10 -0
- package/core/FlyControls.js +55 -0
- package/core/GizmoHelper.cjs.js +1 -0
- package/core/GizmoHelper.d.ts +16 -0
- package/core/GizmoHelper.js +116 -0
- package/core/GizmoViewcube.cjs.js +1 -0
- package/core/GizmoViewcube.d.ts +14 -0
- package/core/GizmoViewcube.js +133 -0
- package/core/GizmoViewport.cjs.js +1 -0
- package/core/GizmoViewport.d.ts +16 -0
- package/core/GizmoViewport.js +140 -0
- package/core/Gltf.cjs.js +1 -0
- package/core/Gltf.d.ts +27 -0
- package/core/Gltf.js +52 -0
- package/core/GradientTexture.cjs.js +1 -0
- package/core/GradientTexture.d.ts +18 -0
- package/core/GradientTexture.js +54 -0
- package/core/Grid.cjs.js +1 -0
- package/core/Grid.d.ts +26 -0
- package/core/Grid.js +142 -0
- package/core/Helper.cjs.js +1 -0
- package/core/Helper.d.ts +16 -0
- package/core/Helper.js +47 -0
- package/core/Hud.cjs.js +1 -0
- package/core/Hud.d.ts +6 -0
- package/core/Hud.js +55 -0
- package/core/Image.cjs.js +1 -0
- package/core/Image.d.ts +38 -0
- package/core/Image.js +160 -0
- package/core/Instances.cjs.js +1 -0
- package/core/Instances.d.ts +64 -0
- package/core/Instances.js +313 -0
- package/core/Ktx2.cjs.js +1 -0
- package/core/Ktx2.d.ts +14 -0
- package/core/Ktx2.js +48 -0
- package/core/Lightformer.cjs.js +1 -0
- package/core/Lightformer.d.ts +15 -0
- package/core/Lightformer.js +63 -0
- package/core/Line.cjs.js +1 -0
- package/core/Line.d.ts +13 -0
- package/core/Line.js +73 -0
- package/core/MapControls.cjs.js +1 -0
- package/core/MapControls.d.ts +14 -0
- package/core/MapControls.js +63 -0
- package/core/MarchingCubes.cjs.js +1 -0
- package/core/MarchingCubes.d.ts +24 -0
- package/core/MarchingCubes.js +78 -0
- package/core/Mask.cjs.js +1 -0
- package/core/Mask.d.ts +17 -0
- package/core/Mask.js +42 -0
- package/core/MatcapTexture.cjs.js +1 -0
- package/core/MatcapTexture.d.ts +9 -0
- package/core/MatcapTexture.js +51 -0
- package/core/MeshDiscardMaterial.cjs.js +1 -0
- package/core/MeshDiscardMaterial.d.ts +10 -0
- package/core/MeshDiscardMaterial.js +15 -0
- package/core/MeshDistortMaterial.cjs.js +1 -0
- package/core/MeshDistortMaterial.d.ts +39 -0
- package/core/MeshDistortMaterial.js +72 -0
- package/core/MeshPortalMaterial.cjs.js +1 -0
- package/core/MeshPortalMaterial.d.ts +25 -0
- package/core/MeshPortalMaterial.js +467 -0
- package/core/MeshReflectorMaterial.cjs.js +1 -0
- package/core/MeshReflectorMaterial.d.ts +14 -0
- package/core/MeshReflectorMaterial.js +180 -0
- package/core/MeshRefractionMaterial.cjs.js +1 -0
- package/core/MeshRefractionMaterial.d.ts +19 -0
- package/core/MeshRefractionMaterial.js +73 -0
- package/core/MeshTransmissionMaterial.cjs.js +1 -0
- package/core/MeshTransmissionMaterial.d.ts +34 -0
- package/core/MeshTransmissionMaterial.js +402 -0
- package/core/MeshWobbleMaterial.cjs.js +1 -0
- package/core/MeshWobbleMaterial.d.ts +36 -0
- package/core/MeshWobbleMaterial.js +60 -0
- package/core/MotionPathControls.cjs.js +1 -0
- package/core/MotionPathControls.d.ts +33 -0
- package/core/MotionPathControls.js +121 -0
- package/core/MultiMaterial.cjs.js +1 -0
- package/core/MultiMaterial.d.ts +4 -0
- package/core/MultiMaterial.js +29 -0
- package/core/NormalTexture.cjs.js +1 -0
- package/core/NormalTexture.d.ts +14 -0
- package/core/NormalTexture.js +42 -0
- package/core/OrbitControls.cjs.js +1 -0
- package/core/OrbitControls.d.ts +22 -0
- package/core/OrbitControls.js +79 -0
- package/core/OrthographicCamera.cjs.js +1 -0
- package/core/OrthographicCamera.d.ts +14 -0
- package/core/OrthographicCamera.js +76 -0
- package/core/Outlines.cjs.js +1 -0
- package/core/Outlines.d.ts +17 -0
- package/core/Outlines.js +166 -0
- package/core/PerformanceMonitor.cjs.js +1 -0
- package/core/PerformanceMonitor.d.ts +36 -0
- package/core/PerformanceMonitor.js +116 -0
- package/core/PerspectiveCamera.cjs.js +1 -0
- package/core/PerspectiveCamera.d.ts +14 -0
- package/core/PerspectiveCamera.js +72 -0
- package/core/PointMaterial.cjs.js +1 -0
- package/core/PointMaterial.d.ts +8 -0
- package/core/PointMaterial.js +36 -0
- package/core/PointerLockControls.cjs.js +1 -0
- package/core/PointerLockControls.d.ts +15 -0
- package/core/PointerLockControls.js +89 -0
- package/core/Points.cjs.js +1 -0
- package/core/Points.d.ts +31 -0
- package/core/Points.js +202 -0
- package/core/PositionalAudio.cjs.js +1 -0
- package/core/PositionalAudio.d.ts +9 -0
- package/core/PositionalAudio.js +46 -0
- package/core/Preload.cjs.js +1 -0
- package/core/Preload.d.ts +7 -0
- package/core/Preload.js +44 -0
- package/core/Progress.cjs.js +1 -0
- package/core/Progress.d.ts +14 -0
- package/core/Progress.js +55 -0
- package/core/QuadraticBezierLine.cjs.js +1 -0
- package/core/QuadraticBezierLine.d.ts +14 -0
- package/core/QuadraticBezierLine.js +42 -0
- package/core/RenderCubeTexture.cjs.js +1 -0
- package/core/RenderCubeTexture.d.ts +30 -0
- package/core/RenderCubeTexture.js +96 -0
- package/core/RenderTexture.cjs.js +1 -0
- package/core/RenderTexture.d.ts +18 -0
- package/core/RenderTexture.js +105 -0
- package/core/Resize.cjs.js +1 -0
- package/core/Resize.d.ts +17 -0
- package/core/Resize.js +39 -0
- package/core/RoundedBox.cjs.js +1 -0
- package/core/RoundedBox.d.ts +14 -0
- package/core/RoundedBox.js +70 -0
- package/core/Sampler.cjs.js +1 -0
- package/core/Sampler.d.ts +28 -0
- package/core/Sampler.js +75 -0
- package/core/ScreenQuad.cjs.js +1 -0
- package/core/ScreenQuad.d.ts +5 -0
- package/core/ScreenQuad.js +25 -0
- package/core/ScreenSizer.cjs.js +1 -0
- package/core/ScreenSizer.d.ts +7 -0
- package/core/ScreenSizer.js +39 -0
- package/core/ScreenSpace.cjs.js +1 -0
- package/core/ScreenSpace.d.ts +7 -0
- package/core/ScreenSpace.js +25 -0
- package/core/Segments.cjs.js +1 -0
- package/core/Segments.d.ts +29 -0
- package/core/Segments.js +96 -0
- package/core/Shadow.cjs.js +1 -0
- package/core/Shadow.d.ts +12 -0
- package/core/Shadow.js +42 -0
- package/core/ShadowAlpha.cjs.js +1 -0
- package/core/ShadowAlpha.d.ts +7 -0
- package/core/ShadowAlpha.js +108 -0
- package/core/Sky.cjs.js +1 -0
- package/core/Sky.d.ts +16 -0
- package/core/Sky.js +39 -0
- package/core/Sparkles.cjs.js +1 -0
- package/core/Sparkles.d.ts +26 -0
- package/core/Sparkles.js +161 -0
- package/core/Splat.cjs.js +1 -0
- package/core/Splat.d.ts +56 -0
- package/core/Splat.js +506 -0
- package/core/SpotLight.cjs.js +1 -0
- package/core/SpotLight.d.ts +27 -0
- package/core/SpotLight.js +223 -0
- package/core/SpriteAnimator.cjs.js +1 -0
- package/core/SpriteAnimator.d.ts +88 -0
- package/core/SpriteAnimator.js +413 -0
- package/core/Stage.cjs.js +1 -0
- package/core/Stage.d.ts +27 -0
- package/core/Stage.js +133 -0
- package/core/Stars.cjs.js +1 -0
- package/core/Stars.d.ts +22 -0
- package/core/Stars.js +100 -0
- package/core/Stats.cjs.js +1 -0
- package/core/Stats.d.ts +7 -0
- package/core/Stats.js +32 -0
- package/core/StatsGl.cjs.js +1 -0
- package/core/StatsGl.d.ts +14 -0
- package/core/StatsGl.js +44 -0
- package/core/Svg.cjs.js +1 -0
- package/core/Svg.d.ts +13 -0
- package/core/Svg.js +62 -0
- package/core/Text.cjs.js +1 -0
- package/core/Text.d.ts +38 -0
- package/core/Text.js +57 -0
- package/core/Text3D.cjs.js +1 -0
- package/core/Text3D.d.ts +20 -0
- package/core/Text3D.js +74 -0
- package/core/Texture.cjs.js +1 -0
- package/core/Texture.d.ts +20 -0
- package/core/Texture.js +60 -0
- package/core/TrackballControls.cjs.js +1 -0
- package/core/TrackballControls.d.ts +15 -0
- package/core/TrackballControls.js +72 -0
- package/core/Trail.cjs.js +1 -0
- package/core/Trail.d.ts +21 -0
- package/core/Trail.js +150 -0
- package/core/TrailTexture.cjs.js +1 -0
- package/core/TrailTexture.d.ts +19 -0
- package/core/TrailTexture.js +159 -0
- package/core/TransformControls.cjs.js +1 -0
- package/core/TransformControls.d.ts +28 -0
- package/core/TransformControls.js +114 -0
- package/core/VideoTexture.cjs.js +1 -0
- package/core/VideoTexture.d.ts +26 -0
- package/core/VideoTexture.js +111 -0
- package/core/Wireframe.cjs.js +1 -0
- package/core/Wireframe.d.ts +15 -0
- package/core/Wireframe.js +157 -0
- package/core/calculateScaleFactor.cjs.js +1 -0
- package/core/calculateScaleFactor.d.ts +3 -0
- package/core/calculateScaleFactor.js +31 -0
- package/core/index.cjs.js +1 -0
- package/core/index.d.ts +122 -0
- package/core/index.js +150 -0
- package/core/meshBounds.cjs.js +1 -0
- package/core/meshBounds.d.ts +2 -0
- package/core/meshBounds.js +28 -0
- package/core/shaderMaterial.cjs.js +1 -0
- package/core/shaderMaterial.d.ts +9 -0
- package/core/shaderMaterial.js +29 -0
- package/core/shapes.cjs.js +1 -0
- package/core/shapes.d.ts +26 -0
- package/core/shapes.js +65 -0
- package/core/softShadows.cjs.js +1 -0
- package/core/softShadows.d.ts +6 -0
- package/core/softShadows.js +158 -0
- package/core/useAnimations.cjs.js +1 -0
- package/core/useAnimations.d.ts +13 -0
- package/core/useAnimations.js +52 -0
- package/core/useAspect.cjs.js +1 -0
- package/core/useAspect.d.ts +1 -0
- package/core/useAspect.js +10 -0
- package/core/useBoxProjectedEnv.cjs.js +1 -0
- package/core/useBoxProjectedEnv.d.ts +19 -0
- package/core/useBoxProjectedEnv.js +95 -0
- package/core/useCamera.cjs.js +1 -0
- package/core/useCamera.d.ts +3 -0
- package/core/useCamera.js +19 -0
- package/core/useContextBridge.cjs.js +1 -0
- package/core/useContextBridge.d.ts +4 -0
- package/core/useContextBridge.js +20 -0
- package/core/useDepthBuffer.cjs.js +1 -0
- package/core/useDepthBuffer.d.ts +6 -0
- package/core/useDepthBuffer.js +38 -0
- package/core/useEnvironment.cjs.js +1 -0
- package/core/useEnvironment.d.ts +17 -0
- package/core/useEnvironment.js +150 -0
- package/core/useFont.cjs.js +1 -0
- package/core/useFont.d.ts +24 -0
- package/core/useFont.js +24 -0
- package/core/useIntersect.cjs.js +1 -0
- package/core/useIntersect.d.ts +3 -0
- package/core/useIntersect.js +36 -0
- package/core/useSpriteLoader.cjs.js +1 -0
- package/core/useSpriteLoader.d.ts +57 -0
- package/core/useSpriteLoader.js +402 -0
- package/helpers/constants.cjs.js +1 -0
- package/helpers/constants.d.ts +1 -0
- package/helpers/constants.js +6 -0
- package/helpers/deprecated.cjs.js +1 -0
- package/helpers/deprecated.d.ts +5 -0
- package/helpers/deprecated.js +8 -0
- package/helpers/environment-assets.cjs.js +1 -0
- package/helpers/environment-assets.d.ts +13 -0
- package/helpers/environment-assets.js +14 -0
- package/helpers/glsl/DefaultSpotlightShadowShadows.glsl.js +3 -0
- package/helpers/glsl/distort.vert.glsl.js +3 -0
- package/helpers/ts-utils.cjs.js +1 -0
- package/helpers/ts-utils.d.ts +7 -0
- package/helpers/ts-utils.js +1 -0
- package/helpers/useEffectfulState.cjs.js +1 -0
- package/helpers/useEffectfulState.d.ts +4 -0
- package/helpers/useEffectfulState.js +17 -0
- package/index.cjs.js +1 -0
- package/index.d.ts +1 -0
- package/index.js +139 -0
- package/materials/BlurPass.cjs.js +1 -0
- package/materials/BlurPass.d.ts +23 -0
- package/materials/BlurPass.js +72 -0
- package/materials/ConvolutionMaterial.cjs.js +1 -0
- package/materials/ConvolutionMaterial.d.ts +7 -0
- package/materials/ConvolutionMaterial.js +97 -0
- package/materials/DiscardMaterial.cjs.js +1 -0
- package/materials/DiscardMaterial.d.ts +3 -0
- package/materials/DiscardMaterial.js +5 -0
- package/materials/MeshReflectorMaterial.cjs.js +1 -0
- package/materials/MeshReflectorMaterial.d.ts +50 -0
- package/materials/MeshReflectorMaterial.js +256 -0
- package/materials/MeshRefractionMaterial.cjs.js +1 -0
- package/materials/MeshRefractionMaterial.d.ts +18 -0
- package/materials/MeshRefractionMaterial.js +163 -0
- package/materials/SpotLightMaterial.cjs.js +1 -0
- package/materials/SpotLightMaterial.d.ts +4 -0
- package/materials/SpotLightMaterial.js +115 -0
- package/materials/WireframeMaterial.cjs.js +1 -0
- package/materials/WireframeMaterial.d.ts +64 -0
- package/materials/WireframeMaterial.js +217 -0
- package/native/index.cjs.js +1 -0
- package/native/index.d.ts +1 -0
- package/native/index.js +150 -0
- package/native/package.json +5 -0
- package/package.json +83 -0
- package/web/CycleRaycast.cjs.js +1 -0
- package/web/CycleRaycast.d.ts +10 -0
- package/web/CycleRaycast.js +93 -0
- package/web/DragControls.cjs.js +1 -0
- package/web/DragControls.d.ts +17 -0
- package/web/DragControls.js +127 -0
- package/web/FaceControls.cjs.js +1 -0
- package/web/FaceControls.d.ts +29 -0
- package/web/FaceControls.js +236 -0
- package/web/FaceLandmarker.cjs.js +1 -0
- package/web/FaceLandmarker.d.ts +14 -0
- package/web/FaceLandmarker.js +49 -0
- package/web/Facemesh.cjs.js +1 -0
- package/web/Facemesh.d.ts +118 -0
- package/web/Facemesh.js +4538 -0
- package/web/Html.cjs.js +1 -0
- package/web/Html.d.ts +34 -0
- package/web/Html.js +375 -0
- package/web/KeyboardControls.cjs.js +1 -0
- package/web/KeyboardControls.d.ts +37 -0
- package/web/KeyboardControls.js +104 -0
- package/web/Loader.cjs.js +1 -0
- package/web/Loader.d.ts +12 -0
- package/web/Loader.js +101 -0
- package/web/PresentationControls.cjs.js +1 -0
- package/web/PresentationControls.d.ts +16 -0
- package/web/PresentationControls.js +79 -0
- package/web/ScreenVideoTexture.cjs.js +1 -0
- package/web/ScreenVideoTexture.d.ts +17 -0
- package/web/ScreenVideoTexture.js +30 -0
- package/web/ScrollControls.cjs.js +1 -0
- package/web/ScrollControls.d.ts +45 -0
- package/web/ScrollControls.js +237 -0
- package/web/Select.cjs.js +1 -0
- package/web/Select.d.ts +14 -0
- package/web/Select.js +171 -0
- package/web/View.cjs.js +1 -0
- package/web/View.d.ts +34 -0
- package/web/View.js +259 -0
- package/web/WebcamVideoTexture.cjs.js +1 -0
- package/web/WebcamVideoTexture.d.ts +17 -0
- package/web/WebcamVideoTexture.js +33 -0
- package/web/index.cjs.js +1 -0
- package/web/index.d.ts +17 -0
- package/web/index.js +176 -0
- package/web/pivotControls/AxisArrow.cjs.js +1 -0
- package/web/pivotControls/AxisArrow.d.ts +7 -0
- package/web/pivotControls/AxisArrow.js +193 -0
- package/web/pivotControls/AxisRotator.cjs.js +1 -0
- package/web/pivotControls/AxisRotator.d.ts +7 -0
- package/web/pivotControls/AxisRotator.js +220 -0
- package/web/pivotControls/PlaneSlider.cjs.js +1 -0
- package/web/pivotControls/PlaneSlider.d.ts +7 -0
- package/web/pivotControls/PlaneSlider.js +202 -0
- package/web/pivotControls/ScalingSphere.cjs.js +1 -0
- package/web/pivotControls/ScalingSphere.d.ts +7 -0
- package/web/pivotControls/ScalingSphere.js +192 -0
- package/web/pivotControls/context.cjs.js +1 -0
- package/web/pivotControls/context.d.ts +33 -0
- package/web/pivotControls/context.js +5 -0
- package/web/pivotControls/index.cjs.js +1 -0
- package/web/pivotControls/index.d.ts +39 -0
- package/web/pivotControls/index.js +213 -0
- package/web/useCursor.cjs.js +1 -0
- package/web/useCursor.d.ts +1 -0
- package/web/useCursor.js +12 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
2
|
+
import { useThree, useFrame } from '@react-three/fiber';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
import { AxisArrow } from './AxisArrow.js';
|
|
6
|
+
import { AxisRotator } from './AxisRotator.js';
|
|
7
|
+
import { PlaneSlider } from './PlaneSlider.js';
|
|
8
|
+
import { ScalingSphere } from './ScalingSphere.js';
|
|
9
|
+
import { context } from './context.js';
|
|
10
|
+
import { calculateScaleFactor } from '../../core/calculateScaleFactor.js';
|
|
11
|
+
|
|
12
|
+
const mL0 = /* @__PURE__ */new THREE.Matrix4();
|
|
13
|
+
const mW0 = /* @__PURE__ */new THREE.Matrix4();
|
|
14
|
+
const mP = /* @__PURE__ */new THREE.Matrix4();
|
|
15
|
+
const mPInv = /* @__PURE__ */new THREE.Matrix4();
|
|
16
|
+
const mW = /* @__PURE__ */new THREE.Matrix4();
|
|
17
|
+
const mL = /* @__PURE__ */new THREE.Matrix4();
|
|
18
|
+
const mL0Inv = /* @__PURE__ */new THREE.Matrix4();
|
|
19
|
+
const mdL = /* @__PURE__ */new THREE.Matrix4();
|
|
20
|
+
const mG = /* @__PURE__ */new THREE.Matrix4();
|
|
21
|
+
const bb = /* @__PURE__ */new THREE.Box3();
|
|
22
|
+
const bbObj = /* @__PURE__ */new THREE.Box3();
|
|
23
|
+
const vCenter = /* @__PURE__ */new THREE.Vector3();
|
|
24
|
+
const vSize = /* @__PURE__ */new THREE.Vector3();
|
|
25
|
+
const vAnchorOffset = /* @__PURE__ */new THREE.Vector3();
|
|
26
|
+
const vPosition = /* @__PURE__ */new THREE.Vector3();
|
|
27
|
+
const vScale = /* @__PURE__ */new THREE.Vector3();
|
|
28
|
+
const xDir = /* @__PURE__ */new THREE.Vector3(1, 0, 0);
|
|
29
|
+
const yDir = /* @__PURE__ */new THREE.Vector3(0, 1, 0);
|
|
30
|
+
const zDir = /* @__PURE__ */new THREE.Vector3(0, 0, 1);
|
|
31
|
+
const PivotControls = /* @__PURE__ */React.forwardRef(({
|
|
32
|
+
enabled = true,
|
|
33
|
+
matrix,
|
|
34
|
+
onDragStart,
|
|
35
|
+
onDrag,
|
|
36
|
+
onDragEnd,
|
|
37
|
+
autoTransform = true,
|
|
38
|
+
anchor,
|
|
39
|
+
disableAxes = false,
|
|
40
|
+
disableSliders = false,
|
|
41
|
+
disableRotations = false,
|
|
42
|
+
disableScaling = false,
|
|
43
|
+
activeAxes = [true, true, true],
|
|
44
|
+
offset = [0, 0, 0],
|
|
45
|
+
rotation = [0, 0, 0],
|
|
46
|
+
scale = 1,
|
|
47
|
+
lineWidth = 4,
|
|
48
|
+
fixed = false,
|
|
49
|
+
translationLimits,
|
|
50
|
+
rotationLimits,
|
|
51
|
+
scaleLimits,
|
|
52
|
+
depthTest = true,
|
|
53
|
+
renderOrder = 500,
|
|
54
|
+
axisColors = ['#ff2060', '#20df80', '#2080ff'],
|
|
55
|
+
hoveredColor = '#ffff40',
|
|
56
|
+
annotations = false,
|
|
57
|
+
annotationsClass,
|
|
58
|
+
opacity = 1,
|
|
59
|
+
visible = true,
|
|
60
|
+
userData,
|
|
61
|
+
children,
|
|
62
|
+
...props
|
|
63
|
+
}, fRef) => {
|
|
64
|
+
const invalidate = useThree(state => state.invalidate);
|
|
65
|
+
const parentRef = React.useRef(null);
|
|
66
|
+
const ref = React.useRef(null);
|
|
67
|
+
const gizmoRef = React.useRef(null);
|
|
68
|
+
const childrenRef = React.useRef(null);
|
|
69
|
+
const translation = React.useRef([0, 0, 0]);
|
|
70
|
+
const cameraScale = React.useRef(new THREE.Vector3(1, 1, 1));
|
|
71
|
+
const gizmoScale = React.useRef(new THREE.Vector3(1, 1, 1));
|
|
72
|
+
React.useLayoutEffect(() => {
|
|
73
|
+
if (!anchor) return;
|
|
74
|
+
childrenRef.current.updateWorldMatrix(true, true);
|
|
75
|
+
mPInv.copy(childrenRef.current.matrixWorld).invert();
|
|
76
|
+
bb.makeEmpty();
|
|
77
|
+
childrenRef.current.traverse(obj => {
|
|
78
|
+
if (!obj.geometry) return;
|
|
79
|
+
if (!obj.geometry.boundingBox) obj.geometry.computeBoundingBox();
|
|
80
|
+
mL.copy(obj.matrixWorld).premultiply(mPInv);
|
|
81
|
+
bbObj.copy(obj.geometry.boundingBox);
|
|
82
|
+
bbObj.applyMatrix4(mL);
|
|
83
|
+
bb.union(bbObj);
|
|
84
|
+
});
|
|
85
|
+
vCenter.copy(bb.max).add(bb.min).multiplyScalar(0.5);
|
|
86
|
+
vSize.copy(bb.max).sub(bb.min).multiplyScalar(0.5);
|
|
87
|
+
vAnchorOffset.copy(vSize).multiply(new THREE.Vector3(...anchor)).add(vCenter);
|
|
88
|
+
vPosition.set(...offset).add(vAnchorOffset);
|
|
89
|
+
gizmoRef.current.position.copy(vPosition);
|
|
90
|
+
invalidate();
|
|
91
|
+
});
|
|
92
|
+
const config = React.useMemo(() => ({
|
|
93
|
+
onDragStart: props => {
|
|
94
|
+
mL0.copy(ref.current.matrix);
|
|
95
|
+
mW0.copy(ref.current.matrixWorld);
|
|
96
|
+
onDragStart && onDragStart(props);
|
|
97
|
+
invalidate();
|
|
98
|
+
},
|
|
99
|
+
onDrag: mdW => {
|
|
100
|
+
mP.copy(parentRef.current.matrixWorld);
|
|
101
|
+
mPInv.copy(mP).invert();
|
|
102
|
+
// After applying the delta
|
|
103
|
+
mW.copy(mW0).premultiply(mdW);
|
|
104
|
+
mL.copy(mW).premultiply(mPInv);
|
|
105
|
+
mL0Inv.copy(mL0).invert();
|
|
106
|
+
mdL.copy(mL).multiply(mL0Inv);
|
|
107
|
+
if (autoTransform) {
|
|
108
|
+
ref.current.matrix.copy(mL);
|
|
109
|
+
}
|
|
110
|
+
onDrag && onDrag(mL, mdL, mW, mdW);
|
|
111
|
+
invalidate();
|
|
112
|
+
},
|
|
113
|
+
onDragEnd: () => {
|
|
114
|
+
if (onDragEnd) onDragEnd();
|
|
115
|
+
invalidate();
|
|
116
|
+
},
|
|
117
|
+
translation,
|
|
118
|
+
translationLimits,
|
|
119
|
+
rotationLimits,
|
|
120
|
+
axisColors,
|
|
121
|
+
hoveredColor,
|
|
122
|
+
opacity,
|
|
123
|
+
scale,
|
|
124
|
+
lineWidth,
|
|
125
|
+
fixed,
|
|
126
|
+
depthTest,
|
|
127
|
+
renderOrder,
|
|
128
|
+
userData,
|
|
129
|
+
annotations,
|
|
130
|
+
annotationsClass
|
|
131
|
+
}), [onDragStart, onDrag, onDragEnd, translation, translationLimits, rotationLimits, scaleLimits, depthTest, scale, lineWidth, fixed, ...axisColors, hoveredColor, opacity, userData, autoTransform, annotations, annotationsClass]);
|
|
132
|
+
const vec = new THREE.Vector3();
|
|
133
|
+
useFrame(state => {
|
|
134
|
+
if (fixed) {
|
|
135
|
+
const sf = calculateScaleFactor(gizmoRef.current.getWorldPosition(vec), scale, state.camera, state.size);
|
|
136
|
+
cameraScale.current.setScalar(sf);
|
|
137
|
+
}
|
|
138
|
+
if (matrix && matrix instanceof THREE.Matrix4) {
|
|
139
|
+
ref.current.matrix = matrix;
|
|
140
|
+
}
|
|
141
|
+
// Update gizmo scale in accordance with matrix changes
|
|
142
|
+
// Without this, there might be noticable turbulences if scaling happens fast enough
|
|
143
|
+
ref.current.updateWorldMatrix(true, true);
|
|
144
|
+
mG.makeRotationFromEuler(gizmoRef.current.rotation).setPosition(gizmoRef.current.position).premultiply(ref.current.matrixWorld);
|
|
145
|
+
gizmoScale.current.setFromMatrixScale(mG);
|
|
146
|
+
vScale.copy(cameraScale.current).divide(gizmoScale.current);
|
|
147
|
+
if (Math.abs(gizmoRef.current.scale.x - vScale.x) > 1e-4 || Math.abs(gizmoRef.current.scale.y - vScale.y) > 1e-4 || Math.abs(gizmoRef.current.scale.z - vScale.z) > 1e-4) {
|
|
148
|
+
gizmoRef.current.scale.copy(vScale);
|
|
149
|
+
state.invalidate();
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
React.useImperativeHandle(fRef, () => ref.current, []);
|
|
153
|
+
return /*#__PURE__*/React.createElement(context.Provider, {
|
|
154
|
+
value: config
|
|
155
|
+
}, /*#__PURE__*/React.createElement("group", {
|
|
156
|
+
ref: parentRef
|
|
157
|
+
}, /*#__PURE__*/React.createElement("group", _extends({
|
|
158
|
+
ref: ref,
|
|
159
|
+
matrix: matrix,
|
|
160
|
+
matrixAutoUpdate: false
|
|
161
|
+
}, props), /*#__PURE__*/React.createElement("group", {
|
|
162
|
+
visible: visible,
|
|
163
|
+
ref: gizmoRef,
|
|
164
|
+
position: offset,
|
|
165
|
+
rotation: rotation
|
|
166
|
+
}, enabled && /*#__PURE__*/React.createElement(React.Fragment, null, !disableAxes && activeAxes[0] && /*#__PURE__*/React.createElement(AxisArrow, {
|
|
167
|
+
axis: 0,
|
|
168
|
+
direction: xDir
|
|
169
|
+
}), !disableAxes && activeAxes[1] && /*#__PURE__*/React.createElement(AxisArrow, {
|
|
170
|
+
axis: 1,
|
|
171
|
+
direction: yDir
|
|
172
|
+
}), !disableAxes && activeAxes[2] && /*#__PURE__*/React.createElement(AxisArrow, {
|
|
173
|
+
axis: 2,
|
|
174
|
+
direction: zDir
|
|
175
|
+
}), !disableSliders && activeAxes[0] && activeAxes[1] && /*#__PURE__*/React.createElement(PlaneSlider, {
|
|
176
|
+
axis: 2,
|
|
177
|
+
dir1: xDir,
|
|
178
|
+
dir2: yDir
|
|
179
|
+
}), !disableSliders && activeAxes[0] && activeAxes[2] && /*#__PURE__*/React.createElement(PlaneSlider, {
|
|
180
|
+
axis: 1,
|
|
181
|
+
dir1: zDir,
|
|
182
|
+
dir2: xDir
|
|
183
|
+
}), !disableSliders && activeAxes[2] && activeAxes[1] && /*#__PURE__*/React.createElement(PlaneSlider, {
|
|
184
|
+
axis: 0,
|
|
185
|
+
dir1: yDir,
|
|
186
|
+
dir2: zDir
|
|
187
|
+
}), !disableRotations && activeAxes[0] && activeAxes[1] && /*#__PURE__*/React.createElement(AxisRotator, {
|
|
188
|
+
axis: 2,
|
|
189
|
+
dir1: xDir,
|
|
190
|
+
dir2: yDir
|
|
191
|
+
}), !disableRotations && activeAxes[0] && activeAxes[2] && /*#__PURE__*/React.createElement(AxisRotator, {
|
|
192
|
+
axis: 1,
|
|
193
|
+
dir1: zDir,
|
|
194
|
+
dir2: xDir
|
|
195
|
+
}), !disableRotations && activeAxes[2] && activeAxes[1] && /*#__PURE__*/React.createElement(AxisRotator, {
|
|
196
|
+
axis: 0,
|
|
197
|
+
dir1: yDir,
|
|
198
|
+
dir2: zDir
|
|
199
|
+
}), !disableScaling && activeAxes[0] && /*#__PURE__*/React.createElement(ScalingSphere, {
|
|
200
|
+
axis: 0,
|
|
201
|
+
direction: xDir
|
|
202
|
+
}), !disableScaling && activeAxes[1] && /*#__PURE__*/React.createElement(ScalingSphere, {
|
|
203
|
+
axis: 1,
|
|
204
|
+
direction: yDir
|
|
205
|
+
}), !disableScaling && activeAxes[2] && /*#__PURE__*/React.createElement(ScalingSphere, {
|
|
206
|
+
axis: 2,
|
|
207
|
+
direction: zDir
|
|
208
|
+
}))), /*#__PURE__*/React.createElement("group", {
|
|
209
|
+
ref: childrenRef
|
|
210
|
+
}, children))));
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
export { PivotControls };
|
|
@@ -0,0 +1 @@
|
|
|
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 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)}Object.defineProperty(exports,"__esModule",{value:!0});var r=e(require("react"));exports.useCursor=function(e,t="pointer",u="auto",o=document.body){r.useEffect((()=>{if(e)return o.style.cursor=t,()=>{o.style.cursor=u}}),[e])};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useCursor(hovered: boolean, onPointerOver?: string, onPointerOut?: string, container?: HTMLElement): void;
|
package/web/useCursor.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
function useCursor(hovered, onPointerOver = 'pointer', onPointerOut = 'auto', container = document.body) {
|
|
4
|
+
React.useEffect(() => {
|
|
5
|
+
if (hovered) {
|
|
6
|
+
container.style.cursor = onPointerOver;
|
|
7
|
+
return () => void (container.style.cursor = onPointerOut);
|
|
8
|
+
}
|
|
9
|
+
}, [hovered]);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { useCursor };
|