| 1234567891011121314151617181920212223 |
- import { readFile } from 'node:fs/promises'
- import { fileURLToPath } from 'node:url'
- // Real Cesium math/events/data types; only GPU/terrain I/O are replaced at the adapter boundary.
- export async function resolve(specifier, context, nextResolve) {
- if (specifier !== 'cesium') return nextResolve(specifier, context)
- const real = await nextResolve(specifier, context)
- const code = `
- export * from ${JSON.stringify(real.url)};
- import { Event } from ${JSON.stringify(real.url)};
- export const Model = { async fromGltfAsync(options) {
- const gltf = await fetch(options.url).then(r=>r.json());
- const model = { options, gltf, readyEvent:new Event(), errorEvent:new Event(), destroyed:false,
- destroy(){this.destroyed=true}, isDestroyed(){return this.destroyed} };
- globalThis.t32Models.push(model);
- return model;
- } };
- export async function sampleTerrainMostDetailed(_, points) {
- return points.map(point=>{point.height=globalThis.t32TerrainFails?undefined:100;return point});
- }
- `
- return { url:'data:text/javascript,'+encodeURIComponent(code), shortCircuit:true }
- }
|