testing.fakeModelFromGlb ​

Contract 2.0.0 · package sha256 a857eca95b35921109faf997094bb4192f12527d9d0fcd4be7e97f06425bad6e · generated from testing.d.ts by services/onsite-scripter/scripts/build-contract-docs.mjs; edit the source, not this file.

Function · import { fakeModelFromGlb } from '@holostep-configurators/runtime-client/testing'; · labs, @experimental · since 2.0.0 · section 24. /testing

A FakeModel read from a GLB with no browser, so a test drives the fake with the product it ships instead of a hand-written tree: nodes in the scene's pre-order walk (a parent is its parent's authored name; a parent whose name another node shares gets an id, its authored one or its part id, _<n> when taken, and its children name it by that, so each child stays under its own parent, as on the runtime), each mesh's bounds (its primitives' POSITION bounds in its own frame), slot, uvChannels and doubleSided, skin joints as joint, connectors as manifestFromGlb reads them, clips with their lengths and animated nodes, variants from the file's KHR_materials_variants, stamped or not (so the fake checks MaterialSpec.variant as the runtime does), and manifest only when the GLB is stamped (the runtime's describe(node).manifest is null otherwise). Sync. Errors: throws HoloInputError ('invalid-input', path 'glb') when the bytes are no glTF 2.0 binary.

Declaration ​

ts
export function fakeModelFromGlb(glb: ArrayBuffer | Uint8Array): FakeModel;

Example ​

Imports: values (has, validate, the Holo*Error classes, the pure helpers) from @holostep-configurators/runtime-client, types from @holostep-configurators/runtime-client/contract, /math and /testing names from those entries; boot from the runtime module the root's loadRuntimeAtFloor resolves to. A type your page defines is your app's: declare it there, never import it from the package.

Compiled under the contract's strict settings (examples/declaration/24-fakeModelFromGlb.ts):

ts
import { createFakeSession, fakeModelFromGlb } from '@holostep-configurators/runtime-client/testing';
import type { IModelNode, Session } from '@holostep-configurators/runtime-client/contract';
declare const session: Session;
declare const signal: AbortSignal;
declare const glb: Uint8Array;                  // the shipped file's bytes
declare const unit: IModelNode;                 // glbUrl 'unit.glb'
const model = fakeModelFromGlb(glb);
export const meshes = model.nodes.filter((n) => n.mesh).map((n) => n.name); // the file's meshes
export const fake = createFakeSession({ models: { 'unit.glb': model }, root: [unit] });

Generic-API test (spec 3.1) ​

Rule Result
1. Neutral name pass: fakeModelFromGlb names no product
2. A precedent not recorded: no ledger row (coverage.json) names this member or its owner
3. Two apps, or labs labs (@experimental at a stable path, reached through has() or supports()): it graduates when a second app uses it
4. The cheaper fix first not recorded per member (Appendix B decides it per need)