@displayxr/inline3d 1.43.1 → 1.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +129 -0
- package/THIRD_PARTY_NOTICES.md +26 -2
- package/camera.d.ts +7 -0
- package/cursor-depth.d.ts +275 -1
- package/dist/call.js +18 -4
- package/js/camera/pair-cursor.js +129 -26
- package/js/inline3d-cursor-bvh.js +147 -0
- package/js/inline3d-cursor-depth-playcanvas.js +507 -61
- package/js/inline3d-cursor-depth.js +497 -43
- package/js/inline3d-cursor-option.js +140 -6
- package/js/inline3d-cursor-perf.js +199 -0
- package/js/inline3d-cursor-shape.js +962 -0
- package/js/inline3d-model.js +30 -1
- package/js/inline3d-playcanvas-engine.js +2 -0
- package/js/inline3d-splat-layer-rig.js +3 -0
- package/js/inline3d-three.js +263 -30
- package/js/vendor/three-mesh-bvh.js +3 -0
- package/model.d.ts +1 -1
- package/package.json +7 -1
- package/splat.d.ts +1 -1
- package/three.d.ts +43 -4
package/three.d.ts
CHANGED
|
@@ -143,7 +143,19 @@ export class EdgeFeather {
|
|
|
143
143
|
): void;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
import type { CursorAnchorMode, CursorPlacement, CursorView } from './cursor-depth.js';
|
|
146
|
+
import type { CursorAnchorMode, CursorPlacement, CursorShape, CursorShapeHit, CursorShapeOption, CursorSoftenOption, CursorSoftenParams, CursorSoftening, CursorView } from './cursor-depth.js';
|
|
147
|
+
|
|
148
|
+
/** One second of `debug` stats: each figure as `{ mean, p95, max, n }`. */
|
|
149
|
+
export interface CursorDebugSummary {
|
|
150
|
+
frames: number;
|
|
151
|
+
seconds: number;
|
|
152
|
+
updateMs: { mean: number; p95: number; max: number; n: number };
|
|
153
|
+
rays: { mean: number; p95: number; max: number; n: number };
|
|
154
|
+
frameMs: { mean: number; p95: number; max: number; n: number };
|
|
155
|
+
/** Age of the pointer sample a frame used, on frames where it was new. */
|
|
156
|
+
pointerAgeMs: { mean: number; p95: number; max: number; n: number };
|
|
157
|
+
samplesPerFrame: number;
|
|
158
|
+
}
|
|
147
159
|
|
|
148
160
|
/**
|
|
149
161
|
* A hit test for {@link DepthCursor} that raycasts three.js objects (recursively): the first hit
|
|
@@ -179,22 +191,49 @@ export class DepthCursor {
|
|
|
179
191
|
height?: number;
|
|
180
192
|
/** Fill colour of the arrow (default 0xffffff; the outline is always dark). */
|
|
181
193
|
color?: number;
|
|
182
|
-
/** How far in front of out-of-screen content it floats, in eye-baseline units (default 0.
|
|
194
|
+
/** How far in front of out-of-screen content it floats, in eye-baseline units (default 0.015 ≈ 1 mm at a 63-65 mm IPD). */
|
|
183
195
|
margin?: number;
|
|
184
196
|
/** Default `'hybrid'`: exact while the pointer moves, world-fixed (parallaxing) while it is still. */
|
|
185
197
|
anchor?: CursorAnchorMode;
|
|
186
198
|
/** `'window'`: keep the cursor over DOM layered on the canvas; hides the CSS cursor page-wide meanwhile. */
|
|
187
199
|
pointerScope?: 'canvas' | 'window';
|
|
188
|
-
/**
|
|
200
|
+
/** 0 (default): the whole footprint every frame. N: amortised — N rays a frame cycling the footprint (both eyes); the arrow still follows the newest pointer each frame. */
|
|
189
201
|
raysPerFrame?: number;
|
|
202
|
+
/**
|
|
203
|
+
* Crosstalk softening of the LIFTED arrow (runtime ADR-046 Amendment 2 §B.7), in the arrow's own
|
|
204
|
+
* shader: blur = 0.1 × its ghost offset (capped at 6% of its height, 8 px), opacity easing to
|
|
205
|
+
* 0.5 over 0.03 baselines of lift; both zero on the glass. Default `'both'`; `'off'` = the crisp arrow.
|
|
206
|
+
*/
|
|
207
|
+
soften?: CursorSoftenOption;
|
|
208
|
+
/**
|
|
209
|
+
* The sprite. Default `'auto'`: what the browser would show — the page's computed CSS cursor
|
|
210
|
+
* under the pointer: every standard keyword has a sprite, `url(…)` images are drawn as
|
|
211
|
+
* images, `none` draws nothing. A sprite name (or `'none'`) fixes it. `color` tints the arrow only.
|
|
212
|
+
*/
|
|
213
|
+
shape?: CursorShapeOption;
|
|
214
|
+
/** Per-frame override while the sprite draws: a shape name, or nothing for `shape`'s answer. */
|
|
215
|
+
shapeFor?: (hit: CursorShapeHit) => CursorShape | 'none' | 'auto' | null | undefined;
|
|
190
216
|
/** Attach pattern: the Object3D the eye cameras hang off; its world matrix carries the views to world. */
|
|
191
217
|
viewSpace?: unknown;
|
|
218
|
+
/** `true`: log update() cost, rays a frame and the frame interval once a second; `'both'`: also keep the OS cursor visible. */
|
|
219
|
+
debug?: boolean | 'both';
|
|
192
220
|
},
|
|
193
221
|
);
|
|
194
|
-
/**
|
|
222
|
+
/** With `debug` only (else null): the rolling stats; `last` is the newest one-second summary, `history` the last 120. */
|
|
223
|
+
readonly debugStats: { last: CursorDebugSummary | null; history: CursorDebugSummary[] } | null;
|
|
224
|
+
/**
|
|
225
|
+
* The arrow (a `THREE.Mesh`: dark outline, white fill, tip at its origin; depth test off, drawn last). Add it to the scene root.
|
|
226
|
+
* While it is softened its geometry and material are a padded quad and the soft-arrow shader; otherwise the crisp mesh.
|
|
227
|
+
*/
|
|
195
228
|
readonly object: unknown;
|
|
196
229
|
/** The last placement, for diagnostics. */
|
|
197
230
|
readonly placement: CursorPlacement | { active: false };
|
|
231
|
+
/** The resolved softening parameters. */
|
|
232
|
+
readonly soften: CursorSoftenParams;
|
|
233
|
+
/** The last drawn frame's softening (diagnostics); null while nothing is drawn. */
|
|
234
|
+
readonly softening: CursorSoftening | null;
|
|
235
|
+
/** The sprite drawn last: a name, 'none' or 'image'. */
|
|
236
|
+
readonly shape: CursorShape | 'none' | 'image';
|
|
198
237
|
/** Place the sprite for this frame — call with the views you are about to render, before rendering. */
|
|
199
238
|
update(views: ArrayLike<XRView | CursorView>, nowMs?: number): CursorPlacement | { active: false };
|
|
200
239
|
/** Set the pointer directly (canvas-normalised, v down), or null — for scripted input. */
|