Vehicle Generator 0.1.0 (alpha)
Procedural, game-ready vehicles for three.js: 13 body styles, blending, seeded random vehicles, three LODs, colliders, 13 parametric mods, paint and livery, a rig that drives, and GLB export that a game can load and drive. Ships with a studio (browser or Tauri desktop app) and a Play mode.
This commit is contained in:
commit
d8f3a6e3df
112 changed files with 17584 additions and 0 deletions
23
scripts/glb-node.ts
Normal file
23
scripts/glb-node.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
* GLTFExporter collects its binary output through `FileReader`, a browser API
|
||||
* bun does not have. This covers the one method the exporter calls. Import it
|
||||
* before anything that loads the exporter.
|
||||
*/
|
||||
class BunFileReader {
|
||||
result: ArrayBuffer | string | null = null
|
||||
onloadend: (() => void) | null = null
|
||||
onerror: ((error: unknown) => void) | null = null
|
||||
|
||||
readAsArrayBuffer(blob: Blob): void {
|
||||
// The exporter assigns `onloadend` after calling this, so resolve later.
|
||||
void blob.arrayBuffer().then(
|
||||
(buffer) => { this.result = buffer; this.onloadend?.() },
|
||||
(error) => { this.onerror?.(error) },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
const globals = globalThis as { FileReader?: unknown }
|
||||
globals.FileReader ??= BunFileReader
|
||||
|
||||
export {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue