@react-three/drei 9.121.5 → 9.121.6-rc.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/core/AccumulativeShadows.d.ts +8 -10
- package/core/ArcballControls.d.ts +4 -4
- package/core/AsciiRenderer.d.ts +1 -2
- package/core/BBAnchor.d.ts +3 -3
- package/core/Backdrop.d.ts +2 -1
- package/core/Billboard.cjs.js +1 -1
- package/core/Billboard.d.ts +3 -2
- package/core/Billboard.js +1 -1
- package/core/Bounds.d.ts +2 -1
- package/core/Bvh.d.ts +3 -2
- package/core/CameraControls.d.ts +4 -4
- package/core/CatmullRomLine.d.ts +2 -3
- package/core/Caustics.d.ts +14 -17
- package/core/Center.d.ts +3 -2
- package/core/Clone.d.ts +4 -4
- package/core/Cloud.cjs.js +1 -1
- package/core/Cloud.d.ts +50 -12
- package/core/Cloud.js +3 -3
- package/core/ComputedAttribute.cjs.js +1 -1
- package/core/ComputedAttribute.d.ts +3 -4
- package/core/ComputedAttribute.js +1 -1
- package/core/ContactShadows.d.ts +3 -2
- package/core/CubeCamera.d.ts +3 -3
- package/core/CubeTexture.d.ts +5 -6
- package/core/CubeTexture.js +2 -7
- package/core/CubicBezierLine.d.ts +2 -3
- package/core/CurveModifier.d.ts +2 -1
- package/core/Decal.d.ts +2 -2
- package/core/Detailed.d.ts +3 -3
- package/core/DetectGPU.d.ts +1 -2
- package/core/DeviceOrientationControls.d.ts +2 -2
- package/core/Edges.cjs.js +1 -1
- package/core/Edges.d.ts +2 -2
- package/core/Edges.js +2 -2
- package/core/Effects.cjs.js +1 -1
- package/core/Effects.d.ts +9 -13
- package/core/Effects.js +3 -3
- package/core/Environment.cjs.js +1 -1
- package/core/Environment.d.ts +5 -7
- package/core/Fbo.d.ts +1 -4
- package/core/Fbo.js +0 -2
- package/core/Fbx.d.ts +1 -1
- package/core/FirstPersonControls.d.ts +2 -2
- package/core/Fisheye.d.ts +2 -1
- package/core/Float.d.ts +2 -1
- package/core/FlyControls.d.ts +2 -2
- package/core/GizmoHelper.d.ts +2 -1
- package/core/GizmoViewport.d.ts +2 -2
- package/core/Gltf.d.ts +9 -5
- package/core/GradientTexture.d.ts +4 -4
- package/core/GradientTexture.js +0 -2
- package/core/Grid.d.ts +6 -7
- package/core/Helper.cjs.js +1 -1
- package/core/Helper.d.ts +1 -1
- package/core/Helper.js +1 -1
- package/core/Hud.d.ts +1 -2
- package/core/Image.d.ts +6 -8
- package/core/Instances.cjs.js +1 -1
- package/core/Instances.d.ts +27 -35
- package/core/Instances.js +35 -30
- package/core/Ktx2.d.ts +1 -1
- package/core/Lightformer.d.ts +3 -3
- package/core/Line.d.ts +4 -4
- package/core/MapControls.d.ts +4 -4
- package/core/MarchingCubes.d.ts +6 -6
- package/core/Mask.d.ts +3 -3
- package/core/MeshDiscardMaterial.d.ts +6 -7
- package/core/MeshDistortMaterial.d.ts +15 -17
- package/core/MeshPortalMaterial.cjs.js +1 -1
- package/core/MeshPortalMaterial.d.ts +14 -17
- package/core/MeshPortalMaterial.js +2 -2
- package/core/MeshReflectorMaterial.cjs.js +1 -1
- package/core/MeshReflectorMaterial.d.ts +9 -22
- package/core/MeshReflectorMaterial.js +2 -4
- package/core/MeshRefractionMaterial.cjs.js +1 -1
- package/core/MeshRefractionMaterial.d.ts +5 -8
- package/core/MeshRefractionMaterial.js +2 -2
- package/core/MeshTransmissionMaterial.cjs.js +1 -1
- package/core/MeshTransmissionMaterial.d.ts +7 -8
- package/core/MeshTransmissionMaterial.js +2 -1
- package/core/MeshWobbleMaterial.d.ts +15 -17
- package/core/MotionPathControls.cjs.js +1 -1
- package/core/MotionPathControls.d.ts +18 -6
- package/core/MotionPathControls.js +2 -3
- package/core/MultiMaterial.cjs.js +1 -1
- package/core/MultiMaterial.d.ts +3 -1
- package/core/MultiMaterial.js +2 -3
- package/core/OrbitControls.d.ts +4 -4
- package/core/OrthographicCamera.d.ts +3 -3
- package/core/Outlines.cjs.js +1 -1
- package/core/Outlines.d.ts +2 -3
- package/core/Outlines.js +2 -2
- package/core/PerformanceMonitor.d.ts +2 -2
- package/core/PerspectiveCamera.d.ts +3 -3
- package/core/PointMaterial.d.ts +3 -11
- package/core/PointerLockControls.d.ts +2 -2
- package/core/Points.cjs.js +1 -1
- package/core/Points.d.ts +10 -13
- package/core/Points.js +6 -16
- package/core/PositionalAudio.d.ts +3 -3
- package/core/Preload.d.ts +2 -3
- package/core/QuadraticBezierLine.d.ts +5 -7
- package/core/RenderCubeTexture.d.ts +2 -2
- package/core/RenderTexture.cjs.js +1 -1
- package/core/RenderTexture.d.ts +3 -3
- package/core/RenderTexture.js +3 -2
- package/core/Resize.d.ts +9 -2
- package/core/RoundedBox.d.ts +4 -4
- package/core/Sampler.d.ts +4 -4
- package/core/ScreenQuad.d.ts +3 -3
- package/core/ScreenSizer.d.ts +3 -3
- package/core/ScreenSpace.d.ts +3 -2
- package/core/Segments.d.ts +6 -8
- package/core/Shadow.d.ts +3 -3
- package/core/ShadowAlpha.cjs.js +1 -1
- package/core/ShadowAlpha.d.ts +1 -2
- package/core/ShadowAlpha.js +1 -1
- package/core/Sky.d.ts +2 -3
- package/core/Sparkles.d.ts +14 -16
- package/core/Splat.d.ts +6 -8
- package/core/SpotLight.d.ts +2 -1
- package/core/SpriteAnimator.cjs.js +1 -1
- package/core/SpriteAnimator.d.ts +36 -3
- package/core/Stage.cjs.js +1 -1
- package/core/Stage.d.ts +3 -2
- package/core/Stars.cjs.js +1 -1
- package/core/Stars.d.ts +6 -8
- package/core/Stars.js +1 -1
- package/core/Stats.d.ts +2 -3
- package/core/StatsGl.d.ts +2 -2
- package/core/Svg.d.ts +6 -6
- package/core/Text.d.ts +3 -4
- package/core/Text3D.d.ts +7 -10
- package/core/Texture.d.ts +1 -1
- package/core/TrackballControls.d.ts +4 -4
- package/core/Trail.cjs.js +1 -1
- package/core/Trail.d.ts +3 -3
- package/core/Trail.js +3 -3
- package/core/TrailTexture.d.ts +3 -2
- package/core/TransformControls.cjs.js +1 -1
- package/core/TransformControls.d.ts +3 -3
- package/core/TransformControls.js +4 -5
- package/core/VideoTexture.cjs.js +1 -1
- package/core/VideoTexture.js +1 -1
- package/core/Wireframe.d.ts +5 -7
- package/core/index.cjs.js +1 -1
- package/core/index.d.ts +0 -1
- package/core/index.js +1 -3
- package/core/shapes.d.ts +21 -20
- package/core/softShadows.d.ts +1 -2
- package/core/useAnimations.cjs.js +1 -1
- package/core/useAnimations.d.ts +2 -2
- package/core/useAnimations.js +1 -1
- package/core/useBoxProjectedEnv.d.ts +1 -1
- package/core/useCamera.cjs.js +1 -1
- package/core/useCamera.d.ts +1 -1
- package/core/useCamera.js +1 -8
- package/core/useContextBridge.d.ts +1 -1
- package/core/useEnvironment.cjs.js +1 -1
- package/core/useEnvironment.d.ts +3 -4
- package/core/useEnvironment.js +11 -19
- package/core/useIntersect.d.ts +1 -1
- package/core/useSpriteLoader.d.ts +1 -1
- package/helpers/deprecated.cjs.js +1 -1
- package/helpers/deprecated.d.ts +1 -4
- package/helpers/deprecated.js +2 -14
- package/helpers/ts-utils.d.ts +4 -0
- package/helpers/useEffectfulState.d.ts +1 -1
- package/index.cjs.js +1 -1
- package/index.js +0 -1
- package/materials/BlurPass.js +0 -1
- package/materials/MeshReflectorMaterial.d.ts +0 -16
- package/native/index.cjs.js +1 -1
- package/native/index.js +1 -3
- package/package.json +7 -8
- package/web/CycleRaycast.d.ts +1 -1
- package/web/FaceLandmarker.d.ts +1 -2
- package/web/Facemesh.d.ts +3 -2
- package/web/Html.cjs.js +1 -1
- package/web/Html.d.ts +4 -4
- package/web/Html.js +1 -1
- package/web/KeyboardControls.d.ts +1 -1
- package/web/PresentationControls.cjs.js +1 -1
- package/web/PresentationControls.d.ts +3 -4
- package/web/PresentationControls.js +20 -28
- package/web/ScrollControls.d.ts +1 -1
- package/web/Select.d.ts +3 -3
- package/web/Select.js +6 -2
- package/web/View.cjs.js +1 -1
- package/web/View.d.ts +8 -10
- package/web/View.js +4 -34
- package/web/index.cjs.js +1 -1
- package/web/index.js +0 -3
- package/web/pivotControls/AxisArrow.js +0 -2
- package/web/pivotControls/AxisRotator.js +0 -2
- package/web/pivotControls/PlaneSlider.js +0 -2
- package/web/pivotControls/ScalingSphere.js +0 -1
- package/web/pivotControls/index.d.ts +1 -2
- package/core/Reflector.cjs.js +0 -1
- package/core/Reflector.d.ts +0 -30
- package/core/Reflector.js +0 -180
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { ReactThreeFiber } from '@react-three/fiber';
|
|
3
|
+
import { ReactThreeFiber, ThreeElements } from '@react-three/fiber';
|
|
4
4
|
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
5
|
-
export type AccumulativeShadowsProps = {
|
|
5
|
+
export type AccumulativeShadowsProps = Omit<ThreeElements['group'], 'ref'> & {
|
|
6
6
|
frames?: number;
|
|
7
7
|
blend?: number;
|
|
8
8
|
limit?: number;
|
|
@@ -34,16 +34,14 @@ type SoftShadowMaterialProps = {
|
|
|
34
34
|
alphaTest?: number;
|
|
35
35
|
blend?: number;
|
|
36
36
|
};
|
|
37
|
-
declare
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
softShadowMaterial: JSX.IntrinsicElements['shaderMaterial'] & SoftShadowMaterialProps;
|
|
41
|
-
}
|
|
37
|
+
declare module '@react-three/fiber' {
|
|
38
|
+
interface ThreeElements {
|
|
39
|
+
softShadowMaterial: ThreeElements['shaderMaterial'] & SoftShadowMaterialProps;
|
|
42
40
|
}
|
|
43
41
|
}
|
|
44
42
|
export declare const accumulativeContext: React.Context<AccumulativeContext>;
|
|
45
|
-
export declare const AccumulativeShadows: ForwardRefComponent<
|
|
46
|
-
export type RandomizedLightProps = {
|
|
43
|
+
export declare const AccumulativeShadows: ForwardRefComponent<AccumulativeShadowsProps, AccumulativeContext>;
|
|
44
|
+
export type RandomizedLightProps = Omit<ThreeElements['group'], 'ref'> & {
|
|
47
45
|
frames?: number;
|
|
48
46
|
position?: [x: number, y: number, z: number];
|
|
49
47
|
radius?: number;
|
|
@@ -57,5 +55,5 @@ export type RandomizedLightProps = {
|
|
|
57
55
|
near?: number;
|
|
58
56
|
far?: number;
|
|
59
57
|
};
|
|
60
|
-
export declare const RandomizedLight: ForwardRefComponent<
|
|
58
|
+
export declare const RandomizedLight: ForwardRefComponent<RandomizedLightProps, AccumulativeLightContext>;
|
|
61
59
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ReactThreeFiber } from '@react-three/fiber';
|
|
1
|
+
import { ReactThreeFiber, ThreeElement } from '@react-three/fiber';
|
|
2
2
|
import { ArcballControls as ArcballControlsImpl } from 'three-stdlib';
|
|
3
3
|
import type { Event, OrthographicCamera, PerspectiveCamera } from 'three';
|
|
4
|
-
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
5
|
-
export type ArcballControlsProps = Omit<
|
|
4
|
+
import { ForwardRefComponent, Overwrite } from '../helpers/ts-utils';
|
|
5
|
+
export type ArcballControlsProps = Omit<Overwrite<ThreeElement<typeof ArcballControlsImpl>, {
|
|
6
6
|
target?: ReactThreeFiber.Vector3;
|
|
7
7
|
camera?: OrthographicCamera | PerspectiveCamera;
|
|
8
8
|
domElement?: HTMLElement;
|
|
@@ -11,5 +11,5 @@ export type ArcballControlsProps = Omit<ReactThreeFiber.Overwrite<ReactThreeFibe
|
|
|
11
11
|
onChange?: (e?: Event) => void;
|
|
12
12
|
onStart?: (e?: Event) => void;
|
|
13
13
|
onEnd?: (e?: Event) => void;
|
|
14
|
-
}>, 'ref'>;
|
|
14
|
+
}>, 'ref' | 'args'>;
|
|
15
15
|
export declare const ArcballControls: ForwardRefComponent<ArcballControlsProps, ArcballControlsImpl>;
|
package/core/AsciiRenderer.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
type AsciiRendererProps = {
|
|
2
|
+
export type AsciiRendererProps = {
|
|
3
3
|
renderIndex?: number;
|
|
4
4
|
bgColor?: string;
|
|
5
5
|
fgColor?: string;
|
|
@@ -9,4 +9,3 @@ type AsciiRendererProps = {
|
|
|
9
9
|
resolution?: number;
|
|
10
10
|
};
|
|
11
11
|
export declare function AsciiRenderer({ renderIndex, bgColor, fgColor, characters, invert, color, resolution, }: AsciiRendererProps): React.JSX.Element;
|
|
12
|
-
export {};
|
package/core/BBAnchor.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as THREE from 'three';
|
|
3
|
-
import {
|
|
4
|
-
export
|
|
3
|
+
import { ThreeElements } from '@react-three/fiber';
|
|
4
|
+
export type BBAnchorProps = ThreeElements['group'] & {
|
|
5
5
|
anchor: THREE.Vector3 | [number, number, number];
|
|
6
|
-
}
|
|
6
|
+
};
|
|
7
7
|
export declare const BBAnchor: ({ anchor, ...props }: BBAnchorProps) => React.JSX.Element;
|
package/core/Backdrop.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { ThreeElements } from '@react-three/fiber';
|
|
1
2
|
import * as React from 'react';
|
|
2
|
-
export type BackdropProps =
|
|
3
|
+
export type BackdropProps = ThreeElements['group'] & {
|
|
3
4
|
floor?: number;
|
|
4
5
|
segments?: number;
|
|
5
6
|
receiveShadow?: boolean;
|
package/core/Billboard.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),r=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),r=require("react"),t=require("three"),n=require("@react-three/fiber");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function o(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}})),r.default=e,Object.freeze(r)}var c=u(e),a=o(r);const i=a.forwardRef((function({children:e,follow:r=!0,lockX:u=!1,lockY:o=!1,lockZ:i=!1,...l},f){const d=a.useRef(null),s=a.useRef(null),p=new t.Quaternion;return n.useFrame((({camera:e})=>{if(!r||!s.current)return;const t=d.current.rotation.clone();s.current.updateMatrix(),s.current.updateWorldMatrix(!1,!1),s.current.getWorldQuaternion(p),e.getWorldQuaternion(d.current.quaternion).premultiply(p.invert()),u&&(d.current.rotation.x=t.x),o&&(d.current.rotation.y=t.y),i&&(d.current.rotation.z=t.z)})),a.useImperativeHandle(f,(()=>s.current),[]),a.createElement("group",c.default({ref:s},l),a.createElement("group",{ref:d},e))}));exports.Billboard=i;
|
package/core/Billboard.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Group } from 'three';
|
|
2
|
+
import { ThreeElements } from '@react-three/fiber';
|
|
2
3
|
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
3
|
-
export type BillboardProps = {
|
|
4
|
+
export type BillboardProps = Omit<ThreeElements['group'], 'ref'> & {
|
|
4
5
|
follow?: boolean;
|
|
5
6
|
lockX?: boolean;
|
|
6
7
|
lockY?: boolean;
|
|
7
8
|
lockZ?: boolean;
|
|
8
|
-
}
|
|
9
|
+
};
|
|
9
10
|
export declare const Billboard: ForwardRefComponent<BillboardProps, Group>;
|
package/core/Billboard.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
2
|
-
import { useFrame } from '@react-three/fiber';
|
|
3
2
|
import * as React from 'react';
|
|
4
3
|
import { Quaternion } from 'three';
|
|
4
|
+
import { useFrame } from '@react-three/fiber';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Wraps children in a billboarded group. Sample usage:
|
package/core/Bounds.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as THREE from 'three';
|
|
3
|
+
import { ThreeElements } from '@react-three/fiber';
|
|
3
4
|
export type SizeProps = {
|
|
4
5
|
box: THREE.Box3;
|
|
5
6
|
size: THREE.Vector3;
|
|
@@ -22,7 +23,7 @@ export type BoundsApi = {
|
|
|
22
23
|
fit(): BoundsApi;
|
|
23
24
|
clip(): BoundsApi;
|
|
24
25
|
};
|
|
25
|
-
export type BoundsProps =
|
|
26
|
+
export type BoundsProps = Omit<ThreeElements['group'], 'ref'> & {
|
|
26
27
|
maxDuration?: number;
|
|
27
28
|
margin?: number;
|
|
28
29
|
observe?: boolean;
|
package/core/Bvh.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ThreeElements } from '@react-three/fiber';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import { Mesh, Group } from 'three';
|
|
3
4
|
import { SplitStrategy } from 'three-mesh-bvh';
|
|
@@ -10,9 +11,9 @@ export interface BVHOptions {
|
|
|
10
11
|
maxLeafTris?: number;
|
|
11
12
|
indirect?: boolean;
|
|
12
13
|
}
|
|
13
|
-
export type BvhProps = BVHOptions &
|
|
14
|
+
export type BvhProps = BVHOptions & ThreeElements['group'] & {
|
|
14
15
|
enabled?: boolean;
|
|
15
16
|
firstHitOnly?: boolean;
|
|
16
17
|
};
|
|
17
|
-
export declare function useBVH(mesh: React.
|
|
18
|
+
export declare function useBVH(mesh: React.RefObject<Mesh | undefined>, options?: BVHOptions): void;
|
|
18
19
|
export declare const Bvh: ForwardRefComponent<BvhProps, Group>;
|
package/core/CameraControls.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EventDispatcher, OrthographicCamera, PerspectiveCamera } from 'three';
|
|
2
|
-
import {
|
|
2
|
+
import { ThreeElement } from '@react-three/fiber';
|
|
3
3
|
import CameraControlsImpl from 'camera-controls';
|
|
4
|
-
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
5
|
-
export type CameraControlsProps = Omit<
|
|
4
|
+
import { ForwardRefComponent, Overwrite } from '../helpers/ts-utils';
|
|
5
|
+
export type CameraControlsProps = Omit<Overwrite<ThreeElement<typeof CameraControlsImpl>, {
|
|
6
6
|
camera?: PerspectiveCamera | OrthographicCamera;
|
|
7
7
|
domElement?: HTMLElement;
|
|
8
8
|
makeDefault?: boolean;
|
|
@@ -17,6 +17,6 @@ export type CameraControlsProps = Omit<ReactThreeFiber.Overwrite<ReactThreeFiber
|
|
|
17
17
|
}) => void;
|
|
18
18
|
events?: boolean;
|
|
19
19
|
regress?: boolean;
|
|
20
|
-
}>, 'ref' | keyof EventDispatcher>;
|
|
20
|
+
}>, 'ref' | 'args' | keyof EventDispatcher>;
|
|
21
21
|
export declare const CameraControls: ForwardRefComponent<CameraControlsProps, CameraControlsImpl>;
|
|
22
22
|
export type CameraControls = CameraControlsImpl;
|
package/core/CatmullRomLine.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Line2 } from 'three-stdlib';
|
|
2
2
|
import { LineProps } from './Line';
|
|
3
3
|
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
4
|
-
type
|
|
4
|
+
export type CatmullRomLineProps = Omit<LineProps, 'ref'> & {
|
|
5
5
|
closed?: boolean;
|
|
6
6
|
curveType?: 'centripetal' | 'chordal' | 'catmullrom';
|
|
7
7
|
tension?: number;
|
|
8
8
|
segments?: number;
|
|
9
9
|
};
|
|
10
|
-
export declare const CatmullRomLine: ForwardRefComponent<
|
|
11
|
-
export {};
|
|
10
|
+
export declare const CatmullRomLine: ForwardRefComponent<CatmullRomLineProps, Line2>;
|
package/core/Caustics.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { ReactThreeFiber } from '@react-three/fiber';
|
|
3
|
+
import { ReactThreeFiber, ThreeElements } from '@react-three/fiber';
|
|
4
4
|
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
5
|
-
type CausticsProps =
|
|
5
|
+
export type CausticsProps = Omit<ThreeElements['group'], 'ref'> & {
|
|
6
6
|
frames?: number;
|
|
7
7
|
debug?: boolean;
|
|
8
8
|
causticsOnly: boolean;
|
|
@@ -13,23 +13,20 @@ type CausticsProps = JSX.IntrinsicElements['group'] & {
|
|
|
13
13
|
intensity?: number;
|
|
14
14
|
color?: ReactThreeFiber.Color;
|
|
15
15
|
resolution?: number;
|
|
16
|
-
lightSource?: [x: number, y: number, z: number] | React.
|
|
16
|
+
lightSource?: [x: number, y: number, z: number] | React.RefObject<THREE.Object3D>;
|
|
17
17
|
};
|
|
18
|
-
declare
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
value: THREE.Matrix4;
|
|
24
|
-
};
|
|
25
|
-
color?: ReactThreeFiber.Color;
|
|
26
|
-
causticsTexture?: THREE.Texture;
|
|
27
|
-
causticsTextureB?: THREE.Texture;
|
|
28
|
-
lightProjMatrix?: THREE.Matrix4;
|
|
29
|
-
lightViewMatrix?: THREE.Matrix4;
|
|
18
|
+
declare module '@react-three/fiber' {
|
|
19
|
+
interface ThreeElements {
|
|
20
|
+
causticsProjectionMaterial: ThreeElements['meshNormalMaterial'] & {
|
|
21
|
+
viewMatrix?: {
|
|
22
|
+
value: THREE.Matrix4;
|
|
30
23
|
};
|
|
31
|
-
|
|
24
|
+
color?: ReactThreeFiber.Color;
|
|
25
|
+
causticsTexture?: THREE.Texture;
|
|
26
|
+
causticsTextureB?: THREE.Texture;
|
|
27
|
+
lightProjMatrix?: THREE.Matrix4;
|
|
28
|
+
lightViewMatrix?: THREE.Matrix4;
|
|
29
|
+
};
|
|
32
30
|
}
|
|
33
31
|
}
|
|
34
32
|
export declare const Caustics: ForwardRefComponent<CausticsProps, THREE.Group>;
|
|
35
|
-
export {};
|
package/core/Center.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Box3, Vector3, Sphere, Group, Object3D } from 'three';
|
|
2
|
+
import { ThreeElements } from '@react-three/fiber';
|
|
2
3
|
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
3
4
|
export type OnCenterCallbackProps = {
|
|
4
5
|
parent: Object3D;
|
|
@@ -13,7 +14,7 @@ export type OnCenterCallbackProps = {
|
|
|
13
14
|
horizontalAlignment: number;
|
|
14
15
|
depthAlignment: number;
|
|
15
16
|
};
|
|
16
|
-
export type CenterProps = {
|
|
17
|
+
export type CenterProps = Omit<ThreeElements['group'], 'ref'> & {
|
|
17
18
|
top?: boolean;
|
|
18
19
|
right?: boolean;
|
|
19
20
|
bottom?: boolean;
|
|
@@ -28,4 +29,4 @@ export type CenterProps = {
|
|
|
28
29
|
onCentered?: (props: OnCenterCallbackProps) => void;
|
|
29
30
|
cacheKey?: any;
|
|
30
31
|
};
|
|
31
|
-
export declare const Center: ForwardRefComponent<
|
|
32
|
+
export declare const Center: ForwardRefComponent<CenterProps, Group>;
|
package/core/Clone.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { MeshProps } from '@react-three/fiber';
|
|
4
3
|
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
5
|
-
|
|
4
|
+
import { ThreeElements } from '@react-three/fiber';
|
|
5
|
+
export type CloneProps = Omit<ThreeElements['group'], 'ref' | 'children'> & {
|
|
6
6
|
object: THREE.Object3D | THREE.Object3D[];
|
|
7
7
|
children?: React.ReactNode;
|
|
8
8
|
deep?: boolean | 'materialsOnly' | 'geometriesOnly';
|
|
9
9
|
keys?: string[];
|
|
10
|
-
inject?:
|
|
10
|
+
inject?: ThreeElements['mesh'] | React.ReactNode | ((object: THREE.Object3D) => React.ReactNode);
|
|
11
11
|
castShadow?: boolean;
|
|
12
12
|
receiveShadow?: boolean;
|
|
13
13
|
isChild?: boolean;
|
|
14
14
|
};
|
|
15
|
-
export declare const Clone: ForwardRefComponent<
|
|
15
|
+
export declare const Clone: ForwardRefComponent<CloneProps, THREE.Group>;
|
package/core/Cloud.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("react"),r=require("three"),n=require("@react-three/fiber"),a=require("./Texture.cjs.js"),o=require("../helpers/deprecated.cjs.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function c(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var l=u(e),i=c(t);const s=new r.Matrix4,d=new r.Vector3,f=new r.Quaternion,m=new r.Vector3,p=new r.Quaternion,g=new r.Vector3,h=i.createContext(null),y=i.forwardRef((({children:e,material:t=r.MeshLambertMaterial,texture:u="https://rawcdn.githack.com/pmndrs/drei-assets/9225a9f1fbd449d9411125c2f419b843d0308c9f/cloud.png",range:c,limit:y=200,frustumCulled:x,...v},b)=>{var M,w;const C=i.useMemo((()=>class extends t{constructor(){super();const e=parseInt(r.REVISION.replace(/\D+/g,""))>=154?"opaque_fragment":"output_fragment";this.onBeforeCompile=t=>{t.vertexShader="attribute float cloudOpacity;\n varying float vOpacity;\n "+t.vertexShader.replace("#include <fog_vertex>","#include <fog_vertex>\n vOpacity = cloudOpacity;\n "),t.fragmentShader="varying float vOpacity;\n "+t.fragmentShader.replace(`#include <${e}>`,`#include <${e}>\n gl_FragColor = vec4(outgoingLight, diffuseColor.a * vOpacity);\n `)}}}),[t]);n.extend({CloudMaterial:C});const E=i.useRef(null),O=i.useRef([]),A=i.useMemo((()=>new Float32Array(Array.from({length:y},(()=>1)))),[y]),j=i.useMemo((()=>new Float32Array(Array.from({length:y},(()=>[1,1,1])).flat())),[y]),R=a.useTexture(u);let U,V=0,_=0;const q=new r.Quaternion,F=new r.Vector3(0,0,1),I=new r.Vector3;n.useFrame(((e,t)=>{for(V=e.clock.elapsedTime,s.copy(E.current.matrixWorld).invert(),e.camera.matrixWorld.decompose(m,p,g),_=0;_<O.current.length;_++)U=O.current[_],U.ref.current.matrixWorld.decompose(d,f,g),d.add(I.copy(U.position).applyQuaternion(f).multiply(g)),f.copy(p).multiply(q.setFromAxisAngle(F,U.rotation+=t*U.rotationFactor)),g.multiplyScalar(U.volume+(1+Math.sin(V*U.density*U.speed))/2*U.growth),U.matrix.compose(d,f,g).premultiply(s),U.dist=d.distanceTo(m);for(O.current.sort(((e,t)=>t.dist-e.dist)),_=0;_<O.current.length;_++)U=O.current[_],A[_]=U.opacity*(U.dist<U.fade-1?U.dist/U.fade:1),E.current.setMatrixAt(_,U.matrix),E.current.setColorAt(_,U.color);E.current.geometry.attributes.cloudOpacity.needsUpdate=!0,E.current.instanceMatrix.needsUpdate=!0,E.current.instanceColor&&(E.current.instanceColor.needsUpdate=!0)})),i.useLayoutEffect((()=>{const e=Math.min(y,void 0!==c?c:y,O.current.length);E.current.count=e,o.setUpdateRange(E.current.instanceMatrix,{
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("react"),r=require("three"),n=require("@react-three/fiber"),a=require("./Texture.cjs.js"),o=require("../helpers/deprecated.cjs.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function c(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var l=u(e),i=c(t);const s=new r.Matrix4,d=new r.Vector3,f=new r.Quaternion,m=new r.Vector3,p=new r.Quaternion,g=new r.Vector3,h=i.createContext(null),y=i.forwardRef((({children:e,material:t=r.MeshLambertMaterial,texture:u="https://rawcdn.githack.com/pmndrs/drei-assets/9225a9f1fbd449d9411125c2f419b843d0308c9f/cloud.png",range:c,limit:y=200,frustumCulled:x,...v},b)=>{var M,w;const C=i.useMemo((()=>class extends t{constructor(){super();const e=parseInt(r.REVISION.replace(/\D+/g,""))>=154?"opaque_fragment":"output_fragment";this.onBeforeCompile=t=>{t.vertexShader="attribute float cloudOpacity;\n varying float vOpacity;\n "+t.vertexShader.replace("#include <fog_vertex>","#include <fog_vertex>\n vOpacity = cloudOpacity;\n "),t.fragmentShader="varying float vOpacity;\n "+t.fragmentShader.replace(`#include <${e}>`,`#include <${e}>\n gl_FragColor = vec4(outgoingLight, diffuseColor.a * vOpacity);\n `)}}}),[t]);n.extend({CloudMaterial:C});const E=i.useRef(null),O=i.useRef([]),A=i.useMemo((()=>new Float32Array(Array.from({length:y},(()=>1)))),[y]),j=i.useMemo((()=>new Float32Array(Array.from({length:y},(()=>[1,1,1])).flat())),[y]),R=a.useTexture(u);let U,V=0,_=0;const q=new r.Quaternion,F=new r.Vector3(0,0,1),I=new r.Vector3;n.useFrame(((e,t)=>{for(V=e.clock.elapsedTime,s.copy(E.current.matrixWorld).invert(),e.camera.matrixWorld.decompose(m,p,g),_=0;_<O.current.length;_++)U=O.current[_],U.ref.current.matrixWorld.decompose(d,f,g),d.add(I.copy(U.position).applyQuaternion(f).multiply(g)),f.copy(p).multiply(q.setFromAxisAngle(F,U.rotation+=t*U.rotationFactor)),g.multiplyScalar(U.volume+(1+Math.sin(V*U.density*U.speed))/2*U.growth),U.matrix.compose(d,f,g).premultiply(s),U.dist=d.distanceTo(m);for(O.current.sort(((e,t)=>t.dist-e.dist)),_=0;_<O.current.length;_++)U=O.current[_],A[_]=U.opacity*(U.dist<U.fade-1?U.dist/U.fade:1),E.current.setMatrixAt(_,U.matrix),E.current.setColorAt(_,U.color);E.current.geometry.attributes.cloudOpacity.needsUpdate=!0,E.current.instanceMatrix.needsUpdate=!0,E.current.instanceColor&&(E.current.instanceColor.needsUpdate=!0)})),i.useLayoutEffect((()=>{const e=Math.min(y,void 0!==c?c:y,O.current.length);E.current.count=e,o.setUpdateRange(E.current.instanceMatrix,{start:0,count:16*e}),E.current.instanceColor&&o.setUpdateRange(E.current.instanceColor,{start:0,count:3*e}),o.setUpdateRange(E.current.geometry.attributes.cloudOpacity,{start:0,count:e})}));let D=[null!==(M=R.image.width)&&void 0!==M?M:1,null!==(w=R.image.height)&&void 0!==w?w:1];const P=Math.max(D[0],D[1]);return D=[D[0]/P,D[1]/P],i.createElement("group",l.default({ref:b},v),i.createElement(h.Provider,{value:O},e,i.createElement("instancedMesh",{matrixAutoUpdate:!1,ref:E,args:[null,null,y],frustumCulled:x},i.createElement("instancedBufferAttribute",{usage:r.DynamicDrawUsage,attach:"instanceColor",args:[j,3]}),i.createElement("planeGeometry",{args:[...D]},i.createElement("instancedBufferAttribute",{usage:r.DynamicDrawUsage,attach:"attributes-cloudOpacity",args:[A,1]})),i.createElement("cloudMaterial",{key:t.name,map:R,transparent:!0,depthWrite:!1}))))})),x=i.forwardRef((({opacity:e=1,speed:t=0,bounds:a=[5,1,1],segments:o=20,color:u="#ffffff",fade:c=10,volume:s=6,smallestVolume:d=.25,distribute:f=null,growth:m=4,concentrate:p="inside",seed:g=Math.random(),...y},x)=>{function v(){const e=1e4*Math.sin(g++);return e-Math.floor(e)}const b=i.useContext(h),M=i.useRef(null),w=i.useId(),C=i.useMemo((()=>[...new Array(o)].map(((e,t)=>({segments:o,bounds:new r.Vector3(1,1,1),position:new r.Vector3,uuid:w,index:t,ref:M,dist:0,matrix:new r.Matrix4,color:new r.Color,rotation:t*(Math.PI/o)})))),[o,w]);return i.useLayoutEffect((()=>{C.forEach(((r,l)=>{n.applyProps(r,{volume:s,color:u,speed:t,growth:m,opacity:e,fade:c,bounds:a,density:Math.max(.5,v()),rotationFactor:Math.max(.2,.5*v())*t});const i=null==f?void 0:f(r,l);var g;(i||o>1)&&r.position.copy(r.bounds).multiply(null!==(g=null==i?void 0:i.point)&&void 0!==g?g:{x:2*v()-1,y:2*v()-1,z:2*v()-1});const h=Math.abs(r.position.x),y=Math.abs(r.position.y),x=Math.abs(r.position.z),b=Math.max(h,y,x);r.length=1,h===b&&(r.length-=h/r.bounds.x),y===b&&(r.length-=y/r.bounds.y),x===b&&(r.length-=x/r.bounds.z),r.volume=(void 0!==(null==i?void 0:i.volume)?i.volume:Math.max(Math.max(0,d),"random"===p?v():"inside"===p?r.length:1-r.length))*s}))}),[p,a,c,u,e,m,s,g,o,t]),i.useLayoutEffect((()=>{const e=C;return b.current=[...b.current,...e],()=>{b.current=b.current.filter((e=>e.uuid!==w))}}),[C]),i.useImperativeHandle(x,(()=>M.current),[]),i.createElement("group",l.default({ref:M},y))})),v=i.forwardRef(((e,t)=>i.useContext(h)?i.createElement(x,l.default({ref:t},e)):i.createElement(y,null,i.createElement(x,l.default({ref:t},e)))));exports.Cloud=v,exports.CloudInstance=x,exports.Clouds=y;
|
package/core/Cloud.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Color, Group, Vector3, Material, MeshLambertMaterial, Matrix4 } from 'three';
|
|
3
|
-
import {
|
|
4
|
-
declare
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
cloudMaterial: MaterialNode<MeshLambertMaterial, typeof MeshLambertMaterial>;
|
|
8
|
-
}
|
|
3
|
+
import { ReactThreeFiber, ThreeElement, ThreeElements } from '@react-three/fiber';
|
|
4
|
+
declare module '@react-three/fiber' {
|
|
5
|
+
interface ThreeElements {
|
|
6
|
+
cloudMaterial: ThreeElement<typeof MeshLambertMaterial>;
|
|
9
7
|
}
|
|
10
8
|
}
|
|
11
9
|
type CloudState = {
|
|
@@ -18,7 +16,7 @@ type CloudState = {
|
|
|
18
16
|
position: Vector3;
|
|
19
17
|
volume: number;
|
|
20
18
|
length: number;
|
|
21
|
-
ref: React.
|
|
19
|
+
ref: React.RefObject<Group>;
|
|
22
20
|
speed: number;
|
|
23
21
|
growth: number;
|
|
24
22
|
opacity: number;
|
|
@@ -28,14 +26,14 @@ type CloudState = {
|
|
|
28
26
|
rotationFactor: number;
|
|
29
27
|
color: Color;
|
|
30
28
|
};
|
|
31
|
-
type CloudsProps =
|
|
29
|
+
export type CloudsProps = Omit<ThreeElements['group'], 'ref'> & {
|
|
32
30
|
texture?: string;
|
|
33
31
|
limit?: number;
|
|
34
32
|
range?: number;
|
|
35
33
|
material?: typeof Material;
|
|
36
34
|
frustumCulled?: boolean;
|
|
37
35
|
};
|
|
38
|
-
type CloudProps =
|
|
36
|
+
export type CloudProps = Omit<ThreeElements['group'], 'ref'> & {
|
|
39
37
|
seed?: number;
|
|
40
38
|
segments?: number;
|
|
41
39
|
bounds?: ReactThreeFiber.Vector3;
|
|
@@ -53,7 +51,47 @@ type CloudProps = JSX.IntrinsicElements['group'] & {
|
|
|
53
51
|
opacity?: number;
|
|
54
52
|
color?: ReactThreeFiber.Color;
|
|
55
53
|
};
|
|
56
|
-
export declare const Clouds: React.ForwardRefExoticComponent<Omit<
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
export declare const Clouds: React.ForwardRefExoticComponent<Omit<import("@react-three/fiber/dist/declarations/src/core/utils").Mutable<import("@react-three/fiber/dist/declarations/src/core/utils").Overwrite<Partial<import("@react-three/fiber/dist/declarations/src/core/utils").Overwrite<Group<import("three").Object3DEventMap>, ReactThreeFiber.MathProps<Group<import("three").Object3DEventMap>> & ReactThreeFiber.ReactProps<Group<import("three").Object3DEventMap>> & Partial<import("@react-three/fiber").EventHandlers>>>, Omit<import("@react-three/fiber").InstanceProps<Group<import("three").Object3DEventMap>, typeof Group>, "object">>>, "ref"> & {
|
|
55
|
+
texture?: string;
|
|
56
|
+
limit?: number;
|
|
57
|
+
range?: number;
|
|
58
|
+
material?: typeof Material;
|
|
59
|
+
frustumCulled?: boolean;
|
|
60
|
+
} & React.RefAttributes<Group<import("three").Object3DEventMap>>>;
|
|
61
|
+
export declare const CloudInstance: React.ForwardRefExoticComponent<Omit<import("@react-three/fiber/dist/declarations/src/core/utils").Mutable<import("@react-three/fiber/dist/declarations/src/core/utils").Overwrite<Partial<import("@react-three/fiber/dist/declarations/src/core/utils").Overwrite<Group<import("three").Object3DEventMap>, ReactThreeFiber.MathProps<Group<import("three").Object3DEventMap>> & ReactThreeFiber.ReactProps<Group<import("three").Object3DEventMap>> & Partial<import("@react-three/fiber").EventHandlers>>>, Omit<import("@react-three/fiber").InstanceProps<Group<import("three").Object3DEventMap>, typeof Group>, "object">>>, "ref"> & {
|
|
62
|
+
seed?: number;
|
|
63
|
+
segments?: number;
|
|
64
|
+
bounds?: ReactThreeFiber.Vector3;
|
|
65
|
+
concentrate?: "random" | "inside" | "outside";
|
|
66
|
+
scale?: ReactThreeFiber.Vector3;
|
|
67
|
+
volume?: number;
|
|
68
|
+
smallestVolume?: number;
|
|
69
|
+
distribute?: (cloud: CloudState, index: number) => {
|
|
70
|
+
point: Vector3;
|
|
71
|
+
volume?: number;
|
|
72
|
+
};
|
|
73
|
+
growth?: number;
|
|
74
|
+
speed?: number;
|
|
75
|
+
fade?: number;
|
|
76
|
+
opacity?: number;
|
|
77
|
+
color?: ReactThreeFiber.Color;
|
|
78
|
+
} & React.RefAttributes<Group<import("three").Object3DEventMap>>>;
|
|
79
|
+
export declare const Cloud: React.ForwardRefExoticComponent<Omit<import("@react-three/fiber/dist/declarations/src/core/utils").Mutable<import("@react-three/fiber/dist/declarations/src/core/utils").Overwrite<Partial<import("@react-three/fiber/dist/declarations/src/core/utils").Overwrite<Group<import("three").Object3DEventMap>, ReactThreeFiber.MathProps<Group<import("three").Object3DEventMap>> & ReactThreeFiber.ReactProps<Group<import("three").Object3DEventMap>> & Partial<import("@react-three/fiber").EventHandlers>>>, Omit<import("@react-three/fiber").InstanceProps<Group<import("three").Object3DEventMap>, typeof Group>, "object">>>, "ref"> & {
|
|
80
|
+
seed?: number;
|
|
81
|
+
segments?: number;
|
|
82
|
+
bounds?: ReactThreeFiber.Vector3;
|
|
83
|
+
concentrate?: "random" | "inside" | "outside";
|
|
84
|
+
scale?: ReactThreeFiber.Vector3;
|
|
85
|
+
volume?: number;
|
|
86
|
+
smallestVolume?: number;
|
|
87
|
+
distribute?: (cloud: CloudState, index: number) => {
|
|
88
|
+
point: Vector3;
|
|
89
|
+
volume?: number;
|
|
90
|
+
};
|
|
91
|
+
growth?: number;
|
|
92
|
+
speed?: number;
|
|
93
|
+
fade?: number;
|
|
94
|
+
opacity?: number;
|
|
95
|
+
color?: ReactThreeFiber.Color;
|
|
96
|
+
} & React.RefAttributes<Group<import("three").Object3DEventMap>>>;
|
|
59
97
|
export {};
|
package/core/Cloud.js
CHANGED
|
@@ -92,17 +92,17 @@ const Clouds = /* @__PURE__ */React.forwardRef(({
|
|
|
92
92
|
const count = Math.min(limit, range !== undefined ? range : limit, clouds.current.length);
|
|
93
93
|
instance.current.count = count;
|
|
94
94
|
setUpdateRange(instance.current.instanceMatrix, {
|
|
95
|
-
|
|
95
|
+
start: 0,
|
|
96
96
|
count: count * 16
|
|
97
97
|
});
|
|
98
98
|
if (instance.current.instanceColor) {
|
|
99
99
|
setUpdateRange(instance.current.instanceColor, {
|
|
100
|
-
|
|
100
|
+
start: 0,
|
|
101
101
|
count: count * 3
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
104
|
setUpdateRange(instance.current.geometry.attributes.cloudOpacity, {
|
|
105
|
-
|
|
105
|
+
start: 0,
|
|
106
106
|
count: count
|
|
107
107
|
});
|
|
108
108
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("react"),r=require("three");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var 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)}var c=u(e),a=n(t);exports.ComputedAttribute=({compute:e,name:t,...u})=>{const[n]=a.useState((()=>new r.BufferAttribute(new Float32Array(0),1))),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("react"),r=require("three");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var 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)}var c=u(e),a=n(t);exports.ComputedAttribute=({compute:e,name:t,...u})=>{const[n]=a.useState((()=>new r.BufferAttribute(new Float32Array(0),1))),o=a.useRef(null);return a.useLayoutEffect((()=>{if(o.current){var t;const r=null!==(t=o.current.parent)&&void 0!==t?t:o.current.__r3f.parent.object,u=e(r);o.current.copy(u)}}),[e]),a.createElement("primitive",c.default({ref:o,object:n,attach:`attributes-${t}`},u))};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ThreeElements } from '@react-three/fiber';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { BufferAttribute, BufferGeometry } from 'three';
|
|
4
|
-
type
|
|
4
|
+
export type ComputedAttributeProps = Omit<ThreeElements['bufferAttribute'], 'args'> & {
|
|
5
5
|
compute: (geometry: BufferGeometry) => BufferAttribute;
|
|
6
6
|
name: string;
|
|
7
7
|
};
|
|
8
|
-
export declare const ComputedAttribute: ({ compute, name, ...props }:
|
|
9
|
-
export {};
|
|
8
|
+
export declare const ComputedAttribute: ({ compute, name, ...props }: ComputedAttributeProps) => React.JSX.Element;
|
|
@@ -18,7 +18,7 @@ const ComputedAttribute = ({
|
|
|
18
18
|
if (primitive.current) {
|
|
19
19
|
var _ref;
|
|
20
20
|
// @ts-expect-error brittle
|
|
21
|
-
const parent = (_ref = primitive.current.parent) !== null && _ref !== void 0 ? _ref : primitive.current.__r3f.parent;
|
|
21
|
+
const parent = (_ref = primitive.current.parent) !== null && _ref !== void 0 ? _ref : primitive.current.__r3f.parent.object;
|
|
22
22
|
const attr = compute(parent);
|
|
23
23
|
primitive.current.copy(attr);
|
|
24
24
|
}
|
package/core/ContactShadows.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
+
import { ThreeElements } from '@react-three/fiber';
|
|
2
3
|
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
3
|
-
export type ContactShadowsProps = {
|
|
4
|
+
export type ContactShadowsProps = Omit<ThreeElements['group'], 'ref' | 'scale'> & {
|
|
4
5
|
opacity?: number;
|
|
5
6
|
width?: number;
|
|
6
7
|
height?: number;
|
|
@@ -14,4 +15,4 @@ export type ContactShadowsProps = {
|
|
|
14
15
|
color?: THREE.ColorRepresentation;
|
|
15
16
|
depthWrite?: boolean;
|
|
16
17
|
};
|
|
17
|
-
export declare const ContactShadows: ForwardRefComponent<
|
|
18
|
+
export declare const ContactShadows: ForwardRefComponent<ContactShadowsProps, THREE.Group>;
|
package/core/CubeCamera.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import { Fog, FogExp2, Texture } from 'three';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
+
import { ThreeElements } from '@react-three/fiber';
|
|
4
5
|
export type CubeCameraOptions = {
|
|
5
6
|
resolution?: number;
|
|
6
7
|
near?: number;
|
|
@@ -13,9 +14,8 @@ export declare function useCubeCamera({ resolution, near, far, envMap, fog }?: C
|
|
|
13
14
|
camera: THREE.CubeCamera;
|
|
14
15
|
update: () => void;
|
|
15
16
|
};
|
|
16
|
-
type
|
|
17
|
+
export type CubeCameraProps = Omit<ThreeElements['group'], 'children'> & {
|
|
17
18
|
children?: (tex: Texture) => React.ReactNode;
|
|
18
19
|
frames?: number;
|
|
19
20
|
} & CubeCameraOptions;
|
|
20
|
-
export declare function CubeCamera({ children, frames, resolution, near, far, envMap, fog, ...props }:
|
|
21
|
-
export {};
|
|
21
|
+
export declare function CubeCamera({ children, frames, resolution, near, far, envMap, fog, ...props }: CubeCameraProps): React.JSX.Element;
|
package/core/CubeTexture.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { CubeTexture as _CubeTexture, Texture } from 'three';
|
|
3
|
-
type
|
|
3
|
+
export type CubeTextureOptions = {
|
|
4
4
|
path: string;
|
|
5
5
|
};
|
|
6
|
-
export declare function useCubeTexture(files: string[], { path }:
|
|
6
|
+
export declare function useCubeTexture(files: string[], { path }: CubeTextureOptions): _CubeTexture;
|
|
7
7
|
export declare namespace useCubeTexture {
|
|
8
|
-
var preload: (files: string[], { path }:
|
|
8
|
+
var preload: (files: string[], { path }: CubeTextureOptions) => void;
|
|
9
9
|
}
|
|
10
|
-
type CubeTextureProps = {
|
|
10
|
+
export type CubeTextureProps = CubeTextureOptions & {
|
|
11
11
|
children?: (tex: Texture) => React.ReactNode;
|
|
12
12
|
files: Parameters<typeof useCubeTexture>[0];
|
|
13
|
-
}
|
|
13
|
+
};
|
|
14
14
|
export declare function CubeTexture({ children, files, ...options }: CubeTextureProps): React.JSX.Element;
|
|
15
|
-
export {};
|
package/core/CubeTexture.js
CHANGED
|
@@ -5,17 +5,12 @@ import { useLoader } from '@react-three/fiber';
|
|
|
5
5
|
function useCubeTexture(files, {
|
|
6
6
|
path
|
|
7
7
|
}) {
|
|
8
|
-
|
|
9
|
-
const [cubeTexture] = useLoader(
|
|
10
|
-
// @ts-ignore
|
|
11
|
-
CubeTextureLoader, [files], loader => loader.setPath(path));
|
|
8
|
+
const [cubeTexture] = useLoader(CubeTextureLoader, [files], loader => loader.setPath(path));
|
|
12
9
|
return cubeTexture;
|
|
13
10
|
}
|
|
14
11
|
useCubeTexture.preload = (files, {
|
|
15
12
|
path
|
|
16
|
-
}) => useLoader.preload(
|
|
17
|
-
// @ts-ignore
|
|
18
|
-
CubeTextureLoader, [files], loader => loader.setPath(path));
|
|
13
|
+
}) => useLoader.preload(CubeTextureLoader, [files], loader => loader.setPath(path));
|
|
19
14
|
function CubeTexture({
|
|
20
15
|
children,
|
|
21
16
|
files,
|
|
@@ -2,12 +2,11 @@ import { Vector3 } from 'three';
|
|
|
2
2
|
import { Line2 } from 'three-stdlib';
|
|
3
3
|
import { LineProps } from './Line';
|
|
4
4
|
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
5
|
-
type
|
|
5
|
+
export type CubicBezierLineProps = Omit<LineProps, 'points' | 'ref'> & {
|
|
6
6
|
start: Vector3 | [number, number, number];
|
|
7
7
|
end: Vector3 | [number, number, number];
|
|
8
8
|
midA: Vector3 | [number, number, number];
|
|
9
9
|
midB: Vector3 | [number, number, number];
|
|
10
10
|
segments?: number;
|
|
11
11
|
};
|
|
12
|
-
export declare const CubicBezierLine: ForwardRefComponent<
|
|
13
|
-
export {};
|
|
12
|
+
export declare const CubicBezierLine: ForwardRefComponent<CubicBezierLineProps, Line2>;
|
package/core/CurveModifier.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as THREE from 'three';
|
|
3
|
+
import { ThreeElements } from '@react-three/fiber';
|
|
3
4
|
import { Flow } from 'three-stdlib';
|
|
4
5
|
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
5
6
|
export interface CurveModifierProps {
|
|
6
|
-
children: React.ReactElement<
|
|
7
|
+
children: React.ReactElement<ThreeElements['mesh']>;
|
|
7
8
|
curve?: THREE.Curve<THREE.Vector3>;
|
|
8
9
|
}
|
|
9
10
|
export type CurveModifierRef = Flow;
|
package/core/Decal.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import * as React from 'react';
|
|
|
2
2
|
import * as THREE from 'three';
|
|
3
3
|
import * as FIBER from '@react-three/fiber';
|
|
4
4
|
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
5
|
-
export type DecalProps = Omit<
|
|
5
|
+
export type DecalProps = Omit<FIBER.ThreeElements['mesh'], 'ref' | 'children'> & {
|
|
6
6
|
debug?: boolean;
|
|
7
|
-
mesh?: React.
|
|
7
|
+
mesh?: React.RefObject<THREE.Mesh>;
|
|
8
8
|
position?: FIBER.Vector3;
|
|
9
9
|
rotation?: FIBER.Euler | number;
|
|
10
10
|
scale?: FIBER.Vector3;
|
package/core/Detailed.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { LOD, Object3D } from 'three';
|
|
3
|
+
import { ThreeElements } from '@react-three/fiber';
|
|
3
4
|
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
4
|
-
type
|
|
5
|
+
export type DetailedProps = Omit<ThreeElements['lOD'], 'ref'> & {
|
|
5
6
|
children: React.ReactElement<Object3D>[];
|
|
6
7
|
hysteresis?: number;
|
|
7
8
|
distances: number[];
|
|
8
9
|
};
|
|
9
|
-
export declare const Detailed: ForwardRefComponent<
|
|
10
|
-
export {};
|
|
10
|
+
export declare const Detailed: ForwardRefComponent<DetailedProps, LOD>;
|
package/core/DetectGPU.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GetGPUTier } from 'detect-gpu';
|
|
3
3
|
export declare const useDetectGPU: (props?: GetGPUTier) => import("detect-gpu").TierResult;
|
|
4
|
-
type DetectGPUProps = {
|
|
4
|
+
export type DetectGPUProps = {
|
|
5
5
|
children?: (result: ReturnType<typeof useDetectGPU>) => React.ReactNode;
|
|
6
6
|
} & Parameters<typeof useDetectGPU>[0];
|
|
7
7
|
export declare function DetectGPU({ children, ...options }: DetectGPUProps): React.JSX.Element;
|
|
8
|
-
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ThreeElement } from '@react-three/fiber';
|
|
2
2
|
import * as THREE from 'three';
|
|
3
3
|
import { DeviceOrientationControls as DeviceOrientationControlsImp } from 'three-stdlib';
|
|
4
4
|
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
5
|
-
export type DeviceOrientationControlsProps =
|
|
5
|
+
export type DeviceOrientationControlsProps = Omit<ThreeElement<typeof DeviceOrientationControlsImp>, 'ref' | 'args'> & {
|
|
6
6
|
camera?: THREE.Camera;
|
|
7
7
|
onChange?: (e?: THREE.Event) => void;
|
|
8
8
|
makeDefault?: boolean;
|