@bendyline/molen-client 0.0.10 → 0.0.12
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 +1 -0
- package/dist/aircraft.d.mts +89 -4
- package/dist/aircraft.mjs +737 -8
- package/dist/audio.d.mts +10 -1
- package/dist/audio.mjs +131 -6
- package/dist/camera-track.d.mts +1 -1
- package/dist/clouds-DmASLVoe.mjs +862 -0
- package/dist/glass.d.mts +19 -0
- package/dist/glass.mjs +249 -0
- package/dist/index.d.mts +34 -6
- package/dist/index.mjs +917 -171
- package/dist/{input-BVZjf4T-.mjs → input-BliZYUY1.mjs} +42 -12
- package/dist/{input-CD-dHuv0.d.mts → input-Ckev_Kvj.d.mts} +9 -0
- package/dist/livery-qcDLzbU9.mjs +307 -0
- package/dist/navigation.d.mts +54 -10
- package/dist/navigation.mjs +646 -220
- package/dist/{renderer-CtEtmwJG.d.mts → renderer-DAk7C8jH.d.mts} +318 -24
- package/dist/vehicle-interior-B8TpzTAx.d.mts +56 -0
- package/dist/vehicle-interior-CeyzF5El.mjs +455 -0
- package/dist/vehicles.d.mts +26 -20
- package/dist/vehicles.mjs +317 -71
- package/dist/webgpu-clouds-H03g7ID1.mjs +186 -0
- package/package.json +7 -3
- package/dist/vehicle-interior-BgcC750p.d.mts +0 -31
- package/dist/vehicle-interior-DfpZwWEh.mjs +0 -15
package/dist/glass.d.mts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { GlassData, GlassStateData } from "@bendyline/molen-schema";
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
|
|
4
|
+
//#region src/glass.d.ts
|
|
5
|
+
interface GlassVisual {
|
|
6
|
+
readonly missingNodes: string[];
|
|
7
|
+
/** Simulation seconds, so pause, rewind and checkpoint restore reproduce the same debris. */
|
|
8
|
+
update(state: GlassStateData | undefined, timeSeconds: number): void;
|
|
9
|
+
dispose(): void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Reusable rectangular glass visualization. Dedicated model panes are hidden only on release;
|
|
13
|
+
* generated crack cells and debris are owned here, never written into shared GLB resources.
|
|
14
|
+
* Debris is cosmetic, ballistic, bounded to eight seconds and has no collision authority.
|
|
15
|
+
* `model` must carry the owner's simulation transform relative to its scene/origin-shift root.
|
|
16
|
+
*/
|
|
17
|
+
declare function createGlassVisual(model: THREE.Object3D, data: GlassData): GlassVisual;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { GlassVisual, createGlassVisual };
|
package/dist/glass.mjs
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
//#region src/glass.ts
|
|
3
|
+
function random(index) {
|
|
4
|
+
let value = Math.imul(index + 1, 73244475);
|
|
5
|
+
value = Math.imul(value ^ value >>> 16, 73244475);
|
|
6
|
+
return ((value ^ value >>> 16) >>> 0) / 4294967296;
|
|
7
|
+
}
|
|
8
|
+
/** Radial cracks and irregular connecting rings, clipped to the pane boundary. */
|
|
9
|
+
function laminateCracks(spec, point) {
|
|
10
|
+
const edges = [];
|
|
11
|
+
const rings = [];
|
|
12
|
+
for (let ring = 0; ring <= 4; ring++) {
|
|
13
|
+
const vertices = [];
|
|
14
|
+
for (let ray = 0; ray < 20; ray++) {
|
|
15
|
+
const angle = (ray + (random(ray + 101) - .5) * .5) * Math.PI * 2 / 20;
|
|
16
|
+
const dx = Math.cos(angle), dy = Math.sin(angle);
|
|
17
|
+
const rx = Math.abs(dx) < 1e-9 ? Infinity : (Math.sign(dx) * spec.size[0] / 2 - point[0]) / dx;
|
|
18
|
+
const ry = Math.abs(dy) < 1e-9 ? Infinity : (Math.sign(dy) * spec.size[1] / 2 - point[1]) / dy;
|
|
19
|
+
const distance = Math.min(rx, ry) * (ring === 0 ? 0 : ring === 4 ? 1 : (ring + (random(ray + ring * 31) - .5) * .5) / 4);
|
|
20
|
+
vertices.push(new THREE.Vector3(point[0] + dx * distance, point[1] + dy * distance, .003));
|
|
21
|
+
}
|
|
22
|
+
rings.push(vertices);
|
|
23
|
+
}
|
|
24
|
+
for (let ring = 1; ring <= 4; ring++) for (let ray = 0; ray < 20; ray++) {
|
|
25
|
+
const p = rings[ring - 1]?.[ray];
|
|
26
|
+
const q = rings[ring]?.[ray];
|
|
27
|
+
edges.push(...p.toArray(), ...q.toArray());
|
|
28
|
+
if (ring < 4) edges.push(...q.toArray(), ...(rings[ring]?.[(ray + 1) % 20]).toArray());
|
|
29
|
+
}
|
|
30
|
+
return edges;
|
|
31
|
+
}
|
|
32
|
+
/** Bounded irregular cells: tempered granules, larger annealed shards, a connected laminate. */
|
|
33
|
+
function cells(pane) {
|
|
34
|
+
const nx = pane.material === "annealed" ? 4 : 12;
|
|
35
|
+
const ny = pane.material === "annealed" ? 3 : 8;
|
|
36
|
+
const points = [];
|
|
37
|
+
for (let y = 0; y <= ny; y++) for (let x = 0; x <= nx; x++) {
|
|
38
|
+
const index = y * (nx + 1) + x;
|
|
39
|
+
points.push(new THREE.Vector3(((x + (x > 0 && x < nx ? (random(index) - .5) * .6 : 0)) / nx - .5) * pane.size[0], ((y + (y > 0 && y < ny ? (random(index + 901) - .5) * .6 : 0)) / ny - .5) * pane.size[1], 0));
|
|
40
|
+
}
|
|
41
|
+
const positions = [], edges = [], centers = [];
|
|
42
|
+
for (let y = 0; y < ny; y++) for (let x = 0; x < nx; x++) {
|
|
43
|
+
const a = points[y * (nx + 1) + x];
|
|
44
|
+
const b = points[y * (nx + 1) + x + 1];
|
|
45
|
+
const c = points[(y + 1) * (nx + 1) + x + 1];
|
|
46
|
+
const d = points[(y + 1) * (nx + 1) + x];
|
|
47
|
+
for (const point of [
|
|
48
|
+
a,
|
|
49
|
+
b,
|
|
50
|
+
c,
|
|
51
|
+
a,
|
|
52
|
+
c,
|
|
53
|
+
d
|
|
54
|
+
]) positions.push(point.x, point.y, point.z);
|
|
55
|
+
centers.push(a.clone().add(b).add(c).add(d).multiplyScalar(.25));
|
|
56
|
+
for (const [p, q] of [
|
|
57
|
+
[a, b],
|
|
58
|
+
[b, c],
|
|
59
|
+
[c, d],
|
|
60
|
+
[d, a]
|
|
61
|
+
]) edges.push(p.x, p.y, .003, q.x, q.y, .003);
|
|
62
|
+
}
|
|
63
|
+
const geometry = new THREE.BufferGeometry();
|
|
64
|
+
geometry.setAttribute("position", new THREE.Float32BufferAttribute(positions, 3));
|
|
65
|
+
geometry.computeVertexNormals();
|
|
66
|
+
return {
|
|
67
|
+
geometry,
|
|
68
|
+
centers,
|
|
69
|
+
edges
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Reusable rectangular glass visualization. Dedicated model panes are hidden only on release;
|
|
74
|
+
* generated crack cells and debris are owned here, never written into shared GLB resources.
|
|
75
|
+
* Debris is cosmetic, ballistic, bounded to eight seconds and has no collision authority.
|
|
76
|
+
* `model` must carry the owner's simulation transform relative to its scene/origin-shift root.
|
|
77
|
+
*/
|
|
78
|
+
function createGlassVisual(model, data) {
|
|
79
|
+
const missingNodes = [];
|
|
80
|
+
const claimed = /* @__PURE__ */ new Set();
|
|
81
|
+
const panes = data.surfaces.map((spec) => {
|
|
82
|
+
const sources = [];
|
|
83
|
+
for (const name of spec.nodes ?? []) {
|
|
84
|
+
const found = [];
|
|
85
|
+
model.traverse((node) => {
|
|
86
|
+
if (node !== model && (node.userData.name ?? node.name) === name) found.push(node);
|
|
87
|
+
});
|
|
88
|
+
if (found.length === 0) missingNodes.push(name);
|
|
89
|
+
for (const node of found) {
|
|
90
|
+
node.traverse((child) => {
|
|
91
|
+
if (claimed.has(child)) throw new Error(`Glass node '${name}' belongs to more than one pane.`);
|
|
92
|
+
claimed.add(child);
|
|
93
|
+
});
|
|
94
|
+
sources.push(node);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
spec,
|
|
99
|
+
sources,
|
|
100
|
+
visible: sources.map((node) => node.visible)
|
|
101
|
+
};
|
|
102
|
+
}).map(({ spec, sources, visible }) => {
|
|
103
|
+
const group = new THREE.Group();
|
|
104
|
+
group.name = `glass:${spec.id}`;
|
|
105
|
+
model.add(group);
|
|
106
|
+
const material = new THREE.MeshStandardMaterial({
|
|
107
|
+
color: "#8baeb7",
|
|
108
|
+
roughness: .18,
|
|
109
|
+
metalness: .1,
|
|
110
|
+
transparent: true,
|
|
111
|
+
opacity: .36,
|
|
112
|
+
depthWrite: false,
|
|
113
|
+
side: THREE.DoubleSide
|
|
114
|
+
});
|
|
115
|
+
const { geometry, centers, edges } = cells(spec);
|
|
116
|
+
const mesh = new THREE.Mesh(geometry, material);
|
|
117
|
+
mesh.name = `glass-pane:${spec.id}`;
|
|
118
|
+
group.add(mesh);
|
|
119
|
+
const rest = new Float32Array(geometry.getAttribute("position").array);
|
|
120
|
+
const edgeGeometry = new THREE.BufferGeometry();
|
|
121
|
+
edgeGeometry.setAttribute("position", new THREE.Float32BufferAttribute(edges, 3));
|
|
122
|
+
const edgeMaterial = new THREE.LineBasicMaterial({
|
|
123
|
+
color: "#e1f5f5",
|
|
124
|
+
transparent: true,
|
|
125
|
+
opacity: .8,
|
|
126
|
+
depthWrite: false
|
|
127
|
+
});
|
|
128
|
+
const cracks = new THREE.LineSegments(edgeGeometry, edgeMaterial);
|
|
129
|
+
cracks.name = `glass-cracks:${spec.id}`;
|
|
130
|
+
group.add(cracks);
|
|
131
|
+
const sheet = new THREE.Group();
|
|
132
|
+
sheet.name = `glass-sheet:${spec.id}`;
|
|
133
|
+
group.add(sheet);
|
|
134
|
+
model.updateWorldMatrix(true, true);
|
|
135
|
+
const paneMatrix = new THREE.Matrix4().compose(new THREE.Vector3().fromArray(spec.center), new THREE.Quaternion().fromArray(spec.rotation), new THREE.Vector3(1, 1, 1));
|
|
136
|
+
const inverse = paneMatrix.clone().invert().multiply(model.matrixWorld.clone().invert());
|
|
137
|
+
for (const node of sources) {
|
|
138
|
+
const clone = node.clone(true);
|
|
139
|
+
clone.matrixAutoUpdate = false;
|
|
140
|
+
clone.matrix.copy(inverse).multiply(node.matrixWorld);
|
|
141
|
+
clone.matrix.decompose(clone.position, clone.quaternion, clone.scale);
|
|
142
|
+
clone.visible = node.visible;
|
|
143
|
+
sheet.add(clone);
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
spec,
|
|
147
|
+
sources,
|
|
148
|
+
visible,
|
|
149
|
+
group,
|
|
150
|
+
mesh,
|
|
151
|
+
cracks,
|
|
152
|
+
sheet,
|
|
153
|
+
geometry,
|
|
154
|
+
edgeGeometry,
|
|
155
|
+
material,
|
|
156
|
+
edgeMaterial,
|
|
157
|
+
rest,
|
|
158
|
+
centers,
|
|
159
|
+
paneMatrix,
|
|
160
|
+
crackPoint: "",
|
|
161
|
+
fragmentAge: -1
|
|
162
|
+
};
|
|
163
|
+
});
|
|
164
|
+
const inverse = new THREE.Matrix4(), pose = new THREE.Matrix4();
|
|
165
|
+
const position = new THREE.Vector3(), rotation = new THREE.Quaternion(), unit = new THREE.Vector3(1, 1, 1);
|
|
166
|
+
const vertex = new THREE.Vector3(), offset = new THREE.Vector3(), spin = new THREE.Quaternion();
|
|
167
|
+
let disposed = false;
|
|
168
|
+
const update = (state, time) => {
|
|
169
|
+
if (disposed) return;
|
|
170
|
+
model.updateMatrix();
|
|
171
|
+
inverse.copy(model.matrix).invert();
|
|
172
|
+
for (const pane of panes) {
|
|
173
|
+
const { spec, group, geometry, mesh, cracks, sheet, sources } = pane;
|
|
174
|
+
const damage = state && Object.hasOwn(state.surfaces, spec.id) ? state.surfaces[spec.id] : void 0;
|
|
175
|
+
const retained = damage?.retained !== false;
|
|
176
|
+
const release = damage?.release;
|
|
177
|
+
const age = release ? Math.max(0, time - release.time) : 0;
|
|
178
|
+
const fragmented = damage?.fracture === "shattered" && spec.material !== "laminated";
|
|
179
|
+
group.visible = retained || !!release && age < 8;
|
|
180
|
+
group.matrixAutoUpdate = false;
|
|
181
|
+
group.matrix.copy(pane.paneMatrix);
|
|
182
|
+
if (!retained && release) {
|
|
183
|
+
position.fromArray(release.position).addScaledVector(new THREE.Vector3().fromArray(release.velocity), age);
|
|
184
|
+
position.y -= .5 * 9.81 * age * age;
|
|
185
|
+
rotation.fromArray(release.rotation);
|
|
186
|
+
pose.compose(position, rotation, unit);
|
|
187
|
+
group.matrix.copy(inverse).multiply(pose);
|
|
188
|
+
}
|
|
189
|
+
group.matrixWorldNeedsUpdate = true;
|
|
190
|
+
group.matrix.decompose(group.position, group.quaternion, group.scale);
|
|
191
|
+
sources.forEach((node, i) => {
|
|
192
|
+
node.visible = retained && (pane.visible[i] ?? true);
|
|
193
|
+
});
|
|
194
|
+
sheet.visible = !retained && !fragmented && sources.length > 0;
|
|
195
|
+
mesh.visible = sources.length === 0 || !retained && fragmented;
|
|
196
|
+
cracks.visible = damage !== void 0 && damage.fracture !== "intact" && !fragmented;
|
|
197
|
+
const crackPoint = JSON.stringify(damage?.point ?? [0, 0]);
|
|
198
|
+
if (spec.material === "laminated" && pane.crackPoint !== crackPoint) {
|
|
199
|
+
pane.edgeGeometry.setAttribute("position", new THREE.Float32BufferAttribute(laminateCracks(spec, damage?.point ?? [0, 0]), 3));
|
|
200
|
+
pane.edgeGeometry.computeBoundingSphere();
|
|
201
|
+
pane.crackPoint = crackPoint;
|
|
202
|
+
}
|
|
203
|
+
pane.edgeGeometry.setDrawRange(0, Math.floor(pane.edgeGeometry.getAttribute("position").count / 2 * (damage?.damage ?? 0)) * 2);
|
|
204
|
+
pane.material.opacity = !retained ? .65 * Math.max(0, Math.min(1, 8 - age)) : .36;
|
|
205
|
+
pane.edgeMaterial.opacity = !retained ? .8 * Math.max(0, Math.min(1, 8 - age)) : .8;
|
|
206
|
+
const attribute = geometry.getAttribute("position");
|
|
207
|
+
const array = attribute.array;
|
|
208
|
+
const fragmentAge = group.visible && !retained && fragmented ? age : -1;
|
|
209
|
+
if (pane.fragmentAge === fragmentAge) continue;
|
|
210
|
+
pane.fragmentAge = fragmentAge;
|
|
211
|
+
array.set(pane.rest);
|
|
212
|
+
if (group.visible && !retained && fragmented) for (let i = 0; i < pane.centers.length; i++) {
|
|
213
|
+
const center = pane.centers[i];
|
|
214
|
+
const dispersion = release?.fragmentSpeed ?? 0;
|
|
215
|
+
offset.set(random(i + 17) - .5, random(i + 101) - .5, random(i + 73) - .5).multiplyScalar(age * dispersion);
|
|
216
|
+
spin.setFromAxisAngle(new THREE.Vector3(.4, .7, .2).normalize(), (random(i + 911) - .5) * age * dispersion * 7);
|
|
217
|
+
for (let j = 0; j < 6; j++) {
|
|
218
|
+
const at = (i * 6 + j) * 3;
|
|
219
|
+
vertex.fromArray(pane.rest, at).sub(center).applyQuaternion(spin).add(center).add(offset);
|
|
220
|
+
vertex.toArray(array, at);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
attribute.needsUpdate = true;
|
|
224
|
+
geometry.computeVertexNormals();
|
|
225
|
+
geometry.computeBoundingSphere();
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
update(void 0, 0);
|
|
229
|
+
return {
|
|
230
|
+
missingNodes,
|
|
231
|
+
update,
|
|
232
|
+
dispose() {
|
|
233
|
+
if (disposed) return;
|
|
234
|
+
disposed = true;
|
|
235
|
+
for (const pane of panes) {
|
|
236
|
+
pane.sources.forEach((node, i) => {
|
|
237
|
+
node.visible = pane.visible[i] ?? true;
|
|
238
|
+
});
|
|
239
|
+
pane.group.removeFromParent();
|
|
240
|
+
pane.geometry.dispose();
|
|
241
|
+
pane.edgeGeometry.dispose();
|
|
242
|
+
pane.material.dispose();
|
|
243
|
+
pane.edgeMaterial.dispose();
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
//#endregion
|
|
249
|
+
export { createGlassVisual };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as readModelSignals, n as ModelSignals, r as createModelSignalVisual, t as ModelSignalVisual } from "./model-signals-BpeXhsim.mjs";
|
|
2
2
|
import { a as createUrlAssetProvider, i as UrlAssetProviderOptions, n as AssetProvider, r as LoadedGltf, t as AssetCache } from "./assets-IbO4GJpF.mjs";
|
|
3
|
-
import { A as
|
|
4
|
-
import { a as normalizeInputAxis, i as InputMapOptions, n as InputGamepad, o as resolveAction, r as InputMap, t as InputBindings } from "./input-
|
|
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";
|
|
3
|
+
import { A as SkyReflectionState, C as defaultSkyPalette, D as skyTimeMs, E as evaluateEarthSky, F as AdmissionSample, I as FrameAdmissionOptions, L as FrameAdmissionQueue, M as createWebGlSkyReflectionFilter, N as reflectionStateFromLights, O as starDirection, P as AdmissionOptions, R as SceneAdmission, S as SkyVisualOptions, T as EarthSkyState, _ as WeatherVisualOptions, a as RendererBackendPreference, b as SkyStar, c as TopDownOrtho, d as ShadowFocus, f as ShadowQuality, g as WeatherVisual, h as createGpuFrameTimer, i as RendererBackend, j as SkyReflections, k as SkyReflectionFilter, l as nextWorldOrigin, m as GpuFrameTimerOptions, n as CameraPose, o as RendererOptions, p as GpuFrameTimer, r as Renderer, s as ThreeRenderer, t as AutoWorldOriginOptions, u as orthoFrustum, v as CloudQuality, w as CelestialPosition, x as SkyVisual, y as SkyFrame } from "./renderer-DAk7C8jH.mjs";
|
|
4
|
+
import { a as normalizeInputAxis, i as InputMapOptions, n as InputGamepad, o as resolveAction, r as InputMap, t as InputBindings } from "./input-Ckev_Kvj.mjs";
|
|
5
|
+
import { CloudType, Command, ControlAction, CustomSkyData, Delta, DiagMessage, EarthObserver, EarthSkyData, EngineEvent, EntityId, GlassData, GlassStateData, JsonObject, JsonValue, Keyframe, LiveryData, LiveryGraphic, 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";
|
|
6
6
|
import * as THREE from "three";
|
|
7
7
|
import { Intersection, Object3D } from "three";
|
|
8
8
|
import { BakedMaterial, BakedMaterialStore, MaterialBaker } from "@bendyline/molen-materials";
|
|
@@ -31,8 +31,9 @@ interface AdaptiveQualitySample {
|
|
|
31
31
|
/** False while hidden, suspended, or deliberately not rendering. Resets measurement history. */
|
|
32
32
|
active?: boolean;
|
|
33
33
|
/**
|
|
34
|
-
* Loading never authorizes an upgrade.
|
|
35
|
-
*
|
|
34
|
+
* Loading alone never authorizes an upgrade. Sustained on-target frames with both CPU and GPU
|
|
35
|
+
* headroom can recover during continuous streaming. Measured loading stalls do not lower detail
|
|
36
|
+
* unless rendering itself is heavy.
|
|
36
37
|
*/
|
|
37
38
|
loading?: boolean;
|
|
38
39
|
/** Optional measured work, excluding waiting for the next animation frame. */
|
|
@@ -225,6 +226,8 @@ interface SceneBackend {
|
|
|
225
226
|
destroy(id: EntityId): void;
|
|
226
227
|
setTransform(id: EntityId, transform: InterpTransform): void;
|
|
227
228
|
setModelSignals?(id: EntityId, spec: ModelSignalSpec | undefined, signals: ModelSignals): void;
|
|
229
|
+
setLivery?(id: EntityId, data: LiveryData | undefined): void;
|
|
230
|
+
setGlass?(id: EntityId, data: GlassData | undefined, state: GlassStateData | undefined): void;
|
|
228
231
|
/** Optional light surface (per-entity `light` components). */
|
|
229
232
|
createLight?(id: EntityId, light: LightData): void;
|
|
230
233
|
updateLight?(id: EntityId, light: LightData): void;
|
|
@@ -505,7 +508,9 @@ declare class ThreeSceneBackend implements SceneBackend {
|
|
|
505
508
|
private animationTickRate;
|
|
506
509
|
private readonly objects;
|
|
507
510
|
private readonly gltf;
|
|
511
|
+
private readonly liveries;
|
|
508
512
|
private readonly modelSignals;
|
|
513
|
+
private readonly glass;
|
|
509
514
|
private readonly identities;
|
|
510
515
|
private readonly lights;
|
|
511
516
|
private readonly pointLightSlots;
|
|
@@ -553,9 +558,15 @@ declare class ThreeSceneBackend implements SceneBackend {
|
|
|
553
558
|
private applyAnimation;
|
|
554
559
|
updateRenderable(id: EntityId, renderable: Renderable): void;
|
|
555
560
|
/** Latest mirrored values are retained while the model loads. No simulation state is changed. */
|
|
561
|
+
setLivery(id: EntityId, data: LiveryData | undefined): void;
|
|
562
|
+
private bindLivery;
|
|
563
|
+
/** Latest mirrored values are retained while the model loads. No simulation state is changed. */
|
|
556
564
|
setModelSignals(id: EntityId, spec: ModelSignalSpec | undefined, signals: ModelSignals): void;
|
|
557
565
|
private bindModelSignals;
|
|
558
566
|
private applyModelSignals;
|
|
567
|
+
setGlass(id: EntityId, data: GlassData | undefined, state: GlassStateData | undefined): void;
|
|
568
|
+
private bindGlass;
|
|
569
|
+
private applyGlass;
|
|
559
570
|
destroy(id: EntityId): void;
|
|
560
571
|
setTransform(id: EntityId, t: InterpTransform): void;
|
|
561
572
|
/** Per-entity `light` components (directional/spot aim at the origin by default). */
|
|
@@ -623,6 +634,8 @@ interface ClientOptions extends RendererOptions {
|
|
|
623
634
|
/** Optional caller-owned worker pool for procedural textures. */
|
|
624
635
|
materialBaker?: MaterialBaker;
|
|
625
636
|
frameLoop?: "auto" | "manual";
|
|
637
|
+
/** Pause the worker and automatic rendering on blur/hidden. Default true for automatic loops. */
|
|
638
|
+
pauseWhenInactive?: boolean;
|
|
626
639
|
/** Declarative camera; follow targets use the same interpolation as rendered entities. */
|
|
627
640
|
sceneCamera?: SceneCamera;
|
|
628
641
|
interpolationDelayTicks?: number;
|
|
@@ -751,6 +764,17 @@ interface MountedExperience {
|
|
|
751
764
|
*/
|
|
752
765
|
declare function mountExperience(opts: MountExperienceOptions): Promise<MountedExperience>;
|
|
753
766
|
//#endregion
|
|
767
|
+
//#region src/livery.d.ts
|
|
768
|
+
interface LiveryVisual {
|
|
769
|
+
readonly warnings: readonly string[];
|
|
770
|
+
/** Restore originals and release only the resources owned by this livery. */
|
|
771
|
+
dispose(): void;
|
|
772
|
+
}
|
|
773
|
+
/** Flat vector artwork, including outlined text; no browser fonts or image downloads. */
|
|
774
|
+
declare function liveryGraphicTexture(graphic: LiveryGraphic, size?: number): THREE.DataTexture;
|
|
775
|
+
/** Apply to an instance, never a cache template. Does not mutate shared materials or geometry. */
|
|
776
|
+
declare function applyLivery(model: THREE.Object3D, data: LiveryData): LiveryVisual;
|
|
777
|
+
//#endregion
|
|
754
778
|
//#region src/material-store.d.ts
|
|
755
779
|
/**
|
|
756
780
|
* Baked materials kept in IndexedDB across visits; pair with `withBakedMaterialStore` from
|
|
@@ -770,6 +794,10 @@ declare function lerp3(a: Vec3, b: Vec3, t: number): Vec3;
|
|
|
770
794
|
*/
|
|
771
795
|
declare function nlerp4(a: Quat, b: Quat, t: number): Quat;
|
|
772
796
|
//#endregion
|
|
797
|
+
//#region src/page-activity.d.ts
|
|
798
|
+
/** Observe whether the page is both visible and focused; reports the initial state immediately. */
|
|
799
|
+
declare function observePageActivity(onChange: (active: boolean) => void): () => void;
|
|
800
|
+
//#endregion
|
|
773
801
|
//#region src/scene-bindings.d.ts
|
|
774
802
|
type Unsubscribe$1 = () => void;
|
|
775
803
|
/** The renderer surface `applySceneCamera` needs (satisfied by `Renderer`). */
|
|
@@ -853,4 +881,4 @@ declare const defaultEnvironment: EnvironmentData;
|
|
|
853
881
|
*/
|
|
854
882
|
declare function applyEnvironment(renderer: Renderer, env: EnvironmentData): void;
|
|
855
883
|
//#endregion
|
|
856
|
-
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 ShadowFocus, type ShadowQuality, 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 };
|
|
884
|
+
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 CloudQuality, type CloudType, 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 LiveryVisual, 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 ShadowFocus, type ShadowQuality, 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, type WeatherVisualOptions, applyEnvironment, applyInputRules, applyLivery, applySceneCamera, computeClipTime, createClient, createClientCore, createGltfLoader, createGpuFrameTimer, createIndexedDbMaterialStore, createModelSignalVisual, createSnapshotViewer, createUrlAssetProvider, createViewer, createWebGlSkyReflectionFilter, decodeStarCatalog, decodeStarCatalogRows, defaultEnvironment, defaultSkyPalette, encodeStarCatalog, evaluateEarthSky, followCameraPose, lerp3, liveryGraphicTexture, localCommand, materialFromBaked, mountExperience, nextWorldOrigin, nlerp4, normalizeInputAxis, observePageActivity, orthoFrustum, readModelSignals, reflectionStateFromLights, resolveAction, resolveWeather, skyTimeMs, starDirection, weatherProfile };
|