Advanced
Architecture patterns
- Region layout: use
MemoryManagerto partition a SAB intovertices/indices/uvs/normalsand allocate with alignment (api/core/memory.ts:1). - Composite buffers:
SharedModelBuffercomputes segment sizes and exposes typed views (api/model/index.ts:1). - WASM math: offload numeric computation to Rust/WASM, keep data in typed views (
api/math/math.ts:1,src/math/mod.rs:1).
Concurrency & sync
- Atomics primitives:
Atomics.store/load/add/sub/compareExchange/wait/notifywithInt32Array. - Ring buffer idea: two atomic indices
head/tail, prefer power-of-two capacity for fast modulo. - Backpressure: block in Workers (or drop strategy) to avoid unbounded growth.
Avoid blocking
Atomics.waiton the browser main thread. Use it in Workers/Node, or prefer non-blocking designs.
