Expand description
The one-call embedder facade: Loom.
crate::navigator::Navigator is the engine, but it asks you to thread a
WorldLoader through every call. Loom owns the loader for you: construct
it once with your renderer’s loader, open() a Locator, and pump
update(dt, player_pos) each frame. That’s the whole browser loop. Everything
a browser needs to decide — resolve, arm, veilwalk, focus — is inside; you
supply only how to draw (the loader) and where the player is.
use thread_engine::{Loom, WorldLoader};
use thread_engine::glam::Vec3;
let mut loom = Loom::new("worlds", my_loader);
loom.open("thread://pixygon.io", Vec3::ZERO);
loop {
if let Some(spawn) = loom.update(1.0 / 60.0, /* player_pos */ Vec3::ZERO) {
// teleport the player to `spawn`
}
// draw loom.portals(), react to loom.focused(pos), etc.
}Use this when your renderer’s loader can be owned by the engine (an embedded
view, a headless tool, a from-scratch browser). When the loader must borrow
shared renderer state per frame — as Infinite’s does, since its SceneRenderer
is shared with the rest of the app — drive Navigator directly instead and
pass a fresh loader each frame.
Structs§
- Loom
- A ready-to-pump browser core: a
Navigatorwired to an ownedWorldLoader.