@react-three/drei 9.83.9 → 9.84.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -5
- package/core/AccumulativeShadows.d.ts +3 -3
- package/core/AccumulativeShadows.js +30 -36
- package/core/AdaptiveDpr.js +4 -4
- package/core/ArcballControls.d.ts +1 -1
- package/core/ArcballControls.js +0 -1
- package/core/AsciiRenderer.d.ts +3 -3
- package/core/AsciiRenderer.js +12 -6
- package/core/BBAnchor.cjs.js +1 -1
- package/core/BBAnchor.d.ts +2 -2
- package/core/BBAnchor.js +5 -5
- package/core/Backdrop.d.ts +2 -2
- package/core/Backdrop.js +0 -3
- package/core/Billboard.d.ts +1 -1
- package/core/Billboard.js +6 -3
- package/core/Bounds.d.ts +5 -5
- package/core/Bounds.js +5 -32
- package/core/CameraControls.d.ts +2 -2
- package/core/CameraControls.js +0 -3
- package/core/CameraShake.js +0 -4
- package/core/CatmullRomLine.d.ts +1 -1
- package/core/CatmullRomLine.js +0 -2
- package/core/Caustics.d.ts +1 -1
- package/core/Caustics.js +31 -32
- package/core/Center.d.ts +2 -2
- package/core/Center.js +2 -1
- package/core/Clone.d.ts +1 -1
- package/core/Clone.js +10 -13
- package/core/Cloud.cjs.js +1 -1
- package/core/Cloud.d.ts +2 -2
- package/core/Cloud.js +1 -2
- package/core/ComputedAttribute.d.ts +2 -2
- package/core/ComputedAttribute.js +0 -1
- package/core/ContactShadows.d.ts +1 -1
- package/core/ContactShadows.js +6 -7
- package/core/CubeCamera.cjs.js +1 -1
- package/core/CubeCamera.d.ts +2 -2
- package/core/CubeCamera.js +1 -1
- package/core/CubicBezierLine.d.ts +1 -1
- package/core/CurveModifier.d.ts +1 -1
- package/core/CurveModifier.js +2 -4
- package/core/Decal.d.ts +1 -1
- package/core/Decal.js +8 -15
- package/core/Detailed.d.ts +1 -1
- package/core/Detailed.js +0 -1
- package/core/DeviceOrientationControls.d.ts +1 -1
- package/core/DeviceOrientationControls.js +3 -4
- package/core/Edges.d.ts +1 -1
- package/core/Edges.js +0 -2
- package/core/Effects.d.ts +1 -1
- package/core/Effects.js +5 -7
- package/core/Environment.d.ts +3 -3
- package/core/Environment.js +6 -12
- package/core/Example.d.ts +3 -3
- package/core/Example.js +2 -1
- package/core/FaceControls.cjs.js +1 -1
- package/core/FaceControls.d.ts +5 -5
- package/core/FaceControls.js +42 -39
- package/core/FaceLandmarker.d.ts +3 -2
- package/core/FaceLandmarker.js +1 -1
- package/core/Facemesh.d.ts +6 -6
- package/core/Facemesh.js +47 -53
- package/core/FirstPersonControls.d.ts +1 -1
- package/core/Float.d.ts +1 -1
- package/core/Float.js +0 -1
- package/core/FlyControls.d.ts +1 -1
- package/core/FlyControls.js +1 -2
- package/core/GizmoHelper.cjs.js +1 -1
- package/core/GizmoHelper.d.ts +2 -2
- package/core/GizmoHelper.js +18 -19
- package/core/GizmoViewcube.d.ts +3 -3
- package/core/GizmoViewcube.js +0 -14
- package/core/GizmoViewport.d.ts +3 -3
- package/core/GizmoViewport.js +0 -7
- package/core/Gltf.d.ts +1 -1
- package/core/GradientTexture.d.ts +3 -3
- package/core/GradientTexture.js +2 -5
- package/core/Grid.d.ts +2 -2
- package/core/Grid.js +2 -6
- package/core/Hud.d.ts +2 -2
- package/core/Hud.js +6 -9
- package/core/Image.d.ts +2 -2
- package/core/Image.js +4 -6
- package/core/Instances.d.ts +6 -6
- package/core/Instances.js +20 -35
- package/core/Lightformer.d.ts +1 -1
- package/core/Lightformer.js +4 -2
- package/core/Line.d.ts +1 -1
- package/core/Line.js +0 -3
- package/core/MapControls.d.ts +1 -1
- package/core/MapControls.js +0 -2
- package/core/MarchingCubes.d.ts +3 -3
- package/core/Mask.d.ts +1 -1
- package/core/MeshDistortMaterial.d.ts +2 -2
- package/core/MeshDistortMaterial.js +0 -9
- package/core/MeshPortalMaterial.d.ts +4 -4
- package/core/MeshPortalMaterial.js +22 -61
- package/core/MeshReflectorMaterial.d.ts +1 -1
- package/core/MeshReflectorMaterial.js +12 -14
- package/core/MeshRefractionMaterial.cjs.js +1 -1
- package/core/MeshRefractionMaterial.d.ts +3 -3
- package/core/MeshRefractionMaterial.js +9 -14
- package/core/MeshTransmissionMaterial.d.ts +2 -2
- package/core/MeshTransmissionMaterial.js +32 -33
- package/core/MeshWobbleMaterial.d.ts +2 -2
- package/core/MeshWobbleMaterial.js +0 -7
- package/core/MotionPathControls.cjs.js +1 -0
- package/core/MotionPathControls.d.ts +15 -0
- package/core/MotionPathControls.js +113 -0
- package/core/OrbitControls.d.ts +2 -2
- package/core/OrbitControls.js +0 -4
- package/core/OrthographicCamera.d.ts +1 -1
- package/core/OrthographicCamera.js +2 -3
- package/core/Outlines.cjs.js +1 -1
- package/core/Outlines.d.ts +3 -3
- package/core/Outlines.js +2 -7
- package/core/PerformanceMonitor.d.ts +4 -4
- package/core/PerformanceMonitor.js +8 -12
- package/core/PerspectiveCamera.d.ts +1 -1
- package/core/PerspectiveCamera.js +2 -3
- package/core/PointMaterial.d.ts +1 -1
- package/core/PointMaterial.js +0 -2
- package/core/PointerLockControls.d.ts +1 -1
- package/core/PointerLockControls.js +4 -6
- package/core/Points.d.ts +2 -2
- package/core/Points.js +6 -23
- package/core/PositionalAudio.d.ts +1 -1
- package/core/PositionalAudio.js +0 -5
- package/core/Preload.d.ts +1 -1
- package/core/Preload.js +8 -9
- package/core/QuadraticBezierLine.d.ts +2 -2
- package/core/QuadraticBezierLine.js +0 -2
- package/core/Reflector.d.ts +1 -1
- package/core/Reflector.js +11 -12
- package/core/RenderTexture.d.ts +1 -1
- package/core/RenderTexture.js +9 -11
- package/core/Resize.d.ts +2 -2
- package/core/RoundedBox.cjs.js +1 -1
- package/core/RoundedBox.d.ts +1 -1
- package/core/RoundedBox.js +1 -3
- package/core/Sampler.d.ts +5 -5
- package/core/Sampler.js +0 -10
- package/core/ScreenQuad.d.ts +1 -1
- package/core/ScreenQuad.js +0 -1
- package/core/ScreenSpace.d.ts +1 -1
- package/core/Segments.d.ts +2 -2
- package/core/Segments.js +0 -6
- package/core/Shadow.d.ts +1 -1
- package/core/Sky.d.ts +1 -1
- package/core/Sparkles.js +0 -10
- package/core/SpotLight.d.ts +2 -2
- package/core/SpotLight.js +3 -10
- package/core/SpriteAnimator.d.ts +1 -1
- package/core/SpriteAnimator.js +16 -34
- package/core/Stage.d.ts +4 -4
- package/core/Stage.js +2 -4
- package/core/Stars.d.ts +1 -1
- package/core/Stars.js +2 -11
- package/core/Stats.d.ts +1 -1
- package/core/Stats.js +2 -2
- package/core/StatsGl.d.ts +1 -1
- package/core/StatsGl.js +4 -3
- package/core/Svg.js +0 -2
- package/core/Text.d.ts +1 -1
- package/core/Text3D.d.ts +1 -1
- package/core/Text3D.js +1 -3
- package/core/TrackballControls.d.ts +1 -1
- package/core/TrackballControls.js +0 -1
- package/core/Trail.d.ts +3 -3
- package/core/Trail.js +6 -17
- package/core/TransformControls.d.ts +1 -1
- package/core/TransformControls.js +3 -9
- package/core/Wireframe.d.ts +1 -1
- package/core/Wireframe.js +0 -28
- package/core/index.cjs.js +1 -1
- package/core/index.d.ts +1 -0
- package/core/index.js +1 -0
- package/core/meshBounds.js +4 -14
- package/core/shaderMaterial.js +10 -9
- package/core/shapes.d.ts +2 -2
- package/core/shapes.js +3 -6
- package/core/softShadows.d.ts +1 -1
- package/core/softShadows.js +1 -4
- package/core/useAnimations.d.ts +1 -1
- package/core/useAnimations.js +2 -4
- package/core/useBVH.d.ts +1 -1
- package/core/useBVH.js +3 -4
- package/core/useBoxProjectedEnv.js +15 -22
- package/core/useCamera.js +0 -1
- package/core/useContextBridge.js +1 -2
- package/core/useCubeCamera.d.ts +1 -1
- package/core/useCubeTexture.d.ts +1 -1
- package/core/useCubeTexture.js +4 -3
- package/core/useEnvironment.cjs.js +1 -1
- package/core/useEnvironment.d.ts +2 -2
- package/core/useEnvironment.js +9 -11
- package/core/useFBO.d.ts +1 -1
- package/core/useFBO.js +3 -12
- package/core/useFBX.js +0 -2
- package/core/useFont.d.ts +2 -2
- package/core/useFont.js +0 -4
- package/core/useGLTF.d.ts +2 -2
- package/core/useGLTF.js +0 -8
- package/core/useHelper.d.ts +3 -3
- package/core/useHelper.js +2 -5
- package/core/useIntersect.js +5 -8
- package/core/useKTX2.js +3 -5
- package/core/useMatcapTexture.js +0 -6
- package/core/useNormalTexture.d.ts +1 -1
- package/core/useProgress.d.ts +1 -1
- package/core/useProgress.js +0 -5
- package/core/useTexture.js +4 -6
- package/core/useTrailTexture.d.ts +1 -1
- package/core/useTrailTexture.js +10 -21
- package/helpers/environment-assets.d.ts +1 -1
- package/helpers/ts-utils.d.ts +2 -2
- package/helpers/useEffectfulState.d.ts +1 -1
- package/helpers/useEffectfulState.js +0 -1
- package/index.cjs.js +1 -1
- package/index.js +1 -0
- package/materials/BlurPass.js +2 -5
- package/materials/ConvolutionMaterial.js +0 -3
- package/materials/MeshReflectorMaterial.d.ts +1 -1
- package/materials/MeshReflectorMaterial.js +0 -34
- package/materials/MeshRefractionMaterial.js +2 -6
- package/materials/SpotLightMaterial.js +2 -7
- package/materials/WireframeMaterial.js +7 -25
- package/native/index.cjs.js +1 -1
- package/native/index.js +1 -0
- package/package.json +2 -2
- package/react-three-drei-0.0.0-semantic-release.tgz +0 -0
- package/web/CycleRaycast.d.ts +1 -1
- package/web/CycleRaycast.js +20 -24
- package/web/Html.d.ts +2 -2
- package/web/Html.js +6 -50
- package/web/KeyboardControls.d.ts +10 -10
- package/web/KeyboardControls.js +9 -6
- package/web/Loader.d.ts +2 -2
- package/web/Loader.js +8 -5
- package/web/PresentationControls.d.ts +2 -2
- package/web/PresentationControls.js +2 -1
- package/web/ScrollControls.d.ts +4 -4
- package/web/ScrollControls.js +5 -16
- package/web/Select.d.ts +3 -3
- package/web/Select.js +6 -17
- package/web/View.d.ts +5 -5
- package/web/View.js +7 -20
- package/web/index.cjs.js +1 -1
- package/web/index.js +1 -0
- package/web/pivotControls/AxisArrow.js +6 -15
- package/web/pivotControls/AxisRotator.js +8 -23
- package/web/pivotControls/PlaneSlider.js +6 -16
- package/web/pivotControls/context.d.ts +2 -2
- package/web/pivotControls/index.d.ts +1 -1
- package/web/pivotControls/index.js +2 -9
|
@@ -29,8 +29,8 @@ const PointerLockControls = /*#__PURE__*/React.forwardRef(({
|
|
|
29
29
|
const controls = React.useMemo(() => new PointerLockControls$1(explCamera), [explCamera]);
|
|
30
30
|
React.useEffect(() => {
|
|
31
31
|
if (enabled) {
|
|
32
|
-
controls.connect(explDomElement);
|
|
33
|
-
|
|
32
|
+
controls.connect(explDomElement);
|
|
33
|
+
// Force events to be centered while PLC is active
|
|
34
34
|
const oldComputeOffsets = get().events.compute;
|
|
35
35
|
setEvents({
|
|
36
36
|
compute(event, state) {
|
|
@@ -39,7 +39,6 @@ const PointerLockControls = /*#__PURE__*/React.forwardRef(({
|
|
|
39
39
|
state.pointer.set(offsetX / state.size.width * 2 - 1, -(offsetY / state.size.height) * 2 + 1);
|
|
40
40
|
state.raycaster.setFromCamera(state.pointer, state.camera);
|
|
41
41
|
}
|
|
42
|
-
|
|
43
42
|
});
|
|
44
43
|
return () => {
|
|
45
44
|
controls.disconnect();
|
|
@@ -54,13 +53,12 @@ const PointerLockControls = /*#__PURE__*/React.forwardRef(({
|
|
|
54
53
|
invalidate();
|
|
55
54
|
if (onChange) onChange(e);
|
|
56
55
|
};
|
|
57
|
-
|
|
58
56
|
controls.addEventListener('change', callback);
|
|
59
57
|
if (onLock) controls.addEventListener('lock', onLock);
|
|
60
|
-
if (onUnlock) controls.addEventListener('unlock', onUnlock);
|
|
58
|
+
if (onUnlock) controls.addEventListener('unlock', onUnlock);
|
|
61
59
|
|
|
60
|
+
// Enforce previous interaction
|
|
62
61
|
const handler = () => controls.lock();
|
|
63
|
-
|
|
64
62
|
const elements = selector ? Array.from(document.querySelectorAll(selector)) : [document];
|
|
65
63
|
elements.forEach(element => element && element.addEventListener('click', handler));
|
|
66
64
|
return () => {
|
package/core/Points.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ declare global {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
type PointsInstancesProps = JSX.IntrinsicElements['points'] & {
|
|
13
13
|
range?: number;
|
|
14
14
|
limit?: number;
|
|
15
15
|
};
|
|
@@ -23,7 +23,7 @@ export declare class PositionPoint extends THREE.Group {
|
|
|
23
23
|
raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection[]): void;
|
|
24
24
|
}
|
|
25
25
|
export declare const Point: ForwardRefComponent<JSX.IntrinsicElements['positionPoint'], PositionPoint>;
|
|
26
|
-
|
|
26
|
+
type PointsBuffersProps = JSX.IntrinsicElements['points'] & {
|
|
27
27
|
positions: Float32Array;
|
|
28
28
|
colors?: Float32Array;
|
|
29
29
|
sizes?: Float32Array;
|
package/core/Points.js
CHANGED
|
@@ -5,13 +5,9 @@ import { extend, useFrame } from '@react-three/fiber';
|
|
|
5
5
|
import mergeRefs from 'react-merge-refs';
|
|
6
6
|
|
|
7
7
|
const _inverseMatrix = /*@__PURE__*/new THREE.Matrix4();
|
|
8
|
-
|
|
9
8
|
const _ray = /*@__PURE__*/new THREE.Ray();
|
|
10
|
-
|
|
11
9
|
const _sphere = /*@__PURE__*/new THREE.Sphere();
|
|
12
|
-
|
|
13
10
|
const _position = /*@__PURE__*/new THREE.Vector3();
|
|
14
|
-
|
|
15
11
|
class PositionPoint extends THREE.Group {
|
|
16
12
|
constructor() {
|
|
17
13
|
super();
|
|
@@ -23,43 +19,31 @@ class PositionPoint extends THREE.Group {
|
|
|
23
19
|
this.instanceKey = {
|
|
24
20
|
current: undefined
|
|
25
21
|
};
|
|
26
|
-
}
|
|
27
|
-
|
|
22
|
+
}
|
|
28
23
|
|
|
24
|
+
// This will allow the virtual instance have bounds
|
|
29
25
|
get geometry() {
|
|
30
26
|
var _this$instance$curren;
|
|
31
|
-
|
|
32
27
|
return (_this$instance$curren = this.instance.current) == null ? void 0 : _this$instance$curren.geometry;
|
|
33
28
|
}
|
|
34
|
-
|
|
35
29
|
raycast(raycaster, intersects) {
|
|
36
30
|
var _raycaster$params$Poi, _raycaster$params$Poi2;
|
|
37
|
-
|
|
38
31
|
const parent = this.instance.current;
|
|
39
32
|
if (!parent || !parent.geometry) return;
|
|
40
|
-
const instanceId = parent.userData.instances.indexOf(this.instanceKey);
|
|
41
|
-
|
|
33
|
+
const instanceId = parent.userData.instances.indexOf(this.instanceKey);
|
|
34
|
+
// If the instance wasn't found or exceeds the parents draw range, bail out
|
|
42
35
|
if (instanceId === -1 || instanceId > parent.geometry.drawRange.count) return;
|
|
43
36
|
const threshold = (_raycaster$params$Poi = (_raycaster$params$Poi2 = raycaster.params.Points) == null ? void 0 : _raycaster$params$Poi2.threshold) !== null && _raycaster$params$Poi !== void 0 ? _raycaster$params$Poi : 1;
|
|
44
|
-
|
|
45
37
|
_sphere.set(this.getWorldPosition(_position), threshold);
|
|
46
|
-
|
|
47
38
|
if (raycaster.ray.intersectsSphere(_sphere) === false) return;
|
|
48
|
-
|
|
49
39
|
_inverseMatrix.copy(parent.matrixWorld).invert();
|
|
50
|
-
|
|
51
40
|
_ray.copy(raycaster.ray).applyMatrix4(_inverseMatrix);
|
|
52
|
-
|
|
53
41
|
const localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3);
|
|
54
42
|
const localThresholdSq = localThreshold * localThreshold;
|
|
55
|
-
|
|
56
43
|
const rayPointDistanceSq = _ray.distanceSqToPoint(this.position);
|
|
57
|
-
|
|
58
44
|
if (rayPointDistanceSq < localThresholdSq) {
|
|
59
45
|
const intersectPoint = new THREE.Vector3();
|
|
60
|
-
|
|
61
46
|
_ray.closestPointToPoint(this.position, intersectPoint);
|
|
62
|
-
|
|
63
47
|
intersectPoint.applyMatrix4(this.matrixWorld);
|
|
64
48
|
const distance = raycaster.ray.origin.distanceTo(intersectPoint);
|
|
65
49
|
if (distance < raycaster.near || distance > raycaster.far) return;
|
|
@@ -73,16 +57,15 @@ class PositionPoint extends THREE.Group {
|
|
|
73
57
|
});
|
|
74
58
|
}
|
|
75
59
|
}
|
|
76
|
-
|
|
77
60
|
}
|
|
78
61
|
let i, positionRef;
|
|
79
62
|
const context = /*@__PURE__*/React.createContext(null);
|
|
80
63
|
const parentMatrix = /*@__PURE__*/new THREE.Matrix4();
|
|
81
64
|
const position = /*@__PURE__*/new THREE.Vector3();
|
|
65
|
+
|
|
82
66
|
/**
|
|
83
67
|
* Instance implementation, relies on react + context to update the attributes based on the children of this component
|
|
84
68
|
*/
|
|
85
|
-
|
|
86
69
|
const PointsInstances = /*#__PURE__*/React.forwardRef(({
|
|
87
70
|
children,
|
|
88
71
|
range,
|
|
@@ -105,7 +88,6 @@ const PointsInstances = /*#__PURE__*/React.forwardRef(({
|
|
|
105
88
|
parentRef.current.updateMatrixWorld();
|
|
106
89
|
parentMatrix.copy(parentRef.current.matrixWorld).invert();
|
|
107
90
|
parentRef.current.geometry.drawRange.count = Math.min(limit, range !== undefined ? range : limit, refs.length);
|
|
108
|
-
|
|
109
91
|
for (i = 0; i < refs.length; i++) {
|
|
110
92
|
positionRef = refs[i].current;
|
|
111
93
|
positionRef.getWorldPosition(position).applyMatrix4(parentMatrix);
|
|
@@ -173,6 +155,7 @@ const Point = /*#__PURE__*/React.forwardRef(({
|
|
|
173
155
|
ref: mergeRefs([ref, group])
|
|
174
156
|
}, props), children);
|
|
175
157
|
});
|
|
158
|
+
|
|
176
159
|
/**
|
|
177
160
|
* Buffer implementation, relies on complete buffers of the correct number, leaves it to the user to update them
|
|
178
161
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PositionalAudio as PositionalAudioImpl } from 'three';
|
|
2
2
|
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
3
|
-
|
|
3
|
+
type Props = JSX.IntrinsicElements['positionalAudio'] & {
|
|
4
4
|
url: string;
|
|
5
5
|
distance?: number;
|
|
6
6
|
loop?: boolean;
|
package/core/PositionalAudio.js
CHANGED
|
@@ -19,14 +19,10 @@ const PositionalAudio = /*#__PURE__*/React.forwardRef(({
|
|
|
19
19
|
const buffer = useLoader(AudioLoader, url);
|
|
20
20
|
React.useEffect(() => {
|
|
21
21
|
const _sound = sound.current;
|
|
22
|
-
|
|
23
22
|
if (_sound) {
|
|
24
23
|
_sound.setBuffer(buffer);
|
|
25
|
-
|
|
26
24
|
_sound.setRefDistance(distance);
|
|
27
|
-
|
|
28
25
|
_sound.setLoop(loop);
|
|
29
|
-
|
|
30
26
|
if (autoplay && !_sound.isPlaying) _sound.play();
|
|
31
27
|
}
|
|
32
28
|
}, [buffer, camera, distance, loop]);
|
|
@@ -35,7 +31,6 @@ const PositionalAudio = /*#__PURE__*/React.forwardRef(({
|
|
|
35
31
|
camera.add(listener);
|
|
36
32
|
return () => {
|
|
37
33
|
camera.remove(listener);
|
|
38
|
-
|
|
39
34
|
if (_sound) {
|
|
40
35
|
if (_sound.isPlaying) _sound.stop();
|
|
41
36
|
if (_sound.source && _sound.source._connected) _sound.disconnect();
|
package/core/Preload.d.ts
CHANGED
package/core/Preload.js
CHANGED
|
@@ -15,11 +15,11 @@ function Preload({
|
|
|
15
15
|
}) => camera);
|
|
16
16
|
const dScene = useThree(({
|
|
17
17
|
scene
|
|
18
|
-
}) => scene);
|
|
18
|
+
}) => scene);
|
|
19
19
|
|
|
20
|
+
// Layout effect because it must run before React commits
|
|
20
21
|
React.useLayoutEffect(() => {
|
|
21
22
|
const invisible = [];
|
|
22
|
-
|
|
23
23
|
if (all) {
|
|
24
24
|
(scene || dScene).traverse(object => {
|
|
25
25
|
if (object.visible === false) {
|
|
@@ -27,16 +27,15 @@ function Preload({
|
|
|
27
27
|
object.visible = true;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
}
|
|
31
|
+
// Now compile the scene
|
|
32
|
+
gl.compile(scene || dScene, camera || dCamera);
|
|
33
|
+
// And for good measure, hit it with a cube camera
|
|
35
34
|
const cubeRenderTarget = new WebGLCubeRenderTarget(128);
|
|
36
35
|
const cubeCamera = new CubeCamera(0.01, 100000, cubeRenderTarget);
|
|
37
36
|
cubeCamera.update(gl, scene || dScene);
|
|
38
|
-
cubeRenderTarget.dispose();
|
|
39
|
-
|
|
37
|
+
cubeRenderTarget.dispose();
|
|
38
|
+
// Flips these objects back
|
|
40
39
|
invisible.forEach(object => object.visible = false);
|
|
41
40
|
}, []);
|
|
42
41
|
return null;
|
|
@@ -3,13 +3,13 @@ import { Line2 } from 'three-stdlib';
|
|
|
3
3
|
import { LineProps } from './Line';
|
|
4
4
|
import { Object3DNode } from '@react-three/fiber';
|
|
5
5
|
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
6
|
-
|
|
6
|
+
type Props = Omit<LineProps, 'points' | 'ref'> & {
|
|
7
7
|
start: Vector3 | [number, number, number];
|
|
8
8
|
end: Vector3 | [number, number, number];
|
|
9
9
|
mid?: Vector3 | [number, number, number];
|
|
10
10
|
segments?: number;
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export type Line2Props = Object3DNode<Line2, typeof Line2> & {
|
|
13
13
|
setPoints: (start: Vector3 | [number, number, number], end: Vector3 | [number, number, number], mid: Vector3 | [number, number, number]) => void;
|
|
14
14
|
};
|
|
15
15
|
export declare const QuadraticBezierLine: ForwardRefComponent<Props, Line2Props>;
|
|
@@ -17,7 +17,6 @@ const QuadraticBezierLine = /*#__PURE__*/React.forwardRef(function QuadraticBezi
|
|
|
17
17
|
const getPoints = React.useCallback((start, end, mid, segments = 20) => {
|
|
18
18
|
if (start instanceof Vector3) curve.v0.copy(start);else curve.v0.set(...start);
|
|
19
19
|
if (end instanceof Vector3) curve.v2.copy(end);else curve.v2.set(...end);
|
|
20
|
-
|
|
21
20
|
if (mid instanceof Vector3) {
|
|
22
21
|
curve.v1.copy(mid);
|
|
23
22
|
} else if (Array.isArray(mid)) {
|
|
@@ -25,7 +24,6 @@ const QuadraticBezierLine = /*#__PURE__*/React.forwardRef(function QuadraticBezi
|
|
|
25
24
|
} else {
|
|
26
25
|
curve.v1.copy(curve.v0.clone().add(curve.v2.clone().sub(curve.v0)).add(v.set(0, curve.v0.y - curve.v2.y, 0)));
|
|
27
26
|
}
|
|
28
|
-
|
|
29
27
|
return curve.getPoints(segments);
|
|
30
28
|
}, []);
|
|
31
29
|
React.useLayoutEffect(() => {
|
package/core/Reflector.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { Mesh, Texture } from 'three';
|
|
3
3
|
import { MeshReflectorMaterialProps } from '../materials/MeshReflectorMaterial';
|
|
4
4
|
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
5
|
-
export
|
|
5
|
+
export type ReflectorProps = Omit<JSX.IntrinsicElements['mesh'], 'args' | 'children'> & Pick<JSX.IntrinsicElements['planeGeometry'], 'args'> & {
|
|
6
6
|
resolution?: number;
|
|
7
7
|
mixBlur?: number;
|
|
8
8
|
mixStrength?: number;
|
package/core/Reflector.js
CHANGED
|
@@ -9,10 +9,10 @@ import { MeshReflectorMaterial } from '../materials/MeshReflectorMaterial.js';
|
|
|
9
9
|
extend({
|
|
10
10
|
MeshReflectorMaterial
|
|
11
11
|
});
|
|
12
|
+
|
|
12
13
|
/**
|
|
13
14
|
* @deprecated Use MeshReflectorMaterial instead
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
16
|
const Reflector = /*#__PURE__*/React.forwardRef(({
|
|
17
17
|
mixBlur = 0,
|
|
18
18
|
mixStrength = 0.5,
|
|
@@ -64,8 +64,8 @@ const Reflector = /*#__PURE__*/React.forwardRef(({
|
|
|
64
64
|
rotationMatrix.extractRotation(meshRef.current.matrixWorld);
|
|
65
65
|
normal.set(0, 0, 1);
|
|
66
66
|
normal.applyMatrix4(rotationMatrix);
|
|
67
|
-
view.subVectors(reflectorWorldPosition, cameraWorldPosition);
|
|
68
|
-
|
|
67
|
+
view.subVectors(reflectorWorldPosition, cameraWorldPosition);
|
|
68
|
+
// Avoid rendering when reflector is facing away
|
|
69
69
|
if (view.dot(normal) > 0) return;
|
|
70
70
|
view.reflect(normal).negate();
|
|
71
71
|
view.add(reflectorWorldPosition);
|
|
@@ -82,16 +82,15 @@ const Reflector = /*#__PURE__*/React.forwardRef(({
|
|
|
82
82
|
virtualCamera.up.reflect(normal);
|
|
83
83
|
virtualCamera.lookAt(target);
|
|
84
84
|
virtualCamera.far = camera.far; // Used in WebGLBackground
|
|
85
|
-
|
|
86
85
|
virtualCamera.updateMatrixWorld();
|
|
87
|
-
virtualCamera.projectionMatrix.copy(camera.projectionMatrix);
|
|
88
|
-
|
|
86
|
+
virtualCamera.projectionMatrix.copy(camera.projectionMatrix);
|
|
87
|
+
// Update the texture matrix
|
|
89
88
|
textureMatrix.set(0.5, 0.0, 0.0, 0.5, 0.0, 0.5, 0.0, 0.5, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 1.0);
|
|
90
89
|
textureMatrix.multiply(virtualCamera.projectionMatrix);
|
|
91
90
|
textureMatrix.multiply(virtualCamera.matrixWorldInverse);
|
|
92
|
-
textureMatrix.multiply(meshRef.current.matrixWorld);
|
|
91
|
+
textureMatrix.multiply(meshRef.current.matrixWorld);
|
|
92
|
+
// Now update projection matrix with new clip plane, implementing code from: http://www.terathon.com/code/oblique.html
|
|
93
93
|
// Paper explaining this technique: http://www.terathon.com/lengyel/Lengyel-Oblique.pdf
|
|
94
|
-
|
|
95
94
|
reflectorPlane.setFromNormalAndCoplanarPoint(normal, reflectorWorldPosition);
|
|
96
95
|
reflectorPlane.applyMatrix4(virtualCamera.matrixWorldInverse);
|
|
97
96
|
clipPlane.set(reflectorPlane.normal.x, reflectorPlane.normal.y, reflectorPlane.normal.z, reflectorPlane.constant);
|
|
@@ -99,10 +98,10 @@ const Reflector = /*#__PURE__*/React.forwardRef(({
|
|
|
99
98
|
q.x = (Math.sign(clipPlane.x) + projectionMatrix.elements[8]) / projectionMatrix.elements[0];
|
|
100
99
|
q.y = (Math.sign(clipPlane.y) + projectionMatrix.elements[9]) / projectionMatrix.elements[5];
|
|
101
100
|
q.z = -1.0;
|
|
102
|
-
q.w = (1.0 + projectionMatrix.elements[10]) / projectionMatrix.elements[14];
|
|
103
|
-
|
|
104
|
-
clipPlane.multiplyScalar(2.0 / clipPlane.dot(q));
|
|
105
|
-
|
|
101
|
+
q.w = (1.0 + projectionMatrix.elements[10]) / projectionMatrix.elements[14];
|
|
102
|
+
// Calculate the scaled plane vector
|
|
103
|
+
clipPlane.multiplyScalar(2.0 / clipPlane.dot(q));
|
|
104
|
+
// Replacing the third row of the projection matrix
|
|
106
105
|
projectionMatrix.elements[2] = clipPlane.x;
|
|
107
106
|
projectionMatrix.elements[6] = clipPlane.y;
|
|
108
107
|
projectionMatrix.elements[10] = clipPlane.z + 1.0;
|
package/core/RenderTexture.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
4
|
-
|
|
4
|
+
type Props = JSX.IntrinsicElements['texture'] & {
|
|
5
5
|
width?: number;
|
|
6
6
|
height?: number;
|
|
7
7
|
samples?: number;
|
package/core/RenderTexture.js
CHANGED
|
@@ -31,23 +31,20 @@ const RenderTexture = /*#__PURE__*/React.forwardRef(({
|
|
|
31
31
|
const [vScene] = React.useState(() => new THREE.Scene());
|
|
32
32
|
const uvCompute = React.useCallback((event, state, previous) => {
|
|
33
33
|
var _fbo$texture, _previous$previousRoo;
|
|
34
|
-
|
|
35
34
|
// Since this is only a texture it does not have an easy way to obtain the parent, which we
|
|
36
35
|
// need to transform event coordinates to local coordinates. We use r3f internals to find the
|
|
37
36
|
// next Object3D.
|
|
38
37
|
let parent = (_fbo$texture = fbo.texture) == null ? void 0 : _fbo$texture.__r3f.parent;
|
|
39
|
-
|
|
40
38
|
while (parent && !(parent instanceof THREE.Object3D)) {
|
|
41
39
|
parent = parent.__r3f.parent;
|
|
42
40
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
if (!parent) return false;
|
|
42
|
+
// First we call the previous state-onion-layers compute, this is what makes it possible to nest portals
|
|
43
|
+
if (!previous.raycaster.camera) previous.events.compute(event, previous, (_previous$previousRoo = previous.previousRoot) == null ? void 0 : _previous$previousRoo.getState());
|
|
44
|
+
// We run a quick check against the parent, if it isn't hit there's no need to raycast at all
|
|
48
45
|
const [intersection] = previous.raycaster.intersectObject(parent);
|
|
49
|
-
if (!intersection) return false;
|
|
50
|
-
|
|
46
|
+
if (!intersection) return false;
|
|
47
|
+
// We take that hits uv coords, set up this layers raycaster, et voilà, we have raycasting on arbitrary surfaces
|
|
51
48
|
const uv = intersection.uv;
|
|
52
49
|
if (!uv) return false;
|
|
53
50
|
state.raycaster.setFromCamera(state.pointer.set(uv.x * 2 - 1, uv.y * 2 - 1), state.camera);
|
|
@@ -67,10 +64,11 @@ const RenderTexture = /*#__PURE__*/React.forwardRef(({
|
|
|
67
64
|
}), /*#__PURE__*/React.createElement("primitive", _extends({
|
|
68
65
|
object: fbo.texture
|
|
69
66
|
}, props)));
|
|
70
|
-
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// The container component has to be separate, it can not be inlined because "useFrame(state" when run inside createPortal will return
|
|
71
70
|
// the portals own state which includes user-land overrides (custom cameras etc), but if it is executed in <RenderTexture>'s render function
|
|
72
71
|
// it would return the default state.
|
|
73
|
-
|
|
74
72
|
function Container({
|
|
75
73
|
frames,
|
|
76
74
|
renderPriority,
|
package/core/Resize.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
export
|
|
3
|
+
export type ResizeProps = JSX.IntrinsicElements['group'] & {
|
|
4
4
|
width?: boolean;
|
|
5
5
|
height?: boolean;
|
|
6
6
|
depth?: boolean;
|
|
7
7
|
box3?: THREE.Box3;
|
|
8
8
|
precise?: boolean;
|
|
9
9
|
};
|
|
10
|
-
export declare const Resize: React.ForwardRefExoticComponent<
|
|
10
|
+
export declare const Resize: React.ForwardRefExoticComponent<Omit<ResizeProps, "ref"> & React.RefAttributes<THREE.Group>>;
|
package/core/RoundedBox.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("three-stdlib");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function a(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 u=s(e),c=a(t);const o=1e-5;const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("react"),r=require("three"),n=require("three-stdlib");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function a(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 u=s(e),c=a(t);const o=1e-5;const l=c.forwardRef((function({args:[e=1,t=1,s=1]=[],radius:a=.05,steps:l=1,smoothness:f=4,bevelSegments:i=4,creaseAngle:b=.4,children:d,...h},m){const p=c.useMemo((()=>function(e,t,n){const s=new r.Shape,a=n-o;return s.absarc(o,o,o,-Math.PI/2,-Math.PI,!0),s.absarc(o,t-2*a,o,Math.PI,Math.PI/2,!0),s.absarc(e-2*a,t-2*a,o,Math.PI/2,0,!0),s.absarc(e-2*a,o,o,0,-Math.PI/2,!0),s}(e,t,a)),[e,t,a]),v=c.useMemo((()=>({depth:s-2*a,bevelEnabled:!0,bevelSegments:2*i,steps:l,bevelSize:a-o,bevelThickness:a,curveSegments:f})),[s,a,f]),M=c.useRef(null);return c.useLayoutEffect((()=>{M.current&&(M.current.center(),n.toCreasedNormals(M.current,b))}),[p,v]),c.createElement("mesh",u.default({ref:m},h),c.createElement("extrudeGeometry",{ref:M,args:[p,v]}),d)}));exports.RoundedBox=l;
|
package/core/RoundedBox.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Mesh } from 'three';
|
|
2
2
|
import { ForwardRefComponent, NamedArrayTuple } from '../helpers/ts-utils';
|
|
3
|
-
|
|
3
|
+
type Props = {
|
|
4
4
|
args?: NamedArrayTuple<(width?: number, height?: number, depth?: number) => void>;
|
|
5
5
|
radius?: number;
|
|
6
6
|
smoothness?: number;
|
package/core/RoundedBox.js
CHANGED
|
@@ -4,7 +4,6 @@ import { Shape } from 'three';
|
|
|
4
4
|
import { toCreasedNormals } from 'three-stdlib';
|
|
5
5
|
|
|
6
6
|
const eps = 0.00001;
|
|
7
|
-
|
|
8
7
|
function createShape(width, height, radius0) {
|
|
9
8
|
const shape = new Shape();
|
|
10
9
|
const radius = radius0 - eps;
|
|
@@ -14,7 +13,6 @@ function createShape(width, height, radius0) {
|
|
|
14
13
|
shape.absarc(width - radius * 2, eps, eps, 0, -Math.PI / 2, true);
|
|
15
14
|
return shape;
|
|
16
15
|
}
|
|
17
|
-
|
|
18
16
|
const RoundedBox = /*#__PURE__*/React.forwardRef(function RoundedBox({
|
|
19
17
|
args: [width = 1, height = 1, depth = 1] = [],
|
|
20
18
|
radius = 0.05,
|
|
@@ -35,7 +33,7 @@ const RoundedBox = /*#__PURE__*/React.forwardRef(function RoundedBox({
|
|
|
35
33
|
bevelThickness: radius,
|
|
36
34
|
curveSegments: smoothness
|
|
37
35
|
}), [depth, radius, smoothness]);
|
|
38
|
-
const geomRef = React.useRef();
|
|
36
|
+
const geomRef = React.useRef(null);
|
|
39
37
|
React.useLayoutEffect(() => {
|
|
40
38
|
if (geomRef.current) {
|
|
41
39
|
geomRef.current.center();
|
package/core/Sampler.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Color, InstancedBufferAttribute, InstancedMesh, Mesh, Object3D, Vector3 } from 'three';
|
|
3
3
|
import { GroupProps } from '@react-three/fiber';
|
|
4
|
-
|
|
4
|
+
type SamplePayload = {
|
|
5
5
|
position: Vector3;
|
|
6
6
|
normal: Vector3;
|
|
7
7
|
color: Color;
|
|
8
8
|
};
|
|
9
|
-
export
|
|
10
|
-
|
|
9
|
+
export type TransformFn = (payload: TransformPayload, i: number) => void;
|
|
10
|
+
type TransformPayload = SamplePayload & {
|
|
11
11
|
dummy: Object3D;
|
|
12
12
|
sampledMesh: Mesh;
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
type Props = {
|
|
15
15
|
mesh?: React.RefObject<Mesh>;
|
|
16
16
|
instances?: React.RefObject<InstancedMesh>;
|
|
17
17
|
weight?: string;
|
|
@@ -24,5 +24,5 @@ export interface useSurfaceSamplerProps {
|
|
|
24
24
|
count?: number;
|
|
25
25
|
}
|
|
26
26
|
export declare function useSurfaceSampler(mesh: React.MutableRefObject<Mesh>, count?: number, transform?: TransformFn, weight?: string, instanceMesh?: React.MutableRefObject<InstancedMesh> | null): InstancedBufferAttribute;
|
|
27
|
-
export declare function Sampler({ children, weight, transform, instances, mesh, count, ...props }: React.PropsWithChildren<Props & GroupProps>): JSX.Element;
|
|
27
|
+
export declare function Sampler({ children, weight, transform, instances, mesh, count, ...props }: React.PropsWithChildren<Props & GroupProps>): React.JSX.Element;
|
|
28
28
|
export {};
|
package/core/Sampler.js
CHANGED
|
@@ -13,21 +13,17 @@ function useSurfaceSampler(mesh, count = 16, transform, weight, instanceMesh) {
|
|
|
13
13
|
React.useLayoutEffect(() => {
|
|
14
14
|
if (typeof mesh.current === 'undefined') return;
|
|
15
15
|
const sampler = new MeshSurfaceSampler(mesh.current);
|
|
16
|
-
|
|
17
16
|
if (weight) {
|
|
18
17
|
sampler.setWeightAttribute(weight);
|
|
19
18
|
}
|
|
20
|
-
|
|
21
19
|
sampler.build();
|
|
22
20
|
const position = new Vector3();
|
|
23
21
|
const normal = new Vector3();
|
|
24
22
|
const color = new Color();
|
|
25
23
|
const dummy = new Object3D();
|
|
26
24
|
mesh.current.updateMatrixWorld(true);
|
|
27
|
-
|
|
28
25
|
for (let i = 0; i < count; i++) {
|
|
29
26
|
sampler.sample(position, normal, color);
|
|
30
|
-
|
|
31
27
|
if (typeof transform === 'function') {
|
|
32
28
|
transform({
|
|
33
29
|
dummy,
|
|
@@ -39,20 +35,15 @@ function useSurfaceSampler(mesh, count = 16, transform, weight, instanceMesh) {
|
|
|
39
35
|
} else {
|
|
40
36
|
dummy.position.copy(position);
|
|
41
37
|
}
|
|
42
|
-
|
|
43
38
|
dummy.updateMatrix();
|
|
44
|
-
|
|
45
39
|
if (instanceMesh != null && instanceMesh.current) {
|
|
46
40
|
instanceMesh.current.setMatrixAt(i, dummy.matrix);
|
|
47
41
|
}
|
|
48
|
-
|
|
49
42
|
dummy.matrix.toArray(buffer.array, i * 16);
|
|
50
43
|
}
|
|
51
|
-
|
|
52
44
|
if (instanceMesh != null && instanceMesh.current) {
|
|
53
45
|
instanceMesh.current.instanceMatrix.needsUpdate = true;
|
|
54
46
|
}
|
|
55
|
-
|
|
56
47
|
buffer.needsUpdate = true;
|
|
57
48
|
setBuffer(buffer.clone());
|
|
58
49
|
}, [mesh, instanceMesh, weight, count, transform]);
|
|
@@ -72,7 +63,6 @@ function Sampler({
|
|
|
72
63
|
const meshToSampleRef = React.useRef(null);
|
|
73
64
|
React.useLayoutEffect(() => {
|
|
74
65
|
var _instances$current, _mesh$current;
|
|
75
|
-
|
|
76
66
|
instancedRef.current = (_instances$current = instances == null ? void 0 : instances.current) !== null && _instances$current !== void 0 ? _instances$current : group.current.children.find(c => c.hasOwnProperty('instanceMatrix'));
|
|
77
67
|
meshToSampleRef.current = (_mesh$current = mesh == null ? void 0 : mesh.current) !== null && _mesh$current !== void 0 ? _mesh$current : group.current.children.find(c => c.type === 'Mesh');
|
|
78
68
|
}, [children, mesh == null ? void 0 : mesh.current, instances == null ? void 0 : instances.current]);
|
package/core/ScreenQuad.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
3
|
-
|
|
3
|
+
type Props = Omit<JSX.IntrinsicElements['mesh'], 'args'>;
|
|
4
4
|
export declare const ScreenQuad: ForwardRefComponent<Props, THREE.Mesh>;
|
|
5
5
|
export {};
|
package/core/ScreenQuad.js
CHANGED
package/core/ScreenSpace.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Group } from 'three';
|
|
2
2
|
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
3
|
-
export
|
|
3
|
+
export type ScreenSpaceProps = {
|
|
4
4
|
depth?: number;
|
|
5
5
|
} & JSX.IntrinsicElements['group'];
|
|
6
6
|
export declare const ScreenSpace: ForwardRefComponent<ScreenSpaceProps, Group>;
|
package/core/Segments.d.ts
CHANGED
|
@@ -3,12 +3,12 @@ import * as React from 'react';
|
|
|
3
3
|
import { ReactThreeFiber } from '@react-three/fiber';
|
|
4
4
|
import { Line2 } from 'three-stdlib';
|
|
5
5
|
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
6
|
-
|
|
6
|
+
type SegmentsProps = {
|
|
7
7
|
limit?: number;
|
|
8
8
|
lineWidth?: number;
|
|
9
9
|
children: React.ReactNode;
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
type SegmentProps = Omit<JSX.IntrinsicElements['segmentObject'], 'start' | 'end' | 'color'> & {
|
|
12
12
|
start: ReactThreeFiber.Vector3;
|
|
13
13
|
end: ReactThreeFiber.Vector3;
|
|
14
14
|
color?: ReactThreeFiber.Color;
|
package/core/Segments.js
CHANGED
|
@@ -32,9 +32,7 @@ const Segments = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
32
32
|
useFrame(() => {
|
|
33
33
|
for (let i = 0; i < limit; i++) {
|
|
34
34
|
var _segments$i;
|
|
35
|
-
|
|
36
35
|
const segment = (_segments$i = segments[i]) == null ? void 0 : _segments$i.current;
|
|
37
|
-
|
|
38
36
|
if (segment) {
|
|
39
37
|
positions[i * 6 + 0] = segment.start.x;
|
|
40
38
|
positions[i * 6 + 1] = segment.start.y;
|
|
@@ -50,7 +48,6 @@ const Segments = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
|
50
48
|
colors[i * 6 + 5] = segment.color.b;
|
|
51
49
|
}
|
|
52
50
|
}
|
|
53
|
-
|
|
54
51
|
geometry.setColors(colors);
|
|
55
52
|
geometry.setPositions(positions);
|
|
56
53
|
line.computeLineDistances();
|
|
@@ -77,11 +74,8 @@ class SegmentObject {
|
|
|
77
74
|
this.start = new THREE.Vector3(0, 0, 0);
|
|
78
75
|
this.end = new THREE.Vector3(0, 0, 0);
|
|
79
76
|
}
|
|
80
|
-
|
|
81
77
|
}
|
|
82
|
-
|
|
83
78
|
const normPos = pos => pos instanceof THREE.Vector3 ? pos : new THREE.Vector3(...(typeof pos === 'number' ? [pos, pos, pos] : pos));
|
|
84
|
-
|
|
85
79
|
const Segment = /*#__PURE__*/React.forwardRef(({
|
|
86
80
|
color,
|
|
87
81
|
start,
|
package/core/Shadow.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Mesh, Color } from 'three';
|
|
2
2
|
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
3
|
-
|
|
3
|
+
type Props = JSX.IntrinsicElements['mesh'] & {
|
|
4
4
|
colorStop?: number;
|
|
5
5
|
fog?: boolean;
|
|
6
6
|
color?: Color | number | string;
|
package/core/Sky.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ReactThreeFiber } from '@react-three/fiber';
|
|
|
2
2
|
import { Sky as SkyImpl } from 'three-stdlib';
|
|
3
3
|
import { Vector3 } from 'three';
|
|
4
4
|
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
5
|
-
|
|
5
|
+
type Props = {
|
|
6
6
|
distance?: number;
|
|
7
7
|
sunPosition?: ReactThreeFiber.Vector3;
|
|
8
8
|
inclination?: number;
|