@bendyline/molen-client 0.0.2 → 0.0.4
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 -0
- package/dist/assets-Bp0ox8YY.d.mts +59 -0
- package/dist/audio.d.mts +526 -0
- package/dist/audio.mjs +1740 -0
- package/dist/camera-track.d.mts +1 -1
- package/dist/index.d.mts +19 -167
- package/dist/index.mjs +725 -482
- package/dist/input-CD-dHuv0.d.mts +120 -0
- package/dist/input-CfbIm1MS.mjs +361 -0
- package/dist/markers.d.mts +137 -0
- package/dist/markers.mjs +347 -0
- package/dist/navigation.d.mts +557 -0
- package/dist/navigation.mjs +1506 -0
- package/dist/{renderer-B3pd4N-J.d.mts → renderer-DfWc3MFM.d.mts} +111 -5
- package/dist/vehicles.d.mts +31 -2
- package/dist/vehicles.mjs +96 -28
- package/dist/webgpu-driver-Bt2mvZk9.mjs +165 -0
- package/dist/webgpu-sky-reflections-CymGEes-.mjs +22 -0
- package/package.json +17 -4
- package/dist/webgpu-driver-DXsRuz8j.mjs +0 -75
package/dist/camera-track.d.mts
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { i as readModelSignals, n as ModelSignals, r as createModelSignalVisual, t as ModelSignalVisual } from "./model-signals-DVlLyP-w.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { a as createUrlAssetProvider, i as UrlAssetProviderOptions, n as AssetProvider, r as LoadedGltf, t as AssetCache } from "./assets-Bp0ox8YY.mjs";
|
|
3
|
+
import { A as AdmissionOptions, C as skyTimeMs, D as SkyReflections, E as SkyReflectionState, M as FrameAdmissionOptions, N as FrameAdmissionQueue, O as createWebGlSkyReflectionFilter, P as SceneAdmission, S as evaluateEarthSky, T as SkyReflectionFilter, _ as SkyVisual, a as RendererBackendPreference, b as CelestialPosition, c as TopDownOrtho, d as GpuFrameTimer, f as GpuFrameTimerOptions, g as SkyStar, h as SkyFrame, i as RendererBackend, j as AdmissionSample, k as reflectionStateFromLights, l as nextWorldOrigin, m as WeatherVisual, n as CameraPose, o as RendererOptions, p as createGpuFrameTimer, r as Renderer, s as ThreeRenderer, t as AutoWorldOriginOptions, u as orthoFrustum, v as SkyVisualOptions, w as starDirection, x as EarthSkyState, y as defaultSkyPalette } from "./renderer-DfWc3MFM.mjs";
|
|
4
|
+
import { a as normalizeInputAxis, i as InputMapOptions, n as InputGamepad, o as resolveAction, r as InputMap, t as InputBindings } from "./input-CD-dHuv0.mjs";
|
|
5
|
+
import { Command, ControlAction, CustomSkyData, Delta, DiagMessage, EarthObserver, EarthSkyData, EngineEvent, EntityId, JsonObject, JsonValue, Keyframe, MessageLink, ModelSignalSpec, Quat, ResolvedWeather, SceneCamera, SceneInput, SceneManifest, SkyAppearance, SkyBodyData, SkyData, SkyData as SkyData$1, SkyPalette, SkyTime, Vec3, WeatherData, WeatherProfile, resolveWeather, weatherProfile } from "@bendyline/molen-schema";
|
|
4
6
|
import * as THREE from "three";
|
|
5
7
|
import { Intersection, Object3D } from "three";
|
|
6
|
-
import { BakedMaterial, MaterialBaker } from "@bendyline/molen-materials";
|
|
7
|
-
import { GLTFLoader
|
|
8
|
+
import { BakedMaterial, BakedMaterialStore, MaterialBaker } from "@bendyline/molen-materials";
|
|
9
|
+
import { GLTFLoader as GLTFLoader$1 } from "three/addons/loaders/GLTFLoader.js";
|
|
8
10
|
import { WebGPURenderer } from "three/webgpu";
|
|
9
11
|
|
|
10
12
|
//#region src/adaptive-quality.d.ts
|
|
@@ -28,7 +30,10 @@ interface AdaptiveQualityOptions {
|
|
|
28
30
|
interface AdaptiveQualitySample {
|
|
29
31
|
/** False while hidden, suspended, or deliberately not rendering. Resets measurement history. */
|
|
30
32
|
active?: boolean;
|
|
31
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Loading never authorizes an upgrade. With CPU/GPU work measurements it lowers detail only
|
|
35
|
+
* when that work itself is heavy; otherwise sustained overload while loading still lowers it.
|
|
36
|
+
*/
|
|
32
37
|
loading?: boolean;
|
|
33
38
|
/** Optional measured work, excluding waiting for the next animation frame. */
|
|
34
39
|
cpuFrameMs?: number;
|
|
@@ -110,61 +115,6 @@ declare class AdaptiveQualityController {
|
|
|
110
115
|
private resetMeasurements;
|
|
111
116
|
}
|
|
112
117
|
//#endregion
|
|
113
|
-
//#region src/assets.d.ts
|
|
114
|
-
/**
|
|
115
|
-
* Resolves asset refs to bytes. Refs are project asset ids ("crate"); refs containing "/" or
|
|
116
|
-
* starting with "./" / "http(s):" pass through as URLs, so manifest-less demos stay trivial.
|
|
117
|
-
*/
|
|
118
|
-
interface AssetProvider {
|
|
119
|
-
load(ref: string): Promise<ArrayBuffer>;
|
|
120
|
-
loadText(ref: string): Promise<string>;
|
|
121
|
-
}
|
|
122
|
-
interface UrlAssetProviderOptions {
|
|
123
|
-
/**
|
|
124
|
-
* Packed runtime variant to prefer for convention-resolved ids (e.g. "ktx2" from
|
|
125
|
-
* `molen asset pack`): assets/<id>/model.<variant>.glb is tried first and model.glb is the
|
|
126
|
-
* fallback when the variant is not served. Index-mapped and URL-ish refs are used as given.
|
|
127
|
-
*/
|
|
128
|
-
variant?: string;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* URL-backed provider: asset ids resolve through an id -> URL index (from the project manifest's
|
|
132
|
-
* assets record, mapped to served model URLs); URL-ish refs resolve against baseUrl.
|
|
133
|
-
*/
|
|
134
|
-
declare function createUrlAssetProvider(baseUrl: string, index?: Record<string, string>, options?: UrlAssetProviderOptions): AssetProvider;
|
|
135
|
-
interface LoadedGltf {
|
|
136
|
-
scene: THREE.Group;
|
|
137
|
-
clips: THREE.AnimationClip[];
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Parse each glTF ref once; hand out per-entity instances (SkeletonUtils.clone so skinned
|
|
141
|
-
* meshes work while geometry/textures stay shared). `whenIdle()` resolves when no loads are
|
|
142
|
-
* pending — the capture path awaits it before its single deterministic frame.
|
|
143
|
-
*/
|
|
144
|
-
declare class AssetCache {
|
|
145
|
-
private readonly provider;
|
|
146
|
-
/** Owned by the cache: `dispose()` tears down its Draco/KTX2 decoder worker pools. */
|
|
147
|
-
private readonly loader;
|
|
148
|
-
private readonly loads;
|
|
149
|
-
private readonly bases;
|
|
150
|
-
private readonly disposedGeometries;
|
|
151
|
-
private readonly disposedMaterials;
|
|
152
|
-
private pending;
|
|
153
|
-
private idleResolvers;
|
|
154
|
-
private disposed;
|
|
155
|
-
constructor(provider: AssetProvider, loader: GLTFLoader);
|
|
156
|
-
/** Register an external async task (e.g. a material bake) so whenIdle() waits for it. */
|
|
157
|
-
track<T>(p: Promise<T>): Promise<T>;
|
|
158
|
-
private base;
|
|
159
|
-
/** A fresh instance of the (sub-)scene for one entity. */
|
|
160
|
-
instance(ref: string, node?: string): Promise<LoadedGltf>;
|
|
161
|
-
/** Resolves once every load kicked off so far has settled. */
|
|
162
|
-
whenIdle(): Promise<void>;
|
|
163
|
-
clear(): void;
|
|
164
|
-
dispose(): void;
|
|
165
|
-
private disposeLoaded;
|
|
166
|
-
}
|
|
167
|
-
//#endregion
|
|
168
118
|
//#region src/interpolation.d.ts
|
|
169
119
|
interface InterpTransform {
|
|
170
120
|
pos: Vec3;
|
|
@@ -408,112 +358,6 @@ interface ClientCore {
|
|
|
408
358
|
declare function localCommand(seq: number, type: string, payload: Command["payload"]): Command;
|
|
409
359
|
declare function createClientCore(opts: ClientCoreOptions): ClientCore;
|
|
410
360
|
//#endregion
|
|
411
|
-
//#region src/input.d.ts
|
|
412
|
-
type Unsubscribe$2 = () => void;
|
|
413
|
-
interface InputBindings {
|
|
414
|
-
bindings: Record<string, string>;
|
|
415
|
-
}
|
|
416
|
-
/** Resolve a key or Mouse<button> code to its bound action. */
|
|
417
|
-
declare function resolveAction(bindings: Record<string, string>, code: string): string | undefined;
|
|
418
|
-
/** Structural Gamepad API snapshot; also usable by custom device adapters and tests. */
|
|
419
|
-
interface InputGamepad {
|
|
420
|
-
id: string;
|
|
421
|
-
index: number;
|
|
422
|
-
connected: boolean;
|
|
423
|
-
mapping: string;
|
|
424
|
-
axes: readonly number[];
|
|
425
|
-
buttons: readonly {
|
|
426
|
-
pressed: boolean;
|
|
427
|
-
value: number;
|
|
428
|
-
}[];
|
|
429
|
-
}
|
|
430
|
-
type EventTargetLike = {
|
|
431
|
-
addEventListener(type: string, listener: (ev: unknown) => void): void;
|
|
432
|
-
removeEventListener(type: string, listener: (ev: unknown) => void): void;
|
|
433
|
-
};
|
|
434
|
-
interface InputMapOptions extends InputProfile {
|
|
435
|
-
profiles?: Record<string, InputProfile>;
|
|
436
|
-
profile?: string;
|
|
437
|
-
/** Event source (usually window); injectable for tests. */
|
|
438
|
-
target?: EventTargetLike;
|
|
439
|
-
/** Defaults to navigator.getGamepads. Inject an adapter for other browser facilities. */
|
|
440
|
-
getGamepads?: () => readonly (InputGamepad | null)[];
|
|
441
|
-
}
|
|
442
|
-
/** Calibrate and shape a raw axis. Invalid/non-finite hardware readings are neutral. */
|
|
443
|
-
declare function normalizeInputAxis(raw: number, binding: GamepadAxisBinding): number;
|
|
444
|
-
/**
|
|
445
|
-
* Keyboard/mouse + browser controllers mapped to numeric named actions. Call update() each
|
|
446
|
-
* frame (applyInputRules does this on its poller). Profiles are complete replacements.
|
|
447
|
-
*/
|
|
448
|
-
declare class InputMap {
|
|
449
|
-
private base;
|
|
450
|
-
private readonly profiles;
|
|
451
|
-
private current;
|
|
452
|
-
private readonly keys;
|
|
453
|
-
private readonly blockedKeys;
|
|
454
|
-
private readonly blockedButtons;
|
|
455
|
-
private baselineButtons;
|
|
456
|
-
private values;
|
|
457
|
-
private padValues;
|
|
458
|
-
private pads;
|
|
459
|
-
private enabled;
|
|
460
|
-
private disposed;
|
|
461
|
-
private focused;
|
|
462
|
-
private suspensions;
|
|
463
|
-
private revision;
|
|
464
|
-
private readonly pressHandlers;
|
|
465
|
-
private readonly releaseHandlers;
|
|
466
|
-
private readonly changeHandlers;
|
|
467
|
-
private readonly resetHandlers;
|
|
468
|
-
private readonly profileHandlers;
|
|
469
|
-
private readonly target;
|
|
470
|
-
private readonly provider;
|
|
471
|
-
private readonly listeners;
|
|
472
|
-
private status;
|
|
473
|
-
constructor(opts: InputMapOptions);
|
|
474
|
-
private get accepting();
|
|
475
|
-
private get profile();
|
|
476
|
-
get activeProfile(): string | undefined;
|
|
477
|
-
get gamepadStatus(): "available" | "unavailable" | "blocked";
|
|
478
|
-
profileNames(): string[];
|
|
479
|
-
/** Detached, serializable copy for custom editors and host-managed persistence. */
|
|
480
|
-
getProfile(...selection: [name?: string]): InputProfile;
|
|
481
|
-
/** Atomically validate and replace bindings; no held button becomes a new action. */
|
|
482
|
-
defineProfile(name: string | undefined, profile: InputProfile): void;
|
|
483
|
-
/** Undefined selects the root bindings. Held keys/buttons must be released before reuse. */
|
|
484
|
-
setProfile(name: string | undefined): void;
|
|
485
|
-
/** Snapshot of all detected devices and raw values, suitable for an axis/button inspector. */
|
|
486
|
-
devices(): InputGamepad[];
|
|
487
|
-
/** Poll fresh browser objects; unplugging or losing permission releases affected controls. */
|
|
488
|
-
update(): void;
|
|
489
|
-
/** Suspend while editing a form/menu; device discovery continues during update(). */
|
|
490
|
-
setEnabled(enabled: boolean): void;
|
|
491
|
-
/** Temporarily suppress gameplay while a remapping UI is open; returned release is idempotent. */
|
|
492
|
-
suspend(): Unsubscribe$2;
|
|
493
|
-
private attach;
|
|
494
|
-
press(code: string): void;
|
|
495
|
-
release(code: string): void;
|
|
496
|
-
/** Numeric action value; strongest absolute contribution wins, keyboard wins ties. */
|
|
497
|
-
value(action: string): number;
|
|
498
|
-
isActive(action: string): boolean;
|
|
499
|
-
activeActions(): Set<string>;
|
|
500
|
-
private contribute;
|
|
501
|
-
private recompute;
|
|
502
|
-
private commit;
|
|
503
|
-
/** Release actions immediately; suppress held physical buttons until released. */
|
|
504
|
-
reset(): void;
|
|
505
|
-
private subscribe;
|
|
506
|
-
onPress(action: string, handler: (action: string) => void): Unsubscribe$2;
|
|
507
|
-
onRelease(action: string, handler: (action: string) => void): Unsubscribe$2;
|
|
508
|
-
/** Action values changed (including neutralization on reset/profile switch). */
|
|
509
|
-
onChange(handler: () => void): Unsubscribe$2;
|
|
510
|
-
/** Explicit neutralization on reset, focus loss, suspension or profile replacement. */
|
|
511
|
-
onReset(handler: () => void): Unsubscribe$2;
|
|
512
|
-
/** Profile selection or definitions changed. */
|
|
513
|
-
onProfilesChanged(handler: () => void): Unsubscribe$2;
|
|
514
|
-
dispose(): void;
|
|
515
|
-
}
|
|
516
|
-
//#endregion
|
|
517
361
|
//#region src/three/materials.d.ts
|
|
518
362
|
/** Upload a BakedMaterial's slots onto a MeshStandardMaterial. */
|
|
519
363
|
declare function materialFromBaked(baked: BakedMaterial): THREE.MeshStandardMaterial;
|
|
@@ -903,6 +747,14 @@ interface MountedExperience {
|
|
|
903
747
|
*/
|
|
904
748
|
declare function mountExperience(opts: MountExperienceOptions): Promise<MountedExperience>;
|
|
905
749
|
//#endregion
|
|
750
|
+
//#region src/material-store.d.ts
|
|
751
|
+
/**
|
|
752
|
+
* Baked materials kept in IndexedDB across visits; pair with `withBakedMaterialStore` from
|
|
753
|
+
* `@bendyline/molen-materials`. Undefined where IndexedDB is unavailable. Every failure (quota,
|
|
754
|
+
* private browsing, a blocked upgrade) resolves as a miss, so baking simply runs as before.
|
|
755
|
+
*/
|
|
756
|
+
declare function createIndexedDbMaterialStore(name?: string): BakedMaterialStore | undefined;
|
|
757
|
+
//#endregion
|
|
906
758
|
//#region src/math.d.ts
|
|
907
759
|
declare function lerp3(a: Vec3, b: Vec3, t: number): Vec3;
|
|
908
760
|
/**
|
|
@@ -997,4 +849,4 @@ declare const defaultEnvironment: EnvironmentData;
|
|
|
997
849
|
*/
|
|
998
850
|
declare function applyEnvironment(renderer: Renderer, env: EnvironmentData): void;
|
|
999
851
|
//#endregion
|
|
1000
|
-
export { type AdaptiveQualityChange, AdaptiveQualityController, type AdaptiveQualityOptions, type AdaptiveQualityReason, type AdaptiveQualitySample, type AdaptiveQualityStats, type AdmissionOptions, type AdmissionSample, AssetCache, type AssetOptions, type AssetProvider, type AutoWorldOriginOptions, type CameraPose, type CameraTarget, type CelestialPosition, type ClientCore, type ClientCoreOptions, type ClientDiagCode, type ClientError, type ClientOptions, type CustomSkyData, type DecoderConfig, type EarthObserver, type EarthSkyData, type EarthSkyState, type EnvironmentData, type FrameAdmissionOptions, FrameAdmissionQueue, type GpuFrameTimer, type GpuFrameTimerOptions, type InputBindings, type InputGamepad, InputMap, type InputMapOptions, type InputRuleOptions, type InterpTransform, InterpolationBuffer, type KindContext, type KindHandle, type KindView, type LightData, type LoadedGltf, MaterialResolver, type MirrorReader, type ModelSignalVisual, type ModelSignals, type MolenClient, type MountExperienceOptions, type MountedExperience, type Renderable, type RenderableKind, Renderer, type RendererBackend, type RendererBackendPreference, type RendererOptions, type ResolvedWeather, type SceneAdmission, type SceneBackend, SceneMirror, type SceneOptimizationOptions, type SkyAppearance, type SkyBodyData, type SkyData, type SkyFrame, type SkyPalette, type SkyStar, type SkyTime, SkyVisual, type SkyVisualOptions, type StarCatalogRow, type StaticBatchOptions, THREE, type ThreeRenderer, ThreeSceneBackend, type TopDownOrtho, type Unsubscribe, type UrlAssetProviderOptions, type WeatherData, type WeatherProfile, WeatherVisual, applyEnvironment, applyInputRules, applySceneCamera, computeClipTime, createClient, createClientCore, createGltfLoader, createGpuFrameTimer, createModelSignalVisual, createSnapshotViewer, createUrlAssetProvider, createViewer, decodeStarCatalog, decodeStarCatalogRows, defaultEnvironment, defaultSkyPalette, encodeStarCatalog, evaluateEarthSky, followCameraPose, lerp3, localCommand, materialFromBaked, mountExperience, nextWorldOrigin, nlerp4, normalizeInputAxis, orthoFrustum, readModelSignals, resolveAction, resolveWeather, skyTimeMs, starDirection, weatherProfile };
|
|
852
|
+
export { type AdaptiveQualityChange, AdaptiveQualityController, type AdaptiveQualityOptions, type AdaptiveQualityReason, type AdaptiveQualitySample, type AdaptiveQualityStats, type AdmissionOptions, type AdmissionSample, AssetCache, type AssetOptions, type AssetProvider, type AutoWorldOriginOptions, type CameraPose, type CameraTarget, type CelestialPosition, type ClientCore, type ClientCoreOptions, type ClientDiagCode, type ClientError, type ClientOptions, type CustomSkyData, type DecoderConfig, type EarthObserver, type EarthSkyData, type EarthSkyState, type EnvironmentData, type FrameAdmissionOptions, FrameAdmissionQueue, type GpuFrameTimer, type GpuFrameTimerOptions, type InputBindings, type InputGamepad, InputMap, type InputMapOptions, type InputRuleOptions, type InterpTransform, InterpolationBuffer, type KindContext, type KindHandle, type KindView, type LightData, type LoadedGltf, MaterialResolver, type MirrorReader, type ModelSignalVisual, type ModelSignals, type MolenClient, type MountExperienceOptions, type MountedExperience, type Renderable, type RenderableKind, Renderer, type RendererBackend, type RendererBackendPreference, type RendererOptions, type ResolvedWeather, type SceneAdmission, type SceneBackend, SceneMirror, type SceneOptimizationOptions, type SkyAppearance, type SkyBodyData, type SkyData, type SkyFrame, type SkyPalette, type SkyReflectionFilter, type SkyReflectionState, SkyReflections, type SkyStar, type SkyTime, SkyVisual, type SkyVisualOptions, type StarCatalogRow, type StaticBatchOptions, THREE, type ThreeRenderer, ThreeSceneBackend, type TopDownOrtho, type Unsubscribe, type UrlAssetProviderOptions, type WeatherData, type WeatherProfile, WeatherVisual, applyEnvironment, applyInputRules, applySceneCamera, computeClipTime, createClient, createClientCore, createGltfLoader, createGpuFrameTimer, createIndexedDbMaterialStore, createModelSignalVisual, createSnapshotViewer, createUrlAssetProvider, createViewer, createWebGlSkyReflectionFilter, decodeStarCatalog, decodeStarCatalogRows, defaultEnvironment, defaultSkyPalette, encodeStarCatalog, evaluateEarthSky, followCameraPose, lerp3, localCommand, materialFromBaked, mountExperience, nextWorldOrigin, nlerp4, normalizeInputAxis, orthoFrustum, readModelSignals, reflectionStateFromLights, resolveAction, resolveWeather, skyTimeMs, starDirection, weatherProfile };
|