@bendyline/molen-client 0.0.5 → 0.0.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.
@@ -7,8 +7,12 @@ import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";
7
7
  * starting with "./" / "http(s):" pass through as URLs, so manifest-less demos stay trivial.
8
8
  */
9
9
  interface AssetProvider {
10
- load(ref: string): Promise<ArrayBuffer>;
11
- loadText(ref: string): Promise<string>;
10
+ load(ref: string, options?: {
11
+ signal?: AbortSignal;
12
+ }): Promise<ArrayBuffer>;
13
+ loadText(ref: string, options?: {
14
+ signal?: AbortSignal;
15
+ }): Promise<string>;
12
16
  }
13
17
  interface UrlAssetProviderOptions {
14
18
  /**
package/dist/audio.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as AssetProvider } from "./assets-Bp0ox8YY.mjs";
1
+ import { n as AssetProvider } from "./assets-IbO4GJpF.mjs";
2
2
  import { AudioEnvironmentData, AudioScalar, AudioWhen, EngineEvent, EntityId, JsonObject, SoundEntry, SoundbankDoc, WeatherData } from "@bendyline/molen-schema";
3
3
 
4
4
  //#region src/audio/types.d.ts
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { i as readModelSignals, n as ModelSignals, r as createModelSignalVisual, t as ModelSignalVisual } from "./model-signals-DVlLyP-w.mjs";
2
- import { a as createUrlAssetProvider, i as UrlAssetProviderOptions, n as AssetProvider, r as LoadedGltf, t as AssetCache } from "./assets-Bp0ox8YY.mjs";
2
+ import { a as createUrlAssetProvider, i as UrlAssetProviderOptions, n as AssetProvider, r as LoadedGltf, t as AssetCache } from "./assets-IbO4GJpF.mjs";
3
3
  import { A as createWebGlSkyReflectionFilter, C as EarthSkyState, D as SkyReflectionFilter, E as starDirection, F as FrameAdmissionQueue, I as SceneAdmission, M as AdmissionOptions, N as AdmissionSample, O as SkyReflectionState, P as FrameAdmissionOptions, S as CelestialPosition, T as skyTimeMs, _ as SkyFrame, a as RendererBackendPreference, b as SkyVisualOptions, c as TopDownOrtho, d as ShadowFocus, f as ShadowQuality, g as WeatherVisual, h as createGpuFrameTimer, i as RendererBackend, j as reflectionStateFromLights, k as SkyReflections, 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 SkyStar, w as evaluateEarthSky, x as defaultSkyPalette, y as SkyVisual } from "./renderer-DNXUCuIZ.mjs";
4
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
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";
package/dist/index.mjs CHANGED
@@ -229,22 +229,22 @@ function createUrlAssetProvider(baseUrl, index, options = {}) {
229
229
  if (options.variant !== void 0) urls.unshift(new URL(`${dir}/model.${options.variant}.glb`, baseUrl).href);
230
230
  return urls;
231
231
  };
232
- const fetchFirst = async (ref) => {
232
+ const fetchFirst = async (ref, signal) => {
233
233
  const urls = candidates(ref);
234
234
  for (let i = 0; i < urls.length; i++) {
235
235
  const url = urls[i];
236
- const res = await fetch(url);
236
+ const res = await fetch(url, signal ? { signal } : void 0);
237
237
  if (res.ok) return res;
238
238
  if (res.status !== 404 || i === urls.length - 1) throw new Error(`asset "${ref}": HTTP ${res.status} for ${url}`);
239
239
  }
240
240
  throw new Error(`asset "${ref}": no candidate URL`);
241
241
  };
242
242
  return {
243
- async load(ref) {
244
- return (await fetchFirst(ref)).arrayBuffer();
243
+ async load(ref, options) {
244
+ return (await fetchFirst(ref, options?.signal)).arrayBuffer();
245
245
  },
246
- async loadText(ref) {
247
- return (await fetchFirst(ref)).text();
246
+ async loadText(ref, options) {
247
+ return (await fetchFirst(ref, options?.signal)).text();
248
248
  }
249
249
  };
250
250
  }
@@ -1170,6 +1170,7 @@ function textureFrom(image, filter, srgb) {
1170
1170
  /** Upload a BakedMaterial's slots onto a MeshStandardMaterial. */
1171
1171
  function materialFromBaked(baked) {
1172
1172
  for (const image of Object.values(baked.slots)) if (image !== void 0) validateImage(image);
1173
+ if (baked.meta.alphaCoverage && (baked.meta.alphaTest !== void 0 || !baked.slots.baseColor)) throw new Error("alphaCoverage requires baseColor and cannot be combined with alphaTest");
1173
1174
  const material = new THREE.MeshStandardMaterial({
1174
1175
  roughness: 1,
1175
1176
  metalness: 1
@@ -1200,6 +1201,24 @@ function materialFromBaked(baked) {
1200
1201
  material.alphaTest = baked.meta.alphaTest;
1201
1202
  material.transparent = false;
1202
1203
  }
1204
+ if (baked.meta.alphaCoverage) {
1205
+ material.alphaTest = 0;
1206
+ material.transparent = true;
1207
+ material.depthWrite = false;
1208
+ for (const texture of [
1209
+ material.map,
1210
+ material.normalMap,
1211
+ material.roughnessMap,
1212
+ material.metalnessMap,
1213
+ material.emissiveMap,
1214
+ material.aoMap
1215
+ ]) {
1216
+ if (!texture || texture.magFilter === THREE.NearestFilter) continue;
1217
+ texture.generateMipmaps = true;
1218
+ texture.minFilter = THREE.LinearMipmapLinearFilter;
1219
+ texture.needsUpdate = true;
1220
+ }
1221
+ }
1203
1222
  return material;
1204
1223
  }
1205
1224
  const GREY = "#cccccc";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bendyline/molen-client",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -68,8 +68,8 @@
68
68
  ],
69
69
  "dependencies": {
70
70
  "zod": "^4.6.5",
71
- "@bendyline/molen-materials": "0.0.4",
72
- "@bendyline/molen-schema": "0.0.4"
71
+ "@bendyline/molen-materials": "0.0.6",
72
+ "@bendyline/molen-schema": "0.0.5"
73
73
  },
74
74
  "peerDependencies": {
75
75
  "@types/three": ">=0.184.0 <0.187.0",