@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,402 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { TextureLoader } from 'three';
|
|
3
|
+
import { useThree, useLoader } from '@react-three/fiber';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { useState } from 'react';
|
|
6
|
+
|
|
7
|
+
/* eslint react-hooks/exhaustive-deps: 1 */
|
|
8
|
+
// utils
|
|
9
|
+
const getFirstFrame = (frames, frameName) => {
|
|
10
|
+
if (Array.isArray(frames)) {
|
|
11
|
+
return frames[0];
|
|
12
|
+
} else {
|
|
13
|
+
const k = frameName !== null && frameName !== void 0 ? frameName : Object.keys(frames)[0];
|
|
14
|
+
return frames[k][0];
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const checkIfFrameIsEmpty = frameData => {
|
|
18
|
+
for (let i = 3; i < frameData.length; i += 4) {
|
|
19
|
+
if (frameData[i] !== 0) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return true;
|
|
24
|
+
};
|
|
25
|
+
function useSpriteLoader(/** The URL of the sprite sheet. */
|
|
26
|
+
input, /** The JSON data of the sprite sheet. */
|
|
27
|
+
json, /** The names of the animations in the sprite sheet. */
|
|
28
|
+
animationNames, /** The number of frames in the sprite sheet. */
|
|
29
|
+
numberOfFrames, /** A callback that is called when the sprite sheet is loaded. */
|
|
30
|
+
onLoad, /** The settings to use when creating the 2D context. */
|
|
31
|
+
canvasRenderingContext2DSettings) {
|
|
32
|
+
const viewportRef = React.useRef(useThree(state => state.viewport));
|
|
33
|
+
const spriteDataRef = React.useRef(null);
|
|
34
|
+
const totalFrames = React.useRef(0);
|
|
35
|
+
const aspectFactor = 0.1;
|
|
36
|
+
const inputRef = React.useRef(input);
|
|
37
|
+
const jsonRef = React.useRef(json);
|
|
38
|
+
const animationFramesRef = React.useRef(animationNames);
|
|
39
|
+
const [spriteData, setSpriteData] = useState(null);
|
|
40
|
+
const [spriteTexture, setSpriteTexture] = React.useState(new THREE.Texture());
|
|
41
|
+
const textureLoader = React.useMemo(() => new THREE.TextureLoader(), []);
|
|
42
|
+
const [spriteObj, setSpriteObj] = useState(null);
|
|
43
|
+
const calculateAspectRatio = React.useCallback((width, height, factor) => {
|
|
44
|
+
const adaptedHeight = height * (viewportRef.current.aspect > width / height ? viewportRef.current.width / width : viewportRef.current.height / height);
|
|
45
|
+
const adaptedWidth = width * (viewportRef.current.aspect > width / height ? viewportRef.current.width / width : viewportRef.current.height / height);
|
|
46
|
+
const scaleX = adaptedWidth * factor;
|
|
47
|
+
const scaleY = adaptedHeight * factor;
|
|
48
|
+
const currentMaxScale = 1;
|
|
49
|
+
// Calculate the maximum scale based on the aspect ratio and max scale limit
|
|
50
|
+
let finalMaxScaleW = Math.min(currentMaxScale, scaleX);
|
|
51
|
+
let finalMaxScaleH = Math.min(currentMaxScale, scaleY);
|
|
52
|
+
|
|
53
|
+
// Ensure that scaleX and scaleY do not exceed the max scale while maintaining aspect ratio
|
|
54
|
+
if (scaleX > currentMaxScale) {
|
|
55
|
+
finalMaxScaleW = currentMaxScale;
|
|
56
|
+
finalMaxScaleH = scaleY / scaleX * currentMaxScale;
|
|
57
|
+
}
|
|
58
|
+
return new THREE.Vector3(finalMaxScaleW, finalMaxScaleH, 1);
|
|
59
|
+
}, []);
|
|
60
|
+
const getRowsAndColumns = React.useCallback((texture, totalFrames) => {
|
|
61
|
+
if (texture.image) {
|
|
62
|
+
const canvas = document.createElement('canvas');
|
|
63
|
+
const ctx = canvas.getContext('2d', canvasRenderingContext2DSettings);
|
|
64
|
+
if (!ctx) {
|
|
65
|
+
throw new Error('Failed to get 2d context');
|
|
66
|
+
}
|
|
67
|
+
canvas.width = texture.image.width;
|
|
68
|
+
canvas.height = texture.image.height;
|
|
69
|
+
ctx.drawImage(texture.image, 0, 0);
|
|
70
|
+
const width = texture.image.width;
|
|
71
|
+
const height = texture.image.height;
|
|
72
|
+
|
|
73
|
+
// Calculate rows and columns based on the number of frames and image dimensions
|
|
74
|
+
const cols = Math.round(Math.sqrt(totalFrames * (width / height)));
|
|
75
|
+
const rows = Math.round(totalFrames / cols);
|
|
76
|
+
const frameWidth = width / cols;
|
|
77
|
+
const frameHeight = height / rows;
|
|
78
|
+
const emptyFrames = [];
|
|
79
|
+
for (let row = 0; row < rows; row++) {
|
|
80
|
+
for (let col = 0; col < cols; col++) {
|
|
81
|
+
const frameIndex = row * cols + col;
|
|
82
|
+
if (frameIndex >= totalFrames) {
|
|
83
|
+
emptyFrames.push({
|
|
84
|
+
row,
|
|
85
|
+
col
|
|
86
|
+
});
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
const frameData = ctx.getImageData(col * frameWidth, row * frameHeight, frameWidth, frameHeight).data;
|
|
90
|
+
const isEmpty = checkIfFrameIsEmpty(frameData);
|
|
91
|
+
if (isEmpty) {
|
|
92
|
+
emptyFrames.push({
|
|
93
|
+
row,
|
|
94
|
+
col
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
rows,
|
|
101
|
+
columns: cols,
|
|
102
|
+
frameWidth,
|
|
103
|
+
frameHeight,
|
|
104
|
+
emptyFrames
|
|
105
|
+
};
|
|
106
|
+
} else {
|
|
107
|
+
return {
|
|
108
|
+
rows: 0,
|
|
109
|
+
columns: 0,
|
|
110
|
+
frameWidth: 0,
|
|
111
|
+
frameHeight: 0,
|
|
112
|
+
emptyFrames: []
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
}, [canvasRenderingContext2DSettings]);
|
|
116
|
+
|
|
117
|
+
// calculate scale ratio for the frames
|
|
118
|
+
const calculateScaleRatio = React.useCallback(frames => {
|
|
119
|
+
// Helper function to calculate scale ratio for an array of frames
|
|
120
|
+
const processFrameArray = frameArray => {
|
|
121
|
+
// Find the largest frame
|
|
122
|
+
let largestFrame = null;
|
|
123
|
+
for (const frame of frameArray) {
|
|
124
|
+
const {
|
|
125
|
+
w,
|
|
126
|
+
h
|
|
127
|
+
} = frame.frame;
|
|
128
|
+
const area = w * h;
|
|
129
|
+
if (!largestFrame || area > largestFrame.area) {
|
|
130
|
+
largestFrame = {
|
|
131
|
+
w,
|
|
132
|
+
h,
|
|
133
|
+
area
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Set scaleRatio property on each frame
|
|
139
|
+
const frameArr = frameArray.map(frame => {
|
|
140
|
+
const {
|
|
141
|
+
w,
|
|
142
|
+
h
|
|
143
|
+
} = frame.frame;
|
|
144
|
+
const area = w * h;
|
|
145
|
+
const scaleRatio = largestFrame ? area === largestFrame.area ? 1 : Math.sqrt(area / largestFrame.area) : 1;
|
|
146
|
+
return {
|
|
147
|
+
...frame,
|
|
148
|
+
scaleRatio
|
|
149
|
+
};
|
|
150
|
+
});
|
|
151
|
+
return frameArr;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// Handle both array and record cases
|
|
155
|
+
if (Array.isArray(frames)) {
|
|
156
|
+
return processFrameArray(frames);
|
|
157
|
+
} else {
|
|
158
|
+
const result = {};
|
|
159
|
+
for (const key in frames) {
|
|
160
|
+
result[key] = processFrameArray(frames[key]);
|
|
161
|
+
}
|
|
162
|
+
return result;
|
|
163
|
+
}
|
|
164
|
+
}, []);
|
|
165
|
+
|
|
166
|
+
// for frame based JSON Hash sprite data
|
|
167
|
+
const parseFrames = React.useCallback(() => {
|
|
168
|
+
const sprites = {};
|
|
169
|
+
const data = spriteDataRef.current;
|
|
170
|
+
const delimiters = animationFramesRef.current;
|
|
171
|
+
if (data) {
|
|
172
|
+
if (delimiters && Array.isArray(data['frames'])) {
|
|
173
|
+
for (let i = 0; i < delimiters.length; i++) {
|
|
174
|
+
// we convert each named animation group into an array
|
|
175
|
+
sprites[delimiters[i]] = [];
|
|
176
|
+
for (const value of data['frames']) {
|
|
177
|
+
const frameData = value['frame'];
|
|
178
|
+
const sourceWidth = value['sourceSize']['w'];
|
|
179
|
+
const sourceHeight = value['sourceSize']['h'];
|
|
180
|
+
if (typeof value['filename'] === 'string' && value['filename'].toLowerCase().indexOf(delimiters[i].toLowerCase()) !== -1) {
|
|
181
|
+
sprites[delimiters[i]].push({
|
|
182
|
+
...value,
|
|
183
|
+
frame: frameData,
|
|
184
|
+
sourceSize: {
|
|
185
|
+
w: sourceWidth,
|
|
186
|
+
h: sourceHeight
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
for (const frame in sprites) {
|
|
193
|
+
const scaleRatioData = calculateScaleRatio(sprites[frame]);
|
|
194
|
+
if (Array.isArray(scaleRatioData)) {
|
|
195
|
+
sprites[frame] = scaleRatioData;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return sprites;
|
|
199
|
+
} else if (delimiters && typeof data['frames'] === 'object') {
|
|
200
|
+
for (let i = 0; i < delimiters.length; i++) {
|
|
201
|
+
// we convert each named animation group into an array
|
|
202
|
+
sprites[delimiters[i]] = [];
|
|
203
|
+
for (const innerKey in data['frames']) {
|
|
204
|
+
const value = data['frames'][innerKey];
|
|
205
|
+
const frameData = value['frame'];
|
|
206
|
+
const sourceWidth = value['sourceSize']['w'];
|
|
207
|
+
const sourceHeight = value['sourceSize']['h'];
|
|
208
|
+
if (typeof innerKey === 'string' && innerKey.toLowerCase().indexOf(delimiters[i].toLowerCase()) !== -1) {
|
|
209
|
+
sprites[delimiters[i]].push({
|
|
210
|
+
...value,
|
|
211
|
+
frame: frameData,
|
|
212
|
+
sourceSize: {
|
|
213
|
+
w: sourceWidth,
|
|
214
|
+
h: sourceHeight
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
for (const frame in sprites) {
|
|
221
|
+
const scaleRatioData = calculateScaleRatio(sprites[frame]);
|
|
222
|
+
if (Array.isArray(scaleRatioData)) {
|
|
223
|
+
sprites[frame] = scaleRatioData;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return sprites;
|
|
227
|
+
} else {
|
|
228
|
+
let spritesArr = [];
|
|
229
|
+
if (data != null && data.frames) {
|
|
230
|
+
if (Array.isArray(data.frames)) {
|
|
231
|
+
spritesArr = data.frames.map(frame => ({
|
|
232
|
+
...frame,
|
|
233
|
+
x: frame.frame.x,
|
|
234
|
+
y: frame.frame.y,
|
|
235
|
+
w: frame.frame.w,
|
|
236
|
+
h: frame.frame.h
|
|
237
|
+
}));
|
|
238
|
+
} else {
|
|
239
|
+
spritesArr = Object.values(data.frames).flat().map(frame => ({
|
|
240
|
+
...frame,
|
|
241
|
+
x: frame.frame.x,
|
|
242
|
+
y: frame.frame.y,
|
|
243
|
+
w: frame.frame.w,
|
|
244
|
+
h: frame.frame.h
|
|
245
|
+
}));
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return calculateScaleRatio(spritesArr);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return [];
|
|
252
|
+
}, [calculateScaleRatio, spriteDataRef]);
|
|
253
|
+
const parseSpriteData = React.useCallback((json, _spriteTexture) => {
|
|
254
|
+
let aspect = new THREE.Vector3(1, 1, 1);
|
|
255
|
+
// sprite only case
|
|
256
|
+
if (json === null) {
|
|
257
|
+
if (_spriteTexture && numberOfFrames) {
|
|
258
|
+
//get size from texture
|
|
259
|
+
const width = _spriteTexture.image.width;
|
|
260
|
+
const height = _spriteTexture.image.height;
|
|
261
|
+
totalFrames.current = numberOfFrames;
|
|
262
|
+
const {
|
|
263
|
+
rows,
|
|
264
|
+
columns,
|
|
265
|
+
frameWidth,
|
|
266
|
+
frameHeight,
|
|
267
|
+
emptyFrames
|
|
268
|
+
} = getRowsAndColumns(_spriteTexture, numberOfFrames);
|
|
269
|
+
const nonJsonFrames = {
|
|
270
|
+
frames: [],
|
|
271
|
+
meta: {
|
|
272
|
+
version: '1.0',
|
|
273
|
+
size: {
|
|
274
|
+
w: width,
|
|
275
|
+
h: height
|
|
276
|
+
},
|
|
277
|
+
rows,
|
|
278
|
+
columns,
|
|
279
|
+
frameWidth,
|
|
280
|
+
frameHeight,
|
|
281
|
+
scale: '1'
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
for (let row = 0; row < rows; row++) {
|
|
285
|
+
for (let col = 0; col < columns; col++) {
|
|
286
|
+
const isExcluded = (emptyFrames !== null && emptyFrames !== void 0 ? emptyFrames : []).some(coord => coord.row === row && coord.col === col);
|
|
287
|
+
if (isExcluded) {
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
if (Array.isArray(nonJsonFrames.frames)) {
|
|
291
|
+
nonJsonFrames.frames.push({
|
|
292
|
+
frame: {
|
|
293
|
+
x: col * frameWidth,
|
|
294
|
+
y: row * frameHeight,
|
|
295
|
+
w: frameWidth,
|
|
296
|
+
h: frameHeight
|
|
297
|
+
},
|
|
298
|
+
scaleRatio: 1,
|
|
299
|
+
rotated: false,
|
|
300
|
+
trimmed: false,
|
|
301
|
+
spriteSourceSize: {
|
|
302
|
+
x: 0,
|
|
303
|
+
y: 0,
|
|
304
|
+
w: frameWidth,
|
|
305
|
+
h: frameHeight
|
|
306
|
+
},
|
|
307
|
+
sourceSize: {
|
|
308
|
+
w: frameWidth,
|
|
309
|
+
h: frameHeight
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
aspect = calculateAspectRatio(frameWidth, frameHeight, aspectFactor);
|
|
316
|
+
spriteDataRef.current = nonJsonFrames;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
//scale ratio for standalone sprite
|
|
320
|
+
if (spriteDataRef.current && spriteDataRef.current.frames) {
|
|
321
|
+
spriteDataRef.current.frames = calculateScaleRatio(spriteDataRef.current.frames);
|
|
322
|
+
}
|
|
323
|
+
} else if (_spriteTexture) {
|
|
324
|
+
spriteDataRef.current = json;
|
|
325
|
+
spriteDataRef.current.frames = parseFrames();
|
|
326
|
+
totalFrames.current = Array.isArray(json.frames) ? json.frames.length : Object.keys(json.frames).length;
|
|
327
|
+
const {
|
|
328
|
+
w,
|
|
329
|
+
h
|
|
330
|
+
} = getFirstFrame(json.frames).sourceSize;
|
|
331
|
+
aspect = calculateAspectRatio(w, h, aspectFactor);
|
|
332
|
+
}
|
|
333
|
+
setSpriteData(spriteDataRef.current);
|
|
334
|
+
if ('encoding' in _spriteTexture) {
|
|
335
|
+
_spriteTexture.encoding = 3001; // sRGBEncoding
|
|
336
|
+
} else if ('colorSpace' in _spriteTexture) {
|
|
337
|
+
//@ts-ignore
|
|
338
|
+
_spriteTexture.colorSpace = THREE.SRGBColorSpace;
|
|
339
|
+
}
|
|
340
|
+
setSpriteTexture(_spriteTexture);
|
|
341
|
+
setSpriteObj({
|
|
342
|
+
spriteTexture: _spriteTexture,
|
|
343
|
+
spriteData: spriteDataRef.current,
|
|
344
|
+
aspect: aspect
|
|
345
|
+
});
|
|
346
|
+
}, [getRowsAndColumns, numberOfFrames, parseFrames, calculateAspectRatio, calculateScaleRatio]);
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
*
|
|
350
|
+
*/
|
|
351
|
+
const loadJsonAndTextureAndExecuteCallback = React.useCallback((jsonUrl, textureUrl, callback) => {
|
|
352
|
+
const jsonPromise = fetch(jsonUrl).then(response => response.json());
|
|
353
|
+
const texturePromise = new Promise(resolve => {
|
|
354
|
+
textureLoader.load(textureUrl, resolve);
|
|
355
|
+
});
|
|
356
|
+
Promise.all([jsonPromise, texturePromise]).then(response => {
|
|
357
|
+
callback(response[0], response[1]);
|
|
358
|
+
});
|
|
359
|
+
}, [textureLoader]);
|
|
360
|
+
const loadStandaloneSprite = React.useCallback(textureUrl => {
|
|
361
|
+
if (!textureUrl && !inputRef.current) {
|
|
362
|
+
throw new Error('Either textureUrl or input must be provided');
|
|
363
|
+
}
|
|
364
|
+
const validUrl = textureUrl !== null && textureUrl !== void 0 ? textureUrl : inputRef.current;
|
|
365
|
+
if (!validUrl) {
|
|
366
|
+
throw new Error('A valid texture URL must be provided');
|
|
367
|
+
}
|
|
368
|
+
textureLoader.load(validUrl, texture => parseSpriteData(null, texture));
|
|
369
|
+
}, [textureLoader, parseSpriteData]);
|
|
370
|
+
const loadJsonAndTexture = React.useCallback((textureUrl, jsonUrl) => {
|
|
371
|
+
if (jsonUrl && textureUrl) {
|
|
372
|
+
loadJsonAndTextureAndExecuteCallback(jsonUrl, textureUrl, parseSpriteData);
|
|
373
|
+
} else {
|
|
374
|
+
loadStandaloneSprite(textureUrl);
|
|
375
|
+
}
|
|
376
|
+
}, [loadJsonAndTextureAndExecuteCallback, loadStandaloneSprite, parseSpriteData]);
|
|
377
|
+
React.useLayoutEffect(() => {
|
|
378
|
+
if (jsonRef.current && inputRef.current) {
|
|
379
|
+
loadJsonAndTextureAndExecuteCallback(jsonRef.current, inputRef.current, parseSpriteData);
|
|
380
|
+
} else if (inputRef.current) {
|
|
381
|
+
// only load the texture, this is an image sprite only
|
|
382
|
+
loadStandaloneSprite();
|
|
383
|
+
}
|
|
384
|
+
const _inputRef = inputRef.current;
|
|
385
|
+
return () => {
|
|
386
|
+
if (_inputRef) {
|
|
387
|
+
useLoader.clear(TextureLoader, _inputRef);
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
}, [loadJsonAndTextureAndExecuteCallback, loadStandaloneSprite, parseSpriteData]);
|
|
391
|
+
React.useLayoutEffect(() => {
|
|
392
|
+
onLoad == null || onLoad(spriteTexture, spriteData !== null && spriteData !== void 0 ? spriteData : null);
|
|
393
|
+
}, [spriteTexture, spriteData, onLoad]);
|
|
394
|
+
return {
|
|
395
|
+
spriteObj,
|
|
396
|
+
loadJsonAndTexture
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
useSpriteLoader.preload = url => useLoader.preload(TextureLoader, url);
|
|
400
|
+
useSpriteLoader.clear = input => useLoader.clear(TextureLoader, input);
|
|
401
|
+
|
|
402
|
+
export { checkIfFrameIsEmpty, getFirstFrame, useSpriteLoader };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three");const r=(()=>parseInt(e.REVISION.replace(/\D+/g,"")))();exports.version=r;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const version: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.setUpdateRange=(e,t)=>{e.updateRanges[0]=t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.presetsObj={apartment:"lebombo_1k.hdr",city:"potsdamer_platz_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",forest:"forest_slope_1k.hdr",lobby:"st_fagans_interior_1k.hdr",night:"dikhololo_night_1k.hdr",park:"rooitou_park_1k.hdr",studio:"studio_small_03_1k.hdr",sunset:"venice_sunset_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr"};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const presetsObj: {
|
|
2
|
+
apartment: string;
|
|
3
|
+
city: string;
|
|
4
|
+
dawn: string;
|
|
5
|
+
forest: string;
|
|
6
|
+
lobby: string;
|
|
7
|
+
night: string;
|
|
8
|
+
park: string;
|
|
9
|
+
studio: string;
|
|
10
|
+
sunset: string;
|
|
11
|
+
warehouse: string;
|
|
12
|
+
};
|
|
13
|
+
export type PresetsType = keyof typeof presetsObj;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const presetsObj = {
|
|
2
|
+
apartment: 'lebombo_1k.hdr',
|
|
3
|
+
city: 'potsdamer_platz_1k.hdr',
|
|
4
|
+
dawn: 'kiara_1_dawn_1k.hdr',
|
|
5
|
+
forest: 'forest_slope_1k.hdr',
|
|
6
|
+
lobby: 'st_fagans_interior_1k.hdr',
|
|
7
|
+
night: 'dikhololo_night_1k.hdr',
|
|
8
|
+
park: 'rooitou_park_1k.hdr',
|
|
9
|
+
studio: 'studio_small_03_1k.hdr',
|
|
10
|
+
sunset: 'venice_sunset_1k.hdr',
|
|
11
|
+
warehouse: 'empty_warehouse_01_1k.hdr'
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { presetsObj };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var distort = "#define GLSLIFY 1\nvec3 mod289(vec3 x){return x-floor(x*(1.0/289.0))*289.0;}vec4 mod289(vec4 x){return x-floor(x*(1.0/289.0))*289.0;}vec4 permute(vec4 x){return mod289(((x*34.0)+1.0)*x);}vec4 taylorInvSqrt(vec4 r){return 1.79284291400159-0.85373472095314*r;}float snoise(vec3 v){const vec2 C=vec2(1.0/6.0,1.0/3.0);const vec4 D=vec4(0.0,0.5,1.0,2.0);vec3 i=floor(v+dot(v,C.yyy));vec3 x0=v-i+dot(i,C.xxx);vec3 g=step(x0.yzx,x0.xyz);vec3 l=1.0-g;vec3 i1=min(g.xyz,l.zxy);vec3 i2=max(g.xyz,l.zxy);vec3 x1=x0-i1+C.xxx;vec3 x2=x0-i2+C.yyy;vec3 x3=x0-D.yyy;i=mod289(i);vec4 p=permute(permute(permute(i.z+vec4(0.0,i1.z,i2.z,1.0))+i.y+vec4(0.0,i1.y,i2.y,1.0))+i.x+vec4(0.0,i1.x,i2.x,1.0));float n_=0.142857142857;vec3 ns=n_*D.wyz-D.xzx;vec4 j=p-49.0*floor(p*ns.z*ns.z);vec4 x_=floor(j*ns.z);vec4 y_=floor(j-7.0*x_);vec4 x=x_*ns.x+ns.yyyy;vec4 y=y_*ns.x+ns.yyyy;vec4 h=1.0-abs(x)-abs(y);vec4 b0=vec4(x.xy,y.xy);vec4 b1=vec4(x.zw,y.zw);vec4 s0=floor(b0)*2.0+1.0;vec4 s1=floor(b1)*2.0+1.0;vec4 sh=-step(h,vec4(0.0));vec4 a0=b0.xzyw+s0.xzyw*sh.xxyy;vec4 a1=b1.xzyw+s1.xzyw*sh.zzww;vec3 p0=vec3(a0.xy,h.x);vec3 p1=vec3(a0.zw,h.y);vec3 p2=vec3(a1.xy,h.z);vec3 p3=vec3(a1.zw,h.w);vec4 norm=taylorInvSqrt(vec4(dot(p0,p0),dot(p1,p1),dot(p2,p2),dot(p3,p3)));p0*=norm.x;p1*=norm.y;p2*=norm.z;p3*=norm.w;vec4 m=max(0.6-vec4(dot(x0,x0),dot(x1,x1),dot(x2,x2),dot(x3,x3)),0.0);m=m*m;return 42.0*dot(m*m,vec4(dot(p0,x0),dot(p1,x1),dot(p2,x2),dot(p3,x3)));}"; // eslint-disable-line
|
|
2
|
+
|
|
3
|
+
export { distort as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react';
|
|
2
|
+
export type NamedArrayTuple<T extends (...args: any) => any> = Parameters<T>;
|
|
3
|
+
export type ForwardRefComponent<P, T> = ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>;
|
|
4
|
+
export type NonFunctionKeys<T> = {
|
|
5
|
+
[K in keyof T]-?: T[K] extends Function ? never : K;
|
|
6
|
+
}[keyof T];
|
|
7
|
+
export type Overwrite<T, O> = Omit<T, NonFunctionKeys<O>> & O;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function e(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var u=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,u.get?u:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("react"));function r(e,t){"function"==typeof e?e(t):null!=e&&(e.current=t)}exports.useEffectfulState=function(e,u=[],n){const[c,f]=t.useState();return t.useLayoutEffect((()=>{const t=e();return f(t),r(n,t),()=>r(n,null)}),u),c};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
function call(ref, value) {
|
|
4
|
+
if (typeof ref === 'function') ref(value);else if (ref != null) ref.current = value;
|
|
5
|
+
}
|
|
6
|
+
function useEffectfulState(fn, deps = [], cb) {
|
|
7
|
+
const [state, set] = React.useState();
|
|
8
|
+
React.useLayoutEffect(() => {
|
|
9
|
+
const value = fn();
|
|
10
|
+
set(value);
|
|
11
|
+
call(cb, value);
|
|
12
|
+
return () => call(cb, null);
|
|
13
|
+
}, deps);
|
|
14
|
+
return state;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { useEffectfulState };
|