@ericchen1990/pano-view 3.6.0 → 3.6.2
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 +3 -1
- package/README.zh-CN.md +1 -1
- package/dist/index.cjs +567 -322
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +447 -202
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2641,6 +2641,7 @@ var PanoramaViewRuntime = (0, import_react3.forwardRef)(function PanoramaViewRun
|
|
|
2641
2641
|
const { camera, gl } = (0, import_fiber.useThree)();
|
|
2642
2642
|
const xrSession = (0, import_xr.useXR)((state) => state.session);
|
|
2643
2643
|
const xrSessionRef = (0, import_react3.useRef)(xrSession);
|
|
2644
|
+
const pointerRevisionRef = (0, import_react3.useRef)(0);
|
|
2644
2645
|
const viewRef = (0, import_react3.useRef)({ ...initialView });
|
|
2645
2646
|
const targetViewRef = (0, import_react3.useRef)({ ...initialView });
|
|
2646
2647
|
const initialViewRef = (0, import_react3.useRef)({ ...initialView });
|
|
@@ -2735,6 +2736,7 @@ var PanoramaViewRuntime = (0, import_react3.forwardRef)(function PanoramaViewRun
|
|
|
2735
2736
|
};
|
|
2736
2737
|
const acquireInteractionLock = () => {
|
|
2737
2738
|
cancelNavigation();
|
|
2739
|
+
pointerRevisionRef.current += 1;
|
|
2738
2740
|
interactionLockCountRef.current += 1;
|
|
2739
2741
|
stopVelocity();
|
|
2740
2742
|
if (mouseActiveRef.current) {
|
|
@@ -2766,6 +2768,7 @@ var PanoramaViewRuntime = (0, import_react3.forwardRef)(function PanoramaViewRun
|
|
|
2766
2768
|
legacyFovRef.current.maxFov
|
|
2767
2769
|
);
|
|
2768
2770
|
if (JSON.stringify(next) === JSON.stringify(limitsRef.current)) return;
|
|
2771
|
+
pointerRevisionRef.current += 1;
|
|
2769
2772
|
limitsRef.current = next;
|
|
2770
2773
|
cancelNavigation();
|
|
2771
2774
|
stopVelocity();
|
|
@@ -2781,6 +2784,7 @@ var PanoramaViewRuntime = (0, import_react3.forwardRef)(function PanoramaViewRun
|
|
|
2781
2784
|
};
|
|
2782
2785
|
const setView = (view, setOptions) => {
|
|
2783
2786
|
cancelNavigation();
|
|
2787
|
+
pointerRevisionRef.current += 1;
|
|
2784
2788
|
const nextView = hardConstrainView(view);
|
|
2785
2789
|
if (gyroActiveRef.current) {
|
|
2786
2790
|
gyroOffsetRef.current = {
|
|
@@ -2800,6 +2804,7 @@ var PanoramaViewRuntime = (0, import_react3.forwardRef)(function PanoramaViewRun
|
|
|
2800
2804
|
if (xrSessionRef.current != null || gyroActiveRef.current || interactionLockCountRef.current > 0) {
|
|
2801
2805
|
return Promise.resolve({ status: "cancelled" });
|
|
2802
2806
|
}
|
|
2807
|
+
pointerRevisionRef.current += 1;
|
|
2803
2808
|
const from = { ...viewRef.current };
|
|
2804
2809
|
const safeTargetInput = {
|
|
2805
2810
|
yaw: targetInput.yaw !== void 0 && Number.isFinite(targetInput.yaw) ? targetInput.yaw : from.yaw,
|
|
@@ -2864,19 +2869,24 @@ var PanoramaViewRuntime = (0, import_react3.forwardRef)(function PanoramaViewRun
|
|
|
2864
2869
|
return false;
|
|
2865
2870
|
}
|
|
2866
2871
|
const current = targetViewRef.current;
|
|
2872
|
+
const origin = !gyroActiveRef.current ? applyOptions?.pointerOrigin : void 0;
|
|
2873
|
+
const reference = origin ?? current;
|
|
2867
2874
|
const gyroMode = gyroTouchModeRef.current;
|
|
2868
2875
|
const gyroControlsView = gyroActiveRef.current;
|
|
2869
2876
|
const appliesTouchMode = gyroControlsView && applyOptions?.source === "touch";
|
|
2870
2877
|
const acceptsYaw = !appliesTouchMode || gyroMode === "horizontaloffset" || gyroMode === "full";
|
|
2871
2878
|
const acceptsPitch = !appliesTouchMode || gyroMode === "full";
|
|
2872
|
-
const nextYaw = acceptsYaw && delta.yaw !== void 0 && Number.isFinite(delta.yaw) ? applyLimitedYawDelta(
|
|
2873
|
-
const nextPitch = acceptsPitch && delta.pitch !== void 0 && Number.isFinite(delta.pitch) ?
|
|
2879
|
+
const nextYaw = acceptsYaw && delta.yaw !== void 0 && Number.isFinite(delta.yaw) ? applyLimitedYawDelta(reference.yaw, delta.yaw, limitsRef.current.yaw) : current.yaw;
|
|
2880
|
+
const nextPitch = acceptsPitch && delta.pitch !== void 0 && Number.isFinite(delta.pitch) ? reference.pitch + delta.pitch : current.pitch;
|
|
2874
2881
|
const nextFov = delta.fov !== void 0 && Number.isFinite(delta.fov) ? current.fov + delta.fov : current.fov;
|
|
2875
2882
|
targetViewRef.current = softConstrainView({
|
|
2876
2883
|
yaw: nextYaw,
|
|
2877
2884
|
pitch: nextPitch,
|
|
2878
2885
|
fov: nextFov
|
|
2879
2886
|
});
|
|
2887
|
+
if (origin) {
|
|
2888
|
+
viewRef.current = { ...viewRef.current, yaw: targetViewRef.current.yaw, pitch: targetViewRef.current.pitch };
|
|
2889
|
+
}
|
|
2880
2890
|
if (gyroControlsView) {
|
|
2881
2891
|
if (acceptsYaw && delta.yaw !== void 0 && Number.isFinite(delta.yaw)) {
|
|
2882
2892
|
gyroOffsetRef.current.yaw = shortestYawDelta(gyroPoseRef.current.yaw, targetViewRef.current.yaw);
|
|
@@ -2886,16 +2896,21 @@ var PanoramaViewRuntime = (0, import_react3.forwardRef)(function PanoramaViewRun
|
|
|
2886
2896
|
}
|
|
2887
2897
|
}
|
|
2888
2898
|
markDirty();
|
|
2889
|
-
|
|
2899
|
+
const releaseVelocity = applyOptions?.velocity;
|
|
2900
|
+
if (!gyroControlsView && releaseVelocity && Number.isFinite(releaseVelocity.yaw) && Number.isFinite(releaseVelocity.pitch)) {
|
|
2901
|
+
yawVelocityRef.current = releaseVelocity.yaw;
|
|
2902
|
+
pitchVelocityRef.current = releaseVelocity.pitch;
|
|
2903
|
+
lastVelocitySampleAtRef.current = performance.now();
|
|
2904
|
+
} else if (applyOptions?.recordVelocity && !gyroControlsView) {
|
|
2890
2905
|
const now = performance.now();
|
|
2891
2906
|
const previousAt = lastVelocitySampleAtRef.current;
|
|
2892
2907
|
const elapsed = previousAt === null ? 1 / 60 : Math.max((now - previousAt) / 1e3, 1 / 120);
|
|
2893
2908
|
lastVelocitySampleAtRef.current = now;
|
|
2894
2909
|
if (delta.yaw !== void 0 && Number.isFinite(delta.yaw)) {
|
|
2895
|
-
yawVelocityRef.current =
|
|
2910
|
+
yawVelocityRef.current = limitedYawDelta(current.yaw, targetViewRef.current.yaw, limitsRef.current.yaw) / elapsed;
|
|
2896
2911
|
}
|
|
2897
2912
|
if (delta.pitch !== void 0 && Number.isFinite(delta.pitch)) {
|
|
2898
|
-
pitchVelocityRef.current =
|
|
2913
|
+
pitchVelocityRef.current = (targetViewRef.current.pitch - current.pitch) / elapsed;
|
|
2899
2914
|
}
|
|
2900
2915
|
if (delta.fov !== void 0 && Number.isFinite(delta.fov)) {
|
|
2901
2916
|
zoomVelocityRef.current = clamp(delta.fov / elapsed, -180, 180);
|
|
@@ -2909,6 +2924,7 @@ var PanoramaViewRuntime = (0, import_react3.forwardRef)(function PanoramaViewRun
|
|
|
2909
2924
|
ref,
|
|
2910
2925
|
() => ({
|
|
2911
2926
|
getView: () => ({ ...viewRef.current }),
|
|
2927
|
+
getPointerDragState: () => ({ revision: pointerRevisionRef.current, anchored: !gyroActiveRef.current && xrSessionRef.current == null }),
|
|
2912
2928
|
setSceneViewLimits: (limits) => {
|
|
2913
2929
|
sceneLimitsRef.current = parseViewLimits(limits);
|
|
2914
2930
|
refreshLimits();
|
|
@@ -2948,6 +2964,9 @@ var PanoramaViewRuntime = (0, import_react3.forwardRef)(function PanoramaViewRun
|
|
|
2948
2964
|
}
|
|
2949
2965
|
syncInteracting();
|
|
2950
2966
|
if (active && !wasActive) {
|
|
2967
|
+
if (!gyroActiveRef.current) {
|
|
2968
|
+
targetViewRef.current = { ...targetViewRef.current, yaw: viewRef.current.yaw, pitch: viewRef.current.pitch };
|
|
2969
|
+
}
|
|
2951
2970
|
eventBusRef.current.emit("viewinteractionstart", { source });
|
|
2952
2971
|
} else if (!active && wasActive) {
|
|
2953
2972
|
eventBusRef.current.emit("viewinteractionend", { source });
|
|
@@ -2967,6 +2986,7 @@ var PanoramaViewRuntime = (0, import_react3.forwardRef)(function PanoramaViewRun
|
|
|
2967
2986
|
isInteractionLocked: () => interactionLockCountRef.current > 0,
|
|
2968
2987
|
isUserInteracting,
|
|
2969
2988
|
setGyroActive: (active) => {
|
|
2989
|
+
if (gyroActiveRef.current !== active) pointerRevisionRef.current += 1;
|
|
2970
2990
|
if (active) {
|
|
2971
2991
|
cancelNavigation();
|
|
2972
2992
|
}
|
|
@@ -3716,6 +3736,216 @@ function KeyboardControls({
|
|
|
3716
3736
|
// src/mouse-controls.tsx
|
|
3717
3737
|
var import_fiber4 = require("@react-three/fiber");
|
|
3718
3738
|
var import_react9 = require("react");
|
|
3739
|
+
|
|
3740
|
+
// src/pointer-drag.ts
|
|
3741
|
+
var import_three2 = require("three");
|
|
3742
|
+
var DEFAULT_POINTER_DRAG_SPEED = 0.35;
|
|
3743
|
+
var POINTER_FOLLOW_TIME_SECONDS = 0.01;
|
|
3744
|
+
var MIN_VELOCITY_SAMPLE_SECONDS = 1 / 120;
|
|
3745
|
+
function pointerReleaseVelocity(samples, releasedAt, solve, maxAgeMs = POINTER_VELOCITY_MAX_AGE_MS) {
|
|
3746
|
+
if (samples.length < 2) return { yaw: 0, pitch: 0 };
|
|
3747
|
+
const newest = samples[samples.length - 1];
|
|
3748
|
+
if (releasedAt < newest.at || releasedAt - newest.at > maxAgeMs) return { yaw: 0, pitch: 0 };
|
|
3749
|
+
let oldest = newest;
|
|
3750
|
+
for (let index = samples.length - 1; index >= 0; index -= 1) {
|
|
3751
|
+
const sample = samples[index];
|
|
3752
|
+
if (releasedAt - sample.at <= maxAgeMs) oldest = sample;
|
|
3753
|
+
else break;
|
|
3754
|
+
}
|
|
3755
|
+
if (oldest === newest) return { yaw: 0, pitch: 0 };
|
|
3756
|
+
const elapsed = Math.max((newest.at - oldest.at) / 1e3, MIN_VELOCITY_SAMPLE_SECONDS);
|
|
3757
|
+
const from = solve(oldest);
|
|
3758
|
+
const to = solve(newest);
|
|
3759
|
+
return {
|
|
3760
|
+
yaw: normalizeViewYaw(to.yaw - from.yaw) / elapsed,
|
|
3761
|
+
pitch: (to.pitch - from.pitch) / elapsed
|
|
3762
|
+
};
|
|
3763
|
+
}
|
|
3764
|
+
var PointerDragAnchor = class {
|
|
3765
|
+
constructor(start, origin, rect, projection) {
|
|
3766
|
+
this.start = start;
|
|
3767
|
+
this.origin = origin;
|
|
3768
|
+
this.rect = rect;
|
|
3769
|
+
this.projection = projection;
|
|
3770
|
+
this.local = new import_three2.Vector3();
|
|
3771
|
+
this.rotation = new import_three2.Euler(0, 0, 0, "YXZ");
|
|
3772
|
+
this.anchor = this.ray(start).clone().applyEuler(this.rotation.set(
|
|
3773
|
+
import_three2.MathUtils.degToRad(origin.pitch),
|
|
3774
|
+
import_three2.MathUtils.degToRad(-origin.yaw),
|
|
3775
|
+
0,
|
|
3776
|
+
"YXZ"
|
|
3777
|
+
));
|
|
3778
|
+
}
|
|
3779
|
+
ray(point) {
|
|
3780
|
+
return this.local.set(
|
|
3781
|
+
(point.x - this.rect.left) / Math.max(this.rect.width, 1) * 2 - 1,
|
|
3782
|
+
1 - (point.y - this.rect.top) / Math.max(this.rect.height, 1) * 2,
|
|
3783
|
+
0.5
|
|
3784
|
+
).applyMatrix4(this.projection.projectionMatrixInverse).normalize();
|
|
3785
|
+
}
|
|
3786
|
+
solve(point, speed = DEFAULT_POINTER_DRAG_SPEED, invert = false) {
|
|
3787
|
+
const multiplier = (Number.isFinite(speed) && speed >= 0 ? speed : DEFAULT_POINTER_DRAG_SPEED) / DEFAULT_POINTER_DRAG_SPEED * (invert ? -1 : 1);
|
|
3788
|
+
if (multiplier === 0) return { yaw: 0, pitch: 0 };
|
|
3789
|
+
const ray = this.ray({
|
|
3790
|
+
x: this.start.x + (point.x - this.start.x) * multiplier,
|
|
3791
|
+
y: this.start.y + (point.y - this.start.y) * multiplier
|
|
3792
|
+
});
|
|
3793
|
+
const latitude = Math.asin(import_three2.MathUtils.clamp(this.anchor.y / Math.max(Math.hypot(ray.y, ray.z), 1e-12), -1, 1));
|
|
3794
|
+
const offset = Math.atan2(ray.y, -ray.z);
|
|
3795
|
+
const originPitch = import_three2.MathUtils.degToRad(this.origin.pitch);
|
|
3796
|
+
const candidates = [latitude - offset, Math.PI - latitude - offset, -Math.PI - latitude - offset];
|
|
3797
|
+
let pitch = candidates[0];
|
|
3798
|
+
let distance = Infinity;
|
|
3799
|
+
for (const candidate of candidates) {
|
|
3800
|
+
const bounded = import_three2.MathUtils.clamp(candidate, -Math.PI / 2, Math.PI / 2);
|
|
3801
|
+
const nextDistance = Math.abs(candidate - bounded) * 10 + Math.abs(bounded - originPitch);
|
|
3802
|
+
if (nextDistance < distance) {
|
|
3803
|
+
pitch = bounded;
|
|
3804
|
+
distance = nextDistance;
|
|
3805
|
+
}
|
|
3806
|
+
}
|
|
3807
|
+
const z = Math.sin(pitch) * ray.y + Math.cos(pitch) * ray.z;
|
|
3808
|
+
const yaw = import_three2.MathUtils.radToDeg(Math.atan2(this.anchor.x, -this.anchor.z) - Math.atan2(ray.x, -z));
|
|
3809
|
+
return { yaw: normalizeViewYaw(yaw - this.origin.yaw), pitch: import_three2.MathUtils.radToDeg(pitch) - this.origin.pitch };
|
|
3810
|
+
}
|
|
3811
|
+
};
|
|
3812
|
+
function createPointerDrag(camera, element, runtime, source) {
|
|
3813
|
+
let anchor;
|
|
3814
|
+
let revision = -1;
|
|
3815
|
+
let projectionKey = "";
|
|
3816
|
+
let pending;
|
|
3817
|
+
let displayed;
|
|
3818
|
+
let lastPoint;
|
|
3819
|
+
let fresh = false;
|
|
3820
|
+
let lastFrameDelta = 1 / 60;
|
|
3821
|
+
let samples = [];
|
|
3822
|
+
let gestureSpeed = DEFAULT_POINTER_DRAG_SPEED;
|
|
3823
|
+
let gestureInvert = false;
|
|
3824
|
+
const key = (rect) => `${rect.left},${rect.top},${rect.width},${rect.height},${camera.projectionMatrix.elements.join(",")}`;
|
|
3825
|
+
const place = (point) => {
|
|
3826
|
+
const handle = runtime();
|
|
3827
|
+
displayed = { ...point };
|
|
3828
|
+
lastPoint = { ...point };
|
|
3829
|
+
pending = void 0;
|
|
3830
|
+
revision = handle?.getPointerDragState().revision ?? -1;
|
|
3831
|
+
anchor = void 0;
|
|
3832
|
+
if (!(camera instanceof import_three2.PerspectiveCamera) || !handle?.getPointerDragState().anchored) return;
|
|
3833
|
+
const rect = element.getBoundingClientRect();
|
|
3834
|
+
projectionKey = key(rect);
|
|
3835
|
+
anchor = new PointerDragAnchor(point, handle.getView(), rect, camera.clone());
|
|
3836
|
+
};
|
|
3837
|
+
const remember = (point, at) => {
|
|
3838
|
+
samples.push({ x: point.x, y: point.y, at });
|
|
3839
|
+
const cutoff = at - POINTER_VELOCITY_MAX_AGE_MS;
|
|
3840
|
+
while (samples.length > 2 && samples[0].at < cutoff) samples.shift();
|
|
3841
|
+
};
|
|
3842
|
+
const apply = (point, previous, speed, invert, recordVelocity, releaseVelocity) => {
|
|
3843
|
+
const handle = runtime();
|
|
3844
|
+
if (!handle) return;
|
|
3845
|
+
const rect = element.getBoundingClientRect();
|
|
3846
|
+
if (anchor && key(rect) !== projectionKey) {
|
|
3847
|
+
const queued = pending;
|
|
3848
|
+
place(displayed ?? previous);
|
|
3849
|
+
pending = queued;
|
|
3850
|
+
}
|
|
3851
|
+
const options = {
|
|
3852
|
+
recordVelocity: releaseVelocity ? false : recordVelocity,
|
|
3853
|
+
source,
|
|
3854
|
+
...releaseVelocity ? { velocity: releaseVelocity } : {}
|
|
3855
|
+
};
|
|
3856
|
+
if (anchor) {
|
|
3857
|
+
handle.applyViewDelta(anchor.solve(point, speed, invert), {
|
|
3858
|
+
...options,
|
|
3859
|
+
pointerOrigin: anchor.origin
|
|
3860
|
+
});
|
|
3861
|
+
} else {
|
|
3862
|
+
handle.applyViewDelta({
|
|
3863
|
+
yaw: -(point.x - previous.x) * 360 * speed / Math.max(rect.width, 1) * (invert ? -1 : 1),
|
|
3864
|
+
pitch: (point.y - previous.y) * 180 * speed / Math.max(rect.height, 1) * (invert ? -1 : 1)
|
|
3865
|
+
}, options);
|
|
3866
|
+
}
|
|
3867
|
+
};
|
|
3868
|
+
const valid = () => revision === (runtime()?.getPointerDragState().revision ?? -1) && !runtime()?.isInteractionLocked();
|
|
3869
|
+
const clear = () => {
|
|
3870
|
+
anchor = void 0;
|
|
3871
|
+
revision = -1;
|
|
3872
|
+
pending = void 0;
|
|
3873
|
+
displayed = void 0;
|
|
3874
|
+
samples = [];
|
|
3875
|
+
};
|
|
3876
|
+
return {
|
|
3877
|
+
start(point, at = performance.now()) {
|
|
3878
|
+
gestureSpeed = DEFAULT_POINTER_DRAG_SPEED;
|
|
3879
|
+
gestureInvert = false;
|
|
3880
|
+
samples = [];
|
|
3881
|
+
remember(point, at);
|
|
3882
|
+
place(point);
|
|
3883
|
+
},
|
|
3884
|
+
valid,
|
|
3885
|
+
clear,
|
|
3886
|
+
suspend: () => {
|
|
3887
|
+
anchor = void 0;
|
|
3888
|
+
pending = void 0;
|
|
3889
|
+
displayed = void 0;
|
|
3890
|
+
samples = [];
|
|
3891
|
+
},
|
|
3892
|
+
move(point, previous, speed, invert, at = performance.now()) {
|
|
3893
|
+
fresh = true;
|
|
3894
|
+
gestureSpeed = speed;
|
|
3895
|
+
gestureInvert = invert;
|
|
3896
|
+
remember(point, at);
|
|
3897
|
+
pending = { point, previous: lastPoint ?? previous, speed, invert };
|
|
3898
|
+
},
|
|
3899
|
+
flush(deltaSeconds = lastFrameDelta, immediate = false, releaseVelocity) {
|
|
3900
|
+
if (deltaSeconds > 0) lastFrameDelta = deltaSeconds;
|
|
3901
|
+
if (!pending) return;
|
|
3902
|
+
const sample = pending;
|
|
3903
|
+
if (!anchor || immediate) {
|
|
3904
|
+
pending = void 0;
|
|
3905
|
+
apply(sample.point, sample.previous, sample.speed, sample.invert, fresh, releaseVelocity);
|
|
3906
|
+
fresh = false;
|
|
3907
|
+
lastPoint = sample.point;
|
|
3908
|
+
displayed = sample.point;
|
|
3909
|
+
return;
|
|
3910
|
+
}
|
|
3911
|
+
const dt = deltaSeconds > 0 ? deltaSeconds : lastFrameDelta;
|
|
3912
|
+
const previousDisplay = displayed ?? sample.previous;
|
|
3913
|
+
const dx = sample.point.x - previousDisplay.x;
|
|
3914
|
+
const dy = sample.point.y - previousDisplay.y;
|
|
3915
|
+
const distance = Math.hypot(dx, dy);
|
|
3916
|
+
const ratio = distance > 0.01 ? POINTER_FOLLOW_TIME_SECONDS / (POINTER_FOLLOW_TIME_SECONDS + dt) : 0;
|
|
3917
|
+
const point = { x: sample.point.x - dx * ratio, y: sample.point.y - dy * ratio };
|
|
3918
|
+
apply(point, sample.previous, sample.speed, sample.invert, fresh);
|
|
3919
|
+
fresh = false;
|
|
3920
|
+
lastPoint = sample.point;
|
|
3921
|
+
displayed = point;
|
|
3922
|
+
if (ratio === 0) pending = void 0;
|
|
3923
|
+
},
|
|
3924
|
+
release() {
|
|
3925
|
+
const handle = runtime();
|
|
3926
|
+
if (!handle || !valid()) {
|
|
3927
|
+
clear();
|
|
3928
|
+
return;
|
|
3929
|
+
}
|
|
3930
|
+
const newestAt = samples[samples.length - 1]?.at ?? 0;
|
|
3931
|
+
const velocity = pointerReleaseVelocity(samples, Math.max(performance.now(), newestAt), (point) => {
|
|
3932
|
+
if (anchor) return anchor.solve(point, gestureSpeed, gestureInvert);
|
|
3933
|
+
const origin = samples[0] ?? point;
|
|
3934
|
+
const rect = element.getBoundingClientRect();
|
|
3935
|
+
const sign = gestureInvert ? -1 : 1;
|
|
3936
|
+
return {
|
|
3937
|
+
yaw: -(point.x - origin.x) * 360 * gestureSpeed / Math.max(rect.width, 1) * sign,
|
|
3938
|
+
pitch: (point.y - origin.y) * 180 * gestureSpeed / Math.max(rect.height, 1) * sign
|
|
3939
|
+
};
|
|
3940
|
+
});
|
|
3941
|
+
if (pending) this.flush(lastFrameDelta, true, velocity);
|
|
3942
|
+
else handle.applyViewDelta({}, { velocity, source });
|
|
3943
|
+
clear();
|
|
3944
|
+
}
|
|
3945
|
+
};
|
|
3946
|
+
}
|
|
3947
|
+
|
|
3948
|
+
// src/mouse-controls.tsx
|
|
3719
3949
|
var DEFAULT_ROTATE_SPEED2 = 0.35;
|
|
3720
3950
|
var DEFAULT_ZOOM_SPEED2 = 0.08;
|
|
3721
3951
|
var BUTTON_FLAG = {
|
|
@@ -3726,6 +3956,9 @@ var BUTTON_FLAG = {
|
|
|
3726
3956
|
function resolveSpeed2(value, fallback) {
|
|
3727
3957
|
return Number.isFinite(value) && value >= 0 ? value : fallback;
|
|
3728
3958
|
}
|
|
3959
|
+
function pointerAt(event) {
|
|
3960
|
+
return event.timeStamp > 0 ? event.timeStamp : performance.now();
|
|
3961
|
+
}
|
|
3729
3962
|
function resolveButtons(buttons) {
|
|
3730
3963
|
const list = buttons && buttons.length > 0 ? buttons : ["left"];
|
|
3731
3964
|
return new Set(list.map((button) => BUTTON_FLAG[button]));
|
|
@@ -3741,7 +3974,9 @@ function MouseControls({
|
|
|
3741
3974
|
}) {
|
|
3742
3975
|
useClaimControlChannel("mouse");
|
|
3743
3976
|
const controlsRef = (0, import_react9.useContext)(PanoramaViewContext);
|
|
3744
|
-
const { gl } = (0, import_fiber4.useThree)();
|
|
3977
|
+
const { gl, camera } = (0, import_fiber4.useThree)();
|
|
3978
|
+
const validateDragRef = (0, import_react9.useRef)(void 0);
|
|
3979
|
+
(0, import_fiber4.useFrame)((_, delta) => validateDragRef.current?.(delta), -1);
|
|
3745
3980
|
const pointersRef = (0, import_react9.useRef)(
|
|
3746
3981
|
/* @__PURE__ */ new Map()
|
|
3747
3982
|
);
|
|
@@ -3764,6 +3999,7 @@ function MouseControls({
|
|
|
3764
3999
|
};
|
|
3765
4000
|
(0, import_react9.useEffect)(() => {
|
|
3766
4001
|
const element = gl.domElement;
|
|
4002
|
+
const drag = createPointerDrag(camera, element, () => controlsRef.current, "mouse");
|
|
3767
4003
|
const allowedButtons = resolveButtons(buttons);
|
|
3768
4004
|
const clearPointers = () => {
|
|
3769
4005
|
for (const pointerId of pointersRef.current.keys()) {
|
|
@@ -3772,8 +4008,13 @@ function MouseControls({
|
|
|
3772
4008
|
}
|
|
3773
4009
|
}
|
|
3774
4010
|
pointersRef.current.clear();
|
|
4011
|
+
drag.clear();
|
|
3775
4012
|
controlsRef.current?.setPointerActive("mouse", false, { cancelled: true });
|
|
3776
4013
|
};
|
|
4014
|
+
validateDragRef.current = (delta) => {
|
|
4015
|
+
if (pointersRef.current.size && !drag.valid()) clearPointers();
|
|
4016
|
+
else drag.flush(delta);
|
|
4017
|
+
};
|
|
3777
4018
|
if (!enabled) {
|
|
3778
4019
|
clearPointers();
|
|
3779
4020
|
return;
|
|
@@ -3804,6 +4045,7 @@ function MouseControls({
|
|
|
3804
4045
|
});
|
|
3805
4046
|
element.setPointerCapture?.(event.pointerId);
|
|
3806
4047
|
syncActive();
|
|
4048
|
+
drag.start({ x: event.clientX, y: event.clientY }, pointerAt(event));
|
|
3807
4049
|
};
|
|
3808
4050
|
const onPointerMove = (event) => {
|
|
3809
4051
|
if (!isMouseLike(event)) {
|
|
@@ -3823,23 +4065,15 @@ function MouseControls({
|
|
|
3823
4065
|
at: performance.now()
|
|
3824
4066
|
};
|
|
3825
4067
|
pointersRef.current.set(event.pointerId, next);
|
|
3826
|
-
const
|
|
3827
|
-
|
|
3828
|
-
optionsRef.current.rotateSpeed,
|
|
3829
|
-
DEFAULT_ROTATE_SPEED2
|
|
3830
|
-
);
|
|
3831
|
-
const sign = optionsRef.current.invert ? -1 : 1;
|
|
3832
|
-
const deltaYaw = sign * -(next.x - previous.x) * 360 * speed / Math.max(rect.width, 1);
|
|
3833
|
-
const deltaPitch = sign * (next.y - previous.y) * 180 * speed / Math.max(rect.height, 1);
|
|
3834
|
-
controlsRef.current?.applyViewDelta(
|
|
3835
|
-
{ yaw: deltaYaw, pitch: deltaPitch },
|
|
3836
|
-
{ recordVelocity: true, source: "mouse" }
|
|
3837
|
-
);
|
|
4068
|
+
const speed = resolveSpeed2(optionsRef.current.rotateSpeed, DEFAULT_ROTATE_SPEED2);
|
|
4069
|
+
drag.move(next, previous, speed, optionsRef.current.invert, pointerAt(event));
|
|
3838
4070
|
};
|
|
3839
4071
|
const releasePointer = (event) => {
|
|
3840
4072
|
if (!pointersRef.current.has(event.pointerId)) {
|
|
3841
4073
|
return;
|
|
3842
4074
|
}
|
|
4075
|
+
if (event.type === "pointerup") drag.release();
|
|
4076
|
+
else drag.clear();
|
|
3843
4077
|
pointersRef.current.delete(event.pointerId);
|
|
3844
4078
|
if (element.hasPointerCapture?.(event.pointerId)) {
|
|
3845
4079
|
element.releasePointerCapture?.(event.pointerId);
|
|
@@ -3876,6 +4110,7 @@ function MouseControls({
|
|
|
3876
4110
|
element.addEventListener("lostpointercapture", releasePointer);
|
|
3877
4111
|
element.addEventListener("wheel", onWheel, { passive: false });
|
|
3878
4112
|
return () => {
|
|
4113
|
+
validateDragRef.current = void 0;
|
|
3879
4114
|
element.removeEventListener("pointerdown", onPointerDown);
|
|
3880
4115
|
element.removeEventListener("pointermove", onPointerMove);
|
|
3881
4116
|
element.removeEventListener("pointerup", releasePointer);
|
|
@@ -3884,7 +4119,7 @@ function MouseControls({
|
|
|
3884
4119
|
element.removeEventListener("wheel", onWheel);
|
|
3885
4120
|
clearPointers();
|
|
3886
4121
|
};
|
|
3887
|
-
}, [buttons, controlsRef, enabled, gl]);
|
|
4122
|
+
}, [buttons, controlsRef, enabled, gl, camera]);
|
|
3888
4123
|
return null;
|
|
3889
4124
|
}
|
|
3890
4125
|
|
|
@@ -5299,10 +5534,10 @@ function usePanoOverlayHost(isFullscreen) {
|
|
|
5299
5534
|
// src/panorama-event-surface.tsx
|
|
5300
5535
|
var import_fiber7 = require("@react-three/fiber");
|
|
5301
5536
|
var import_react16 = require("react");
|
|
5302
|
-
var
|
|
5537
|
+
var import_three4 = require("three");
|
|
5303
5538
|
|
|
5304
5539
|
// src/hotspot/coordinates.ts
|
|
5305
|
-
var
|
|
5540
|
+
var import_three3 = require("three");
|
|
5306
5541
|
|
|
5307
5542
|
// src/hotspot/types.ts
|
|
5308
5543
|
var MAX_HOTSPOT_PITCH = 90;
|
|
@@ -5325,13 +5560,13 @@ function normalizePanoYaw(yaw) {
|
|
|
5325
5560
|
if (!Number.isFinite(yaw)) {
|
|
5326
5561
|
return 0;
|
|
5327
5562
|
}
|
|
5328
|
-
return
|
|
5563
|
+
return import_three3.MathUtils.euclideanModulo(yaw + 180, 360) - 180;
|
|
5329
5564
|
}
|
|
5330
5565
|
function clampPanoPitch(pitch) {
|
|
5331
5566
|
if (!Number.isFinite(pitch)) {
|
|
5332
5567
|
return 0;
|
|
5333
5568
|
}
|
|
5334
|
-
const clamped =
|
|
5569
|
+
const clamped = import_three3.MathUtils.clamp(
|
|
5335
5570
|
pitch,
|
|
5336
5571
|
-MAX_HOTSPOT_PITCH,
|
|
5337
5572
|
MAX_HOTSPOT_PITCH
|
|
@@ -5348,10 +5583,10 @@ function normalizePanoPosition(position) {
|
|
|
5348
5583
|
function panoPositionToVector3(position, radius = 1) {
|
|
5349
5584
|
const normalized = normalizePanoPosition(position);
|
|
5350
5585
|
const safeRadius = Number.isFinite(radius) ? Math.max(0, radius) : 1;
|
|
5351
|
-
const yaw =
|
|
5352
|
-
const pitch =
|
|
5586
|
+
const yaw = import_three3.MathUtils.degToRad(normalized.yaw);
|
|
5587
|
+
const pitch = import_three3.MathUtils.degToRad(normalized.pitch);
|
|
5353
5588
|
const cosPitch = Math.cos(pitch);
|
|
5354
|
-
return new
|
|
5589
|
+
return new import_three3.Vector3(
|
|
5355
5590
|
cosPitch * Math.sin(yaw) * safeRadius,
|
|
5356
5591
|
Math.sin(pitch) * safeRadius,
|
|
5357
5592
|
-cosPitch * Math.cos(yaw) * safeRadius
|
|
@@ -5363,9 +5598,9 @@ function vector3ToPanoPosition(vector) {
|
|
|
5363
5598
|
return { yaw: 0, pitch: 0 };
|
|
5364
5599
|
}
|
|
5365
5600
|
return normalizePanoPosition({
|
|
5366
|
-
yaw:
|
|
5367
|
-
pitch:
|
|
5368
|
-
Math.asin(
|
|
5601
|
+
yaw: import_three3.MathUtils.radToDeg(Math.atan2(vector.x, -vector.z)),
|
|
5602
|
+
pitch: import_three3.MathUtils.radToDeg(
|
|
5603
|
+
Math.asin(import_three3.MathUtils.clamp(vector.y / length, -1, 1))
|
|
5369
5604
|
)
|
|
5370
5605
|
});
|
|
5371
5606
|
}
|
|
@@ -5398,9 +5633,9 @@ function PanoramaEventSurface() {
|
|
|
5398
5633
|
return;
|
|
5399
5634
|
}
|
|
5400
5635
|
const element = gl.domElement;
|
|
5401
|
-
const ndc = new
|
|
5402
|
-
const raycaster = new
|
|
5403
|
-
const direction = new
|
|
5636
|
+
const ndc = new import_three4.Vector2();
|
|
5637
|
+
const raycaster = new import_three4.Raycaster();
|
|
5638
|
+
const direction = new import_three4.Vector3();
|
|
5404
5639
|
const handleContextMenu = (nativeEvent) => {
|
|
5405
5640
|
const rect = element.getBoundingClientRect();
|
|
5406
5641
|
if (rect.width <= 0 || rect.height <= 0) {
|
|
@@ -5452,7 +5687,7 @@ function PanoramaEventSurface() {
|
|
|
5452
5687
|
depthTest: false,
|
|
5453
5688
|
depthWrite: false,
|
|
5454
5689
|
opacity: 0,
|
|
5455
|
-
side:
|
|
5690
|
+
side: import_three4.BackSide,
|
|
5456
5691
|
transparent: true
|
|
5457
5692
|
}
|
|
5458
5693
|
)
|
|
@@ -5482,6 +5717,9 @@ function notifyScenesHost(host) {
|
|
|
5482
5717
|
var import_fiber8 = require("@react-three/fiber");
|
|
5483
5718
|
var import_react18 = require("react");
|
|
5484
5719
|
var DEFAULT_ROTATE_SPEED3 = 0.35;
|
|
5720
|
+
function pointerAt2(event) {
|
|
5721
|
+
return event.timeStamp > 0 ? event.timeStamp : performance.now();
|
|
5722
|
+
}
|
|
5485
5723
|
function resolveSpeed3(value, fallback) {
|
|
5486
5724
|
return Number.isFinite(value) && value >= 0 ? value : fallback;
|
|
5487
5725
|
}
|
|
@@ -5496,7 +5734,9 @@ function TouchControls({
|
|
|
5496
5734
|
}) {
|
|
5497
5735
|
useClaimControlChannel("touch");
|
|
5498
5736
|
const controlsRef = (0, import_react18.useContext)(PanoramaViewContext);
|
|
5499
|
-
const { gl } = (0, import_fiber8.useThree)();
|
|
5737
|
+
const { gl, camera } = (0, import_fiber8.useThree)();
|
|
5738
|
+
const validateDragRef = (0, import_react18.useRef)(void 0);
|
|
5739
|
+
(0, import_fiber8.useFrame)((_, delta) => validateDragRef.current?.(delta), -1);
|
|
5500
5740
|
const pointersRef = (0, import_react18.useRef)(/* @__PURE__ */ new Map());
|
|
5501
5741
|
const pinchDistanceRef = (0, import_react18.useRef)(null);
|
|
5502
5742
|
const optionsRef = (0, import_react18.useRef)({ rotateSpeed, invert, pinchZoom });
|
|
@@ -5506,6 +5746,7 @@ function TouchControls({
|
|
|
5506
5746
|
optionsRef.current = { rotateSpeed, invert, pinchZoom };
|
|
5507
5747
|
(0, import_react18.useEffect)(() => {
|
|
5508
5748
|
const element = gl.domElement;
|
|
5749
|
+
const drag = createPointerDrag(camera, element, () => controlsRef.current, "touch");
|
|
5509
5750
|
const clearPointers = () => {
|
|
5510
5751
|
for (const pointerId of pointersRef.current.keys()) {
|
|
5511
5752
|
if (element.hasPointerCapture?.(pointerId)) {
|
|
@@ -5513,9 +5754,14 @@ function TouchControls({
|
|
|
5513
5754
|
}
|
|
5514
5755
|
}
|
|
5515
5756
|
pointersRef.current.clear();
|
|
5757
|
+
drag.clear();
|
|
5516
5758
|
pinchDistanceRef.current = null;
|
|
5517
5759
|
controlsRef.current?.setPointerActive("touch", false, { cancelled: true });
|
|
5518
5760
|
};
|
|
5761
|
+
validateDragRef.current = (delta) => {
|
|
5762
|
+
if (pointersRef.current.size && !drag.valid()) clearPointers();
|
|
5763
|
+
else drag.flush(delta);
|
|
5764
|
+
};
|
|
5519
5765
|
if (!enabled) {
|
|
5520
5766
|
clearPointers();
|
|
5521
5767
|
return;
|
|
@@ -5542,7 +5788,9 @@ function TouchControls({
|
|
|
5542
5788
|
});
|
|
5543
5789
|
element.setPointerCapture?.(event.pointerId);
|
|
5544
5790
|
syncActive();
|
|
5545
|
-
|
|
5791
|
+
drag.start({ x: event.clientX, y: event.clientY }, pointerAt2(event));
|
|
5792
|
+
if (pointersRef.current.size >= 2) {
|
|
5793
|
+
drag.suspend();
|
|
5546
5794
|
const [first, second] = Array.from(pointersRef.current.values());
|
|
5547
5795
|
pinchDistanceRef.current = pointerDistance(first, second);
|
|
5548
5796
|
}
|
|
@@ -5567,6 +5815,7 @@ function TouchControls({
|
|
|
5567
5815
|
pointersRef.current.set(event.pointerId, next);
|
|
5568
5816
|
const pointers = Array.from(pointersRef.current.values());
|
|
5569
5817
|
if (pointers.length >= 2) {
|
|
5818
|
+
drag.suspend();
|
|
5570
5819
|
if (!optionsRef.current.pinchZoom) {
|
|
5571
5820
|
return;
|
|
5572
5821
|
}
|
|
@@ -5585,23 +5834,16 @@ function TouchControls({
|
|
|
5585
5834
|
}
|
|
5586
5835
|
return;
|
|
5587
5836
|
}
|
|
5588
|
-
const
|
|
5589
|
-
|
|
5590
|
-
optionsRef.current.rotateSpeed,
|
|
5591
|
-
DEFAULT_ROTATE_SPEED3
|
|
5592
|
-
);
|
|
5593
|
-
const sign = optionsRef.current.invert ? -1 : 1;
|
|
5594
|
-
const deltaYaw = sign * -(next.x - previous.x) * 360 * speed / Math.max(rect.width, 1);
|
|
5595
|
-
const deltaPitch = sign * (next.y - previous.y) * 180 * speed / Math.max(rect.height, 1);
|
|
5596
|
-
controlsRef.current?.applyViewDelta(
|
|
5597
|
-
{ yaw: deltaYaw, pitch: deltaPitch },
|
|
5598
|
-
{ recordVelocity: true, source: "touch" }
|
|
5599
|
-
);
|
|
5837
|
+
const speed = resolveSpeed3(optionsRef.current.rotateSpeed, DEFAULT_ROTATE_SPEED3);
|
|
5838
|
+
drag.move(next, previous, speed, optionsRef.current.invert, pointerAt2(event));
|
|
5600
5839
|
};
|
|
5601
5840
|
const releasePointer = (event) => {
|
|
5602
5841
|
if (!pointersRef.current.has(event.pointerId)) {
|
|
5603
5842
|
return;
|
|
5604
5843
|
}
|
|
5844
|
+
const pinch = pointersRef.current.size >= 2;
|
|
5845
|
+
if (event.type === "pointerup" && !pinch) drag.release();
|
|
5846
|
+
else drag.clear();
|
|
5605
5847
|
pointersRef.current.delete(event.pointerId);
|
|
5606
5848
|
if (element.hasPointerCapture?.(event.pointerId)) {
|
|
5607
5849
|
element.releasePointerCapture?.(event.pointerId);
|
|
@@ -5610,6 +5852,8 @@ function TouchControls({
|
|
|
5610
5852
|
pinchDistanceRef.current = null;
|
|
5611
5853
|
}
|
|
5612
5854
|
syncActive(event.type !== "pointerup");
|
|
5855
|
+
const remaining = pointersRef.current.values().next().value;
|
|
5856
|
+
if (remaining) drag.start(remaining, pointerAt2(event));
|
|
5613
5857
|
};
|
|
5614
5858
|
element.addEventListener("pointerdown", onPointerDown);
|
|
5615
5859
|
element.addEventListener("pointermove", onPointerMove);
|
|
@@ -5617,6 +5861,7 @@ function TouchControls({
|
|
|
5617
5861
|
element.addEventListener("pointercancel", releasePointer);
|
|
5618
5862
|
element.addEventListener("lostpointercapture", releasePointer);
|
|
5619
5863
|
return () => {
|
|
5864
|
+
validateDragRef.current = void 0;
|
|
5620
5865
|
element.removeEventListener("pointerdown", onPointerDown);
|
|
5621
5866
|
element.removeEventListener("pointermove", onPointerMove);
|
|
5622
5867
|
element.removeEventListener("pointerup", releasePointer);
|
|
@@ -5624,7 +5869,7 @@ function TouchControls({
|
|
|
5624
5869
|
element.removeEventListener("lostpointercapture", releasePointer);
|
|
5625
5870
|
clearPointers();
|
|
5626
5871
|
};
|
|
5627
|
-
}, [controlsRef, enabled, gl]);
|
|
5872
|
+
}, [controlsRef, enabled, gl, camera]);
|
|
5628
5873
|
return null;
|
|
5629
5874
|
}
|
|
5630
5875
|
|
|
@@ -7247,12 +7492,12 @@ function WebVRChromeBridge({ host }) {
|
|
|
7247
7492
|
}
|
|
7248
7493
|
|
|
7249
7494
|
// src/webvr/stereo-view.ts
|
|
7250
|
-
var
|
|
7251
|
-
var PROJECT = new
|
|
7495
|
+
var import_three5 = require("three");
|
|
7496
|
+
var PROJECT = new import_three5.Vector3();
|
|
7252
7497
|
function createWebVRStereoView() {
|
|
7253
7498
|
return {
|
|
7254
7499
|
active: false,
|
|
7255
|
-
stereo: new
|
|
7500
|
+
stereo: new import_three5.StereoCamera()
|
|
7256
7501
|
};
|
|
7257
7502
|
}
|
|
7258
7503
|
function isFallbackStereoMode(mode) {
|
|
@@ -7276,11 +7521,11 @@ function projectStereoHtmlPosition(el, camera, size, eye) {
|
|
|
7276
7521
|
var import_fiber9 = require("@react-three/fiber");
|
|
7277
7522
|
var import_xr2 = require("@react-three/xr");
|
|
7278
7523
|
var import_react26 = require("react");
|
|
7279
|
-
var
|
|
7524
|
+
var import_three6 = require("three");
|
|
7280
7525
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
7281
7526
|
function PanoramaXROrigin() {
|
|
7282
7527
|
const originRef = (0, import_react26.useRef)(null);
|
|
7283
|
-
const localHeadPositionRef = (0, import_react26.useRef)(new
|
|
7528
|
+
const localHeadPositionRef = (0, import_react26.useRef)(new import_three6.Vector3());
|
|
7284
7529
|
const session2 = (0, import_xr2.useXR)((state) => state.session);
|
|
7285
7530
|
const gl = (0, import_fiber9.useThree)((state) => state.gl);
|
|
7286
7531
|
(0, import_fiber9.useFrame)(() => {
|
|
@@ -8030,7 +8275,7 @@ var import_react51 = require("react");
|
|
|
8030
8275
|
// src/scenes.tsx
|
|
8031
8276
|
var import_fiber18 = require("@react-three/fiber");
|
|
8032
8277
|
var import_react38 = require("react");
|
|
8033
|
-
var
|
|
8278
|
+
var import_three20 = require("three");
|
|
8034
8279
|
|
|
8035
8280
|
// src/scene-detail.tsx
|
|
8036
8281
|
var import_react28 = require("react");
|
|
@@ -8102,12 +8347,12 @@ function isSnapshotTransition(preset) {
|
|
|
8102
8347
|
// src/scene-transitions/snapshot-hold.tsx
|
|
8103
8348
|
var import_fiber11 = require("@react-three/fiber");
|
|
8104
8349
|
var import_react29 = require("react");
|
|
8105
|
-
var
|
|
8350
|
+
var import_three9 = require("three");
|
|
8106
8351
|
|
|
8107
8352
|
// src/scene-transitions/overlay-utils.ts
|
|
8108
|
-
var
|
|
8353
|
+
var import_three7 = require("three");
|
|
8109
8354
|
var OVERLAY_RENDER_ORDER = 1e4;
|
|
8110
|
-
var FULLSCREEN_PLANE = new
|
|
8355
|
+
var FULLSCREEN_PLANE = new import_three7.PlaneGeometry(1, 1);
|
|
8111
8356
|
function isPerspectiveCamera(camera) {
|
|
8112
8357
|
return camera.isPerspectiveCamera === true;
|
|
8113
8358
|
}
|
|
@@ -8126,7 +8371,7 @@ function overlayProgress(elapsedTime, duration, startTime) {
|
|
|
8126
8371
|
}
|
|
8127
8372
|
|
|
8128
8373
|
// src/scene-transitions/snapshot-shaders.ts
|
|
8129
|
-
var
|
|
8374
|
+
var import_three8 = require("three");
|
|
8130
8375
|
|
|
8131
8376
|
// src/scene-transitions/glsl.ts
|
|
8132
8377
|
var GLSL_COMMON = `
|
|
@@ -8418,15 +8663,15 @@ var SNAPSHOT_FRAGMENT_SHADERS = {
|
|
|
8418
8663
|
`)
|
|
8419
8664
|
};
|
|
8420
8665
|
function createSnapshotMaterial(preset, texture) {
|
|
8421
|
-
return new
|
|
8666
|
+
return new import_three8.ShaderMaterial({
|
|
8422
8667
|
transparent: true,
|
|
8423
8668
|
depthTest: false,
|
|
8424
8669
|
depthWrite: false,
|
|
8425
|
-
side:
|
|
8670
|
+
side: import_three8.DoubleSide,
|
|
8426
8671
|
uniforms: {
|
|
8427
8672
|
map: { value: texture },
|
|
8428
8673
|
progress: { value: 0 },
|
|
8429
|
-
resolution: { value: new
|
|
8674
|
+
resolution: { value: new import_three8.Vector2(1, 1) }
|
|
8430
8675
|
},
|
|
8431
8676
|
vertexShader: SNAPSHOT_VERTEX_SHADER,
|
|
8432
8677
|
fragmentShader: SNAPSHOT_FRAGMENT_SHADERS[preset]
|
|
@@ -8438,7 +8683,7 @@ var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
|
8438
8683
|
function SnapshotHold({ snapshot }) {
|
|
8439
8684
|
const { camera, gl } = (0, import_fiber11.useThree)();
|
|
8440
8685
|
const meshRef = (0, import_react29.useRef)(null);
|
|
8441
|
-
const directionRef = (0, import_react29.useRef)(new
|
|
8686
|
+
const directionRef = (0, import_react29.useRef)(new import_three9.Vector3());
|
|
8442
8687
|
const material = (0, import_react29.useMemo)(
|
|
8443
8688
|
() => createSnapshotMaterial("crossfade", snapshot.texture),
|
|
8444
8689
|
[snapshot.texture]
|
|
@@ -8522,7 +8767,7 @@ function phaseAfterSnapshot(preset, hold) {
|
|
|
8522
8767
|
// src/scene-transitions/particle-overlay.tsx
|
|
8523
8768
|
var import_fiber12 = require("@react-three/fiber");
|
|
8524
8769
|
var import_react30 = require("react");
|
|
8525
|
-
var
|
|
8770
|
+
var import_three10 = require("three");
|
|
8526
8771
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
8527
8772
|
var PARTICLE_GRID = 48;
|
|
8528
8773
|
var PARTICLE_COUNT = PARTICLE_GRID * PARTICLE_GRID;
|
|
@@ -8576,8 +8821,8 @@ var PARTICLE_FRAGMENT_SHADER = `
|
|
|
8576
8821
|
}
|
|
8577
8822
|
`;
|
|
8578
8823
|
function createParticleGeometry() {
|
|
8579
|
-
const quad = new
|
|
8580
|
-
const geometry = new
|
|
8824
|
+
const quad = new import_three10.PlaneGeometry(1, 1);
|
|
8825
|
+
const geometry = new import_three10.InstancedBufferGeometry();
|
|
8581
8826
|
if (quad.index) {
|
|
8582
8827
|
geometry.setIndex(quad.index.clone());
|
|
8583
8828
|
}
|
|
@@ -8587,7 +8832,7 @@ function createParticleGeometry() {
|
|
|
8587
8832
|
for (let i = 0; i < PARTICLE_COUNT; i += 1) {
|
|
8588
8833
|
indexes[i] = i;
|
|
8589
8834
|
}
|
|
8590
|
-
geometry.setAttribute("instanceIndex", new
|
|
8835
|
+
geometry.setAttribute("instanceIndex", new import_three10.InstancedBufferAttribute(indexes, 1));
|
|
8591
8836
|
geometry.instanceCount = PARTICLE_COUNT;
|
|
8592
8837
|
quad.dispose();
|
|
8593
8838
|
return geometry;
|
|
@@ -8603,18 +8848,18 @@ function ParticleOverlay({
|
|
|
8603
8848
|
const meshRef = (0, import_react30.useRef)(null);
|
|
8604
8849
|
const startRef = (0, import_react30.useRef)(null);
|
|
8605
8850
|
const finishedRef = (0, import_react30.useRef)(false);
|
|
8606
|
-
const directionRef = (0, import_react30.useRef)(new
|
|
8851
|
+
const directionRef = (0, import_react30.useRef)(new import_three10.Vector3());
|
|
8607
8852
|
const geometry = (0, import_react30.useMemo)(() => createParticleGeometry(), []);
|
|
8608
8853
|
const material = (0, import_react30.useMemo)(
|
|
8609
|
-
() => new
|
|
8854
|
+
() => new import_three10.ShaderMaterial({
|
|
8610
8855
|
transparent: true,
|
|
8611
8856
|
depthTest: false,
|
|
8612
8857
|
depthWrite: false,
|
|
8613
|
-
side:
|
|
8858
|
+
side: import_three10.DoubleSide,
|
|
8614
8859
|
uniforms: {
|
|
8615
8860
|
map: { value: snapshot.texture },
|
|
8616
8861
|
progress: { value: 0 },
|
|
8617
|
-
grid: { value: new
|
|
8862
|
+
grid: { value: new import_three10.Vector2(PARTICLE_GRID, PARTICLE_GRID) }
|
|
8618
8863
|
},
|
|
8619
8864
|
vertexShader: PARTICLE_VERTEX_SHADER,
|
|
8620
8865
|
fragmentShader: PARTICLE_FRAGMENT_SHADER
|
|
@@ -8660,7 +8905,7 @@ function ParticleOverlay({
|
|
|
8660
8905
|
// src/scene-transitions/snapshot-overlay.tsx
|
|
8661
8906
|
var import_fiber13 = require("@react-three/fiber");
|
|
8662
8907
|
var import_react31 = require("react");
|
|
8663
|
-
var
|
|
8908
|
+
var import_three11 = require("three");
|
|
8664
8909
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
8665
8910
|
function SnapshotOverlay({
|
|
8666
8911
|
snapshot,
|
|
@@ -8673,7 +8918,7 @@ function SnapshotOverlay({
|
|
|
8673
8918
|
const meshRef = (0, import_react31.useRef)(null);
|
|
8674
8919
|
const startRef = (0, import_react31.useRef)(null);
|
|
8675
8920
|
const finishedRef = (0, import_react31.useRef)(false);
|
|
8676
|
-
const directionRef = (0, import_react31.useRef)(new
|
|
8921
|
+
const directionRef = (0, import_react31.useRef)(new import_three11.Vector3());
|
|
8677
8922
|
const material = (0, import_react31.useMemo)(() => {
|
|
8678
8923
|
if (!isSnapshotTransition(transition.preset)) {
|
|
8679
8924
|
return null;
|
|
@@ -8764,11 +9009,11 @@ function TransitionOverlay(props) {
|
|
|
8764
9009
|
// src/sphere.tsx
|
|
8765
9010
|
var import_fiber14 = require("@react-three/fiber");
|
|
8766
9011
|
var import_react33 = require("react");
|
|
8767
|
-
var
|
|
9012
|
+
var import_three13 = require("three");
|
|
8768
9013
|
|
|
8769
9014
|
// src/pano-filter/pano-basic-material.tsx
|
|
8770
9015
|
var import_react32 = require("react");
|
|
8771
|
-
var
|
|
9016
|
+
var import_three12 = require("three");
|
|
8772
9017
|
|
|
8773
9018
|
// src/pano-filter/shaders.ts
|
|
8774
9019
|
var GLSL_FILTER_COMMON = `
|
|
@@ -8935,7 +9180,7 @@ function injectPanoColorMatrixShader(shader) {
|
|
|
8935
9180
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
8936
9181
|
function matrixUniforms(matrix) {
|
|
8937
9182
|
return {
|
|
8938
|
-
matrix: new
|
|
9183
|
+
matrix: new import_three12.Matrix4().set(
|
|
8939
9184
|
matrix[0],
|
|
8940
9185
|
matrix[1],
|
|
8941
9186
|
matrix[2],
|
|
@@ -8953,7 +9198,7 @@ function matrixUniforms(matrix) {
|
|
|
8953
9198
|
matrix[17],
|
|
8954
9199
|
matrix[18]
|
|
8955
9200
|
),
|
|
8956
|
-
offset: new
|
|
9201
|
+
offset: new import_three12.Vector4(matrix[4], matrix[9], matrix[14], matrix[19])
|
|
8957
9202
|
};
|
|
8958
9203
|
}
|
|
8959
9204
|
function PanoBasicMaterial({
|
|
@@ -9024,7 +9269,7 @@ function useEquirectTexture(url, anisotropy, generateMipmaps, onLoad, onError) {
|
|
|
9024
9269
|
return;
|
|
9025
9270
|
}
|
|
9026
9271
|
let active = true;
|
|
9027
|
-
const loader = new
|
|
9272
|
+
const loader = new import_three13.TextureLoader();
|
|
9028
9273
|
setTexture(null);
|
|
9029
9274
|
loader.load(
|
|
9030
9275
|
url,
|
|
@@ -9033,13 +9278,13 @@ function useEquirectTexture(url, anisotropy, generateMipmaps, onLoad, onError) {
|
|
|
9033
9278
|
loadedTexture.dispose();
|
|
9034
9279
|
return;
|
|
9035
9280
|
}
|
|
9036
|
-
loadedTexture.colorSpace =
|
|
9037
|
-
loadedTexture.wrapS =
|
|
9281
|
+
loadedTexture.colorSpace = import_three13.SRGBColorSpace;
|
|
9282
|
+
loadedTexture.wrapS = import_three13.RepeatWrapping;
|
|
9038
9283
|
loadedTexture.repeat.x = -1;
|
|
9039
9284
|
loadedTexture.offset.x = 1;
|
|
9040
9285
|
loadedTexture.anisotropy = anisotropy;
|
|
9041
|
-
loadedTexture.magFilter =
|
|
9042
|
-
loadedTexture.minFilter = generateMipmaps ?
|
|
9286
|
+
loadedTexture.magFilter = import_three13.LinearFilter;
|
|
9287
|
+
loadedTexture.minFilter = generateMipmaps ? import_three13.LinearMipmapLinearFilter : import_three13.LinearFilter;
|
|
9043
9288
|
loadedTexture.generateMipmaps = generateMipmaps;
|
|
9044
9289
|
loadedTexture.needsUpdate = true;
|
|
9045
9290
|
setTexture(loadedTexture);
|
|
@@ -9123,7 +9368,7 @@ function Sphere({
|
|
|
9123
9368
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
9124
9369
|
"mesh",
|
|
9125
9370
|
{
|
|
9126
|
-
rotation: [0,
|
|
9371
|
+
rotation: [0, import_three13.MathUtils.degToRad(90 + yawOffset2), 0],
|
|
9127
9372
|
visible,
|
|
9128
9373
|
children: [
|
|
9129
9374
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("sphereGeometry", { args: [DEFAULT_PANORAMA_RADIUS, 128, 64] }),
|
|
@@ -9131,7 +9376,7 @@ function Sphere({
|
|
|
9131
9376
|
PanoBasicMaterial,
|
|
9132
9377
|
{
|
|
9133
9378
|
map: displayTexture,
|
|
9134
|
-
side:
|
|
9379
|
+
side: import_three13.BackSide,
|
|
9135
9380
|
toneMapped: false
|
|
9136
9381
|
}
|
|
9137
9382
|
)
|
|
@@ -9143,10 +9388,10 @@ function Sphere({
|
|
|
9143
9388
|
// src/sphere-tile/sphere-tile.tsx
|
|
9144
9389
|
var import_fiber16 = require("@react-three/fiber");
|
|
9145
9390
|
var import_react36 = require("react");
|
|
9146
|
-
var
|
|
9391
|
+
var import_three17 = require("three");
|
|
9147
9392
|
|
|
9148
9393
|
// src/tile/texture-manager.ts
|
|
9149
|
-
var
|
|
9394
|
+
var import_three14 = require("three");
|
|
9150
9395
|
var EMPTY_TEXTURE_SNAPSHOT = {
|
|
9151
9396
|
status: "idle",
|
|
9152
9397
|
texture: null,
|
|
@@ -9154,7 +9399,7 @@ var EMPTY_TEXTURE_SNAPSHOT = {
|
|
|
9154
9399
|
};
|
|
9155
9400
|
var TileTextureManager = class {
|
|
9156
9401
|
constructor(options) {
|
|
9157
|
-
this.loader = new
|
|
9402
|
+
this.loader = new import_three14.TextureLoader();
|
|
9158
9403
|
this.entries = /* @__PURE__ */ new Map();
|
|
9159
9404
|
this.queue = [];
|
|
9160
9405
|
this.activeLoads = 0;
|
|
@@ -9326,11 +9571,11 @@ var TileTextureManager = class {
|
|
|
9326
9571
|
}
|
|
9327
9572
|
}
|
|
9328
9573
|
configureTexture(texture) {
|
|
9329
|
-
texture.colorSpace =
|
|
9330
|
-
texture.wrapS =
|
|
9331
|
-
texture.wrapT =
|
|
9332
|
-
texture.magFilter =
|
|
9333
|
-
texture.minFilter =
|
|
9574
|
+
texture.colorSpace = import_three14.SRGBColorSpace;
|
|
9575
|
+
texture.wrapS = import_three14.ClampToEdgeWrapping;
|
|
9576
|
+
texture.wrapT = import_three14.ClampToEdgeWrapping;
|
|
9577
|
+
texture.magFilter = import_three14.LinearFilter;
|
|
9578
|
+
texture.minFilter = import_three14.LinearFilter;
|
|
9334
9579
|
texture.generateMipmaps = false;
|
|
9335
9580
|
texture.anisotropy = Math.min(4, this.options.anisotropy);
|
|
9336
9581
|
texture.needsUpdate = true;
|
|
@@ -9403,7 +9648,7 @@ function useSharedTileTextureManager() {
|
|
|
9403
9648
|
|
|
9404
9649
|
// src/tile/texture-hooks.ts
|
|
9405
9650
|
var import_react35 = require("react");
|
|
9406
|
-
var
|
|
9651
|
+
var import_three15 = require("three");
|
|
9407
9652
|
function usePreviewTexture(url, anisotropy, onError) {
|
|
9408
9653
|
const [texture, setTexture] = (0, import_react35.useState)(null);
|
|
9409
9654
|
const onErrorRef = (0, import_react35.useRef)(onError);
|
|
@@ -9414,7 +9659,7 @@ function usePreviewTexture(url, anisotropy, onError) {
|
|
|
9414
9659
|
return;
|
|
9415
9660
|
}
|
|
9416
9661
|
let active = true;
|
|
9417
|
-
const loader = new
|
|
9662
|
+
const loader = new import_three15.TextureLoader();
|
|
9418
9663
|
setTexture(null);
|
|
9419
9664
|
loader.load(
|
|
9420
9665
|
url,
|
|
@@ -9423,11 +9668,11 @@ function usePreviewTexture(url, anisotropy, onError) {
|
|
|
9423
9668
|
loadedTexture.dispose();
|
|
9424
9669
|
return;
|
|
9425
9670
|
}
|
|
9426
|
-
loadedTexture.colorSpace =
|
|
9427
|
-
loadedTexture.wrapS =
|
|
9428
|
-
loadedTexture.wrapT =
|
|
9429
|
-
loadedTexture.magFilter =
|
|
9430
|
-
loadedTexture.minFilter =
|
|
9671
|
+
loadedTexture.colorSpace = import_three15.SRGBColorSpace;
|
|
9672
|
+
loadedTexture.wrapS = import_three15.ClampToEdgeWrapping;
|
|
9673
|
+
loadedTexture.wrapT = import_three15.ClampToEdgeWrapping;
|
|
9674
|
+
loadedTexture.magFilter = import_three15.LinearFilter;
|
|
9675
|
+
loadedTexture.minFilter = import_three15.LinearFilter;
|
|
9431
9676
|
loadedTexture.generateMipmaps = false;
|
|
9432
9677
|
loadedTexture.anisotropy = Math.min(4, anisotropy);
|
|
9433
9678
|
loadedTexture.needsUpdate = true;
|
|
@@ -9476,7 +9721,7 @@ function useManagedTexture(manager, key, url, address) {
|
|
|
9476
9721
|
}
|
|
9477
9722
|
|
|
9478
9723
|
// src/sphere-tile/layout.ts
|
|
9479
|
-
var
|
|
9724
|
+
var import_three16 = require("three");
|
|
9480
9725
|
function positiveInteger2(value, name) {
|
|
9481
9726
|
if (!Number.isSafeInteger(value) || value <= 0) {
|
|
9482
9727
|
throw new Error(`${name} must be a positive safe integer`);
|
|
@@ -9547,9 +9792,9 @@ function sphereTileRange(address) {
|
|
|
9547
9792
|
};
|
|
9548
9793
|
}
|
|
9549
9794
|
function spherePoint(u, v, yawOffset2 = 0, radius = DEFAULT_PANORAMA_RADIUS) {
|
|
9550
|
-
const yaw = (u - 0.5) * Math.PI * 2 +
|
|
9795
|
+
const yaw = (u - 0.5) * Math.PI * 2 + import_three16.MathUtils.degToRad(yawOffset2);
|
|
9551
9796
|
const pitch = (0.5 - v) * Math.PI;
|
|
9552
|
-
return new
|
|
9797
|
+
return new import_three16.Vector3(
|
|
9553
9798
|
Math.sin(yaw) * Math.cos(pitch) * radius,
|
|
9554
9799
|
Math.sin(pitch) * radius,
|
|
9555
9800
|
-Math.cos(yaw) * Math.cos(pitch) * radius
|
|
@@ -9563,7 +9808,7 @@ function sphereTileBounds(address, yawOffset2) {
|
|
|
9563
9808
|
if (u > left && u < right) us.push(u);
|
|
9564
9809
|
}
|
|
9565
9810
|
const vs = top < 0.5 && bottom > 0.5 ? [top, 0.5, bottom] : [top, bottom];
|
|
9566
|
-
return new
|
|
9811
|
+
return new import_three16.Box3().setFromPoints(
|
|
9567
9812
|
us.flatMap((u) => vs.map((v) => spherePoint(u, v, yawOffset2)))
|
|
9568
9813
|
);
|
|
9569
9814
|
}
|
|
@@ -9589,9 +9834,9 @@ function sphereTileGeometry(address, yawOffset2, radius = DEFAULT_PANORAMA_RADIU
|
|
|
9589
9834
|
}
|
|
9590
9835
|
}
|
|
9591
9836
|
}
|
|
9592
|
-
const geometry = new
|
|
9593
|
-
geometry.setAttribute("position", new
|
|
9594
|
-
geometry.setAttribute("uv", new
|
|
9837
|
+
const geometry = new import_three16.BufferGeometry();
|
|
9838
|
+
geometry.setAttribute("position", new import_three16.Float32BufferAttribute(positions, 3));
|
|
9839
|
+
geometry.setAttribute("uv", new import_three16.Float32BufferAttribute(uvs, 2));
|
|
9595
9840
|
geometry.setIndex(indices);
|
|
9596
9841
|
geometry.computeBoundingSphere();
|
|
9597
9842
|
return geometry;
|
|
@@ -9637,7 +9882,7 @@ function SpherePatch({
|
|
|
9637
9882
|
PanoBasicMaterial,
|
|
9638
9883
|
{
|
|
9639
9884
|
map: texture,
|
|
9640
|
-
side:
|
|
9885
|
+
side: import_three17.BackSide,
|
|
9641
9886
|
depthTest: false,
|
|
9642
9887
|
depthWrite: false,
|
|
9643
9888
|
toneMapped: false
|
|
@@ -9779,9 +10024,9 @@ function SphereTileSource({
|
|
|
9779
10024
|
const targetKeysRef = (0, import_react36.useRef)([]);
|
|
9780
10025
|
const scratch = (0, import_react36.useMemo)(
|
|
9781
10026
|
() => ({
|
|
9782
|
-
camera: new
|
|
9783
|
-
frustum: new
|
|
9784
|
-
matrix: new
|
|
10027
|
+
camera: new import_three17.PerspectiveCamera(),
|
|
10028
|
+
frustum: new import_three17.Frustum(),
|
|
10029
|
+
matrix: new import_three17.Matrix4(),
|
|
9785
10030
|
quaternion: camera.quaternion.clone(),
|
|
9786
10031
|
fov: NaN,
|
|
9787
10032
|
width: 0,
|
|
@@ -9796,7 +10041,7 @@ function SphereTileSource({
|
|
|
9796
10041
|
[camera, candidates]
|
|
9797
10042
|
);
|
|
9798
10043
|
(0, import_fiber16.useFrame)(() => {
|
|
9799
|
-
if (!(camera instanceof
|
|
10044
|
+
if (!(camera instanceof import_three17.PerspectiveCamera)) return;
|
|
9800
10045
|
const now = performance.now(), dpr = gl.getPixelRatio();
|
|
9801
10046
|
const managerChanged = scratch.manager !== manager;
|
|
9802
10047
|
const loadModeChanged = scratch.loadMode !== loadMode;
|
|
@@ -9900,10 +10145,10 @@ function SphereTile({ multires, ...props }) {
|
|
|
9900
10145
|
// src/tile/tile.tsx
|
|
9901
10146
|
var import_fiber17 = require("@react-three/fiber");
|
|
9902
10147
|
var import_react37 = require("react");
|
|
9903
|
-
var
|
|
10148
|
+
var import_three19 = require("three");
|
|
9904
10149
|
|
|
9905
10150
|
// src/tile/face-layout.ts
|
|
9906
|
-
var
|
|
10151
|
+
var import_three18 = require("three");
|
|
9907
10152
|
var CUBE_FACES = ["f", "r", "b", "l", "u", "d"];
|
|
9908
10153
|
var PREVIEW_FACE_ORDER = ["l", "f", "r", "b", "u", "d"];
|
|
9909
10154
|
var CUBE_RADIUS = DEFAULT_PANORAMA_RADIUS;
|
|
@@ -9954,8 +10199,8 @@ function getFaceQuaternion(face) {
|
|
|
9954
10199
|
return cached;
|
|
9955
10200
|
}
|
|
9956
10201
|
const transform = getFaceTransform(face);
|
|
9957
|
-
const quaternion = new
|
|
9958
|
-
new
|
|
10202
|
+
const quaternion = new import_three18.Quaternion().setFromEuler(
|
|
10203
|
+
new import_three18.Euler(...transform.rotation, "XYZ")
|
|
9959
10204
|
);
|
|
9960
10205
|
faceQuaternionCache.set(face, quaternion);
|
|
9961
10206
|
return quaternion;
|
|
@@ -9966,17 +10211,17 @@ function getTileBoundingBox(address, radius = CUBE_RADIUS) {
|
|
|
9966
10211
|
const halfWidth = local.width / 2;
|
|
9967
10212
|
const halfHeight = local.height / 2;
|
|
9968
10213
|
const quaternion = getFaceQuaternion(address.face);
|
|
9969
|
-
const position = new
|
|
10214
|
+
const position = new import_three18.Vector3(...transform.position);
|
|
9970
10215
|
const corners = [
|
|
9971
|
-
new
|
|
9972
|
-
new
|
|
9973
|
-
new
|
|
9974
|
-
new
|
|
10216
|
+
new import_three18.Vector3(local.x - halfWidth, local.y - halfHeight, 0),
|
|
10217
|
+
new import_three18.Vector3(local.x + halfWidth, local.y - halfHeight, 0),
|
|
10218
|
+
new import_three18.Vector3(local.x - halfWidth, local.y + halfHeight, 0),
|
|
10219
|
+
new import_three18.Vector3(local.x + halfWidth, local.y + halfHeight, 0)
|
|
9975
10220
|
];
|
|
9976
10221
|
for (const corner of corners) {
|
|
9977
10222
|
corner.applyQuaternion(quaternion).add(position);
|
|
9978
10223
|
}
|
|
9979
|
-
return new
|
|
10224
|
+
return new import_three18.Box3().setFromPoints(corners);
|
|
9980
10225
|
}
|
|
9981
10226
|
function makeTileAddress(face, level, faceSize, tileSize, col, row) {
|
|
9982
10227
|
const left = (col - 1) * tileSize;
|
|
@@ -10046,14 +10291,14 @@ function decideTileLodUpdate(input) {
|
|
|
10046
10291
|
}
|
|
10047
10292
|
var VISIBILITY_FOV_PADDING_DEGREES = 8;
|
|
10048
10293
|
var PREVIEW_RADIUS = CUBE_RADIUS + 0.05;
|
|
10049
|
-
var SHARED_TILE_GEOMETRY = new
|
|
10294
|
+
var SHARED_TILE_GEOMETRY = new import_three19.PlaneGeometry(1, 1);
|
|
10050
10295
|
function PreviewFace({
|
|
10051
10296
|
face,
|
|
10052
10297
|
texture,
|
|
10053
10298
|
faceOrder
|
|
10054
10299
|
}) {
|
|
10055
10300
|
const geometry = (0, import_react37.useMemo)(() => {
|
|
10056
|
-
const nextGeometry = new
|
|
10301
|
+
const nextGeometry = new import_three19.PlaneGeometry(
|
|
10057
10302
|
PREVIEW_RADIUS * 2,
|
|
10058
10303
|
PREVIEW_RADIUS * 2
|
|
10059
10304
|
);
|
|
@@ -10245,8 +10490,8 @@ function parentAddresses(child, parentLevel, parentFaceSize, tileSize) {
|
|
|
10245
10490
|
return addresses;
|
|
10246
10491
|
}
|
|
10247
10492
|
function centerFacingAddress(candidates, camera) {
|
|
10248
|
-
const direction = camera.getWorldDirection(new
|
|
10249
|
-
const center = new
|
|
10493
|
+
const direction = camera.getWorldDirection(new import_three19.Vector3());
|
|
10494
|
+
const center = new import_three19.Vector3();
|
|
10250
10495
|
let bestCandidate = candidates[0];
|
|
10251
10496
|
let bestAlignment = -Infinity;
|
|
10252
10497
|
for (const candidate of candidates) {
|
|
@@ -10391,9 +10636,9 @@ function Tile({
|
|
|
10391
10636
|
const lastVisibilityQuaternionRef = (0, import_react37.useRef)(camera.quaternion.clone());
|
|
10392
10637
|
const lastVisibilityFovRef = (0, import_react37.useRef)(Number.NaN);
|
|
10393
10638
|
const lastViewportRef = (0, import_react37.useRef)({ width: 0, height: 0, dpr: 0 });
|
|
10394
|
-
const frustumRef = (0, import_react37.useRef)(new
|
|
10395
|
-
const projectionMatrixRef = (0, import_react37.useRef)(new
|
|
10396
|
-
const visibilityCameraRef = (0, import_react37.useRef)(new
|
|
10639
|
+
const frustumRef = (0, import_react37.useRef)(new import_three19.Frustum());
|
|
10640
|
+
const projectionMatrixRef = (0, import_react37.useRef)(new import_three19.Matrix4());
|
|
10641
|
+
const visibilityCameraRef = (0, import_react37.useRef)(new import_three19.PerspectiveCamera());
|
|
10397
10642
|
const trackedLoadModeRef = (0, import_react37.useRef)(loadMode);
|
|
10398
10643
|
const targetKeysRef = (0, import_react37.useRef)([]);
|
|
10399
10644
|
const detailTokenRef = (0, import_react37.useRef)("");
|
|
@@ -10421,7 +10666,7 @@ function Tile({
|
|
|
10421
10666
|
}
|
|
10422
10667
|
};
|
|
10423
10668
|
(0, import_fiber17.useFrame)(() => {
|
|
10424
|
-
if (!(camera instanceof
|
|
10669
|
+
if (!(camera instanceof import_three19.PerspectiveCamera)) {
|
|
10425
10670
|
return;
|
|
10426
10671
|
}
|
|
10427
10672
|
if (loadMode === "preview") {
|
|
@@ -10601,14 +10846,14 @@ function SnapshotCapture({
|
|
|
10601
10846
|
const scale = Math.min(1, Math.sqrt(maxPixels / (sourceWidth * sourceHeight)));
|
|
10602
10847
|
const width = Math.max(1, Math.floor(sourceWidth * scale));
|
|
10603
10848
|
const height = Math.max(1, Math.floor(sourceHeight * scale));
|
|
10604
|
-
const nextTarget = new
|
|
10849
|
+
const nextTarget = new import_three20.WebGLRenderTarget(width, height, {
|
|
10605
10850
|
depthBuffer: false,
|
|
10606
10851
|
stencilBuffer: false
|
|
10607
10852
|
});
|
|
10608
|
-
nextTarget.texture.colorSpace =
|
|
10853
|
+
nextTarget.texture.colorSpace = import_three20.LinearSRGBColorSpace;
|
|
10609
10854
|
nextTarget.texture.generateMipmaps = false;
|
|
10610
|
-
nextTarget.texture.minFilter =
|
|
10611
|
-
nextTarget.texture.magFilter =
|
|
10855
|
+
nextTarget.texture.minFilter = import_three20.LinearFilter;
|
|
10856
|
+
nextTarget.texture.magFilter = import_three20.LinearFilter;
|
|
10612
10857
|
const previousTarget = gl.getRenderTarget();
|
|
10613
10858
|
gl.setRenderTarget(nextTarget);
|
|
10614
10859
|
gl.clear();
|
|
@@ -11158,12 +11403,12 @@ function Scenes({
|
|
|
11158
11403
|
// src/hotspot/image-hotspot.tsx
|
|
11159
11404
|
var import_fiber22 = require("@react-three/fiber");
|
|
11160
11405
|
var import_react43 = require("react");
|
|
11161
|
-
var
|
|
11406
|
+
var import_three26 = require("three");
|
|
11162
11407
|
|
|
11163
11408
|
// src/hotspot/hotspot-anchor.tsx
|
|
11164
11409
|
var import_fiber21 = require("@react-three/fiber");
|
|
11165
11410
|
var import_react42 = require("react");
|
|
11166
|
-
var
|
|
11411
|
+
var import_three24 = require("three");
|
|
11167
11412
|
|
|
11168
11413
|
// src/hotspot/hotspot-tooltip.tsx
|
|
11169
11414
|
var import_react40 = require("react");
|
|
@@ -11172,7 +11417,7 @@ var import_react40 = require("react");
|
|
|
11172
11417
|
var import_fiber19 = require("@react-three/fiber");
|
|
11173
11418
|
var import_react39 = require("react");
|
|
11174
11419
|
var import_client = require("react-dom/client");
|
|
11175
|
-
var
|
|
11420
|
+
var import_three21 = require("three");
|
|
11176
11421
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
11177
11422
|
function useFallbackStereoView() {
|
|
11178
11423
|
const runtime = (0, import_react39.useContext)(WebVRRuntimeContext);
|
|
@@ -11195,7 +11440,7 @@ function ProjectedHtml({
|
|
|
11195
11440
|
const { camera, gl, events, size } = (0, import_fiber19.useThree)();
|
|
11196
11441
|
const group = (0, import_react39.useRef)(null);
|
|
11197
11442
|
const overlay = (0, import_react39.useRef)(null);
|
|
11198
|
-
const scratch = (0, import_react39.useRef)(new
|
|
11443
|
+
const scratch = (0, import_react39.useRef)(new import_three21.Vector3());
|
|
11199
11444
|
const target = events.connected || gl.domElement.parentElement;
|
|
11200
11445
|
const updatePosition = () => {
|
|
11201
11446
|
const anchor = group.current;
|
|
@@ -11395,18 +11640,18 @@ function HotspotTooltip({
|
|
|
11395
11640
|
}
|
|
11396
11641
|
|
|
11397
11642
|
// src/hotspot/transform.ts
|
|
11398
|
-
var
|
|
11399
|
-
var LOCAL_FORWARD = new
|
|
11400
|
-
var CAMERA_POSITION = new
|
|
11643
|
+
var import_three22 = require("three");
|
|
11644
|
+
var LOCAL_FORWARD = new import_three22.Vector3(0, 0, 1);
|
|
11645
|
+
var CAMERA_POSITION = new import_three22.Vector3();
|
|
11401
11646
|
function applyHotspotTransform(group, camera, orientation2, surfaceQuaternion3, rotation, scaleMode, referenceFov, useAngularScale, worldWidth, worldHeight, distance) {
|
|
11402
11647
|
if (orientation2 === "billboard") {
|
|
11403
11648
|
group.quaternion.copy(camera.quaternion);
|
|
11404
11649
|
} else {
|
|
11405
11650
|
group.quaternion.copy(surfaceQuaternion3);
|
|
11406
11651
|
}
|
|
11407
|
-
group.rotateOnAxis(LOCAL_FORWARD,
|
|
11408
|
-
let scaleFactor = scaleMode === "fixed" && camera instanceof
|
|
11409
|
-
if (scaleMode === "fixed" && orientation2 === "billboard" && useAngularScale && camera instanceof
|
|
11652
|
+
group.rotateOnAxis(LOCAL_FORWARD, import_three22.MathUtils.degToRad(-rotation));
|
|
11653
|
+
let scaleFactor = scaleMode === "fixed" && camera instanceof import_three22.PerspectiveCamera ? fixedScaleFactor(camera.fov, referenceFov) : 1;
|
|
11654
|
+
if (scaleMode === "fixed" && orientation2 === "billboard" && useAngularScale && camera instanceof import_three22.PerspectiveCamera) {
|
|
11410
11655
|
group.updateWorldMatrix(true, false);
|
|
11411
11656
|
CAMERA_POSITION.setFromMatrixPosition(group.matrixWorld).applyMatrix4(
|
|
11412
11657
|
camera.matrixWorldInverse
|
|
@@ -11421,17 +11666,17 @@ function applyHotspotTransform(group, camera, orientation2, surfaceQuaternion3,
|
|
|
11421
11666
|
group.updateMatrixWorld();
|
|
11422
11667
|
}
|
|
11423
11668
|
function fixedScaleFactor(cameraFov, referenceFov) {
|
|
11424
|
-
const safeReferenceFov =
|
|
11425
|
-
return Math.tan(
|
|
11669
|
+
const safeReferenceFov = import_three22.MathUtils.clamp(referenceFov, 1, 179);
|
|
11670
|
+
return Math.tan(import_three22.MathUtils.degToRad(cameraFov) / 2) / Math.tan(import_three22.MathUtils.degToRad(safeReferenceFov) / 2);
|
|
11426
11671
|
}
|
|
11427
11672
|
|
|
11428
11673
|
// src/hotspot/hotspot-stroke-line.tsx
|
|
11429
11674
|
var import_drei = require("@react-three/drei");
|
|
11430
11675
|
var import_fiber20 = require("@react-three/fiber");
|
|
11431
11676
|
var import_react41 = require("react");
|
|
11432
|
-
var
|
|
11677
|
+
var import_three23 = require("three");
|
|
11433
11678
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
11434
|
-
var LINE_WORLD_POSITION = new
|
|
11679
|
+
var LINE_WORLD_POSITION = new import_three23.Vector3();
|
|
11435
11680
|
function applyScreenSpaceDashScale(object, camera, viewportHeight) {
|
|
11436
11681
|
const material = object?.material;
|
|
11437
11682
|
if (!object || typeof material?.dashScale !== "number") {
|
|
@@ -11439,8 +11684,8 @@ function applyScreenSpaceDashScale(object, camera, viewportHeight) {
|
|
|
11439
11684
|
}
|
|
11440
11685
|
object.getWorldPosition(LINE_WORLD_POSITION);
|
|
11441
11686
|
const depth = Math.max(camera.position.distanceTo(LINE_WORLD_POSITION), 1);
|
|
11442
|
-
const fov = camera instanceof
|
|
11443
|
-
material.dashScale = viewportHeight / (2 * Math.tan(
|
|
11687
|
+
const fov = camera instanceof import_three23.PerspectiveCamera ? camera.fov : 75;
|
|
11688
|
+
material.dashScale = viewportHeight / (2 * Math.tan(import_three23.MathUtils.degToRad(fov) * 0.5) * depth);
|
|
11444
11689
|
}
|
|
11445
11690
|
function resolveDash(dashSize, gapSize) {
|
|
11446
11691
|
if (dashSize === void 0 || !Number.isFinite(dashSize) || dashSize <= 0) {
|
|
@@ -11513,27 +11758,27 @@ var SELECTION_BORDER_POINTS = [
|
|
|
11513
11758
|
[-0.5, 0.5, 1e-3],
|
|
11514
11759
|
[-0.5, -0.5, 1e-3]
|
|
11515
11760
|
];
|
|
11516
|
-
var TOOLTIP_WORLD_BOX = new
|
|
11517
|
-
var TOOLTIP_LOCAL_BOX = new
|
|
11518
|
-
var TOOLTIP_CORNER = new
|
|
11519
|
-
var TOOLTIP_INVERSE = new
|
|
11520
|
-
var TOOLTIP_WORLD_CORNER = new
|
|
11521
|
-
var TOOLTIP_PROJECTED = new
|
|
11522
|
-
var TOOLTIP_RAY_ORIGIN = new
|
|
11523
|
-
var TOOLTIP_RAY_FAR = new
|
|
11524
|
-
var TOOLTIP_RAY_DIRECTION = new
|
|
11525
|
-
var TOOLTIP_RAY = new
|
|
11526
|
-
var TOOLTIP_PLANE = new
|
|
11527
|
-
var TOOLTIP_INTERSECTION = new
|
|
11528
|
-
var TOOLTIP_PLANE_NORMAL = new
|
|
11529
|
-
var TOOLTIP_PLANE_POINT = new
|
|
11761
|
+
var TOOLTIP_WORLD_BOX = new import_three24.Box3();
|
|
11762
|
+
var TOOLTIP_LOCAL_BOX = new import_three24.Box3();
|
|
11763
|
+
var TOOLTIP_CORNER = new import_three24.Vector3();
|
|
11764
|
+
var TOOLTIP_INVERSE = new import_three24.Matrix4();
|
|
11765
|
+
var TOOLTIP_WORLD_CORNER = new import_three24.Vector3();
|
|
11766
|
+
var TOOLTIP_PROJECTED = new import_three24.Vector3();
|
|
11767
|
+
var TOOLTIP_RAY_ORIGIN = new import_three24.Vector3();
|
|
11768
|
+
var TOOLTIP_RAY_FAR = new import_three24.Vector3();
|
|
11769
|
+
var TOOLTIP_RAY_DIRECTION = new import_three24.Vector3();
|
|
11770
|
+
var TOOLTIP_RAY = new import_three24.Ray();
|
|
11771
|
+
var TOOLTIP_PLANE = new import_three24.Plane();
|
|
11772
|
+
var TOOLTIP_INTERSECTION = new import_three24.Vector3();
|
|
11773
|
+
var TOOLTIP_PLANE_NORMAL = new import_three24.Vector3();
|
|
11774
|
+
var TOOLTIP_PLANE_POINT = new import_three24.Vector3();
|
|
11530
11775
|
var HOTSPOT_MODE_RENDERING = {
|
|
11531
11776
|
surface: { orientation: "surface", placement: "surface" },
|
|
11532
11777
|
billboard: { orientation: "billboard", placement: "floating" }
|
|
11533
11778
|
};
|
|
11534
11779
|
function angularSizeToWorldSize(size, radius) {
|
|
11535
|
-
const safeSize = Number.isFinite(size) ?
|
|
11536
|
-
return 2 * radius * Math.tan(
|
|
11780
|
+
const safeSize = Number.isFinite(size) ? import_three24.MathUtils.clamp(Math.abs(size), MIN_ANGULAR_SIZE, MAX_ANGULAR_SIZE) : MIN_ANGULAR_SIZE;
|
|
11781
|
+
return 2 * radius * Math.tan(import_three24.MathUtils.degToRad(safeSize) / 2);
|
|
11537
11782
|
}
|
|
11538
11783
|
function resolveScale(scale) {
|
|
11539
11784
|
return Number.isFinite(scale) && scale > 0 ? scale : 1;
|
|
@@ -11546,39 +11791,39 @@ function resolveDistance(placement, distance, width, height) {
|
|
|
11546
11791
|
if (!Number.isFinite(distance)) {
|
|
11547
11792
|
return DEFAULT_FLOATING_DISTANCE;
|
|
11548
11793
|
}
|
|
11549
|
-
return
|
|
11794
|
+
return import_three24.MathUtils.clamp(Math.abs(distance), 0.1, maximumDistance);
|
|
11550
11795
|
}
|
|
11551
11796
|
function maximumHotspotDistance(width, height) {
|
|
11552
|
-
const safeWidth =
|
|
11797
|
+
const safeWidth = import_three24.MathUtils.clamp(
|
|
11553
11798
|
Math.abs(Number.isFinite(width) ? width : MIN_ANGULAR_SIZE),
|
|
11554
11799
|
MIN_ANGULAR_SIZE,
|
|
11555
11800
|
MAX_ANGULAR_SIZE
|
|
11556
11801
|
);
|
|
11557
|
-
const safeHeight =
|
|
11802
|
+
const safeHeight = import_three24.MathUtils.clamp(
|
|
11558
11803
|
Math.abs(Number.isFinite(height) ? height : MIN_ANGULAR_SIZE),
|
|
11559
11804
|
MIN_ANGULAR_SIZE,
|
|
11560
11805
|
MAX_ANGULAR_SIZE
|
|
11561
11806
|
);
|
|
11562
11807
|
const cornerFactor = Math.hypot(
|
|
11563
11808
|
1,
|
|
11564
|
-
Math.tan(
|
|
11565
|
-
Math.tan(
|
|
11809
|
+
Math.tan(import_three24.MathUtils.degToRad(safeWidth) / 2),
|
|
11810
|
+
Math.tan(import_three24.MathUtils.degToRad(safeHeight) / 2)
|
|
11566
11811
|
);
|
|
11567
11812
|
return (PANORAMA_RADIUS - PANORAMA_SURFACE_INSET) / cornerFactor;
|
|
11568
11813
|
}
|
|
11569
11814
|
function createSurfaceQuaternion(position) {
|
|
11570
11815
|
const outward = panoPositionToVector3(position).normalize();
|
|
11571
11816
|
const inward = outward.clone().negate();
|
|
11572
|
-
const pitch =
|
|
11573
|
-
const yaw =
|
|
11574
|
-
const localUp = new
|
|
11817
|
+
const pitch = import_three24.MathUtils.degToRad(position.pitch);
|
|
11818
|
+
const yaw = import_three24.MathUtils.degToRad(position.yaw);
|
|
11819
|
+
const localUp = new import_three24.Vector3(
|
|
11575
11820
|
-Math.sin(pitch) * Math.sin(yaw),
|
|
11576
11821
|
Math.cos(pitch),
|
|
11577
11822
|
Math.sin(pitch) * Math.cos(yaw)
|
|
11578
11823
|
).normalize();
|
|
11579
11824
|
const localRight = localUp.clone().cross(inward).normalize();
|
|
11580
|
-
const basis = new
|
|
11581
|
-
return new
|
|
11825
|
+
const basis = new import_three24.Matrix4().makeBasis(localRight, localUp, inward);
|
|
11826
|
+
return new import_three24.Quaternion().setFromRotationMatrix(basis);
|
|
11582
11827
|
}
|
|
11583
11828
|
function makeInteractionEvent(id, position, event) {
|
|
11584
11829
|
return {
|
|
@@ -11591,7 +11836,7 @@ function makeInteractionEvent(id, position, event) {
|
|
|
11591
11836
|
function angularDistance(a, b) {
|
|
11592
11837
|
const aVector = panoPositionToVector3(a);
|
|
11593
11838
|
const bVector = panoPositionToVector3(b);
|
|
11594
|
-
return
|
|
11839
|
+
return import_three24.MathUtils.radToDeg(aVector.angleTo(bVector));
|
|
11595
11840
|
}
|
|
11596
11841
|
function isTooltipOpen(trigger, hovered, focused, pinned) {
|
|
11597
11842
|
switch (trigger) {
|
|
@@ -11868,8 +12113,8 @@ function HotspotAnchor({
|
|
|
11868
12113
|
const worldWidth = angularSizeToWorldSize(scaledWidth, resolvedDistance);
|
|
11869
12114
|
const worldHeight = angularSizeToWorldSize(scaledHeight, resolvedDistance);
|
|
11870
12115
|
const focusGeometry = (0, import_react42.useMemo)(() => {
|
|
11871
|
-
const planeGeometry = new
|
|
11872
|
-
const geometry = new
|
|
12116
|
+
const planeGeometry = new import_three24.PlaneGeometry(1, 1);
|
|
12117
|
+
const geometry = new import_three24.EdgesGeometry(planeGeometry);
|
|
11873
12118
|
planeGeometry.dispose();
|
|
11874
12119
|
return geometry;
|
|
11875
12120
|
}, []);
|
|
@@ -12185,10 +12430,10 @@ function HotspotAnchor({
|
|
|
12185
12430
|
}
|
|
12186
12431
|
|
|
12187
12432
|
// src/hotspot/hotspot-plane.tsx
|
|
12188
|
-
var
|
|
12433
|
+
var import_three25 = require("three");
|
|
12189
12434
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
12190
12435
|
var HOTSPOT_ALPHA_CUTOFF = 0.05;
|
|
12191
|
-
var SAMPLE_UV = new
|
|
12436
|
+
var SAMPLE_UV = new import_three25.Vector2();
|
|
12192
12437
|
var RAYCAST_HITS = [];
|
|
12193
12438
|
var IMAGE_DATA_CACHE = /* @__PURE__ */ new WeakMap();
|
|
12194
12439
|
function clampOpacity(opacity) {
|
|
@@ -12262,8 +12507,8 @@ function sampleTextureAlpha(texture, u, v) {
|
|
|
12262
12507
|
}
|
|
12263
12508
|
function hotspotPlaneRaycast(raycaster, intersects2) {
|
|
12264
12509
|
const material = Array.isArray(this.material) ? this.material[0] : this.material;
|
|
12265
|
-
if (!(material instanceof
|
|
12266
|
-
|
|
12510
|
+
if (!(material instanceof import_three25.MeshBasicMaterial)) {
|
|
12511
|
+
import_three25.Mesh.prototype.raycast.call(this, raycaster, intersects2);
|
|
12267
12512
|
return;
|
|
12268
12513
|
}
|
|
12269
12514
|
const cutoff = Math.max(material.alphaTest, HOTSPOT_ALPHA_CUTOFF);
|
|
@@ -12271,7 +12516,7 @@ function hotspotPlaneRaycast(raycaster, intersects2) {
|
|
|
12271
12516
|
return;
|
|
12272
12517
|
}
|
|
12273
12518
|
RAYCAST_HITS.length = 0;
|
|
12274
|
-
|
|
12519
|
+
import_three25.Mesh.prototype.raycast.call(this, raycaster, RAYCAST_HITS);
|
|
12275
12520
|
const map = material.map;
|
|
12276
12521
|
for (const hit of RAYCAST_HITS) {
|
|
12277
12522
|
if (!map || !hit.uv) {
|
|
@@ -12297,7 +12542,7 @@ function HotspotPlane({
|
|
|
12297
12542
|
alphaTest: HOTSPOT_ALPHA_CUTOFF,
|
|
12298
12543
|
map,
|
|
12299
12544
|
opacity: map ? clampOpacity(opacity) : 0,
|
|
12300
|
-
side:
|
|
12545
|
+
side: import_three25.DoubleSide,
|
|
12301
12546
|
toneMapped: false,
|
|
12302
12547
|
transparent: true
|
|
12303
12548
|
}
|
|
@@ -12322,7 +12567,7 @@ function useHotspotImageTexture(src, onLoad, onError) {
|
|
|
12322
12567
|
active = false;
|
|
12323
12568
|
};
|
|
12324
12569
|
}
|
|
12325
|
-
const loader = new
|
|
12570
|
+
const loader = new import_three26.TextureLoader();
|
|
12326
12571
|
loader.load(
|
|
12327
12572
|
src,
|
|
12328
12573
|
(loadedTexture) => {
|
|
@@ -12330,11 +12575,11 @@ function useHotspotImageTexture(src, onLoad, onError) {
|
|
|
12330
12575
|
loadedTexture.dispose();
|
|
12331
12576
|
return;
|
|
12332
12577
|
}
|
|
12333
|
-
loadedTexture.colorSpace =
|
|
12334
|
-
loadedTexture.wrapS =
|
|
12335
|
-
loadedTexture.wrapT =
|
|
12336
|
-
loadedTexture.magFilter =
|
|
12337
|
-
loadedTexture.minFilter =
|
|
12578
|
+
loadedTexture.colorSpace = import_three26.SRGBColorSpace;
|
|
12579
|
+
loadedTexture.wrapS = import_three26.ClampToEdgeWrapping;
|
|
12580
|
+
loadedTexture.wrapT = import_three26.ClampToEdgeWrapping;
|
|
12581
|
+
loadedTexture.magFilter = import_three26.LinearFilter;
|
|
12582
|
+
loadedTexture.minFilter = import_three26.LinearMipmapLinearFilter;
|
|
12338
12583
|
loadedTexture.generateMipmaps = true;
|
|
12339
12584
|
loadedTexture.anisotropy = gl.capabilities.getMaxAnisotropy();
|
|
12340
12585
|
loadedTexture.needsUpdate = true;
|
|
@@ -12375,7 +12620,7 @@ function ImageHotspot({
|
|
|
12375
12620
|
|
|
12376
12621
|
// src/hotspot/graphic-hotspot.tsx
|
|
12377
12622
|
var import_react44 = require("react");
|
|
12378
|
-
var
|
|
12623
|
+
var import_three27 = require("three");
|
|
12379
12624
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
12380
12625
|
var GRAPHIC_TEXTURE_SIZE = 512;
|
|
12381
12626
|
function resolveStrokeWidth(value) {
|
|
@@ -12554,12 +12799,12 @@ function createGraphicTexture(graphic, aspectWidth, aspectHeight) {
|
|
|
12554
12799
|
throw new Error("Canvas 2D is unavailable for this graphic hotspot.");
|
|
12555
12800
|
}
|
|
12556
12801
|
drawGraphic(context, graphic, aspectWidth, aspectHeight);
|
|
12557
|
-
const texture = new
|
|
12558
|
-
texture.colorSpace =
|
|
12559
|
-
texture.wrapS =
|
|
12560
|
-
texture.wrapT =
|
|
12561
|
-
texture.magFilter =
|
|
12562
|
-
texture.minFilter =
|
|
12802
|
+
const texture = new import_three27.CanvasTexture(canvas);
|
|
12803
|
+
texture.colorSpace = import_three27.SRGBColorSpace;
|
|
12804
|
+
texture.wrapS = import_three27.ClampToEdgeWrapping;
|
|
12805
|
+
texture.wrapT = import_three27.ClampToEdgeWrapping;
|
|
12806
|
+
texture.magFilter = import_three27.LinearFilter;
|
|
12807
|
+
texture.minFilter = import_three27.LinearMipmapLinearFilter;
|
|
12563
12808
|
texture.generateMipmaps = true;
|
|
12564
12809
|
texture.needsUpdate = true;
|
|
12565
12810
|
return texture;
|
|
@@ -12610,7 +12855,7 @@ function GraphicHotspot(props) {
|
|
|
12610
12855
|
// src/hotspot/sequence-hotspot.tsx
|
|
12611
12856
|
var import_fiber23 = require("@react-three/fiber");
|
|
12612
12857
|
var import_react45 = require("react");
|
|
12613
|
-
var
|
|
12858
|
+
var import_three28 = require("three");
|
|
12614
12859
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
12615
12860
|
var DEFAULT_SEQUENCE_FPS = 12;
|
|
12616
12861
|
function resolveFps(value) {
|
|
@@ -12640,7 +12885,7 @@ function useSpriteTexture({
|
|
|
12640
12885
|
active = false;
|
|
12641
12886
|
};
|
|
12642
12887
|
}
|
|
12643
|
-
const loader = new
|
|
12888
|
+
const loader = new import_three28.TextureLoader();
|
|
12644
12889
|
loader.load(
|
|
12645
12890
|
src,
|
|
12646
12891
|
(loadedTexture) => {
|
|
@@ -12648,11 +12893,11 @@ function useSpriteTexture({
|
|
|
12648
12893
|
loadedTexture.dispose();
|
|
12649
12894
|
return;
|
|
12650
12895
|
}
|
|
12651
|
-
loadedTexture.colorSpace =
|
|
12652
|
-
loadedTexture.wrapS =
|
|
12653
|
-
loadedTexture.wrapT =
|
|
12654
|
-
loadedTexture.magFilter =
|
|
12655
|
-
loadedTexture.minFilter =
|
|
12896
|
+
loadedTexture.colorSpace = import_three28.SRGBColorSpace;
|
|
12897
|
+
loadedTexture.wrapS = import_three28.ClampToEdgeWrapping;
|
|
12898
|
+
loadedTexture.wrapT = import_three28.ClampToEdgeWrapping;
|
|
12899
|
+
loadedTexture.magFilter = import_three28.LinearFilter;
|
|
12900
|
+
loadedTexture.minFilter = import_three28.LinearMipmapLinearFilter;
|
|
12656
12901
|
loadedTexture.generateMipmaps = true;
|
|
12657
12902
|
loadedTexture.anisotropy = gl.capabilities.getMaxAnisotropy();
|
|
12658
12903
|
loadedTexture.needsUpdate = true;
|
|
@@ -12793,7 +13038,7 @@ function SequenceHotspot({
|
|
|
12793
13038
|
// src/hotspot/video-hotspot.tsx
|
|
12794
13039
|
var import_fiber24 = require("@react-three/fiber");
|
|
12795
13040
|
var import_react46 = require("react");
|
|
12796
|
-
var
|
|
13041
|
+
var import_three29 = require("three");
|
|
12797
13042
|
|
|
12798
13043
|
// src/video/inline-playback.ts
|
|
12799
13044
|
var INLINE_VIDEO_ATTRIBUTES = [
|
|
@@ -12866,7 +13111,7 @@ function usePosterTexture(id, poster, onError) {
|
|
|
12866
13111
|
active = false;
|
|
12867
13112
|
};
|
|
12868
13113
|
}
|
|
12869
|
-
const loader = new
|
|
13114
|
+
const loader = new import_three29.TextureLoader();
|
|
12870
13115
|
loader.load(
|
|
12871
13116
|
poster,
|
|
12872
13117
|
(loadedTexture) => {
|
|
@@ -12874,11 +13119,11 @@ function usePosterTexture(id, poster, onError) {
|
|
|
12874
13119
|
loadedTexture.dispose();
|
|
12875
13120
|
return;
|
|
12876
13121
|
}
|
|
12877
|
-
loadedTexture.colorSpace =
|
|
12878
|
-
loadedTexture.wrapS =
|
|
12879
|
-
loadedTexture.wrapT =
|
|
12880
|
-
loadedTexture.magFilter =
|
|
12881
|
-
loadedTexture.minFilter =
|
|
13122
|
+
loadedTexture.colorSpace = import_three29.SRGBColorSpace;
|
|
13123
|
+
loadedTexture.wrapS = import_three29.ClampToEdgeWrapping;
|
|
13124
|
+
loadedTexture.wrapT = import_three29.ClampToEdgeWrapping;
|
|
13125
|
+
loadedTexture.magFilter = import_three29.LinearFilter;
|
|
13126
|
+
loadedTexture.minFilter = import_three29.LinearMipmapLinearFilter;
|
|
12882
13127
|
loadedTexture.generateMipmaps = true;
|
|
12883
13128
|
loadedTexture.anisotropy = gl.capabilities.getMaxAnisotropy();
|
|
12884
13129
|
loadedTexture.needsUpdate = true;
|
|
@@ -12933,12 +13178,12 @@ function useVideoResource({
|
|
|
12933
13178
|
}
|
|
12934
13179
|
applyInlineVideoPlayback(video, playsInline ?? true);
|
|
12935
13180
|
video.poster = poster ?? "";
|
|
12936
|
-
const texture = new
|
|
12937
|
-
texture.colorSpace =
|
|
12938
|
-
texture.wrapS =
|
|
12939
|
-
texture.wrapT =
|
|
12940
|
-
texture.magFilter =
|
|
12941
|
-
texture.minFilter =
|
|
13181
|
+
const texture = new import_three29.VideoTexture(video);
|
|
13182
|
+
texture.colorSpace = import_three29.SRGBColorSpace;
|
|
13183
|
+
texture.wrapS = import_three29.ClampToEdgeWrapping;
|
|
13184
|
+
texture.wrapT = import_three29.ClampToEdgeWrapping;
|
|
13185
|
+
texture.magFilter = import_three29.LinearFilter;
|
|
13186
|
+
texture.minFilter = import_three29.LinearFilter;
|
|
12942
13187
|
texture.generateMipmaps = false;
|
|
12943
13188
|
const notifyState = (state) => {
|
|
12944
13189
|
if (active) {
|
|
@@ -13077,13 +13322,13 @@ function VideoHotspot({
|
|
|
13077
13322
|
// src/hotspot/audio-hotspot.tsx
|
|
13078
13323
|
var import_fiber25 = require("@react-three/fiber");
|
|
13079
13324
|
var import_react47 = require("react");
|
|
13080
|
-
var
|
|
13325
|
+
var import_three31 = require("three");
|
|
13081
13326
|
|
|
13082
13327
|
// src/hotspot/audio-spatial.ts
|
|
13083
|
-
var
|
|
13084
|
-
var LOOK_DIR = new
|
|
13085
|
-
var SOURCE_DIR = new
|
|
13086
|
-
var RIGHT_DIR = new
|
|
13328
|
+
var import_three30 = require("three");
|
|
13329
|
+
var LOOK_DIR = new import_three30.Vector3();
|
|
13330
|
+
var SOURCE_DIR = new import_three30.Vector3();
|
|
13331
|
+
var RIGHT_DIR = new import_three30.Vector3();
|
|
13087
13332
|
function clampAudioVolume(volume) {
|
|
13088
13333
|
if (!Number.isFinite(volume)) {
|
|
13089
13334
|
return 1;
|
|
@@ -13108,11 +13353,11 @@ function lookRangeGain(angleDegrees, range) {
|
|
|
13108
13353
|
function audioSpatialFromView(camera, position, range) {
|
|
13109
13354
|
camera.getWorldDirection(LOOK_DIR);
|
|
13110
13355
|
SOURCE_DIR.copy(panoPositionToVector3(position)).normalize();
|
|
13111
|
-
const angleDegrees =
|
|
13112
|
-
Math.acos(
|
|
13356
|
+
const angleDegrees = import_three30.MathUtils.radToDeg(
|
|
13357
|
+
Math.acos(import_three30.MathUtils.clamp(LOOK_DIR.dot(SOURCE_DIR), -1, 1))
|
|
13113
13358
|
);
|
|
13114
13359
|
RIGHT_DIR.set(1, 0, 0).applyQuaternion(camera.quaternion);
|
|
13115
|
-
const pan =
|
|
13360
|
+
const pan = import_three30.MathUtils.clamp(
|
|
13116
13361
|
Math.atan2(SOURCE_DIR.dot(RIGHT_DIR), SOURCE_DIR.dot(LOOK_DIR)) / (Math.PI / 2),
|
|
13117
13362
|
-1,
|
|
13118
13363
|
1
|
|
@@ -13177,12 +13422,12 @@ function createSpeakerTexture(state) {
|
|
|
13177
13422
|
return exhaustive;
|
|
13178
13423
|
}
|
|
13179
13424
|
}
|
|
13180
|
-
const texture = new
|
|
13181
|
-
texture.colorSpace =
|
|
13182
|
-
texture.wrapS =
|
|
13183
|
-
texture.wrapT =
|
|
13184
|
-
texture.magFilter =
|
|
13185
|
-
texture.minFilter =
|
|
13425
|
+
const texture = new import_three31.CanvasTexture(canvas);
|
|
13426
|
+
texture.colorSpace = import_three31.SRGBColorSpace;
|
|
13427
|
+
texture.wrapS = import_three31.ClampToEdgeWrapping;
|
|
13428
|
+
texture.wrapT = import_three31.ClampToEdgeWrapping;
|
|
13429
|
+
texture.magFilter = import_three31.LinearFilter;
|
|
13430
|
+
texture.minFilter = import_three31.LinearMipmapLinearFilter;
|
|
13186
13431
|
texture.generateMipmaps = true;
|
|
13187
13432
|
texture.needsUpdate = true;
|
|
13188
13433
|
return texture;
|
|
@@ -13217,7 +13462,7 @@ function useIconTexture(icon, enabled, onError, id) {
|
|
|
13217
13462
|
active = false;
|
|
13218
13463
|
};
|
|
13219
13464
|
}
|
|
13220
|
-
const loader = new
|
|
13465
|
+
const loader = new import_three31.TextureLoader();
|
|
13221
13466
|
loader.load(
|
|
13222
13467
|
icon,
|
|
13223
13468
|
(loadedTexture) => {
|
|
@@ -13225,11 +13470,11 @@ function useIconTexture(icon, enabled, onError, id) {
|
|
|
13225
13470
|
loadedTexture.dispose();
|
|
13226
13471
|
return;
|
|
13227
13472
|
}
|
|
13228
|
-
loadedTexture.colorSpace =
|
|
13229
|
-
loadedTexture.wrapS =
|
|
13230
|
-
loadedTexture.wrapT =
|
|
13231
|
-
loadedTexture.magFilter =
|
|
13232
|
-
loadedTexture.minFilter =
|
|
13473
|
+
loadedTexture.colorSpace = import_three31.SRGBColorSpace;
|
|
13474
|
+
loadedTexture.wrapS = import_three31.ClampToEdgeWrapping;
|
|
13475
|
+
loadedTexture.wrapT = import_three31.ClampToEdgeWrapping;
|
|
13476
|
+
loadedTexture.magFilter = import_three31.LinearFilter;
|
|
13477
|
+
loadedTexture.minFilter = import_three31.LinearMipmapLinearFilter;
|
|
13233
13478
|
loadedTexture.generateMipmaps = true;
|
|
13234
13479
|
loadedTexture.anisotropy = gl.capabilities.getMaxAnisotropy();
|
|
13235
13480
|
loadedTexture.needsUpdate = true;
|
|
@@ -13420,7 +13665,7 @@ function AudioHotspot({
|
|
|
13420
13665
|
// src/hotspot/text-hotspot.tsx
|
|
13421
13666
|
var import_react48 = require("react");
|
|
13422
13667
|
var import_fiber26 = require("@react-three/fiber");
|
|
13423
|
-
var
|
|
13668
|
+
var import_three32 = require("three");
|
|
13424
13669
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
13425
13670
|
var TEXT_TEXTURE_LONG_SIDE = 1024;
|
|
13426
13671
|
var TEXT_RASTER_SUPERSAMPLE = 2;
|
|
@@ -13492,7 +13737,7 @@ function projectedDevicePixels(angleDeg, fovDeg, viewportHeight) {
|
|
|
13492
13737
|
}
|
|
13493
13738
|
const fov = Math.min(179, Math.max(1, resolvePositive(fovDeg, DEFAULT_REFERENCE_FOV2)));
|
|
13494
13739
|
const angle = Math.min(179, Math.max(0.01, Math.abs(angleDeg)));
|
|
13495
|
-
return Math.tan(
|
|
13740
|
+
return Math.tan(import_three32.MathUtils.degToRad(angle) / 2) / Math.tan(import_three32.MathUtils.degToRad(fov) / 2) * viewportHeight;
|
|
13496
13741
|
}
|
|
13497
13742
|
function snapRasterLongSide(screenLong, layoutLong) {
|
|
13498
13743
|
if (!(screenLong > 0)) {
|
|
@@ -13677,12 +13922,12 @@ function createTextTexture(text, width, height, style, rasterLong) {
|
|
|
13677
13922
|
fontSize: resolvePositive(style.fontSize, DEFAULT_FONT_SIZE) * scale,
|
|
13678
13923
|
strokeWidth: Number.isFinite(style.strokeWidth) ? style.strokeWidth * scale : style.strokeWidth
|
|
13679
13924
|
});
|
|
13680
|
-
const texture = new
|
|
13681
|
-
texture.colorSpace =
|
|
13682
|
-
texture.wrapS =
|
|
13683
|
-
texture.wrapT =
|
|
13684
|
-
texture.magFilter =
|
|
13685
|
-
texture.minFilter =
|
|
13925
|
+
const texture = new import_three32.CanvasTexture(canvas);
|
|
13926
|
+
texture.colorSpace = import_three32.SRGBColorSpace;
|
|
13927
|
+
texture.wrapS = import_three32.ClampToEdgeWrapping;
|
|
13928
|
+
texture.wrapT = import_three32.ClampToEdgeWrapping;
|
|
13929
|
+
texture.magFilter = import_three32.LinearFilter;
|
|
13930
|
+
texture.minFilter = import_three32.LinearFilter;
|
|
13686
13931
|
texture.generateMipmaps = false;
|
|
13687
13932
|
texture.needsUpdate = true;
|
|
13688
13933
|
return texture;
|
|
@@ -13694,7 +13939,7 @@ function useRasterLongSide(width, height, scale, scaleMode, referenceFov) {
|
|
|
13694
13939
|
const measure = () => {
|
|
13695
13940
|
const pixelRatio = getPixelRatio();
|
|
13696
13941
|
const viewportHeight = size.height * (Number.isFinite(pixelRatio) && pixelRatio > 0 ? pixelRatio : 1);
|
|
13697
|
-
const cameraFov = camera instanceof
|
|
13942
|
+
const cameraFov = camera instanceof import_three32.PerspectiveCamera ? camera.fov : DEFAULT_REFERENCE_FOV2;
|
|
13698
13943
|
const screenLong = Math.max(
|
|
13699
13944
|
projectedDevicePixels(
|
|
13700
13945
|
width * resolveScale2(scale),
|
|
@@ -13846,7 +14091,7 @@ function TextHotspot({
|
|
|
13846
14091
|
|
|
13847
14092
|
// src/hotspot/iframe-hotspot.tsx
|
|
13848
14093
|
var import_drei2 = require("@react-three/drei");
|
|
13849
|
-
var
|
|
14094
|
+
var import_three33 = require("three");
|
|
13850
14095
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
13851
14096
|
var IFRAME_LONG_SIDE = 800;
|
|
13852
14097
|
var CSS3D_DISTANCE_FACTOR = 400;
|
|
@@ -13920,7 +14165,7 @@ function IframeHotspot({
|
|
|
13920
14165
|
{
|
|
13921
14166
|
depthWrite: false,
|
|
13922
14167
|
opacity: 0,
|
|
13923
|
-
side:
|
|
14168
|
+
side: import_three33.DoubleSide,
|
|
13924
14169
|
toneMapped: false,
|
|
13925
14170
|
transparent: true
|
|
13926
14171
|
}
|
|
@@ -13964,7 +14209,7 @@ function IframeHotspot({
|
|
|
13964
14209
|
|
|
13965
14210
|
// src/hotspot/polygon-hotspot.tsx
|
|
13966
14211
|
var import_react49 = require("react");
|
|
13967
|
-
var
|
|
14212
|
+
var import_three34 = require("three");
|
|
13968
14213
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
13969
14214
|
var POLYGON_RADIUS = 990;
|
|
13970
14215
|
var MAX_FILL_SEGMENT_DEGREES = 7;
|
|
@@ -14000,7 +14245,7 @@ function intersects(a, b, c, d) {
|
|
|
14000
14245
|
}
|
|
14001
14246
|
function hasSelfIntersection(vertices) {
|
|
14002
14247
|
const points = vertices.map(
|
|
14003
|
-
(vertex) => new
|
|
14248
|
+
(vertex) => new import_three34.Vector2(vertex.unwrappedYaw, vertex.pitch)
|
|
14004
14249
|
);
|
|
14005
14250
|
for (let index = 0; index < points.length; index += 1) {
|
|
14006
14251
|
const nextIndex = (index + 1) % points.length;
|
|
@@ -14037,7 +14282,7 @@ function polygonContainsDirection(vertices, direction) {
|
|
|
14037
14282
|
}
|
|
14038
14283
|
function fitsHemisphere(vertices) {
|
|
14039
14284
|
const directions = vertices.map((vertex) => panoPositionToVector3(vertex).normalize());
|
|
14040
|
-
const candidates = [new
|
|
14285
|
+
const candidates = [new import_three34.Vector3()];
|
|
14041
14286
|
for (const direction of directions) {
|
|
14042
14287
|
candidates[0].add(direction);
|
|
14043
14288
|
candidates.push(direction.clone());
|
|
@@ -14061,7 +14306,7 @@ function validatePolygonVertices(vertices) {
|
|
|
14061
14306
|
if (hasSelfIntersection(unwrapped)) {
|
|
14062
14307
|
issues.push({ code: "self_intersection", message: "Polygon edges cannot cross." });
|
|
14063
14308
|
}
|
|
14064
|
-
if (polygonContainsDirection(normalized, new
|
|
14309
|
+
if (polygonContainsDirection(normalized, new import_three34.Vector3(0, 1, 0)) || polygonContainsDirection(normalized, new import_three34.Vector3(0, -1, 0))) {
|
|
14065
14310
|
issues.push({ code: "contains_pole", message: "Polygons cannot contain a panorama pole." });
|
|
14066
14311
|
}
|
|
14067
14312
|
if (!fitsHemisphere(normalized)) {
|
|
@@ -14072,7 +14317,7 @@ function validatePolygonVertices(vertices) {
|
|
|
14072
14317
|
function polygonCenter(vertices) {
|
|
14073
14318
|
const sum = vertices.reduce(
|
|
14074
14319
|
(total, vertex) => total.add(panoPositionToVector3(vertex).normalize()),
|
|
14075
|
-
new
|
|
14320
|
+
new import_three34.Vector3()
|
|
14076
14321
|
);
|
|
14077
14322
|
return sum.lengthSq() > 1e-8 ? vector3ToPanoPosition(sum) : normalizePanoPosition(vertices[0]);
|
|
14078
14323
|
}
|
|
@@ -14081,20 +14326,20 @@ function surfaceQuaternion(position) {
|
|
|
14081
14326
|
const inward = outward.clone().negate();
|
|
14082
14327
|
const pitch = position.pitch * Math.PI / 180;
|
|
14083
14328
|
const yaw = position.yaw * Math.PI / 180;
|
|
14084
|
-
const localUp = new
|
|
14329
|
+
const localUp = new import_three34.Vector3(
|
|
14085
14330
|
-Math.sin(pitch) * Math.sin(yaw),
|
|
14086
14331
|
Math.cos(pitch),
|
|
14087
14332
|
Math.sin(pitch) * Math.cos(yaw)
|
|
14088
14333
|
).normalize();
|
|
14089
|
-
return new
|
|
14090
|
-
new
|
|
14334
|
+
return new import_three34.Quaternion().setFromRotationMatrix(
|
|
14335
|
+
new import_three34.Matrix4().makeBasis(localUp.clone().cross(inward).normalize(), localUp, inward)
|
|
14091
14336
|
);
|
|
14092
14337
|
}
|
|
14093
14338
|
function makeWorldToLocal(center) {
|
|
14094
|
-
return new
|
|
14339
|
+
return new import_three34.Matrix4().compose(
|
|
14095
14340
|
panoPositionToVector3(center, POLYGON_RADIUS),
|
|
14096
14341
|
surfaceQuaternion(center),
|
|
14097
|
-
new
|
|
14342
|
+
new import_three34.Vector3(1, 1, 1)
|
|
14098
14343
|
).invert();
|
|
14099
14344
|
}
|
|
14100
14345
|
function projectedPoint(a, b, c, weightB, weightC, radius, worldToLocal) {
|
|
@@ -14149,8 +14394,8 @@ function addSubdividedTriangle(positions, indices, a, b, c, worldToLocal, steps)
|
|
|
14149
14394
|
}
|
|
14150
14395
|
function makeFillGeometry(vertices, center) {
|
|
14151
14396
|
const unwrapped = unwrapPolygonVertices(vertices);
|
|
14152
|
-
const contour = unwrapped.map((vertex) => new
|
|
14153
|
-
const triangles =
|
|
14397
|
+
const contour = unwrapped.map((vertex) => new import_three34.Vector2(vertex.unwrappedYaw, vertex.pitch));
|
|
14398
|
+
const triangles = import_three34.ShapeUtils.triangulateShape(contour, []);
|
|
14154
14399
|
const positions = [];
|
|
14155
14400
|
const indices = [];
|
|
14156
14401
|
const worldToLocal = makeWorldToLocal(center);
|
|
@@ -14166,7 +14411,7 @@ function makeFillGeometry(vertices, center) {
|
|
|
14166
14411
|
steps
|
|
14167
14412
|
);
|
|
14168
14413
|
}
|
|
14169
|
-
return new
|
|
14414
|
+
return new import_three34.BufferGeometry().setAttribute("position", new import_three34.Float32BufferAttribute(positions, 3)).setIndex(indices);
|
|
14170
14415
|
}
|
|
14171
14416
|
function makeStrokePositions(vertices, center) {
|
|
14172
14417
|
const points = [];
|
|
@@ -14296,7 +14541,7 @@ function PolygonHotspot({
|
|
|
14296
14541
|
color: fill,
|
|
14297
14542
|
depthWrite: false,
|
|
14298
14543
|
opacity: Math.max(0, Math.min(fillOpacity, 1)),
|
|
14299
|
-
side:
|
|
14544
|
+
side: import_three34.DoubleSide,
|
|
14300
14545
|
transparent: true
|
|
14301
14546
|
}
|
|
14302
14547
|
) }),
|
|
@@ -14319,7 +14564,7 @@ function PolygonHotspot({
|
|
|
14319
14564
|
|
|
14320
14565
|
// src/hotspot/polyline-hotspot.tsx
|
|
14321
14566
|
var import_react50 = require("react");
|
|
14322
|
-
var
|
|
14567
|
+
var import_three35 = require("three");
|
|
14323
14568
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
14324
14569
|
var POLYLINE_RADIUS = 990;
|
|
14325
14570
|
var MAX_SEGMENT_DEGREES = 7;
|
|
@@ -14345,29 +14590,29 @@ function unwrapVertices(vertices) {
|
|
|
14345
14590
|
function polylineCenter(vertices) {
|
|
14346
14591
|
const sum = vertices.reduce(
|
|
14347
14592
|
(total, vertex) => total.add(panoPositionToVector3(vertex).normalize()),
|
|
14348
|
-
new
|
|
14593
|
+
new import_three35.Vector3()
|
|
14349
14594
|
);
|
|
14350
14595
|
return sum.lengthSq() > 1e-8 ? vector3ToPanoPosition(sum) : normalizePanoPosition(vertices[0]);
|
|
14351
14596
|
}
|
|
14352
14597
|
function surfaceQuaternion2(position) {
|
|
14353
14598
|
const outward = panoPositionToVector3(position).normalize();
|
|
14354
14599
|
const inward = outward.clone().negate();
|
|
14355
|
-
const pitch =
|
|
14356
|
-
const yaw =
|
|
14357
|
-
const localUp = new
|
|
14600
|
+
const pitch = import_three35.MathUtils.degToRad(position.pitch);
|
|
14601
|
+
const yaw = import_three35.MathUtils.degToRad(position.yaw);
|
|
14602
|
+
const localUp = new import_three35.Vector3(
|
|
14358
14603
|
-Math.sin(pitch) * Math.sin(yaw),
|
|
14359
14604
|
Math.cos(pitch),
|
|
14360
14605
|
Math.sin(pitch) * Math.cos(yaw)
|
|
14361
14606
|
).normalize();
|
|
14362
|
-
return new
|
|
14363
|
-
new
|
|
14607
|
+
return new import_three35.Quaternion().setFromRotationMatrix(
|
|
14608
|
+
new import_three35.Matrix4().makeBasis(localUp.clone().cross(inward).normalize(), localUp, inward)
|
|
14364
14609
|
);
|
|
14365
14610
|
}
|
|
14366
14611
|
function makeWorldToLocal2(center) {
|
|
14367
|
-
return new
|
|
14612
|
+
return new import_three35.Matrix4().compose(
|
|
14368
14613
|
panoPositionToVector3(center, POLYLINE_RADIUS),
|
|
14369
14614
|
surfaceQuaternion2(center),
|
|
14370
|
-
new
|
|
14615
|
+
new import_three35.Vector3(1, 1, 1)
|
|
14371
14616
|
).invert();
|
|
14372
14617
|
}
|
|
14373
14618
|
function subdivisionSteps(vertices) {
|
|
@@ -14382,7 +14627,7 @@ function subdivisionSteps(vertices) {
|
|
|
14382
14627
|
}
|
|
14383
14628
|
return Math.min(
|
|
14384
14629
|
8,
|
|
14385
|
-
Math.max(1, Math.ceil(
|
|
14630
|
+
Math.max(1, Math.ceil(import_three35.MathUtils.radToDeg(maxAngle) / MAX_SEGMENT_DEGREES))
|
|
14386
14631
|
);
|
|
14387
14632
|
}
|
|
14388
14633
|
function makeLinePositions(vertices, center) {
|
|
@@ -15149,12 +15394,12 @@ var import_fiber27 = require("@react-three/fiber");
|
|
|
15149
15394
|
var import_react54 = require("react");
|
|
15150
15395
|
|
|
15151
15396
|
// src/gyro-orientation.ts
|
|
15152
|
-
var
|
|
15153
|
-
var DEVICE_FORWARD_CORRECTION = new
|
|
15154
|
-
new
|
|
15397
|
+
var import_three36 = require("three");
|
|
15398
|
+
var DEVICE_FORWARD_CORRECTION = new import_three36.Quaternion().setFromAxisAngle(
|
|
15399
|
+
new import_three36.Vector3(1, 0, 0),
|
|
15155
15400
|
-Math.PI / 2
|
|
15156
15401
|
);
|
|
15157
|
-
var SCREEN_AXIS = new
|
|
15402
|
+
var SCREEN_AXIS = new import_three36.Vector3(0, 0, 1);
|
|
15158
15403
|
function getScreenOrientationAngle() {
|
|
15159
15404
|
if (typeof window === "undefined") {
|
|
15160
15405
|
return 0;
|
|
@@ -15168,31 +15413,31 @@ function getScreenOrientationAngle() {
|
|
|
15168
15413
|
}
|
|
15169
15414
|
function deviceOrientationToQuaternion(sample, screenOrientation) {
|
|
15170
15415
|
const alpha = Number.isFinite(sample.compassHeading) ? 360 - sample.compassHeading : sample.alpha;
|
|
15171
|
-
const deviceEuler = new
|
|
15172
|
-
|
|
15173
|
-
|
|
15174
|
-
|
|
15416
|
+
const deviceEuler = new import_three36.Euler(
|
|
15417
|
+
import_three36.MathUtils.degToRad(sample.beta),
|
|
15418
|
+
import_three36.MathUtils.degToRad(alpha),
|
|
15419
|
+
import_three36.MathUtils.degToRad(-sample.gamma),
|
|
15175
15420
|
"YXZ"
|
|
15176
15421
|
);
|
|
15177
|
-
const screenCorrection = new
|
|
15422
|
+
const screenCorrection = new import_three36.Quaternion().setFromAxisAngle(
|
|
15178
15423
|
SCREEN_AXIS,
|
|
15179
|
-
-
|
|
15424
|
+
-import_three36.MathUtils.degToRad(screenOrientation)
|
|
15180
15425
|
);
|
|
15181
|
-
return new
|
|
15426
|
+
return new import_three36.Quaternion().setFromEuler(deviceEuler).multiply(DEVICE_FORWARD_CORRECTION).multiply(screenCorrection).normalize();
|
|
15182
15427
|
}
|
|
15183
15428
|
function quaternionToGyroPose(quaternion) {
|
|
15184
|
-
const euler = new
|
|
15429
|
+
const euler = new import_three36.Euler().setFromQuaternion(quaternion, "YXZ");
|
|
15185
15430
|
return {
|
|
15186
|
-
yaw:
|
|
15187
|
-
pitch:
|
|
15188
|
-
roll:
|
|
15431
|
+
yaw: import_three36.MathUtils.radToDeg(-euler.y),
|
|
15432
|
+
pitch: import_three36.MathUtils.radToDeg(euler.x),
|
|
15433
|
+
roll: import_three36.MathUtils.radToDeg(euler.z)
|
|
15189
15434
|
};
|
|
15190
15435
|
}
|
|
15191
15436
|
function createRelativeCalibration(deviceQuaternion, yaw, pitch) {
|
|
15192
|
-
const targetQuaternion = new
|
|
15193
|
-
new
|
|
15194
|
-
|
|
15195
|
-
|
|
15437
|
+
const targetQuaternion = new import_three36.Quaternion().setFromEuler(
|
|
15438
|
+
new import_three36.Euler(
|
|
15439
|
+
import_three36.MathUtils.degToRad(pitch),
|
|
15440
|
+
import_three36.MathUtils.degToRad(-yaw),
|
|
15196
15441
|
0,
|
|
15197
15442
|
"YXZ"
|
|
15198
15443
|
)
|
|
@@ -15623,9 +15868,9 @@ async function detectWebVRCapabilities() {
|
|
|
15623
15868
|
// src/webvr/reticle.tsx
|
|
15624
15869
|
var import_fiber28 = require("@react-three/fiber");
|
|
15625
15870
|
var import_react55 = require("react");
|
|
15626
|
-
var
|
|
15871
|
+
var import_three37 = require("three");
|
|
15627
15872
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
15628
|
-
var CENTER_NDC = new
|
|
15873
|
+
var CENTER_NDC = new import_three37.Vector2(0, 0);
|
|
15629
15874
|
var HUD_DISTANCE = 2;
|
|
15630
15875
|
var RETICLE_SCALE = 1;
|
|
15631
15876
|
var RETICLE_RENDER_ORDER = 1e5;
|
|
@@ -15710,8 +15955,8 @@ function WebVRReticle({
|
|
|
15710
15955
|
}) {
|
|
15711
15956
|
const groupRef = (0, import_react55.useRef)(null);
|
|
15712
15957
|
const ringMeshRef = (0, import_react55.useRef)(null);
|
|
15713
|
-
const directionRef = (0, import_react55.useRef)(new
|
|
15714
|
-
const raycasterRef = (0, import_react55.useRef)(new
|
|
15958
|
+
const directionRef = (0, import_react55.useRef)(new import_three37.Vector3());
|
|
15959
|
+
const raycasterRef = (0, import_react55.useRef)(new import_three37.Raycaster());
|
|
15715
15960
|
const hoveredRef = (0, import_react55.useRef)(null);
|
|
15716
15961
|
const dwellRef = (0, import_react55.useRef)(0);
|
|
15717
15962
|
const clickedRef = (0, import_react55.useRef)(false);
|
|
@@ -15862,7 +16107,7 @@ function WebVRReticle({
|
|
|
15862
16107
|
color: "#ffffff",
|
|
15863
16108
|
depthTest: false,
|
|
15864
16109
|
depthWrite: false,
|
|
15865
|
-
side:
|
|
16110
|
+
side: import_three37.DoubleSide,
|
|
15866
16111
|
toneMapped: false,
|
|
15867
16112
|
transparent: true
|
|
15868
16113
|
}
|
|
@@ -15878,7 +16123,7 @@ function WebVRReticle({
|
|
|
15878
16123
|
// src/webvr/stereo.tsx
|
|
15879
16124
|
var import_fiber29 = require("@react-three/fiber");
|
|
15880
16125
|
var import_react56 = require("react");
|
|
15881
|
-
var
|
|
16126
|
+
var import_three38 = require("three");
|
|
15882
16127
|
var vertexShader = `
|
|
15883
16128
|
varying vec2 vUv;
|
|
15884
16129
|
void main() {
|
|
@@ -15903,26 +16148,26 @@ void main() {
|
|
|
15903
16148
|
}
|
|
15904
16149
|
`;
|
|
15905
16150
|
function createDistortionResources() {
|
|
15906
|
-
const target = new
|
|
16151
|
+
const target = new import_three38.WebGLRenderTarget(1, 1, {
|
|
15907
16152
|
depthBuffer: true,
|
|
15908
16153
|
stencilBuffer: false
|
|
15909
16154
|
});
|
|
15910
|
-
const geometry = new
|
|
15911
|
-
const material = new
|
|
16155
|
+
const geometry = new import_three38.PlaneGeometry(2, 2);
|
|
16156
|
+
const material = new import_three38.ShaderMaterial({
|
|
15912
16157
|
depthTest: false,
|
|
15913
16158
|
depthWrite: false,
|
|
15914
16159
|
fragmentShader,
|
|
15915
16160
|
uniforms: {
|
|
15916
|
-
distortion: { value: new
|
|
16161
|
+
distortion: { value: new import_three38.Vector2() },
|
|
15917
16162
|
sourceTexture: { value: target.texture }
|
|
15918
16163
|
},
|
|
15919
16164
|
vertexShader
|
|
15920
16165
|
});
|
|
15921
|
-
const mesh = new
|
|
15922
|
-
const scene = new
|
|
16166
|
+
const mesh = new import_three38.Mesh(geometry, material);
|
|
16167
|
+
const scene = new import_three38.Scene();
|
|
15923
16168
|
scene.add(mesh);
|
|
15924
16169
|
return {
|
|
15925
|
-
camera: new
|
|
16170
|
+
camera: new import_three38.OrthographicCamera(-1, 1, 1, -1, 0, 1),
|
|
15926
16171
|
geometry,
|
|
15927
16172
|
material,
|
|
15928
16173
|
mesh,
|
|
@@ -15955,15 +16200,15 @@ function WebVRStereoRenderer({
|
|
|
15955
16200
|
const runtime = (0, import_react56.useContext)(WebVRRuntimeContext);
|
|
15956
16201
|
const fallbackStereoRef = (0, import_react56.useRef)(null);
|
|
15957
16202
|
if (!fallbackStereoRef.current) {
|
|
15958
|
-
fallbackStereoRef.current = new
|
|
16203
|
+
fallbackStereoRef.current = new import_three38.StereoCamera();
|
|
15959
16204
|
}
|
|
15960
16205
|
const stereo = runtime?.stereoView.stereo ?? fallbackStereoRef.current;
|
|
15961
16206
|
const stereoRef = (0, import_react56.useRef)(stereo);
|
|
15962
16207
|
stereoRef.current = stereo;
|
|
15963
16208
|
const resources = (0, import_react56.useMemo)(createDistortionResources, []);
|
|
15964
|
-
const drawingSizeRef = (0, import_react56.useRef)(new
|
|
15965
|
-
const viewportRef = (0, import_react56.useRef)(new
|
|
15966
|
-
const scissorRef = (0, import_react56.useRef)(new
|
|
16209
|
+
const drawingSizeRef = (0, import_react56.useRef)(new import_three38.Vector2());
|
|
16210
|
+
const viewportRef = (0, import_react56.useRef)(new import_three38.Vector4());
|
|
16211
|
+
const scissorRef = (0, import_react56.useRef)(new import_three38.Vector4());
|
|
15967
16212
|
const originalFovRef = (0, import_react56.useRef)(null);
|
|
15968
16213
|
const stereoActiveRef = (0, import_react56.useRef)(false);
|
|
15969
16214
|
const profileRef = (0, import_react56.useRef)(profile);
|
|
@@ -15981,7 +16226,7 @@ function WebVRStereoRenderer({
|
|
|
15981
16226
|
(0, import_react56.useEffect)(() => {
|
|
15982
16227
|
const originalRender = gl.render.bind(gl);
|
|
15983
16228
|
gl.render = (sceneToRender, cameraToRender) => {
|
|
15984
|
-
if (!stereoActiveRef.current || !(cameraToRender instanceof
|
|
16229
|
+
if (!stereoActiveRef.current || !(cameraToRender instanceof import_three38.PerspectiveCamera)) {
|
|
15985
16230
|
originalRender(sceneToRender, cameraToRender);
|
|
15986
16231
|
return;
|
|
15987
16232
|
}
|
|
@@ -16056,7 +16301,7 @@ function WebVRStereoRenderer({
|
|
|
16056
16301
|
if (runtime) {
|
|
16057
16302
|
runtime.stereoView.active = fallback;
|
|
16058
16303
|
}
|
|
16059
|
-
if (fallback && camera instanceof
|
|
16304
|
+
if (fallback && camera instanceof import_three38.PerspectiveCamera) {
|
|
16060
16305
|
syncStereoCameras(
|
|
16061
16306
|
stereoRef.current,
|
|
16062
16307
|
camera,
|
|
@@ -16067,7 +16312,7 @@ function WebVRStereoRenderer({
|
|
|
16067
16312
|
);
|
|
16068
16313
|
return;
|
|
16069
16314
|
}
|
|
16070
|
-
if (originalFovRef.current !== null && camera instanceof
|
|
16315
|
+
if (originalFovRef.current !== null && camera instanceof import_three38.PerspectiveCamera) {
|
|
16071
16316
|
camera.fov = originalFovRef.current;
|
|
16072
16317
|
camera.updateProjectionMatrix();
|
|
16073
16318
|
originalFovRef.current = null;
|
|
@@ -16749,7 +16994,7 @@ function usePanoViewer() {
|
|
|
16749
16994
|
// src/video/pano-video.tsx
|
|
16750
16995
|
var import_fiber31 = require("@react-three/fiber");
|
|
16751
16996
|
var import_react61 = require("react");
|
|
16752
|
-
var
|
|
16997
|
+
var import_three39 = require("three");
|
|
16753
16998
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
16754
16999
|
var EMPTY_TRACKS = [];
|
|
16755
17000
|
var EMPTY_RATES = DEFAULT_PANO_VIDEO_PLAYBACK_RATES;
|
|
@@ -16826,8 +17071,8 @@ function findTextTrack(video, tracks, trackId) {
|
|
|
16826
17071
|
return list.length > 0 ? list[0] : null;
|
|
16827
17072
|
}
|
|
16828
17073
|
function applyEquirectangularLayout(texture, anisotropy) {
|
|
16829
|
-
texture.colorSpace =
|
|
16830
|
-
texture.wrapS =
|
|
17074
|
+
texture.colorSpace = import_three39.SRGBColorSpace;
|
|
17075
|
+
texture.wrapS = import_three39.RepeatWrapping;
|
|
16831
17076
|
texture.repeat.x = -1;
|
|
16832
17077
|
texture.offset.x = 1;
|
|
16833
17078
|
texture.anisotropy = anisotropy;
|
|
@@ -16846,7 +17091,7 @@ function usePosterTexture2(poster, onError) {
|
|
|
16846
17091
|
active = false;
|
|
16847
17092
|
};
|
|
16848
17093
|
}
|
|
16849
|
-
const loader = new
|
|
17094
|
+
const loader = new import_three39.TextureLoader();
|
|
16850
17095
|
loader.load(
|
|
16851
17096
|
poster,
|
|
16852
17097
|
(loadedTexture) => {
|
|
@@ -16858,9 +17103,9 @@ function usePosterTexture2(poster, onError) {
|
|
|
16858
17103
|
loadedTexture,
|
|
16859
17104
|
gl.capabilities.getMaxAnisotropy()
|
|
16860
17105
|
);
|
|
16861
|
-
loadedTexture.wrapT =
|
|
16862
|
-
loadedTexture.magFilter =
|
|
16863
|
-
loadedTexture.minFilter =
|
|
17106
|
+
loadedTexture.wrapT = import_three39.RepeatWrapping;
|
|
17107
|
+
loadedTexture.magFilter = import_three39.LinearFilter;
|
|
17108
|
+
loadedTexture.minFilter = import_three39.LinearMipmapLinearFilter;
|
|
16864
17109
|
loadedTexture.generateMipmaps = true;
|
|
16865
17110
|
setTexture(loadedTexture);
|
|
16866
17111
|
},
|
|
@@ -17014,10 +17259,10 @@ function PanoVideo({
|
|
|
17014
17259
|
video.muted = true;
|
|
17015
17260
|
applyInlineVideoPlayback(video, true);
|
|
17016
17261
|
video.preload = "metadata";
|
|
17017
|
-
const texture = new
|
|
17262
|
+
const texture = new import_three39.VideoTexture(video);
|
|
17018
17263
|
applyEquirectangularLayout(texture, 1);
|
|
17019
|
-
texture.magFilter =
|
|
17020
|
-
texture.minFilter =
|
|
17264
|
+
texture.magFilter = import_three39.LinearFilter;
|
|
17265
|
+
texture.minFilter = import_three39.LinearFilter;
|
|
17021
17266
|
texture.generateMipmaps = false;
|
|
17022
17267
|
return { video, texture };
|
|
17023
17268
|
}, []);
|
|
@@ -17453,7 +17698,7 @@ function PanoVideo({
|
|
|
17453
17698
|
activeTexture ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
17454
17699
|
"mesh",
|
|
17455
17700
|
{
|
|
17456
|
-
rotation: [0,
|
|
17701
|
+
rotation: [0, import_three39.MathUtils.degToRad(90 + yawOffset2), 0],
|
|
17457
17702
|
visible,
|
|
17458
17703
|
children: [
|
|
17459
17704
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("sphereGeometry", { args: [DEFAULT_PANORAMA_RADIUS, 128, 64] }),
|
|
@@ -17461,7 +17706,7 @@ function PanoVideo({
|
|
|
17461
17706
|
PanoBasicMaterial,
|
|
17462
17707
|
{
|
|
17463
17708
|
map: activeTexture,
|
|
17464
|
-
side:
|
|
17709
|
+
side: import_three39.BackSide,
|
|
17465
17710
|
toneMapped: false
|
|
17466
17711
|
}
|
|
17467
17712
|
)
|