@spatial-elements/core 1.0.0-beta.6 → 1.0.0-beta.7
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/dist/catalog/CarouselDeviceCamera.d.ts +12 -0
- package/dist/catalog/CarouselDeviceCamera.d.ts.map +1 -0
- package/dist/catalog/CarouselDeviceCamera.js +44 -0
- package/dist/catalog/CarouselDeviceCamera.js.map +1 -0
- package/dist/catalog/CatalogSpatialElementLayer.d.ts +15 -0
- package/dist/catalog/CatalogSpatialElementLayer.d.ts.map +1 -1
- package/dist/catalog/CatalogSpatialElementLayer.js +148 -72
- package/dist/catalog/CatalogSpatialElementLayer.js.map +1 -1
- package/dist/catalog/CatalogTransition.d.ts.map +1 -1
- package/dist/catalog/CatalogTransition.js +18 -5
- package/dist/catalog/CatalogTransition.js.map +1 -1
- package/dist/catalog/deviceYaw.d.ts +21 -0
- package/dist/catalog/deviceYaw.d.ts.map +1 -0
- package/dist/catalog/deviceYaw.js +87 -0
- package/dist/catalog/deviceYaw.js.map +1 -0
- package/dist/catalog/listDeviceOrientation.d.ts +15 -0
- package/dist/catalog/listDeviceOrientation.d.ts.map +1 -0
- package/dist/catalog/listDeviceOrientation.js +245 -0
- package/dist/catalog/listDeviceOrientation.js.map +1 -0
- package/dist/stage/DeviceGeometryMotion.d.ts +13 -0
- package/dist/stage/DeviceGeometryMotion.d.ts.map +1 -0
- package/dist/stage/DeviceGeometryMotion.js +37 -0
- package/dist/stage/DeviceGeometryMotion.js.map +1 -0
- package/dist/stage/MinimapController.d.ts +1 -0
- package/dist/stage/MinimapController.d.ts.map +1 -1
- package/dist/stage/MinimapController.js +7 -0
- package/dist/stage/MinimapController.js.map +1 -1
- package/dist/stage/PanelPresentationController.d.ts.map +1 -1
- package/dist/stage/PanelPresentationController.js +14 -9
- package/dist/stage/PanelPresentationController.js.map +1 -1
- package/dist/stage/StageExperience.d.ts +16 -0
- package/dist/stage/StageExperience.d.ts.map +1 -1
- package/dist/stage/StageExperience.js +42 -4
- package/dist/stage/StageExperience.js.map +1 -1
- package/dist/stage/StageRenderPipeline.d.ts.map +1 -1
- package/dist/stage/StageRenderPipeline.js +3 -1
- package/dist/stage/StageRenderPipeline.js.map +1 -1
- package/dist/stage/stageTypes.d.ts +1 -0
- package/dist/stage/stageTypes.d.ts.map +1 -1
- package/dist/stage/stageTypes.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PerspectiveCamera, Vector3 } from 'three/webgpu';
|
|
2
|
+
/** Small camera orbit around the selected geometry; UI uses a separate fixed camera. */
|
|
3
|
+
export declare class CarouselDeviceCamera {
|
|
4
|
+
readonly angles: Vector3;
|
|
5
|
+
private readonly sensorAngles;
|
|
6
|
+
private readonly pivot;
|
|
7
|
+
private pivotReady;
|
|
8
|
+
private pivotSettling;
|
|
9
|
+
orbit(camera: PerspectiveCamera, pivot: Vector3, delta?: number, smooth?: boolean): boolean;
|
|
10
|
+
update(camera: PerspectiveCamera, yaw: number, pitch: number, roll: number, delta: number, reduced?: boolean): boolean;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=CarouselDeviceCamera.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CarouselDeviceCamera.d.ts","sourceRoot":"","sources":["../../src/catalog/CarouselDeviceCamera.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,iBAAiB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAErE,wFAAwF;AACxF,qBAAa,oBAAoB;IAChC,QAAQ,CAAC,MAAM,UAAiB;IAChC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAiB;IAC9C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiB;IACvC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,aAAa,CAAS;IAC9B,KAAK,CAAC,MAAM,EAAE,iBAAiB,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,SAAI,EAAE,MAAM,UAAQ;IAY1E,MAAM,CAAC,MAAM,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,UAAQ;CAkB1G"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { MathUtils, PerspectiveCamera, Vector3 } from 'three/webgpu';
|
|
2
|
+
/** Small camera orbit around the selected geometry; UI uses a separate fixed camera. */
|
|
3
|
+
export class CarouselDeviceCamera {
|
|
4
|
+
angles = new Vector3();
|
|
5
|
+
sensorAngles = new Vector3();
|
|
6
|
+
pivot = new Vector3();
|
|
7
|
+
pivotReady = false;
|
|
8
|
+
pivotSettling = false;
|
|
9
|
+
orbit(camera, pivot, delta = 1, smooth = false) {
|
|
10
|
+
if (this.pivotReady && (smooth || this.pivotSettling)) {
|
|
11
|
+
this.pivot.lerp(pivot, 1 - Math.exp(-12 * delta));
|
|
12
|
+
this.pivotSettling = this.pivot.distanceTo(pivot) > 0.01;
|
|
13
|
+
if (!this.pivotSettling)
|
|
14
|
+
this.pivot.copy(pivot);
|
|
15
|
+
}
|
|
16
|
+
else
|
|
17
|
+
this.pivot.copy(pivot);
|
|
18
|
+
this.pivotReady = true;
|
|
19
|
+
// C' = P + Q(C - P) preserves P's camera-space position, even off-centre.
|
|
20
|
+
camera.position.set(0, 0, 2500).sub(this.pivot).applyQuaternion(camera.quaternion).add(this.pivot);
|
|
21
|
+
camera.updateMatrixWorld(true);
|
|
22
|
+
return this.pivotSettling;
|
|
23
|
+
}
|
|
24
|
+
update(camera, yaw, pitch, roll, delta, reduced = false) {
|
|
25
|
+
const target = [pitch, yaw, roll];
|
|
26
|
+
let animating = false;
|
|
27
|
+
for (let i = 0; i < 3; i++) {
|
|
28
|
+
const limit = [10, 16, 6][i];
|
|
29
|
+
// Camera orbits amplify background parallax; keep sensor motion below card strength.
|
|
30
|
+
const value = reduced ? 0 : MathUtils.clamp(target[i], -limit, limit) * 0.25;
|
|
31
|
+
let next = reduced ? 0 : MathUtils.damp(this.sensorAngles.getComponent(i), value, 40, delta);
|
|
32
|
+
if (Math.abs(next - value) < 0.001)
|
|
33
|
+
next = value;
|
|
34
|
+
this.sensorAngles.setComponent(i, next);
|
|
35
|
+
animating ||= next !== value;
|
|
36
|
+
this.angles.setComponent(i, next);
|
|
37
|
+
}
|
|
38
|
+
// Rotating the observer has the inverse visual effect of rotating the scene.
|
|
39
|
+
camera.rotation.set(...this.angles.toArray().map(MathUtils.degToRad), 'ZXY');
|
|
40
|
+
camera.updateMatrixWorld(true);
|
|
41
|
+
return animating;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=CarouselDeviceCamera.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CarouselDeviceCamera.js","sourceRoot":"","sources":["../../src/catalog/CarouselDeviceCamera.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAErE,wFAAwF;AACxF,MAAM,OAAO,oBAAoB;IACvB,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;IACf,YAAY,GAAG,IAAI,OAAO,EAAE,CAAC;IAC7B,KAAK,GAAG,IAAI,OAAO,EAAE,CAAC;IAC/B,UAAU,GAAG,KAAK,CAAC;IACnB,aAAa,GAAG,KAAK,CAAC;IAC9B,KAAK,CAAC,MAAyB,EAAE,KAAc,EAAE,KAAK,GAAG,CAAC,EAAE,MAAM,GAAG,KAAK;QACzE,IAAI,IAAI,CAAC,UAAU,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC;YACvD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC;YAClD,IAAI,CAAC,aA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CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;YAC7F,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,GAAG,KAAK;gBAAE,IAAI,GAAG,KAAK,CAAC;YACjD,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;YACxC,SAAS,KAAK,IAAI,KAAK,KAAK,CAAC;YAC7B,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QACnC,CAAC;QACD,6EAA6E;QAC7E,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,QAAQ,CAA6B,EAAE,KAAK,CAAC,CAAC;QACzG,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAC/B,OAAO,SAAS,CAAC;IAClB,CAAC;CACD","sourcesContent":["import { MathUtils, PerspectiveCamera, Vector3 } from 'three/webgpu';\n\n/** Small camera orbit around the selected geometry; UI uses a separate fixed camera. */\nexport class CarouselDeviceCamera {\n\treadonly angles = new Vector3();\n\tprivate readonly sensorAngles = new Vector3();\n\tprivate readonly pivot = new Vector3();\n\tprivate pivotReady = false;\n\tprivate pivotSettling = false;\n\torbit(camera: PerspectiveCamera, pivot: Vector3, delta = 1, smooth = false) {\n\t\tif (this.pivotReady && (smooth || this.pivotSettling)) {\n\t\t\tthis.pivot.lerp(pivot, 1 - Math.exp(-12 * delta));\n\t\t\tthis.pivotSettling = this.pivot.distanceTo(pivot) > 0.01;\n\t\t\tif (!this.pivotSettling) this.pivot.copy(pivot);\n\t\t} else this.pivot.copy(pivot);\n\t\tthis.pivotReady = true;\n\t\t// C' = P + Q(C - P) preserves P's camera-space position, even off-centre.\n\t\tcamera.position.set(0, 0, 2500).sub(this.pivot).applyQuaternion(camera.quaternion).add(this.pivot);\n\t\tcamera.updateMatrixWorld(true);\n\t\treturn this.pivotSettling;\n\t}\n\tupdate(camera: PerspectiveCamera, yaw: number, pitch: number, roll: number, delta: number, reduced = false) {\n\t\tconst target = [pitch, yaw, roll];\n\t\tlet animating = false;\n\t\tfor (let i = 0; i < 3; i++) {\n\t\t\tconst limit = [10, 16, 6][i];\n\t\t\t// Camera orbits amplify background parallax; keep sensor motion below card strength.\n\t\t\tconst value = reduced ? 0 : MathUtils.clamp(target[i], -limit, limit) * 0.25;\n\t\t\tlet next = reduced ? 0 : MathUtils.damp(this.sensorAngles.getComponent(i), value, 40, delta);\n\t\t\tif (Math.abs(next - value) < 0.001) next = value;\n\t\t\tthis.sensorAngles.setComponent(i, next);\n\t\t\tanimating ||= next !== value;\n\t\t\tthis.angles.setComponent(i, next);\n\t\t}\n\t\t// Rotating the observer has the inverse visual effect of rotating the scene.\n\t\tcamera.rotation.set(...this.angles.toArray().map(MathUtils.degToRad) as [number, number, number], 'ZXY');\n\t\tcamera.updateMatrixWorld(true);\n\t\treturn animating;\n\t}\n}\n"]}
|
|
@@ -27,6 +27,11 @@ export declare class CatalogSpatialElementLayer {
|
|
|
27
27
|
private passes;
|
|
28
28
|
getStats(): {
|
|
29
29
|
instances: number;
|
|
30
|
+
deviceCamera: {
|
|
31
|
+
pitch: number;
|
|
32
|
+
yaw: number;
|
|
33
|
+
roll: number;
|
|
34
|
+
};
|
|
30
35
|
detachedInstances: number;
|
|
31
36
|
visible: number;
|
|
32
37
|
passes: number;
|
|
@@ -52,6 +57,7 @@ export declare class CatalogSpatialElementLayer {
|
|
|
52
57
|
};
|
|
53
58
|
actors: {
|
|
54
59
|
spatialElementId: string;
|
|
60
|
+
projectedCenter: THREE.Vector3Tuple;
|
|
55
61
|
band: "front" | "rear" | undefined;
|
|
56
62
|
clip: {
|
|
57
63
|
left: number;
|
|
@@ -70,6 +76,11 @@ export declare class CatalogSpatialElementLayer {
|
|
|
70
76
|
x: number;
|
|
71
77
|
y: number;
|
|
72
78
|
};
|
|
79
|
+
deviceTilt: {
|
|
80
|
+
yaw: number;
|
|
81
|
+
pitch: number;
|
|
82
|
+
roll: number;
|
|
83
|
+
};
|
|
73
84
|
}[];
|
|
74
85
|
};
|
|
75
86
|
private readonly depthBlur;
|
|
@@ -80,6 +91,9 @@ export declare class CatalogSpatialElementLayer {
|
|
|
80
91
|
private readonly handoffScene;
|
|
81
92
|
private readonly camera;
|
|
82
93
|
private readonly carouselCamera;
|
|
94
|
+
private readonly carouselUiCamera;
|
|
95
|
+
private readonly carouselDeviceCamera;
|
|
96
|
+
private carouselSelection?;
|
|
83
97
|
private readonly handoffCamera;
|
|
84
98
|
private readonly actors;
|
|
85
99
|
private readonly requests;
|
|
@@ -88,6 +102,7 @@ export declare class CatalogSpatialElementLayer {
|
|
|
88
102
|
private readonly loadingKeys;
|
|
89
103
|
private readonly failedKeys;
|
|
90
104
|
private readonly motion;
|
|
105
|
+
private readonly unsubscribeDeviceYaw;
|
|
91
106
|
private readonly pointer;
|
|
92
107
|
private handoff?;
|
|
93
108
|
private handoffPoint?;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CatalogSpatialElementLayer.d.ts","sourceRoot":"","sources":["../../src/catalog/CatalogSpatialElementLayer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CatalogSpatialElementLayer.d.ts","sourceRoot":"","sources":["../../src/catalog/CatalogSpatialElementLayer.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAEpE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAE5E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAErF,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAA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AQ1B,wBAAwB,CAAC,gBAAgB,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,wBAAwB,GAAG,SAAS;IAqC7G,eAAe;WAluBa,MAAM;WAAK,MAAM;;IAsuB7C,2FAA2F;IAC3F,aAAa;;;;;sBAv6BP,MAAM;qBACP,MAAM;uBACJ,MAAM;wBACL,MAAM;;;;;;;;;;;;IAm9Bd,gBAAgB,CAAC,MAAM,EAAE;QACxB,MAAM,EAAE,KAAK,CAAC,iBAAiB,CAAC;QAChC,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC;QACtB,QAAQ,EAAE,MAAM,CAAC;QACjB,oBAAoB,CAAC,EAAE,MAAM,CAAC;KAC9B;IAMD,cAAc,CACb,IAAI,EAAE,KAAK,CAAC,QAAQ,GAAG,SAAS,EAChC,KAAK,EAAE,wBAAwB,GAAG,SAAS,EAC3C,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,KAAK,CAAC,OAAO;IAW5B,aAAa;IAoBb,iFAAiF;IACjF,iBAAiB,CAAC,OAAO,EAAE,MAAM;IAIjC,OAAO;IA4BP,OAAO,CAAC,WAAW;IA+FnB,OAAO,CAAC,aAAa;IA2CrB,OAAO,CAAC,aAAa;IA8FrB,OAAO,CAAC,YAAY;CAapB;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAgB7F"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { CatalogGeometryFade } from './CatalogGeometryFade.js';
|
|
2
|
+
import { CarouselDeviceCamera } from './CarouselDeviceCamera.js';
|
|
3
|
+
import { isDeviceOrientationPaused, getListDeviceYaw, getListDevicePitch, getListDeviceRoll, subscribeListDeviceYaw } from './listDeviceOrientation.js';
|
|
2
4
|
import { cardModelFit } from './cardModelFit.js';
|
|
3
5
|
import { CatalogDepthBlur } from './CatalogDepthBlur.js';
|
|
4
6
|
import { CatalogModelOutline } from './CatalogModelOutline.js';
|
|
@@ -78,6 +80,7 @@ export class CatalogSpatialElementLayer {
|
|
|
78
80
|
getStats() {
|
|
79
81
|
return {
|
|
80
82
|
instances: this.actors.size,
|
|
83
|
+
deviceCamera: { pitch: this.carouselDeviceCamera.angles.x, yaw: this.carouselDeviceCamera.angles.y, roll: this.carouselDeviceCamera.angles.z },
|
|
81
84
|
detachedInstances: this.detachedInstances,
|
|
82
85
|
visible: [...this.actors.values()].filter((actor) => actor.root.visible).length,
|
|
83
86
|
passes: this.passes,
|
|
@@ -87,6 +90,7 @@ export class CatalogSpatialElementLayer {
|
|
|
87
90
|
outline: this.outline.getStats(),
|
|
88
91
|
actors: [...this.actors.values()].map((actor) => ({
|
|
89
92
|
spatialElementId: actor.spatialElementId,
|
|
93
|
+
projectedCenter: actor.view.getWorldPosition(new THREE.Vector3()).project(actor.pose ? this.carouselCamera : this.camera).toArray(),
|
|
90
94
|
band: actor.band,
|
|
91
95
|
clip: actor.clip ? { ...actor.clip } : undefined,
|
|
92
96
|
opacity: this.exitOpacity * (actor.materials[0]?.material.opacity ?? 0),
|
|
@@ -95,7 +99,8 @@ export class CatalogSpatialElementLayer {
|
|
|
95
99
|
modelScale: actor.view.scale.x, modelDepth: actor.view.position.z,
|
|
96
100
|
blur: actor.blur ?? 0,
|
|
97
101
|
hover: actor.hover,
|
|
98
|
-
proximityTilt: { x: actor.rotationX, y: actor.rotationY }
|
|
102
|
+
proximityTilt: { x: actor.rotationX, y: actor.rotationY },
|
|
103
|
+
deviceTilt: { yaw: actor.deviceYaw, pitch: actor.devicePitch, roll: actor.deviceRoll }
|
|
99
104
|
}))
|
|
100
105
|
};
|
|
101
106
|
}
|
|
@@ -109,6 +114,9 @@ export class CatalogSpatialElementLayer {
|
|
|
109
114
|
// The carousel sits ~2500 units from the lens. A near plane of 1 wastes depth
|
|
110
115
|
// precision and makes closely spaced CAD surfaces fight after the longer-lens change.
|
|
111
116
|
carouselCamera = new THREE.PerspectiveCamera(45, 1, 250, 6000);
|
|
117
|
+
carouselUiCamera = new THREE.PerspectiveCamera();
|
|
118
|
+
carouselDeviceCamera = new CarouselDeviceCamera();
|
|
119
|
+
carouselSelection;
|
|
112
120
|
handoffCamera = new THREE.PerspectiveCamera();
|
|
113
121
|
actors = new Map();
|
|
114
122
|
requests = new Set();
|
|
@@ -117,6 +125,7 @@ export class CatalogSpatialElementLayer {
|
|
|
117
125
|
loadingKeys = new Set();
|
|
118
126
|
failedKeys = new Set();
|
|
119
127
|
motion = window.matchMedia('(prefers-reduced-motion: reduce)');
|
|
128
|
+
unsubscribeDeviceYaw;
|
|
120
129
|
pointer = { x: 0, y: 0, active: false, pressed: false };
|
|
121
130
|
handoff;
|
|
122
131
|
handoffPoint;
|
|
@@ -176,6 +185,10 @@ export class CatalogSpatialElementLayer {
|
|
|
176
185
|
this.assets = assets;
|
|
177
186
|
this.invalidate = invalidate;
|
|
178
187
|
this.interactionTheme = interactionTheme;
|
|
188
|
+
this.unsubscribeDeviceYaw = subscribeListDeviceYaw(() => {
|
|
189
|
+
if (!this.transitionActive && [...this.actors.values()].some(actor => actor.root.visible && actor.card?.closest('[data-device-orientation]')))
|
|
190
|
+
this.invalidate();
|
|
191
|
+
});
|
|
179
192
|
this.scene.environmentIntensity = 0.5;
|
|
180
193
|
this.scene.fog = new THREE.Fog(0xffffff, 1200, 2500);
|
|
181
194
|
this.handoffScene.fog = this.scene.fog;
|
|
@@ -315,6 +328,10 @@ export class CatalogSpatialElementLayer {
|
|
|
315
328
|
this.carouselCamera.aspect = width / height;
|
|
316
329
|
this.carouselCamera.fov = THREE.MathUtils.radToDeg(2 * Math.atan(height / 5000));
|
|
317
330
|
this.carouselCamera.updateProjectionMatrix();
|
|
331
|
+
this.carouselUiCamera.copy(this.carouselCamera);
|
|
332
|
+
this.carouselUiCamera.position.set(0, 0, 2500);
|
|
333
|
+
this.carouselUiCamera.quaternion.identity();
|
|
334
|
+
this.carouselUiCamera.updateMatrixWorld(true);
|
|
318
335
|
this.scene.environment = environment;
|
|
319
336
|
this.handoffScene.environment = this.handoff?.sourceEnvironment ?? environment;
|
|
320
337
|
const scroll = getStageVisualScrollPosition();
|
|
@@ -328,6 +345,8 @@ export class CatalogSpatialElementLayer {
|
|
|
328
345
|
const delta = Math.min(this.lastTime ? (now - this.lastTime) / 1000 : 1 / 60, 0.05);
|
|
329
346
|
this.lastTime = now;
|
|
330
347
|
let animating = false;
|
|
348
|
+
const projectCarousels = [];
|
|
349
|
+
let selected;
|
|
331
350
|
this.glass.beginFrame();
|
|
332
351
|
if (!this.handoff)
|
|
333
352
|
this.ground.beginFrame();
|
|
@@ -367,6 +386,7 @@ export class CatalogSpatialElementLayer {
|
|
|
367
386
|
if (!actor.root.visible)
|
|
368
387
|
continue;
|
|
369
388
|
if (actor.pose) {
|
|
389
|
+
actor.view.quaternion.copy(actor.viewOrientation);
|
|
370
390
|
const pose = actor.pose.read();
|
|
371
391
|
const approach = this.pointer.active && !this.pointer.pressed && !this.transitionActive &&
|
|
372
392
|
!this.motion.matches && actor.renderRect && pose.visible
|
|
@@ -377,6 +397,21 @@ export class CatalogSpatialElementLayer {
|
|
|
377
397
|
actor[property] = target;
|
|
378
398
|
animating ||= actor[property] !== target;
|
|
379
399
|
}
|
|
400
|
+
// Add the remaining sensor response only to the focus model. The camera keeps 25%.
|
|
401
|
+
const sensorEnabled = pose.front && !this.motion.matches && !this.transitionActive &&
|
|
402
|
+
actor.card.closest('[data-device-orientation]');
|
|
403
|
+
for (const [property, target] of [
|
|
404
|
+
['deviceYaw', sensorEnabled ? -getListDeviceYaw() * 0.75 : 0],
|
|
405
|
+
['devicePitch', sensorEnabled ? -getListDevicePitch() * 0.75 : 0],
|
|
406
|
+
['deviceRoll', sensorEnabled ? -getListDeviceRoll() * 0.75 : 0]
|
|
407
|
+
]) {
|
|
408
|
+
if (!this.motion.matches && isDeviceOrientationPaused())
|
|
409
|
+
continue;
|
|
410
|
+
actor[property] = this.motion.matches ? 0 : THREE.MathUtils.damp(actor[property], target, 40, delta);
|
|
411
|
+
if (Math.abs(actor[property] - target) < 0.01)
|
|
412
|
+
actor[property] = target;
|
|
413
|
+
animating ||= actor[property] !== target;
|
|
414
|
+
}
|
|
380
415
|
const hoverTarget = !this.transitionActive && !this.pointer.pressed &&
|
|
381
416
|
((this.pointer.active && actor.hitTarget?.hasAttribute('data-mouse-hover')) ||
|
|
382
417
|
actor.hitTarget?.matches(':focus-visible')) ? 1 : 0;
|
|
@@ -395,7 +430,7 @@ export class CatalogSpatialElementLayer {
|
|
|
395
430
|
// and spacing naturally, including scroll parallax and the foreground advance.
|
|
396
431
|
const x = slot.left + dx + slot.width * (pose.orbit ? (compact ? 0.5 : 0.31) : pose.x - (compact ? 0 : 0.19));
|
|
397
432
|
const y = slot.top + dy + (pose.orbit ? (compact ? 180 : slot.height * 0.54) : slot.height * pose.y);
|
|
398
|
-
const perspective = pose.orbit ? 1 : 1 - pose.depth /
|
|
433
|
+
const perspective = pose.orbit ? 1 : 1 - pose.depth / 2500;
|
|
399
434
|
actor.root.matrix.makeTranslation((x - width / 2) * perspective + (pose.orbit?.x ?? 0), (height / 2 - y) * perspective + (pose.orbit?.y ?? 0), pose.depth);
|
|
400
435
|
actor.root.matrixWorldNeedsUpdate = true;
|
|
401
436
|
// Geometry follows the seat and pointer; panel projection below excludes pointer tilt.
|
|
@@ -408,6 +443,7 @@ export class CatalogSpatialElementLayer {
|
|
|
408
443
|
? (slot.height - 360) * pose.y / (pose.size / 0.82)
|
|
409
444
|
: 0, 0);
|
|
410
445
|
actor.view.scale.setScalar((Math.min(slot.width, compact ? 360 : slot.height) * 0.82) / (actor.radius * 2));
|
|
446
|
+
let groundMatrix;
|
|
411
447
|
if (pose.orbit && actor.root.visible) {
|
|
412
448
|
const frame = Math.min(slot.width, compact ? 360 : slot.height);
|
|
413
449
|
const floor = frame * 0.32;
|
|
@@ -419,80 +455,87 @@ export class CatalogSpatialElementLayer {
|
|
|
419
455
|
const bottom = Math.min(...actor.supportPoints.map(point => point.clone().applyMatrix4(actor.view.matrix).applyMatrix4(upright).y));
|
|
420
456
|
actor.view.position.y += (-floor - bottom) / upright.elements[5];
|
|
421
457
|
actor.view.updateMatrix();
|
|
422
|
-
|
|
458
|
+
groundMatrix = new THREE.Matrix4().makeTranslation(x - width / 2, height / 2 - y, 0)
|
|
423
459
|
.multiply(new THREE.Matrix4().makeRotationX(pitch))
|
|
424
460
|
.multiply(new THREE.Matrix4().makeTranslation(0, -floor, 0));
|
|
425
|
-
actor.root.updateMatrixWorld(true);
|
|
426
|
-
this.ground.shadow(actor, actor.model, groundMatrix, 0.14 * pose.opacity);
|
|
427
461
|
}
|
|
462
|
+
// Apply after floor fitting so the model centre and UI anchors remain fixed.
|
|
463
|
+
actor.view.quaternion.setFromEuler(new THREE.Euler(THREE.MathUtils.degToRad(actor.devicePitch), THREE.MathUtils.degToRad(actor.deviceYaw), THREE.MathUtils.degToRad(actor.deviceRoll), 'ZXY'))
|
|
464
|
+
.multiply(actor.viewOrientation);
|
|
428
465
|
actor.root.updateMatrixWorld(true);
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
const
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
466
|
+
if (groundMatrix)
|
|
467
|
+
this.ground.shadow(actor, actor.model, groundMatrix, 0.14 * pose.opacity);
|
|
468
|
+
if (pose.front && actor.root.visible && (!selected || pose.panelOpacity > (selected.pose?.read().panelOpacity ?? 0)))
|
|
469
|
+
selected = actor;
|
|
470
|
+
projectCarousels.push(() => {
|
|
471
|
+
const hitTarget = actor.hitTarget;
|
|
472
|
+
if (hitTarget) {
|
|
473
|
+
// Project cached model bounds, not the framing sphere: empty foreground
|
|
474
|
+
// margins must not intercept clicks on visible neighbouring spatialElements.
|
|
475
|
+
let left = Infinity, top = Infinity, right = -Infinity, bottom = -Infinity;
|
|
476
|
+
const point = new THREE.Vector3();
|
|
477
|
+
for (const corner of actor.hitCorners) {
|
|
478
|
+
point.copy(corner).applyMatrix4(actor.view.matrixWorld).project(this.carouselCamera);
|
|
479
|
+
const px = ((point.x + 1) * width) / 2 - slot.left - dx;
|
|
480
|
+
const py = ((1 - point.y) * height) / 2 - slot.top - dy;
|
|
481
|
+
left = Math.min(left, px);
|
|
482
|
+
right = Math.max(right, px);
|
|
483
|
+
top = Math.min(top, py);
|
|
484
|
+
bottom = Math.max(bottom, py);
|
|
485
|
+
}
|
|
486
|
+
hitTarget.style.left = `${(left + right) / 2}px`;
|
|
487
|
+
hitTarget.style.top = `${(top + bottom) / 2}px`;
|
|
488
|
+
hitTarget.style.width = `${right - left}px`;
|
|
489
|
+
hitTarget.style.height = `${bottom - top}px`;
|
|
490
|
+
hitTarget.style.maxWidth = 'none';
|
|
491
|
+
actor.renderRect = { left: left + slot.left + dx, top: top + slot.top + dy,
|
|
492
|
+
width: right - left, height: bottom - top };
|
|
443
493
|
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
x:
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
}
|
|
490
|
-
actor.clip = {
|
|
491
|
-
left: 0,
|
|
492
|
-
top: 0,
|
|
493
|
-
width,
|
|
494
|
-
height
|
|
495
|
-
};
|
|
494
|
+
const panel = actor.summaryPanel;
|
|
495
|
+
if (panel && actor.summarySize) {
|
|
496
|
+
const { width: pw, height: ph } = actor.summarySize;
|
|
497
|
+
// The panel follows the seat and its yaw, but not the elevated
|
|
498
|
+
// product view. At rest it is parallel to the screen, also on mobile.
|
|
499
|
+
const panelFrame = pose.orbit
|
|
500
|
+
? actor.root.matrixWorld.clone().multiply(new THREE.Matrix4().makeRotationY(pose.yaw))
|
|
501
|
+
: actor.tilt.matrixWorld.clone();
|
|
502
|
+
const matrix = panelFrame
|
|
503
|
+
.multiply(new THREE.Matrix4().makeTranslation(compact ? 0 : slot.width * 0.39, compact ? (pose.orbit ? 180 : slot.height / 2) - 360 - ph / 2 : 0, 0));
|
|
504
|
+
const corners = [
|
|
505
|
+
[-pw / 2, ph / 2],
|
|
506
|
+
[pw / 2, ph / 2],
|
|
507
|
+
[pw / 2, -ph / 2],
|
|
508
|
+
[-pw / 2, -ph / 2]
|
|
509
|
+
].map(([x, y]) => {
|
|
510
|
+
const point = new THREE.Vector3(x, y, 0)
|
|
511
|
+
.applyMatrix4(matrix)
|
|
512
|
+
.project(this.carouselUiCamera);
|
|
513
|
+
return {
|
|
514
|
+
x: ((point.x + 1) * width) / 2 - slot.left - dx,
|
|
515
|
+
y: ((1 - point.y) * height) / 2 - slot.top - dy
|
|
516
|
+
};
|
|
517
|
+
});
|
|
518
|
+
// The semantic summary keeps its intrinsic layout slot before and after
|
|
519
|
+
// enhancement. Project relative to that slot instead of moving it to (0, 0).
|
|
520
|
+
const origin = actor.summaryOrigin ?? { x: 0, y: 0 };
|
|
521
|
+
const localCorners = corners.map(({ x, y }) => ({
|
|
522
|
+
x: x - origin.x, y: y - origin.y
|
|
523
|
+
}));
|
|
524
|
+
panel.style.transform = getProjectiveCssMatrix3d(localCorners, pw, ph) ?? '';
|
|
525
|
+
recordCarouselPanel(panel, corners.map((point) => ({
|
|
526
|
+
x: point.x + slot.left + dx,
|
|
527
|
+
y: point.y + slot.top + dy
|
|
528
|
+
})), pw, ph);
|
|
529
|
+
const hidden = actor.card.style.visibility === 'hidden' || panel.style.visibility === 'hidden';
|
|
530
|
+
this.glass.panel(actor.card, matrix, pw, ph, hidden ? 0 : pose.panelOpacity * this.exitOpacity, (1 - pose.panelOpacity) * 6);
|
|
531
|
+
}
|
|
532
|
+
actor.clip = {
|
|
533
|
+
left: 0,
|
|
534
|
+
top: 0,
|
|
535
|
+
width,
|
|
536
|
+
height
|
|
537
|
+
};
|
|
538
|
+
});
|
|
496
539
|
if (this.isDestinationActor(actor))
|
|
497
540
|
actor.root.visible = false;
|
|
498
541
|
continue;
|
|
@@ -533,9 +576,37 @@ export class CatalogSpatialElementLayer {
|
|
|
533
576
|
actor.tilt.position.y = -actor.lift;
|
|
534
577
|
actor.view.position.set(slot.left + slot.width / 2 - card.left - card.width / 2, card.top + card.height / 2 - slot.top - slot.height / 2, 96 * actor.hover);
|
|
535
578
|
actor.view.scale.setScalar(actor.cardScale * (1 + 0.12 * actor.hover));
|
|
579
|
+
const deviceEnabled = !this.motion.matches && !this.transitionActive &&
|
|
580
|
+
actor.card.closest('[data-device-orientation]');
|
|
581
|
+
// Sensor motion remains available on hybrids even with a stationary mouse cursor.
|
|
582
|
+
for (const [property, target] of [
|
|
583
|
+
['deviceYaw', deviceEnabled ? -getListDeviceYaw() : 0],
|
|
584
|
+
['devicePitch', deviceEnabled ? -getListDevicePitch() : 0],
|
|
585
|
+
['deviceRoll', deviceEnabled ? -getListDeviceRoll() : 0]
|
|
586
|
+
]) {
|
|
587
|
+
if (!this.motion.matches && isDeviceOrientationPaused())
|
|
588
|
+
continue;
|
|
589
|
+
actor[property] = this.motion.matches ? 0 : THREE.MathUtils.damp(actor[property], target, 40, delta);
|
|
590
|
+
if (Math.abs(actor[property] - target) < 0.01)
|
|
591
|
+
actor[property] = target;
|
|
592
|
+
animating ||= actor[property] !== target;
|
|
593
|
+
}
|
|
594
|
+
// Rotate around the model's own centre, leaving the panel and copy still.
|
|
595
|
+
actor.view.rotation.set(THREE.MathUtils.degToRad(actor.devicePitch), THREE.MathUtils.degToRad(actor.deviceYaw), THREE.MathUtils.degToRad(actor.deviceRoll), 'ZXY');
|
|
596
|
+
actor.view.quaternion.multiply(actor.viewOrientation);
|
|
536
597
|
if (this.isDestinationActor(actor))
|
|
537
598
|
actor.root.visible = false;
|
|
538
599
|
}
|
|
600
|
+
if (!this.transitionActive && !this.handoff) {
|
|
601
|
+
const pivot = selected?.view.getWorldPosition(new THREE.Vector3()) ?? new THREE.Vector3();
|
|
602
|
+
const enabled = selected?.card?.closest('[data-device-orientation]');
|
|
603
|
+
if (this.motion.matches || !isDeviceOrientationPaused())
|
|
604
|
+
animating = this.carouselDeviceCamera.update(this.carouselCamera, enabled ? getListDeviceYaw() : 0, enabled ? getListDevicePitch() : 0, enabled ? getListDeviceRoll() : 0, delta, this.motion.matches) || animating;
|
|
605
|
+
animating = this.carouselDeviceCamera.orbit(this.carouselCamera, pivot, delta, !this.motion.matches && (this.pointer.pressed || this.carouselSelection !== selected)) || animating;
|
|
606
|
+
this.carouselSelection = selected;
|
|
607
|
+
}
|
|
608
|
+
for (const project of projectCarousels)
|
|
609
|
+
project();
|
|
539
610
|
if (this.queueDirty) {
|
|
540
611
|
this.queueDirty = false;
|
|
541
612
|
void this.loadVisibleSpatialElements(this.generation);
|
|
@@ -631,7 +702,7 @@ export class CatalogSpatialElementLayer {
|
|
|
631
702
|
return [...this.actors.values()].some((actor) => Boolean(actor.pose));
|
|
632
703
|
}
|
|
633
704
|
renderRear(renderer) {
|
|
634
|
-
this.glass.render(renderer, this.
|
|
705
|
+
this.glass.render(renderer, this.carouselUiCamera, () => {
|
|
635
706
|
this.ground.draw(renderer, this.carouselCamera, this.exitOpacity);
|
|
636
707
|
this.draw(renderer, 'rear');
|
|
637
708
|
});
|
|
@@ -826,6 +897,7 @@ export class CatalogSpatialElementLayer {
|
|
|
826
897
|
if (this.disposed)
|
|
827
898
|
return;
|
|
828
899
|
this.disposed = true;
|
|
900
|
+
this.unsubscribeDeviceYaw();
|
|
829
901
|
this.generation += 1;
|
|
830
902
|
for (const request of this.requests)
|
|
831
903
|
request.abort();
|
|
@@ -908,6 +980,7 @@ export class CatalogSpatialElementLayer {
|
|
|
908
980
|
root,
|
|
909
981
|
tilt,
|
|
910
982
|
view,
|
|
983
|
+
viewOrientation: view.quaternion.clone(),
|
|
911
984
|
radius,
|
|
912
985
|
hitCorners,
|
|
913
986
|
fitCorners: hitCorners.map((corner) => corner.clone().applyQuaternion(view.quaternion)),
|
|
@@ -921,6 +994,9 @@ export class CatalogSpatialElementLayer {
|
|
|
921
994
|
scrollY: 0,
|
|
922
995
|
rotationX: 0,
|
|
923
996
|
rotationY: 0,
|
|
997
|
+
deviceYaw: 0,
|
|
998
|
+
devicePitch: 0,
|
|
999
|
+
deviceRoll: 0,
|
|
924
1000
|
lift: 0,
|
|
925
1001
|
rendered: false
|
|
926
1002
|
};
|